Authored by wangnan

【曝光值、曝光类型】 ctr 改成 bigdecimal

package com.yoho.search.dal.model;
import java.math.BigDecimal;
public class SknCtrValue {
private Integer productSkn;
private String dateId;
private Integer ctrValue;
private BigDecimal ctrValue;
private Integer createTime;
... ... @@ -25,11 +27,11 @@ public class SknCtrValue {
this.dateId = dateId == null ? null : dateId.trim();
}
public Integer getCtrValue() {
public BigDecimal getCtrValue() {
return ctrValue;
}
public void setCtrValue(Integer ctrValue) {
public void setCtrValue(BigDecimal ctrValue) {
this.ctrValue = ctrValue;
}
... ...
... ... @@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.SknCtrValue" >
<id column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="date_id" property="dateId" jdbcType="VARCHAR" />
<result column="ctr_value" property="ctrValue" jdbcType="INTEGER" />
<result column="ctr_value" property="ctrValue" jdbcType="BigDecimal" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
... ... @@ -23,7 +23,7 @@
<insert id="insert" parameterType="com.yoho.search.dal.model.SknCtrValue" >
insert into skn_ctr_value (product_skn, date_id, ctr_value,
create_time)
values (#{productSkn,jdbcType=INTEGER}, #{dateId,jdbcType=VARCHAR}, #{ctrValue,jdbcType=INTEGER},
values (#{productSkn,jdbcType=INTEGER}, #{dateId,jdbcType=VARCHAR}, #{ctrValue,jdbcType=BigDecimal},
#{createTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.SknCtrValue" >
... ... @@ -50,7 +50,7 @@
#{dateId,jdbcType=VARCHAR},
</if>
<if test="ctrValue != null" >
#{ctrValue,jdbcType=INTEGER},
#{ctrValue,jdbcType=BigDecimal},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
... ... @@ -64,7 +64,7 @@
date_id = #{dateId,jdbcType=VARCHAR},
</if>
<if test="ctrValue != null" >
ctr_value = #{ctrValue,jdbcType=INTEGER},
ctr_value = #{ctrValue,jdbcType=BigDecimal},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=INTEGER},
... ... @@ -75,7 +75,7 @@
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.SknCtrValue" >
update skn_ctr_value
set date_id = #{dateId,jdbcType=VARCHAR},
ctr_value = #{ctrValue,jdbcType=INTEGER},
ctr_value = #{ctrValue,jdbcType=BigDecimal},
create_time = #{createTime,jdbcType=INTEGER}
where product_skn = #{productSkn,jdbcType=INTEGER}
</update>
... ...
... ... @@ -769,7 +769,7 @@
"index": "not_analyzed"
},
"ctrValue": {
"type": "long"
"type": "double"
},
"flowType": {
"type": "long"
... ...
... ... @@ -139,16 +139,16 @@ public class ProductIndexBO extends ProductIBO implements Serializable {
private String specialSearchFieldVideo;
//from ctr_value
private Integer ctrValue;
private BigDecimal ctrValue;
//skn_flow
private Integer flowType;
public Integer getCtrValue() {
public BigDecimal getCtrValue() {
return ctrValue;
}
public void setCtrValue(Integer ctrValue) {
public void setCtrValue(BigDecimal ctrValue) {
this.ctrValue = ctrValue;
}
... ...
... ... @@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
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;
... ... @@ -32,7 +33,7 @@ public class CtrValueBuilder implements ViewBuilder {
if (CollectionUtils.isEmpty(sknCtrValueList)) {
return;
}
Map<Integer,Integer> ctrValueMap = sknCtrValueList.stream().parallel().collect(Collectors.toMap(SknCtrValue::getProductSkn,SknCtrValue::getCtrValue));
Map<Integer,BigDecimal> ctrValueMap = sknCtrValueList.stream().parallel().collect(Collectors.toMap(SknCtrValue::getProductSkn,SknCtrValue::getCtrValue));
productIndexBOs.stream().forEach(p->{
if (ctrValueMap.containsKey(p.getProductSkn())) {
p.setCtrValue(ctrValueMap.get(p.getProductSkn()));
... ...