Authored by wangnan

Merge branch 'gray' into wn_promotion

# Conflicts:
#	index/src/main/java/com/yoho/search/consumer/index/increment/ActivityProductMqListener.java
#	index/src/main/java/com/yoho/search/consumer/index/increment/ProductPriceMqListener.java
... ... @@ -14,18 +14,12 @@ public interface ProductMapper {
int updateByPrimaryKeySelective(Product record);
int updateByPrimaryKey(Product record);
List<Product> selectPageLists(@Param(value = "offset") Integer offset, @Param(value = "pageSize") Integer pageSize);
Integer selectProductIdBySkn(Integer productSkn);
Integer selectSknByProductId(Integer productId);
List<Product> selectSknsByProductIds(List<Integer> productIds);
List<Product> selectAll();
int selectCount();
Product selectBySkn(Integer skn);
... ...
... ... @@ -10,14 +10,10 @@ public interface ProductPriceMapper {
int insert(ProductPrice record);
int insertSelective(ProductPrice record);
ProductPrice selectByPrimaryKey(Integer productId);
int updateByPrimaryKeySelective(ProductPrice record);
int updateByPrimaryKey(ProductPrice record);
List<ProductPrice> selectPageLists(@Param(value="offset")Integer offset, @Param(value="pageSize")Integer pageSize);
List<ProductPrice> selectByIds(List<Integer> ids);
... ...
<?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.ProductMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.Product">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="shop_id" property="shopId" jdbcType="INTEGER"/>
... ... @@ -56,7 +57,9 @@
<result column="is_seckill" property="isSeckill" jdbcType="CHAR"/>
<result column="market_phrase" property="marketPhrase" jdbcType="VARCHAR"/>
<result column="bundle_type" property="bundleType" jdbcType="INTEGER"/>
<result column="coupon_limit_status" property="couponLimitStatus" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, erp_product_id,shop_id, product_name, cn_alphabet,
phrase, sales_phrase, brand_id, max_sort_id, middle_sort_id,
... ... @@ -67,8 +70,9 @@
first_shelve_time,shelve_time,expect_arrival_time, create_time, arrival_time,
edit_time, auditing_time, is_down, status, is_edit,
vip_discount_type, storage,is_outlets,folder_id,sell_channels,
elements, age_level,app_type,is_instalment,is_seckill,is_limitbuy,is_deposit_advance,market_phrase,bundle_type
elements, age_level,app_type,is_instalment,is_seckill,is_limitbuy,is_deposit_advance,market_phrase,bundle_type,coupon_limit_status
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer" timeout="20000">
select
... ... @@ -76,6 +80,7 @@
from product
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectBySkn" resultMap="BaseResultMap"
parameterType="java.lang.Integer" timeout="20000">
select
... ... @@ -84,11 +89,13 @@
where erp_product_id = #{skn,jdbcType=INTEGER}
limit 1
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
timeout="20000">
delete from product
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.Product"
timeout="20000">
insert ignore into product (id, erp_product_id,shop_id,
... ... @@ -112,7 +119,7 @@
status, is_edit, vip_discount_type,
storage,
is_outlets, folder_id,
sell_channels, elements,age_level,app_type,is_instalment,is_seckill,is_deposit_advance,is_limitbuy,market_phrase,bundle_type)
sell_channels, elements,age_level,app_type,is_instalment,is_seckill,is_deposit_advance,is_limitbuy,market_phrase,bundle_type,coupon_limit_status)
values
(#{id,jdbcType=INTEGER},
#{erpProductId,jdbcType=INTEGER},
... ... @@ -154,9 +161,11 @@
#{isDepositAdvance,jdbcType=CHAR},
#{isLimitbuy,jdbcType=CHAR},
#{marketPhrase,jdbcType=VARCHAR},
#{bundleType,jdbcType=INTEGER}
#{bundleType,jdbcType=INTEGER},
#{couponLimitStatus,jdbcType=INTEGER}
)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.Product"
timeout="20000">
update product
... ... @@ -321,34 +330,37 @@
<if test="bundleType != null">
bundle_type = #{bundleType,jdbcType=INTEGER},
</if>
<if test="couponLimitStatus != null">
coupon_limit_status = #{couponLimitStatus,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectCount" resultType="java.lang.Integer" timeout="20000">
SELECT count(*) FROM product
</select>
<select id="selectProductIdBySkn" resultType="java.lang.Integer"
parameterType="java.lang.Integer" timeout="20000">
SELECT id FROM product where
erp_product_id =
#{productSkn,jdbcType=INTEGER}
</select>
<select id="selectSknByProductId" resultType="java.lang.Integer"
parameterType="java.lang.Integer" timeout="20000">
SELECT erp_product_id FROM product where
id =
#{id,jdbcType=INTEGER}
</select>
<select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List"/>
from product limit #{offset},#{pageSize}
</select>
<select id="selectAll" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List"/>
from product
</select>
<select id="selectBySkns" resultMap="BaseResultMap">
Select
<include refid="Base_Column_List"/>
... ... @@ -358,6 +370,7 @@
#{item}
</foreach>
</select>
<select id="selectListByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
... ... @@ -367,4 +380,5 @@
#{item}
</foreach>
</select>
</mapper>
\ 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.ProductPriceMapper">
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ProductPrice">
<id column="product_id" property="productId" jdbcType="INTEGER" />
<result column="market_price" property="marketPrice" jdbcType="DECIMAL" />
<result column="sales_price" property="salesPrice" jdbcType="DECIMAL" />
<result column="purchase_price" property="purchasePrice"
jdbcType="DECIMAL" />
<result column="special_price" property="specialPrice"
jdbcType="DECIMAL" />
<result column="purchase_price" property="purchasePrice" jdbcType="DECIMAL" />
<result column="special_price" property="specialPrice" jdbcType="DECIMAL" />
<result column="yoho_coin_num" property="yohoCoinNum" jdbcType="INTEGER" />
<result column="purchase_num" property="purchaseNum" jdbcType="DECIMAL" />
<result column="purchase_cost" property="purchaseCost"
jdbcType="DECIMAL" />
<result column="purchase_cost" property="purchaseCost" jdbcType="DECIMAL" />
<result column="tariff" property="tariff" jdbcType="DECIMAL" />
<result column="vip_discount_type" property="vipDiscountType"
jdbcType="INTEGER" />
<result column="vip_discount_type" property="vipDiscountType" jdbcType="INTEGER" />
<result column="vip_discount" property="vipDiscount" jdbcType="DECIMAL" />
<result column="vip_price" property="vipPrice" jdbcType="DECIMAL" />
<result column="vip1_price" property="vip1Price" jdbcType="DECIMAL" />
... ... @@ -25,31 +22,36 @@
<result column="product_skn" property="productSkn" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="student_coin_rate" property="studentCoinRate" jdbcType="DECIMAL" />
<result column="lastReducePriceTime" property="lastReducePriceTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
<sql id="Base_Column_List">
product_id, market_price, sales_price, purchase_price, special_price,
yoho_coin_num,
purchase_num, purchase_cost, tariff, vip_discount_type, vip_discount, vip_price,
vip1_price, vip2_price, vip3_price,student_price, product_skn, update_time, student_coin_rate
vip1_price, vip2_price, vip3_price,student_price, product_skn, update_time, student_coin_rate,lastReducePriceTime
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer" timeout="20000">
select
<include refid="Base_Column_List" />
from product_price
where product_id = #{productId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" timeout="20000">
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" timeout="20000">
delete from product_price
where product_id = #{productId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.ProductPrice" timeout="20000">
<insert id="insert" parameterType="com.yoho.search.dal.model.ProductPrice" timeout="20000">
insert ignore into product_price (product_id, market_price, sales_price,
purchase_price, special_price, yoho_coin_num,
purchase_num, purchase_cost, tariff,
vip_discount_type, vip_discount, vip_price,
vip1_price, vip2_price, vip3_price,student_price,
product_skn, update_time, student_coin_rate)
product_skn, update_time, student_coin_rate,lastReducePriceTime)
values (#{productId,jdbcType=INTEGER}, #{marketPrice,jdbcType=DECIMAL},
#{salesPrice,jdbcType=DECIMAL},
#{purchasePrice,jdbcType=DECIMAL}, #{specialPrice,jdbcType=DECIMAL}, #{yohoCoinNum,jdbcType=INTEGER},
... ... @@ -58,218 +60,82 @@
#{vipDiscountType,jdbcType=INTEGER}, #{vipDiscount,jdbcType=DECIMAL}, #{vipPrice,jdbcType=DECIMAL},
#{vip1Price,jdbcType=DECIMAL}, #{vip2Price,jdbcType=DECIMAL},
#{vip3Price,jdbcType=DECIMAL},#{studentPrice,jdbcType=DECIMAL},
#{productSkn,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER} ,#{studentCoinRate,jdbcType=DECIMAL})
#{productSkn,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER} ,#{studentCoinRate,jdbcType=DECIMAL},#{lastReducePriceTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.ProductPrice" timeout="20000">
insert ignore into product_price
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="productId != null">
product_id,
</if>
<if test="marketPrice != null">
market_price,
</if>
<if test="salesPrice != null">
sales_price,
</if>
<if test="purchasePrice != null">
purchase_price,
</if>
<if test="specialPrice != null">
special_price,
</if>
<if test="yohoCoinNum != null">
yoho_coin_num,
</if>
<if test="purchaseNum != null">
purchase_num,
</if>
<if test="purchaseCost != null">
purchase_cost,
</if>
<if test="tariff != null">
tariff,
</if>
<if test="vipDiscountType != null">
vip_discount_type,
</if>
<if test="vipDiscount != null">
vip_discount,
</if>
<if test="vipPrice != null">
vip_price,
</if>
<if test="vip1Price != null">
vip1_price,
</if>
<if test="vip2Price != null">
vip2_price,
</if>
<if test="vip3Price != null">
vip3_price,
</if>
<if test="studentPrice != null">
student_price,
</if>
<if test="productSkn != null">
product_skn,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="studentCoinRate != null">
student_coin_rate,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productId != null">
#{productId,jdbcType=INTEGER},
</if>
<if test="marketPrice != null">
#{marketPrice,jdbcType=DECIMAL},
</if>
<if test="salesPrice != null">
#{salesPrice,jdbcType=DECIMAL},
</if>
<if test="purchasePrice != null">
#{purchasePrice,jdbcType=DECIMAL},
</if>
<if test="specialPrice != null">
#{specialPrice,jdbcType=DECIMAL},
</if>
<if test="yohoCoinNum != null">
#{yohoCoinNum,jdbcType=INTEGER},
</if>
<if test="purchaseNum != null">
#{purchaseNum,jdbcType=DECIMAL},
</if>
<if test="purchaseCost != null">
#{purchaseCost,jdbcType=DECIMAL},
</if>
<if test="tariff != null">
#{tariff,jdbcType=DECIMAL},
</if>
<if test="vipDiscountType != null">
#{vipDiscountType,jdbcType=INTEGER},
</if>
<if test="vipDiscount != null">
#{vipDiscount,jdbcType=DECIMAL},
</if>
<if test="vipPrice != null">
#{vipPrice,jdbcType=DECIMAL},
</if>
<if test="vip1Price != null">
#{vip1Price,jdbcType=DECIMAL},
</if>
<if test="vip2Price != null">
#{vip2Price,jdbcType=DECIMAL},
</if>
<if test="vip3Price != null">
#{vip3Price,jdbcType=DECIMAL},
</if>
<if test="studentPrice != null">
#{studentPrice,jdbcType=DECIMAL},
</if>
<if test="productSkn != null">
#{productSkn,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=INTEGER},
</if>
<if test="studentCoinRate != null">
#{studentCoinRate,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ProductPrice" timeout="20000">
update product_price
<set>
<if test="marketPrice != null">
market_price = #{marketPrice,jdbcType=DECIMAL},
</if>
<if test="salesPrice != null">
sales_price = #{salesPrice,jdbcType=DECIMAL},
</if>
<if test="purchasePrice != null">
purchase_price = #{purchasePrice,jdbcType=DECIMAL},
</if>
<if test="specialPrice != null">
special_price = #{specialPrice,jdbcType=DECIMAL},
</if>
<if test="yohoCoinNum != null">
yoho_coin_num = #{yohoCoinNum,jdbcType=INTEGER},
</if>
<if test="purchaseNum != null">
purchase_num = #{purchaseNum,jdbcType=DECIMAL},
</if>
<if test="purchaseCost != null">
purchase_cost = #{purchaseCost,jdbcType=DECIMAL},
</if>
<if test="tariff != null">
tariff = #{tariff,jdbcType=DECIMAL},
</if>
<if test="vipDiscountType != null">
vip_discount_type = #{vipDiscountType,jdbcType=INTEGER},
</if>
<if test="vipDiscount != null">
vip_discount = #{vipDiscount,jdbcType=DECIMAL},
</if>
<if test="vipPrice != null">
vip_price = #{vipPrice,jdbcType=DECIMAL},
</if>
<if test="vip1Price != null">
vip1_price = #{vip1Price,jdbcType=DECIMAL},
</if>
<if test="vip2Price != null">
vip2_price = #{vip2Price,jdbcType=DECIMAL},
</if>
<if test="vip3Price != null">
vip3_price = #{vip3Price,jdbcType=DECIMAL},
</if>
student_price = #{studentPrice,jdbcType=DECIMAL},
<if test="productSkn != null">
product_skn = #{productSkn,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="studentCoinRate != null">
student_coin_rate = #{studentCoinRate,jdbcType=DECIMAL},
</if>
</set>
where product_id = #{productId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.ProductPrice" timeout="20000">
update product_price
set market_price = #{marketPrice,jdbcType=DECIMAL},
sales_price = #{salesPrice,jdbcType=DECIMAL},
purchase_price = #{purchasePrice,jdbcType=DECIMAL},
special_price = #{specialPrice,jdbcType=DECIMAL},
yoho_coin_num = #{yohoCoinNum,jdbcType=INTEGER},
purchase_num = #{purchaseNum,jdbcType=DECIMAL},
purchase_cost = #{purchaseCost,jdbcType=DECIMAL},
tariff = #{tariff,jdbcType=DECIMAL},
vip_discount_type = #{vipDiscountType,jdbcType=INTEGER},
vip_discount = #{vipDiscount,jdbcType=DECIMAL},
vip_price = #{vipPrice,jdbcType=DECIMAL},
vip1_price = #{vip1Price,jdbcType=DECIMAL},
vip2_price = #{vip2Price,jdbcType=DECIMAL},YH
vip3_price = #{vip3Price,jdbcType=DECIMAL},
student_price = #{studentPrice,jdbcType=DECIMAL},
product_skn = #{productSkn,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=INTEGER},
student_coin_rate = #{studentCoinRate,jdbcType=DECIMAL}
where product_id = #{productId,jdbcType=INTEGER}
</update>
<select id="selectCount" resultType="java.lang.Integer" timeout="20000">
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ProductPrice" timeout="20000">
update product_price
<set>
<if test="marketPrice != null">
market_price = #{marketPrice,jdbcType=DECIMAL},
</if>
<if test="salesPrice != null">
sales_price = #{salesPrice,jdbcType=DECIMAL},
</if>
<if test="purchasePrice != null">
purchase_price = #{purchasePrice,jdbcType=DECIMAL},
</if>
<if test="specialPrice != null">
special_price = #{specialPrice,jdbcType=DECIMAL},
</if>
<if test="yohoCoinNum != null">
yoho_coin_num = #{yohoCoinNum,jdbcType=INTEGER},
</if>
<if test="purchaseNum != null">
purchase_num = #{purchaseNum,jdbcType=DECIMAL},
</if>
<if test="purchaseCost != null">
purchase_cost = #{purchaseCost,jdbcType=DECIMAL},
</if>
<if test="tariff != null">
tariff = #{tariff,jdbcType=DECIMAL},
</if>
<if test="vipDiscountType != null">
vip_discount_type = #{vipDiscountType,jdbcType=INTEGER},
</if>
<if test="vipDiscount != null">
vip_discount = #{vipDiscount,jdbcType=DECIMAL},
</if>
<if test="vipPrice != null">
vip_price = #{vipPrice,jdbcType=DECIMAL},
</if>
<if test="vip1Price != null">
vip1_price = #{vip1Price,jdbcType=DECIMAL},
</if>
<if test="vip2Price != null">
vip2_price = #{vip2Price,jdbcType=DECIMAL},
</if>
<if test="vip3Price != null">
vip3_price = #{vip3Price,jdbcType=DECIMAL},
</if>
student_price = #{studentPrice,jdbcType=DECIMAL},
<if test="productSkn != null">
product_skn = #{productSkn,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="studentCoinRate != null">
student_coin_rate = #{studentCoinRate,jdbcType=DECIMAL},
</if>
<if test="lastReducePriceTime != null">
lastReducePriceTime = #{lastReducePriceTime,jdbcType=INTEGER},
</if>
</set>
where product_id = #{productId,jdbcType=INTEGER}
</update>
<select id="selectCount" resultType="java.lang.Integer" timeout="20000">
SELECT count(1) FROM product_price
</select>
<select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
<select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List" />
from product_price limit #{offset},#{pageSize}
</select>
<select id="selectByIds" resultMap="BaseResultMap">
<select id="selectByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from product_price where product_id in
... ...
... ... @@ -1055,6 +1055,12 @@
},
"productProfitValue": {
"type":"long"
},
"lastReducePriceTime": {
"type": "long"
},
"couponLimitStatus": {
"type":"long"
}
}
}
... ...
... ... @@ -210,6 +210,8 @@ public class ProductIndexService {
map.put(ProductIndexEsField.giveValue, productIndexBO.getGiveValue());
map.put(ProductIndexEsField.profitValue, productIndexBO.getProfitValue());
map.put(ProductIndexEsField.promotionTitle, productIndexBO.getPromotionTitles());
map.put(ProductIndexEsField.lastReducePriceTime, productIndexBO.getLastReducePriceTime());
map.put(ProductIndexEsField.couponLimitStatus, productIndexBO.getCouponLimitStatus());
return map;
}
... ...
... ... @@ -62,6 +62,8 @@ public class ProductIBO implements Serializable {
private String isInstalment;
private String isSeckill;
private String marketPhrase;
private Integer couponLimitStatus;
// inner join brand
private String brandNameCn;
... ... @@ -689,4 +691,11 @@ public class ProductIBO implements Serializable {
this.isPhraseExist = isPhraseExist;
}
public Integer getCouponLimitStatus() {
return couponLimitStatus;
}
public void setCouponLimitStatus(Integer couponLimitStatus) {
this.couponLimitStatus = couponLimitStatus;
}
}
\ No newline at end of file
... ...
... ... @@ -126,6 +126,17 @@ public class ProductIndexBO extends ProductIBO implements Serializable {
private Integer giveValue;
private Integer profitValue;
// from product_price
private Integer lastReducePriceTime;
public Integer getLastReducePriceTime() {
return lastReducePriceTime;
}
public void setLastReducePriceTime(Integer lastReducePriceTime) {
this.lastReducePriceTime = lastReducePriceTime;
}
public Integer getActiveValue() {
return activeValue;
}
... ...
... ... @@ -18,6 +18,7 @@ public class ProductPriceBO {
private BigDecimal studentPrice;
private BigDecimal studentCoinRate;
private Integer updateTime;
private Integer lastReducePriceTime;
// others
private String isDiscount;
... ... @@ -42,9 +43,18 @@ public class ProductPriceBO {
this.studentPrice = productPrice.getStudentPrice();
this.studentCoinRate = productPrice.getStudentCoinRate();
this.updateTime = productPrice.getUpdateTime();
this.lastReducePriceTime = productPrice.getLastReducePriceTime();
}
public Integer getProductId() {
public Integer getLastReducePriceTime() {
return lastReducePriceTime;
}
public void setLastReducePriceTime(Integer lastReducePriceTime) {
this.lastReducePriceTime = lastReducePriceTime;
}
public Integer getProductId() {
return productId;
}
... ...
... ... @@ -164,6 +164,7 @@ public class ProductILogicService {
productIBO.setSellChannels(p.getSellChannels());
productIBO.setAgeLevel(p.getAgeLevel());
productIBO.setAppType(p.getAppType());
productIBO.setCouponLimitStatus(p.getCouponLimitStatus());
//品牌
this.buildBrand(brandMap,p,productIBO);
//品类
... ...
... ... @@ -72,6 +72,9 @@ public class ProductPriceBuilder implements ViewBuilder {
//设置价格更新时间
pi.setPriceUpdateTime(productPriceBO.getUpdateTime());
//设置最后一次降价时间
pi.setLastReducePriceTime(productPriceBO.getLastReducePriceTime());
// 计算isNew(规则:首次上架7天内展示且折扣率大于等于88折)
pi.setIsnew("N");
if (this.isNew(pi.getFirstShelveTime(), pi.getMarketPrice(), pi.getSalesPrice())) {
... ...