...
|
...
|
@@ -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;
|
|
|
}
|
|
|
} |
...
|
...
|
|