Authored by chenchao

fix coupon name

... ... @@ -171,7 +171,8 @@ public class CouponConvert {
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon, UserCoupon userCoupon){
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
couponSimpleBo.setCouponId(coupon.getId());
couponSimpleBo.setCouponName(coupon.getCouponName());
String couponName = buildCouponNameByType(coupon);
couponSimpleBo.setCouponName(couponName);
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
couponSimpleBo.setUseLimitValue(String.valueOf(coupon.getUseLimitValue()));
... ... @@ -188,7 +189,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{
... ... @@ -209,9 +210,19 @@ public class CouponConvert {
couponSimpleBo.setCouponToken(coupon.getCouponToken());
Integer couponType;
couponSimpleBo.setCouponType(couponType=coupon.getCouponType());
String couponDesc = null;
String couponDesc = buildCouponNameByType(coupon);
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;
}
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)) {
... ... @@ -224,9 +235,6 @@ public class CouponConvert {
if (Integer.valueOf(CouponTypeEnum.SHIPPING_COUPON.getCode()).equals(couponType)){
couponDesc = "包邮" + couponAmountSkipDecimal;
}
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;
}
}
... ...