Authored by 胡古飞

增加商品特征是否存在的字段

@@ -972,6 +972,10 @@ @@ -972,6 +972,10 @@
972 "type": "string", 972 "type": "string",
973 "index": "not_analyzed" 973 "index": "not_analyzed"
974 }, 974 },
  975 + "productFeatureFactorExist": {
  976 + "type": "string",
  977 + "index": "not_analyzed"
  978 + },
975 "pools": { 979 "pools": {
976 "type": "nested", 980 "type": "nested",
977 "properties": { 981 "properties": {
1 package com.yoho.search.consumer.service.bo; 1 package com.yoho.search.consumer.service.bo;
2 2
3 -import com.alibaba.fastjson.JSONArray;  
4 -  
5 import java.io.Serializable; 3 import java.io.Serializable;
6 import java.math.BigDecimal; 4 import java.math.BigDecimal;
7 5
  6 +import com.alibaba.fastjson.JSONArray;
  7 +
8 /** 8 /**
9 * 商品实体索引 9 * 商品实体索引
10 * 10 *
@@ -99,6 +99,7 @@ public class ProductIndexBO extends ProductIBO implements Serializable { @@ -99,6 +99,7 @@ public class ProductIndexBO extends ProductIBO implements Serializable {
99 private String tblCountryName; 99 private String tblCountryName;
100 100
101 private String productFeatureFactor; 101 private String productFeatureFactor;
  102 + private String productFeatureFactorExist;
102 103
103 // from product_pool_detail 104 // from product_pool_detail
104 private JSONArray pools; 105 private JSONArray pools;
@@ -521,6 +522,14 @@ public class ProductIndexBO extends ProductIBO implements Serializable { @@ -521,6 +522,14 @@ public class ProductIndexBO extends ProductIBO implements Serializable {
521 this.productFeatureFactor = productFeatureFactor; 522 this.productFeatureFactor = productFeatureFactor;
522 } 523 }
523 524
  525 + public String getProductFeatureFactorExist() {
  526 + return productFeatureFactorExist;
  527 + }
  528 +
  529 + public void setProductFeatureFactorExist(String productFeatureFactorExist) {
  530 + this.productFeatureFactorExist = productFeatureFactorExist;
  531 + }
  532 +
524 public Integer getTblBrandId() { 533 public Integer getTblBrandId() {
525 return tblBrandId; 534 return tblBrandId;
526 } 535 }
1 package com.yoho.search.consumer.service.logic.productIndex.viewBuilder; 1 package com.yoho.search.consumer.service.logic.productIndex.viewBuilder;
2 2
3 -import com.yoho.search.consumer.service.bo.ProductIndexBO;  
4 -import com.yoho.search.consumer.service.logic.ProductVectorFeatureLogicService; 3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.apache.commons.lang.StringUtils;
5 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
7 9
8 -import java.util.List;  
9 -import java.util.Map;  
10 -import java.util.Optional; 10 +import com.yoho.search.consumer.service.bo.ProductIndexBO;
  11 +import com.yoho.search.consumer.service.logic.ProductVectorFeatureLogicService;
11 12
12 /** 13 /**
13 * Created by wangnan on 2017/1/10. 14 * Created by wangnan on 2017/1/10.
@@ -21,7 +22,15 @@ public class ProductFeatureFactorBuilder implements ViewBuilder { @@ -21,7 +22,15 @@ public class ProductFeatureFactorBuilder implements ViewBuilder {
21 @Override 22 @Override
22 public void build(List<ProductIndexBO> productIndexBOs, List<Integer> ids, List<Integer> sknList) { 23 public void build(List<ProductIndexBO> productIndexBOs, List<Integer> ids, List<Integer> sknList) {
23 Map<Integer, String> productVectorFeatureMapBaseSknMap = productVectorFeatureLogicService.queryProductVectorFeatureMap(sknList); 24 Map<Integer, String> productVectorFeatureMapBaseSknMap = productVectorFeatureLogicService.queryProductVectorFeatureMap(sknList);
24 - productIndexBOs.stream().forEach(productIndexBO -> productIndexBO.setProductFeatureFactor(Optional.ofNullable(productVectorFeatureMapBaseSknMap.get(productIndexBO.getProductSkn()))  
25 - .orElse(null))); 25 + for (ProductIndexBO productIndexBO : productIndexBOs) {
  26 + String productVectorFeature = productVectorFeatureMapBaseSknMap.get(productIndexBO.getProductSkn());
  27 + if (StringUtils.isBlank(productVectorFeature)) {
  28 + productIndexBO.setProductFeatureFactor(null);
  29 + productIndexBO.setProductFeatureFactorExist("N");
  30 + } else {
  31 + productIndexBO.setProductFeatureFactor(productVectorFeature);
  32 + productIndexBO.setProductFeatureFactorExist("Y");
  33 + }
  34 + }
26 } 35 }
27 } 36 }