From 50fb58286ed3b718c39a97e0987ee7561a295651 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 04 七月 2025 17:56:41 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 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..e8604ac 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
@@ -79,9 +79,10 @@
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌涓绘柟妗堟暟鎹�!");
         }
         solutions.setInsuranceId(solutionsBase.getInsuranceId());
-        solutions.setCanAdd(solutionsBase.getCanAdd());
-        solutions.setCanReduce(solutionsBase.getCanReduce());
-        solutions.setCanChangeUnit(solutionsBase.getCanChangeUnit());
+//        solutions.setCanAdd(solutionsBase.getCanAdd());
+//        solutions.setCanReduce(solutionsBase.getCanReduce());
+//        solutions.setCanChangeUnit(solutionsBase.getCanChangeUnit());
+//        solutions.setDelOnlyReplace(solutionsBase.getDelOnlyReplace());
         solutions.setAddValidDays(solutionsBase.getAddValidDays());
         solutions.setDelValidDays(solutionsBase.getDelValidDays());
         solutions.setMinAge(solutionsBase.getMinAge());
@@ -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);
         }
     }
 
@@ -204,6 +211,10 @@
                 ||Objects.isNull(solutions.getType())
                 ||Objects.isNull(solutions.getRetrial())
                 ||Objects.isNull(solutions.getFanganFile())
+               || Objects.isNull(solutions.getCanAdd())
+                || Objects.isNull(solutions.getCanReduce())
+                || Objects.isNull(solutions.getCanChangeUnit())
+                || Objects.isNull(solutions.getDelOnlyReplace())
 //                ||Constants.formatIntegerNum(solutions.getPriceCycleUnit()) < 0
                 ||Constants.formatIntegerNum(solutions.getInsureCycle()) < 0
                 ||Constants.formatIntegerNum(solutions.getInsureCycleUnit()) < 0
@@ -220,7 +231,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
@@ -320,6 +346,7 @@
                         .eq(Multifile::getIsdeleted,Constants.ZERO)
                         .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey()));
         Multifile file = solutions.getFanganFile();
+        file.setId(null);
         file.setIsdeleted(Constants.ZERO);
         file.setCreateDate(solutions.getEditDate());
         file.setCreator(solutions.getEditor());
@@ -327,6 +354,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);
 

--
Gitblit v1.9.3