Browse Source

[fix]
设定头像组合为最多九张头像

chenchen 2 months ago
parent
commit
700fcb3f74

+ 22 - 5
application-webadmin/src/main/java/com/tourism/webadmin/back/controller/TourProjectGroupPurchaseDetailController.java

@@ -36,7 +36,8 @@ public class TourProjectGroupPurchaseDetailController {
 
     @Autowired
     private TourProjectGroupPurchaseDetailService tourProjectGroupPurchaseDetailService;
-
+    @Autowired
+    private TourProjectGroupPurchaseService tourProjectGroupPurchaseService;
     /**
      * 新增拼团设置从表数据。
      *
@@ -61,6 +62,13 @@ public class TourProjectGroupPurchaseDetailController {
         if (errorMessage != null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
         }
+        //判断拼团的上下限是否超过拼团的最高人数限制
+        TourProjectGroupPurchase tourProjectGroupPurchase = new TourProjectGroupPurchase();
+        tourProjectGroupPurchase.setCode(tourProjectGroupPurchaseDetailDto.getGroupPurchaseCode());
+        TourProjectGroupPurchase tourProjectGroupPurchaseServiceOne = tourProjectGroupPurchaseService.getOne(tourProjectGroupPurchase);
+        if(tourProjectGroupPurchaseServiceOne.getMaxCount() < tourProjectGroupPurchaseDetailDto.getMinCount()){
+            return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, "阶梯价格的最低人数不能超过拼团最高人数,请重新填写");
+        }
         //判断人数是否存在交集
         TourProjectGroupPurchaseDetail tourProjectGroupPurchaseDetailVerify = new TourProjectGroupPurchaseDetail();
         tourProjectGroupPurchaseDetailVerify.setGroupPurchaseCode(tourProjectGroupPurchaseDetailDto.getGroupPurchaseCode());
@@ -101,6 +109,15 @@ public class TourProjectGroupPurchaseDetailController {
         if (errorMessage != null) {
             return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
         }
+        //判断拼团的上下限是否超过拼团的最高人数限制
+        TourProjectGroupPurchase tourProjectGroupPurchase = new TourProjectGroupPurchase();
+        tourProjectGroupPurchase.setCode(tourProjectGroupPurchaseDetailDto.getGroupPurchaseCode());
+        TourProjectGroupPurchase tourProjectGroupPurchaseServiceOne = tourProjectGroupPurchaseService.getOne(tourProjectGroupPurchase);
+        if(tourProjectGroupPurchaseServiceOne.getMaxCount() < tourProjectGroupPurchaseDetailDto.getMinCount()){
+            return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, "阶梯价格的最低人数不能超过拼团最高人数,请重新填写");
+        }else if(tourProjectGroupPurchaseServiceOne.getMaxCount() < tourProjectGroupPurchaseDetailDto.getMaxCount()){
+            return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, "阶梯价格的最高人数不能超过拼团最高人数,请重新填写");
+        }
         //判断人数是否存在交集
         TourProjectGroupPurchaseDetail tourProjectGroupPurchaseDetailVerify = new TourProjectGroupPurchaseDetail();
         tourProjectGroupPurchaseDetailVerify.setGroupPurchaseCode(tourProjectGroupPurchaseDetailDto.getGroupPurchaseCode());
@@ -219,10 +236,10 @@ public class TourProjectGroupPurchaseDetailController {
         }
         // NOTE: 如果该对象的删除前数据一致性验证和实际需求有偏差,可以根据需求调整验证字段,甚至也可以直接删除下面的验证。
         // 删除前,先主动验证是否存在关联的从表数据。
-        CallResult callResult = tourProjectGroupPurchaseDetailService.verifyRelatedDataBeforeDelete(originalTourProjectGroupPurchaseDetail);
-        if (!callResult.isSuccess()) {
-            return ResponseResult.errorFrom(callResult);
-        }
+//        CallResult callResult = tourProjectGroupPurchaseDetailService.verifyRelatedDataBeforeDelete(originalTourProjectGroupPurchaseDetail);
+//        if (!callResult.isSuccess()) {
+//            return ResponseResult.errorFrom(callResult);
+//        }
         if (!tourProjectGroupPurchaseDetailService.remove(id)) {
             errorMessage = "数据操作失败,删除的对象不存在,请刷新后重试!";
             return ResponseResult.error(ErrorCodeEnum.DATA_NOT_EXIST, errorMessage);