|
|
package com.yoho.search.service.service.helper;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.yoho.search.base.utils.ConvertUtils;
|
|
|
import com.yoho.search.base.utils.DateUtil;
|
|
|
import com.yoho.search.base.utils.ISearchConstants;
|
...
|
...
|
@@ -680,84 +681,90 @@ public class SearchServiceHelper { |
|
|
Map<String, Object> productMap = new HashMap<String, Object>();
|
|
|
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.getOrDefault("productName.productName_ansj", ""));
|
|
|
}
|
|
|
}
|
|
|
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"));
|
|
|
productMap.put("shop_id", map.get("shopId"));
|
|
|
productMap.put("vip_price", map.get("vipPrice"));
|
|
|
productMap.put("vip1_price", map.get("vip1Price"));
|
|
|
productMap.put("vip2_price", map.get("vip2Price"));
|
|
|
productMap.put("vip3_price", map.get("vip3Price"));
|
|
|
productMap.put("sales_price", map.get("salesPrice"));
|
|
|
productMap.put("vip_discount_type", map.get("vipDiscountType"));
|
|
|
productMap.put("product_id", map.get("productId"));
|
|
|
productMap.put("product_skn", map.get("productSkn"));
|
|
|
productMap.put("goods_list", map.get("goodsList"));
|
|
|
productMap.put("is_new", map.get("isnew"));
|
|
|
productMap.put("is_advance", map.get("isAdvance"));
|
|
|
productMap.put("is_deposit_advance", map.get("isDepositAdvance"));
|
|
|
productMap.put("first_shelve_time", map.get("firstShelveTime"));
|
|
|
productMap.put("is_seckill", map.get("isSeckill"));
|
|
|
productMap.put("is_limitbuy", map.get("isLimitbuy"));
|
|
|
productMap.put("is_limited", map.get("islimited"));
|
|
|
productMap.put("stock_number", map.get("storageNum"));
|
|
|
productMap.put("is_outlets", map.get("isOutlets"));
|
|
|
productMap.put("is_special", map.get("isSpecial"));
|
|
|
productMap.put("gender", map.get("gender"));
|
|
|
productMap.put("default_images", map.get("defaultImages"));
|
|
|
productMap.put("middle_sort_id", map.get("middleSortId"));
|
|
|
productMap.put("small_sort_id", map.get("smallSortId"));
|
|
|
productMap.put("max_sort_id", map.get("maxSortId"));
|
|
|
productMap.put("is_discount", map.get("isDiscount"));
|
|
|
productMap.put("is_soon_sold_out", map.get("isSoonSoldOut"));
|
|
|
productMap.put("edit_time", map.get("editTime"));
|
|
|
productMap.put("shelve_time", map.get("shelveTime"));
|
|
|
productMap.put("storage_num", map.get("storageNum"));
|
|
|
productMap.put("sales_num", map.get("salesNum"));
|
|
|
productMap.put("status", map.get("status"));
|
|
|
productMap.put("is_promotion", map.get("ispromotion"));
|
|
|
String yohoodIdFromMap = (String) map.get("yohoodId");
|
|
|
if (yohoodIdFromMap != null && yohoodIdFromMap.length() > 0) {
|
|
|
productMap.put("yohood_id", yohoodIdFromMap);
|
|
|
} else {
|
|
|
productMap.put("yohood_id", null);
|
|
|
}
|
|
|
productMap.put("sales_phrase", map.get("salesPhrase"));
|
|
|
|
|
|
String isStudentPrice = (String) map.get("isStudentPrice");
|
|
|
if (highlightMap.containsKey(ProductIndexEsField.productName_productName_ansj)) {
|
|
|
productMap.put("product_name_highlight", highlightMap.getOrDefault(ProductIndexEsField.productName_productName_ansj, ""));
|
|
|
}
|
|
|
}
|
|
|
productMap.put("product_id", map.get(ProductIndexEsField.productId));
|
|
|
productMap.put("product_name", map.getOrDefault(ProductIndexEsField.productName, ""));
|
|
|
productMap.put("product_skn", map.get(ProductIndexEsField.productSkn));
|
|
|
|
|
|
productMap.put("brand_id", map.get(ProductIndexEsField.brandId));
|
|
|
productMap.put("brand_name", map.getOrDefault(ProductIndexEsField.brandName, ""));
|
|
|
productMap.put("brand_domain", map.get(ProductIndexEsField.brandDomain));
|
|
|
productMap.put("country_id", map.get(ProductIndexEsField.countryId));
|
|
|
|
|
|
productMap.put("shop_id", map.get(ProductIndexEsField.shopId));
|
|
|
productMap.put("shop_name", map.get(ProductIndexEsField.shopName));
|
|
|
productMap.put("shop_domain", map.get(ProductIndexEsField.shopDomain));
|
|
|
|
|
|
productMap.put("sales_price", map.get(ProductIndexEsField.salesPrice));
|
|
|
productMap.put("market_price", map.get(ProductIndexEsField.marketPrice));
|
|
|
productMap.put("vip_price", map.get(ProductIndexEsField.vipPrice));
|
|
|
productMap.put("vip1_price", map.get(ProductIndexEsField.vip1Price));
|
|
|
productMap.put("vip2_price", map.get(ProductIndexEsField.vip2Price));
|
|
|
productMap.put("vip3_price", map.get(ProductIndexEsField.vip3Price));
|
|
|
productMap.put("vip_discount_type", map.get(ProductIndexEsField.vipDiscountType));
|
|
|
|
|
|
productMap.put("default_images", map.getOrDefault(ProductIndexEsField.defaultImages, ""));
|
|
|
productMap.put("skn_default_img", map.getOrDefault(ProductIndexEsField.sknDefaultImg, ""));
|
|
|
|
|
|
productMap.put("edit_time", map.get(ProductIndexEsField.editTime));
|
|
|
productMap.put("shelve_time", map.get(ProductIndexEsField.shelveTime));
|
|
|
productMap.put("first_shelve_time", map.get(ProductIndexEsField.firstShelveTime));
|
|
|
|
|
|
productMap.put("max_sort_id", map.get(ProductIndexEsField.maxSortId));
|
|
|
productMap.put("middle_sort_id", map.get(ProductIndexEsField.middleSortId));
|
|
|
productMap.put("small_sort_id", map.get(ProductIndexEsField.smallSortId));
|
|
|
productMap.put("small_sort_name", map.get(ProductIndexEsField.smallSort));
|
|
|
|
|
|
productMap.put("stock_number", map.getOrDefault(ProductIndexEsField.storageNum, 0));
|
|
|
productMap.put("storage_num", map.getOrDefault(ProductIndexEsField.storageNum, 0));
|
|
|
productMap.put("sales_num", map.getOrDefault(ProductIndexEsField.salesNum, 0));
|
|
|
|
|
|
productMap.put("gender", map.get(ProductIndexEsField.gender));
|
|
|
productMap.put("age_level", map.getOrDefault(ProductIndexEsField.ageLevel, ""));// 年龄层,逗号隔开的字符串
|
|
|
productMap.put("sales_phrase", map.getOrDefault(ProductIndexEsField.salesPhrase, ""));
|
|
|
productMap.put("status", map.getOrDefault(ProductIndexEsField.status, 0));
|
|
|
productMap.put("goods_list", map.getOrDefault(ProductIndexEsField.goodsList, new JSONArray()));
|
|
|
|
|
|
productMap.put("is_new", map.getOrDefault(ProductIndexEsField.isnew, "N"));
|
|
|
productMap.put("is_advance", map.getOrDefault(ProductIndexEsField.isAdvance, "N"));
|
|
|
productMap.put("is_deposit_advance", map.getOrDefault(ProductIndexEsField.isDepositAdvance, "N"));
|
|
|
productMap.put("is_seckill", map.getOrDefault(ProductIndexEsField.isSeckill, "N"));
|
|
|
productMap.put("is_limitbuy", map.getOrDefault(ProductIndexEsField.isLimitbuy, "N"));
|
|
|
productMap.put("is_limited", map.getOrDefault(ProductIndexEsField.islimited, "N"));
|
|
|
productMap.put("is_outlets", map.getOrDefault(ProductIndexEsField.isOutlets, 2));
|
|
|
productMap.put("is_special", map.getOrDefault(ProductIndexEsField.isSpecial, "N"));
|
|
|
productMap.put("is_discount", map.getOrDefault(ProductIndexEsField.isDiscount, "N"));
|
|
|
productMap.put("is_soon_sold_out", map.getOrDefault(ProductIndexEsField.isSoonSoldOut, "N"));
|
|
|
productMap.put("is_promotion", map.getOrDefault(ProductIndexEsField.ispromotion, 0));
|
|
|
|
|
|
// yohoodId
|
|
|
String yohoodId = (String) map.getOrDefault(ProductIndexEsField.yohoodId, "");
|
|
|
productMap.put("yohood_id", StringUtils.isNotBlank(yohoodId) ? yohoodId : null);
|
|
|
|
|
|
// 学生价和学生返币
|
|
|
productMap.put("is_student_rebate", map.getOrDefault(ProductIndexEsField.isstudentrebate, "N"));
|
|
|
String isStudentPrice = (String) map.get(ProductIndexEsField.isStudentPrice);
|
|
|
productMap.put("is_student_price", isStudentPrice);
|
|
|
if (isStudentPrice == null || isStudentPrice.equalsIgnoreCase("N")) {
|
|
|
productMap.put("student_price", null);
|
|
|
} else {
|
|
|
productMap.put("student_price", map.get("studentPrice"));
|
|
|
productMap.put("student_price", map.get(ProductIndexEsField.studentPrice));
|
|
|
}
|
|
|
productMap.put("country_id", map.get("countryId"));
|
|
|
// 是否学生返币
|
|
|
productMap.put("is_student_rebate", map.getOrDefault("isstudentrebate", "N"));
|
|
|
// 年龄层,逗号隔开的字符串
|
|
|
productMap.put("age_level", map.getOrDefault("ageLevel", ""));
|
|
|
|
|
|
// 是否是全球购商品
|
|
|
productMap.put("is_global", map.getOrDefault("isGlobal", "N"));
|
|
|
// 全球购相关
|
|
|
productMap.put("is_global", map.getOrDefault(ProductIndexEsField.isGlobal, "N"));
|
|
|
Integer tbl_country_id = 0;
|
|
|
try {
|
|
|
tbl_country_id = (Integer) map.get("tblCountryId");
|
|
|
tbl_country_id = (Integer) map.get(ProductIndexEsField.tblCountryId);
|
|
|
} catch (Exception e) {
|
|
|
}
|
|
|
productMap.put("tbl_country_id", tbl_country_id);
|
|
|
productMap.put("tbl_country_name", map.get("tblCountryName"));
|
|
|
productMap.put("tbl_country_name", map.get(ProductIndexEsField.tblCountryName));
|
|
|
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) {
|
...
|
...
|
|