Authored by hugufei

添加注释

@@ -116,28 +116,24 @@ public class ProductIndexBaseService { @@ -116,28 +116,24 @@ public class ProductIndexBaseService {
116 return results; 116 return results;
117 } 117 }
118 118
119 - @SuppressWarnings("unchecked")  
120 public Map<String, Object> getProductMapFromEsSource(Map<String, Object> map) { 119 public Map<String, Object> getProductMapFromEsSource(Map<String, Object> map) {
121 Map<String, Object> productMap = new HashMap<String, Object>(); 120 Map<String, Object> productMap = new HashMap<String, Object>();
122 - if (map.containsKey("_highlight") && map.get("_highlight") != null) {  
123 - Map<String, Object> highlightMap = (Map<String, Object>) map.get("_highlight");  
124 - if (highlightMap.containsKey(ProductIndexEsField.productName_productName_ansj)) {  
125 - productMap.put("product_name_highlight", MapUtils.getString(highlightMap, ProductIndexEsField.productName_productName_ansj, ""));  
126 - }  
127 - }  
128 productMap.put("product_id", MapUtils.getIntValue(map, ProductIndexEsField.productId, 0)); 121 productMap.put("product_id", MapUtils.getIntValue(map, ProductIndexEsField.productId, 0));
129 productMap.put("product_name", MapUtils.getString(map, ProductIndexEsField.productName, "")); 122 productMap.put("product_name", MapUtils.getString(map, ProductIndexEsField.productName, ""));
130 productMap.put("product_skn", MapUtils.getIntValue(map, ProductIndexEsField.productSkn, 0)); 123 productMap.put("product_skn", MapUtils.getIntValue(map, ProductIndexEsField.productSkn, 0));
131 - 124 +
  125 + //品牌
132 productMap.put("brand_id", MapUtils.getIntValue(map, ProductIndexEsField.brandId, 0)); 126 productMap.put("brand_id", MapUtils.getIntValue(map, ProductIndexEsField.brandId, 0));
133 productMap.put("brand_name", MapUtils.getString(map, ProductIndexEsField.brandName, "")); 127 productMap.put("brand_name", MapUtils.getString(map, ProductIndexEsField.brandName, ""));
134 productMap.put("brand_domain", MapUtils.getString(map, ProductIndexEsField.brandDomain, "")); 128 productMap.put("brand_domain", MapUtils.getString(map, ProductIndexEsField.brandDomain, ""));
135 - productMap.put("country_id", MapUtils.getIntValue(map, ProductIndexEsField.countryId, 0)); 129 + productMap.put("country_id", MapUtils.getIntValue(map, ProductIndexEsField.countryId, 0));//线下店专用
136 130
  131 + //店铺
137 productMap.put("shop_id", MapUtils.getIntValue(map, ProductIndexEsField.shopId, 0)); 132 productMap.put("shop_id", MapUtils.getIntValue(map, ProductIndexEsField.shopId, 0));
138 productMap.put("shop_name", MapUtils.getString(map, ProductIndexEsField.shopName, "")); 133 productMap.put("shop_name", MapUtils.getString(map, ProductIndexEsField.shopName, ""));
139 productMap.put("shop_domain", MapUtils.getString(map, ProductIndexEsField.shopDomain, "")); 134 productMap.put("shop_domain", MapUtils.getString(map, ProductIndexEsField.shopDomain, ""));
140 - 135 +
  136 + //价格相关
141 productMap.put("sales_price", MapUtils.getDoubleValue(map, ProductIndexEsField.salesPrice, 0)); 137 productMap.put("sales_price", MapUtils.getDoubleValue(map, ProductIndexEsField.salesPrice, 0));
142 productMap.put("market_price", MapUtils.getDoubleValue(map, ProductIndexEsField.marketPrice, 0)); 138 productMap.put("market_price", MapUtils.getDoubleValue(map, ProductIndexEsField.marketPrice, 0));
143 productMap.put("vip_price", MapUtils.getDoubleValue(map, ProductIndexEsField.vipPrice, 0)); 139 productMap.put("vip_price", MapUtils.getDoubleValue(map, ProductIndexEsField.vipPrice, 0));
@@ -150,19 +146,23 @@ public class ProductIndexBaseService { @@ -150,19 +146,23 @@ public class ProductIndexBaseService {
150 productMap.put("is_student_price", isStudentPrice); 146 productMap.put("is_student_price", isStudentPrice);
151 productMap.put("student_price", "Y".equalsIgnoreCase(isStudentPrice) ? MapUtils.getDoubleValue(map, ProductIndexEsField.studentPrice) : null); 147 productMap.put("student_price", "Y".equalsIgnoreCase(isStudentPrice) ? MapUtils.getDoubleValue(map, ProductIndexEsField.studentPrice) : null);
152 productMap.put("is_student_rebate", MapUtils.getString(map, ProductIndexEsField.isstudentrebate, "N")); 148 productMap.put("is_student_rebate", MapUtils.getString(map, ProductIndexEsField.isstudentrebate, "N"));
153 - 149 +
  150 + //图片相关
154 productMap.put("default_images", MapUtils.getString(map, ProductIndexEsField.defaultImages, "")); 151 productMap.put("default_images", MapUtils.getString(map, ProductIndexEsField.defaultImages, ""));
155 productMap.put("skn_default_img", MapUtils.getString(map, ProductIndexEsField.sknDefaultImg, "")); 152 productMap.put("skn_default_img", MapUtils.getString(map, ProductIndexEsField.sknDefaultImg, ""));
156 - 153 +
  154 + //时间相关
157 productMap.put("edit_time", MapUtils.getIntValue(map, ProductIndexEsField.editTime)); 155 productMap.put("edit_time", MapUtils.getIntValue(map, ProductIndexEsField.editTime));
158 productMap.put("shelve_time", MapUtils.getIntValue(map, ProductIndexEsField.shelveTime)); 156 productMap.put("shelve_time", MapUtils.getIntValue(map, ProductIndexEsField.shelveTime));
159 productMap.put("first_shelve_time", MapUtils.getIntValue(map, ProductIndexEsField.firstShelveTime)); 157 productMap.put("first_shelve_time", MapUtils.getIntValue(map, ProductIndexEsField.firstShelveTime));
160 - 158 +
  159 + //品类相关
161 productMap.put("max_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.maxSortId)); 160 productMap.put("max_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.maxSortId));
162 productMap.put("middle_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.middleSortId)); 161 productMap.put("middle_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.middleSortId));
163 productMap.put("small_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.smallSortId)); 162 productMap.put("small_sort_id", MapUtils.getIntValue(map, ProductIndexEsField.smallSortId));
164 productMap.put("small_sort_name", MapUtils.getString(map, ProductIndexEsField.smallSort, "")); 163 productMap.put("small_sort_name", MapUtils.getString(map, ProductIndexEsField.smallSort, ""));
165 164
  165 + //库存销量相关
166 productMap.put("stock_number", MapUtils.getIntValue(map, ProductIndexEsField.storageNum, 0)); 166 productMap.put("stock_number", MapUtils.getIntValue(map, ProductIndexEsField.storageNum, 0));
167 productMap.put("storage_num", MapUtils.getIntValue(map, ProductIndexEsField.storageNum, 0)); 167 productMap.put("storage_num", MapUtils.getIntValue(map, ProductIndexEsField.storageNum, 0));
168 productMap.put("sales_num", MapUtils.getIntValue(map, ProductIndexEsField.salesNum, 0)); 168 productMap.put("sales_num", MapUtils.getIntValue(map, ProductIndexEsField.salesNum, 0));
@@ -172,7 +172,7 @@ public class ProductIndexBaseService { @@ -172,7 +172,7 @@ public class ProductIndexBaseService {
172 productMap.put("phrase", MapUtils.getString(map, ProductIndexEsField.phrase, "")); 172 productMap.put("phrase", MapUtils.getString(map, ProductIndexEsField.phrase, ""));
173 productMap.put("status", MapUtils.getIntValue(map, ProductIndexEsField.status, 0)); 173 productMap.put("status", MapUtils.getIntValue(map, ProductIndexEsField.status, 0));
174 productMap.put("goods_list", MapUtils.getObject(map, ProductIndexEsField.goodsList, new JSONArray())); 174 productMap.put("goods_list", MapUtils.getObject(map, ProductIndexEsField.goodsList, new JSONArray()));
175 - 175 +
176 productMap.put("is_new", MapUtils.getString(map, ProductIndexEsField.isnew, "N")); 176 productMap.put("is_new", MapUtils.getString(map, ProductIndexEsField.isnew, "N"));
177 productMap.put("is_advance", MapUtils.getString(map, ProductIndexEsField.isAdvance, "N")); 177 productMap.put("is_advance", MapUtils.getString(map, ProductIndexEsField.isAdvance, "N"));
178 productMap.put("is_deposit_advance", MapUtils.getString(map, ProductIndexEsField.isDepositAdvance, "N")); 178 productMap.put("is_deposit_advance", MapUtils.getString(map, ProductIndexEsField.isDepositAdvance, "N"));
@@ -185,7 +185,6 @@ public class ProductIndexBaseService { @@ -185,7 +185,6 @@ public class ProductIndexBaseService {
185 productMap.put("is_discount", MapUtils.getString(map, ProductIndexEsField.isDiscount, "N")); 185 productMap.put("is_discount", MapUtils.getString(map, ProductIndexEsField.isDiscount, "N"));
186 productMap.put("is_soon_sold_out", MapUtils.getString(map, ProductIndexEsField.isSoonSoldOut, "N")); 186 productMap.put("is_soon_sold_out", MapUtils.getString(map, ProductIndexEsField.isSoonSoldOut, "N"));
187 productMap.put("is_promotion", MapUtils.getIntValue(map, ProductIndexEsField.ispromotion, 0)); 187 productMap.put("is_promotion", MapUtils.getIntValue(map, ProductIndexEsField.ispromotion, 0));
188 - productMap.put("is_latest_reduce_price", MapUtils.getString(map, ProductIndexEsField.isLatestReducePrice, "N"));  
189 productMap.put("is_breaking", "N"); 188 productMap.put("is_breaking", "N");
190 if (MapUtils.getDoubleValue(map, ProductIndexEsField.basePinRatio, 0) >= 3.5 && MapUtils.getDoubleValue(map, ProductIndexEsField.breakSizePercent, 0) >= 50) { 189 if (MapUtils.getDoubleValue(map, ProductIndexEsField.basePinRatio, 0) >= 3.5 && MapUtils.getDoubleValue(map, ProductIndexEsField.breakSizePercent, 0) >= 50) {
191 productMap.put("is_breaking", "Y"); 190 productMap.put("is_breaking", "Y");
@@ -213,15 +212,19 @@ public class ProductIndexBaseService { @@ -213,15 +212,19 @@ public class ProductIndexBaseService {
213 // 标签 212 // 标签
214 productMap.put("customize_tag", MapUtils.getObject(map, ProductIndexEsField.customizeTags, new JSONArray())); 213 productMap.put("customize_tag", MapUtils.getObject(map, ProductIndexEsField.customizeTags, new JSONArray()));
215 productMap.put("promotion_tag", this.getPomotionTags(map));// 促销标签 214 productMap.put("promotion_tag", this.getPomotionTags(map));// 促销标签
  215 +
  216 + // 定金 定金倍数
  217 + productMap.put("deposit", MapUtils.getDoubleValue(map, ProductIndexEsField.deposit, 0));
  218 + productMap.put("deposit_multiples", MapUtils.getIntValue(map, ProductIndexEsField.depositMultiples));
  219 +
  220 + // 商品标签-首页天窗专用
216 productMap.put("is_promotion_active", "N");// 当前是否有促销正在进行 221 productMap.put("is_promotion_active", "N");// 当前是否有促销正在进行
217 boolean promotionActive = getPromotionActive(map); 222 boolean promotionActive = getPromotionActive(map);
218 if (promotionActive) { 223 if (promotionActive) {
219 productMap.put("is_promotion_active", "Y"); 224 productMap.put("is_promotion_active", "Y");
220 } 225 }
221 -  
222 - // 定金 定金倍数  
223 - productMap.put("deposit", MapUtils.getDoubleValue(map, ProductIndexEsField.deposit, 0));  
224 - productMap.put("deposit_multiples", MapUtils.getIntValue(map, ProductIndexEsField.depositMultiples)); 226 + productMap.put("is_latest_reduce_price", MapUtils.getString(map, ProductIndexEsField.isLatestReducePrice, "N"));//是否最新降价
  227 +
225 228
226 return productMap; 229 return productMap;
227 } 230 }