Commit ae661fd1 authored by hezhen's avatar hezhen

Merge branch 'hz_master' into master_pay

parents b5f4ac88 d1753bbc
...@@ -59,11 +59,17 @@ public class UserCouponVo { ...@@ -59,11 +59,17 @@ public class UserCouponVo {
@ApiModelProperty(value = "开始时间", hidden = true ) @ApiModelProperty(value = "开始时间", hidden = true )
private Long startTime; private Long startTime;
/** /**
* 到期时间 * 到期时间
*/ */
@ApiModelProperty(value = "到期时间", hidden = true ) @ApiModelProperty(value = "到期时间", hidden = true )
private Long expireTime; private Long expireTime;
@ApiModelProperty(value = "到期时间字符串")
private String expireDate;
/** /**
* 使用时间 * 使用时间
......
...@@ -124,9 +124,12 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> { ...@@ -124,9 +124,12 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
if(type==1){ if(type==1){
startTime=coupon.getStartTime(); startTime=coupon.getStartTime();
expireTime=coupon.getValidEndTime(); expireTime=coupon.getValidEndTime();
}else { }else if (type==2){
startTime=expireTime; startTime=expireTime;
expireTime+=DAY*coupon.getValidDays(); expireTime+=DAY*coupon.getValidDays();
} else {
startTime=expireTime;
expireTime=-1L;
} }
String ticker_no=Snowflake.build()+""; String ticker_no=Snowflake.build()+"";
UserCoupon userCoupon=new UserCoupon(); UserCoupon userCoupon=new UserCoupon();
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result property="crtTime" column="crt_time"/> <result property="crtTime" column="crt_time"/>
<result property="startTime" column="start_time"/> <result property="startTime" column="start_time"/>
<result property="expireTime" column="expire_time"/> <result property="expireTime" column="expire_time"/>
<result property="expireDate" column="expireDate"/>
<result property="useTime" column="use_time"/> <result property="useTime" column="use_time"/>
<result property="title" column="title"/> <result property="title" column="title"/>
<result property="subtitle" column="subtitle"/> <result property="subtitle" column="subtitle"/>
...@@ -32,20 +33,20 @@ ...@@ -32,20 +33,20 @@
<select id="getUserCouponsByType" resultMap="userCouponMap"> <select id="getUserCouponsByType" resultMap="userCouponMap">
SELECT SELECT
* *,IF(expire_time=-1,'永久有效',CONCAT('有效期至',FROM_UNIXTIME(expire_time/1000,'%Y-%m-%d'))) as expireDate
FROM FROM
user_coupon u user_coupon u
LEFT JOIN coupon c ON u.coupon_id = c.id LEFT JOIN coupon c ON u.coupon_id = c.id
WHERE WHERE
u.is_del = 0 and u.user_id=#{userId} u.is_del = 0 and u.user_id=#{userId}
<if test="type==0"> <if test="type==0">
and u.is_use=0 and u.expire_time >=#{time} and u.is_use=0 and (u.expire_time >=#{time} or u.expire_time=-1)
</if> </if>
<if test="type==1"> <if test="type==1">
and u.is_use=1 and u.is_use=1
</if> </if>
<if test="type==2"> <if test="type==2">
and u.is_use=0 and u.expire_time &lt;#{time} and u.is_use=0 and u.expire_time &lt;#{time} and u.expire_time!=-1
</if> </if>
<if test="channel!=null and channel!=''"> <if test="channel!=null and channel!=''">
and (c.channel=#{channel} or c.channel=0 ) and (c.channel=#{channel} or c.channel=0 )
......
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