Authored by zhaojun2

add id search

... ... @@ -38,6 +38,7 @@ public class ProductSearchController {
public ApiResponse searchProductList(
@RequestParam(value = "type", required = false)Integer type,
@RequestParam(value = "order", required = false)String order,
@RequestParam(value = "product_id", required = false)String id,
@RequestParam(value = "productPool", required = false) String productPool,
@RequestParam(value = "sort", required = false)String sort,
@RequestParam(value = "brand", required = false)String brand,
... ... @@ -50,8 +51,8 @@ public class ProductSearchController {
@RequestParam(value = "page", required = false)Integer page
) {
SortIdLevel sortIdLevel = productSearchService.getSortLevelById(sort);
ProductSearchReq req = new ProductSearchReq().setOrder(order).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId())
.setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page);
ProductSearchReq req = new ProductSearchReq().setOrder(order).setId(id).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId())
.setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page).setIsIdFilter(type);
searchHelpService.setQuery(query, req);
LOG.info("in method=ufo.product.search.list req={}", req.toString());
... ...
... ... @@ -14,7 +14,10 @@ public final class SearchConstants {
/**
* 品牌ID查多个品牌以逗号分隔
*/
String BRAND_ID = "brand";
String PRODUCT_ID = "id";
String PRODUCT_ID_FILTER = "isIdFilter";
/**
* 性别1-男,2-女,3-通用
... ...
... ... @@ -44,7 +44,7 @@ public class SearchParam {
setOrder(req.getOrder()).setBrand(req.getBrand()).setSize(req.getSize())
.setMaxSort(req.getMaxSort()).setMidSort(req.getMidSort())
.setQuery(req.getQuery()).setSoonSale(req.getIsSoonSale())
.setProductPool(req.getPool())
.setProductPool(req.getPool()).setId(req.getId()).setIdFilter(req.getIsIdFilter())
.setViewNum(req.getViewNum()).setPage(req.getPage())
.setBrandSeries(req.getSeries()).setGender(req.getGender());
return this;
... ... @@ -117,6 +117,20 @@ public class SearchParam {
}
public SearchParam setId(String id) {
if (StringUtils.isNotEmpty(id)) {
param.put(SearchConstants.IndexNameConstant.PRODUCT_ID, id);
}
return this;
}
public SearchParam setIdFilter(String idFilter) {
if (StringUtils.isNotEmpty(idFilter)) {
param.put(SearchConstants.IndexNameConstant.PRODUCT_ID_FILTER, idFilter);
}
return this;
}
public SearchParam setProductPool(String productPool) {
if (StringUtils.isNotEmpty(productPool)) {
param.put(SearchConstants.IndexNameConstant.PRODUCT_POOL, productPool);
... ...
... ... @@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
public class ProductSearchReq {
private Integer id;
private String id;
private Integer viewNum;
private Integer page;
private String query;
... ... @@ -18,6 +18,7 @@ public class ProductSearchReq {
private String order;
private String isSoonSale; //Y saletime查了大于now的
private String not_id;
private String isIdFilter;
@Override
... ... @@ -36,15 +37,17 @@ public class ProductSearchReq {
.append("pool", pool)
.append("isSoonSale", isSoonSale)
.append("not_id", not_id)
.append("id", id)
.append("isIdFilter", isIdFilter)
.toString();
}
public Integer getId() {
public String getId() {
return id;
}
public ProductSearchReq setId(Integer id) {
public ProductSearchReq setId(String id) {
this.id = id;
return this;
}
... ... @@ -167,4 +170,14 @@ public class ProductSearchReq {
return this;
}
public String getIsIdFilter() {
return isIdFilter;
}
public ProductSearchReq setIsIdFilter(Integer type) {
if (type != null && type.equals(Integer.valueOf(7))) {
this.isIdFilter = "Y";
}
return this;
}
}
... ...