Commit a25c77a1 by chongfu.liang

Merge branch 'feature/2.0.9-购物车检查券是否可用' into qa

parents 89b153ab 88b0ef45
......@@ -617,8 +617,10 @@ public class CheckOrder {
}
private void checkCouonRedeemTime(List<GetCouponDetailResponseDto.ActiveRedeemTimeInterval> activeRedeemTimeIntervalList) {
boolean verificationPassed = false;
if (CollectionUtils.isNotEmpty(activeRedeemTimeIntervalList)){
for (GetCouponDetailResponseDto.ActiveRedeemTimeInterval dateLimit : activeRedeemTimeIntervalList){
boolean dayCheck = true;
String weekday = dateLimit.getWeekday(); // 日期限制 0011100 周日开始,0表示不可用
if (StringUtils.isNotBlank(weekday)){ // 存在校验周几
char[] chars = weekday.toCharArray();
......@@ -627,9 +629,10 @@ public class CheckOrder {
dayOfWeek = 0;
}
if (Integer.parseInt(String.valueOf(chars[dayOfWeek])) == 0){ //限制
throw new ServiceException(ResponseResult.COUPON_DATETIME_INVAILD);
dayCheck = false;
}
}
boolean timeCheck = true;
String begintime = dateLimit.getBegintime(); // 开始时间 00:00:00
String endtime = dateLimit.getEndtime(); // 结束时间 12:59:59
if (StringUtils.isNotBlank(begintime) && StringUtils.isNotBlank(endtime)){ // 存在校验时段
......@@ -639,11 +642,21 @@ public class CheckOrder {
LocalTime endLocalTime = LocalTime.of(Integer.valueOf(endTimeArr[0]), Integer.valueOf(endTimeArr[1]), Integer.valueOf(endTimeArr[2]));
LocalTime now = LocalTime.now();
if (now.isBefore(beginLocalTime) || now.isAfter(endLocalTime)){
throw new ServiceException(ResponseResult.COUPON_DATETIME_INVAILD);
timeCheck = false;
}
}
if (dayCheck && timeCheck){
verificationPassed = true;
break;
}
}
} else {
verificationPassed = true;
}
if (!verificationPassed){
throw new ServiceException(ResponseResult.COUPON_DATETIME_INVAILD);
}
}
/**
......
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