...
|
...
|
@@ -9,6 +9,8 @@ import com.yoho.search.common.SearchDynamicConfigService; |
|
|
import com.yoho.search.common.SearchRequestParams;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
...
|
...
|
@@ -25,12 +27,15 @@ public class GoodsCoverHelper { |
|
|
@Autowired
|
|
|
private SearchDynamicConfigService searchDynamicConfigService;
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(GoodsCoverHelper.class);
|
|
|
|
|
|
public void pickImgOnColor(List<Map<String, Object>> productReturnInfoList, Map paramMap){
|
|
|
List<String> values = ConvertUtils.stringToStringList(MapUtils.getString(paramMap, SearchRequestParams.PARAM_SEARCH_COLOR), ",");
|
|
|
if(values==null || values.isEmpty()){
|
|
|
return;
|
|
|
}
|
|
|
for (Map<String, Object> productInfo : productReturnInfoList) {
|
|
|
try {
|
|
|
List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(productInfo.get("goods_list")), new TypeReference<List<JSONObject>>() {});
|
|
|
for (JSONObject good : goodsList) {
|
|
|
String colorId = good.getString("color_id");
|
...
|
...
|
@@ -42,11 +47,13 @@ public class GoodsCoverHelper { |
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//测试环境zk配置改为false以不返回goods,刚上线默认还是要返回,等6.7上线后彻底删除
|
|
|
if (!searchDynamicConfigService.productListReturnGoods()) {
|
|
|
productInfo.put("goods_list", new JSONArray());
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage(),e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|