Authored by 胡古飞

fix getProductMap

... ... @@ -678,17 +678,14 @@ public class SearchServiceHelper {
@SuppressWarnings("unchecked")
public Map<String, Object> getProductMap(Map<String, Object> map, List<String> extendedFields) {
Map<String, Object> productMap = new HashMap<String, Object>();
productMap.put("cn_alphabet", map.get("cnAlphabet") == null ? "" : map.get("cnAlphabet"));
if (map.containsKey("_highlight") && map.get("_highlight") != null) {
Map<String, Object> highlightMap = (Map<String, Object>) map.get("_highlight");
if (highlightMap.containsKey("productName.productName_ansj")) {
productMap.put("product_name_highlight", highlightMap.get("productName.productName_ansj") == null ? "" : highlightMap.get("productName.productName_ansj"));
productMap.put("product_name_highlight", highlightMap.getOrDefault("productName.productName_ansj", ""));
}
}
// productMap.put("shop_weight", map.get("shopWeight") == null ? "0" :
// map.get("shopWeight"));
productMap.put("product_name", map.get("productName") == null ? "" : map.get("productName"));
productMap.put("brand_name", map.get("brandName") == null ? "" : map.get("brandName"));
productMap.put("product_name", map.getOrDefault("productName", ""));
productMap.put("brand_name", map.getOrDefault("brandName", ""));
productMap.put("brand_domain", map.get("brandDomain"));
productMap.put("market_price", map.get("marketPrice"));
productMap.put("brand_id", map.get("brandId"));
... ... @@ -742,12 +739,12 @@ public class SearchServiceHelper {
}
productMap.put("country_id", map.get("countryId"));
// 是否学生返币
productMap.put("is_student_rebate", map.get("isstudentrebate") == null ? "N" : map.get("isstudentrebate"));
productMap.put("is_student_rebate", map.getOrDefault("isstudentrebate", "N"));
// 年龄层,逗号隔开的字符串
productMap.put("age_level", map.get("ageLevel") == null ? "" : map.get("ageLevel"));
productMap.put("age_level", map.getOrDefault("ageLevel", ""));
// 是否是全球购商品
productMap.put("is_global", map.get("isGlobal") == null ? "N" : map.get("isGlobal"));
productMap.put("is_global", map.getOrDefault("isGlobal", "N"));
Integer tbl_country_id = 0;
try {
tbl_country_id = (Integer) map.get("tblCountryId");
... ... @@ -758,6 +755,10 @@ public class SearchServiceHelper {
String tbl_plane = (tbl_country_id != null && tbl_country_id != 86) ? "Y" : "N";
productMap.put("tbl_plane", tbl_plane);
productMap.put("skn_default_img", map.get("sknDefaultImg"));
productMap.put("small_sort_name", map.get("smallSort"));
productMap.put("shop_name", map.get("shopName"));
productMap.put("shop_domain", map.get("shopDomain"));
// 一些特殊场景需要额外返回一些参数
if (extendedFields != null) {
for (String extendedField : extendedFields) {
... ... @@ -765,13 +766,6 @@ public class SearchServiceHelper {
}
}
// 增加小分类名称用于搜索推荐
productMap.put("small_sort_name", map.get("smallSort"));
// shop
productMap.put("shop_name", map.get("shopName"));
productMap.put("shop_domain", map.get("shopDomain"));
return productMap;
}
}
... ...