From 870dfdba90fc4062b66de669ad9ff3f4707bf496 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 09 六月 2025 10:32:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1

---
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
index 1e2232c..fc9f3f2 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -98,6 +98,7 @@
         solutions.setDataType(Constants.ZERO);
         solutions.setStatus(Constants.ZERO);
         solutions.setCorrectWarnTime(solutionsBase.getCorrectWarnTime());
+        solutions.setDelOnlyReplace(solutionsBase.getDelOnlyReplace());
         //2024骞�6鏈�17鏃�15:56:18 浠呮敮鎸佹浛鎹㈡ā寮忎笅锛屾壒澧炴棩鏈� 绛変簬 鎵瑰噺鏃ユ湡
         if(Constants.equalsInteger(solutions.getDelOnlyReplace(),Constants.ONE)){
             solutions.setAddValidDays(solutions.getDelValidDays());
@@ -132,6 +133,7 @@
         file.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
         file.setType(Constants.formatIntegerNum(file.getType()));
         multifileMapper.insert(file);
+        file.setId(null);
         file.setObjId(newModel.getId());
         multifileMapper.insert(file);
         return solutions.getId();
@@ -140,6 +142,7 @@
     private void dealWorkType(Solutions solutions, Solutions newModel, List<SolutionWorktype> worktypes) {
 
         int num =0;
+        List<SolutionWorktype> typeList = new ArrayList<>();
         for(SolutionWorktype type : worktypes) {
             //鍩虹鐗堟湰
             SolutionWorktype w = new SolutionWorktype();
@@ -156,8 +159,12 @@
             //鍘嗗彶鐗堟湰鐨勫伐绉嶄俊鎭�
             SolutionWorktype newType = new SolutionWorktype();
             BeanUtils.copyProperties(w, newType);
+            newType.setId(null);
             newType.setSolutionId(newModel.getId());
-            solutionWorktypeJoinMapper.insert(newType);
+            typeList.add(newType);
+        }
+        if(typeList.size()>0){
+            solutionWorktypeJoinMapper.insert(typeList);
         }
     }
 
@@ -220,7 +227,22 @@
 
     @Override
     public void deleteById(Integer id) {
-        solutionsMapper.deleteById(id);
+        //鏌ヨ鏄惁宸插瓨鍦ㄤ娇鐢ㄤ腑鐨勪繚鍗�
+        if(insuranceApplyMapper.selectCount(new QueryWrapper<InsuranceApply>().lambda()
+                .apply(" solution_id in (  select id from solutions where BASE_ID = "+id+" or id = "+id+"  )" )
+                .notIn(InsuranceApply::getStatus
+                        ,Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey()
+                        ,Constants.InsuranceApplyStatus.CLOSE.getKey()
+                        ,Constants.InsuranceApplyStatus.WTB_CLOSED.getKey()
+                )
+        )>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪宸叉姇淇濈殑淇濆崟鏁版嵁,鏃犳硶杩涜鍒犻櫎");
+        };
+        solutionsMapper.update(null,new UpdateWrapper<Solutions>()
+                .lambda()
+                .set(Solutions::getIsdeleted,Constants.ONE)
+                .and(i->i.eq(Solutions::getId,id).or().eq(Solutions::getBaseId,id))
+        );
     }
 
     @Override

--
Gitblit v1.9.3