Authored by hugufei

添加trycatch

@@ -9,6 +9,8 @@ import com.yoho.search.common.SearchDynamicConfigService; @@ -9,6 +9,8 @@ import com.yoho.search.common.SearchDynamicConfigService;
9 import com.yoho.search.common.SearchRequestParams; 9 import com.yoho.search.common.SearchRequestParams;
10 import org.apache.commons.collections.MapUtils; 10 import org.apache.commons.collections.MapUtils;
11 import org.apache.commons.lang.StringUtils; 11 import org.apache.commons.lang.StringUtils;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Component; 15 import org.springframework.stereotype.Component;
14 16
@@ -25,12 +27,15 @@ public class GoodsCoverHelper { @@ -25,12 +27,15 @@ public class GoodsCoverHelper {
25 @Autowired 27 @Autowired
26 private SearchDynamicConfigService searchDynamicConfigService; 28 private SearchDynamicConfigService searchDynamicConfigService;
27 29
  30 + private static final Logger logger = LoggerFactory.getLogger(GoodsCoverHelper.class);
  31 +
28 public void pickImgOnColor(List<Map<String, Object>> productReturnInfoList, Map paramMap){ 32 public void pickImgOnColor(List<Map<String, Object>> productReturnInfoList, Map paramMap){
29 List<String> values = ConvertUtils.stringToStringList(MapUtils.getString(paramMap, SearchRequestParams.PARAM_SEARCH_COLOR), ","); 33 List<String> values = ConvertUtils.stringToStringList(MapUtils.getString(paramMap, SearchRequestParams.PARAM_SEARCH_COLOR), ",");
30 if(values==null || values.isEmpty()){ 34 if(values==null || values.isEmpty()){
31 return; 35 return;
32 } 36 }
33 for (Map<String, Object> productInfo : productReturnInfoList) { 37 for (Map<String, Object> productInfo : productReturnInfoList) {
  38 + try {
34 List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(productInfo.get("goods_list")), new TypeReference<List<JSONObject>>() {}); 39 List<JSONObject> goodsList = JSON.parseObject(JSON.toJSONString(productInfo.get("goods_list")), new TypeReference<List<JSONObject>>() {});
35 for (JSONObject good : goodsList) { 40 for (JSONObject good : goodsList) {
36 String colorId = good.getString("color_id"); 41 String colorId = good.getString("color_id");
@@ -42,11 +47,13 @@ public class GoodsCoverHelper { @@ -42,11 +47,13 @@ public class GoodsCoverHelper {
42 break; 47 break;
43 } 48 }
44 } 49 }
45 -  
46 //测试环境zk配置改为false以不返回goods,刚上线默认还是要返回,等6.7上线后彻底删除 50 //测试环境zk配置改为false以不返回goods,刚上线默认还是要返回,等6.7上线后彻底删除
47 if (!searchDynamicConfigService.productListReturnGoods()) { 51 if (!searchDynamicConfigService.productListReturnGoods()) {
48 productInfo.put("goods_list", new JSONArray()); 52 productInfo.put("goods_list", new JSONArray());
49 } 53 }
  54 + }catch (Exception e){
  55 + logger.error(e.getMessage(),e);
  56 + }
50 } 57 }
51 } 58 }
52 59