Authored by wangnan

商品索引添加商品热度字段,支持全量和定时增量。

  1 +package com.yoho.search.dal;
  2 +
  3 +import com.yoho.search.dal.model.ProductHeatValue;
  4 +import org.apache.ibatis.annotations.Param;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface ProductHeatValueMapper {
  9 + int deleteByPrimaryKey(Integer productSkn);
  10 +
  11 + int insert(ProductHeatValue record);
  12 +
  13 + int insertSelective(ProductHeatValue record);
  14 +
  15 + ProductHeatValue selectByPrimaryKey(Integer productSkn);
  16 +
  17 + int updateByPrimaryKeySelective(ProductHeatValue record);
  18 +
  19 + int updateByPrimaryKey(ProductHeatValue record);
  20 +
  21 + Integer selectLatestDateId();
  22 +
  23 + List<ProductHeatValue> selectHeatValueOfLatestDate(@Param(value="sknList")List<Integer> sknList, @Param(value="dateId")Integer dateId);
  24 +}
  1 +package com.yoho.search.dal.model;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +public class ProductHeatValue {
  6 + private Integer productSkn;
  7 +
  8 + private String dateId;
  9 +
  10 + private BigDecimal heatValue;
  11 +
  12 + private Integer lastUpdateTime;
  13 +
  14 + public Integer getProductSkn() {
  15 + return productSkn;
  16 + }
  17 +
  18 + public void setProductSkn(Integer productSkn) {
  19 + this.productSkn = productSkn;
  20 + }
  21 +
  22 + public String getDateId() {
  23 + return dateId;
  24 + }
  25 +
  26 + public void setDateId(String dateId) {
  27 + this.dateId = dateId == null ? null : dateId.trim();
  28 + }
  29 +
  30 + public BigDecimal getHeatValue() {
  31 + return heatValue;
  32 + }
  33 +
  34 + public void setHeatValue(BigDecimal heatValue) {
  35 + this.heatValue = heatValue;
  36 + }
  37 +
  38 + public Integer getLastUpdateTime() {
  39 + return lastUpdateTime;
  40 + }
  41 +
  42 + public void setLastUpdateTime(Integer lastUpdateTime) {
  43 + this.lastUpdateTime = lastUpdateTime;
  44 + }
  45 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.search.dal.ProductHeatValueMapper" >
  4 + <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductHeatValue" >
  5 + <id column="product_skn" property="productSkn" jdbcType="INTEGER" />
  6 + <result column="date_id" property="dateId" jdbcType="VARCHAR" />
  7 + <result column="heat_value" property="heatValue" jdbcType="DECIMAL" />
  8 + <result column="last_update_time" property="lastUpdateTime" jdbcType="INTEGER" />
  9 + </resultMap>
  10 + <sql id="Base_Column_List" >
  11 + product_skn, date_id, heat_value, last_update_time
  12 + </sql>
  13 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  14 + select
  15 + <include refid="Base_Column_List" />
  16 + from product_heat_value
  17 + where product_skn = #{productSkn,jdbcType=INTEGER}
  18 + </select>
  19 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  20 + delete from product_heat_value
  21 + where product_skn = #{productSkn,jdbcType=INTEGER}
  22 + </delete>
  23 + <insert id="insert" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
  24 + insert into product_heat_value (product_skn, date_id, heat_value,
  25 + last_update_time)
  26 + values (#{productSkn,jdbcType=INTEGER}, #{dateId,jdbcType=VARCHAR}, #{heatValue,jdbcType=DECIMAL},
  27 + #{lastUpdateTime,jdbcType=INTEGER})
  28 + </insert>
  29 + <insert id="insertSelective" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
  30 + insert into product_heat_value
  31 + <trim prefix="(" suffix=")" suffixOverrides="," >
  32 + <if test="productSkn != null" >
  33 + product_skn,
  34 + </if>
  35 + <if test="dateId != null" >
  36 + date_id,
  37 + </if>
  38 + <if test="heatValue != null" >
  39 + heat_value,
  40 + </if>
  41 + <if test="lastUpdateTime != null" >
  42 + last_update_time,
  43 + </if>
  44 + </trim>
  45 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  46 + <if test="productSkn != null" >
  47 + #{productSkn,jdbcType=INTEGER},
  48 + </if>
  49 + <if test="dateId != null" >
  50 + #{dateId,jdbcType=VARCHAR},
  51 + </if>
  52 + <if test="heatValue != null" >
  53 + #{heatValue,jdbcType=DECIMAL},
  54 + </if>
  55 + <if test="lastUpdateTime != null" >
  56 + #{lastUpdateTime,jdbcType=INTEGER},
  57 + </if>
  58 + </trim>
  59 + </insert>
  60 + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
  61 + update product_heat_value
  62 + <set >
  63 + <if test="dateId != null" >
  64 + date_id = #{dateId,jdbcType=VARCHAR},
  65 + </if>
  66 + <if test="heatValue != null" >
  67 + heat_value = #{heatValue,jdbcType=DECIMAL},
  68 + </if>
  69 + <if test="lastUpdateTime != null" >
  70 + last_update_time = #{lastUpdateTime,jdbcType=INTEGER},
  71 + </if>
  72 + </set>
  73 + where product_skn = #{productSkn,jdbcType=INTEGER}
  74 + </update>
  75 + <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
  76 + update product_heat_value
  77 + set date_id = #{dateId,jdbcType=VARCHAR},
  78 + heat_value = #{heatValue,jdbcType=DECIMAL},
  79 + last_update_time = #{lastUpdateTime,jdbcType=INTEGER}
  80 + where product_skn = #{productSkn,jdbcType=INTEGER}
  81 + </update>
  82 + <select id="selectHeatValueOfLatestDate" resultMap="BaseResultMap" timeout="20000">
  83 + <![CDATA[
  84 + select * from product_heat_value p
  85 + where
  86 + date_id = #{dateId}
  87 + and
  88 + p.product_skn in
  89 + ]]>
  90 + <foreach item="item" index="index" collection="sknList"
  91 + open="(" separator="," close=")">
  92 + #{item}
  93 + </foreach>
  94 + </select>
  95 + <select id="selectLatestDateId" resultType="java.lang.Integer">
  96 + select max(date_id) from product_heat_value
  97 + </select>
  98 +</mapper>
@@ -1030,6 +1030,9 @@ @@ -1030,6 +1030,9 @@
1030 } 1030 }
1031 }, 1031 },
1032 "type": "multi_field" 1032 "type": "multi_field"
  1033 + },
  1034 + "heatValue": {
  1035 + "type": "double"
1033 } 1036 }
1034 } 1037 }
1035 } 1038 }
1 package com.yoho.search.consumer.service.base; 1 package com.yoho.search.consumer.service.base;
2 2
3 -import java.math.BigDecimal;  
4 -import java.util.HashMap;  
5 -import java.util.Map;  
6 - 3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.alibaba.fastjson.JSONException;
  5 +import com.yoho.search.base.utils.ProductIndexEsField;
  6 +import com.yoho.search.consumer.service.bo.ProductIndexBO;
  7 +import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService;
7 import org.apache.commons.lang.StringUtils; 8 import org.apache.commons.lang.StringUtils;
8 import org.slf4j.Logger; 9 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
10 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
12 13
13 -import com.alibaba.fastjson.JSONArray;  
14 -import com.alibaba.fastjson.JSONException;  
15 -import com.yoho.search.base.utils.ProductIndexEsField;  
16 -import com.yoho.search.consumer.service.bo.ProductIndexBO;  
17 -import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService; 14 +import java.math.BigDecimal;
  15 +import java.util.HashMap;
  16 +import java.util.Map;
18 17
19 @Component 18 @Component
20 public class ProductIndexService { 19 public class ProductIndexService {
@@ -203,6 +202,7 @@ public class ProductIndexService { @@ -203,6 +202,7 @@ public class ProductIndexService {
203 map.put(ProductIndexEsField.shopDomain, productIndexBO.getShopDomain()); 202 map.put(ProductIndexEsField.shopDomain, productIndexBO.getShopDomain());
204 map.put(ProductIndexEsField.productAttrField, productIndexBO.getProductAttrField()); 203 map.put(ProductIndexEsField.productAttrField, productIndexBO.getProductAttrField());
205 map.put(ProductIndexEsField.bundleType, productIndexBO.getBundleType()); 204 map.put(ProductIndexEsField.bundleType, productIndexBO.getBundleType());
  205 + map.put(ProductIndexEsField.heatValue, productIndexBO.getHeatValue());
206 return map; 206 return map;
207 } 207 }
208 208
@@ -13,523 +13,530 @@ import java.math.BigDecimal; @@ -13,523 +13,530 @@ import java.math.BigDecimal;
13 13
14 public class ProductIndexBO extends ProductIBO implements Serializable { 14 public class ProductIndexBO extends ProductIBO implements Serializable {
15 15
16 - private static final long serialVersionUID = 1L; 16 + private static final long serialVersionUID = 1L;
17 17
18 - // from product_price  
19 - private BigDecimal specialPrice;  
20 - private BigDecimal marketPrice;  
21 - private Integer vipDiscountType;  
22 - private BigDecimal vipPrice;  
23 - private BigDecimal vip1Price;  
24 - private BigDecimal vip2Price;  
25 - private BigDecimal vip3Price;  
26 - private String vipLevels;// 支持的vip等级 18 + // from product_price
  19 + private BigDecimal specialPrice;
  20 + private BigDecimal marketPrice;
  21 + private Integer vipDiscountType;
  22 + private BigDecimal vipPrice;
  23 + private BigDecimal vip1Price;
  24 + private BigDecimal vip2Price;
  25 + private BigDecimal vip3Price;
  26 + private String vipLevels;// 支持的vip等级
27 27
28 - private BigDecimal salesPrice;  
29 - private BigDecimal studentPrice;  
30 - private String isStudentPrice;  
31 - private Long promotionDiscountInt;  
32 - private BigDecimal promotionDiscount;  
33 - private String specialoffer;  
34 - private String isDiscount; 28 + private BigDecimal salesPrice;
  29 + private BigDecimal studentPrice;
  30 + private String isStudentPrice;
  31 + private Long promotionDiscountInt;
  32 + private BigDecimal promotionDiscount;
  33 + private String specialoffer;
  34 + private String isDiscount;
35 35
36 - // from product_keywords  
37 - private String productKeyword; 36 + // from product_keywords
  37 + private String productKeyword;
38 38
39 - // from product_colors  
40 - private String colorIds;  
41 - private String colorNames; 39 + // from product_colors
  40 + private String colorIds;
  41 + private String colorNames;
42 42
43 - // from product_standards  
44 - private String standardIds;  
45 - private String standardNames;  
46 - private String standardOnlyNames; 43 + // from product_standards
  44 + private String standardIds;
  45 + private String standardNames;
  46 + private String standardOnlyNames;
47 47
48 - // from product_sizes  
49 - // private BigDecimal salesNum;  
50 - private BigDecimal storageNum;  
51 - private String isSoonSoldOut;  
52 - private String isSoldOut;  
53 - private Integer soldOut;  
54 - private String sizeIds;  
55 - private String sizeNames;  
56 - private double breakSizePercent; 48 + // from product_sizes
  49 + // private BigDecimal salesNum;
  50 + private BigDecimal storageNum;
  51 + private String isSoonSoldOut;
  52 + private String isSoldOut;
  53 + private Integer soldOut;
  54 + private String sizeIds;
  55 + private String sizeNames;
  56 + private double breakSizePercent;
57 57
58 - // from product_15day_salesnum  
59 - private Integer salesNum; 58 + // from product_15day_salesnum
  59 + private Integer salesNum;
60 60
61 - // from product_styles  
62 - private String styleIds; 61 + // from product_styles
  62 + private String styleIds;
63 63
64 - // from product_goods  
65 - private String goodsList; 64 + // from product_goods
  65 + private String goodsList;
66 66
67 - // from product_default_image  
68 - private String defaultImages; 67 + // from product_default_image
  68 + private String defaultImages;
69 69
70 - // from product_activities  
71 - private String activities; 70 + // from product_activities
  71 + private String activities;
72 72
73 - // from product_search  
74 - private Long sortWeight;  
75 - private Long brandWeight;  
76 - private Long shopWeight; 73 + // from product_search
  74 + private Long sortWeight;
  75 + private Long brandWeight;
  76 + private Long shopWeight;
77 77
78 - // from product_activities_link  
79 - private String yohoodId; 78 + // from product_activities_link
  79 + private String yohoodId;
80 80
81 - // from base_pin_ratio  
82 - private double basePinRatio; 81 + // from base_pin_ratio
  82 + private double basePinRatio;
83 83
84 - // from broken_code  
85 - private double breakingRate; 84 + // from broken_code
  85 + private double breakingRate;
86 86
87 - // from discount_product_skn  
88 - private double discountScore;  
89 - private String poolId; 87 + // from discount_product_skn
  88 + private double discountScore;
  89 + private String poolId;
90 90
91 - private String isStudentRebate; 91 + private String isStudentRebate;
92 92
93 - // form storage  
94 - private Integer storageUpdateTime; 93 + // form storage
  94 + private Integer storageUpdateTime;
95 95
96 - // from tbl_product  
97 - private Integer tblCountryId;  
98 - private String tblCountryName; 96 + // from tbl_product
  97 + private Integer tblCountryId;
  98 + private String tblCountryName;
99 99
100 - private String productFeatureFactor; 100 + private String productFeatureFactor;
101 101
102 - // from product_pool_detail  
103 - private JSONArray pools; 102 + // from product_pool_detail
  103 + private JSONArray pools;
104 104
105 - // from `erp_product`.`product_ext`  
106 - private String sknDefaultImg; 105 + // from `erp_product`.`product_ext`
  106 + private String sknDefaultImg;
107 107
108 - // from erp_product.product_attribute  
109 - // yh_shops.product_attribute_property_values  
110 - private String attributeNames; 108 + // from erp_product.product_attribute
  109 + // yh_shops.product_attribute_property_values
  110 + private String attributeNames;
111 111
112 - // from shops  
113 - private String shopName;  
114 - private String shopDomain; 112 + // from shops
  113 + private String shopName;
  114 + private String shopDomain;
115 115
116 - private String productAttrField; 116 + private String productAttrField;
  117 + private BigDecimal heatValue;
117 118
118 - // get  
119 - public BigDecimal getSpecialPrice() {  
120 - return specialPrice;  
121 - } 119 + public BigDecimal getSpecialPrice() {
  120 + return specialPrice;
  121 + }
122 122
123 - public BigDecimal getMarketPrice() {  
124 - return marketPrice;  
125 - } 123 + public BigDecimal getMarketPrice() {
  124 + return marketPrice;
  125 + }
126 126
127 - public Integer getVipDiscountType() {  
128 - return vipDiscountType;  
129 - } 127 + public Integer getVipDiscountType() {
  128 + return vipDiscountType;
  129 + }
130 130
131 - public BigDecimal getVipPrice() {  
132 - return vipPrice;  
133 - } 131 + public BigDecimal getVipPrice() {
  132 + return vipPrice;
  133 + }
134 134
135 - public BigDecimal getVip1Price() {  
136 - return vip1Price;  
137 - } 135 + public BigDecimal getVip1Price() {
  136 + return vip1Price;
  137 + }
138 138
139 - public BigDecimal getVip2Price() {  
140 - return vip2Price;  
141 - } 139 + public BigDecimal getVip2Price() {
  140 + return vip2Price;
  141 + }
142 142
143 - public BigDecimal getVip3Price() {  
144 - return vip3Price;  
145 - } 143 + public BigDecimal getVip3Price() {
  144 + return vip3Price;
  145 + }
146 146
147 - public String getVipLevels() {  
148 - return vipLevels;  
149 - } 147 + public String getVipLevels() {
  148 + return vipLevels;
  149 + }
150 150
151 - public void setVipLevels(String vipLevels) {  
152 - this.vipLevels = vipLevels;  
153 - } 151 + public void setVipLevels(String vipLevels) {
  152 + this.vipLevels = vipLevels;
  153 + }
154 154
155 - public BigDecimal getSalesPrice() {  
156 - return salesPrice;  
157 - } 155 + public BigDecimal getSalesPrice() {
  156 + return salesPrice;
  157 + }
158 158
159 - public Long getPromotionDiscountInt() {  
160 - return promotionDiscountInt;  
161 - } 159 + public Long getPromotionDiscountInt() {
  160 + return promotionDiscountInt;
  161 + }
162 162
163 - public BigDecimal getPromotionDiscount() {  
164 - return promotionDiscount;  
165 - } 163 + public BigDecimal getPromotionDiscount() {
  164 + return promotionDiscount;
  165 + }
166 166
167 - public String getSpecialoffer() {  
168 - return specialoffer;  
169 - } 167 + public String getSpecialoffer() {
  168 + return specialoffer;
  169 + }
170 170
171 - public String getIsDiscount() {  
172 - return isDiscount;  
173 - } 171 + public String getIsDiscount() {
  172 + return isDiscount;
  173 + }
174 174
175 - public String getProductKeyword() {  
176 - return productKeyword;  
177 - } 175 + public String getProductKeyword() {
  176 + return productKeyword;
  177 + }
178 178
179 - public String getColorIds() {  
180 - return colorIds;  
181 - } 179 + public String getColorIds() {
  180 + return colorIds;
  181 + }
182 182
183 - public String getColorNames() {  
184 - return colorNames;  
185 - } 183 + public String getColorNames() {
  184 + return colorNames;
  185 + }
186 186
187 - public String getStandardIds() {  
188 - return standardIds;  
189 - } 187 + public String getStandardIds() {
  188 + return standardIds;
  189 + }
190 190
191 - public String getStandardNames() {  
192 - return standardNames;  
193 - } 191 + public String getStandardNames() {
  192 + return standardNames;
  193 + }
194 194
195 - public String getStandardOnlyNames() {  
196 - return standardOnlyNames;  
197 - } 195 + public String getStandardOnlyNames() {
  196 + return standardOnlyNames;
  197 + }
198 198
199 - public Integer getSalesNum() {  
200 - return salesNum;  
201 - } 199 + public Integer getSalesNum() {
  200 + return salesNum;
  201 + }
202 202
203 - public BigDecimal getStorageNum() {  
204 - return storageNum;  
205 - } 203 + public BigDecimal getStorageNum() {
  204 + return storageNum;
  205 + }
206 206
207 - public String getIsSoonSoldOut() {  
208 - return isSoonSoldOut;  
209 - } 207 + public String getIsSoonSoldOut() {
  208 + return isSoonSoldOut;
  209 + }
210 210
211 - public String getIsSoldOut() {  
212 - return isSoldOut;  
213 - } 211 + public String getIsSoldOut() {
  212 + return isSoldOut;
  213 + }
214 214
215 - public Integer getSoldOut() {  
216 - return soldOut;  
217 - }  
218 -  
219 - public String getSizeIds() {  
220 - return sizeIds;  
221 - } 215 + public Integer getSoldOut() {
  216 + return soldOut;
  217 + }
222 218
223 - public String getStyleIds() {  
224 - return styleIds;  
225 - } 219 + public String getSizeIds() {
  220 + return sizeIds;
  221 + }
226 222
227 - public String getGoodsList() {  
228 - return goodsList;  
229 - } 223 + public String getStyleIds() {
  224 + return styleIds;
  225 + }
230 226
231 - public String getDefaultImages() {  
232 - return defaultImages;  
233 - } 227 + public String getGoodsList() {
  228 + return goodsList;
  229 + }
234 230
235 - public String getActivities() {  
236 - return activities;  
237 - } 231 + public String getDefaultImages() {
  232 + return defaultImages;
  233 + }
238 234
239 - public Long getSortWeight() {  
240 - return sortWeight;  
241 - } 235 + public String getActivities() {
  236 + return activities;
  237 + }
242 238
243 - public Long getBrandWeight() {  
244 - return brandWeight;  
245 - } 239 + public Long getSortWeight() {
  240 + return sortWeight;
  241 + }
246 242
247 - public String getYohoodId() {  
248 - return yohoodId;  
249 - } 243 + public Long getBrandWeight() {
  244 + return brandWeight;
  245 + }
250 246
251 - public double getBasePinRatio() {  
252 - return basePinRatio;  
253 - } 247 + public String getYohoodId() {
  248 + return yohoodId;
  249 + }
254 250
255 - public double getBreakingRate() {  
256 - return breakingRate;  
257 - } 251 + public double getBasePinRatio() {
  252 + return basePinRatio;
  253 + }
258 254
259 - public double getDiscountScore() {  
260 - return discountScore;  
261 - } 255 + public double getBreakingRate() {
  256 + return breakingRate;
  257 + }
262 258
263 - public String getPoolId() {  
264 - return poolId;  
265 - } 259 + public double getDiscountScore() {
  260 + return discountScore;
  261 + }
266 262
267 - // set  
268 - public void setSpecialPrice(BigDecimal specialPrice) {  
269 - this.specialPrice = specialPrice;  
270 - } 263 + public String getPoolId() {
  264 + return poolId;
  265 + }
271 266
272 - public void setMarketPrice(BigDecimal marketPrice) {  
273 - this.marketPrice = marketPrice;  
274 - } 267 + public void setSpecialPrice(BigDecimal specialPrice) {
  268 + this.specialPrice = specialPrice;
  269 + }
275 270
276 - public void setVipDiscountType(Integer vipDiscountType) {  
277 - this.vipDiscountType = vipDiscountType;  
278 - } 271 + public void setMarketPrice(BigDecimal marketPrice) {
  272 + this.marketPrice = marketPrice;
  273 + }
279 274
280 - public void setVipPrice(BigDecimal vipPrice) {  
281 - this.vipPrice = vipPrice;  
282 - } 275 + public void setVipDiscountType(Integer vipDiscountType) {
  276 + this.vipDiscountType = vipDiscountType;
  277 + }
283 278
284 - public void setVip1Price(BigDecimal vip1Price) {  
285 - this.vip1Price = vip1Price;  
286 - } 279 + public void setVipPrice(BigDecimal vipPrice) {
  280 + this.vipPrice = vipPrice;
  281 + }
287 282
288 - public void setVip2Price(BigDecimal vip2Price) {  
289 - this.vip2Price = vip2Price;  
290 - } 283 + public void setVip1Price(BigDecimal vip1Price) {
  284 + this.vip1Price = vip1Price;
  285 + }
291 286
292 - public void setVip3Price(BigDecimal vip3Price) {  
293 - this.vip3Price = vip3Price;  
294 - } 287 + public void setVip2Price(BigDecimal vip2Price) {
  288 + this.vip2Price = vip2Price;
  289 + }
295 290
296 - public void setSalesPrice(BigDecimal salesPrice) {  
297 - this.salesPrice = salesPrice;  
298 - } 291 + public void setVip3Price(BigDecimal vip3Price) {
  292 + this.vip3Price = vip3Price;
  293 + }
299 294
300 - public void setPromotionDiscountInt(Long promotionDiscountInt) {  
301 - this.promotionDiscountInt = promotionDiscountInt;  
302 - } 295 + public void setSalesPrice(BigDecimal salesPrice) {
  296 + this.salesPrice = salesPrice;
  297 + }
303 298
304 - public void setPromotionDiscount(BigDecimal promotionDiscount) {  
305 - this.promotionDiscount = promotionDiscount;  
306 - } 299 + public void setPromotionDiscountInt(Long promotionDiscountInt) {
  300 + this.promotionDiscountInt = promotionDiscountInt;
  301 + }
307 302
308 - public void setSpecialoffer(String specialoffer) {  
309 - this.specialoffer = specialoffer;  
310 - } 303 + public void setPromotionDiscount(BigDecimal promotionDiscount) {
  304 + this.promotionDiscount = promotionDiscount;
  305 + }
311 306
312 - public void setIsDiscount(String isDiscount) {  
313 - this.isDiscount = isDiscount;  
314 - } 307 + public void setSpecialoffer(String specialoffer) {
  308 + this.specialoffer = specialoffer;
  309 + }
315 310
316 - public void setProductKeyword(String productKeyword) {  
317 - this.productKeyword = productKeyword;  
318 - } 311 + public void setIsDiscount(String isDiscount) {
  312 + this.isDiscount = isDiscount;
  313 + }
319 314
320 - public void setColorIds(String colorIds) {  
321 - this.colorIds = colorIds == null ? null : colorIds.trim();  
322 - } 315 + public void setProductKeyword(String productKeyword) {
  316 + this.productKeyword = productKeyword;
  317 + }
323 318
324 - public void setColorNames(String colorNames) {  
325 - this.colorNames = colorNames == null ? null : colorNames.trim();  
326 - } 319 + public void setColorIds(String colorIds) {
  320 + this.colorIds = colorIds == null ? null : colorIds.trim();
  321 + }
327 322
328 - public void setStandardIds(String standardIds) {  
329 - this.standardIds = standardIds == null ? null : standardIds.trim();  
330 - } 323 + public void setColorNames(String colorNames) {
  324 + this.colorNames = colorNames == null ? null : colorNames.trim();
  325 + }
331 326
332 - public void setStandardNames(String standardNames) {  
333 - this.standardNames = standardNames == null ? null : standardNames.trim();  
334 - } 327 + public void setStandardIds(String standardIds) {
  328 + this.standardIds = standardIds == null ? null : standardIds.trim();
  329 + }
335 330
336 - public void setStandardOnlyNames(String standardOnlyNames) {  
337 - this.standardOnlyNames = standardOnlyNames == null ? null : standardOnlyNames.trim();  
338 - } 331 + public void setStandardNames(String standardNames) {
  332 + this.standardNames = standardNames == null ? null : standardNames.trim();
  333 + }
339 334
340 - public void setSalesNum(Integer salesNum) {  
341 - this.salesNum = salesNum;  
342 - } 335 + public void setStandardOnlyNames(String standardOnlyNames) {
  336 + this.standardOnlyNames = standardOnlyNames == null ? null : standardOnlyNames.trim();
  337 + }
343 338
344 - public void setStorageNum(BigDecimal storageNum) {  
345 - this.storageNum = storageNum;  
346 - } 339 + public void setSalesNum(Integer salesNum) {
  340 + this.salesNum = salesNum;
  341 + }
347 342
348 - public void setIsSoonSoldOut(String isSoonSoldOut) {  
349 - this.isSoonSoldOut = isSoonSoldOut;  
350 - } 343 + public void setStorageNum(BigDecimal storageNum) {
  344 + this.storageNum = storageNum;
  345 + }
351 346
352 - public void setIsSoldOut(String isSoldOut) {  
353 - this.isSoldOut = isSoldOut;  
354 - } 347 + public void setIsSoonSoldOut(String isSoonSoldOut) {
  348 + this.isSoonSoldOut = isSoonSoldOut;
  349 + }
355 350
356 - public void setSoldOut(Integer soldOut) {  
357 - this.soldOut = soldOut;  
358 - } 351 + public void setIsSoldOut(String isSoldOut) {
  352 + this.isSoldOut = isSoldOut;
  353 + }
359 354
360 - public void setSizeIds(String sizeIds) {  
361 - this.sizeIds = sizeIds == null ? null : sizeIds.trim();  
362 - } 355 + public void setSoldOut(Integer soldOut) {
  356 + this.soldOut = soldOut;
  357 + }
363 358
364 - public void setStyleIds(String styleIds) {  
365 - this.styleIds = styleIds == null ? null : styleIds.trim();  
366 - } 359 + public void setSizeIds(String sizeIds) {
  360 + this.sizeIds = sizeIds == null ? null : sizeIds.trim();
  361 + }
367 362
368 - public void setGoodsList(String goodsList) {  
369 - this.goodsList = goodsList == null ? null : goodsList.trim();  
370 - } 363 + public void setStyleIds(String styleIds) {
  364 + this.styleIds = styleIds == null ? null : styleIds.trim();
  365 + }
371 366
372 - public void setDefaultImages(String defaultImages) {  
373 - this.defaultImages = defaultImages == null ? null : defaultImages.trim();  
374 - } 367 + public void setGoodsList(String goodsList) {
  368 + this.goodsList = goodsList == null ? null : goodsList.trim();
  369 + }
375 370
376 - public void setActivities(String activities) {  
377 - this.activities = activities;  
378 - } 371 + public void setDefaultImages(String defaultImages) {
  372 + this.defaultImages = defaultImages == null ? null : defaultImages.trim();
  373 + }
379 374
380 - public void setSortWeight(Long sortWeight) {  
381 - this.sortWeight = sortWeight;  
382 - } 375 + public void setActivities(String activities) {
  376 + this.activities = activities;
  377 + }
383 378
384 - public void setBrandWeight(Long brandWeight) {  
385 - this.brandWeight = brandWeight;  
386 - } 379 + public void setSortWeight(Long sortWeight) {
  380 + this.sortWeight = sortWeight;
  381 + }
387 382
388 - public void setYohoodId(String yohoodId) {  
389 - this.yohoodId = yohoodId;  
390 - } 383 + public void setBrandWeight(Long brandWeight) {
  384 + this.brandWeight = brandWeight;
  385 + }
391 386
392 - public void setBasePinRatio(double basePinRatio) {  
393 - this.basePinRatio = basePinRatio;  
394 - } 387 + public void setYohoodId(String yohoodId) {
  388 + this.yohoodId = yohoodId;
  389 + }
395 390
396 - public void setBreakingRate(double breakingRate) {  
397 - this.breakingRate = breakingRate;  
398 - } 391 + public void setBasePinRatio(double basePinRatio) {
  392 + this.basePinRatio = basePinRatio;
  393 + }
399 394
400 - public void setDiscountScore(double discountScore) {  
401 - this.discountScore = discountScore;  
402 - } 395 + public void setBreakingRate(double breakingRate) {
  396 + this.breakingRate = breakingRate;
  397 + }
403 398
404 - public void setPoolId(String poolId) {  
405 - this.poolId = poolId;  
406 - } 399 + public void setDiscountScore(double discountScore) {
  400 + this.discountScore = discountScore;
  401 + }
407 402
408 - public BigDecimal getStudentPrice() {  
409 - return studentPrice;  
410 - } 403 + public void setPoolId(String poolId) {
  404 + this.poolId = poolId;
  405 + }
411 406
412 - public void setStudentPrice(BigDecimal studentPrice) {  
413 - this.studentPrice = studentPrice;  
414 - } 407 + public BigDecimal getStudentPrice() {
  408 + return studentPrice;
  409 + }
415 410
416 - public String getSizeNames() {  
417 - return sizeNames;  
418 - } 411 + public void setStudentPrice(BigDecimal studentPrice) {
  412 + this.studentPrice = studentPrice;
  413 + }
419 414
420 - public double getBreakSizePercent() {  
421 - return breakSizePercent;  
422 - } 415 + public String getSizeNames() {
  416 + return sizeNames;
  417 + }
423 418
424 - public void setBreakSizePercent(double breakSizePercent) {  
425 - this.breakSizePercent = breakSizePercent;  
426 - } 419 + public double getBreakSizePercent() {
  420 + return breakSizePercent;
  421 + }
427 422
428 - public String getIsStudentPrice() {  
429 - return isStudentPrice;  
430 - } 423 + public void setBreakSizePercent(double breakSizePercent) {
  424 + this.breakSizePercent = breakSizePercent;
  425 + }
431 426
432 - public void setSizeNames(String sizeNames) {  
433 - this.sizeNames = sizeNames;  
434 - } 427 + public String getIsStudentPrice() {
  428 + return isStudentPrice;
  429 + }
435 430
436 - public void setIsStudentPrice(String isStudentPrice) {  
437 - this.isStudentPrice = isStudentPrice;  
438 - } 431 + public void setSizeNames(String sizeNames) {
  432 + this.sizeNames = sizeNames;
  433 + }
439 434
440 - public Long getShopWeight() {  
441 - return shopWeight;  
442 - } 435 + public void setIsStudentPrice(String isStudentPrice) {
  436 + this.isStudentPrice = isStudentPrice;
  437 + }
443 438
444 - public void setShopWeight(Long shopWeight) {  
445 - this.shopWeight = shopWeight;  
446 - } 439 + public Long getShopWeight() {
  440 + return shopWeight;
  441 + }
447 442
448 - public String getIsStudentRebate() {  
449 - return isStudentRebate;  
450 - } 443 + public void setShopWeight(Long shopWeight) {
  444 + this.shopWeight = shopWeight;
  445 + }
451 446
452 - public void setIsStudentRebate(String isStudentRebate) {  
453 - this.isStudentRebate = isStudentRebate;  
454 - } 447 + public String getIsStudentRebate() {
  448 + return isStudentRebate;
  449 + }
455 450
456 - public Integer getStorageUpdateTime() {  
457 - return storageUpdateTime;  
458 - } 451 + public void setIsStudentRebate(String isStudentRebate) {
  452 + this.isStudentRebate = isStudentRebate;
  453 + }
459 454
460 - public void setStorageUpdateTime(Integer storageUpdateTime) {  
461 - this.storageUpdateTime = storageUpdateTime;  
462 - } 455 + public Integer getStorageUpdateTime() {
  456 + return storageUpdateTime;
  457 + }
463 458
464 - public String getProductFeatureFactor() {  
465 - return productFeatureFactor;  
466 - } 459 + public void setStorageUpdateTime(Integer storageUpdateTime) {
  460 + this.storageUpdateTime = storageUpdateTime;
  461 + }
467 462
468 - public void setProductFeatureFactor(String productFeatureFactor) {  
469 - this.productFeatureFactor = productFeatureFactor;  
470 - } 463 + public String getProductFeatureFactor() {
  464 + return productFeatureFactor;
  465 + }
471 466
472 - public Integer getTblCountryId() {  
473 - return tblCountryId;  
474 - } 467 + public void setProductFeatureFactor(String productFeatureFactor) {
  468 + this.productFeatureFactor = productFeatureFactor;
  469 + }
475 470
476 - public void setTblCountryId(Integer tblCountryId) {  
477 - this.tblCountryId = tblCountryId;  
478 - } 471 + public Integer getTblCountryId() {
  472 + return tblCountryId;
  473 + }
479 474
480 - public String getTblCountryName() {  
481 - return tblCountryName;  
482 - } 475 + public void setTblCountryId(Integer tblCountryId) {
  476 + this.tblCountryId = tblCountryId;
  477 + }
483 478
484 - public void setTblCountryName(String tblCountryName) {  
485 - this.tblCountryName = tblCountryName;  
486 - } 479 + public String getTblCountryName() {
  480 + return tblCountryName;
  481 + }
487 482
488 - public JSONArray getPools() {  
489 - return pools;  
490 - } 483 + public void setTblCountryName(String tblCountryName) {
  484 + this.tblCountryName = tblCountryName;
  485 + }
491 486
492 - public void setPools(JSONArray pools) {  
493 - this.pools = pools;  
494 - } 487 + public JSONArray getPools() {
  488 + return pools;
  489 + }
495 490
496 - public String getSknDefaultImg() {  
497 - return sknDefaultImg;  
498 - } 491 + public void setPools(JSONArray pools) {
  492 + this.pools = pools;
  493 + }
499 494
500 - public void setSknDefaultImg(String sknDefaultImg) {  
501 - this.sknDefaultImg = sknDefaultImg;  
502 - } 495 + public String getSknDefaultImg() {
  496 + return sknDefaultImg;
  497 + }
503 498
504 - public String getAttributeNames() {  
505 - return attributeNames;  
506 - } 499 + public void setSknDefaultImg(String sknDefaultImg) {
  500 + this.sknDefaultImg = sknDefaultImg;
  501 + }
507 502
508 - public void setAttributeNames(String attributeNames) {  
509 - this.attributeNames = attributeNames;  
510 - } 503 + public String getAttributeNames() {
  504 + return attributeNames;
  505 + }
511 506
512 - public String getShopName() {  
513 - return shopName;  
514 - } 507 + public void setAttributeNames(String attributeNames) {
  508 + this.attributeNames = attributeNames;
  509 + }
515 510
516 - public void setShopName(String shopName) {  
517 - this.shopName = shopName;  
518 - } 511 + public String getShopName() {
  512 + return shopName;
  513 + }
519 514
520 - public String getShopDomain() {  
521 - return shopDomain;  
522 - } 515 + public void setShopName(String shopName) {
  516 + this.shopName = shopName;
  517 + }
523 518
524 - public void setShopDomain(String shopDomain) {  
525 - this.shopDomain = shopDomain;  
526 - } 519 + public String getShopDomain() {
  520 + return shopDomain;
  521 + }
527 522
528 - public String getProductAttrField() {  
529 - return productAttrField;  
530 - } 523 + public void setShopDomain(String shopDomain) {
  524 + this.shopDomain = shopDomain;
  525 + }
531 526
532 - public void setProductAttrField(String productAttrField) {  
533 - this.productAttrField = productAttrField;  
534 - } 527 + public String getProductAttrField() {
  528 + return productAttrField;
  529 + }
  530 +
  531 + public void setProductAttrField(String productAttrField) {
  532 + this.productAttrField = productAttrField;
  533 + }
  534 +
  535 + public BigDecimal getHeatValue() {
  536 + return heatValue;
  537 + }
  538 +
  539 + public void setHeatValue(BigDecimal heatValue) {
  540 + this.heatValue = heatValue;
  541 + }
535 } 542 }
  1 +package com.yoho.search.consumer.service.logic.productIndex.viewBuilder;
  2 +
  3 +import com.yoho.search.consumer.service.bo.ProductIndexBO;
  4 +import com.yoho.search.dal.ProductHeatValueMapper;
  5 +import com.yoho.search.dal.model.ProductHeatValue;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +import java.util.stream.Collectors;
  13 +
  14 +/**
  15 + * Created by wangnan on 2017/4/10.
  16 + */
  17 +@Component
  18 +public class HeatValueBuilder implements ViewBuilder {
  19 +
  20 + @Autowired
  21 + private ProductHeatValueMapper productHeatValueMapper;
  22 +
  23 + @Override
  24 + public void build(List<ProductIndexBO> productIndexBOs, List<Integer> ids, List<Integer> sknList) {
  25 + List<ProductHeatValue> productHeatValueList = productHeatValueMapper.selectHeatValueOfLatestDate(sknList, productHeatValueMapper.selectLatestDateId());
  26 + Map<Integer, BigDecimal> productHeatValueMap = productHeatValueList.parallelStream().collect(Collectors.toMap(ProductHeatValue::getProductSkn, ProductHeatValue::getHeatValue));
  27 + productIndexBOs.stream().forEach((p) -> {p.setHeatValue(productHeatValueMap.get(p.getProductSkn()));});
  28 + }
  29 +}