Authored by zhaojun2

add id search

@@ -38,6 +38,7 @@ public class ProductSearchController { @@ -38,6 +38,7 @@ public class ProductSearchController {
38 public ApiResponse searchProductList( 38 public ApiResponse searchProductList(
39 @RequestParam(value = "type", required = false)Integer type, 39 @RequestParam(value = "type", required = false)Integer type,
40 @RequestParam(value = "order", required = false)String order, 40 @RequestParam(value = "order", required = false)String order,
  41 + @RequestParam(value = "product_id", required = false)String id,
41 @RequestParam(value = "productPool", required = false) String productPool, 42 @RequestParam(value = "productPool", required = false) String productPool,
42 @RequestParam(value = "sort", required = false)String sort, 43 @RequestParam(value = "sort", required = false)String sort,
43 @RequestParam(value = "brand", required = false)String brand, 44 @RequestParam(value = "brand", required = false)String brand,
@@ -50,8 +51,8 @@ public class ProductSearchController { @@ -50,8 +51,8 @@ public class ProductSearchController {
50 @RequestParam(value = "page", required = false)Integer page 51 @RequestParam(value = "page", required = false)Integer page
51 ) { 52 ) {
52 SortIdLevel sortIdLevel = productSearchService.getSortLevelById(sort); 53 SortIdLevel sortIdLevel = productSearchService.getSortLevelById(sort);
53 - ProductSearchReq req = new ProductSearchReq().setOrder(order).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId())  
54 - .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page); 54 + ProductSearchReq req = new ProductSearchReq().setOrder(order).setId(id).setPool(productPool).setBrand(brand).setMidSort(sortIdLevel.getMidSortId()).setMaxSort(sortIdLevel.getMaxSortId())
  55 + .setSeries(series).setGender(gender).setSize(size).setIsSoonSale(isSoonSale).setViewNum(limit).setPage(page).setIsIdFilter(type);
55 searchHelpService.setQuery(query, req); 56 searchHelpService.setQuery(query, req);
56 LOG.info("in method=ufo.product.search.list req={}", req.toString()); 57 LOG.info("in method=ufo.product.search.list req={}", req.toString());
57 58
@@ -14,7 +14,10 @@ public final class SearchConstants { @@ -14,7 +14,10 @@ public final class SearchConstants {
14 /** 14 /**
15 * 品牌ID查多个品牌以逗号分隔 15 * 品牌ID查多个品牌以逗号分隔
16 */ 16 */
17 - String BRAND_ID = "brand"; 17 + String PRODUCT_ID = "id";
  18 +
  19 + String PRODUCT_ID_FILTER = "isIdFilter";
  20 +
18 21
19 /** 22 /**
20 * 性别1-男,2-女,3-通用 23 * 性别1-男,2-女,3-通用
@@ -44,7 +44,7 @@ public class SearchParam { @@ -44,7 +44,7 @@ public class SearchParam {
44 setOrder(req.getOrder()).setBrand(req.getBrand()).setSize(req.getSize()) 44 setOrder(req.getOrder()).setBrand(req.getBrand()).setSize(req.getSize())
45 .setMaxSort(req.getMaxSort()).setMidSort(req.getMidSort()) 45 .setMaxSort(req.getMaxSort()).setMidSort(req.getMidSort())
46 .setQuery(req.getQuery()).setSoonSale(req.getIsSoonSale()) 46 .setQuery(req.getQuery()).setSoonSale(req.getIsSoonSale())
47 - .setProductPool(req.getPool()) 47 + .setProductPool(req.getPool()).setId(req.getId()).setIdFilter(req.getIsIdFilter())
48 .setViewNum(req.getViewNum()).setPage(req.getPage()) 48 .setViewNum(req.getViewNum()).setPage(req.getPage())
49 .setBrandSeries(req.getSeries()).setGender(req.getGender()); 49 .setBrandSeries(req.getSeries()).setGender(req.getGender());
50 return this; 50 return this;
@@ -117,6 +117,20 @@ public class SearchParam { @@ -117,6 +117,20 @@ public class SearchParam {
117 } 117 }
118 118
119 119
  120 + public SearchParam setId(String id) {
  121 + if (StringUtils.isNotEmpty(id)) {
  122 + param.put(SearchConstants.IndexNameConstant.PRODUCT_ID, id);
  123 + }
  124 + return this;
  125 + }
  126 +
  127 + public SearchParam setIdFilter(String idFilter) {
  128 + if (StringUtils.isNotEmpty(idFilter)) {
  129 + param.put(SearchConstants.IndexNameConstant.PRODUCT_ID_FILTER, idFilter);
  130 + }
  131 + return this;
  132 + }
  133 +
120 public SearchParam setProductPool(String productPool) { 134 public SearchParam setProductPool(String productPool) {
121 if (StringUtils.isNotEmpty(productPool)) { 135 if (StringUtils.isNotEmpty(productPool)) {
122 param.put(SearchConstants.IndexNameConstant.PRODUCT_POOL, productPool); 136 param.put(SearchConstants.IndexNameConstant.PRODUCT_POOL, productPool);
@@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; @@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
4 4
5 public class ProductSearchReq { 5 public class ProductSearchReq {
6 6
7 - private Integer id; 7 + private String id;
8 private Integer viewNum; 8 private Integer viewNum;
9 private Integer page; 9 private Integer page;
10 private String query; 10 private String query;
@@ -18,6 +18,7 @@ public class ProductSearchReq { @@ -18,6 +18,7 @@ public class ProductSearchReq {
18 private String order; 18 private String order;
19 private String isSoonSale; //Y saletime查了大于now的 19 private String isSoonSale; //Y saletime查了大于now的
20 private String not_id; 20 private String not_id;
  21 + private String isIdFilter;
21 22
22 23
23 @Override 24 @Override
@@ -36,15 +37,17 @@ public class ProductSearchReq { @@ -36,15 +37,17 @@ public class ProductSearchReq {
36 .append("pool", pool) 37 .append("pool", pool)
37 .append("isSoonSale", isSoonSale) 38 .append("isSoonSale", isSoonSale)
38 .append("not_id", not_id) 39 .append("not_id", not_id)
  40 + .append("id", id)
  41 + .append("isIdFilter", isIdFilter)
39 .toString(); 42 .toString();
40 } 43 }
41 44
42 45
43 - public Integer getId() { 46 + public String getId() {
44 return id; 47 return id;
45 } 48 }
46 49
47 - public ProductSearchReq setId(Integer id) { 50 + public ProductSearchReq setId(String id) {
48 this.id = id; 51 this.id = id;
49 return this; 52 return this;
50 } 53 }
@@ -167,4 +170,14 @@ public class ProductSearchReq { @@ -167,4 +170,14 @@ public class ProductSearchReq {
167 return this; 170 return this;
168 } 171 }
169 172
  173 + public String getIsIdFilter() {
  174 + return isIdFilter;
  175 + }
  176 +
  177 + public ProductSearchReq setIsIdFilter(Integer type) {
  178 + if (type != null && type.equals(Integer.valueOf(7))) {
  179 + this.isIdFilter = "Y";
  180 + }
  181 + return this;
  182 + }
170 } 183 }