From c26e227abe288476c11b0a8b7875045e71efa14c Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Thu, 30 Apr 2026 17:30:00 +0800
Subject: [PATCH] 新增修改
---
multi-system/src/main/java/com/gkhy/exam/system/service/impl/AnnualMaintenanceServiceServiceImpl.java | 45 ++++++++++++++++++++++-----------------------
1 files changed, 22 insertions(+), 23 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..e4f118f 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
@@ -4,17 +4,20 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.*;
+import com.gkhy.exam.system.domain.AnnualMaintenanceService;
+import com.gkhy.exam.system.domain.AnnualMaintenanceServiceContent;
+import com.gkhy.exam.system.domain.AnnualMaintenanceServiceUser;
import com.gkhy.exam.system.mapper.AnnualMaintenanceServiceContentMapper;
import com.gkhy.exam.system.mapper.AnnualMaintenanceServiceMapper;
import com.gkhy.exam.system.mapper.AnnualMaintenanceServiceUserMapper;
import com.gkhy.exam.system.service.AnnualMaintenanceServiceService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -23,8 +26,6 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-
-import static net.sf.jsqlparser.parser.feature.Feature.update;
/**
* <p>
@@ -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