فهرست منبع

创建预订单

wangqifan 4 سال پیش
والد
کامیت
e41abebd08
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      src/main/java/com/izouma/tcg/service/orderInfo/OrderInfoService.java

+ 5 - 0
src/main/java/com/izouma/tcg/service/orderInfo/OrderInfoService.java

@@ -79,6 +79,11 @@ public class OrderInfoService {
     public OrderInfo create(String boxIdStr, Long caseId, String remark, Long userAddressId) {
         List<Long> boxIds = Arrays.asList((Long[]) ConvertUtils.convert(boxIdStr.split(","), Long.class));
         List<CardBox> cardBoxList = cardBoxRepo.findAllByIdIn(boxIds);
+        cardBoxList.forEach(cardbox -> {
+            if (cardbox.isSold()) {
+                throw new BusinessException("卖完啦,本次选位已被其他用户抢先购买!");
+            }
+        });
         User user = SecurityUtils.getAuthenticatedUser();
         CardCase cardCase = cardCaseRepo.findById(caseId).orElseThrow(new BusinessException("无信息"));
         if (cardCase.isDel()) {