From 8a7693fb0c93235dfc9fdd9477992d0bfb41d5f9 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 23 二月 2024 20:06:32 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java       |  101 +++++++++++++---
 server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java                |    1 
 server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java        |    4 
 server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java           |    2 
 server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java      |    5 
 server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java             |   14 ++
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChagneDetailServiceImpl.java |    7 +
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java         |   18 ++
 server/company/src/main/java/com/doumee/api/business/SettleClaimsController.java                |   11 +
 server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java          |    8 +
 server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java               |    8 +
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java         |   38 +++++
 server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java                 |    3 
 server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java            |    2 
 server/company/src/main/java/com/doumee/api/business/NoticesController.java                     |    5 
 server/service/src/main/java/com/doumee/core/utils/Constants.java                               |    8 
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java    |   67 ++++++++--
 server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java                  |    5 
 18 files changed, 251 insertions(+), 56 deletions(-)

diff --git a/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java b/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
index f4f4e85..c00d02f 100644
--- a/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
+++ b/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
@@ -120,7 +120,6 @@
     @PostMapping("/findListByDTO")
     @RequiresPermissions("business:dispatchunit:query")
     public ApiResponse<List<DispatchUnit>> findListByDTO (@RequestBody DispatchUnitQueryDTO dispatchUnitQueryDTO) {
-        dispatchUnitQueryDTO.setDataType(Constants.TWO);
         return ApiResponse.success(dispatchUnitService.findByDTO(dispatchUnitQueryDTO));
     }
 
diff --git a/server/company/src/main/java/com/doumee/api/business/NoticesController.java b/server/company/src/main/java/com/doumee/api/business/NoticesController.java
index 6d47a17..ed1694b 100644
--- a/server/company/src/main/java/com/doumee/api/business/NoticesController.java
+++ b/server/company/src/main/java/com/doumee/api/business/NoticesController.java
@@ -12,6 +12,8 @@
 import com.doumee.dao.business.vo.ApplyNoticeVO;
 import com.doumee.service.business.NoticesService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -105,6 +107,9 @@
 
     @ApiOperation("鎶曚繚鍗曞叧闂彁閱�")
     @GetMapping("/closeApplyNotice")
+    @ApiImplicitParams({
+            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "鍏抽棴绫诲瀷锛�1=寰呯缃叉彁閱掞紱6=缁繚鎻愰啋", required = true),
+    })
     public ApiResponse closeApplyNotice(@RequestParam Integer type) {
         LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         noticesService.closeApplyNotice(loginUserInfo.getCompanyId(),type);
diff --git a/server/company/src/main/java/com/doumee/api/business/SettleClaimsController.java b/server/company/src/main/java/com/doumee/api/business/SettleClaimsController.java
index ad43c63..e1be898 100644
--- a/server/company/src/main/java/com/doumee/api/business/SettleClaimsController.java
+++ b/server/company/src/main/java/com/doumee/api/business/SettleClaimsController.java
@@ -3,6 +3,8 @@
 import com.doumee.api.BaseController;
 import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
@@ -84,6 +86,15 @@
         return ApiResponse.success(null);
     }
 
+    @ApiOperation("璧勬枡涓嬭浇")
+    @PostMapping("/exportFiles")
+    @RequiresPermissions("business:settleclaims:exportExcel")
+    public void exportFiles(@RequestBody SettleClaims model,HttpServletResponse response) {
+        if(model.getId() == null){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        settleClaimsService.exportFiles(model.getId(),response);
+    }
 
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
diff --git a/server/service/src/main/java/com/doumee/core/utils/Constants.java b/server/service/src/main/java/com/doumee/core/utils/Constants.java
index c38aec1..5e503fb 100644
--- a/server/service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -748,7 +748,7 @@
         PLATFORM_AGREE_BACK(8, "鍚屾剰閫�鍥炵敵璇�","",0),
         PLATFORM_UN_AGREE_BACK(9, "椹冲洖閫�鍥炵敵璇�","鎻愪氦鎰忚锛�${param}",0),
         COMPANY_EDIT(10, "淇濆崟淇敼","鎻愪氦鎰忚锛�${param1}\n${param2}",0),
-        PLATFORM_CHECK_PASS(11, "鎶曚繚瀹℃牳閫氳繃","",0),
+        PLATFORM_CHECK_PASS(11, "鎶曚繚瀹℃牳閫氳繃","鎻愪氦鎰忚锛�${param}",0),
         UPLOAD_AGAIN(26, "鍐嶆鎶曚繚","",0),
         PALTFORM_EDIT_BD(22, "淇敼淇濆崟","淇敼鍘熷洜锛�${param}",0),
 
@@ -758,7 +758,7 @@
         CA_PLATFORM_APPROVE(14, "鎵瑰崟瀹屾垚","淇濋櫓鐢熸晥璧锋湡锛�${param1}鍙樻洿涓�${param2}",1),
         CA_PLATFORM_CHECK_SIGNATURE(15, "浼佷笟绛剧珷","",1),
         CA_COMPANY_EDIT(16, "鎵瑰崟淇敼","鎻愪氦鎰忚锛�${param1}\n${param2}",1),
-        CA_COMPANY_COMMIT(17, "鎻愪氦鎶曚繚","鎻愪氦鎰忚锛�${param}",1),
+        CA_COMPANY_COMMIT(17, "鎻愪氦鎶曚繚","",1),
         CA_COMPANY_BACK_APPLY(18, "鐢宠閫�鍥�","鎻愪氦鎰忚锛�${param}",1),
         CA_COMPANY_CLOSE(19, "鍏抽棴璁㈠崟","",1),
         CA_PALTFORM_REFUSE_APPLY(20, "椹冲洖閫�鍥炵敵璇�","",1),
@@ -1005,8 +1005,8 @@
 
     public  enum NoticeType {
 
-        ZERO(0, "寰呭鎵�","","","寰呭鏍�","宸茬敵璇�","寰呭彈鐞�"),
-        ONE(1, "浼佷笟寰呯缃�","","","宸ョ寰呭鏍�","","瀹屾垚鍙楃悊"),
+        ZERO(0, "寰呭鎵�","","","寰呭鏍�","寰呭鐞�","澶勭悊涓�"),
+        ONE(1, "浼佷笟寰呯缃�","","","宸ョ寰呭鏍�","","澶勭悊涓�"),
         TWO(2, "寰呭嚭鍗�","寰呭鎵�","寰呭鎵�","","",""),
         THREE(3, "鐢宠閫�鍥�","鐢宠閫�鍥�","鐢宠閫�鍥�","","",""),
         FOUR(4, "宸查��鍥�","宸查��鍥�","宸查��鍥�","","",""),
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
index e69641a..2f2369a 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChagneDetail.java
@@ -140,5 +140,13 @@
     @ApiModelProperty(value = "鎶曚繚鐢宠缂栫爜", example = "1")
     @TableField(exist = false)
     private Integer applyId;
+    @ApiModelProperty(value = "鏂规涓婚敭", example = "1")
+    @TableField(exist = false)
+    private Integer solutionId;
+
+    @ApiModelProperty(value = "骞撮緞")
+    @TableField(exist = false)
+    private long age;
+
 
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java b/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
index c4df7c5..8732783 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -208,6 +208,11 @@
     @TableField(exist = false)
     private Integer timeUnit;
 
+
+    @ApiModelProperty(value = "鏈�鏂扮増鏈殑鏂规涓婚敭", example = "1")
+    @TableField(exist = false)
+    private Integer newVersionSolutionId;
+
     public TaxesInvoicingVO toTaxesInvoicingVO(){
         TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO();
         taxesInvoicingVO.setId(this.getId());
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java b/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
index 568f1f4..3c55bcb 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
@@ -52,7 +52,7 @@
 
 
     //鍔犲噺淇濈敵璇锋暟鎹�
-    public MemberInsurance(ApplyChagneDetail applyChangeDetail, ApplyChange applyChange, Integer sysUserId,Integer applyDetailId){
+    public MemberInsurance(ApplyChagneDetail applyChangeDetail, ApplyChange applyChange, Integer sysUserId,Integer applyDetailId,Integer solutionId){
         this.createDate = new Date();
         this.creator = sysUserId;
         this.isdeleted = Constants.ZERO;
@@ -73,6 +73,7 @@
         this.duName = applyChangeDetail.getDuName();
 //        this.relationType = Constants.ONE;
         this.relationId = applyDetailId;
+        this.solutionId=solutionId;
     }
 
 
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChagneDetailServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChagneDetailServiceImpl.java
index d7354dd..d51c086 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChagneDetailServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChagneDetailServiceImpl.java
@@ -252,7 +252,12 @@
         queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getOldDuId);
         queryWrapper.in(CollectionUtils.isNotEmpty(applyDetailPageDTO.getTypes()),ApplyChagneDetail::getType,applyDetailPageDTO.getTypes());
         queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getApplyChangeId()),ApplyChagneDetail::getApplyChangeId,applyDetailPageDTO.getApplyChangeId());
-        return applyChangeDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, queryWrapper);
+        List<ApplyChagneDetail> list = applyChangeDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, queryWrapper);
+        for (ApplyChagneDetail applyChagneDetail:list) {
+            applyChagneDetail.setAge(Constants.getAgeByIdCard(applyChagneDetail.getMemberIdcardNo()));
+
+        }
+        return list;
     }
 
 
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
index bf1e82b..ee34315 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -122,9 +122,11 @@
         if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.DATA_EMPTY);
         }
-        if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
-                ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())
-                ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
+        if(
+//                Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())
+//                ||Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.SIGNATURE.getKey())
+//                ||
+                Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.APPROVE.getKey())){
             //宸叉彁浜ゅ拰宸插畬鎴愮姸鎬佷笉鏀寔瀹℃牳涓嶉�氳繃
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
         }
@@ -194,16 +196,15 @@
         param.getPidanFile().setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
         param.getPidanFile().setType(Constants.TWO);
         multifileMapper.insert(param.getPidanFile());
-
         update.setApplyId(model.getApplyId());
 
 
         if(Constants.equalsInteger(model.getType(),Constants.ZERO)){
             //濡傛灉鏄姞鍑忎繚鐢宠 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
-            dealDetailsValidTime(update);
+            dealDetailsValidTime(update,insuranceApply);
         }else{
             //濡傛灉鏄崲鍘傜敵璇� 澶勭悊鏄庣粏鏁版嵁
-            dealDetailsDUdata(update);
+            dealDetailsDUdata(update,insuranceApply);
         }
 
         applyChangeMapper.updateById(update);
@@ -294,12 +295,13 @@
      * 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
      * @param update
      */
-    private void dealDetailsDUdata(ApplyChange update ) {
+    private void dealDetailsDUdata(ApplyChange update,InsuranceApply insuranceApply) {
         List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
                 new MPJLambdaWrapper<ApplyChagneDetail>()
                         .selectAll(ApplyChagneDetail.class)
                         .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit)
                         .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice)
+                        .selectAs(Solutions::getId,ApplyChagneDetail::getSolutionId)
                         .selectAs(Solutions::getName,ApplyChagneDetail::getSolutionsName)
                         .selectAs(Worktype::getName,ApplyChagneDetail::getWorkTypeName)
                         .selectAs(DispatchUnit::getName,ApplyChagneDetail::getDuName)
@@ -397,10 +399,16 @@
                 applyDetailJoinMapper.insert(applyDetail);
 
                 MemberInsurance memberInsurance = new MemberInsurance(applyDetail,update.getId());
+                memberInsurance.setSolutionId(detail.getSolutionId());
+                memberInsurance.setWorktypeName(detail.getWorkTypeName());
+                memberInsurance.setDuName(detail.getDuName());
+                memberInsurance.setApplyChangeId(detail.getApplyChangeId());
+                memberInsurance.setSolutionName(detail.getSolutionsName());
+                memberInsurance.setPdCode(update.getValidCode());
+                memberInsurance.setBdCode(insuranceApply.getCode());
                 memberInsurance.setRelationType(Constants.ONE);
                 memberInsuranceJoinMapper.insert(memberInsurance);
             }else{
-
                 applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
                         .set(ApplyDetail::getEditor,update.getEditor())
                         .set(ApplyDetail::getEditDate,update.getEditDate())
@@ -408,7 +416,6 @@
                         .set(ApplyDetail::getWorktypeId,detail.getWorktypeId())
                         .eq(ApplyDetail::getId,oldModel.getId())
                 );
-
                 //鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
                 memberInsuranceJoinMapper.update(null,new UpdateWrapper<MemberInsurance>().lambda()
                         .set(MemberInsurance::getDuId,detail.getDuId())
@@ -440,7 +447,7 @@
      * 澶勭悊鍔犲噺淇濇槑缁嗘暟鎹�
      * @param update
      */
-    private void dealDetailsValidTime(ApplyChange update) {
+    private void dealDetailsValidTime(ApplyChange update,InsuranceApply insuranceApply) {
         List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class,
                 new MPJLambdaWrapper<ApplyChagneDetail>()
                         .selectAll(ApplyChagneDetail.class)
@@ -477,6 +484,16 @@
         //鍔犱繚 娣诲姞鐨勯噾棰�
         CountCyclePriceVO countCyclePriceVO_add = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_add);
 
+        Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
+        }
+        if(solutions.getDataType().equals(Constants.ONE)){
+            solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+            if(Objects.isNull(solutions)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+            }
+        }
 
 
         for (ApplyChagneDetail detail : detailList) {
@@ -531,7 +548,9 @@
                 totalFee = totalFee.add(add.getFee());
                 currentFee = currentFee.add(add.getCurrentFee());
 
-                MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId());
+                MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId(),solutions.getId());
+                memberInsurance.setStartTime(add.getStartTime());
+                memberInsurance.setEndTime(add.getEndTime());
                 memberInsurance.setRelationType(Constants.ONE);
                 memberInsuranceList.add(memberInsurance);
 
@@ -567,10 +586,13 @@
                         CountCyclePriceVO timeoutCountCyclePriceVOReduce = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_reduce);
                         updateCurrentFee = timeoutCountCyclePriceVOReduce.getCyclePrice().subtract(countCyclePriceVO_reduce.getCyclePrice());
                     }
+
+
                     applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
                             .setSql(" fee = ifnull(fee,0)+" + updateFee)
                             .setSql(" current_fee = " + updateCurrentFee)
-                            .set(ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3))
+                            .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 3))
+                            .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,ApplyDetail::getEndTime, DateUtil.getMontageDate(update.getApplyStartTime(), 2))
                             .set(ApplyDetail::getEditor, update.getEditor())
                             .set(ApplyDetail::getEditDate, update.getEditDate())
                             .eq(ApplyDetail::getId, oldModel.getId())
@@ -581,7 +603,9 @@
                     //淇敼 鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
                     memberInsuranceJoinMapper.update(null, new UpdateWrapper<MemberInsurance>().lambda()
                             .setSql(" fee = ifnull(fee,0)+" + updateFee)
-                            .set(MemberInsurance::getEndTime, update.getApplyStartTime())
+                            .set(insuranceApply.getStartTime().compareTo(update.getValidTime())!=0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 3))
+                            .set(insuranceApply.getStartTime().compareTo(update.getValidTime())==0,MemberInsurance::getEndTime,DateUtil.getMontageDate(update.getApplyStartTime(), 2))
+                            .set(MemberInsurance::getStartTime, update.getApplyStartTime())
                             .eq(MemberInsurance::getRelationId, oldModel.getId())
                     );
 
@@ -661,10 +685,15 @@
             ){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
+            if(Constants.equalsInteger(model.getStatus(),Constants.ApplyChangeStatus.RETURN_APPLY_SIGNATURE.getKey())){
+                update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
+            }else {
+                update.setStatus(Constants.ApplyChangeStatus.UPLOAD.getKey());
+            }
             applyLogType = Constants.ApplyLogType.CA_PALTFORM_REFUSE_APPLY;
             info = applyLogType.getInfo();
             info = info.replace("${param}", param.getCheckInfo());
-            update.setStatus(Constants.ApplyChangeStatus.SIGNATURE.getKey());
+
             noticeType = Constants.NoticeType.FIVE;
         }else{
             //濡傛灉鏄悓鎰�,涓ょ鐢宠閫�鍥炵姸鎬侀兘鍙搷浣�
@@ -693,7 +722,7 @@
         }
         //鍒犻櫎鍏朵粬寰呭姙
         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,model.getId()));
-        Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),solutions.getName(),
+        Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),
                 model.getCompanyId(), noticeType);
         noticesMapper.insert(notices);
 
@@ -735,6 +764,14 @@
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
         }
+        if(solutions.getDataType().equals(Constants.ONE)){
+            solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+            if(Objects.isNull(solutions)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+            }
+        }
+
+
         CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda()
                 .eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId())
                 .eq(CompanySolution::getSolutionBaseId,solutions.getBaseId())
@@ -776,9 +813,7 @@
         applyChangeMapper.updateById(applyChangeFee);
 
         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.CA_COMPANY_COMMIT;
-        String info =applyLogType.getInfo();
-        info = info.replace("${param}", "");
-        ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null);
+        ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),"",applyChange.getId(),applyLogType.getKey(), null, null);
         applyLogMapper.insert(log);
         
 
@@ -829,9 +864,15 @@
         if(Objects.isNull(solutions)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇濋櫓鏂规");
         }
+        if(solutions.getDataType().equals(Constants.ONE)){
+            solutions = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+            if(Objects.isNull(solutions)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+            }
+        }
         CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda()
                 .eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId())
-                .eq(CompanySolution::getSolutionBaseId,solutions.getId())
+                .eq(CompanySolution::getSolutionBaseId,solutions.getBaseId())
                 .eq(CompanySolution::getIsdeleted,Constants.ZERO)
                 .last(" limit 1 ")
         );
@@ -908,6 +949,13 @@
             if(companySolution.getCanAdd().equals(Constants.ZERO)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ紒涓氬垎閰嶄繚闄╂柟妗堟棤娉曡繘琛屽姞淇�");
             }
+            //楠岃瘉鏄惁瀛樺湪閲嶅鏁版嵁
+            List<String> idcarNo = addDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList());
+            Set<String> set = new HashSet<>(idcarNo);
+            if(idcarNo.size() != set.size()){
+                throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝浜哄憳褰曞叆鏁版嵁瀛樺湪鐩稿悓鏁版嵁锛�");
+            }
+
             //鍔犱繚鏄庣粏鏁版嵁 璁$畻閲戦  鏍规嵁鎵瑰崟鏃堕棿 璁$畻
             applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),1));
             CountCyclePriceVO countCyclePriceVO =  this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO);
@@ -921,6 +969,13 @@
         //鍑忎繚鏁版嵁
         List<ApplyChagneDetail> delDetailList = applyChange.getDelDetailList();
         if (CollectionUtils.isNotEmpty(delDetailList)) {
+            //楠岃瘉鏄惁瀛樺湪閲嶅鏁版嵁
+            List<String> idcarNo = delDetailList.stream().map(m->m.getIdcardNo()).collect(Collectors.toList());
+            Set<String> set = new HashSet<>(idcarNo);
+            if(idcarNo.size() != set.size()){
+                throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝浜哄憳褰曞叆鏁版嵁瀛樺湪鐩稿悓鏁版嵁锛�");
+            }
+
             if(companySolution.getCanReduce().equals(Constants.ZERO)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "璇ヤ紒涓氬垎閰嶄繚闄╂柟妗堟棤娉曡繘琛屽噺淇�");
             }
@@ -928,7 +983,7 @@
             applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(applyChange.getValidTime(),2));
             CountCyclePriceVO countCyclePriceVO =  this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO);
             BigDecimal detailFee = countCyclePriceVO.getCyclePrice();
-            this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee);
+            this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee,applyChangeCyclePriceDTO.getValidTime());
             fee = fee.add(delDetailList.stream().map(ApplyChagneDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add));
         }
 
@@ -966,7 +1021,7 @@
      * @param loginUserInfo
      */
     public void delChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> delDetailList,InsuranceApply insuranceApply,Solutions solutions,
-                                LoginUserInfo loginUserInfo,BigDecimal detailFee){
+                                LoginUserInfo loginUserInfo,BigDecimal detailFee,Date endTime){
         for (ApplyChagneDetail applyChagneDetail : delDetailList) {
             if (Objects.isNull(applyChagneDetail.getMemberId())) {
                 throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "鍑忎繚浜哄憳銆�" + applyChagneDetail.getMemberName() + "銆戝繀濉」缂哄け");
@@ -1018,7 +1073,7 @@
             applyChagneDetail.setType(Constants.ONE);
 
             applyChagneDetail.setStartTime(applyDetail.getStartTime());
-            applyChagneDetail.setEndTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(),3));
+            applyChagneDetail.setEndTime(endTime);
 
             member.setApplyId(insuranceApply.getId());
             member.setDuId(applyChagneDetail.getDuId());
@@ -1512,6 +1567,8 @@
         String info = applyLogType.getInfo();
         if(StringUtils.isNotBlank(applyChangeOptDTO.getOptIllustration())){
             info = info.replace("${param}", applyChangeOptDTO.getOptIllustration());
+        }else{
+            info = info.replace("${param}", "");
         }
         ApplyLog log = new ApplyLog(applyChange,applyLogType.getName(),info,applyChange.getId(),applyLogType.getKey(), null, null);
         applyLogMapper.insert(log);
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
index 9ede794..2ef45bc 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/CompanyServiceImpl.java
@@ -153,7 +153,7 @@
             response.setContentType("application/octet-stream");
             response.setHeader("eva-opera-type", "download");
             response.setHeader("eva-download-filename", encodeFileName);
-            Constants. packFilesToZip(fileList,response.getOutputStream());
+            Constants.packFilesToZip(fileList,response.getOutputStream());
         } catch (IOException e) {
             throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
         }
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
index 9e43698..78bbd14 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
@@ -63,13 +63,13 @@
         duWorktypeMapper.deleteById(id);
 
         if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda()
-                .eq(DuWorktype::getWorkTypeId,dbDuWorkType.getWorkTypeId())
+                .eq(DuWorktype::getDispatchUnitId,dispatchUnit.getId())
                 .eq(DuWorktype::getStatus,Constants.ZERO)
                 .ne(DuWorktype::getId,dbDuWorkType.getId())
         )>Constants.ZERO){
             dispatchUnit.setWorktypeStatus(0);
         }else  if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda()
-                .eq(DuWorktype::getWorkTypeId,dbDuWorkType.getWorkTypeId())
+                .eq(DuWorktype::getDispatchUnitId,dispatchUnit.getId())
                 .eq(DuWorktype::getStatus,Constants.TWO)
                 .ne(DuWorktype::getId,dbDuWorkType.getId())
         )>Constants.ZERO){
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
index 14aa6b2..7d4d91d 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -214,7 +214,7 @@
         String info = "";
         if(model.getApplyStartTime()!=null && model.getApplyStartTime().getTime()/1000!= insuranceApply.getStartTime().getTime()/1000){
             info =applyLogType.getInfo();
-            info = info.replace("${param1}",DateUtil.getPlusTime2(model.getApplyEndTime()));
+            info = info.replace("${param1}",DateUtil.getPlusTime2(model.getStartTime()));
             info = info.replace("${param2}",DateUtil.getPlusTime2(insuranceApply.getStartTime()));
         }
         ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
@@ -332,13 +332,22 @@
         InsuranceApply update = new InsuranceApply();
         if(insuranceApply.getDealBackApply() ==1){
             //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
-            if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())){
+            if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())||
+                Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())||
+                Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey()))
+            ){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
             applyLogType = Constants.ApplyLogType.PLATFORM_UN_AGREE_BACK;
             info = applyLogType.getInfo();
             info = info.replace("${param}", insuranceApply.getCheckInfo());
-            update.setStatus(Constants.InsuranceApplyStatus.SIGNATURE.getKey());
+            if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.SIGNATURE.getKey());
+            }else if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey());
+            }else if(  Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey())){
+                update.setStatus(Constants.InsuranceApplyStatus.UPLOAD.getKey());
+            }
         }else{
             //濡傛灉鏄悓鎰�,涓ょ鐢宠閫�鍥炵姸鎬侀兘鍙搷浣�
             if(!(Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())
@@ -347,13 +356,7 @@
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
             }
             applyLogType = Constants.ApplyLogType.PLATFORM_AGREE_BACK;
-            if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_SIGNATURE.getKey())){
-                update.setStatus(Constants.InsuranceApplyStatus.SIGNATURE.getKey());
-            }else if( Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_WAIT_SIGNATURE.getKey())){
-                update.setStatus(Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey());
-            }else if(  Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.COMPANY_BACK_APPLY_UPLOAD.getKey())){
-                update.setStatus(Constants.InsuranceApplyStatus.UPLOAD.getKey());
-            }
+            update.setStatus(Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey());
         }
         update.setEditDate(new Date());
         update.setEditor(user.getId());
@@ -697,6 +700,12 @@
                 || Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey()))){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
         }
+
+        Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         InsuranceApply update = new InsuranceApply();
         update.setEditDate(new Date());
@@ -734,6 +743,12 @@
         //鍒犻櫎鍏朵粬寰呭姙
         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
         noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey()).eq(Notices::getObjId,insuranceApply.getId()));
+
+        Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),
+                model.getCompanyId(), Constants.NoticeType.ONE);
+        noticesMapper.insert(notices);
+
+
 
         return  1;
 
@@ -796,7 +811,11 @@
         noticesMapper.insert(notices);
 
         String info =applyLogType.getInfo();
-        info = info.replace("${param}", update.getCheckInfo());
+        if(StringUtils.isNotBlank(update.getCheckInfo())){
+            info = info.replace("${param}", update.getCheckInfo());
+        }else{
+            info = null;
+        }
         ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
         applyLogMapper.insert(log);
         return  1;
@@ -1153,8 +1172,8 @@
         queryWrapper.select(" DATEDIFF( t.END_TIME ,now()  ) AS loseEfficacyDays  ");
         queryWrapper.select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.apply_id = t.id ) as insureNum");
         if(!Objects.isNull(pageWrap.getModel())&&!Objects.isNull(pageWrap.getModel().getType())){
-            queryWrapper.select(" ifnull(( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ),0) as taxesMoney");
-            queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast ");
+            queryWrapper.select(" ifnull(( select sum(td.fee) from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status  = 1 and td.INSURANCE_APPLY_ID = t.id ),0) as taxesMoney");
+            queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on td.TAX_ID = ts.id  where ts.status = 1 and td.INSURANCE_APPLY_ID = t.id order by td.CREATE_DATE desc limit 1 ) as taxesLast ");
         }
         queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
         queryWrapper.leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId);
@@ -1207,6 +1226,9 @@
         }
         if (pageWrap.getModel().getStatus() != null) {
             queryWrapper.in(InsuranceApply::getStatus, pageWrap.getModel().getStatus().split(","));
+        }
+        if (pageWrap.getModel().getLoseEfficacy() != null && pageWrap.getModel().getLoseEfficacy() ==1) {
+            queryWrapper.apply("  DATEDIFF(t.END_TIME,CURRENT_DATE() ) <= 5 ");
         }
         if(CollectionUtils.isNotEmpty(pageWrap.getSorts())){
             for(PageWrap.SortData sortData: pageWrap.getSorts()) {
@@ -1333,6 +1355,19 @@
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
 
+        Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规淇℃伅");
+        }
+        if(solutions.getDataType().equals(Constants.ONE)){
+            Solutions newVersionSolution = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
+            if(Objects.isNull(newVersionSolution)){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏈煡璇㈠埌鏂规鏈�鏂扮増鏈俊鎭�");
+            }
+            insuranceApply.setNewVersionSolutionId(newVersionSolution.getId());
+        }else{
+            insuranceApply.setNewVersionSolutionId(solutions.getId());
+        }
         if(insuranceApply.getStartTime().compareTo(new Date())<0  && insuranceApply.getEndTime().compareTo(new Date()) > 0 ){
             insuranceApply.setLoseEfficacyDays(DateUtil.daysBetweenDates(insuranceApply.getEndTime(),new Date()));
         }
@@ -1493,7 +1528,7 @@
             noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
                             .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
                     .eq(Notices::getObjId,insuranceApply.getId()));
-            Notices notices = new Notices(noticeObjectType,Constants.ONE,insuranceApply.getId(),solutions.getName(),
+            Notices notices = new Notices(noticeObjectType,Constants.ZERO,insuranceApply.getId(),solutions.getName(),
                     insuranceApply.getCompanyId(), Constants.NoticeType.THREE);
             noticesMapper.insert(notices);
 
@@ -1519,7 +1554,9 @@
         //瀛樺偍鏃ュ織鏁版嵁
         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.COMPANY_APPLY_RETURN;
         String info =applyLogType.getInfo();
-        info = info.replace("${param}", insuranceApplyOptDTO.getOptIllustration());
+        if(StringUtils.isNotBlank(insuranceApplyOptDTO.getOptIllustration())){
+            info = info.replace("${param}", insuranceApplyOptDTO.getOptIllustration());
+        }
         ApplyLog log = new ApplyLog(insuranceApply,applyLogType.getName(),info,insuranceApply.getId(),applyLogType.getKey(),JSONObject.toJSONString(insuranceApply), JSONObject.toJSONString(insuranceApply));
         applyLogMapper.insert(log);
     }
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());
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
index 30020de..bdafd31 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -205,7 +205,7 @@
                 .like(StringUtils.isNotBlank(memberQueryDTO.getIdCard()),Member::getIdcardNo, memberQueryDTO.getIdCard())
                 .like(StringUtils.isNotBlank(memberQueryDTO.getDuName()),DispatchUnit::getName, memberQueryDTO.getDuName())
                 .eq(!Objects.isNull(memberQueryDTO.getDuId()),Member::getDuId, memberQueryDTO.getDuId())
-                .eq(!Objects.isNull(memberQueryDTO.getSolutionsId()),Solutions::getId, memberQueryDTO.getSolutionsId())
+                .eq(!Objects.isNull(memberQueryDTO.getSolutionsId()),Solutions::getBaseId, memberQueryDTO.getSolutionsId())
                 .apply(!Objects.isNull(memberQueryDTO.getSolutionsStatus())&&memberQueryDTO.getSolutionsStatus().equals(Constants.ONE),"now() between t.start_time and t.end_time")
                 .apply(!Objects.isNull(memberQueryDTO.getSolutionsStatus())&&memberQueryDTO.getSolutionsStatus().equals(Constants.TWO),"now()  >  t.end_time")
         ;
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
index 73bb3b4..add335c 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -449,16 +449,19 @@
                             Constants.MultiFile.LP_SCZL_FILE.getKey(),
                             Constants.MultiFile.LP_JACL_FILE.getKey(),
                     }))
+                    .orderByAsc(Multifile::getCreateDate)
             );
             if(multifileList== null || multifileList.size() == 0){
                 throw  new BusinessException(ResponseStatus.DATA_EMPTY);
             }
             String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.SETTLE_FILE).getCode();
+            Integer sn = 1;
             for(Multifile l : multifileList){
-                File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(l.getName(),"鏈懡鍚�"));
+                File f = Constants.getFileByNetFile(path + l.getFileurl(),StringUtils.defaultString(sn + "_" +l.getName(),"鏈懡鍚�"));
                 if(f !=null && f.isFile()){
                     fileList.add(f);
                 }
+                sn = sn +1;
             }
             if(fileList == null || fileList.size() == 0){
                 throw  new BusinessException(ResponseStatus.DATA_EMPTY);
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 ebac33f..b1aaf13 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
@@ -61,6 +61,15 @@
         LoginUserInfo user= (LoginUserInfo)SecurityUtils.getSubject().getPrincipal();
         initCreateParam(solutions);//宸ョ鏁版嵁鏈夋晥鎬ф楠岋紝鍘婚櫎绌虹櫧琛屾暟鎹�
 
+
+        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
+                .eq(Solutions::getName,solutions.getName())
+                .eq(Solutions::getIsdeleted,Constants.ZERO)
+                .eq(Solutions::getDataType,Constants.ZERO)
+        )>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�");
+        }
+
         solutions.setIsdeleted(Constants.ZERO);
         solutions.setCreator(user.getId());
         solutions.setCreateDate(new Date());
@@ -167,7 +176,14 @@
         }
         //鏁版嵁鏈夋晥鎬ф牎楠�
         initCreateParam(solutions);
-
+        if(solutionsMapper.selectCount(new QueryWrapper<Solutions>().lambda()
+                .eq(Solutions::getName,solutions.getName())
+                .eq(Solutions::getIsdeleted,Constants.ZERO)
+                .eq(Solutions::getDataType,Constants.ZERO)
+                .ne(Solutions::getId,solutions.getId())
+        )>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"淇濋櫓鏂规鍚嶇О宸插瓨鍦�");
+        }
         solutions.setEditor(user.getId());
         solutions.setVersion(UUID.randomUUID().toString());
         solutions.setEditDate(new Date());
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
index be13b91..36414c2 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -189,6 +189,20 @@
         update.setImgurl(taxes.getImgurl());
         taxesMapper.updateById(update);
 
+        //鏌ヨ寮�绁ㄦ槑缁嗚褰�
+        List<TaxDetial> taxDetialList = taxDetialMapper.selectList(new QueryWrapper<TaxDetial>().lambda()
+                .eq(TaxDetial::getTaxId,taxes.getId())
+                .eq(TaxDetial::getType,Constants.TWO));
+        if(CollectionUtils.isNotEmpty(taxDetialList)){
+            for (TaxDetial taxDetial:taxDetialList) {
+                taxesMapper.update(null,new UpdateWrapper<Taxes>().lambda()
+                                .set(Taxes::getEditDate,new Date())
+                                .set(Taxes::getEditor,user.getId())
+                        .set(Taxes::getStatus,3).eq(Taxes::getId,taxDetial.getDelTaxId()));
+            }
+        }
+
+
         //瀛樺偍寰呭姙淇℃伅
         Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.TAXES;
         //鍒犻櫎鍏朵粬寰呭姙
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
index 8594c8a..7c02437 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/WorktypeServiceImpl.java
@@ -105,10 +105,11 @@
         List<Worktype> list = worktypeMapper.selectList(new QueryWrapper<Worktype>().lambda()
                 .eq(Worktype::getIsdeleted,Constants.ZERO)
                 .eq(Worktype::getDataType,Constants.TWO)
+                .eq(Worktype::getStatus,Constants.ZERO)
                 .apply(workTypeQueryDTO.getQueryType().equals(Constants.ZERO),
                         "id in ( select  sw.worktype_id from solution_worktype sw where sw.SOLUTION_ID = "+workTypeQueryDTO.getId()+" )")
                 .apply(workTypeQueryDTO.getQueryType().equals(Constants.ONE),
-                        "id in ( select  dw.work_type_id from du_worktype dw where dw.du_solution_id = "+workTypeQueryDTO.getId()+" )")
+                        "id in ( select  dw.work_type_id from du_worktype dw where dw.status = 1 and  dw.du_solution_id = "+workTypeQueryDTO.getId()+" )")
                 .apply(workTypeQueryDTO.getQueryType().equals(Constants.TWO),
                         "id in ( select  dw.WORKTYPE_ID from apply_detail dw where dw.APPLY_ID = "+workTypeQueryDTO.getId()+" )")
         );
@@ -192,7 +193,7 @@
         ExcelImporter ie = null;
         List<WorktypeImport> dataList =null;
         try {
-            ie = new ExcelImporter(file,0,0);
+            ie = new ExcelImporter(file,1,0);
             dataList = ie.getDataList(WorktypeImport.class,null);
         }  catch (Exception e) {
             e.printStackTrace();
@@ -202,6 +203,9 @@
         }
          List<String> result = new ArrayList<>();
         for(WorktypeImport model : dataList){
+            if(StringUtils.isBlank(model.getName())){
+                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝褰曞叆鏁版嵁瀛樺湪寮傚父");
+            }
 //            if(StringUtils.isNotBlank(model.getName()) && !isNewWorkTypeByName(model.getName(),list)){
                 result.add(model.getName());
 //            }

--
Gitblit v1.9.3