Authored by LUOXC

Merge branch 'test6.9.21' into gray

... ... @@ -54,7 +54,7 @@
AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
and receive_start_time <![CDATA[ <= ]]> #{currentTime}
AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
ORDER BY coupon_type,use_limit_type,`use_limit_value` DESC
ORDER BY coupon_type,use_limit_type,`coupon_amount` DESC
limit #{offset},#{limit}
</select>
... ... @@ -90,7 +90,7 @@
AND (#{currentTime} <![CDATA[ < ]]> `end_time` OR #{currentTime} <![CDATA[ < ]]> `receive_end_time`)
and receive_start_time <![CDATA[ <= ]]> #{currentTime}
AND `business_client` LIKE CONCAT('%',#{businessClient},'%')
ORDER BY `use_limit_value` DESC
ORDER BY `coupon_amount` DESC
limit #{offset},#{limit}
</select>
... ... @@ -98,7 +98,9 @@
SELECT DISTINCT cpn.id FROM coupon cpn
LEFT JOIN `coupon_product_limit` cpl ON cpl.`coupon_id` = cpn.id
WHERE coupon_type = #{couponType}
and use_limit_type = #{useLimitType}
<if test="useLimitType != null">
and use_limit_type = #{useLimitType}
</if>
and ((cpn.`product_limit_type` = 1 AND cpl.`product_id` = #{productId}) OR (cpn.`product_limit_type` = 3 AND cpl.`product_id` != #{productId}) OR cpn.`product_limit_type` =2)
</sql>
... ...
... ... @@ -167,11 +167,17 @@ public class CouponConvert {
&& DateUtil.between(userCoupon.getEndTime() - DateUtil.getCurrentTimeSecond(), 0, THREE_DAY_SECOND);
}
/**
* 展示原有的券名
* @param coupon
* @param userCoupon
* @return
*/
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon, UserCoupon userCoupon){
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
couponSimpleBo.setCouponId(coupon.getId());
couponSimpleBo.setCouponName(coupon.getCouponName());
String couponName = coupon.getCouponName();
couponSimpleBo.setCouponName(couponName);
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
couponSimpleBo.setUseLimitValue(String.valueOf(coupon.getUseLimitValue()));
... ... @@ -188,7 +194,7 @@ public class CouponConvert {
if (Objects.nonNull(receiveEndTime=coupon.getReceiveEndTime())){
couponSimpleBo.setReceiveEndTime(DateUtil.formatDate(receiveEndTime, DateUtil.YYYY_MM_DD_DOT));
}
//
//是否可以领取
if (Objects.nonNull(userCoupon)){
couponSimpleBo.setReceive("N");
}else{
... ... @@ -197,10 +203,16 @@ public class CouponConvert {
return couponSimpleBo;
}
/**
* 重命名券名
* @param coupon
* @return
*/
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon){
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
couponSimpleBo.setCouponId(coupon.getId());
couponSimpleBo.setCouponName(coupon.getCouponName());
String newName = buildCouponNameByType(coupon);
couponSimpleBo.setCouponName(newName);
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
String useLimitValueStr;
... ... @@ -209,9 +221,18 @@ public class CouponConvert {
couponSimpleBo.setCouponToken(coupon.getCouponToken());
Integer couponType;
couponSimpleBo.setCouponType(couponType=coupon.getCouponType());
String couponDesc = null;
couponSimpleBo.setStartTime(DateUtil.formatDate(coupon.getStartTime(), DateUtil.YYYY_MM_DD_DOT));
couponSimpleBo.setEndTime(DateUtil.formatDate(coupon.getEndTime(), DateUtil.YYYY_MM_DD_DOT));
return couponSimpleBo;
}
static String buildCouponNameByType(Coupon coupon){
String couponAmountSkipDecimal = BigDecimalHelper.getStripTrailingZeros(coupon.getCouponAmount());
Integer couponType = coupon.getCouponType();
String useLimitValueStr=String.valueOf(coupon.getUseLimitValue());
String couponDesc = coupon.getCouponName();
if (Integer.valueOf(CouponTypeEnum.ACTIVITY_COUPON.getCode()).equals(couponType)) {
String useLimitTypeStr = coupon.getUseLimitType().toString();
if (CouponUseLimitTypeEnum.NON_LIMIT.getLimitType().equals(useLimitTypeStr)) {
... ... @@ -222,11 +243,8 @@ public class CouponConvert {
}
}
if (Integer.valueOf(CouponTypeEnum.SHIPPING_COUPON.getCode()).equals(couponType)){
couponDesc = "包邮" + couponAmountSkipDecimal;
couponDesc = "包邮";
}
couponSimpleBo.setCouponDesc(couponDesc);
couponSimpleBo.setStartTime(DateUtil.formatDate(coupon.getStartTime(), DateUtil.YYYY_MM_DD_DOT));
couponSimpleBo.setEndTime(DateUtil.formatDate(coupon.getEndTime(), DateUtil.YYYY_MM_DD_DOT));
return couponSimpleBo;
return couponDesc;
}
}
... ...