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/InsuranceServiceImpl.java |  226 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 222 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 4acc4f0..88d1647 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
@@ -9,8 +9,12 @@
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.InsuranceMapper;
+import com.doumee.dao.business.MultifileMapper;
 import com.doumee.dao.business.WorktypeMapper;
+import com.doumee.dao.business.join.DuWorkTypeJoinMapper;
+import com.doumee.dao.business.join.WorktypeJoinMapper;
 import com.doumee.dao.business.model.Insurance;
+import com.doumee.dao.business.model.Multifile;
 import com.doumee.dao.business.model.Solutions;
 import com.doumee.dao.business.model.Worktype;
 import com.doumee.dao.system.model.SystemUser;
@@ -19,8 +23,11 @@
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -43,7 +50,11 @@
     @Autowired
     private WorktypeMapper worktypeMapper;
     @Autowired
+    private WorktypeJoinMapper worktypeJoinMapper;
+    @Autowired
     private SystemDictDataBiz systemDictDataBiz;
+    @Autowired
+    private MultifileMapper multifileMapper;
 
     @Override
     @Transactional
@@ -86,6 +97,8 @@
         if(workTypeName.size() != set.size()){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝宸ョ褰曞叆鏁版嵁瀛樺湪鐩稿悓鏁版嵁锛�");
         }
+        List<Worktype> saveList = new ArrayList<>();
+
         for(Worktype w : worktypeList) {
             if(!isNew){
                 //鏌ヨ淇濋櫓鍏徃涓嬫槸鍚﹀凡瀛樺湪璇ュ伐绉�
@@ -101,12 +114,13 @@
             w.setInsuranceId(insurance.getId());
             w.setIsdeleted(Constants.ZERO);
             w.setCreator(newModel.getCreator());
-            w.setCreateDate(insurance.getCreateDate());
+            w.setCreateDate(new Date());
             w.setDataType(insurance.getDataType());
             w.setStatus(Constants.ZERO);
             w.setVersion(insurance.getVersion());
             w.setSortnum(num++);
-            worktypeMapper.insert(w);
+            saveList.add(w);
+//            worktypeMapper.insert(w);
 
 
             //鍘嗗彶鐗堟湰鐨勫伐绉嶄俊鎭�
@@ -117,8 +131,15 @@
             newType.setDataType(Constants.TWO);
             newType.setVersion(newModel.getVersion());
             w.setSortnum(num++);
-            worktypeMapper.insert(newType);
+            saveList.add(newType);
+//            worktypeMapper.insert(newType);
         }
+
+        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(saveList)){
+            worktypeJoinMapper.insert(saveList);
+        }
+        
+
     }
 
     private void initCreateParam(Insurance insurance) {
@@ -193,6 +214,105 @@
         }
         insuranceMapper.deleteBatchIds(ids);
     }
+
+    /*@Override
+    public void updateById(Insurance insurance) {
+        Insurance model = findById(insurance.getId());
+        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)
+                || !Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        //鏁版嵁鏈夋晥鎬ф牎楠�
+        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());
+        updateModel.setName(insurance.getName());
+        updateModel.setId(model.getId());
+        updateModel.setVersion(UUID.randomUUID().toString());
+        updateModel.setEditDate(new Date());
+        updateModel.setRemark(insurance.getRemark());
+        updateModel.setSortnum(insurance.getSortnum());
+        updateModel.setLogo(insurance.getLogo());
+        updateModel.setEnglishName(insurance.getEnglishName());
+        updateModel.setLinkName(insurance.getLinkName());
+        updateModel.setLinkPhone(insurance.getLinkPhone());
+        updateModel.setPolicy(insurance.getPolicy());
+        updateModel.setAgreement(insurance.getAgreement());
+        updateModel.setClaimsInformation(insurance.getClaimsInformation());
+        insuranceMapper.updateById(updateModel);
+
+        //濡傛灉淇敼锛屽垯浜х敓涓�涓柊鐨勫巻鍙茬増鏈� ~
+//        Insurance newModel = new Insurance();
+//        BeanUtils.copyProperties(model,newModel);
+//        newModel.setId(null);
+//        newModel.setVersion(updateModel.getVersion());
+//        newModel.setCreateDate(new Date());
+//        newModel.setName(updateModel.getName());
+//        newModel.setBaseId(insurance.getId());
+//        newModel.setDataType(Constants.TWO);
+//        newModel.setLogo(insurance.getLogo());
+//        newModel.setEnglishName(insurance.getEnglishName());
+//        newModel.setLinkName(insurance.getLinkName());
+//        newModel.setLinkPhone(insurance.getLinkPhone());
+//        newModel.setPolicy(insurance.getPolicy());
+//        newModel.setAgreement(insurance.getAgreement());
+//        newModel.setClaimsInformation(insurance.getClaimsInformation());
+//        insuranceMapper.insert(newModel);
+
+        Insurance useVersion = insuranceMapper.selectOne(new QueryWrapper<Insurance>().lambda()
+                .eq(Insurance::getBaseId,insurance.getId())
+                .eq(Insurance::getDataType,Constants.TWO)
+                .last(" limit 1")
+        );
+
+        Insurance updateUsrModel = new Insurance();
+        updateUsrModel.setEditor(user.getId());
+        updateUsrModel.setName(insurance.getName());
+        updateUsrModel.setId(useVersion.getId());
+        updateUsrModel.setVersion(UUID.randomUUID().toString());
+        updateUsrModel.setEditDate(new Date());
+        updateUsrModel.setRemark(insurance.getRemark());
+        updateUsrModel.setSortnum(insurance.getSortnum());
+        updateUsrModel.setLogo(insurance.getLogo());
+        updateUsrModel.setEnglishName(insurance.getEnglishName());
+        updateUsrModel.setLinkName(insurance.getLinkName());
+        updateUsrModel.setLinkPhone(insurance.getLinkPhone());
+        updateUsrModel.setPolicy(insurance.getPolicy());
+        updateUsrModel.setAgreement(insurance.getAgreement());
+        updateUsrModel.setClaimsInformation(insurance.getClaimsInformation());
+
+        //鍒犻櫎鎵�鏈夊伐绉嶆暟鎹�
+        worktypeMapper.delete(new UpdateWrapper<Worktype>()
+                .lambda()
+                .in(Worktype::getInsuranceId,insurance.getId())
+        );
+//        insuranceMapper.update(null,new UpdateWrapper<Insurance>()
+//                .lambda()
+//                .eq(Insurance::getBaseId,insurance.getId())
+//                .eq(Insurance::getDataType,Constants.TWO)
+//                .ne(Insurance::getId,newModel.getId())
+//                .set(Insurance::getDataType,Constants.ONE)
+//        );
+        worktypeMapper.update(null,new UpdateWrapper<Worktype>()
+                .lambda()
+                .eq(Worktype::getInsuranceId,useVersion.getId())
+                .eq(Worktype::getDataType,Constants.TWO)
+                .set(Worktype::getDataType,Constants.ONE)
+        );
+
+        //澶勭悊宸ヤ綔淇℃伅锛屾柊澧炴渶鏂扮殑锛屽悓鏃朵骇鐢熷巻鍙茬増鏈�
+        dealWorkTypeData(updateModel,useVersion,insurance.getWorktypeList(),false);
+    }*/
+
 
     @Override
     public void updateById(Insurance insurance) {
@@ -307,10 +427,29 @@
     }
 
     @Override
-    public Insurance findById(Integer id) {
+    public Insurance findByIdAndType(Integer id,Integer type) {
         Insurance model = insuranceMapper.selectById(id);
         if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+        }
+        String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+
+                systemDictDataBiz.queryByCode(Constants.OSS,Constants.INSURANCE).getCode();
+        //闄勪欢淇℃伅
+        Multifile lpStampTempFile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO)
+                .eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.LP_STAMP_FILE.getKey()).last("limit 1"));
+        if(Objects.nonNull(lpStampTempFile)){
+            lpStampTempFile.setFileurlFull(path + lpStampTempFile.getFileurl());
+            model.setLpStampTempFile(lpStampTempFile);
+        }
+
+        Multifile lpFile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO)
+                .eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.LP_FILE.getKey()).last("limit 1"));
+        if(Objects.nonNull(lpFile)){
+            lpFile.setFileurlFull(path + lpFile.getFileurl());
+            model.setLpFile(lpFile);
+        }
+        if(Objects.nonNull(type)&&Constants.equalsInteger(type,Constants.ONE)){
+            return  model;
         }
         List<Worktype> worktypeList = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda()
                 .eq(Worktype::getInsuranceId,id)
@@ -318,6 +457,37 @@
                 .orderByAsc(Worktype::getSortnum));
         model.setWorktypeList(worktypeList);
         return model;
+    }
+
+    @Override
+    public Insurance findById(Integer id) {
+        return this.findByIdAndType(id,null);
+//        Insurance model = insuranceMapper.selectById(id);
+//        if(model == null  || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+//            throw  new BusinessException(ResponseStatus.DATA_EMPTY );
+//        }
+//        List<Worktype> worktypeList = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda()
+//                .eq(Worktype::getInsuranceId,id)
+//                .eq(Worktype::getIsdeleted,Constants.ZERO)
+//                .orderByAsc(Worktype::getSortnum));
+//        model.setWorktypeList(worktypeList);
+//        String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+
+//                systemDictDataBiz.queryByCode(Constants.OSS,Constants.INSURANCE).getCode();
+//        //闄勪欢淇℃伅
+//        Multifile lpStampTempFile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO)
+//                .eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.LP_STAMP_FILE.getKey()).last("limit 1"));
+//        if(Objects.nonNull(lpStampTempFile)){
+//            lpStampTempFile.setFileurlFull(path + lpStampTempFile.getFileurl());
+//            model.setLpStampTempFile(lpStampTempFile);
+//        }
+//
+//        Multifile lpFile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO)
+//                .eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.LP_FILE.getKey()).last("limit 1"));
+//        if(Objects.nonNull(lpFile)){
+//            lpFile.setFileurlFull(path + lpFile.getFileurl());
+//            model.setLpFile(lpFile);
+//        }
+
     }
 
     @Override
@@ -401,4 +571,52 @@
         QueryWrapper<Insurance> wrapper = new QueryWrapper<>(insurance);
         return insuranceMapper.selectCount(wrapper);
     }
+
+
+
+    @Override
+    public void saveLpInfo(Insurance insurance){
+        LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
+        if(Objects.isNull(insurance)
+                || Objects.isNull(insurance.getId())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        multifileMapper.delete(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId,insurance.getId())
+                .in(Multifile::getObjType,Constants.MultiFile.LP_STAMP_FILE.getKey(),Constants.MultiFile.LP_FILE.getKey())
+        );
+
+        Insurance model = new Insurance();
+        model.setEditDate(new Date());
+        model.setEditor(user.getId());
+        if(Objects.nonNull(insurance.getLpStampTempFile())){
+            Multifile multifile = insurance.getLpStampTempFile();
+            multifile.setCreateDate(model.getEditDate());
+            multifile.setCreator(model.getEditor());
+            multifile.setIsdeleted(Constants.ZERO);
+            multifile.setObjType(Constants.MultiFile.LP_STAMP_FILE.getKey());
+            multifile.setObjId(insurance.getId());
+            multifileMapper.insert(multifile);
+        }
+        if(Objects.nonNull(insurance.getLpFile())){
+            Multifile multifile = insurance.getLpFile();
+            multifile.setCreateDate(model.getEditDate());
+            multifile.setCreator(model.getEditor());
+            multifile.setIsdeleted(Constants.ZERO);
+            multifile.setObjType(Constants.MultiFile.LP_FILE.getKey());
+            multifile.setObjId(insurance.getId());
+            multifileMapper.insert(multifile);
+        }
+        model.setId(insurance.getId());
+        model.setLpYggxFileInfo(insurance.getLpYggxFileInfo());
+        model.setLpMzFileInfo(insurance.getLpMzFileInfo());
+        model.setLpZyFileInfo(insurance.getLpZyFileInfo());
+        model.setLpScFileInfo(insurance.getLpScFileInfo());
+        model.setLpOtherFileInfo(insurance.getLpOtherFileInfo());
+        model.setLpFileStatus(Constants.ONE);
+        insuranceMapper.updateById(model);
+    }
+
+
 }

--
Gitblit v1.9.3