zoujiajian 3 yıl önce
ebeveyn
işleme
d06dc1502a

+ 4 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1056,6 +1056,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			if (exists.getIsValidTime() && exists.getValidEndTime().before(DateTime.now())) {
 				throw BusinessRuntimeException.getInstance("该优惠码已失效");
 			}
+			if (exists.getIsValidTime() && exists.getValidStartTime().after(DateTime.now())) {
+				throw BusinessRuntimeException.getInstance("该优惠码未失效");
+			}
 		} else if (couponId != null) {
 			CouponUserView couponUserView = beanSearcher.searchFirst(CouponUserView.class, MapUtils.builder()
 					.field(CouponUserView::getCouponId, couponId).op(Operator.Equal)
@@ -1069,7 +1072,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			}
 			couponFontService.setCouponUserStatus(couponUserView, DateTime.now());
 			if (couponUserView.getCouponUserStatus() != CouponUser.Status.unused) {
-				throw BusinessRuntimeException.getInstance("该优惠券不可使用");
+				throw BusinessRuntimeException.getInstance(couponUserView.getReason());
 			}
 			checkCouponGoods(goodsDon, skuId, couponUserView.getType(), couponUserView.getGoodsSkuIds(), false);
 			//检验是否续费可使用