|
@@ -167,11 +167,17 @@ public class CouponConvert { |
|
@@ -167,11 +167,17 @@ public class CouponConvert { |
167
|
&& DateUtil.between(userCoupon.getEndTime() - DateUtil.getCurrentTimeSecond(), 0, THREE_DAY_SECOND);
|
167
|
&& DateUtil.between(userCoupon.getEndTime() - DateUtil.getCurrentTimeSecond(), 0, THREE_DAY_SECOND);
|
168
|
}
|
168
|
}
|
169
|
|
169
|
|
170
|
-
|
170
|
+ /**
|
|
|
171
|
+ * 展示原有的券名
|
|
|
172
|
+ * @param coupon
|
|
|
173
|
+ * @param userCoupon
|
|
|
174
|
+ * @return
|
|
|
175
|
+ */
|
171
|
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon, UserCoupon userCoupon){
|
176
|
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon, UserCoupon userCoupon){
|
172
|
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
|
177
|
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
|
173
|
couponSimpleBo.setCouponId(coupon.getId());
|
178
|
couponSimpleBo.setCouponId(coupon.getId());
|
174
|
- couponSimpleBo.setCouponName(coupon.getCouponName());
|
179
|
+ String couponName = coupon.getCouponName();
|
|
|
180
|
+ couponSimpleBo.setCouponName(couponName);
|
175
|
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
|
181
|
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
|
176
|
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
|
182
|
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
|
177
|
couponSimpleBo.setUseLimitValue(String.valueOf(coupon.getUseLimitValue()));
|
183
|
couponSimpleBo.setUseLimitValue(String.valueOf(coupon.getUseLimitValue()));
|
|
@@ -188,7 +194,7 @@ public class CouponConvert { |
|
@@ -188,7 +194,7 @@ public class CouponConvert { |
188
|
if (Objects.nonNull(receiveEndTime=coupon.getReceiveEndTime())){
|
194
|
if (Objects.nonNull(receiveEndTime=coupon.getReceiveEndTime())){
|
189
|
couponSimpleBo.setReceiveEndTime(DateUtil.formatDate(receiveEndTime, DateUtil.YYYY_MM_DD_DOT));
|
195
|
couponSimpleBo.setReceiveEndTime(DateUtil.formatDate(receiveEndTime, DateUtil.YYYY_MM_DD_DOT));
|
190
|
}
|
196
|
}
|
191
|
- //
|
197
|
+ //是否可以领取
|
192
|
if (Objects.nonNull(userCoupon)){
|
198
|
if (Objects.nonNull(userCoupon)){
|
193
|
couponSimpleBo.setReceive("N");
|
199
|
couponSimpleBo.setReceive("N");
|
194
|
}else{
|
200
|
}else{
|
|
@@ -197,10 +203,16 @@ public class CouponConvert { |
|
@@ -197,10 +203,16 @@ public class CouponConvert { |
197
|
return couponSimpleBo;
|
203
|
return couponSimpleBo;
|
198
|
}
|
204
|
}
|
199
|
|
205
|
|
|
|
206
|
+ /**
|
|
|
207
|
+ * 重命名券名
|
|
|
208
|
+ * @param coupon
|
|
|
209
|
+ * @return
|
|
|
210
|
+ */
|
200
|
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon){
|
211
|
public static CouponSimpleBo do2CouponSimpleBo(Coupon coupon){
|
201
|
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
|
212
|
CouponSimpleBo couponSimpleBo = new CouponSimpleBo();
|
202
|
couponSimpleBo.setCouponId(coupon.getId());
|
213
|
couponSimpleBo.setCouponId(coupon.getId());
|
203
|
- couponSimpleBo.setCouponName(coupon.getCouponName());
|
214
|
+ String newName = buildCouponNameByType(coupon);
|
|
|
215
|
+ couponSimpleBo.setCouponName(newName);
|
204
|
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
|
216
|
couponSimpleBo.setCouponAmount(coupon.getCouponAmount());
|
205
|
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
|
217
|
couponSimpleBo.setUseLimitType(coupon.getUseLimitType().intValue());
|
206
|
String useLimitValueStr;
|
218
|
String useLimitValueStr;
|
|
@@ -209,9 +221,18 @@ public class CouponConvert { |
|
@@ -209,9 +221,18 @@ public class CouponConvert { |
209
|
couponSimpleBo.setCouponToken(coupon.getCouponToken());
|
221
|
couponSimpleBo.setCouponToken(coupon.getCouponToken());
|
210
|
Integer couponType;
|
222
|
Integer couponType;
|
211
|
couponSimpleBo.setCouponType(couponType=coupon.getCouponType());
|
223
|
couponSimpleBo.setCouponType(couponType=coupon.getCouponType());
|
212
|
- String couponDesc = null;
|
|
|
213
|
|
224
|
|
|
|
225
|
+ couponSimpleBo.setStartTime(DateUtil.formatDate(coupon.getStartTime(), DateUtil.YYYY_MM_DD_DOT));
|
|
|
226
|
+ couponSimpleBo.setEndTime(DateUtil.formatDate(coupon.getEndTime(), DateUtil.YYYY_MM_DD_DOT));
|
|
|
227
|
+ return couponSimpleBo;
|
|
|
228
|
+ }
|
|
|
229
|
+
|
|
|
230
|
+
|
|
|
231
|
+ static String buildCouponNameByType(Coupon coupon){
|
214
|
String couponAmountSkipDecimal = BigDecimalHelper.getStripTrailingZeros(coupon.getCouponAmount());
|
232
|
String couponAmountSkipDecimal = BigDecimalHelper.getStripTrailingZeros(coupon.getCouponAmount());
|
|
|
233
|
+ Integer couponType = coupon.getCouponType();
|
|
|
234
|
+ String useLimitValueStr=String.valueOf(coupon.getUseLimitValue());
|
|
|
235
|
+ String couponDesc = coupon.getCouponName();
|
215
|
if (Integer.valueOf(CouponTypeEnum.ACTIVITY_COUPON.getCode()).equals(couponType)) {
|
236
|
if (Integer.valueOf(CouponTypeEnum.ACTIVITY_COUPON.getCode()).equals(couponType)) {
|
216
|
String useLimitTypeStr = coupon.getUseLimitType().toString();
|
237
|
String useLimitTypeStr = coupon.getUseLimitType().toString();
|
217
|
if (CouponUseLimitTypeEnum.NON_LIMIT.getLimitType().equals(useLimitTypeStr)) {
|
238
|
if (CouponUseLimitTypeEnum.NON_LIMIT.getLimitType().equals(useLimitTypeStr)) {
|
|
@@ -222,11 +243,8 @@ public class CouponConvert { |
|
@@ -222,11 +243,8 @@ public class CouponConvert { |
222
|
}
|
243
|
}
|
223
|
}
|
244
|
}
|
224
|
if (Integer.valueOf(CouponTypeEnum.SHIPPING_COUPON.getCode()).equals(couponType)){
|
245
|
if (Integer.valueOf(CouponTypeEnum.SHIPPING_COUPON.getCode()).equals(couponType)){
|
225
|
- couponDesc = "包邮" + couponAmountSkipDecimal;
|
246
|
+ couponDesc = "包邮";
|
226
|
}
|
247
|
}
|
227
|
- couponSimpleBo.setCouponDesc(couponDesc);
|
|
|
228
|
- couponSimpleBo.setStartTime(DateUtil.formatDate(coupon.getStartTime(), DateUtil.YYYY_MM_DD_DOT));
|
|
|
229
|
- couponSimpleBo.setEndTime(DateUtil.formatDate(coupon.getEndTime(), DateUtil.YYYY_MM_DD_DOT));
|
|
|
230
|
- return couponSimpleBo;
|
248
|
+ return couponDesc;
|
231
|
}
|
249
|
}
|
232
|
} |
250
|
} |