|
@@ -374,15 +374,12 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService {
|
|
|
if (fsUserCoupon == null || !Objects.equals(fsUserCoupon.getUserId(), userId)) {
|
|
if (fsUserCoupon == null || !Objects.equals(fsUserCoupon.getUserId(), userId)) {
|
|
|
throw new CustomException("无效的优惠券");
|
|
throw new CustomException("无效的优惠券");
|
|
|
}
|
|
}
|
|
|
- if (fsUserCoupon.getBusinessType() != 4) {
|
|
|
|
|
- throw new CustomException("优惠券类型不匹配,无法使用");
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
if (fsUserCoupon.getStatus() == 1) {
|
|
if (fsUserCoupon.getStatus() == 1) {
|
|
|
throw new CustomException("优惠券已使用");
|
|
throw new CustomException("优惠券已使用");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (fsUserCoupon.getStatus() == 2 || fsUserCoupon.getLimitTime().before(new Date())) {
|
|
|
|
|
|
|
+ if (fsUserCoupon.getStatus() == 2 || (fsUserCoupon.getLimitTime() != null && fsUserCoupon.getLimitTime().before(new Date()))) {
|
|
|
throw new CustomException("优惠券已过期");
|
|
throw new CustomException("优惠券已过期");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -478,6 +475,7 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService {
|
|
|
updateUserCoupon.setStatus(1);
|
|
updateUserCoupon.setStatus(1);
|
|
|
updateUserCoupon.setUseTime(new Date());
|
|
updateUserCoupon.setUseTime(new Date());
|
|
|
updateUserCoupon.setBusinessId(order.getOrderId());
|
|
updateUserCoupon.setBusinessId(order.getOrderId());
|
|
|
|
|
+ updateUserCoupon.setBusinessType(4);
|
|
|
fsUserCouponMapper.updateFsUserCoupon(updateUserCoupon);
|
|
fsUserCouponMapper.updateFsUserCoupon(updateUserCoupon);
|
|
|
}
|
|
}
|
|
|
|
|
|