From 9b1237538ff8972febd1be94d94533f9568bb991 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 26 三月 2025 09:17:11 +0800
Subject: [PATCH] Merge branch '1.0.1' of http://139.186.142.91:10010/r/productDev/yunyibao into 1.0.1
---
server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java | 38 ++++++++++++++++++++++++++++++++++----
1 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
index 591c11e..04808f9 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
@@ -10,6 +10,7 @@
import com.doumee.dao.business.InsuranceMapper;
import com.doumee.dao.business.WorktypeMapper;
import com.doumee.dao.business.model.Insurance;
+import com.doumee.dao.business.model.Solutions;
import com.doumee.dao.business.model.Worktype;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.InsuranceService;
@@ -25,10 +26,8 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
+import java.util.stream.Collectors;
/**
* 淇濋櫓鍏徃淇℃伅琛⊿ervice瀹炵幇
@@ -49,6 +48,13 @@
LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
initCreateParam(insurance);//宸ョ鏁版嵁鏈夋晥鎬ф楠岋紝鍘婚櫎绌虹櫧琛屾暟鎹�
+
+ if(insuranceMapper.selectCount(new QueryWrapper<Insurance>().lambda().eq(Insurance::getName,insurance.getName())
+ .eq(Insurance::getIsdeleted,Constants.ZERO)
+ .eq(Insurance::getDataType,Constants.ZERO)
+ )>Constants.ZERO){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鍏徃鍚嶇О宸插瓨鍦�");
+ }
insurance.setIsdeleted(Constants.ZERO);
insurance.setCreator(user.getId());
@@ -72,7 +78,22 @@
}
private void dealWorkTypeData(Insurance insurance, Insurance newModel, List<Worktype> worktypeList,boolean isNew) {
int num=0;
+ List<String> workTypeName = worktypeList.stream().map(m->m.getName()).collect(Collectors.toList());
+ Set<String> set = new HashSet<>(workTypeName);
+ if(workTypeName.size() != set.size()){
+ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝宸ョ褰曞叆鏁版嵁瀛樺湪鐩稿悓鏁版嵁锛�");
+ }
for(Worktype w : worktypeList) {
+ if(!isNew){
+ //鏌ヨ淇濋櫓鍏徃涓嬫槸鍚﹀凡瀛樺湪璇ュ伐绉�
+ if(worktypeMapper.selectCount(new QueryWrapper<Worktype>().lambda().eq(Worktype::getInsuranceId,insurance.getId())
+ .eq(Worktype::getIsdeleted,Constants.ZERO)
+ .eq(Worktype::getDataType,Constants.ZERO)
+ .eq(Worktype::getName,w.getName())
+ )>Constants.ZERO){
+ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"褰撳墠淇濋櫓鍏徃涓嬪瓨鍦ㄣ��"+w.getName()+"銆戣宸ョ淇℃伅");
+ }
+ }
//鍩虹鐗堟湰
w.setInsuranceId(insurance.getId());
w.setIsdeleted(Constants.ZERO);
@@ -83,6 +104,7 @@
w.setVersion(insurance.getVersion());
w.setSortnum(num++);
worktypeMapper.insert(w);
+
//鍘嗗彶鐗堟湰鐨勫伐绉嶄俊鎭�
Worktype newType = new Worktype();
@@ -169,6 +191,14 @@
}
//鏁版嵁鏈夋晥鎬ф牎楠�
initCreateParam(insurance);
+ if(insuranceMapper.selectCount(new QueryWrapper<Insurance>().lambda().eq(Insurance::getName,insurance.getName())
+ .eq(Insurance::getIsdeleted,Constants.ZERO)
+ .eq(Insurance::getDataType,Constants.ZERO)
+ .ne(Insurance::getId,insurance.getId())
+ )>Constants.ZERO){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鍏徃鍚嶇О宸插瓨鍦�");
+ }
+
LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
Insurance updateModel = new Insurance();
updateModel.setEditor(user.getId());
--
Gitblit v1.9.3