Authored by hugufei

拆包

Showing 19 changed files with 132 additions and 89 deletions
@@ -5,7 +5,8 @@ import com.yoho.search.aop.downgrade.PersionalRateLimit; @@ -5,7 +5,8 @@ import com.yoho.search.aop.downgrade.PersionalRateLimit;
5 import com.yoho.search.common.utils.HttpServletRequestUtils; 5 import com.yoho.search.common.utils.HttpServletRequestUtils;
6 import com.yoho.search.models.SearchApiResult; 6 import com.yoho.search.models.SearchApiResult;
7 import com.yoho.search.service.scene.list.ProductListSwitchService; 7 import com.yoho.search.service.scene.list.ProductListSwitchService;
8 -import com.yoho.search.service.scene.guang.ProductListService; 8 +import com.yoho.search.service.scene.guang.ProductListWithPhraseService;
  9 +import com.yoho.search.service.scene.tools.ProductListDslService;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Controller; 11 import org.springframework.stereotype.Controller;
11 import org.springframework.web.bind.annotation.RequestBody; 12 import org.springframework.web.bind.annotation.RequestBody;
@@ -21,7 +22,7 @@ import java.util.Map; @@ -21,7 +22,7 @@ import java.util.Map;
21 public class ProductListController { 22 public class ProductListController {
22 23
23 @Autowired 24 @Autowired
24 - private ProductListService productListService; 25 + private ProductListWithPhraseService productListWithPhraseService;
25 @Autowired 26 @Autowired
26 private ProductListSwitchService productListSwitchService; 27 private ProductListSwitchService productListSwitchService;
27 28
@@ -61,7 +62,7 @@ public class ProductListController { @@ -61,7 +62,7 @@ public class ProductListController {
61 public SearchApiResult productListWithPhrase(HttpServletRequest request) { 62 public SearchApiResult productListWithPhrase(HttpServletRequest request) {
62 Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request); 63 Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
63 paramMap.remove("uid"); 64 paramMap.remove("uid");
64 - return productListService.productListWithPhrase(paramMap); 65 + return productListWithPhraseService.productListWithPhrase(paramMap);
65 } 66 }
66 67
67 private Map<String, String> getParamMap(JSONObject param) { 68 private Map<String, String> getParamMap(JSONObject param) {
@@ -77,16 +78,4 @@ public class ProductListController { @@ -77,16 +78,4 @@ public class ProductListController {
77 return paramMap; 78 return paramMap;
78 } 79 }
79 80
80 - /**  
81 - * 打印获取商品列表的ES的dsl的工具接口  
82 - *  
83 - * @return  
84 - */  
85 - @RequestMapping(method = RequestMethod.GET, value = "/dsl/productList")  
86 - @ResponseBody  
87 - public SearchApiResult getESDsl(HttpServletRequest request) {  
88 - Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);  
89 - return productListService.getESDsl(paramMap);  
90 - }  
91 -  
92 } 81 }
  1 +package com.yoho.search.restapi.tools;
  2 +
  3 +import com.yoho.search.common.utils.HttpServletRequestUtils;
  4 +import com.yoho.search.models.SearchApiResult;
  5 +import com.yoho.search.service.scene.tools.ProductListDslService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.ResponseBody;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import javax.servlet.http.HttpServletRequest;
  13 +import java.util.Map;
  14 +
  15 +@RestController
  16 +public class ProductListDslController {
  17 +
  18 + @Autowired
  19 + private ProductListDslService productListDslService;
  20 +
  21 + /**
  22 + * 打印获取商品列表的ES的dsl的工具接口
  23 + *
  24 + * @return
  25 + */
  26 + @RequestMapping(method = RequestMethod.GET, value = "/dsl/productList")
  27 + @ResponseBody
  28 + public SearchApiResult getESDsl(HttpServletRequest request) {
  29 + Map<String, String> paramMap = HttpServletRequestUtils.transParamType(request);
  30 + return productListDslService.getESDsl(paramMap);
  31 + }
  32 +}
@@ -6,8 +6,8 @@ import com.yoho.search.models.SearchApiResult; @@ -6,8 +6,8 @@ import com.yoho.search.models.SearchApiResult;
6 import com.yoho.search.common.SearchRequestParams; 6 import com.yoho.search.common.SearchRequestParams;
7 import com.yoho.search.service.scene.list.ProductListSwitchService; 7 import com.yoho.search.service.scene.list.ProductListSwitchService;
8 import com.yoho.search.service.scene.common.AbstractSceneService; 8 import com.yoho.search.service.scene.common.AbstractSceneService;
9 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
10 -import com.yoho.search.service.scene.common.SceneSelectionsService; 9 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  10 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
11 import org.apache.commons.lang3.StringUtils; 11 import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 13 import org.slf4j.LoggerFactory;
@@ -26,7 +26,7 @@ public class BrandSceneService extends AbstractSceneService { @@ -26,7 +26,7 @@ public class BrandSceneService extends AbstractSceneService {
26 @Autowired 26 @Autowired
27 private SceneSelectionsService sceneSelectionsService; 27 private SceneSelectionsService sceneSelectionsService;
28 @Autowired 28 @Autowired
29 - private SceneRecommendBrandsService sceneRecommendBrandsService; 29 + private RecommendBrandsService recommendBrandsService;
30 30
31 @Override 31 @Override
32 public String pageId() { 32 public String pageId() {
@@ -66,7 +66,7 @@ public class BrandSceneService extends AbstractSceneService { @@ -66,7 +66,7 @@ public class BrandSceneService extends AbstractSceneService {
66 this.addParamsToParamMap(paramMap); 66 this.addParamsToParamMap(paramMap);
67 // 2、返回聚合结果 67 // 2、返回聚合结果
68 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 68 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
69 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 69 + recommendBrandsService.getRecommendBrands(paramMap, result);
70 return result; 70 return result;
71 } catch (Exception e) { 71 } catch (Exception e) {
72 logger.error("[func=BrandAggregations][params=" + paramMap + "]", e); 72 logger.error("[func=BrandAggregations][params=" + paramMap + "]", e);
@@ -18,8 +18,8 @@ import com.yoho.search.service.index.SizeIndexBaseService; @@ -18,8 +18,8 @@ import com.yoho.search.service.index.SizeIndexBaseService;
18 import com.yoho.search.service.helper.SearchParamHelper; 18 import com.yoho.search.service.helper.SearchParamHelper;
19 import com.yoho.search.service.scene.list.ProductListSwitchService; 19 import com.yoho.search.service.scene.list.ProductListSwitchService;
20 import com.yoho.search.service.scene.common.AbstractSceneService; 20 import com.yoho.search.service.scene.common.AbstractSceneService;
21 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
22 -import com.yoho.search.service.scene.common.SceneSelectionsService; 21 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  22 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
23 import org.elasticsearch.search.SearchHit; 23 import org.elasticsearch.search.SearchHit;
24 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; 24 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
25 import org.elasticsearch.search.aggregations.Aggregation; 25 import org.elasticsearch.search.aggregations.Aggregation;
@@ -53,7 +53,7 @@ public class BreakSizeSceneService extends AbstractSceneService { @@ -53,7 +53,7 @@ public class BreakSizeSceneService extends AbstractSceneService {
53 @Autowired 53 @Autowired
54 private SceneSelectionsService sceneSelectionsService; 54 private SceneSelectionsService sceneSelectionsService;
55 @Autowired 55 @Autowired
56 - private SceneRecommendBrandsService sceneRecommendBrandsService; 56 + private RecommendBrandsService recommendBrandsService;
57 57
58 /** 58 /**
59 * 为断码区添加默认的过滤条件 59 * 为断码区添加默认的过滤条件
@@ -92,7 +92,7 @@ public class BreakSizeSceneService extends AbstractSceneService { @@ -92,7 +92,7 @@ public class BreakSizeSceneService extends AbstractSceneService {
92 // 2、返回聚合结果 92 // 2、返回聚合结果
93 List<IAggregation> aggregation = sceneSelectionsService.getBreakSizeAggregations(paramMap); 93 List<IAggregation> aggregation = sceneSelectionsService.getBreakSizeAggregations(paramMap);
94 SearchApiResult result = sceneSelectionsService.aggregations(paramMap, aggregation); 94 SearchApiResult result = sceneSelectionsService.aggregations(paramMap, aggregation);
95 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 95 + recommendBrandsService.getRecommendBrands(paramMap, result);
96 return result; 96 return result;
97 } catch (Exception e) { 97 } catch (Exception e) {
98 logger.error("[func=Couponaggregations][params=" + paramMap + "]", e); 98 logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);
@@ -8,8 +8,8 @@ import com.yoho.search.service.scene.img.SknImgsResponse; @@ -8,8 +8,8 @@ import com.yoho.search.service.scene.img.SknImgsResponse;
8 import com.yoho.search.common.SearchRequestParams; 8 import com.yoho.search.common.SearchRequestParams;
9 import com.yoho.search.service.scene.list.ProductListSwitchService; 9 import com.yoho.search.service.scene.list.ProductListSwitchService;
10 import com.yoho.search.service.scene.common.AbstractSceneService; 10 import com.yoho.search.service.scene.common.AbstractSceneService;
11 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
12 -import com.yoho.search.service.scene.common.SceneSelectionsService; 11 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  12 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
13 import com.yoho.search.service.scene.img.SknImgsCacheBean; 13 import com.yoho.search.service.scene.img.SknImgsCacheBean;
14 import org.apache.commons.lang3.StringUtils; 14 import org.apache.commons.lang3.StringUtils;
15 import org.slf4j.Logger; 15 import org.slf4j.Logger;
@@ -30,7 +30,7 @@ public class CommonSceneService extends AbstractSceneService { @@ -30,7 +30,7 @@ public class CommonSceneService extends AbstractSceneService {
30 @Autowired 30 @Autowired
31 private SceneSelectionsService sceneSelectionsService; 31 private SceneSelectionsService sceneSelectionsService;
32 @Autowired 32 @Autowired
33 - private SceneRecommendBrandsService sceneRecommendBrandsService; 33 + private RecommendBrandsService recommendBrandsService;
34 @Autowired 34 @Autowired
35 private SknImgsCacheBean sknImgsCacheBean; 35 private SknImgsCacheBean sknImgsCacheBean;
36 36
@@ -64,7 +64,7 @@ public class CommonSceneService extends AbstractSceneService { @@ -64,7 +64,7 @@ public class CommonSceneService extends AbstractSceneService {
64 this.addParamsToParamMap(paramMap); 64 this.addParamsToParamMap(paramMap);
65 // 2、返回聚合结果 65 // 2、返回聚合结果
66 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 66 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
67 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 67 + recommendBrandsService.getRecommendBrands(paramMap, result);
68 return result; 68 return result;
69 } catch (Exception e) { 69 } catch (Exception e) {
70 logger.error("[func=Couponaggregations][params=" + paramMap + "]", e); 70 logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);
@@ -5,8 +5,8 @@ import com.yoho.search.common.utils.SearchApiResultUtils; @@ -5,8 +5,8 @@ import com.yoho.search.common.utils.SearchApiResultUtils;
5 import com.yoho.search.models.SearchApiResult; 5 import com.yoho.search.models.SearchApiResult;
6 import com.yoho.search.service.scene.list.ProductListSwitchService; 6 import com.yoho.search.service.scene.list.ProductListSwitchService;
7 import com.yoho.search.service.scene.common.AbstractSceneService; 7 import com.yoho.search.service.scene.common.AbstractSceneService;
8 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
9 -import com.yoho.search.service.scene.common.SceneSelectionsService; 8 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  9 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
10 import org.slf4j.Logger; 10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +24,7 @@ public class CouponSceneService extends AbstractSceneService { @@ -24,7 +24,7 @@ public class CouponSceneService extends AbstractSceneService {
24 @Autowired 24 @Autowired
25 private SceneSelectionsService sceneSelectionsService; 25 private SceneSelectionsService sceneSelectionsService;
26 @Autowired 26 @Autowired
27 - private SceneRecommendBrandsService sceneRecommendBrandsService; 27 + private RecommendBrandsService recommendBrandsService;
28 28
29 @Override 29 @Override
30 public String pageId() { 30 public String pageId() {
@@ -57,7 +57,7 @@ public class CouponSceneService extends AbstractSceneService { @@ -57,7 +57,7 @@ public class CouponSceneService extends AbstractSceneService {
57 this.addParamsToParamMap(paramMap); 57 this.addParamsToParamMap(paramMap);
58 // 2、返回聚合结果 58 // 2、返回聚合结果
59 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 59 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
60 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 60 + recommendBrandsService.getRecommendBrands(paramMap, result);
61 return result; 61 return result;
62 } catch (Exception e) { 62 } catch (Exception e) {
63 logger.error("[func=Couponaggregations][params=" + paramMap + "]", e); 63 logger.error("[func=Couponaggregations][params=" + paramMap + "]", e);
@@ -4,7 +4,7 @@ import java.util.Date; @@ -4,7 +4,7 @@ import java.util.Date;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5 import java.util.Map;
6 6
7 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService; 7 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
8 import org.slf4j.Logger; 8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
10 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,7 +18,7 @@ import com.yoho.search.models.SearchApiResult; @@ -18,7 +18,7 @@ import com.yoho.search.models.SearchApiResult;
18 import com.yoho.search.common.SearchRequestParams; 18 import com.yoho.search.common.SearchRequestParams;
19 import com.yoho.search.service.scene.common.AbstractSceneService; 19 import com.yoho.search.service.scene.common.AbstractSceneService;
20 import com.yoho.search.service.scene.list.ProductListSwitchService; 20 import com.yoho.search.service.scene.list.ProductListSwitchService;
21 -import com.yoho.search.service.scene.common.SceneSelectionsService; 21 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
22 22
23 @Service 23 @Service
24 public class NewArrivalSceneService extends AbstractSceneService { 24 public class NewArrivalSceneService extends AbstractSceneService {
@@ -30,7 +30,7 @@ public class NewArrivalSceneService extends AbstractSceneService { @@ -30,7 +30,7 @@ public class NewArrivalSceneService extends AbstractSceneService {
30 @Autowired 30 @Autowired
31 private SceneSelectionsService sceneSelectionsService; 31 private SceneSelectionsService sceneSelectionsService;
32 @Autowired 32 @Autowired
33 - private SceneRecommendBrandsService sceneRecommendBrandsService; 33 + private RecommendBrandsService recommendBrandsService;
34 34
35 @Override 35 @Override
36 public String pageId() { 36 public String pageId() {
@@ -66,7 +66,7 @@ public class NewArrivalSceneService extends AbstractSceneService { @@ -66,7 +66,7 @@ public class NewArrivalSceneService extends AbstractSceneService {
66 this.addParamsToParamMap(paramMap); 66 this.addParamsToParamMap(paramMap);
67 // 2、返回聚合结果 67 // 2、返回聚合结果
68 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 68 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
69 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 69 + recommendBrandsService.getRecommendBrands(paramMap, result);
70 return result; 70 return result;
71 } catch (Exception e) { 71 } catch (Exception e) {
72 logger.error("[func=NewArrivalAggregations][params=" + paramMap + "]", e); 72 logger.error("[func=NewArrivalAggregations][params=" + paramMap + "]", e);
@@ -2,7 +2,7 @@ package com.yoho.search.service.scene; @@ -2,7 +2,7 @@ package com.yoho.search.service.scene;
2 2
3 import java.util.Map; 3 import java.util.Map;
4 4
5 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService; 5 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
6 import org.apache.commons.lang.StringUtils; 6 import org.apache.commons.lang.StringUtils;
7 import org.slf4j.Logger; 7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
@@ -15,7 +15,7 @@ import com.yoho.search.models.SearchApiResult; @@ -15,7 +15,7 @@ import com.yoho.search.models.SearchApiResult;
15 import com.yoho.search.common.SearchRequestParams; 15 import com.yoho.search.common.SearchRequestParams;
16 import com.yoho.search.service.scene.common.AbstractSceneService; 16 import com.yoho.search.service.scene.common.AbstractSceneService;
17 import com.yoho.search.service.scene.list.ProductListSwitchService; 17 import com.yoho.search.service.scene.list.ProductListSwitchService;
18 -import com.yoho.search.service.scene.common.SceneSelectionsService; 18 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
19 19
20 @Service 20 @Service
21 public class ProductPoolSceneService extends AbstractSceneService { 21 public class ProductPoolSceneService extends AbstractSceneService {
@@ -27,7 +27,7 @@ public class ProductPoolSceneService extends AbstractSceneService { @@ -27,7 +27,7 @@ public class ProductPoolSceneService extends AbstractSceneService {
27 @Autowired 27 @Autowired
28 private SceneSelectionsService sceneSelectionsService; 28 private SceneSelectionsService sceneSelectionsService;
29 @Autowired 29 @Autowired
30 - private SceneRecommendBrandsService sceneRecommendBrandsService; 30 + private RecommendBrandsService recommendBrandsService;
31 31
32 /** 32 /**
33 * 33 *
@@ -91,7 +91,7 @@ public class ProductPoolSceneService extends AbstractSceneService { @@ -91,7 +91,7 @@ public class ProductPoolSceneService extends AbstractSceneService {
91 try { 91 try {
92 this.addParamsToParamMap(paramMap); 92 this.addParamsToParamMap(paramMap);
93 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 93 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
94 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 94 + recommendBrandsService.getRecommendBrands(paramMap, result);
95 return result; 95 return result;
96 } catch (Exception e) { 96 } catch (Exception e) {
97 logger.error("[func=PoolAggregations][params=" + paramMap + "]", e); 97 logger.error("[func=PoolAggregations][params=" + paramMap + "]", e);
@@ -17,7 +17,7 @@ import com.yoho.search.models.SearchApiResult; @@ -17,7 +17,7 @@ import com.yoho.search.models.SearchApiResult;
17 import com.yoho.search.common.SearchRequestParams; 17 import com.yoho.search.common.SearchRequestParams;
18 import com.yoho.search.service.scene.common.AbstractSceneService; 18 import com.yoho.search.service.scene.common.AbstractSceneService;
19 import com.yoho.search.service.scene.list.ProductListSwitchService; 19 import com.yoho.search.service.scene.list.ProductListSwitchService;
20 -import com.yoho.search.service.scene.common.SceneSelectionsService; 20 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
21 21
22 @Service 22 @Service
23 public class ReducePriceSceneService extends AbstractSceneService { 23 public class ReducePriceSceneService extends AbstractSceneService {
@@ -3,7 +3,7 @@ package com.yoho.search.service.scene; @@ -3,7 +3,7 @@ package com.yoho.search.service.scene;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService; 6 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
7 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
8 import org.slf4j.Logger; 8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
@@ -17,7 +17,7 @@ import com.yoho.search.models.SearchApiResult; @@ -17,7 +17,7 @@ import com.yoho.search.models.SearchApiResult;
17 import com.yoho.search.common.SearchRequestParams; 17 import com.yoho.search.common.SearchRequestParams;
18 import com.yoho.search.service.scene.common.AbstractSceneService; 18 import com.yoho.search.service.scene.common.AbstractSceneService;
19 import com.yoho.search.service.scene.list.ProductListSwitchService; 19 import com.yoho.search.service.scene.list.ProductListSwitchService;
20 -import com.yoho.search.service.scene.common.SceneSelectionsService; 20 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
21 21
22 @Service 22 @Service
23 public class ShopSceneService extends AbstractSceneService { 23 public class ShopSceneService extends AbstractSceneService {
@@ -29,7 +29,7 @@ public class ShopSceneService extends AbstractSceneService { @@ -29,7 +29,7 @@ public class ShopSceneService extends AbstractSceneService {
29 @Autowired 29 @Autowired
30 private SceneSelectionsService sceneSelectionsService; 30 private SceneSelectionsService sceneSelectionsService;
31 @Autowired 31 @Autowired
32 - private SceneRecommendBrandsService sceneRecommendBrandsService; 32 + private RecommendBrandsService recommendBrandsService;
33 33
34 @Override 34 @Override
35 public String pageId() { 35 public String pageId() {
@@ -69,7 +69,7 @@ public class ShopSceneService extends AbstractSceneService { @@ -69,7 +69,7 @@ public class ShopSceneService extends AbstractSceneService {
69 this.addParamsToParamMap(paramMap); 69 this.addParamsToParamMap(paramMap);
70 // 2、返回聚合结果 70 // 2、返回聚合结果
71 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 71 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
72 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 72 + recommendBrandsService.getRecommendBrands(paramMap, result);
73 return result; 73 return result;
74 } catch (Exception e) { 74 } catch (Exception e) {
75 logger.error("[func=ShopAggregations][params=" + paramMap + "]", e); 75 logger.error("[func=ShopAggregations][params=" + paramMap + "]", e);
@@ -7,8 +7,8 @@ import com.yoho.search.common.SearchRequestParams; @@ -7,8 +7,8 @@ import com.yoho.search.common.SearchRequestParams;
7 import com.yoho.search.service.scene.list.ProductListSwitchService; 7 import com.yoho.search.service.scene.list.ProductListSwitchService;
8 import com.yoho.search.service.scene.aggregations.SceneAggregationsHelper; 8 import com.yoho.search.service.scene.aggregations.SceneAggregationsHelper;
9 import com.yoho.search.service.scene.common.AbstractSceneService; 9 import com.yoho.search.service.scene.common.AbstractSceneService;
10 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
11 -import com.yoho.search.service.scene.common.SceneSelectionsService; 10 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  11 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
12 import org.apache.commons.lang.StringUtils; 12 import org.apache.commons.lang.StringUtils;
13 import org.slf4j.Logger; 13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
@@ -32,7 +32,7 @@ public class SortSceneService extends AbstractSceneService { @@ -32,7 +32,7 @@ public class SortSceneService extends AbstractSceneService {
32 @Autowired 32 @Autowired
33 private SceneAggregationsHelper sceneAggregationsHelper; 33 private SceneAggregationsHelper sceneAggregationsHelper;
34 @Autowired 34 @Autowired
35 - private SceneRecommendBrandsService sceneRecommendBrandsService; 35 + private RecommendBrandsService recommendBrandsService;
36 36
37 @Override 37 @Override
38 public String pageId() { 38 public String pageId() {
@@ -112,7 +112,7 @@ public class SortSceneService extends AbstractSceneService { @@ -112,7 +112,7 @@ public class SortSceneService extends AbstractSceneService {
112 this.addParamsToParamMap(paramMap); 112 this.addParamsToParamMap(paramMap);
113 // 2、返回聚合结果 113 // 2、返回聚合结果
114 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 114 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
115 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 115 + recommendBrandsService.getRecommendBrands(paramMap, result);
116 return result; 116 return result;
117 } catch (Exception e) { 117 } catch (Exception e) {
118 logger.error(e.getMessage(), e); 118 logger.error(e.getMessage(), e);
@@ -2,7 +2,7 @@ package com.yoho.search.service.scene; @@ -2,7 +2,7 @@ package com.yoho.search.service.scene;
2 2
3 import java.util.Map; 3 import java.util.Map;
4 4
5 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService; 5 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
6 import org.apache.commons.lang.StringUtils; 6 import org.apache.commons.lang.StringUtils;
7 import org.slf4j.Logger; 7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
@@ -15,7 +15,7 @@ import com.yoho.search.models.SearchApiResult; @@ -15,7 +15,7 @@ import com.yoho.search.models.SearchApiResult;
15 import com.yoho.search.common.SearchRequestParams; 15 import com.yoho.search.common.SearchRequestParams;
16 import com.yoho.search.service.scene.common.AbstractSceneService; 16 import com.yoho.search.service.scene.common.AbstractSceneService;
17 import com.yoho.search.service.scene.list.ProductListSwitchService; 17 import com.yoho.search.service.scene.list.ProductListSwitchService;
18 -import com.yoho.search.service.scene.common.SceneSelectionsService; 18 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
19 19
20 @Service 20 @Service
21 public class ZqSceneService extends AbstractSceneService { 21 public class ZqSceneService extends AbstractSceneService {
@@ -27,7 +27,7 @@ public class ZqSceneService extends AbstractSceneService { @@ -27,7 +27,7 @@ public class ZqSceneService extends AbstractSceneService {
27 @Autowired 27 @Autowired
28 private SceneSelectionsService sceneSelectionsService; 28 private SceneSelectionsService sceneSelectionsService;
29 @Autowired 29 @Autowired
30 - private SceneRecommendBrandsService sceneRecommendBrandsService; 30 + private RecommendBrandsService recommendBrandsService;
31 31
32 @Override 32 @Override
33 public String pageId() { 33 public String pageId() {
@@ -67,7 +67,7 @@ public class ZqSceneService extends AbstractSceneService { @@ -67,7 +67,7 @@ public class ZqSceneService extends AbstractSceneService {
67 this.addParamsToParamMap(paramMap); 67 this.addParamsToParamMap(paramMap);
68 // 2、返回聚合结果 68 // 2、返回聚合结果
69 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 69 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
70 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 70 + recommendBrandsService.getRecommendBrands(paramMap, result);
71 return result; 71 return result;
72 } catch (Exception e) { 72 } catch (Exception e) {
73 logger.error("[func=zqProductList][params=" + paramMap + "]", e); 73 logger.error("[func=zqProductList][params=" + paramMap + "]", e);
1 -package com.yoho.search.service.scene.common; 1 +package com.yoho.search.service.scene.aggregations;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.yoho.search.base.utils.ISearchConstants; 4 import com.yoho.search.base.utils.ISearchConstants;
1 -package com.yoho.search.service.scene.common; 1 +package com.yoho.search.service.scene.brandshop;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
@@ -19,7 +19,7 @@ import java.util.function.Function; @@ -19,7 +19,7 @@ import java.util.function.Function;
19 import java.util.stream.Collectors; 19 import java.util.stream.Collectors;
20 20
21 @Service 21 @Service
22 -public class SceneRecommendBrandsService { 22 +public class RecommendBrandsService {
23 23
24 @Autowired 24 @Autowired
25 private UserPersionalFactorComponent userPersionalFactorComponent; 25 private UserPersionalFactorComponent userPersionalFactorComponent;
@@ -11,8 +11,8 @@ import com.yoho.search.service.helper.SearchKeyWordHelper; @@ -11,8 +11,8 @@ import com.yoho.search.service.helper.SearchKeyWordHelper;
11 import com.yoho.search.service.scene.list.ProductListSwitchService; 11 import com.yoho.search.service.scene.list.ProductListSwitchService;
12 import com.yoho.search.service.scene.aggregations.SceneAggregationsHelper; 12 import com.yoho.search.service.scene.aggregations.SceneAggregationsHelper;
13 import com.yoho.search.service.scene.common.AbstractSceneService; 13 import com.yoho.search.service.scene.common.AbstractSceneService;
14 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
15 -import com.yoho.search.service.scene.common.SceneSelectionsService; 14 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  15 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
16 import org.apache.commons.lang.StringUtils; 16 import org.apache.commons.lang.StringUtils;
17 import org.slf4j.Logger; 17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 18 import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ public class FuzzySceneService extends AbstractSceneService { @@ -42,7 +42,7 @@ public class FuzzySceneService extends AbstractSceneService {
42 @Autowired 42 @Autowired
43 private SceneAggregationsHelper sceneAggregationsHelper; 43 private SceneAggregationsHelper sceneAggregationsHelper;
44 @Autowired 44 @Autowired
45 - private SceneRecommendBrandsService sceneRecommendBrandsService; 45 + private RecommendBrandsService recommendBrandsService;
46 @Autowired 46 @Autowired
47 private ProductListSwitchService productListSwitchService; 47 private ProductListSwitchService productListSwitchService;
48 48
@@ -118,7 +118,7 @@ public class FuzzySceneService extends AbstractSceneService { @@ -118,7 +118,7 @@ public class FuzzySceneService extends AbstractSceneService {
118 this.addParamsToParamMap(paramMap); 118 this.addParamsToParamMap(paramMap);
119 // 2、返回聚合结果 119 // 2、返回聚合结果
120 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 120 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
121 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 121 + recommendBrandsService.getRecommendBrands(paramMap, result);
122 return result; 122 return result;
123 } catch (Exception e) { 123 } catch (Exception e) {
124 logger.error(e.getMessage(), e); 124 logger.error(e.getMessage(), e);
1 package com.yoho.search.service.scene.guang; 1 package com.yoho.search.service.scene.guang;
2 2
3 -import com.alibaba.fastjson.JSON;  
4 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
5 import com.yoho.search.aop.cache.SearchCacheAble; 4 import com.yoho.search.aop.cache.SearchCacheAble;
6 import com.yoho.search.base.utils.ISearchConstants; 5 import com.yoho.search.base.utils.ISearchConstants;
  6 +import com.yoho.search.common.SearchCommonService;
7 import com.yoho.search.common.utils.SearchApiResultUtils; 7 import com.yoho.search.common.utils.SearchApiResultUtils;
8 import com.yoho.search.core.es.model.SearchParam; 8 import com.yoho.search.core.es.model.SearchParam;
9 import com.yoho.search.core.es.model.SearchResult; 9 import com.yoho.search.core.es.model.SearchResult;
10 -import com.yoho.search.core.es.utils.SearchParamUtils;  
11 import com.yoho.search.models.SearchApiResult; 10 import com.yoho.search.models.SearchApiResult;
12 -import com.yoho.search.service.recall.beans.strategy.NotRecallTypeEnum;  
13 -import com.yoho.search.common.SearchCommonService;  
14 import com.yoho.search.service.helper.ProductListHelper; 11 import com.yoho.search.service.helper.ProductListHelper;
15 -import org.elasticsearch.search.builder.SearchSourceBuilder; 12 +import com.yoho.search.service.recall.beans.strategy.NotRecallTypeEnum;
16 import org.slf4j.Logger; 13 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
18 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,30 +18,15 @@ import org.springframework.stereotype.Service; @@ -21,30 +18,15 @@ import org.springframework.stereotype.Service;
21 import java.util.Map; 18 import java.util.Map;
22 19
23 @Service 20 @Service
24 -public class ProductListService { 21 +public class ProductListWithPhraseService {
25 22
26 - private static final Logger logger = LoggerFactory.getLogger(ProductListService.class); 23 + private static final Logger logger = LoggerFactory.getLogger(ProductListWithPhraseService.class);
27 24
28 @Autowired 25 @Autowired
29 private SearchCommonService searchCommonService; 26 private SearchCommonService searchCommonService;
30 @Autowired 27 @Autowired
31 private ProductListHelper productListHelper; 28 private ProductListHelper productListHelper;
32 29
33 - public SearchApiResult getESDsl(Map<String, String> paramMap) {  
34 - logger.info("[func=getESDsl][param={}]", paramMap);  
35 - try {  
36 - SearchParam searchParam = productListHelper.buildProductListSearchParam(paramMap, true);  
37 - SearchSourceBuilder searchSourceBuilder = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);  
38 - SearchApiResult searchApiResult = new SearchApiResult();  
39 - String results = searchSourceBuilder.toString();  
40 - searchApiResult.setData(JSON.parseObject(results));  
41 - logger.info("[func=getESDsl][dsl=\n{}]", searchApiResult.getData());  
42 - return searchApiResult;  
43 - } catch (Exception e) {  
44 - return SearchApiResultUtils.errorSearchApiResult("getESDsl", paramMap, e);  
45 - }  
46 - }  
47 -  
48 @SearchCacheAble(cacheInMinute = 10, cacheName = "PRODUCT_LIST_WITH_PHRASE") 30 @SearchCacheAble(cacheInMinute = 10, cacheName = "PRODUCT_LIST_WITH_PHRASE")
49 public SearchApiResult productListWithPhrase(Map<String, String> paramMap) { 31 public SearchApiResult productListWithPhrase(Map<String, String> paramMap) {
50 try { 32 try {
@@ -10,8 +10,8 @@ import com.yoho.search.service.helper.SearchKeyWordHelper; @@ -10,8 +10,8 @@ import com.yoho.search.service.helper.SearchKeyWordHelper;
10 import com.yoho.search.service.scene.list.ProductListSwitchService; 10 import com.yoho.search.service.scene.list.ProductListSwitchService;
11 import com.yoho.search.service.scene.fuzzy.FuzzySceneService; 11 import com.yoho.search.service.scene.fuzzy.FuzzySceneService;
12 import com.yoho.search.service.scene.common.AbstractSceneService; 12 import com.yoho.search.service.scene.common.AbstractSceneService;
13 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService;  
14 -import com.yoho.search.service.scene.common.SceneSelectionsService; 13 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
  14 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
15 import org.apache.commons.lang.StringUtils; 15 import org.apache.commons.lang.StringUtils;
16 import org.slf4j.Logger; 16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory; 17 import org.slf4j.LoggerFactory;
@@ -34,7 +34,7 @@ public class MiniappFuzzySceneService extends AbstractSceneService { @@ -34,7 +34,7 @@ public class MiniappFuzzySceneService extends AbstractSceneService {
34 @Autowired 34 @Autowired
35 private SceneSelectionsService sceneSelectionsService; 35 private SceneSelectionsService sceneSelectionsService;
36 @Autowired 36 @Autowired
37 - private SceneRecommendBrandsService sceneRecommendBrandsService; 37 + private RecommendBrandsService recommendBrandsService;
38 @Autowired 38 @Autowired
39 private ProductListSwitchService productListSwitchService; 39 private ProductListSwitchService productListSwitchService;
40 40
@@ -96,7 +96,7 @@ public class MiniappFuzzySceneService extends AbstractSceneService { @@ -96,7 +96,7 @@ public class MiniappFuzzySceneService extends AbstractSceneService {
96 // 2、返回聚合结果 96 // 2、返回聚合结果
97 SearchApiResult result = sceneSelectionsService.aggregations(paramMap); 97 SearchApiResult result = sceneSelectionsService.aggregations(paramMap);
98 if(result!=null){ 98 if(result!=null){
99 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 99 + recommendBrandsService.getRecommendBrands(paramMap, result);
100 } 100 }
101 return result; 101 return result;
102 } catch (Exception e) { 102 } catch (Exception e) {
@@ -7,7 +7,7 @@ import java.util.Map; @@ -7,7 +7,7 @@ import java.util.Map;
7 import com.yoho.search.base.utils.CollectionUtils; 7 import com.yoho.search.base.utils.CollectionUtils;
8 import com.yoho.search.models.RecommendPromotionAggVO; 8 import com.yoho.search.models.RecommendPromotionAggVO;
9 import com.yoho.search.service.scene.aggregations.SceneAggregationsHelper; 9 import com.yoho.search.service.scene.aggregations.SceneAggregationsHelper;
10 -import com.yoho.search.service.scene.common.SceneRecommendBrandsService; 10 +import com.yoho.search.service.scene.brandshop.RecommendBrandsService;
11 import org.elasticsearch.index.query.BoolQueryBuilder; 11 import org.elasticsearch.index.query.BoolQueryBuilder;
12 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; 12 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
13 import org.elasticsearch.search.aggregations.Aggregation; 13 import org.elasticsearch.search.aggregations.Aggregation;
@@ -31,7 +31,7 @@ import com.yoho.search.common.SearchCommonService; @@ -31,7 +31,7 @@ import com.yoho.search.common.SearchCommonService;
31 import com.yoho.search.service.helper.SearchAfterCacheHelper; 31 import com.yoho.search.service.helper.SearchAfterCacheHelper;
32 import com.yoho.search.service.helper.SearchParamHelper; 32 import com.yoho.search.service.helper.SearchParamHelper;
33 import com.yoho.search.cache.beans.AbstractCacheAbleService; 33 import com.yoho.search.cache.beans.AbstractCacheAbleService;
34 -import com.yoho.search.service.scene.common.SceneSelectionsService; 34 +import com.yoho.search.service.scene.aggregations.SceneSelectionsService;
35 import com.yoho.search.service.scene.brandshop.BrandService; 35 import com.yoho.search.service.scene.brandshop.BrandService;
36 import com.yoho.search.service.scene.aggregations.DiscountService; 36 import com.yoho.search.service.scene.aggregations.DiscountService;
37 import com.yoho.search.service.scene.aggregations.SearchSortGroupService; 37 import com.yoho.search.service.scene.aggregations.SearchSortGroupService;
@@ -66,7 +66,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { @@ -66,7 +66,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService {
66 @Autowired 66 @Autowired
67 private PromotionSceneHelper promotionSceneHelper; 67 private PromotionSceneHelper promotionSceneHelper;
68 @Autowired 68 @Autowired
69 - private SceneRecommendBrandsService sceneRecommendBrandsService; 69 + private RecommendBrandsService recommendBrandsService;
70 @Autowired 70 @Autowired
71 private SceneAggregationsHelper sceneAggregationsHelper; 71 private SceneAggregationsHelper sceneAggregationsHelper;
72 72
@@ -196,7 +196,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { @@ -196,7 +196,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService {
196 // 0、解析promotion的限制条件 196 // 0、解析promotion的限制条件
197 BoolQueryBuilder mustFilter = promotionSceneHelper.getMustFilterByPromotion(promotionConditions); 197 BoolQueryBuilder mustFilter = promotionSceneHelper.getMustFilterByPromotion(promotionConditions);
198 SearchApiResult result = sceneSelectionsService.aggregations(paramMap, mustFilter); 198 SearchApiResult result = sceneSelectionsService.aggregations(paramMap, mustFilter);
199 - sceneRecommendBrandsService.getRecommendBrands(paramMap, result); 199 + recommendBrandsService.getRecommendBrands(paramMap, result);
200 return result; 200 return result;
201 } catch (Exception e) { 201 } catch (Exception e) {
202 logger.error(e.getMessage(), e); 202 logger.error(e.getMessage(), e);
  1 +package com.yoho.search.service.scene.tools;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.yoho.search.common.utils.SearchApiResultUtils;
  5 +import com.yoho.search.core.es.model.SearchParam;
  6 +import com.yoho.search.core.es.utils.SearchParamUtils;
  7 +import com.yoho.search.models.SearchApiResult;
  8 +import com.yoho.search.service.helper.ProductListHelper;
  9 +import org.elasticsearch.search.builder.SearchSourceBuilder;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import java.util.Map;
  16 +
  17 +@Service
  18 +public class ProductListDslService {
  19 +
  20 + private static final Logger logger = LoggerFactory.getLogger(ProductListDslService.class);
  21 +
  22 + @Autowired
  23 + private ProductListHelper productListHelper;
  24 +
  25 + public SearchApiResult getESDsl(Map<String, String> paramMap) {
  26 + logger.info("[func=getESDsl][param={}]", paramMap);
  27 + try {
  28 + SearchParam searchParam = productListHelper.buildProductListSearchParam(paramMap, true);
  29 + SearchSourceBuilder searchSourceBuilder = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
  30 + SearchApiResult searchApiResult = new SearchApiResult();
  31 + String results = searchSourceBuilder.toString();
  32 + searchApiResult.setData(JSON.parseObject(results));
  33 + logger.info("[func=getESDsl][dsl=\n{}]", searchApiResult.getData());
  34 + return searchApiResult;
  35 + } catch (Exception e) {
  36 + return SearchApiResultUtils.errorSearchApiResult("getESDsl", paramMap, e);
  37 + }
  38 + }
  39 +
  40 +}