From 7f89db04cc75a842352087099ee6a7431b7357e0 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期二, 09 十二月 2025 15:12:24 +0800
Subject: [PATCH] 修改返回所有数据

---
 multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceServiceServiceImpl.java |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceServiceServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceServiceServiceImpl.java
index 88b9bda..218668b 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceServiceServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceServiceServiceImpl.java
@@ -7,6 +7,7 @@
 import com.gkhy.exam.common.api.CommonPage;
 import com.gkhy.exam.common.api.CommonResult;
 import com.gkhy.exam.common.constant.UserConstant;
+import com.gkhy.exam.common.exception.ApiException;
 import com.gkhy.exam.common.utils.PageUtils;
 import com.gkhy.exam.common.utils.SecurityUtils;
 import com.gkhy.exam.system.domain.*;
@@ -90,7 +91,7 @@
             });
             int insert = annualMaintenanceServiceContentMapper.batchInsert(annualMaintenanceServiceContentList);
             if (insert <= 0) {
-                throw new RuntimeException("保存保养内容失败");
+                throw new ApiException("保存保养内容失败");
             }
         } else {
             annualMaintenanceServiceContentList.forEach(content -> {
@@ -99,7 +100,7 @@
             });
             int update = annualMaintenanceServiceContentMapper.batchUpdate(annualMaintenanceServiceContentList);
             if (update <= 0) {
-                throw new RuntimeException("保存保养内容失败");
+                throw new ApiException("保存保养内容失败");
             }
         }
     }
@@ -112,7 +113,7 @@
                             .in(AnnualMaintenanceServiceUser::getId, delServiceUserIds)
             );
             if (update1 <= 0) {
-                throw new RuntimeException("保存失败");
+                throw new ApiException("保存失败");
             }
         }
 
@@ -127,7 +128,7 @@
             });
             int i = annualMaintenanceServiceUserMapper.batchInsert(addUser);
             if (i <= 0) {
-                throw new RuntimeException("保存失败");
+                throw new ApiException("保存失败");
             }
         }
 
@@ -142,7 +143,7 @@
             });
             int update = annualMaintenanceServiceUserMapper.batchUpdate(updateUser);
             if (update <= 0) {
-                throw new RuntimeException("保存失败");
+                throw new ApiException("保存失败");
             }
         }
 
@@ -154,52 +155,52 @@
                 .filter(user -> 1 == user.getUserType())
                 .collect(Collectors.toList());
         if (ObjectUtil.isEmpty(filteredUsers)) {
-            throw new RuntimeException("请填写一级保养操作人员");
+            throw new ApiException("请填写一级保养操作人员");
         }
         Set<Long> userIdSet = filteredUsers.stream()
                 .map(AnnualMaintenanceServiceUser::getUserId)
                 .collect(Collectors.toSet());
         if (userIdSet.size() != filteredUsers.size()) {
-            throw new RuntimeException("一级保养操作人员重复");
+            throw new ApiException("一级保养操作人员重复");
         }
 
         List<AnnualMaintenanceServiceUser> filteredUsers2 = annualMaintenanceServiceUserList.stream()
                 .filter(user -> 2 == user.getUserType())
                 .collect(Collectors.toList());
         if (ObjectUtil.isEmpty(filteredUsers2)) {
-            throw new RuntimeException("请填写一级保养检查人员");
+            throw new ApiException("请填写一级保养检查人员");
         }
         Set<Long> userIdSet2 = filteredUsers2.stream()
                 .map(AnnualMaintenanceServiceUser::getUserId)
                 .collect(Collectors.toSet());
         if (userIdSet2.size() != filteredUsers2.size()) {
-            throw new RuntimeException("一级保养检查人员重复");
+            throw new ApiException("一级保养检查人员重复");
         }
 
         List<AnnualMaintenanceServiceUser> filteredUsers3 = annualMaintenanceServiceUserList.stream()
                 .filter(user -> 3 == user.getUserType())
                 .collect(Collectors.toList());
         if (ObjectUtil.isEmpty(filteredUsers3)) {
-            throw new RuntimeException("请填写二级保养操作人员");
+            throw new ApiException("请填写二级保养操作人员");
         }
         Set<Long> userIdSet3 = filteredUsers3.stream()
                 .map(AnnualMaintenanceServiceUser::getUserId)
                 .collect(Collectors.toSet());
         if (userIdSet3.size() != filteredUsers3.size()) {
-            throw new RuntimeException("二级保养操作人员重复");
+            throw new ApiException("二级保养操作人员重复");
         }
 
         List<AnnualMaintenanceServiceUser> filteredUsers4 = annualMaintenanceServiceUserList.stream()
                 .filter(user -> 4 == user.getUserType())
                 .collect(Collectors.toList());
         if (ObjectUtil.isEmpty(filteredUsers4)) {
-            throw new RuntimeException("请填写二级保养检查人员");
+            throw new ApiException("请填写二级保养检查人员");
         }
         Set<Long> userIdSet4 = filteredUsers4.stream()
                 .map(AnnualMaintenanceServiceUser::getUserId)
                 .collect(Collectors.toSet());
         if (userIdSet4.size() != filteredUsers4.size()) {
-            throw new RuntimeException("二级保养检查人员重复");
+            throw new ApiException("二级保养检查人员重复");
         }
     }
 
@@ -234,18 +235,16 @@
                             .set(AnnualMaintenanceServiceUser::getDelFlag, UserConstant.DEPT_DISABLE)
                             .set(AnnualMaintenanceServiceUser::getUpdateTime, LocalDateTime.now())
                             .set(AnnualMaintenanceServiceUser::getUpdateBy, SecurityUtils.getUsername()));
-            if (update1 <= 0) {
-                throw new RuntimeException("删除失败");
-            }
+//            if (update1 <= 0) {
+//                throw new ApiException("删除失败");
+//            }
             int update2 = annualMaintenanceServiceContentMapper.update(new AnnualMaintenanceServiceContent(),
                     new LambdaUpdateWrapper<AnnualMaintenanceServiceContent>().eq(AnnualMaintenanceServiceContent::getAnnualMaintenanceServiceId, id)
                             .set(AnnualMaintenanceServiceContent::getDelFlag, UserConstant.DEPT_DISABLE)
                             .set(AnnualMaintenanceServiceContent::getUpdateTime, LocalDateTime.now())
                             .set(AnnualMaintenanceServiceContent::getUpdateBy, SecurityUtils.getUsername())
             );
-            if (update2 <= 0) {
-                throw new RuntimeException("删除失败");
-            }
+
             return CommonResult.success();
         }
         return CommonResult.failed();

--
Gitblit v1.9.2