Authored by wangnan

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

package com.yoho.search.dal;
import com.yoho.search.dal.model.ProductHeatValue;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ProductHeatValueMapper {
int deleteByPrimaryKey(Integer productSkn);
int insert(ProductHeatValue record);
int insertSelective(ProductHeatValue record);
ProductHeatValue selectByPrimaryKey(Integer productSkn);
int updateByPrimaryKeySelective(ProductHeatValue record);
int updateByPrimaryKey(ProductHeatValue record);
Integer selectLatestDateId();
List<ProductHeatValue> selectHeatValueOfLatestDate(@Param(value="sknList")List<Integer> sknList, @Param(value="dateId")Integer dateId);
}
\ No newline at end of file
... ...
package com.yoho.search.dal.model;
import java.math.BigDecimal;
public class ProductHeatValue {
private Integer productSkn;
private String dateId;
private BigDecimal heatValue;
private Integer lastUpdateTime;
public Integer getProductSkn() {
return productSkn;
}
public void setProductSkn(Integer productSkn) {
this.productSkn = productSkn;
}
public String getDateId() {
return dateId;
}
public void setDateId(String dateId) {
this.dateId = dateId == null ? null : dateId.trim();
}
public BigDecimal getHeatValue() {
return heatValue;
}
public void setHeatValue(BigDecimal heatValue) {
this.heatValue = heatValue;
}
public Integer getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Integer lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.search.dal.ProductHeatValueMapper" >
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductHeatValue" >
<id column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="date_id" property="dateId" jdbcType="VARCHAR" />
<result column="heat_value" property="heatValue" jdbcType="DECIMAL" />
<result column="last_update_time" property="lastUpdateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, heat_value, last_update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from product_heat_value
where product_skn = #{productSkn,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from product_heat_value
where product_skn = #{productSkn,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
insert into product_heat_value (product_skn, date_id, heat_value,
last_update_time)
values (#{productSkn,jdbcType=INTEGER}, #{dateId,jdbcType=VARCHAR}, #{heatValue,jdbcType=DECIMAL},
#{lastUpdateTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
insert into product_heat_value
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="productSkn != null" >
product_skn,
</if>
<if test="dateId != null" >
date_id,
</if>
<if test="heatValue != null" >
heat_value,
</if>
<if test="lastUpdateTime != null" >
last_update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="productSkn != null" >
#{productSkn,jdbcType=INTEGER},
</if>
<if test="dateId != null" >
#{dateId,jdbcType=VARCHAR},
</if>
<if test="heatValue != null" >
#{heatValue,jdbcType=DECIMAL},
</if>
<if test="lastUpdateTime != null" >
#{lastUpdateTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
update product_heat_value
<set >
<if test="dateId != null" >
date_id = #{dateId,jdbcType=VARCHAR},
</if>
<if test="heatValue != null" >
heat_value = #{heatValue,jdbcType=DECIMAL},
</if>
<if test="lastUpdateTime != null" >
last_update_time = #{lastUpdateTime,jdbcType=INTEGER},
</if>
</set>
where product_skn = #{productSkn,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.ProductHeatValue" >
update product_heat_value
set date_id = #{dateId,jdbcType=VARCHAR},
heat_value = #{heatValue,jdbcType=DECIMAL},
last_update_time = #{lastUpdateTime,jdbcType=INTEGER}
where product_skn = #{productSkn,jdbcType=INTEGER}
</update>
<select id="selectHeatValueOfLatestDate" resultMap="BaseResultMap" timeout="20000">
<![CDATA[
select * from product_heat_value p
where
date_id = #{dateId}
and
p.product_skn in
]]>
<foreach item="item" index="index" collection="sknList"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectLatestDateId" resultType="java.lang.Integer">
select max(date_id) from product_heat_value
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -1030,6 +1030,9 @@
}
},
"type": "multi_field"
},
"heatValue": {
"type": "double"
}
}
}
... ...
package com.yoho.search.consumer.service.base;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.consumer.service.logic.tools.SpecialDealLogicService;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
@Component
public class ProductIndexService {
... ... @@ -203,6 +202,7 @@ public class ProductIndexService {
map.put(ProductIndexEsField.shopDomain, productIndexBO.getShopDomain());
map.put(ProductIndexEsField.productAttrField, productIndexBO.getProductAttrField());
map.put(ProductIndexEsField.bundleType, productIndexBO.getBundleType());
map.put(ProductIndexEsField.heatValue, productIndexBO.getHeatValue());
return map;
}
... ...
... ... @@ -13,523 +13,530 @@ import java.math.BigDecimal;
public class ProductIndexBO extends ProductIBO implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
// from product_price
private BigDecimal specialPrice;
private BigDecimal marketPrice;
private Integer vipDiscountType;
private BigDecimal vipPrice;
private BigDecimal vip1Price;
private BigDecimal vip2Price;
private BigDecimal vip3Price;
private String vipLevels;// 支持的vip等级
// from product_price
private BigDecimal specialPrice;
private BigDecimal marketPrice;
private Integer vipDiscountType;
private BigDecimal vipPrice;
private BigDecimal vip1Price;
private BigDecimal vip2Price;
private BigDecimal vip3Price;
private String vipLevels;// 支持的vip等级
private BigDecimal salesPrice;
private BigDecimal studentPrice;
private String isStudentPrice;
private Long promotionDiscountInt;
private BigDecimal promotionDiscount;
private String specialoffer;
private String isDiscount;
private BigDecimal salesPrice;
private BigDecimal studentPrice;
private String isStudentPrice;
private Long promotionDiscountInt;
private BigDecimal promotionDiscount;
private String specialoffer;
private String isDiscount;
// from product_keywords
private String productKeyword;
// from product_keywords
private String productKeyword;
// from product_colors
private String colorIds;
private String colorNames;
// from product_colors
private String colorIds;
private String colorNames;
// from product_standards
private String standardIds;
private String standardNames;
private String standardOnlyNames;
// from product_standards
private String standardIds;
private String standardNames;
private String standardOnlyNames;
// from product_sizes
// private BigDecimal salesNum;
private BigDecimal storageNum;
private String isSoonSoldOut;
private String isSoldOut;
private Integer soldOut;
private String sizeIds;
private String sizeNames;
private double breakSizePercent;
// from product_sizes
// private BigDecimal salesNum;
private BigDecimal storageNum;
private String isSoonSoldOut;
private String isSoldOut;
private Integer soldOut;
private String sizeIds;
private String sizeNames;
private double breakSizePercent;
// from product_15day_salesnum
private Integer salesNum;
// from product_15day_salesnum
private Integer salesNum;
// from product_styles
private String styleIds;
// from product_styles
private String styleIds;
// from product_goods
private String goodsList;
// from product_goods
private String goodsList;
// from product_default_image
private String defaultImages;
// from product_default_image
private String defaultImages;
// from product_activities
private String activities;
// from product_activities
private String activities;
// from product_search
private Long sortWeight;
private Long brandWeight;
private Long shopWeight;
// from product_search
private Long sortWeight;
private Long brandWeight;
private Long shopWeight;
// from product_activities_link
private String yohoodId;
// from product_activities_link
private String yohoodId;
// from base_pin_ratio
private double basePinRatio;
// from base_pin_ratio
private double basePinRatio;
// from broken_code
private double breakingRate;
// from broken_code
private double breakingRate;
// from discount_product_skn
private double discountScore;
private String poolId;
// from discount_product_skn
private double discountScore;
private String poolId;
private String isStudentRebate;
private String isStudentRebate;
// form storage
private Integer storageUpdateTime;
// form storage
private Integer storageUpdateTime;
// from tbl_product
private Integer tblCountryId;
private String tblCountryName;
// from tbl_product
private Integer tblCountryId;
private String tblCountryName;
private String productFeatureFactor;
private String productFeatureFactor;
// from product_pool_detail
private JSONArray pools;
// from product_pool_detail
private JSONArray pools;
// from `erp_product`.`product_ext`
private String sknDefaultImg;
// from `erp_product`.`product_ext`
private String sknDefaultImg;
// from erp_product.product_attribute
// yh_shops.product_attribute_property_values
private String attributeNames;
// from erp_product.product_attribute
// yh_shops.product_attribute_property_values
private String attributeNames;
// from shops
private String shopName;
private String shopDomain;
// from shops
private String shopName;
private String shopDomain;
private String productAttrField;
private String productAttrField;
private BigDecimal heatValue;
// get
public BigDecimal getSpecialPrice() {
return specialPrice;
}
public BigDecimal getSpecialPrice() {
return specialPrice;
}
public BigDecimal getMarketPrice() {
return marketPrice;
}
public BigDecimal getMarketPrice() {
return marketPrice;
}
public Integer getVipDiscountType() {
return vipDiscountType;
}
public Integer getVipDiscountType() {
return vipDiscountType;
}
public BigDecimal getVipPrice() {
return vipPrice;
}
public BigDecimal getVipPrice() {
return vipPrice;
}
public BigDecimal getVip1Price() {
return vip1Price;
}
public BigDecimal getVip1Price() {
return vip1Price;
}
public BigDecimal getVip2Price() {
return vip2Price;
}
public BigDecimal getVip2Price() {
return vip2Price;
}
public BigDecimal getVip3Price() {
return vip3Price;
}
public BigDecimal getVip3Price() {
return vip3Price;
}
public String getVipLevels() {
return vipLevels;
}
public String getVipLevels() {
return vipLevels;
}
public void setVipLevels(String vipLevels) {
this.vipLevels = vipLevels;
}
public void setVipLevels(String vipLevels) {
this.vipLevels = vipLevels;
}
public BigDecimal getSalesPrice() {
return salesPrice;
}
public BigDecimal getSalesPrice() {
return salesPrice;
}
public Long getPromotionDiscountInt() {
return promotionDiscountInt;
}
public Long getPromotionDiscountInt() {
return promotionDiscountInt;
}
public BigDecimal getPromotionDiscount() {
return promotionDiscount;
}
public BigDecimal getPromotionDiscount() {
return promotionDiscount;
}
public String getSpecialoffer() {
return specialoffer;
}
public String getSpecialoffer() {
return specialoffer;
}
public String getIsDiscount() {
return isDiscount;
}
public String getIsDiscount() {
return isDiscount;
}
public String getProductKeyword() {
return productKeyword;
}
public String getProductKeyword() {
return productKeyword;
}
public String getColorIds() {
return colorIds;
}
public String getColorIds() {
return colorIds;
}
public String getColorNames() {
return colorNames;
}
public String getColorNames() {
return colorNames;
}
public String getStandardIds() {
return standardIds;
}
public String getStandardIds() {
return standardIds;
}
public String getStandardNames() {
return standardNames;
}
public String getStandardNames() {
return standardNames;
}
public String getStandardOnlyNames() {
return standardOnlyNames;
}
public String getStandardOnlyNames() {
return standardOnlyNames;
}
public Integer getSalesNum() {
return salesNum;
}
public Integer getSalesNum() {
return salesNum;
}
public BigDecimal getStorageNum() {
return storageNum;
}
public BigDecimal getStorageNum() {
return storageNum;
}
public String getIsSoonSoldOut() {
return isSoonSoldOut;
}
public String getIsSoonSoldOut() {
return isSoonSoldOut;
}
public String getIsSoldOut() {
return isSoldOut;
}
public String getIsSoldOut() {
return isSoldOut;
}
public Integer getSoldOut() {
return soldOut;
}
public String getSizeIds() {
return sizeIds;
}
public Integer getSoldOut() {
return soldOut;
}
public String getStyleIds() {
return styleIds;
}
public String getSizeIds() {
return sizeIds;
}
public String getGoodsList() {
return goodsList;
}
public String getStyleIds() {
return styleIds;
}
public String getDefaultImages() {
return defaultImages;
}
public String getGoodsList() {
return goodsList;
}
public String getActivities() {
return activities;
}
public String getDefaultImages() {
return defaultImages;
}
public Long getSortWeight() {
return sortWeight;
}
public String getActivities() {
return activities;
}
public Long getBrandWeight() {
return brandWeight;
}
public Long getSortWeight() {
return sortWeight;
}
public String getYohoodId() {
return yohoodId;
}
public Long getBrandWeight() {
return brandWeight;
}
public double getBasePinRatio() {
return basePinRatio;
}
public String getYohoodId() {
return yohoodId;
}
public double getBreakingRate() {
return breakingRate;
}
public double getBasePinRatio() {
return basePinRatio;
}
public double getDiscountScore() {
return discountScore;
}
public double getBreakingRate() {
return breakingRate;
}
public String getPoolId() {
return poolId;
}
public double getDiscountScore() {
return discountScore;
}
// set
public void setSpecialPrice(BigDecimal specialPrice) {
this.specialPrice = specialPrice;
}
public String getPoolId() {
return poolId;
}
public void setMarketPrice(BigDecimal marketPrice) {
this.marketPrice = marketPrice;
}
public void setSpecialPrice(BigDecimal specialPrice) {
this.specialPrice = specialPrice;
}
public void setVipDiscountType(Integer vipDiscountType) {
this.vipDiscountType = vipDiscountType;
}
public void setMarketPrice(BigDecimal marketPrice) {
this.marketPrice = marketPrice;
}
public void setVipPrice(BigDecimal vipPrice) {
this.vipPrice = vipPrice;
}
public void setVipDiscountType(Integer vipDiscountType) {
this.vipDiscountType = vipDiscountType;
}
public void setVip1Price(BigDecimal vip1Price) {
this.vip1Price = vip1Price;
}
public void setVipPrice(BigDecimal vipPrice) {
this.vipPrice = vipPrice;
}
public void setVip2Price(BigDecimal vip2Price) {
this.vip2Price = vip2Price;
}
public void setVip1Price(BigDecimal vip1Price) {
this.vip1Price = vip1Price;
}
public void setVip3Price(BigDecimal vip3Price) {
this.vip3Price = vip3Price;
}
public void setVip2Price(BigDecimal vip2Price) {
this.vip2Price = vip2Price;
}
public void setSalesPrice(BigDecimal salesPrice) {
this.salesPrice = salesPrice;
}
public void setVip3Price(BigDecimal vip3Price) {
this.vip3Price = vip3Price;
}
public void setPromotionDiscountInt(Long promotionDiscountInt) {
this.promotionDiscountInt = promotionDiscountInt;
}
public void setSalesPrice(BigDecimal salesPrice) {
this.salesPrice = salesPrice;
}
public void setPromotionDiscount(BigDecimal promotionDiscount) {
this.promotionDiscount = promotionDiscount;
}
public void setPromotionDiscountInt(Long promotionDiscountInt) {
this.promotionDiscountInt = promotionDiscountInt;
}
public void setSpecialoffer(String specialoffer) {
this.specialoffer = specialoffer;
}
public void setPromotionDiscount(BigDecimal promotionDiscount) {
this.promotionDiscount = promotionDiscount;
}
public void setIsDiscount(String isDiscount) {
this.isDiscount = isDiscount;
}
public void setSpecialoffer(String specialoffer) {
this.specialoffer = specialoffer;
}
public void setProductKeyword(String productKeyword) {
this.productKeyword = productKeyword;
}
public void setIsDiscount(String isDiscount) {
this.isDiscount = isDiscount;
}
public void setColorIds(String colorIds) {
this.colorIds = colorIds == null ? null : colorIds.trim();
}
public void setProductKeyword(String productKeyword) {
this.productKeyword = productKeyword;
}
public void setColorNames(String colorNames) {
this.colorNames = colorNames == null ? null : colorNames.trim();
}
public void setColorIds(String colorIds) {
this.colorIds = colorIds == null ? null : colorIds.trim();
}
public void setStandardIds(String standardIds) {
this.standardIds = standardIds == null ? null : standardIds.trim();
}
public void setColorNames(String colorNames) {
this.colorNames = colorNames == null ? null : colorNames.trim();
}
public void setStandardNames(String standardNames) {
this.standardNames = standardNames == null ? null : standardNames.trim();
}
public void setStandardIds(String standardIds) {
this.standardIds = standardIds == null ? null : standardIds.trim();
}
public void setStandardOnlyNames(String standardOnlyNames) {
this.standardOnlyNames = standardOnlyNames == null ? null : standardOnlyNames.trim();
}
public void setStandardNames(String standardNames) {
this.standardNames = standardNames == null ? null : standardNames.trim();
}
public void setSalesNum(Integer salesNum) {
this.salesNum = salesNum;
}
public void setStandardOnlyNames(String standardOnlyNames) {
this.standardOnlyNames = standardOnlyNames == null ? null : standardOnlyNames.trim();
}
public void setStorageNum(BigDecimal storageNum) {
this.storageNum = storageNum;
}
public void setSalesNum(Integer salesNum) {
this.salesNum = salesNum;
}
public void setIsSoonSoldOut(String isSoonSoldOut) {
this.isSoonSoldOut = isSoonSoldOut;
}
public void setStorageNum(BigDecimal storageNum) {
this.storageNum = storageNum;
}
public void setIsSoldOut(String isSoldOut) {
this.isSoldOut = isSoldOut;
}
public void setIsSoonSoldOut(String isSoonSoldOut) {
this.isSoonSoldOut = isSoonSoldOut;
}
public void setSoldOut(Integer soldOut) {
this.soldOut = soldOut;
}
public void setIsSoldOut(String isSoldOut) {
this.isSoldOut = isSoldOut;
}
public void setSizeIds(String sizeIds) {
this.sizeIds = sizeIds == null ? null : sizeIds.trim();
}
public void setSoldOut(Integer soldOut) {
this.soldOut = soldOut;
}
public void setStyleIds(String styleIds) {
this.styleIds = styleIds == null ? null : styleIds.trim();
}
public void setSizeIds(String sizeIds) {
this.sizeIds = sizeIds == null ? null : sizeIds.trim();
}
public void setGoodsList(String goodsList) {
this.goodsList = goodsList == null ? null : goodsList.trim();
}
public void setStyleIds(String styleIds) {
this.styleIds = styleIds == null ? null : styleIds.trim();
}
public void setDefaultImages(String defaultImages) {
this.defaultImages = defaultImages == null ? null : defaultImages.trim();
}
public void setGoodsList(String goodsList) {
this.goodsList = goodsList == null ? null : goodsList.trim();
}
public void setActivities(String activities) {
this.activities = activities;
}
public void setDefaultImages(String defaultImages) {
this.defaultImages = defaultImages == null ? null : defaultImages.trim();
}
public void setSortWeight(Long sortWeight) {
this.sortWeight = sortWeight;
}
public void setActivities(String activities) {
this.activities = activities;
}
public void setBrandWeight(Long brandWeight) {
this.brandWeight = brandWeight;
}
public void setSortWeight(Long sortWeight) {
this.sortWeight = sortWeight;
}
public void setYohoodId(String yohoodId) {
this.yohoodId = yohoodId;
}
public void setBrandWeight(Long brandWeight) {
this.brandWeight = brandWeight;
}
public void setBasePinRatio(double basePinRatio) {
this.basePinRatio = basePinRatio;
}
public void setYohoodId(String yohoodId) {
this.yohoodId = yohoodId;
}
public void setBreakingRate(double breakingRate) {
this.breakingRate = breakingRate;
}
public void setBasePinRatio(double basePinRatio) {
this.basePinRatio = basePinRatio;
}
public void setDiscountScore(double discountScore) {
this.discountScore = discountScore;
}
public void setBreakingRate(double breakingRate) {
this.breakingRate = breakingRate;
}
public void setPoolId(String poolId) {
this.poolId = poolId;
}
public void setDiscountScore(double discountScore) {
this.discountScore = discountScore;
}
public BigDecimal getStudentPrice() {
return studentPrice;
}
public void setPoolId(String poolId) {
this.poolId = poolId;
}
public void setStudentPrice(BigDecimal studentPrice) {
this.studentPrice = studentPrice;
}
public BigDecimal getStudentPrice() {
return studentPrice;
}
public String getSizeNames() {
return sizeNames;
}
public void setStudentPrice(BigDecimal studentPrice) {
this.studentPrice = studentPrice;
}
public double getBreakSizePercent() {
return breakSizePercent;
}
public String getSizeNames() {
return sizeNames;
}
public void setBreakSizePercent(double breakSizePercent) {
this.breakSizePercent = breakSizePercent;
}
public double getBreakSizePercent() {
return breakSizePercent;
}
public String getIsStudentPrice() {
return isStudentPrice;
}
public void setBreakSizePercent(double breakSizePercent) {
this.breakSizePercent = breakSizePercent;
}
public void setSizeNames(String sizeNames) {
this.sizeNames = sizeNames;
}
public String getIsStudentPrice() {
return isStudentPrice;
}
public void setIsStudentPrice(String isStudentPrice) {
this.isStudentPrice = isStudentPrice;
}
public void setSizeNames(String sizeNames) {
this.sizeNames = sizeNames;
}
public Long getShopWeight() {
return shopWeight;
}
public void setIsStudentPrice(String isStudentPrice) {
this.isStudentPrice = isStudentPrice;
}
public void setShopWeight(Long shopWeight) {
this.shopWeight = shopWeight;
}
public Long getShopWeight() {
return shopWeight;
}
public String getIsStudentRebate() {
return isStudentRebate;
}
public void setShopWeight(Long shopWeight) {
this.shopWeight = shopWeight;
}
public void setIsStudentRebate(String isStudentRebate) {
this.isStudentRebate = isStudentRebate;
}
public String getIsStudentRebate() {
return isStudentRebate;
}
public Integer getStorageUpdateTime() {
return storageUpdateTime;
}
public void setIsStudentRebate(String isStudentRebate) {
this.isStudentRebate = isStudentRebate;
}
public void setStorageUpdateTime(Integer storageUpdateTime) {
this.storageUpdateTime = storageUpdateTime;
}
public Integer getStorageUpdateTime() {
return storageUpdateTime;
}
public String getProductFeatureFactor() {
return productFeatureFactor;
}
public void setStorageUpdateTime(Integer storageUpdateTime) {
this.storageUpdateTime = storageUpdateTime;
}
public void setProductFeatureFactor(String productFeatureFactor) {
this.productFeatureFactor = productFeatureFactor;
}
public String getProductFeatureFactor() {
return productFeatureFactor;
}
public Integer getTblCountryId() {
return tblCountryId;
}
public void setProductFeatureFactor(String productFeatureFactor) {
this.productFeatureFactor = productFeatureFactor;
}
public void setTblCountryId(Integer tblCountryId) {
this.tblCountryId = tblCountryId;
}
public Integer getTblCountryId() {
return tblCountryId;
}
public String getTblCountryName() {
return tblCountryName;
}
public void setTblCountryId(Integer tblCountryId) {
this.tblCountryId = tblCountryId;
}
public void setTblCountryName(String tblCountryName) {
this.tblCountryName = tblCountryName;
}
public String getTblCountryName() {
return tblCountryName;
}
public JSONArray getPools() {
return pools;
}
public void setTblCountryName(String tblCountryName) {
this.tblCountryName = tblCountryName;
}
public void setPools(JSONArray pools) {
this.pools = pools;
}
public JSONArray getPools() {
return pools;
}
public String getSknDefaultImg() {
return sknDefaultImg;
}
public void setPools(JSONArray pools) {
this.pools = pools;
}
public void setSknDefaultImg(String sknDefaultImg) {
this.sknDefaultImg = sknDefaultImg;
}
public String getSknDefaultImg() {
return sknDefaultImg;
}
public String getAttributeNames() {
return attributeNames;
}
public void setSknDefaultImg(String sknDefaultImg) {
this.sknDefaultImg = sknDefaultImg;
}
public void setAttributeNames(String attributeNames) {
this.attributeNames = attributeNames;
}
public String getAttributeNames() {
return attributeNames;
}
public String getShopName() {
return shopName;
}
public void setAttributeNames(String attributeNames) {
this.attributeNames = attributeNames;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public String getShopName() {
return shopName;
}
public String getShopDomain() {
return shopDomain;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public void setShopDomain(String shopDomain) {
this.shopDomain = shopDomain;
}
public String getShopDomain() {
return shopDomain;
}
public String getProductAttrField() {
return productAttrField;
}
public void setShopDomain(String shopDomain) {
this.shopDomain = shopDomain;
}
public void setProductAttrField(String productAttrField) {
this.productAttrField = productAttrField;
}
public String getProductAttrField() {
return productAttrField;
}
public void setProductAttrField(String productAttrField) {
this.productAttrField = productAttrField;
}
public BigDecimal getHeatValue() {
return heatValue;
}
public void setHeatValue(BigDecimal heatValue) {
this.heatValue = heatValue;
}
}
\ No newline at end of file
... ...
package com.yoho.search.consumer.service.logic.productIndex.viewBuilder;
import com.yoho.search.consumer.service.bo.ProductIndexBO;
import com.yoho.search.dal.ProductHeatValueMapper;
import com.yoho.search.dal.model.ProductHeatValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by wangnan on 2017/4/10.
*/
@Component
public class HeatValueBuilder implements ViewBuilder {
@Autowired
private ProductHeatValueMapper productHeatValueMapper;
@Override
public void build(List<ProductIndexBO> productIndexBOs, List<Integer> ids, List<Integer> sknList) {
List<ProductHeatValue> productHeatValueList = productHeatValueMapper.selectHeatValueOfLatestDate(sknList, productHeatValueMapper.selectLatestDateId());
Map<Integer, BigDecimal> productHeatValueMap = productHeatValueList.parallelStream().collect(Collectors.toMap(ProductHeatValue::getProductSkn, ProductHeatValue::getHeatValue));
productIndexBOs.stream().forEach((p) -> {p.setHeatValue(productHeatValueMap.get(p.getProductSkn()));});
}
}
... ...