Authored by hugufei

代码优化

... ... @@ -77,7 +77,7 @@ public class UserRecallResponseBuilder {
//8、构造返回结果
List<RecallSknInfo> sknList = new ArrayList<>();
for (RecallMergerResult.SknResult sknResult : sknResultList) {
//按优先级排序,第一种召回策略
//按优先级排序,第一种召回策略
Collections.sort(sknResult.getStrategys(), (o1, o2) -> o2.getPriority().compareTo(o1.getPriority()));
String requestType = sknResult.getStrategys().get(0).name();
sknList.add(new RecallSknInfo(sknResult.getProductSkn(), requestType));
... ... @@ -152,8 +152,8 @@ public class UserRecallResponseBuilder {
if (sknResult.isLikePriceArea()) {
score = score + 100;
}
//2)判断兜底的数据是否参与评分
if(!searchDynamicConfigService.searchPersionalNewStrategyCommonJoinScoreOpen() && !this.isCommonRecallOnly(sknResult)){
//2)如果兜底策略不参与评分,并且当前skn有其他的召回策略,则加分【将兜底和非兜底的拆分】
if(!searchDynamicConfigService.searchPersionalNewStrategyCommonJoinScoreOpen() && !this.isCommonRecallOnly(sknResult)){
score = score + 50;
}
sknResult.setScore(score);
... ... @@ -163,6 +163,11 @@ public class UserRecallResponseBuilder {
return sknResultList;
}
/**
* 当前商品是否只是兜底策略找回来的
* @param sknResult
* @return
*/
private boolean isCommonRecallOnly(RecallMergerResult.SknResult sknResult) {
List<StrategyEnum> strategys = sknResult.getStrategys();
//1、非空判断
... ...