Showing
1 changed file
with
10 additions
and
16 deletions
@@ -678,17 +678,14 @@ public class SearchServiceHelper { | @@ -678,17 +678,14 @@ public class SearchServiceHelper { | ||
678 | @SuppressWarnings("unchecked") | 678 | @SuppressWarnings("unchecked") |
679 | public Map<String, Object> getProductMap(Map<String, Object> map, List<String> extendedFields) { | 679 | public Map<String, Object> getProductMap(Map<String, Object> map, List<String> extendedFields) { |
680 | Map<String, Object> productMap = new HashMap<String, Object>(); | 680 | Map<String, Object> productMap = new HashMap<String, Object>(); |
681 | - productMap.put("cn_alphabet", map.get("cnAlphabet") == null ? "" : map.get("cnAlphabet")); | ||
682 | if (map.containsKey("_highlight") && map.get("_highlight") != null) { | 681 | if (map.containsKey("_highlight") && map.get("_highlight") != null) { |
683 | Map<String, Object> highlightMap = (Map<String, Object>) map.get("_highlight"); | 682 | Map<String, Object> highlightMap = (Map<String, Object>) map.get("_highlight"); |
684 | if (highlightMap.containsKey("productName.productName_ansj")) { | 683 | if (highlightMap.containsKey("productName.productName_ansj")) { |
685 | - productMap.put("product_name_highlight", highlightMap.get("productName.productName_ansj") == null ? "" : highlightMap.get("productName.productName_ansj")); | 684 | + productMap.put("product_name_highlight", highlightMap.getOrDefault("productName.productName_ansj", "")); |
686 | } | 685 | } |
687 | } | 686 | } |
688 | - // productMap.put("shop_weight", map.get("shopWeight") == null ? "0" : | ||
689 | - // map.get("shopWeight")); | ||
690 | - productMap.put("product_name", map.get("productName") == null ? "" : map.get("productName")); | ||
691 | - productMap.put("brand_name", map.get("brandName") == null ? "" : map.get("brandName")); | 687 | + productMap.put("product_name", map.getOrDefault("productName", "")); |
688 | + productMap.put("brand_name", map.getOrDefault("brandName", "")); | ||
692 | productMap.put("brand_domain", map.get("brandDomain")); | 689 | productMap.put("brand_domain", map.get("brandDomain")); |
693 | productMap.put("market_price", map.get("marketPrice")); | 690 | productMap.put("market_price", map.get("marketPrice")); |
694 | productMap.put("brand_id", map.get("brandId")); | 691 | productMap.put("brand_id", map.get("brandId")); |
@@ -742,12 +739,12 @@ public class SearchServiceHelper { | @@ -742,12 +739,12 @@ public class SearchServiceHelper { | ||
742 | } | 739 | } |
743 | productMap.put("country_id", map.get("countryId")); | 740 | productMap.put("country_id", map.get("countryId")); |
744 | // 是否学生返币 | 741 | // 是否学生返币 |
745 | - productMap.put("is_student_rebate", map.get("isstudentrebate") == null ? "N" : map.get("isstudentrebate")); | 742 | + productMap.put("is_student_rebate", map.getOrDefault("isstudentrebate", "N")); |
746 | // 年龄层,逗号隔开的字符串 | 743 | // 年龄层,逗号隔开的字符串 |
747 | - productMap.put("age_level", map.get("ageLevel") == null ? "" : map.get("ageLevel")); | 744 | + productMap.put("age_level", map.getOrDefault("ageLevel", "")); |
748 | 745 | ||
749 | // 是否是全球购商品 | 746 | // 是否是全球购商品 |
750 | - productMap.put("is_global", map.get("isGlobal") == null ? "N" : map.get("isGlobal")); | 747 | + productMap.put("is_global", map.getOrDefault("isGlobal", "N")); |
751 | Integer tbl_country_id = 0; | 748 | Integer tbl_country_id = 0; |
752 | try { | 749 | try { |
753 | tbl_country_id = (Integer) map.get("tblCountryId"); | 750 | tbl_country_id = (Integer) map.get("tblCountryId"); |
@@ -758,6 +755,10 @@ public class SearchServiceHelper { | @@ -758,6 +755,10 @@ public class SearchServiceHelper { | ||
758 | String tbl_plane = (tbl_country_id != null && tbl_country_id != 86) ? "Y" : "N"; | 755 | String tbl_plane = (tbl_country_id != null && tbl_country_id != 86) ? "Y" : "N"; |
759 | productMap.put("tbl_plane", tbl_plane); | 756 | productMap.put("tbl_plane", tbl_plane); |
760 | productMap.put("skn_default_img", map.get("sknDefaultImg")); | 757 | productMap.put("skn_default_img", map.get("sknDefaultImg")); |
758 | + productMap.put("small_sort_name", map.get("smallSort")); | ||
759 | + productMap.put("shop_name", map.get("shopName")); | ||
760 | + productMap.put("shop_domain", map.get("shopDomain")); | ||
761 | + | ||
761 | // 一些特殊场景需要额外返回一些参数 | 762 | // 一些特殊场景需要额外返回一些参数 |
762 | if (extendedFields != null) { | 763 | if (extendedFields != null) { |
763 | for (String extendedField : extendedFields) { | 764 | for (String extendedField : extendedFields) { |
@@ -765,13 +766,6 @@ public class SearchServiceHelper { | @@ -765,13 +766,6 @@ public class SearchServiceHelper { | ||
765 | } | 766 | } |
766 | } | 767 | } |
767 | 768 | ||
768 | - // 增加小分类名称用于搜索推荐 | ||
769 | - productMap.put("small_sort_name", map.get("smallSort")); | ||
770 | - | ||
771 | - // shop | ||
772 | - productMap.put("shop_name", map.get("shopName")); | ||
773 | - productMap.put("shop_domain", map.get("shopDomain")); | ||
774 | - | ||
775 | return productMap; | 769 | return productMap; |
776 | } | 770 | } |
777 | } | 771 | } |
-
Please register or login to post a comment