Commit 3d152d6d by 吕明尚

优惠券配置增加过期天数

parent b639d475
......@@ -134,6 +134,12 @@ public class SCoupon extends BaseEntity
private String weeks;
/**
* 过期天数
*/
@Excel(name = "过期天数")
private Integer expirationNumber;
/**
* 第三方平台类型(1:自营,2:美团)
*/
@Excel(name = "第三方平台类型(1:自营,2:美团,3: 抖音)")
......
......@@ -473,7 +473,15 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setSourceType(SourceTypeEnum.GIVE.getCode());
newSConsumerCoupon.setPlatformType(sCoupon.getPlatformType());
newSConsumerCoupon.setStartDate(sCoupon.getStartDate());
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
if (ObjectUtils.isEmpty(sCoupon.getExpirationNumber())) {
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
} else {
if (DateUtils.addDays(new Date(), sCoupon.getExpirationNumber()).getTime() < sCoupon.getEndDate().getTime()) {
newSConsumerCoupon.setEndDate(DateUtils.addDays(new Date(), sCoupon.getExpirationNumber()));
} else {
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
}
}
newSConsumerCoupon.setRemark(sCoupon.getRemark());
newSConsumerCoupon.setCreateTime(new Date());
int insert = baseMapper.insert(newSConsumerCoupon);
......
......@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="weeks" column="weeks"/>
<result property="platformType" column="platform_type" />
<result property="number" column="number" />
<result property="expirationNumber" column="expiration_number"/>
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
......@@ -55,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
min_price,
original_price,
is_overlay,
expiration_number,
platform_type,number,create_by,
create_time,update_by,update_time,
remark from s_coupon
......@@ -87,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="platformType != null"> and platform_type = #{platformType}</if>
<if test="weeks != null">and weeks = #{weeks}</if>
<if test="number != null"> and number = #{number}</if>
<if test="expirationNumber != null">and expiration_number = #{expirationNumber}</if>
<if test="createBy != null"> and create_by = #{createBy}</if>
<if test="createTime != null"> and create_time = #{createTime}</if>
<if test="updateBy != null"> and update_by = #{updateBy}</if>
......@@ -158,6 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storeIds != null">store_ids,</if>
<if test="couponPayPrice != null">coupon_pay_price,</if>
<if test="salePrice != null">sale_price,</if>
<if test="expirationNumber != null">expiration_number,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
......@@ -187,6 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="storeIds != null">#{storeIds},</if>
<if test="couponPayPrice != null">#{couponPayPrice},</if>
<if test="salePrice != null">#{salePrice},</if>
<if test="expirationNumber != null">#{expirationNumber},</if>
</trim>
</insert>
......@@ -222,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark = #{remark},</if>
<if test="couponPayPrice != null">coupon_pay_price = #{couponPayPrice},</if>
<if test="salePrice != null">sale_price = #{salePrice},</if>
<if test="expirationNumber != null">expiration_number = #{expirationNumber},</if>
</trim>
where id = #{id}
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment