...
|
...
|
@@ -6,8 +6,8 @@ import java.util.Map; |
|
|
|
|
|
import com.yoho.search.base.utils.CollectionUtils;
|
|
|
import com.yoho.search.models.RecommendPromotionAggVO;
|
|
|
import com.yoho.search.service.scene.pages.selections.SceneAggregationsHelper;
|
|
|
import com.yoho.search.service.scene.pages.selections.SceneRecommendBrandsService;
|
|
|
import com.yoho.search.service.scene.pages.selections.SceneAggregationHelper;
|
|
|
import com.yoho.search.service.scene.pages.selections.SceneSelectionsBrandsService;
|
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
|
|
|
import org.elasticsearch.search.aggregations.Aggregation;
|
...
|
...
|
@@ -35,8 +35,8 @@ import com.yoho.search.service.scene.pages.selections.SceneSelectionsService; |
|
|
import com.yoho.search.service.scene.shopbrand.BrandService;
|
|
|
import com.yoho.search.service.scene.general.DiscountService;
|
|
|
import com.yoho.search.service.scene.general.SearchSortGroupService;
|
|
|
import com.yoho.search.service.scene.general.SelectionsForApp;
|
|
|
import com.yoho.search.service.scene.general.SelectionsForPc;
|
|
|
import com.yoho.search.service.scene.pages.selections.AppSelectionsService;
|
|
|
import com.yoho.search.service.scene.pages.selections.PcSelectionsService;
|
|
|
|
|
|
@Service
|
|
|
public class PromotionAggregationsService extends AbstractCacheAbleService {
|
...
|
...
|
@@ -48,11 +48,11 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { |
|
|
@Autowired
|
|
|
private AggregationFactory aggregationFactory;
|
|
|
@Autowired
|
|
|
private SelectionsForApp selectionsWithOutAdvanceService;
|
|
|
private AppSelectionsService selectionsWithOutAdvanceService;
|
|
|
@Autowired
|
|
|
private SearchAfterCacheHelper searchAfterCacheService;
|
|
|
@Autowired
|
|
|
private SelectionsForPc selectionsForPc;
|
|
|
private PcSelectionsService pcSelectionsService;
|
|
|
@Autowired
|
|
|
private BrandService brandService;
|
|
|
@Autowired
|
...
|
...
|
@@ -66,9 +66,9 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { |
|
|
@Autowired
|
|
|
private PromotionSceneHelper promotionSceneHelper;
|
|
|
@Autowired
|
|
|
private SceneRecommendBrandsService sceneRecommendBrandsService;
|
|
|
private SceneSelectionsBrandsService sceneSceneSelectionsBrandsService;
|
|
|
@Autowired
|
|
|
private SceneAggregationsHelper sceneAggregationsHelper;
|
|
|
private SceneAggregationHelper sceneAggregationHelper;
|
|
|
|
|
|
@Override
|
|
|
public SearchCache getSearchCache() {
|
...
|
...
|
@@ -154,7 +154,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { |
|
|
BoolQueryBuilder mustFilterByPromotion = promotionSceneHelper.getMustFilterByPromotion(promotionConditions);
|
|
|
|
|
|
// 2、调通用的PC聚合逻辑
|
|
|
SearchApiResult apiResult = selectionsForPc.getSelectionsForPc(paramMap, mustFilterByPromotion);
|
|
|
SearchApiResult apiResult = pcSelectionsService.getSelectionsForPc(paramMap, mustFilterByPromotion);
|
|
|
if (apiResult == null || apiResult.getData() == null) {
|
|
|
return apiResult;
|
|
|
}
|
...
|
...
|
@@ -196,7 +196,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { |
|
|
// 0、解析promotion的限制条件
|
|
|
BoolQueryBuilder mustFilter = promotionSceneHelper.getMustFilterByPromotion(promotionConditions);
|
|
|
SearchApiResult result = sceneSelectionsService.aggregations(paramMap, mustFilter);
|
|
|
sceneRecommendBrandsService.getRecommendBrands(paramMap, result);
|
|
|
sceneSceneSelectionsBrandsService.getRecommendBrands(paramMap, result);
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
...
|
...
|
@@ -207,7 +207,7 @@ public class PromotionAggregationsService extends AbstractCacheAbleService { |
|
|
public SearchApiResult aggPromotions(Map<String, String> paramMap){
|
|
|
int size = 10;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
List<RecommendPromotionAggVO> recommendPromotionAggVOS = sceneAggregationsHelper.aggPromotion(paramMap);
|
|
|
List<RecommendPromotionAggVO> recommendPromotionAggVOS = sceneAggregationHelper.aggPromotion(paramMap);
|
|
|
if (recommendPromotionAggVOS.size() > size) {
|
|
|
jsonObject.put("promotionList", CollectionUtils.safeSubList(recommendPromotionAggVOS, 0, size));
|
|
|
} else {
|
...
|
...
|
|