From dc3cfa57c400ded43fdac3a73c7be27a18a90b23 Mon Sep 17 00:00:00 2001
From: nidapeng <jp@doumee.com>
Date: 星期四, 28 三月 2024 15:57:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/1.0.1' into 1.0.1

---
 server/service/src/main/java/com/doumee/dao/business/model/Solutions.java                    |    1 
 server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java             |    8 
 server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java                   |    4 
 server/company/src/main/java/com/doumee/api/business/MemberController.java                   |    2 
 server/service/src/main/java/com/doumee/dao/business/dto/UnionChangeBXDDTO.java              |   35 
 server/company/src/main/java/com/doumee/api/business/UnionChangeController.java              |   39 +
 server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDDetailTO.java         |   32 
 server/company/src/main/java/com/doumee/api/business/UnionApplyController.java               |   46 +
 server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionChangeDTO.java             |   32 
 server/service/src/main/java/com/doumee/core/utils/Constants.java                            |  113 ++
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |  537 +++++++++++++
 server/company/src/main/java/com/doumee/api/system/SystemController.java                     |    1 
 server/service/src/main/java/com/doumee/service/business/MemberService.java                  |    2 
 server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDTO.java               |   43 +
 server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java                  |   10 
 server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java    |  102 ++
 server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java    |    7 
 server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java           |   18 
 server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java              |    9 
 server/service/src/main/java/com/doumee/service/business/UnionChangeService.java             |   32 
 server/service/src/main/java/com/doumee/dao/business/dto/UploadMultifileDTO.java             |   25 
 server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java         |   27 
 server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java     |  350 ++++++++
 server/service/src/main/java/com/doumee/dao/business/join/UnionApplyJoinMapper.java          |   13 
 server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java                  |   16 
 server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java                  |    6 
 server/service/src/main/java/com/doumee/service/business/UnionApplyService.java              |   30 
 server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java    |  574 ++++++++++++++
 server/service/src/main/java/com/doumee/dao/business/dto/MemberQueryDTO.java                 |    4 
 server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java               |   18 
 server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java          |   22 
 server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java             |  134 +++
 server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java         |    4 
 33 files changed, 2,257 insertions(+), 39 deletions(-)

diff --git a/server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java b/server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java
index 2debb6c..ac9af61 100644
--- a/server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java
+++ b/server/company/src/main/java/com/doumee/api/business/ApplyChangeController.java
@@ -116,7 +116,7 @@
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @RequiresPermissions("business:applychange:query")
-    public ApiResponse findById(@PathVariable Integer id) {
+    public ApiResponse<ApplyChange> findById(@PathVariable Integer id) {
         return ApiResponse.success(applyChangeService.findDetail(id));
     }
 
@@ -133,4 +133,11 @@
         return ApiResponse.success("鎿嶄綔鎴愬姛",applyChangeService.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO));
     }
 
+    @ApiOperation("鎶曚繚纭涔︾绔犱笟鍔�")
+    @GetMapping("/getChangeMemberListOnlineSignLink/{id}")
+    @RequiresPermissions("business:applychange:query")
+    public ApiResponse<String> getChangeMemberListOnlineSignLink(@PathVariable Integer id) {
+        return ApiResponse.success(applyChangeService.getChangeMemberListOnlineSignLink(id));
+    }
+
 }
diff --git a/server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java b/server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java
index 2d0296e..007be44 100644
--- a/server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java
+++ b/server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java
@@ -150,4 +150,22 @@
         return ApiResponse.success(null);
     }
 
+
+
+    @ApiOperation("鎶曚繚纭涔︾绔犱笟鍔�")
+    @GetMapping("/getSignTBQRSLink/{id}")
+    @RequiresPermissions("business:insuranceapply:query")
+    public ApiResponse<String> getSignTBQRSLink(@PathVariable Integer id) {
+        return ApiResponse.success(insuranceApplyService.getSignTBQRSLink(id));
+    }
+
+
+    @ApiOperation("浜哄憳鍚嶅崟绛剧珷")
+    @GetMapping("/getMemberListOnlineSignLink/{id}")
+    @RequiresPermissions("business:insuranceapply:query")
+    public ApiResponse<String> getMemberListOnlineSignLink(@PathVariable Integer id) {
+        return ApiResponse.success(insuranceApplyService.getMemberListOnlineSignLink(id));
+    }
+
+
 }
diff --git a/server/company/src/main/java/com/doumee/api/business/MemberController.java b/server/company/src/main/java/com/doumee/api/business/MemberController.java
index ee6cf89..a5f8676 100644
--- a/server/company/src/main/java/com/doumee/api/business/MemberController.java
+++ b/server/company/src/main/java/com/doumee/api/business/MemberController.java
@@ -96,7 +96,7 @@
     @GetMapping("/{id}")
     @RequiresPermissions("business:member:query")
     public ApiResponse findById(@PathVariable Integer id) {
-        return ApiResponse.success(memberService.findById(id));
+        return ApiResponse.success(memberService.findDetailById(id));
     }
 
 
diff --git a/server/company/src/main/java/com/doumee/api/business/UnionApplyController.java b/server/company/src/main/java/com/doumee/api/business/UnionApplyController.java
index d3e1152..7fdc5ec 100644
--- a/server/company/src/main/java/com/doumee/api/business/UnionApplyController.java
+++ b/server/company/src/main/java/com/doumee/api/business/UnionApplyController.java
@@ -6,6 +6,7 @@
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
+import com.doumee.dao.business.dto.*;
 import com.doumee.dao.business.model.UnionApply;
 import com.doumee.service.business.UnionApplyService;
 import io.swagger.annotations.Api;
@@ -87,4 +88,49 @@
     public ApiResponse findById(@PathVariable Integer id) {
         return ApiResponse.success(unionApplyService.findById(id));
     }
+
+
+    @PreventRepeat
+    @ApiOperation("鍒涘缓鍚堝苟鍗�")
+    @PostMapping("/merge")
+    @RequiresPermissions("business:unionapply:create")
+    public ApiResponse merge(@RequestBody SaveUnionApplyDTO saveUnionApplyDTO) {
+        return ApiResponse.success(unionApplyService.merge(saveUnionApplyDTO));
+    }
+
+    @ApiOperation("鍏抽棴鍚堝苟鍗�")
+    @GetMapping("/close")
+    @RequiresPermissions("business:unionapply:close")
+    public ApiResponse close(@RequestParam Integer id) {
+        unionApplyService.cancelMerge(id);
+        return ApiResponse.success(null);
+    }
+
+    @PreventRepeat
+    @ApiOperation("涓婁紶鎶曚繚鍗�")
+    @PostMapping("/uploadToubaodan")
+    @RequiresPermissions("business:unionapply:create")
+    public ApiResponse uploadToubaodan(@RequestBody UploadMultifileDTO uploadMultifileDTO) {
+        unionApplyService.uploadToubaodan(uploadMultifileDTO);
+        return ApiResponse.success(null);
+    }
+
+    @ApiOperation("绛剧讲鐢宠鍗�")
+    @GetMapping("/getSignLink")
+    @RequiresPermissions("business:unionapply:query")
+    public ApiResponse getSignLink(@RequestParam Integer id) {
+        unionApplyService.getSignLink(id);
+        return ApiResponse.success(null);
+    }
+
+
+    @ApiOperation("涓婁紶淇濋櫓鍗�")
+    @PostMapping("/uploadBXD")
+    @RequiresPermissions("business:unionchange:query")
+    public ApiResponse uploadBXD(@RequestBody UnionApplyBXDDTO unionApplyBXDDTO) {
+        unionApplyService.uploadBXD(unionApplyBXDDTO);
+        return ApiResponse.success(null);
+    }
+
+
 }
diff --git a/server/company/src/main/java/com/doumee/api/business/UnionChangeController.java b/server/company/src/main/java/com/doumee/api/business/UnionChangeController.java
index 1f3017d..7098f83 100644
--- a/server/company/src/main/java/com/doumee/api/business/UnionChangeController.java
+++ b/server/company/src/main/java/com/doumee/api/business/UnionChangeController.java
@@ -6,6 +6,8 @@
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
+import com.doumee.dao.business.dto.SaveUnionChangeDTO;
+import com.doumee.dao.business.dto.UnionChangeBXDDTO;
 import com.doumee.dao.business.model.UnionChange;
 import com.doumee.service.business.UnionChangeService;
 import io.swagger.annotations.Api;
@@ -87,4 +89,41 @@
     public ApiResponse findById(@PathVariable Integer id) {
         return ApiResponse.success(unionChangeService.findById(id));
     }
+
+    @PreventRepeat
+    @ApiOperation("鍒涘缓鍚堝苟鍗�")
+    @PostMapping("/merge")
+    @RequiresPermissions("business:unionchange:create")
+    public ApiResponse merge(@RequestBody SaveUnionChangeDTO saveUnionChangeDTO) {
+        return ApiResponse.success(unionChangeService.merge(saveUnionChangeDTO));
+    }
+
+
+    @ApiOperation("鍏抽棴鍚堝苟鍗�")
+    @GetMapping("/close")
+    @RequiresPermissions("business:unionchange:close")
+    public ApiResponse close(@RequestParam Integer id) {
+        unionChangeService.cancelMerge(id);
+        return ApiResponse.success(null);
+    }
+
+
+    @ApiOperation("绛剧讲鐢宠鍗�")
+    @GetMapping("/getSignLink")
+    @RequiresPermissions("business:unionchange:query")
+    public ApiResponse getSignLink(@RequestParam Integer id) {
+        unionChangeService.getSignLink(id);
+        return ApiResponse.success(null);
+    }
+
+
+
+    @ApiOperation("涓婁紶淇濋櫓鍗�")
+    @PostMapping("/uploadBXD")
+    @RequiresPermissions("business:unionchange:query")
+    public ApiResponse uploadBXD(@RequestBody UnionChangeBXDDTO unionChangeBXDDTO) {
+        unionChangeService.uploadBXD(unionChangeBXDDTO);
+        return ApiResponse.success(null);
+    }
+
 }
diff --git a/server/company/src/main/java/com/doumee/api/system/SystemController.java b/server/company/src/main/java/com/doumee/api/system/SystemController.java
index 85cb705..c6d61cb 100644
--- a/server/company/src/main/java/com/doumee/api/system/SystemController.java
+++ b/server/company/src/main/java/com/doumee/api/system/SystemController.java
@@ -68,6 +68,7 @@
         subject.logout();
         return ApiResponse.success(null);
     }
+
     @Trace(withRequestParameters = false)
     @ApiOperation("淇敼褰撳墠鐢ㄦ埛瀵嗙爜")
     @PostMapping("/updatePwd")
diff --git a/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java b/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
index a98cbd2..4b9bd83 100644
--- a/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
+++ b/server/service/src/main/java/com/doumee/core/annotation/excel/ExcelExporter.java
@@ -745,7 +745,7 @@
      * @param data 鏁版嵁
      * @param sheetName Sheet鍚嶇О
      */
-    public String exportJiajianBaoExcelToPdf (ApplyChange data, String sheetName) {
+    public String exportJiajianBaoExcelToPdf (ApplyChange data, String sheetName,String cellValue) {
         SXSSFWorkbook sxssfWorkbook;
         try {
             sxssfWorkbook = new SXSSFWorkbook();
@@ -762,7 +762,7 @@
                 configTitleCell(sxssfWorkbook,title.getCell(i));
             }
             Row header1 = sheet.createRow(1);
-            header1.createCell(0).setCellValue("鎶曚繚浼佷笟");
+            header1.createCell(0).setCellValue(cellValue);
             header1.createCell(3).setCellValue("淇濋櫓鏂规");
             header1.createCell(4).setCellValue("淇濆崟鍙�");
             header1.createCell(5).setCellValue("淇濋櫓鐢熸晥璧锋湡");
@@ -871,7 +871,7 @@
             sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,0,11));
             Row header7= sheet.createRow(rowIndex+1);
             header7.setHeight((short) 3000);
-            header7.createCell(0).setCellValue("鎶曚繚浼佷笟绛剧珷 锛�                            \n \n \n" +"鏃ユ湡锛�     骞�     鏈�     鏃�    ");
+            header7.createCell(0).setCellValue(cellValue+"绛剧珷 锛�                            \n \n \n" +"鏃ユ湡锛�     骞�     鏈�     鏃�    ");
             for (int i =0; i < 12; i++) {
                 if(i>0){
                     header7.createCell(i).setCellValue("");
@@ -1001,7 +1001,7 @@
      * @param data 鏁版嵁
      * @param sheetName Sheet鍚嶇О
      */
-    public String exportChangeUnitExcelToPdf (ApplyChange data, String sheetName) {
+    public String exportChangeUnitExcelToPdf (ApplyChange data, String sheetName,String cellValue) {
         SXSSFWorkbook sxssfWorkbook;
         try {
             sxssfWorkbook = new SXSSFWorkbook();
@@ -1023,7 +1023,7 @@
                 configTitleCell(sxssfWorkbook,title.getCell(i));
             }
             Row header1 = sheet.createRow(1);
-            header1.createCell(0).setCellValue("鎶曚繚浼佷笟");
+            header1.createCell(0).setCellValue(cellValue);
             header1.createCell(1).setCellValue("淇濋櫓鏂规");
             header1.createCell(2).setCellValue("");
             header1.createCell(3).setCellValue("淇濆崟鍙�");
@@ -1096,7 +1096,7 @@
             sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,0,7));
             Row header7= sheet.createRow(rowIndex+1);
             header7.setHeight((short) 3000);
-            header7.createCell(0).setCellValue("鎶曚繚浼佷笟绛剧珷 锛�                            \n \n \n" +"鏃ユ湡锛�     骞�     鏈�     鏃�    ");
+            header7.createCell(0).setCellValue(cellValue + "绛剧珷 锛�                            \n \n \n" +"鏃ユ湡锛�     骞�     鏈�     鏃�    ");
             for (int i =0; i < 8; i++) {
                 if(i>0){
                     header7.createCell(i).setCellValue("");
@@ -1125,6 +1125,128 @@
         return null;
     }
 
+
+    /**
+     * 瀵煎嚭 鎶曚繚鐢宠璇﹀崟
+     * @param insuranceApply 鏁版嵁
+     * @param sheetName Sheet鍚嶇О
+     */
+    public String exportApplyExcelToPdf(InsuranceApply insuranceApply, String sheetName) {
+        SXSSFWorkbook sxssfWorkbook;
+        try {
+            sxssfWorkbook = new SXSSFWorkbook();
+            Sheet sheet = sxssfWorkbook.createSheet(sheetName);
+            for (int i = 0; i < 6; i++) {
+                sheet.setColumnWidth(i, ((i==3|| i== 4|| i== 5 )?16:8) * 2 * 256);
+            }
+            sheet.createFreezePane(0, 1);
+            sheet.addMergedRegion(new CellRangeAddress(0   ,0,0,6));
+            Row title = sheet.createRow(0);
+            title.setHeight((short) 2000);
+            Cell c = title.createCell(0);
+            c.setCellValue(sheetName);
+            configFirstCell(sxssfWorkbook,c);
+            for (int i = 0; i < 8; i++) {
+                if(i>0){
+                    title.createCell(i).setCellValue("");
+                }
+                configTitleCell(sxssfWorkbook,title.getCell(i));
+            }
+            Row header1 = sheet.createRow(1);
+            header1.createCell(0).setCellValue("鎶曚繚浜�");
+            header1.createCell(1).setCellValue("鎶ヤ繚闄╀汉");
+            header1.createCell(2).setCellValue("鎶曚繚浜烘暟");
+            header1.createCell(3).setCellValue("淇濋櫓鏂规");
+            header1.createCell(4).setCellValue("淇濋櫓鐢熸晥璧锋湡");
+            header1.createCell(5).setCellValue("淇濋櫓鐢熸晥姝㈡湡");
+            for (int i = 0; i < 6; i++) {
+                configFirstCell(sxssfWorkbook,header1.getCell(i));
+            }
+            sheet.addMergedRegion(new CellRangeAddress(1  ,1,1,2));
+
+            Row header2 = sheet.createRow(2);
+            header2.createCell(0).setCellValue(insuranceApply.getShopName());
+            header2.createCell(1).setCellValue(insuranceApply.getCompanyName());
+            header2.createCell(2).setCellValue(insuranceApply.getInsureNum());
+            header2.createCell(3).setCellValue(insuranceApply.getSolutionsName());
+            header2.createCell(4).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(insuranceApply.getStartTime()));
+            header2.createCell(5).setCellValue(com.doumee.core.utils.DateUtil.getPlusTime2(insuranceApply.getEndTime()));
+            sheet.addMergedRegion(new CellRangeAddress(2  ,2,1,2));
+            for (int i = 0; i < 6; i++) {
+                configDataCell(sxssfWorkbook,header2.getCell(i));
+            }
+            Row header4 = sheet.createRow(3);
+            header4.createCell(0).setCellValue("搴忓彿");
+            header4.createCell(1).setCellValue("鍛樺伐濮撳悕");
+            header4.createCell(2).setCellValue("鎬у埆");
+            header4.createCell(3).setCellValue("韬唤璇佸彿");
+            header4.createCell(4).setCellValue("娲鹃仯鍗曚綅");
+            header4.createCell(5).setCellValue("鎵�鎵�灞炲伐绉�");
+            for (int i = 0; i < 6; i++) {
+                configFirstCell(sxssfWorkbook,header4.getCell(i));
+            }
+            // 鍒涘缓鏁版嵁璁板綍
+            for (int rowIndex = 0; rowIndex <insuranceApply.getApplyDetailList().size(); rowIndex++) {
+                ApplyDetail addModel = insuranceApply.getApplyDetailList().get(rowIndex);
+                Row header5 = sheet.createRow(rowIndex + 4);
+                header5.createCell(0).setCellValue(rowIndex+1);
+                header5.createCell(1).setCellValue(StringUtils.defaultString(addModel.getMemberName(),""));
+                header5.createCell(2).setCellValue(Constants.equalsInteger(addModel.getSex(),0)?"鐢�":(Constants.equalsInteger(addModel.getSex(),1)?"濂�":"-"));
+                header5.createCell(3).setCellValue(StringUtils.defaultString(addModel.getIdcardNo(),""));
+                header5.createCell(6).setCellValue(StringUtils.defaultString(addModel.getDuName(),""));
+                header5.createCell(7).setCellValue(StringUtils.defaultString(addModel.getWorkTypeName(),""));
+                for (int i = 0; i < 6; i++) {
+                    configDataCell(sxssfWorkbook,header5.getCell(i));
+                }
+            }
+            int rowIndex = 4+insuranceApply.getApplyDetailList().size();
+            Row header6= sheet.createRow(rowIndex);
+            header6.createCell(0).setCellValue("鎶曚繚浼佷笟鐢虫槑:\n" +
+                    "1銆佸湪鐢宠涔︿笂濉啓鐨勪竴鍒囧唴瀹瑰睘瀹烇紝鍚﹀垯鏈紒涓氭壙鎷呬竴鍒囨硶寰嬭矗浠汇�俓n" +
+                    "2銆佺敱浜庡彉鏇村彈鐩婁汉浜х敓鐨勬硶寰嬬籂绾锋湰浼佷笟鎰挎壙鎷呬竴鍒囨硶寰嬭矗浠汇�俓n" +
+                    "3銆佹湰鐢宠琛ㄧ殑绛剧珷涓烘湰浼佷笟浜茶嚜绛剧讲锛屽鐢辨浜х敓鐨勬硶寰嬬籂绾锋湰浼佷笟鎰挎壙鎷呬竴鍒囨硶寰嬭矗浠汇�俓n");
+            for (int i = 1; i < 6; i++) {
+                header6.createCell(i).setCellValue("");
+            }
+            for (int i =0; i < 6; i++) {
+                if(i>0){
+                    header6.createCell(i).setCellValue("");
+                }
+                configInfoCell(sxssfWorkbook,header6.getCell(i),HorizontalAlignment.LEFT);
+            }
+            header6.setHeight((short) 2000);
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex ,rowIndex,0,7));
+            Row header7= sheet.createRow(rowIndex+1);
+            header7.setHeight((short) 3000);
+            header7.createCell(0).setCellValue("鎶曚繚浼佷笟绛剧珷 锛�                            \n \n \n" +"鏃ユ湡锛�     骞�     鏈�     鏃�    ");
+            for (int i =0; i < 6; i++) {
+                if(i>0){
+                    header7.createCell(i).setCellValue("");
+                }
+                configInfoCell(sxssfWorkbook,header7.getCell(i),HorizontalAlignment.RIGHT);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex+1 ,rowIndex+1,0,7));
+
+            //涓存椂缂撳啿鍖�
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            //鍒涘缓涓存椂鏂囦欢
+            sxssfWorkbook.write(out);
+            byte [] bookByteAry = out.toByteArray();
+            InputStream     in = new ByteArrayInputStream(bookByteAry);
+            String tempExcel = saveIsToFile(in);
+            String tempPdf =System.getProperty("java.io.tmpdir")+File.separator+UUID.randomUUID().toString()+".pdf";
+//            ExcelToPdfTool.excelToPdf(in,tempPdf);//杞琍DF
+            ExcelToPdfTool.excelToPdf(tempExcel,tempPdf);//杞琍DF
+            File f = new File(tempPdf);
+            if(f!=null && f.isFile() && f.length()>0){
+                return tempPdf;
+            }
+        } catch (Exception e) {
+            // throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
+        }
+        return null;
+    }
+
     private String saveIsToFile(InputStream inputStream) {
             try {
                 String fileName =System.getProperty("java.io.tmpdir")+File.separator+UUID.randomUUID().toString()+".xlsx";
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 4efd1ab..bc4bf5c 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
@@ -439,6 +439,18 @@
         CA_APPLY_JIAJIAN_SIGN(13, "鍔犲噺淇濈敵璇风绔犳枃浠�", "鍔犲噺淇濈敵璇风绔犳枃浠�"),
         CA_APPLY_CHANGEUNIT_SIGN(14, "鎹㈠巶鐢宠绛剧珷鏂囦欢", "鎹㈠巶鐢宠绛剧珷鏂囦欢"),
 
+        HBD_BD_APPLY_PDF(15, "鍚堝苟鍗�-淇濆崟鐢宠琛≒DF ", "鍚堝苟鍗�-淇濆崟鐢宠琛≒DF "),
+        HBD_BD_SIGNED_PDF(16, "鍚堝苟鍗�-绛剧讲鍚庝繚鍗曠敵璇疯〃PDF", "鍚堝苟鍗�-绛剧讲鍚庝繚鍗曠敵璇疯〃PDF"),
+        COMPANY_TBD_SIGNED_PDF(17, "鍚堝苟鍗�-鎶曚繚鍗�-鍟嗘埛鎻愪氦锛堜紒涓氱缃诧級", "鍚堝苟鍗�-绛剧讲鍚庝繚鍗曠敵璇疯〃PDF"),
+        SOLUTIONS_CONFIRMATION_LATTER(18, "濮旀墭淇� - 鎶曚繚鏂规纭涔�", "濮旀墭淇� - 鏂规纭涔�"),
+        MEMBER_LIST_LATTER(19, "濮旀墭淇� - 鎶曚繚浜哄憳鍚嶅崟", "濮旀墭淇� - 鏂规纭涔�"),
+        CHANGE_MEMBER_LIST_LATTER(20, "濮旀墭淇� - 鍔犲噺淇濅汉鍛樺悕鍗�", "濮旀墭淇� - 鏂规纭涔�"),
+
+
+
+
+
+
 
         ;
         // 鎴愬憳鍙橀噺
@@ -847,7 +859,11 @@
     }
 
     public  enum UnionApplyStatus {
-        UPLOAD(1, "寰呬笂浼犳姇淇濆崟","",0),
+        MERGE(1, "寰呬笂浼犱繚鍗�","",0),
+        WAIT_SIGNATURE(2, "寰呯缃�","",0),
+        UPLOAD_INSURANCE_POLICY(3, "寰呬笂浼犱繚鍗�","",0),
+        FINISH(4, "淇濋殰涓�","",0),
+        CLOSE(5, "鍏抽棴","",0),
         ;
         // 鎴愬憳鍙橀噺
         private String name;
@@ -937,6 +953,98 @@
 
 
 
+    public  enum UnionChangeStatus {
+        MERGE(0, "寰呯缃茬敵璇峰崟","",0),
+        UPLOAD_INSURANCE_POLICY(1, "寰呬笂浼犱繚鍗�","",0),
+        FINISH(2, "淇濋殰涓�","",0),
+        CLOSE(3, "鍏抽棴","",0),
+        ;
+        // 鎴愬憳鍙橀噺
+        private String name;
+        private String info;
+        private int key;
+        private int collectStatus;
+
+
+        // 鏋勯�犳柟娉�
+        UnionChangeStatus(int key, String name,String info,int collectStatus) {
+            this.name = name;
+            this.key = key;
+            this.info = info;
+            this.collectStatus = collectStatus;
+        }
+
+        // 鏅�氭柟娉�
+        public static String getName(int index) {
+            for (UnionChangeStatus c : UnionChangeStatus.values()) {
+                if (c.getKey() == index) {
+                    return c.name;
+                }
+            }
+            return null;
+        }
+        public static List<Integer> getKesByStatus(Integer collectStatus) {
+            List<Integer>  list = new ArrayList<>();
+            if(collectStatus!=null){
+                for (UnionChangeStatus c : UnionChangeStatus.values()) {
+                    if (Constants.equalsInteger(c.getCollectStatus() ,collectStatus)) {
+                        list.add(c.getKey());
+                    }
+                }
+            }
+            return list;
+        }
+        public static Integer getCollectStatus(Integer index) {
+            for (UnionChangeStatus c : UnionChangeStatus.values()) {
+                if (Constants.equalsInteger(c.getKey() , index)) {
+                    return c.collectStatus;
+                }
+            }
+            return null;
+        }
+        public static String getInfo(int index) {
+            for (UnionChangeStatus c : UnionChangeStatus.values()) {
+                if (c.getKey() == index) {
+                    return c.info;
+                }
+            }
+            return null;
+        }
+
+        // get set 鏂规硶
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public int getKey() {
+            return key;
+        }
+
+        public void setKey(int key) {
+            this.key = key;
+        }
+
+        public String getInfo() {
+            return info;
+        }
+
+        public void setInfo(String info) {
+            this.info = info;
+        }
+
+        public int getCollectStatus() {
+            return collectStatus;
+        }
+
+        public void setCollectStatus(int collectStatus) {
+            this.collectStatus = collectStatus;
+        }
+    }
+
     public  enum InsuranceApplyStatus {
         UPLOAD(0, "鎻愪氦鎶曚繚","",0),
         PLATFORM_RETURN(1, "瀹℃牳涓嶉�氳繃","鎻愪氦鎰忚锛�${param}",4),
@@ -950,6 +1058,8 @@
         CLOSE(9, "璁㈠崟鍏抽棴","",6),
         PLATFORM_CHECK_PASS(10,"骞冲彴鎶曚繚瀹℃牳閫氳繃","鎻愪氦鎰忚锛�${param}",0),
         COMPANY_BACK_APPLY_PASS(11, "浼佷笟鐢宠閫�鍥�(骞冲彴鎶曚繚瀹℃牳閫氳繃)","鎻愪氦鎰忚锛�${param}",5),
+        COMPANY_APPLY_SIGNATURE(12, "濮旀墭淇�-浼佷笟宸茬缃叉姇淇濈‘璁や功","鎻愪氦鎰忚锛�${param}",5),
+        COMPANY_MEMBER_LIST_SIGNATURE(13, "濮旀墭淇�-浼佷笟宸茬缃蹭汉鍛樺悕鍗�","鎻愪氦鎰忚锛�${param}",5),
         ;
         // 鎴愬憳鍙橀噺
         private String name;
@@ -1242,6 +1352,7 @@
         CLOSE(6, "宸插叧闂�"),
         PALTFORM_CHECK_PASS(7, "瀹℃牳閫氳繃"),
         PALTFORM_CHECK_PASS_NO(8, "瀹℃牳涓嶉�氳繃"),
+        COMPANY_SIGN(9, "浼佷笟绛剧讲浜哄憳鍚嶅崟 - 濮旀墭淇�"),
         ;
         // 鎴愬憳鍙橀噺
         private String name;
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java
index 91ea1bb..532210b 100644
--- a/server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/InsuranceApplyQueryDTO.java
@@ -76,4 +76,8 @@
 
     @ApiModelProperty(value = "鐘舵�� 0寰呭鏍� 1寰呭嚭鍗� 2淇濋殰涓�  3宸茶繃鏈� 4宸叉挙鍥� 5閫�鍥炵敵璇蜂腑 6宸插叧闂�", example = "1")
     private Integer statusCollect;
+
+
+    @ApiModelProperty(value = "鐢熸晥涓� 0=鏄�")
+    private Integer isEffective;
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/MemberQueryDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/MemberQueryDTO.java
index 3a76cfa..1bf6981 100644
--- a/server/service/src/main/java/com/doumee/dao/business/dto/MemberQueryDTO.java
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/MemberQueryDTO.java
@@ -9,8 +9,12 @@
 @Data
 public class MemberQueryDTO {
 
+    @ApiModelProperty(value = "妯$硦鏌ヨ 鎵嬫満鍙�+韬唤璇佸彿鐮�")
+    private String keywords;
+
     @ApiModelProperty(value = "鍛樺伐鍚嶇О")
     private String name;
+
     @ApiModelProperty(value = "娲鹃仯鍠綅鍚嶇О")
     private String duName;
 
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionChangeDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionChangeDTO.java
new file mode 100644
index 0000000..36ee37f
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionChangeDTO.java
@@ -0,0 +1,32 @@
+package com.doumee.dao.business.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2024/3/15 14:42
+ */
+@Data
+public class SaveUnionChangeDTO {
+
+    @ApiModelProperty(value = "鎶曚繚鍚堝苟鍗曚富閿�")
+    private Integer unionApplyId;
+
+    @ApiModelProperty(value = "鍔犲噺淇�/鎹㈠巶鍗曟嵁涓婚敭 澶氫釜浠�,鍒嗗壊")
+    private List<Integer> applyIds;
+
+    @ApiModelProperty(value = "鎵瑰崟鏃ユ湡")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date applyDate;
+
+    @ApiModelProperty(value = "涓氬姟绫诲瀷锛�0=鍔犲噺淇�;1=鎹㈠巶")
+    private Integer businessType;
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDDetailTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDDetailTO.java
new file mode 100644
index 0000000..0630205
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDDetailTO.java
@@ -0,0 +1,32 @@
+package com.doumee.dao.business.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2024/3/20 16:52
+ */
+@Data
+public class UnionApplyBXDDDetailTO {
+
+    @ApiModelProperty(value = "鎶曚繚鍗曚富閿� insurance_apply")
+    private Integer applyId;
+
+    @ApiModelProperty(value = "鏈嶅姟璐� 姣忎汉")
+    private BigDecimal serverMoney;
+
+    @ApiModelProperty(value = "淇濆崟鏂囦欢鍦板潃")
+    private String fileUrl;
+
+    @ApiModelProperty(value = "鏂囦欢鍚嶇О")
+    private String fileName;
+
+    
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDTO.java
new file mode 100644
index 0000000..cf7aa4b
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/UnionApplyBXDDTO.java
@@ -0,0 +1,43 @@
+package com.doumee.dao.business.dto;
+
+import com.doumee.core.annotation.excel.ExcelColumn;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2024/3/20 16:52
+ */
+@Data
+public class UnionApplyBXDDTO {
+
+    @ApiModelProperty(value = "鍚堝苟鍗曚富閿�")
+    private Integer id;
+
+    @ApiModelProperty(value = "淇濆崟鍙�")
+    private String code;
+
+    @ApiModelProperty(value = "淇濋櫓鐢熸晥姝㈡湡")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date endTime;
+
+    @ApiModelProperty(value = "淇濋櫓鐢熸晥璧锋湡")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date startTime;
+
+    @ApiModelProperty(value = "淇濆崟鏂囦欢鍦板潃")
+    private String fileUrl;
+
+    @ApiModelProperty(value = "淇濆崟鏂囦欢鍚嶇О")
+    private String fileName;
+
+    @ApiModelProperty(value = "鍚堝苟鍗曟槑缁嗕繚鍗曚俊鎭�")
+    private List<UnionApplyBXDDDetailTO> unionApplyBXDDDetailTOList;
+    
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/UnionChangeBXDDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/UnionChangeBXDDTO.java
new file mode 100644
index 0000000..b33d8d9
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/UnionChangeBXDDTO.java
@@ -0,0 +1,35 @@
+package com.doumee.dao.business.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2024/3/20 16:52
+ */
+@Data
+public class UnionChangeBXDDTO {
+
+    @ApiModelProperty(value = "鍚堝苟鍗曚富閿�")
+    private Integer id;
+
+    @ApiModelProperty(value = "淇濆崟鍙�")
+    private String code;
+
+    @ApiModelProperty(value = "鎵瑰崟鏃ユ湡")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date applyDate;
+
+    @ApiModelProperty(value = "淇濆崟鏂囦欢鍦板潃")
+    private String fileUrl;
+
+    @ApiModelProperty(value = "淇濆崟鏂囦欢鍚嶇О")
+    private String fileName;
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/UploadMultifileDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/UploadMultifileDTO.java
new file mode 100644
index 0000000..1b472ca
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/UploadMultifileDTO.java
@@ -0,0 +1,25 @@
+package com.doumee.dao.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2024/3/19 16:52
+ */
+@Data
+public class UploadMultifileDTO {
+
+
+    @ApiModelProperty(value = "涓氬姟涓婚敭")
+    private Integer businessId;
+
+    @ApiModelProperty(value = "鏂囦欢璺緞")
+    private String filePath;
+
+    @ApiModelProperty(value = "鏂囦欢鍚嶇О")
+    private String fileName;
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/join/UnionApplyJoinMapper.java b/server/service/src/main/java/com/doumee/dao/business/join/UnionApplyJoinMapper.java
new file mode 100644
index 0000000..3a10f64
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/join/UnionApplyJoinMapper.java
@@ -0,0 +1,13 @@
+package com.doumee.dao.business.join;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.doumee.dao.business.model.UnionApply;
+import com.github.yulichang.base.mapper.MPJJoinMapper;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2024/03/12 11:34
+ */
+public interface UnionApplyJoinMapper extends MPJJoinMapper<UnionApply> {
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
index d8a786d..12970c1 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyChange.java
@@ -113,6 +113,14 @@
     @ApiModelProperty(value = "鍙樻洿閲戦")
     @ExcelColumn(name="鍙樻洿閲戦")
     private BigDecimal fee;
+
+    @ApiModelProperty(value = "鍚堝苟鍗�-鎶曚繚鍗曠姸鎬� 0=鏈笂浼�;1=宸蹭笂浼�;2=宸茬缃�", example = "1")
+    private Integer unionChangeTbdStatus;
+
+    @ApiModelProperty(value = "浜哄憳鍚嶅崟绛剧讲鍚堝悓鍙�")
+    @ExcelColumn(name="浜哄憳鍚嶅崟绛剧讲鍚堝悓鍙�")
+    private String signMemberListNo;
+
     @ApiModelProperty(value = "淇濆崟鍙�")
     @TableField(exist = false)
     private String applyCode;
@@ -151,6 +159,14 @@
     @TableField(exist = false)
     private String createDateE;
 
+    @ApiModelProperty(value = "鎵瑰崟鐢熸晥璧锋湡鏃堕棿")
+    @TableField(exist = false)
+    private String applyStartS;
+
+    @ApiModelProperty(value = "鎵瑰崟姝㈡晥鏃堕棿")
+    @TableField(exist = false)
+    private String applyStartE;
+
     @ApiModelProperty(value = "淇濋櫓鏂规涓婚敭")
     @TableField(exist = false)
     private Integer solutionsId;
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java b/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
index f52f696..46a235c 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
@@ -72,8 +72,10 @@
     @ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥璧锋湡")
     @ExcelColumn(name="淇濋櫓鐢熸晥璧锋湡",index =8,width = 12,dateFormat="yyyy-MM-dd HH:mm:ss")
     private Date startTime;
+
     @ApiModelProperty(value = "鍚堝苟鍗曠紪鐮侊紙鍏宠仈union_apply)", example = "1")
     private Integer unionApplyId;
+
     @ApiModelProperty(value = "韬唤璇佸彿鐮�")
     @ExcelColumn(name="韬唤璇佸彿鐮�",index = 5,width = 12)
     private String idcardNo;
@@ -89,6 +91,10 @@
     @ApiModelProperty(value = "璐圭敤", example = "1")
     @ExcelColumn(name="璐圭敤",index = 10,width = 5)
     private BigDecimal fee;
+
+
+    @ApiModelProperty(value = "鍗曚环", example = "1")
+    private BigDecimal price;
 
     @ApiModelProperty(value = "鎬у埆 0=鐢�;1=濂�", example = "1")
     @ExcelColumn(name="鎬у埆",index =4,valueMapping = "0=鐢�;1=濂�;",width = 3)
@@ -119,6 +125,10 @@
     @TableField(exist = false)
     private String validCode;
 
+    @ApiModelProperty(value = "淇濋殰鐘舵�侊細0=淇濋殰涓紱1=涓嶅湪淇�")
+    @TableField(exist = false)
+    private Integer applyStatus;
+
     @ApiModelProperty(value = "娲鹃仯鍗曚綅鍚嶇О")
     @TableField(exist = false)
     @ExcelColumn(name="娲鹃仯鍗曚綅",index = 6,width = 10)
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 36ade21..fa689c9 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
@@ -108,6 +108,9 @@
     @ExcelColumn(name="鍚堝苟鍗曠紪鐮侊紙鍏宠仈union_apply)")
     private Integer unionApplyId;
 
+    @ApiModelProperty(value = "鍚堝苟鍗�-鎶曚繚鍗曠姸鎬� 0=鏈笂浼�;1=宸蹭笂浼�;2=宸茬缃�", example = "1")
+    private Integer unionApplyTbdStatus;
+
     @ApiModelProperty(value = "鍗曞彿")
     @ExcelColumn(name="鍗曞彿")
     private String code;
@@ -126,6 +129,14 @@
     @ApiModelProperty(value = "鎬昏垂鐢�")
     @ExcelColumn(name="鎬昏垂鐢�")
     private BigDecimal fee;
+
+    @ApiModelProperty(value = "鍦ㄧ嚎纭涔﹀悎鍚屽彿")
+    @ExcelColumn(name="鍦ㄧ嚎纭涔﹀悎鍚屽彿")
+    private String signQrsNo;
+
+    @ApiModelProperty(value = "浜哄憳鍚嶅崟绛剧讲鍚堝悓鍙�")
+    @ExcelColumn(name="浜哄憳鍚嶅崟绛剧讲鍚堝悓鍙�")
+    private String signMemberListNo;
 
     @ApiModelProperty(value = "浼佷笟鍚嶇О")
     @TableField(exist = false)
@@ -222,6 +233,13 @@
     @TableField(exist = false)
     private Integer newVersionSolutionId;
 
+
+    @ApiModelProperty(value = "鍟嗘埛鍚嶇О")
+    @TableField(exist = false)
+    private String shopName;
+
+
+
     public TaxesInvoicingVO toTaxesInvoicingVO(){
         TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO();
         taxesInvoicingVO.setId(this.getId());
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java b/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
index 4d6f9d5..29c91bd 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/Solutions.java
@@ -116,6 +116,7 @@
     @ApiModelProperty(value = "鎺ユ敹鏂囦欢閭")
     @ExcelColumn(name="鎺ユ敹鏂囦欢閭")
     private String email;
+
     @ApiModelProperty(value = "鎵垮寘鍏徃")
     @ExcelColumn(name="鎵垮寘鍏徃")
     private String companyName;
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java b/server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java
index 0ec7761..b1f4ee3 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/UnionApply.java
@@ -103,4 +103,8 @@
     @ExcelColumn(name="鍦ㄧ嚎绛剧珷鍚堝悓鍙�")
     private String signApplyNo;
 
+    @ApiModelProperty(value = "鏂规缂栫爜锛堝叧鑱攕olutions锛�", example = "1")
+    @ExcelColumn(name="鏂规缂栫爜锛堝叧鑱攕olutions锛�")
+    private Integer solutionId;
+
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java b/server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java
index 4929fc4..bdf08f7 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/UnionChange.java
@@ -70,7 +70,7 @@
 
     @ApiModelProperty(value = "鐘舵�� 0寰呯缃茬敵璇峰崟 1寰呬笂浼犳壒鍗� 2宸蹭笂浼犳壒鍗� 3閫�鍥�")
     @ExcelColumn(name="鐘舵�� 0寰呯缃茬敵璇峰崟 1寰呬笂浼犳壒鍗� 2宸蹭笂浼犳壒鍗� 3閫�鍥�")
-    private String status;
+    private Integer status;
 
     @ApiModelProperty(value = "鏈熸湜淇濋櫓鐢熸晥璧锋湡")
     @ExcelColumn(name="鏈熸湜淇濋櫓鐢熸晥璧锋湡")
@@ -89,4 +89,8 @@
     @ExcelColumn(name="鍦ㄧ嚎绛剧珷鍚堝悓鍙�")
     private String signApplyNo;
 
+    @ApiModelProperty(value = "鍚堝苟淇濆崟涓婚敭")
+    @ExcelColumn(name="鍚堝苟淇濆崟涓婚敭")
+    private Integer unionApplyId;
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java b/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
index 14b0e80..f831e59 100644
--- a/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
+++ b/server/service/src/main/java/com/doumee/service/business/ApplyChangeService.java
@@ -121,4 +121,12 @@
     String getSignLinkChangeUnit(ApplyChange model);
 
     CountCyclePriceVO getChangeCountCyclePriceVO(ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO);
+
+    /**
+     * 濮旀墭淇� 浜哄憳鍚嶅崟绛剧讲
+     * @param applyChangeId
+     * @return
+     */
+    String getChangeMemberListOnlineSignLink(Integer applyChangeId);
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java b/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
index 613fb08..f46c055 100644
--- a/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
+++ b/server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java
@@ -133,4 +133,26 @@
     CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO);
 
     void generateNotice();
+
+    /**
+     * 璇︽儏淇℃伅
+     * @param applyId
+     * @return
+     */
+    InsuranceApply  queryApplyDetail(Integer applyId);
+
+    /**
+     * 濮旀墭淇� 鎶曚繚纭涔︾绔犱笟鍔�
+     * @param applyId
+     * @return
+     */
+    String getSignTBQRSLink(Integer applyId);
+
+    /**
+     * 浜哄憳鍚嶅崟绛剧珷
+     * @param applyId
+     * @return
+     */
+    String getMemberListOnlineSignLink(Integer applyId);
 }
+
diff --git a/server/service/src/main/java/com/doumee/service/business/MemberService.java b/server/service/src/main/java/com/doumee/service/business/MemberService.java
index 536d665..14012d5 100644
--- a/server/service/src/main/java/com/doumee/service/business/MemberService.java
+++ b/server/service/src/main/java/com/doumee/service/business/MemberService.java
@@ -67,6 +67,8 @@
      */
     Member findById(Integer id);
 
+    Member findDetailById(Integer id);
+
     /**
      * 鏉′欢鏌ヨ鍗曟潯璁板綍
      *
diff --git a/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java b/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
index 354081f..6e36ad7 100644
--- a/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
+++ b/server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
@@ -3,6 +3,8 @@
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.dao.business.dto.SaveUnionApplyDTO;
+import com.doumee.dao.business.dto.UnionApplyBXDDTO;
+import com.doumee.dao.business.dto.UploadMultifileDTO;
 import com.doumee.dao.business.model.UnionApply;
 import java.util.List;
 
@@ -100,5 +102,31 @@
      * 淇濆崟鍚堝苟
      * @param saveUnionApplyDTO
      */
-    void merge(SaveUnionApplyDTO saveUnionApplyDTO);
+    Integer merge(SaveUnionApplyDTO saveUnionApplyDTO);
+
+    /**
+     * 鍙栨秷鍚堝苟鍗�
+     * @param id
+     */
+    void cancelMerge(Integer id);
+
+    /**
+     * 涓婁紶鎶曚繚鍗�
+     * @param uploadMultifileDTO
+     */
+    void uploadToubaodan(UploadMultifileDTO uploadMultifileDTO);
+
+    /**
+     * 鍚堝苟鍗� 淇濆崟绛剧讲
+     * @param id
+     * @return
+     */
+    String getSignLink(Integer id);
+
+    /**
+     * 涓婁紶淇濋櫓鍗�
+     * @param unionApplyBXDDTO
+     */
+    void uploadBXD(UnionApplyBXDDTO unionApplyBXDDTO);
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/UnionChangeService.java b/server/service/src/main/java/com/doumee/service/business/UnionChangeService.java
index 0e724e7..d626d1f 100644
--- a/server/service/src/main/java/com/doumee/service/business/UnionChangeService.java
+++ b/server/service/src/main/java/com/doumee/service/business/UnionChangeService.java
@@ -2,6 +2,8 @@
 
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.dto.SaveUnionChangeDTO;
+import com.doumee.dao.business.dto.UnionChangeBXDDTO;
 import com.doumee.dao.business.model.UnionChange;
 import java.util.List;
 
@@ -94,4 +96,34 @@
      * @return long
      */
     long count(UnionChange unionChange);
+
+    /**
+     * 鍒涘缓鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶鍗曪級
+     * @param saveUnionChangeDTO
+     * @return
+     */
+    Integer merge(SaveUnionChangeDTO saveUnionChangeDTO);
+
+    /**
+     * 鍏抽棴 鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶鍗曪級
+     * @param id
+     */
+    void cancelMerge(Integer id);
+
+
+    /**
+     * 鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛� - 鎶曚繚鐢宠绛剧讲
+     * @param id
+     * @return
+     */
+    String getSignLink(Integer id);
+
+
+    /**
+     * 鍚堝苟鍗� 涓婁紶淇濋櫓鍗�
+     * @param unionChangeBXDDTO
+     */
+    void uploadBXD(UnionChangeBXDDTO unionChangeBXDDTO);
+
+
 }
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 fc49dfe..33dbed9 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
@@ -664,7 +664,6 @@
             );
 
             update.setFee(totalFee);
-
         }
     }
 
@@ -1472,7 +1471,9 @@
                 .eq(!Objects.isNull(model.getApplyId()),ApplyChange::getApplyId,model.getApplyId())
                 .eq(!Objects.isNull(model.getBaseSolutionsId()),Solutions::getBaseId,model.getBaseSolutionsId())
                 .ge(StringUtils.isNotBlank(model.getCreateDateS()),ApplyChange::getCreateDate, model.getCreateDateS()+" 00:00:00" )
-                .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" );
+                .le(StringUtils.isNotBlank(model.getCreateDateE()),ApplyChange::getCreateDate, model.getCreateDateE()+" 23:59:59" )
+                .ge(StringUtils.isNotBlank(model.getApplyStartS()),ApplyChange::getApplyStartTime, model.getApplyStartS()+" 00:00:00" )
+                .le(StringUtils.isNotBlank(model.getApplyStartE()),ApplyChange::getApplyStartTime, model.getApplyStartE()+" 23:59:59" );
         LoginUserInfo loginUserInfo =(LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         //浼佷笟浜哄憳鏌ョ湅鏈紒涓氭暟鎹�
         if(loginUserInfo.getType().equals(Constants.ONE)){
@@ -1753,9 +1754,9 @@
         }
         String fileUrl = null;
         if(Constants.equalsObject(model.getType(), Constants.ONE)){
-              fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�");
+              fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","鎶曚繚浼佷笟");
         }else{
-            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃");
+            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","鎶曚繚浼佷笟");
         }
         String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
         notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
@@ -1773,8 +1774,6 @@
         update.setEditDate(new Date());
         update.setSignApplyNo(applyNo);
         applyChangeMapper.updateById(update);
-
-
 
         return  link;
     }
@@ -1932,4 +1931,95 @@
         return sumPrice.divide(new BigDecimal(sumDays),2, RoundingMode.HALF_UP).multiply(new BigDecimal(optDays));
     }
 
+    public  ApplyChange  queryApplyChangeData(Integer applyChangeId){
+        ApplyChange model = findDetail(applyChangeId);
+        if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getIsdeleted())){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        MPJLambdaWrapper<ApplyChagneDetail> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper.selectAll(ApplyChagneDetail.class);
+        queryWrapper.select("t2.name",ApplyChagneDetail::getWorkTypeName);
+        queryWrapper.select("t3.name",ApplyChagneDetail::getDuName);
+        queryWrapper.select("t4.name",ApplyChagneDetail::getOldWorkTypeName);
+        queryWrapper.select("t5.name",ApplyChagneDetail::getOldDuName);
+        queryWrapper.selectAs(Member::getName,ApplyChagneDetail::getMemberName);
+        queryWrapper.selectAs(Member::getSex,ApplyChagneDetail::getSex);
+        queryWrapper.selectAs(Member::getIdcardNo,ApplyChagneDetail::getMemberIdcardNo);
+        queryWrapper.leftJoin(Member.class,Member::getId,ApplyChagneDetail::getMemberId);
+        queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getWorktypeId);
+        queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getDuId);
+        queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getOldWorktypeId);
+        queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getOldDuId);
+        queryWrapper.eq(ApplyChagneDetail::getApplyChangeId,applyChangeId);
+        List<ApplyChagneDetail> list = applyChangeDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, queryWrapper);
+        for (ApplyChagneDetail applyChagneDetail:list) {
+            applyChagneDetail.setAge(Constants.getAgeByIdCard(applyChagneDetail.getMemberIdcardNo()));
+        }
+        if(CollectionUtils.isNotEmpty(list)){
+            model.setAddDetailList(list.stream().filter(m->m.getType().equals(Constants.ZERO)).collect(Collectors.toList()));
+            model.setDelDetailList(list.stream().filter(m->m.getType().equals(Constants.ONE)).collect(Collectors.toList()));
+            model.setChangeDetailList(list.stream().filter(m->m.getType().equals(Constants.TWO)).collect(Collectors.toList()));
+        }
+        return model;
+    }
+
+    /**
+     * 浜哄憳鍚嶅崟绛剧珷
+     */
+    @Override
+    public String getChangeMemberListOnlineSignLink(Integer applyChangeId) {
+        ApplyChange model = this.queryApplyChangeData(applyChangeId);
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠姞鍑忎繚淇℃伅");
+        }
+        if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getIsdeleted())){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔绛剧珷鎿嶄綔锛�");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        Company company = user.getCompany();
+        if(debugModel){
+            company = companyMapper.selectById(model.getCompanyId());
+        }
+        if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
+        }
+        Solutions solutions = solutionsMapper.selectById(model.getSolutionsId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+        if(solutions.getType().equals(Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝闈炲鎵樹繚鏂规淇濆崟锛屾棤娉曡繘琛岃鎿嶄綔!");
+        }
+        String fileUrl = null;
+        if(Constants.equalsObject(model.getType(), Constants.ONE)){
+            fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
+        }else{
+            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
+        }
+        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
+        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
+        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"浜哄憳鍚嶅崟绛剧珷",company.getSignId(),notifyUrl);
+        if(StringUtils.isBlank(applyNo) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        String link = signService.signLink(applyNo,company.getName(),company.getCode());
+        if(StringUtils.isBlank(link) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        ApplyChange update= new ApplyChange();
+        update.setId(model.getId());
+        update.setEditor(user.getId());
+        update.setEditDate(new Date());
+        update.setSignMemberListNo(applyNo);
+        applyChangeMapper.updateById(update);
+        return  link;
+    }
+
+
+
+
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
index 366e9f3..b62574e 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
@@ -201,6 +201,7 @@
         queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo);
         queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName);
         queryWrapper.selectAs(Solutions::getName,ApplyDetail::getSolutionName);
+        queryWrapper.selectAs(InsuranceApply::getStatus,ApplyDetail::getSolutionName);
         queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId);
         queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId);
         queryWrapper.leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId);
@@ -242,6 +243,12 @@
             int num = 1;
             for (ApplyDetail d : pageData.getRecords()){
                 d.setSortnum(num++);
+                if(d.getEndTime().compareTo(new Date())<0){
+                    d.setApplyStatus(Constants.ONE);
+                }else{
+                    d.setApplyStatus(Constants.ZERO);
+                }
+
             }
         }
         return pageData;
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 6b79eb3..03a8e69 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
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
@@ -98,6 +99,8 @@
 
     @Autowired
     private NoticesMapper noticesMapper;
+    @Autowired
+    private UnionApplyJoinMapper unionApplyJoinMapper;
 
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -251,8 +254,8 @@
         }
 
         return  1;
-
     }
+
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public     Integer editBaoxiandan(InsuranceApply param) {
@@ -375,6 +378,7 @@
 
 
     }
+
     @Override
     public  String getSignLink(Integer id) {
         if(id == null ){
@@ -434,9 +438,10 @@
         update.setEditDate(new Date());
         update.setSignApplyNo(applyNo);
         insuranceApplyMapper.updateById(update);
-
         return  link;
     }
+
+
     public String uploadSignFile(String link){
         try {
             String bucketName = systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode();
@@ -496,8 +501,75 @@
 
         startSendEmail(f, model.getCompanyName(),model.getSolutionsName(),model.getSolutionEmail());
         return  f;
-
     }
+
+    /**
+     * 濮旀墭淇� 鏂规纭涔︼紙浼佷笟锛�
+     * @param model
+     * @param fileurl
+     * @param fullUrl
+     * @return
+     */
+    public Multifile   uploadFAQRSSignedFileDo(InsuranceApply model,String fileurl,String fullUrl) {
+        InsuranceApply update = new InsuranceApply();
+        update.setEditDate(new Date());
+        update.setEditor(model.getCreator());
+        update.setStatus(Constants.InsuranceApplyStatus.COMPANY_APPLY_SIGNATURE.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo("浼佷笟瀹屾垚绛剧讲鏂规纭涔�");
+        update.setCheckUserId(model.getCreator());
+        update.setId(model.getId());
+        insuranceApplyMapper.updateById(update);
+
+        Multifile f = new Multifile();
+        f.setIsdeleted(Constants.ZERO);
+        f.setCreator(model.getCreator());
+        f.setObjId(update.getId());
+        f.setCreateDate(update.getEditDate());
+        f.setObjType(Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey());
+        f.setType(Constants.TWO);
+        f.setFileurl(fileurl);
+        f.setFileurlFull(fullUrl);
+        f.setInfo("浼佷笟瀹屾垚绛剧讲鏂规纭涔�");
+        f.setName("鏂规纭涔�.pdf");
+        multifileMapper.insert(f);
+        return  f;
+    }
+
+    /**
+     * 濮旀墭淇� 浼佷笟绛剧讲 浜哄憳鍚嶅崟
+     * @param model
+     * @param fileurl
+     * @param fullUrl
+     * @return
+     */
+    public Multifile   uploadApplyMemberListSignedFileDo(InsuranceApply model,String fileurl,String fullUrl) {
+        InsuranceApply update = new InsuranceApply();
+        update.setEditDate(new Date());
+        update.setEditor(model.getCreator());
+        update.setStatus(Constants.InsuranceApplyStatus.COMPANY_MEMBER_LIST_SIGNATURE.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo("浼佷笟瀹屾垚绛剧讲浜哄憳鍚嶅崟");
+        update.setCheckUserId(model.getCreator());
+        update.setId(model.getId());
+        insuranceApplyMapper.updateById(update);
+
+        Multifile f = new Multifile();
+        f.setIsdeleted(Constants.ZERO);
+        f.setCreator(model.getCreator());
+        f.setObjId(update.getId());
+        f.setCreateDate(update.getEditDate());
+        f.setObjType(Constants.MultiFile.MEMBER_LIST_LATTER.getKey());
+        f.setType(Constants.TWO);
+        f.setFileurl(fileurl);
+        f.setFileurlFull(fullUrl);
+        f.setInfo("浼佷笟瀹屾垚绛剧讲浜哄憳鍚嶅崟");
+        f.setName("浜哄憳鍚嶅崟.pdf");
+        multifileMapper.insert(f);
+        return  f;
+    }
+    
+    
     public Multifile  uploadChangeSignedFileDo(ApplyChange model,String fileurl,String fullurl) {
         Integer companyId = model.getCompanyId();
         ApplyChange update = new ApplyChange();
@@ -542,7 +614,81 @@
 
         startSendEmail(f,model.getCompanyName(),model.getSolutionsName(),model.getSolutionEmail());
         return f;
+    }
 
+
+    public Multifile  uploadChangeMemberListSignedFileDo(ApplyChange model,String fileurl,String fullurl) {
+        ApplyChange update = new ApplyChange();
+        update.setEditDate(new Date());
+        update.setEditor(model.getCreator());
+        update.setStatus(Constants.ApplyChangeStatus.COMPANY_SIGN.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo("浼佷笟瀹屾垚绛剧讲浜哄憳鍚嶅崟");
+        update.setCheckUserId(model.getCreator());
+        update.setId(model.getId());
+        applyChangeMapper.updateById(update);
+
+        Multifile f = new Multifile();
+        f.setIsdeleted(Constants.ZERO);
+        f.setCreator(model.getCreator());
+        f.setObjId(update.getId());
+        f.setCreateDate(update.getEditDate());
+        f.setObjType(Constants.MultiFile.CHANGE_MEMBER_LIST_LATTER.getKey());
+        f.setType(Constants.TWO);
+        f.setFileurl(fileurl);
+        f.setFileurlFull(fullurl);
+        f.setInfo("浼佷笟瀹屾垚绛剧讲浜哄憳鍚嶅崟");
+        f.setName("绛剧珷浜哄憳鍚嶅崟.pdf");
+        multifileMapper.insert(f);
+
+        return f;
+    }
+
+    /**
+     * 鍟嗘埛鍚堝苟鍗� 鍟嗘埛绛剧讲鎶曚繚鐢宠鍗�
+     * @param model
+     * @param fileurl
+     * @param fullUrl
+     * @return
+     */
+    public Multifile   uploadUnionApplySignedFileDo(UnionApply model,String fileurl,String fullUrl) {
+        UnionApply update = new UnionApply();
+        update.setEditDate(new Date());
+        update.setEditor(model.getCreator());
+        update.setStatus(Constants.UnionApplyStatus.UPLOAD_INSURANCE_POLICY.getKey());
+        update.setCheckDate(update.getEditDate());
+        update.setCheckInfo("鍟嗘埛瀹屾垚绛剧讲");
+        update.setCheckUserId(model.getCreator());
+        update.setId(model.getId());
+        unionApplyJoinMapper.updateById(update);
+
+        //瀛樺偍寰呭姙淇℃伅
+//        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
+//        //鍒犻櫎鍏朵粬寰呭姙
+//        noticesMapper.delete(new QueryWrapper<Notices>().lambda().eq(Notices::getObjType,noticeObjectType.getKey())
+//                .ne(Notices::getType,Constants.NoticeType.SIX.getStatus())
+//                .eq(Notices::getObjId,model.getId()));
+//        Notices notices = new Notices(noticeObjectType,Constants.ZERO,model.getId(),model.getSolutionsName(),model.getCompanyId(),Constants.NoticeType.TWO);
+//        noticesMapper.insert(notices);
+
+        Multifile f = new Multifile();
+        f.setIsdeleted(Constants.ZERO);
+        f.setCreator(model.getCreator());
+        f.setObjId(update.getId());
+        f.setCreateDate(update.getEditDate());
+        f.setObjType(Constants.MultiFile.HBD_BD_APPLY_PDF.getKey());
+        f.setType(Constants.TWO);
+        f.setFileurl(fileurl);
+        f.setFileurlFull(fullUrl);
+        f.setInfo("鍟嗘埛绛剧讲鎶曚繚鍗�");
+        f.setName("鍟嗘埛绛剧讲鎶曚繚鍗�.pdf");
+        multifileMapper.insert(f);
+//        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.SIGNATURE;
+//        ApplyLog log = new ApplyLog(update,applyLogType.getName(), null,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update));
+//        applyLogMapper.insert(log);
+//
+//        startSendEmail(f, model.getCompanyName(),model.getSolutionsName(),model.getSolutionEmail());
+        return  f;
     }
 
     private void startSendEmail(Multifile f, String companyName, String solutionsName, String solutionEmail) {
@@ -567,6 +713,9 @@
 
     @Override
     public   void dealWaitSignedData(){
+        String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+
+                systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
+        //鐩翠繚淇濆崟 浼佷笟绛剧珷鏁版嵁澶勭悊
         List<InsuranceApply> applyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,
                 new MPJLambdaWrapper<InsuranceApply>()
                 .selectAll(InsuranceApply.class)
@@ -576,9 +725,8 @@
                 .selectAs(Company::getName,InsuranceApply::getCompanyName)
                 .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
                 .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())
+                .eq(Solutions::getType,Constants.ZERO)
                 .isNotNull(InsuranceApply::getSignApplyNo));
-        String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+
-                systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
         if(applyList !=null && applyList.size()>0 ){
             for(InsuranceApply model : applyList){
                 String status = signService.linkFileStatus(model.getSignApplyNo());
@@ -595,6 +743,64 @@
                 return;
             }
         }
+        //濮旀墭淇� 浼佷笟绛剧讲鎶曚繚纭涔�
+        applyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,
+                new MPJLambdaWrapper<InsuranceApply>()
+                        .selectAll(InsuranceApply.class)
+                        .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                        .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
+                        .selectAs(Company::getName,InsuranceApply::getCompanyName)
+                        .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                        .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD.getKey())
+                        .eq(Solutions::getType,Constants.ONE)
+                        .isNotNull(InsuranceApply::getSignQrsNo));
+        if(applyList !=null && applyList.size()>0 ){
+            for(InsuranceApply model : applyList){
+                String status = signService.linkFileStatus(model.getSignQrsNo());
+                if(!StringUtils.equals(status,"3")){
+                    continue;
+                }
+                String link = signService.linkFile(model.getSignQrsNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadFAQRSSignedFileDo(model,fileUrl,path+fileUrl);
+                return;
+            }
+        }
+
+        //濮旀墭淇� 浼佷笟绛剧讲浜哄憳鍚嶅崟
+        applyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,
+                new MPJLambdaWrapper<InsuranceApply>()
+                        .selectAll(InsuranceApply.class)
+                        .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                        .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
+                        .selectAs(Company::getName,InsuranceApply::getCompanyName)
+                        .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                        .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.COMPANY_APPLY_SIGNATURE.getKey())
+                        .eq(Solutions::getType,Constants.ONE)
+                        .isNotNull(InsuranceApply::getSignMemberListNo));
+        if(applyList !=null && applyList.size()>0 ){
+            for(InsuranceApply model : applyList){
+                String status = signService.linkFileStatus(model.getSignMemberListNo());
+                if(!StringUtils.equals(status,"3")){
+                    continue;
+                }
+                String link = signService.linkFile(model.getSignMemberListNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadApplyMemberListSignedFileDo(model,fileUrl,path+fileUrl);
+                return;
+            }
+        }
+
         List<ApplyChange> chagneList = applyChangeMapper.selectJoinList(ApplyChange.class,
                 new MPJLambdaWrapper<ApplyChange>()
                 .selectAll(ApplyChange.class)
@@ -606,6 +812,7 @@
                 .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                 .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
                 .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.UPLOAD.getKey())
+                .eq(Solutions::getType,Constants.ZERO)
                 .isNotNull(ApplyChange::getSignApplyNo));
         if(chagneList !=null && chagneList.size()>0 ){
             for(ApplyChange model : chagneList){
@@ -623,6 +830,64 @@
                 return;
             }
         }
+
+        chagneList = applyChangeMapper.selectJoinList(ApplyChange.class,
+                new MPJLambdaWrapper<ApplyChange>()
+                        .selectAll(ApplyChange.class)
+                        .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                        .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
+                        .selectAs(Company::getName,InsuranceApply::getCompanyName)
+                        .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId)
+                        .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
+                        .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                        .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                        .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.UPLOAD.getKey())
+                        .eq(Solutions::getType,Constants.ONE)
+                        .isNotNull(ApplyChange::getSignMemberListNo));
+        if(chagneList !=null && chagneList.size()>0 ){
+            for(ApplyChange model : chagneList){
+                String status = signService.linkFileStatus(model.getSignMemberListNo());
+                if(!StringUtils.equals(status,"3")){
+                    continue;
+                }
+                String link = signService.linkFile(model.getSignMemberListNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadChangeMemberListSignedFileDo(model,fileUrl,path+fileUrl);
+                return;
+            }
+        }
+
+
+
+        /**
+         *鍚堝苟鎶曚繚鍗� 绛剧讲涓氬姟
+         */
+        List<UnionApply> unionApplyList = unionApplyJoinMapper.selectJoinList(UnionApply.class,
+                new MPJLambdaWrapper<UnionApply>()
+                        .selectAll(UnionApply.class)
+                        .eq(UnionApply::getStatus,Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())
+                        .isNotNull(UnionApply::getSignApplyNo));
+        if(unionApplyList !=null && unionApplyList.size()>0 ){
+            for(UnionApply model : unionApplyList){
+                String status = signService.linkFileStatus(model.getSignApplyNo());
+                if(!StringUtils.equals(status,"3")){
+                    continue;
+                }
+                String link = signService.linkFile(model.getSignApplyNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadUnionApplySignedFileDo(model,fileUrl,path+fileUrl);
+                return;
+            }
+        }
+
     }
     @Override
     public   void dealSignResult(NotifyDataReq data){
@@ -633,6 +898,7 @@
             //濡傛灉宸蹭繚鍏�,鍙笅杞界绾﹂檮浠�
             String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+
                     systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode();
+            //鐩翠繚 鎶曚繚鐢宠
             InsuranceApply model = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,
                     new MPJLambdaWrapper<InsuranceApply>()
                             .selectAll(InsuranceApply.class)
@@ -641,6 +907,7 @@
                             .selectAs(Company::getName,InsuranceApply::getCompanyName)
                             .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                             .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                            .eq(Solutions::getType,Constants.ZERO)
                             .eq(InsuranceApply::getSignApplyNo,data.getApplyNo())
                             .last("limit 1" ));
             if(model != null && Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())){
@@ -654,6 +921,54 @@
                 uploadSignedFileDo(model,fileUrl,path+fileUrl);
                 return;
             }
+            //濮旀墭淇� 浼佷笟鏂规纭涔�
+            InsuranceApply modelTBQRS = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,
+                    new MPJLambdaWrapper<InsuranceApply>()
+                            .selectAll(InsuranceApply.class)
+                            .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                            .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
+                            .selectAs(Company::getName,InsuranceApply::getCompanyName)
+                            .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                            .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                            .eq(Solutions::getType,Constants.ONE)
+                            .eq(InsuranceApply::getSignQrsNo,data.getApplyNo())
+                            .last("limit 1" ));
+            if(modelTBQRS != null && Constants.equalsInteger(modelTBQRS.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())){
+                //瀹屾垚绛剧讲宸插畬鎴愭搷浣�
+                String link = signService.linkFile(data.getApplyNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadFAQRSSignedFileDo(modelTBQRS,fileUrl,path+fileUrl);
+                return;
+            }
+            //濮旀墭淇� 浼佷笟绛剧讲浜哄憳鍚嶅崟
+            InsuranceApply modelMemberList = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,
+                    new MPJLambdaWrapper<InsuranceApply>()
+                            .selectAll(InsuranceApply.class)
+                            .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                            .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
+                            .selectAs(Company::getName,InsuranceApply::getCompanyName)
+                            .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                            .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                            .eq(Solutions::getType,Constants.ONE)
+                            .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo())
+                            .last("limit 1" ));
+            if(modelMemberList != null && Constants.equalsInteger(modelMemberList.getStatus(),Constants.InsuranceApplyStatus.COMPANY_APPLY_SIGNATURE.getKey())){
+                //瀹屾垚绛剧讲宸插畬鎴愭搷浣�
+                String link = signService.linkFile(data.getApplyNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadApplyMemberListSignedFileDo(modelMemberList,fileUrl,path+fileUrl);
+                return;
+            }
+
+            //鐩翠繚 鍔犲噺淇濅紒涓氱缃�
             ApplyChange applyChange = applyChangeMapper.selectJoinOne(ApplyChange.class,
                     new MPJLambdaWrapper<ApplyChange>()
                             .selectAll(ApplyChange.class)
@@ -664,6 +979,7 @@
                             .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
                             .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                             .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                            .eq(Solutions::getType,Constants.ZERO)
                             .eq(ApplyChange::getSignApplyNo,data.getApplyNo()).last("limit 1" ));
             if(applyChange != null &&Constants.equalsInteger(applyChange.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){
                 String link = signService.linkFile(data.getApplyNo());
@@ -674,18 +990,67 @@
                 }
                 uploadChangeSignedFileDo(applyChange,fileUrl,path+fileUrl);
             }
+
+            //濮旀墭淇� 鍔犲噺淇濅紒涓氱缃�
+            ApplyChange applyChangeMemberList = applyChangeMapper.selectJoinOne(ApplyChange.class,
+                    new MPJLambdaWrapper<ApplyChange>()
+                            .selectAll(ApplyChange.class)
+                            .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                            .selectAs(Solutions::getEmail,InsuranceApply::getSolutionEmail)
+                            .selectAs(Company::getName,InsuranceApply::getCompanyName)
+                            .selectAs(InsuranceApply::getCompanyId,ApplyChange::getCompanyId)
+                            .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
+                            .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                            .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                            .eq(Solutions::getType,Constants.ONE)
+                            .eq(ApplyChange::getSignMemberListNo,data.getApplyNo()).last("limit 1" ));
+            if(applyChangeMemberList != null &&Constants.equalsInteger(applyChangeMemberList.getStatus(),Constants.ApplyChangeStatus.UPLOAD.getKey())){
+                String link = signService.linkFile(data.getApplyNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadChangeMemberListSignedFileDo(applyChangeMemberList,fileUrl,path+fileUrl);
+            }
+
+
+            //鎶曚繚鍚堝苟鍗� 鍟嗘埛绛剧讲淇濆崟
+            UnionApply unionApply = unionApplyJoinMapper.selectOne(new QueryWrapper<UnionApply>()
+                    .lambda().eq(UnionApply::getSignApplyNo,data.getApplyNo()).last(" limit 1 "));
+            if(unionApply != null &&Constants.equalsInteger(unionApply.getStatus(),Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())){
+                String link = signService.linkFile(data.getApplyNo());
+                String fileUrl = uploadSignFile(link);
+                if(StringUtils.isBlank(fileUrl)){
+                    //濡傛灉涓嬭浇澶辫触锛屾竻闄ゅ悎鍚岋紝涓嬫绛剧珷閲嶆柊鐢熸垚鏂板悎鍚�
+                    return;
+                }
+                uploadUnionApplySignedFileDo(unionApply,fileUrl,path+fileUrl);
+            }
         }else if(Constants.equalsInteger(data.getSignStatus(), Constants.TWO )){
             //濡傛灉宸叉嫆绛撅紝娓呴櫎鍚堝悓锛屼笅娆$绔犻噸鏂扮敓鎴愭柊鍚堝悓
             insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
                     .set(InsuranceApply::getSignApplyNo,null)
                     .eq(InsuranceApply::getSignApplyNo,data.getApplyNo()));
-            //濡傛灉宸叉嫆绛撅紝娓呴櫎鍚堝悓锛屼笅娆$绔犻噸鏂扮敓鎴愭柊鍚堝悓
             applyChangeMapper.update(null,new UpdateWrapper<ApplyChange>().lambda()
                     .set(ApplyChange::getSignApplyNo,null)
                     .eq(ApplyChange::getSignApplyNo,data.getApplyNo()));
+            insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
+                    .set(InsuranceApply::getSignQrsNo,null)
+                    .eq(InsuranceApply::getSignQrsNo,data.getApplyNo()));
+            insuranceApplyMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
+                    .set(InsuranceApply::getSignMemberListNo,null)
+                    .eq(InsuranceApply::getSignMemberListNo,data.getApplyNo()));
+            unionApplyJoinMapper.update(null,new UpdateWrapper<UnionApply>().lambda()
+                    .set(UnionApply::getSignApplyNo,null)
+                    .eq(UnionApply::getSignApplyNo,data.getApplyNo()));
+            applyChangeMapper.update(null,new UpdateWrapper<ApplyChange>().lambda()
+                    .set(ApplyChange::getSignMemberListNo,null)
+                    .eq(ApplyChange::getSignMemberListNo,data.getApplyNo()));
         }
-
     }
+
+
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public Integer uploadToubaodan(InsuranceApply insuranceApply) {
@@ -751,8 +1116,6 @@
         Notices notices = new Notices(noticeObjectType,Constants.ONE,model.getId(),solutions.getName(),
                 model.getCompanyId(), Constants.NoticeType.ONE);
         noticesMapper.insert(notices);
-
-
 
         return  1;
 
@@ -1290,8 +1653,9 @@
         queryWrapper.selectAs(Company::getName,InsuranceApply::getCompanyName);
         queryWrapper.selectAs(Solutions::getName,InsuranceApply::getSolutionsName);
         queryWrapper.selectAs(Solutions::getType,InsuranceApply::getSolutionType);
-        queryWrapper.select(" ( select sum(td.fee) from taxes ts inner join tax_detial td on ts.TAX_ID = ts.id  where ts.status != 2 and td.INSURANCE_APPLY_ID = t.id ) as taxesMoney ");
-        queryWrapper.select(" ( select td.CREATE_DATE from taxes ts inner join tax_detial td on ts.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(" ( select max(ac.APPLY_START_TIME) from apply_change ac  where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate");
+        queryWrapper.select(" ( 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 ) 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.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId);
         queryWrapper.leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId);
         queryWrapper.eq(InsuranceApply::getIsdeleted,Constants.ZERO);
@@ -1341,6 +1705,12 @@
         if (CollectionUtils.isNotEmpty(model.getIds())) {
             queryWrapper.in(InsuranceApply::getId, model.getIds());
         }
+        if (CollectionUtils.isNotEmpty(model.getIds())) {
+            queryWrapper.in(InsuranceApply::getId, model.getIds());
+        }
+        if (model.getIsEffective() != null && model.getIsEffective().equals(Constants.ZERO)) {
+            queryWrapper.ge(InsuranceApply::getEndTime,DateUtil.DateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
+        }
         List<InsuranceApply> list = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class, queryWrapper);
         return list;
     }
@@ -1365,11 +1735,13 @@
                 .selectAs(Solutions::getTimeUnit,InsuranceApply::getTimeUnit)
                 .selectAs(Solutions::getType,InsuranceApply::getSolutionType)
                 .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
+                .selectAs(Solutions::getName,InsuranceApply::getShopName)
                 .selectAs(Company::getName,InsuranceApply::getCompanyName)
                 .select(" ( select max(ac.APPLY_START_TIME) from apply_change ac  where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate")
                 .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.apply_id = t.id ) as insureNum")
                 .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                 .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
+                .leftJoin(Company.class,Company::getId,Solutions::getShopId)
                 .eq(InsuranceApply::getId,id)
                 .last("limit 1");
 
@@ -1679,5 +2051,148 @@
     }
 
 
+    /**
+     * 濮旀墭瀹� 鎶曚繚纭涔�
+     * @param id
+     * @return
+     */
+    @Override
+    public  String getSignTBQRSLink(Integer id) {
+        if(id == null ){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        MPJLambdaWrapper wrapper=  new MPJLambdaWrapper<InsuranceApply>()
+                .selectAll(InsuranceApply.class)
+                .selectAs(Solutions::getSignKeyword,InsuranceApply::getSignKeyword)
+                .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                .eq(InsuranceApply::getId,id)
+                .last("limit 1");
+
+        InsuranceApply model = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,wrapper);
+        if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+        if(solutions.getType().equals(Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝闈炲鎵樹繚鏂规淇濆崟!");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        Constants.ApplyLogType applyLogType = null;
+        String info = "";
+        //濡傛灉鏄┏鍥�,鍙兘鍙┏鍥炲凡绛剧珷鐘舵�佷笅鐨勯��鍥炵敵璇风姸鎬佽繘琛屾搷浣�
+        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.UPLOAD.getKey())){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        Company company = user.getCompany();
+        if(debugModel){
+            company = companyMapper.selectById(model.getCompanyId());
+        }
+        if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
+        }
+        Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId,solutions.getId())
+                .eq(Multifile::getObjType,Constants.MultiFile.SOLUTIONS_CONFIRMATION_LATTER.getKey())
+                .eq(Multifile::getIsdeleted,Constants.ZERO).last("limit 1"));
+        if(f == null || StringUtils.isBlank(f.getFileurl())){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇纭涔︽枃浠跺け璐ワ紝璇疯仈绯诲晢鎴风‘璁ゆ姇淇濈‘璁や功鏄惁姝g‘锛�");
+        }
+        String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode()+f.getFileurl();
+        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
+        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
+        String applyNo = signService.applySign(company.getName(),url,company.getName(),company.getCode(),company.getEmail(),model.getSignKeyword(),company.getSignId(),notifyUrl);
+        if(StringUtils.isBlank(applyNo) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        String link = signService.signLink(applyNo,company.getName(),company.getCode());
+        if(StringUtils.isBlank(link) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        InsuranceApply update= new InsuranceApply();
+        update.setId(model.getId());
+        update.setEditor(user.getId());
+        update.setEditDate(new Date());
+        update.setSignQrsNo(applyNo);
+        insuranceApplyMapper.updateById(update);
+        return  link;
+    }
+
+    @Override
+    public  InsuranceApply  queryApplyDetail(Integer applyId){
+        InsuranceApply model = findDetail(applyId);
+        if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getIsdeleted())){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        //鏌ヨ淇濆崟鏄庣粏淇℃伅
+        List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>()
+                .selectAll(ApplyDetail.class)
+                .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName)
+                .selectAs(DispatchUnit::getName,ApplyDetail::getDuName)
+                .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId)
+                .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId)
+                .isNull(ApplyDetail::getFromId)
+                .eq(ApplyDetail::getId,model.getId())
+        );
+        model.setApplyDetailList(applyDetailList);
+        return model;
+    }
+
+
+
+    /**
+     * 浜哄憳鍚嶅崟绛剧珷
+     */
+    @Override
+    public String getMemberListOnlineSignLink(Integer applyId) {
+        InsuranceApply model = this.queryApplyDetail(applyId);
+        if(Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇繚鍗曚俊鎭�");
+        }
+        if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getIsdeleted())){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝璇ョ敵璇风姸鎬佸凡娴佽浆锛屽綋鍓嶄笉鏀寔绛剧珷鎿嶄綔锛�");
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        Company company = user.getCompany();
+        if(debugModel){
+            company = companyMapper.selectById(model.getCompanyId());
+        }
+        if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
+        }
+        Solutions solutions = solutionsMapper.selectById(model.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+        if(solutions.getType().equals(Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝闈炲鎵樹繚鏂规淇濆崟锛屾棤娉曡繘琛岃鎿嶄綔!");
+        }
+        String fileUrl =  ExcelExporter.build(InsuranceApply.class).exportApplyExcelToPdf(model,"浜哄憳鍚嶅崟");
+        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
+        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
+        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"鎶曚繚鍚嶅崟绛剧珷",company.getSignId(),notifyUrl);
+        if(StringUtils.isBlank(applyNo) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        String link = signService.signLink(applyNo,company.getName(),company.getCode());
+        if(StringUtils.isBlank(link) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        InsuranceApply update= new InsuranceApply();
+        update.setId(model.getId());
+        update.setEditor(user.getId());
+        update.setEditDate(new Date());
+        update.setSignMemberListNo(applyNo);
+        insuranceApplyMapper.updateById(update);
+        return  link;
+    }
+
+
+
 
 }
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 ffd6741..2b57685 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
@@ -103,6 +103,29 @@
     }
 
     @Override
+    public Member findDetailById(Integer id) {
+        MPJLambdaWrapper<Member> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper.selectAll(Member.class)
+                .selectAs(DispatchUnit::getName,Member::getDuName)
+                .selectAs(Worktype::getName,Member::getWorkTypeName)
+                .selectAs(Solutions::getName,Member::getSolutionName)
+                .selectAs(Company::getName,Member::getCompanyName)
+                .select(" case when  now() between t.start_time and t.end_time then 1  else 2 end solutionsStatus ")
+                .leftJoin(InsuranceApply.class,InsuranceApply::getId,Member::getApplyId)
+                .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
+                .leftJoin(DispatchUnit.class,DispatchUnit::getId,Member::getDuId)
+                .leftJoin(Worktype.class,Worktype::getId,Member::getWorktypeId)
+                .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+                .eq(Member::getId,id)
+                .eq(Member::getIsdeleted, Constants.ZERO)
+                .last(" limit 1 ")
+        ;
+        return memberJoinMapper.selectJoinOne(Member.class,queryWrapper);
+    }
+
+
+
+    @Override
     public Member findOne(Member member) {
         QueryWrapper<Member> wrapper = new QueryWrapper<>(member);
         return memberMapper.selectOne(wrapper);
@@ -207,6 +230,10 @@
                 .leftJoin(DispatchUnit.class,DispatchUnit::getId,Member::getDuId)
                 .leftJoin(Worktype.class,Worktype::getId,Member::getWorktypeId)
                 .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+                .and(StringUtils.isNotBlank(memberQueryDTO.getKeywords()),
+                        i->i.like(Member::getName, memberQueryDTO.getKeywords()).or().like(
+                                Member::getIdcardNo,memberQueryDTO.getKeywords()
+                        ))
                 .eq(Member::getIsdeleted, Constants.ZERO)
 //                .eq(Member::getCompanyId, memberQueryDTO.getCompanyId())
                 .like(StringUtils.isNotBlank(memberQueryDTO.getName()),Member::getName, memberQueryDTO.getName())
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
index b9450d7..8088df0 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -1,35 +1,48 @@
 package com.doumee.service.business.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.CompanyMapper;
+import com.doumee.dao.business.MultifileMapper;
+import com.doumee.dao.business.SolutionsMapper;
 import com.doumee.dao.business.UnionApplyMapper;
 import com.doumee.dao.business.dto.SaveUnionApplyDTO;
+import com.doumee.dao.business.dto.UnionApplyBXDDDetailTO;
+import com.doumee.dao.business.dto.UnionApplyBXDDTO;
+import com.doumee.dao.business.dto.UploadMultifileDTO;
+import com.doumee.dao.business.join.ApplyDetailJoinMapper;
 import com.doumee.dao.business.join.InsuranceApplyJoinMapper;
-import com.doumee.dao.business.model.InsuranceApply;
-import com.doumee.dao.business.model.Solutions;
-import com.doumee.dao.business.model.UnionApply;
+import com.doumee.dao.business.join.UnionApplyJoinMapper;
+import com.doumee.dao.business.model.*;
 import com.doumee.service.business.UnionApplyService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.doumee.service.business.third.SignService;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import io.swagger.models.auth.In;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * 鍚堝苟鎶曚繚鍗曚俊鎭〃Service瀹炵幇
@@ -43,7 +56,28 @@
     private UnionApplyMapper unionApplyMapper;
 
     @Autowired
+    private UnionApplyJoinMapper unionApplyJoinMapper;
+
+    @Autowired
+    private SolutionsMapper solutionsMapper;
+
+    @Autowired
+    private CompanyMapper companyMapper;
+
+    @Autowired
     private InsuranceApplyJoinMapper insuranceApplyJoinMapper;
+
+    @Autowired
+    private ApplyDetailJoinMapper applyDetailJoinMapper;
+
+    @Autowired
+    private MultifileMapper multifileMapper;
+
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
+
+    @Autowired
+    private SignService signService;
 
     @Override
     public Integer create(UnionApply unionApply) {
@@ -187,7 +221,7 @@
 
 
     @Override
-    public void merge(SaveUnionApplyDTO saveUnionApplyDTO){
+    public Integer merge(SaveUnionApplyDTO saveUnionApplyDTO){
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         if(user.getType().equals(Constants.TWO)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
@@ -196,6 +230,7 @@
             || Objects.isNull(saveUnionApplyDTO.getApplyIds())
             || Objects.isNull(saveUnionApplyDTO.getStartDate())
             || Objects.isNull(saveUnionApplyDTO.getEndDate())
+            || Objects.isNull(saveUnionApplyDTO.getBaseSolutionId())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -205,7 +240,7 @@
                         .selectAs(InsuranceApply::getSolutionBaseId,Solutions::getBaseId)
                         .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                         .eq(InsuranceApply::getIsdeleted, Constants.ZERO)
-                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())
+                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.COMPANY_MEMBER_LIST_SIGNATURE.getKey())
                         .eq(Solutions::getBaseId,saveUnionApplyDTO.getBaseSolutionId())
                         .in(InsuranceApply::getId,saveUnionApplyDTO.getApplyIds())
                         .isNull(InsuranceApply::getUnionApplyId)
@@ -222,10 +257,14 @@
         unionApply.setStartTime(saveUnionApplyDTO.getStartDate());
         unionApply.setEndTime(saveUnionApplyDTO.getEndDate());
         unionApply.setCheckDate(new Date());
-        unionApply.setStatus(Constants.UnionApplyStatus.UPLOAD.getKey());
+        unionApply.setStatus(Constants.UnionApplyStatus.MERGE.getKey());
         unionApply.setCheckUserId(user.getId());
-        unionApply.setFee(insuranceApplyList.stream().map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
         unionApply.setCurrentFee(BigDecimal.ZERO);
+
+        Integer maxDays = DateUtil.calculateBetween(saveUnionApplyDTO.getStartDate(),saveUnionApplyDTO.getEndDate(),0);
+        List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getPrice)
+                .in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds()));
+        unionApply.setFee(applyDetailList.stream().map(i->i.getPrice().multiply(new BigDecimal(maxDays))).reduce(BigDecimal.ZERO,BigDecimal::add));
         unionApplyMapper.insert(unionApply);
 
         insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
@@ -234,16 +273,311 @@
                 .set(InsuranceApply::getCheckUserId,user.getId())
                 .in(InsuranceApply::getId,saveUnionApplyDTO.getApplyIds()));
 
+        applyDetailJoinMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda()
+                .set(ApplyDetail::getUnionApplyId,unionApply.getId())
+                .in(ApplyDetail::getApplyId,saveUnionApplyDTO.getApplyIds()));
+
+        return unionApply.getId();
+
     }
 
 
+    /**
+     * 鍙栨秷淇濆崟鍚堝苟
+     * @param id
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public void cancelMerge(Integer id){
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         if(user.getType().equals(Constants.TWO)){
-            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        UnionApply unionApply = unionApplyMapper.selectById(id);
+        if(Objects.isNull(unionApply)||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!unionApply.getCompanyId().equals(user.getCompanyId())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
+        }
+        if(unionApply.getStatus().equals(Constants.UnionApplyStatus.FINISH.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡瀹岀粨锛屾偍鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        if(unionApply.getStatus().equals(Constants.UnionApplyStatus.CLOSE.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡鍏抽棴");
+        }
+        //鍚堝苟鍗曠姸鎬佸浜庡緟鎶曚繚
+        if(unionApply.getStatus().equals(Constants.UnionApplyStatus.UPLOAD_INSURANCE_POLICY.getKey())
+        || unionApply.getStatus().equals(Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())){
+            //TODO 鍒犻櫎浼佷笟鎶曚繚鍗曠殑 绛剧讲鏁版嵁
+
+        }
+        insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
+                .set(InsuranceApply::getUnionApplyId,null)
+                .set(InsuranceApply::getCheckDate,new Date())
+                .set(InsuranceApply::getCheckUserId,user.getId())
+                .eq(InsuranceApply::getUnionApplyId,unionApply.getId()));
+
+        applyDetailJoinMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda()
+                .set(ApplyDetail::getUnionApplyId,null)
+                .eq(ApplyDetail::getUnionApplyId,unionApply.getId()));
+
+        unionApplyMapper.update(null,new UpdateWrapper<UnionApply>().lambda()
+                .set(UnionApply::getCheckDate,new Date())
+                .set(UnionApply::getCheckUserId,user.getId())
+                .set(UnionApply::getStatus,Constants.UnionApplyStatus.CLOSE.getKey())
+                .eq(UnionApply::getId,unionApply.getId())
+        );
+    }
+
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void uploadToubaodan(UploadMultifileDTO uploadMultifileDTO){
+        if(uploadMultifileDTO.getBusinessId() == null
+                ||StringUtils.isBlank( uploadMultifileDTO.getFilePath())
+                ||StringUtils.isBlank( uploadMultifileDTO.getFileName())){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        UnionApply unionApply = unionApplyMapper.selectById(uploadMultifileDTO.getBusinessId());
+        if(Objects.isNull(unionApply)||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!unionApply.getCompanyId().equals(user.getCompanyId())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
+        }
+        if(unionApply.getStatus().equals(Constants.UnionApplyStatus.FINISH.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡瀹岀粨锛屾偍鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        if(unionApply.getStatus().equals(Constants.UnionApplyStatus.MERGE.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡娴佽浆锛屾偍鏃犳硶杩涜璇ユ搷浣滐紒");
         }
 
+        unionApply.setCheckDate(new Date());
+        unionApply.setCheckUserId(user.getId());
+        unionApply.setStatus(Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey());
+        unionApply.setEditor(user.getId());
+        unionApply.setEditDate(new Date());
+        unionApplyMapper.updateById(unionApply);
+
+        Multifile multifile = new Multifile();
+        multifile.setIsdeleted(Constants.ZERO);
+        multifile.setCreator(user.getId());
+        multifile.setCreateDate(new Date());
+        multifile.setObjId(uploadMultifileDTO.getBusinessId());
+        multifile.setCreateDate(new Date());
+        multifile.setObjType(Constants.MultiFile.HBD_BD_SIGNED_PDF.getKey());
+        multifile.setType(Constants.TWO);
+        multifile.setFileurl(uploadMultifileDTO.getFilePath());
+        multifile.setName(uploadMultifileDTO.getFileName());
+        multifileMapper.insert(multifile);
+
     }
 
 
+    /**
+     * 鍚堝苟鍗� - 鎶曚繚鐢宠绛剧讲
+     * @param id
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public  String getSignLink(Integer id) {
+        if(id == null ){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        UnionApply unionApply = unionApplyJoinMapper.selectById(id);
+        if(unionApply == null ||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        Solutions solutions = solutionsMapper.selectById(unionApply.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+
+        if(!Constants.equalsInteger(unionApply.getStatus(),Constants.UnionApplyStatus.WAIT_SIGNATURE.getKey())){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ュ悎骞跺崟鐘舵�佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        Multifile f = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
+                .eq(Multifile::getObjId,unionApply.getId())
+                .eq(Multifile::getObjType,Constants.MultiFile.HBD_BD_SIGNED_PDF.getKey())
+                .eq(Multifile::getIsdeleted,Constants.ZERO)
+                .last("limit 1"));
+        if(f == null || StringUtils.isBlank(f.getFileurl())){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇寰呯绔犳枃浠跺け璐ワ紝璇疯仈绯荤‘璁ゅ悎骞朵繚鍗曟槸鍚︽纭紒");
+        }
+
+        Company company =  companyMapper.selectById(unionApply.getCompanyId());
+        if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝鍟嗘埛灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
+        }
+
+        String url = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.APPLY_FILE).getCode()+f.getFileurl();
+        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
+        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}", unionApply.getId().toString());
+
+        String applyNo = signService.applySign(company.getName(),url,company.getName(),company.getCode(),company.getEmail(),null,company.getSignId(),notifyUrl);
+
+        if(StringUtils.isBlank(applyNo) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        String link = signService.signLink(applyNo,company.getName(),company.getCode());
+        if(StringUtils.isBlank(link) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        UnionApply update= new UnionApply();
+        update.setId(unionApply.getId());
+        update.setEditor(user.getId());
+        update.setEditDate(new Date());
+        update.setSignApplyNo(applyNo);
+        unionApplyJoinMapper.updateById(update);
+        return  link;
+    }
+
+
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void uploadBXD(UnionApplyBXDDTO unionApplyBXDDTO){
+        if(Objects.isNull(unionApplyBXDDTO)
+            || Objects.isNull(unionApplyBXDDTO.getId())
+            || Objects.isNull(unionApplyBXDDTO.getStartTime())
+            || Objects.isNull(unionApplyBXDDTO.getEndTime())
+            || StringUtils.isBlank(unionApplyBXDDTO.getCode())
+            || Objects.isNull(unionApplyBXDDTO.getUnionApplyBXDDDetailTOList())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        UnionApply unionApply = unionApplyJoinMapper.selectById(unionApplyBXDDTO.getId());
+        if(unionApply == null ||!Constants.equalsInteger(unionApply.getIsdeleted(),Constants.ZERO)){
+            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(unionApply.getStatus().equals(Constants.UnionApplyStatus.UPLOAD_INSURANCE_POLICY.getKey())){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ュ悎骞跺崟鐘舵�佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+        }
+        //鍔犱环鍙傛暟
+        List<UnionApplyBXDDDetailTO> unionApplyBXDDDetailTOList = unionApplyBXDDTO.getUnionApplyBXDDDetailTOList();
+
+        //鎵�鏈夋姇淇濈敵璇蜂繚鍗曟槑缁嗚
+        List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().select(ApplyDetail::getPrice)
+                .in(ApplyDetail::getUnionApplyId,unionApply.getId()));
+        //鎬诲ぉ鏁�
+        Integer maxDays = DateUtil.calculateBetween(unionApplyBXDDTO.getStartTime(),unionApplyBXDDTO.getEndTime(),0);
+        //瀹為檯宸茬粡浜х敓璐圭敤鐨勫ぉ鏁�
+        Integer useDays = 0 ;
+        if(unionApplyBXDDTO.getStartTime().compareTo(new Date()) <= 0 && unionApplyBXDDTO.getEndTime().compareTo(new Date()) >= 0 ){
+            //褰撳墠鏃ユ湡鍦ㄥ紑濮嬬粨鏉熸棩鏈熶箣鍐�
+            useDays =  DateUtil.calculateBetween(unionApplyBXDDTO.getStartTime(),new Date(),0);
+        }else if(unionApplyBXDDTO.getStartTime().compareTo(new Date()) <= 0&&unionApplyBXDDTO.getEndTime().compareTo(new Date()) <= 0){
+            //褰撳墠鏃ユ湡鍦ㄧ粨鏉熸棩鏈熶箣鍚�
+            useDays =  -1;
+        }
+
+        BigDecimal sumFee = BigDecimal.ZERO;
+        BigDecimal sumCurrFee = BigDecimal.ZERO;
+
+        for (UnionApplyBXDDDetailTO unionApplyBXDDDetailTO:unionApplyBXDDDetailTOList) {
+            InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectById(unionApplyBXDDDetailTO.getApplyId());
+            if(Objects.isNull(insuranceApply)||!Constants.equalsInteger(insuranceApply.getIsdeleted(),Constants.ZERO)){
+                throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+            }
+            if(!insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())){
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ姇淇濆崟鐘舵�佸凡娴佽浆锛屽綋鍓嶄笉鏀寔璇ユ搷浣渵");
+            }
+            List<ApplyDetail> applyDetails = applyDetailList.stream().filter(m->m.getApplyId().equals(unionApplyBXDDDetailTO.getApplyId())).collect(Collectors.toList());
+            if(CollectionUtils.isEmpty(applyDetails)){
+                throw  new BusinessException(ResponseStatus.DATA_EMPTY);
+            }
+            //鎻愪氦鍚庣殑鏂颁环鏍� 鍔犱笂鏈嶅姟璐�
+            BigDecimal price = applyDetails.get(Constants.ZERO).getPrice().add(unionApplyBXDDDetailTO.getServerMoney());
+            //瀹為檯宸蹭骇鐢熻垂鐢�
+            BigDecimal currentFee = BigDecimal.ZERO;
+            if(useDays==-1){
+                currentFee =  new BigDecimal(maxDays).multiply(price);
+            }else if(useDays>0){
+                currentFee =  new BigDecimal(useDays).multiply(price);
+            }
+            //涓婁紶淇濆崟淇℃伅
+            if(StringUtils.isNotBlank(unionApplyBXDDDetailTO.getFileUrl())){
+                Multifile multifile = new Multifile();
+                multifile.setIsdeleted(Constants.ZERO);
+                multifile.setCreator(user.getId());
+                multifile.setCreateDate(new Date());
+                multifile.setObjId(insuranceApply.getId());
+                multifile.setObjType(Constants.MultiFile.COMPANY_TBD_SIGNED_PDF.getKey());
+                multifile.setType(Constants.TWO);
+                multifile.setFileurl(unionApplyBXDDDetailTO.getFileUrl());
+                multifile.setName(unionApplyBXDDDetailTO.getFileName());
+                multifileMapper.insert(multifile);
+                insuranceApply.setUnionApplyTbdStatus(Constants.ONE);
+            }else{
+                insuranceApply.setUnionApplyTbdStatus(Constants.ZERO);
+            }
+            //鏇存柊鎶曚繚鐢宠鍗�
+            insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
+                    .set(InsuranceApply::getFee,
+                            new BigDecimal(applyDetails.size())
+                            .multiply(price)
+                    )
+                    .set(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                    .set(InsuranceApply::getFee,price.multiply(new BigDecimal(applyDetails.size())).multiply(new BigDecimal(maxDays)))
+                    .set(InsuranceApply::getCurrentFee,currentFee.multiply(new BigDecimal(applyDetails.size())))
+                    .set(InsuranceApply::getStartTime,unionApplyBXDDTO.getStartTime())
+                    .set(InsuranceApply::getEndTime,unionApplyBXDDTO.getEndTime())
+                    .set(InsuranceApply::getUnionApplyTbdStatus,insuranceApply.getUnionApplyTbdStatus())
+                    .set(InsuranceApply::getEditDate,new Date())
+                    .set(InsuranceApply::getEditor,user.getId())
+                    .eq(InsuranceApply::getId,insuranceApply.getId()));
+            //鏇存柊鎶曚繚鍗曟槑缁嗛噾棰�
+            applyDetailJoinMapper.update(null,new UpdateWrapper<ApplyDetail>().lambda()
+                    .set(ApplyDetail::getPrice,price)
+                    .set(ApplyDetail::getFee, price.multiply(new BigDecimal(maxDays)))
+                    .set(ApplyDetail::getCurrentFee,currentFee)
+                    .set(ApplyDetail::getEditDate,new Date())
+                    .set(ApplyDetail::getEditor,user.getId())
+                    .set(ApplyDetail::getStartTime,unionApplyBXDDTO.getStartTime())
+                    .set(ApplyDetail::getEndTime,unionApplyBXDDTO.getEndTime())
+                    .in(ApplyDetail::getId,applyDetails.stream().map(m->m.getId()).collect(Collectors.toList()))
+            );
+
+            sumFee = sumFee.add(price.multiply(new BigDecimal(applyDetails.size())).multiply(new BigDecimal(maxDays)));
+            sumCurrFee = sumCurrFee.add(currentFee.multiply(new BigDecimal(applyDetails.size())));
+        }
+        unionApplyMapper.update(null,new UpdateWrapper<UnionApply>()
+                .lambda()
+                .set(UnionApply::getStatus,Constants.UnionApplyStatus.FINISH)
+                .set(UnionApply::getEditDate,new Date())
+                .set(UnionApply::getEditor,user.getId())
+                .set(UnionApply::getStartTime,unionApplyBXDDTO.getStartTime())
+                .set(UnionApply::getEndTime,unionApplyBXDDTO.getEndTime())
+                .set(UnionApply::getFee,sumFee)
+                .set(UnionApply::getCurrentFee,sumCurrFee)
+                .eq(UnionApply::getId,unionApply.getId())
+        );
+        //鍚堝苟鍗� 鎬讳繚鍗�
+        if(StringUtils.isNotBlank(unionApplyBXDDTO.getFileUrl())){
+            Multifile multifile = new Multifile();
+            multifile.setIsdeleted(Constants.ZERO);
+            multifile.setCreator(user.getId());
+            multifile.setCreateDate(new Date());
+            multifile.setObjId(unionApply.getId());
+            multifile.setObjType(Constants.MultiFile.HBD_BD_APPLY_PDF.getKey());
+            multifile.setType(Constants.TWO);
+            multifile.setFileurl(unionApplyBXDDTO.getFileUrl());
+            multifile.setName(unionApplyBXDDTO.getFileName());
+            multifileMapper.insert(multifile);
+        }
+
+
+
+
+    }
+
+
+
+
+
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
index 56819cd..ade3466 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -1,20 +1,44 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
+import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.UnionChangeMapper;
-import com.doumee.dao.business.model.UnionChange;
+import com.doumee.dao.business.*;
+import com.doumee.dao.business.dto.SaveUnionApplyDTO;
+import com.doumee.dao.business.dto.SaveUnionChangeDTO;
+import com.doumee.dao.business.dto.UnionChangeBXDDTO;
+import com.doumee.dao.business.join.ApplyChagneDetailJoinMapper;
+import com.doumee.dao.business.join.ApplyChangeJoinMapper;
+import com.doumee.dao.business.join.ApplyDetailJoinMapper;
+import com.doumee.dao.business.join.MemberInsuranceJoinMapper;
+import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.vo.CountCyclePriceVO;
 import com.doumee.service.business.UnionChangeService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 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.doumee.service.business.third.SignService;
+import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * 鍔犲噺淇濇崲鍘傚悎骞跺崟淇℃伅琛⊿ervice瀹炵幇
@@ -26,6 +50,36 @@
 
     @Autowired
     private UnionChangeMapper unionChangeMapper;
+
+    @Autowired
+    private ApplyChangeJoinMapper applyChangeJoinMapper;
+
+    @Autowired
+    private ApplyChagneDetailJoinMapper applyChagneDetailJoinMapper;
+
+    @Autowired
+    private CompanyMapper companyMapper;
+
+    @Autowired
+    private SolutionsMapper solutionsMapper;
+
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
+
+    @Autowired
+    private SignService signService;
+
+    @Autowired
+    private MemberMapper memberMapper;
+
+    @Autowired
+    private ApplyDetailJoinMapper applyDetailJoinMapper;
+
+    @Autowired
+    private MemberInsuranceJoinMapper memberInsuranceJoinMapper;
+
+    @Autowired
+    private InsuranceApplyMapper insuranceApplyMapper;
 
     @Override
     public Integer create(UnionChange unionChange) {
@@ -156,4 +210,518 @@
         QueryWrapper<UnionChange> wrapper = new QueryWrapper<>(unionChange);
         return unionChangeMapper.selectCount(wrapper);
     }
+
+
+
+    @Override
+    public Integer merge(SaveUnionChangeDTO saveUnionChangeDTO){
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(user.getType().equals(Constants.TWO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣�");
+        }
+        if(Objects.isNull(saveUnionChangeDTO)
+                || Objects.isNull(saveUnionChangeDTO.getApplyIds())
+                || Objects.isNull(saveUnionChangeDTO.getApplyDate())
+                || Objects.isNull(saveUnionChangeDTO.getUnionApplyId())
+                || Objects.isNull(saveUnionChangeDTO.getBusinessType())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,
+                new MPJLambdaWrapper<ApplyChange>()
+                        .selectAll(ApplyChange.class)
+                        .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
+                        .eq(ApplyChange::getIsdeleted, Constants.ZERO)
+                        .eq(InsuranceApply::getUnionApplyId,saveUnionChangeDTO.getUnionApplyId())
+                        .eq(ApplyChange::getStatus,Constants.ApplyChangeStatus.COMPANY_SIGN.getKey())
+                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                        .eq(ApplyChange::getType,saveUnionChangeDTO.getBusinessType())
+                        .in(ApplyChange::getId,saveUnionChangeDTO.getApplyIds())
+                        .isNull(ApplyChange::getUnionChangeId)
+        );
+        //鏌ヨ鏁版嵁鏄惁瀛樺湪鏈浜庡鎵归�氳繃鐨勬暟鎹�
+        if(applyChangeList.size()!=saveUnionChangeDTO.getApplyIds().size()){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏁版嵁宸插鐞嗭紝璇峰埛鏂伴噸璇�");
+        }
+
+        UnionChange unionChange = new UnionChange();
+        unionChange.setCreateDate(new Date());
+        unionChange.setCreator(user.getId());
+        unionChange.setShopId(user.getCompanyId());
+        unionChange.setUnionApplyId(saveUnionChangeDTO.getUnionApplyId());
+        unionChange.setApplyStartTime(saveUnionChangeDTO.getApplyDate());
+        unionChange.setType(saveUnionChangeDTO.getBusinessType());
+        unionChange.setStatus(Constants.UnionChangeStatus.MERGE.getKey());
+        unionChangeMapper.insert(unionChange);
+
+        applyChangeJoinMapper.update(null,new UpdateWrapper<ApplyChange>().lambda()
+                .set(ApplyChange::getUnionChangeId,unionChange.getId())
+                .set(ApplyChange::getCheckDate,new Date())
+                .set(ApplyChange::getCheckUserId,user.getId())
+                .in(ApplyChange::getId,saveUnionChangeDTO.getApplyIds())
+        );
+
+        applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
+                .set(ApplyChagneDetail::getUnionChangeId,unionChange.getId())
+                .in(ApplyChagneDetail::getApplyId,saveUnionChangeDTO.getApplyIds()));
+        return unionChange.getId();
+    }
+
+
+
+
+
+
+    /**
+     * 鍙栨秷淇濆崟鍚堝苟
+     * @param id
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public void cancelMerge(Integer id){
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(user.getType().equals(Constants.TWO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炲晢鎴风敤鎴凤紝鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        UnionChange unionChange = unionChangeMapper.selectById(id);
+        if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!unionChange.getShopId().equals(user.getCompanyId())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.FINISH.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡瀹岀粨锛屾偍鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.CLOSE.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡鍏抽棴");
+        }
+
+        applyChangeJoinMapper.update(null,new UpdateWrapper<ApplyChange>().lambda()
+                .set(ApplyChange::getUnionChangeId,null)
+                .set(ApplyChange::getCheckDate,new Date())
+                .set(ApplyChange::getCheckUserId,user.getId())
+                .in(ApplyChange::getUnionChangeId,unionChange.getId())
+        );
+
+        applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
+                .set(ApplyChagneDetail::getUnionChangeId,null)
+                .in(ApplyChagneDetail::getApplyId,unionChange.getId()));
+
+        unionChangeMapper.update(null,new UpdateWrapper<UnionChange>().lambda()
+                .set(UnionChange::getStatus,Constants.UnionApplyStatus.CLOSE.getKey())
+                .eq(UnionChange::getId,unionChange.getId())
+        );
+    }
+
+
+    /**
+     * 鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛� - 鎶曚繚鐢宠绛剧讲
+     * @param id
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public  String getSignLink(Integer id) {
+        if(id == null ){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        UnionChange unionChange = unionChangeMapper.selectById(id);
+        if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!unionChange.getShopId().equals(user.getCompanyId())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.FINISH.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡瀹岀粨锛屾偍鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.CLOSE.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡鍏抽棴");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.MERGE.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曠姸鎬佸凡娴佽浆");
+        }
+        Company company =  companyMapper.selectById(user.getCompanyId());
+        if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.THREE)){
+            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝浼佷笟灏氭湭鍏峰鍦ㄧ嚎绛剧珷鏉′欢锛岃鑱旂郴骞冲彴绠$悊鍛樼‘璁");
+        }
+
+        String fileUrl = null;
+        if(Constants.equalsObject(unionChange.getType(), Constants.ONE)){
+//            fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"鎹㈠巶鐢宠琛�","琚繚闄╀汉");
+        }else{
+//            fileUrl = ExcelExporter.build(ApplyChange.class).exportJiajianBaoExcelToPdf(model,"鍔犲噺淇濈敵璇疯〃","琚繚闄╀汉");
+        }
+
+        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
+        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",unionChange.getId().toString());
+        String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"鍚堝苟鍗曪紙鍔犲噺淇�/鎹㈠巶锛夌敵璇风缃�",company.getSignId(),notifyUrl);
+        if(StringUtils.isBlank(applyNo) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+        String link = signService.signLink(applyNo,company.getName(),company.getCode());
+        if(StringUtils.isBlank(link) ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�");
+        }
+
+        UnionChange update= new UnionChange();
+        update.setId(unionChange.getId());
+        update.setEditor(user.getId());
+        update.setEditDate(new Date());
+        update.setSignApplyNo(applyNo);
+        unionChangeMapper.updateById(update);
+        return  link;
+    }
+
+
+
+    @Override
+    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+    public void uploadBXD(UnionChangeBXDDTO unionChangeBXDDTO){
+        if(Objects.isNull(unionChangeBXDDTO)
+            || Objects.isNull(unionChangeBXDDTO.getId())
+                || Objects.isNull(unionChangeBXDDTO.getApplyDate())
+                || StringUtils.isBlank(unionChangeBXDDTO.getFileName())
+                || StringUtils.isBlank(unionChangeBXDDTO.getFileUrl())
+                || StringUtils.isBlank(unionChangeBXDDTO.getCode())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        UnionChange unionChange = unionChangeMapper.selectById(unionChangeBXDDTO.getId());
+        if(Objects.isNull(unionChange)||!Constants.equalsInteger(unionChange.getIsdeleted(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!unionChange.getShopId().equals(user.getCompanyId())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧烽潪鎮ㄧ殑鍚堝苟鍗曪紝鎮ㄦ棤娉曡繘琛屾搷浣滐紒");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.FINISH.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡瀹岀粨锛屾偍鏃犳硶杩涜璇ユ搷浣滐紒");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.CLOSE.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曚笟鍔″凡鍏抽棴");
+        }
+        if(unionChange.getStatus().equals(Constants.UnionChangeStatus.UPLOAD_INSURANCE_POLICY.getKey())){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"瀵逛笉璧凤紝鍚堝苟鍗曠姸鎬佸凡娴佽浆");
+        }
+
+        List<ApplyChange> applyChangeList = applyChangeJoinMapper.selectJoinList(ApplyChange.class,
+                new MPJLambdaWrapper<ApplyChange>()
+                        .selectAll(ApplyChange.class)
+                        .selectAs(InsuranceApply::getSolutionId,ApplyChange::getSolutionsId)
+                        .selectAs(InsuranceApply::getCode,ApplyChange::getApplyCode)
+                        .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyChange::getApplyId)
+                        .eq(ApplyChange::getUnionChangeId,unionChange.getId()));
+        if(CollectionUtils.isNotEmpty(applyChangeList)){
+            for (ApplyChange applyChange:applyChangeList) {
+                applyChange.setApplyStartTime(unionChangeBXDDTO.getApplyDate());
+                applyChange.setValidTime(unionChangeBXDDTO.getApplyDate());
+                applyChange.setEditDate(new Date());
+                applyChange.setEditor(user.getId());
+                List<ApplyChagneDetail> allList = applyChagneDetailJoinMapper.selectList(new QueryWrapper<ApplyChagneDetail>().lambda().eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId()));
+                this.dealApplyChangeDetail(applyChange,allList);
+            }
+        }
+        unionChangeMapper.update(null,new UpdateWrapper<UnionChange>().lambda()
+                .set(UnionChange::getStatus,Constants.UnionChangeStatus.FINISH.getKey())
+                .set(UnionChange::getEditDate,new Date())
+                .set(UnionChange::getEditor,user.getId())
+                .eq(UnionChange::getId,unionChangeBXDDTO.getId())
+        );
+    }
+
+
+
+
+    public void dealApplyChangeDetail(ApplyChange applyChange,List<ApplyChagneDetail> applyChagneDetailList){
+
+        BigDecimal totalFee = BigDecimal.ZERO;
+        BigDecimal currentFee = BigDecimal.ZERO;
+        //鏌ヨ鏈�鍚庤褰� 鑾峰彇瀵瑰簲鍗曚环
+        ApplyDetail applyDetail = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,applyChange.getApplyId()).last(" limit 1 "));
+        if(Objects.isNull(applyDetail)){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌淇濆崟鏄庣粏鏁版嵁");
+        }
+        //鑾峰彇鍗曚环
+        BigDecimal price = applyDetail.getPrice();
+        for (ApplyChagneDetail detail:applyChagneDetailList) {
+            Member member = memberMapper.selectById(detail.getMemberId());
+            if(Objects.isNull(member)){
+                throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌鍛樺伐鏁版嵁");
+            }
+            if (Constants.equalsInteger(detail.getType(), Constants.ZERO)) {
+               this.addChangeDetailData(applyChange,detail,price,currentFee,totalFee);
+            }else if(Constants.equalsInteger(detail.getType(),Constants.ONE)){
+                this.reduceChangeDetailData(applyChange,detail,applyDetail,price,currentFee,totalFee);
+            }else{
+                this.otherChangeDetailData(applyChange,detail,applyDetail,price);
+            }
+        }
+
+        if (totalFee.compareTo(new BigDecimal(0)) != 0) {
+            //濡傛灉淇濆崟閲戦鍙戠敓缂栫爜锛屾洿鏂版�讳繚鍗曢噾棰�
+            insuranceApplyMapper.update(null, new UpdateWrapper<InsuranceApply>().lambda()
+                    .setSql(" fee = ifnull(fee,0)+" + totalFee)
+                    .setSql(" current_fee = ifnull(current_fee,0)+" + currentFee)
+                    .set(InsuranceApply::getEditor, applyChange.getEditor())
+                    .set(InsuranceApply::getEditDate, applyChange.getEditDate())
+                    .eq(InsuranceApply::getId, applyChange.getApplyId())
+            );
+            applyChangeJoinMapper.update(null, new UpdateWrapper<ApplyChange>().lambda()
+                    .set(ApplyChange::getFee,totalFee)
+                    .set(ApplyChange::getEditor, applyChange.getEditor())
+                    .set(ApplyChange::getEditDate, applyChange.getEditDate())
+                    .eq(ApplyChange::getId, applyChange.getApplyId())
+            );
+        }
+
+    }
+
+
+    /**
+     * 鍔犱繚鏁版嵁澶勭悊
+     * @param applyChange
+     * @param detail
+     * @param price
+     * @param currentFee
+     * @param totalFee
+     */
+    public void addChangeDetailData(ApplyChange applyChange,ApplyChagneDetail detail
+            ,BigDecimal price,BigDecimal currentFee,BigDecimal totalFee){
+        //鏌ヨ鍔犱繚浜哄憳鏄惁瀛樺湪 鍐茬獊鐨� 淇濆崟鏄庣粏鏁版嵁
+        if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>()
+                .lambda()
+                .eq(ApplyDetail::getApplyId,applyChange.getApplyId())
+                .eq(ApplyDetail::getIdcardNo,detail.getIdcardNo())
+                .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(),1))
+                .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(detail.getEndTime(),2))
+        )>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠淇濆崟涓嬶紝鍔犱繚浜哄憳銆�" + detail.getMemberName() + "銆戝瓨鍦ㄦ棩鏈熷啿绐佺殑鏁版嵁");
+        }
+        //鎬诲ぉ鏁�
+        Integer countDays = DateUtil.daysBetweenDates(DateUtil.getMontageDate(detail.getEndTime(), 2), applyChange.getApplyStartTime());
+        //鍔犱繚
+        ApplyDetail add = new ApplyDetail();
+        if(new Date().compareTo(DateUtil.getMontageDate(applyChange.getApplyStartTime(), 2))>=0){
+            Integer days = DateUtil.daysBetweenDates(DateUtil.getMontageDate(new Date(), 2), applyChange.getApplyStartTime()) + 1;
+            //濡傛灉宸插凡浜х敓璐圭敤锛岃绠楀凡宸蹭骇鐢熻垂鐢�
+            add.setCurrentFee(new BigDecimal(days).multiply(price));
+        }else{
+            add.setCurrentFee(BigDecimal.ZERO);
+        }
+        add.setApplyId(applyChange.getApplyId());
+        add.setValidCode(applyChange.getValidCode());
+        add.setFee(detail.getFee());
+        add.setIsdeleted(Constants.ZERO);
+        add.setCreator(applyChange.getEditor());
+        add.setCreateDate(applyChange.getEditDate());
+        add.setMemberId(detail.getMemberId());
+        add.setMemberName(detail.getMemberName());
+        add.setWorktypeId(detail.getWorktypeId());
+        add.setIsdeleted(Constants.ZERO);
+        add.setIdcardNo(detail.getIdcardNo());
+        add.setSex(Constants.getSexByIdCard(detail.getIdcardNo()));
+        add.setMemberName(detail.getMemberName());
+        add.setDuId(detail.getDuId());
+        add.setStartTime(applyChange.getApplyStartTime());
+        add.setStartTime(DateUtil.getMontageDate(applyChange.getApplyStartTime(), 1));
+        add.setEndTime(DateUtil.getMontageDate(detail.getEndTime(), 2));
+        add.setFee(new BigDecimal(countDays).multiply(price));
+        applyDetailJoinMapper.insert(add);
+
+        detail.setFee(add.getFee());
+        applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
+                .set(ApplyChagneDetail::getFee,add.getFee())
+                .set(ApplyChagneDetail::getStartTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(), 1))
+                .eq(ApplyChagneDetail::getId,detail.getId())
+        );
+
+        totalFee = totalFee.add(add.getFee());
+        currentFee = currentFee.add(add.getCurrentFee());
+
+        MemberInsurance memberInsurance = new MemberInsurance(detail, applyChange, applyChange.getEditor(), add.getId(),applyChange.getSolutionsId());
+        memberInsurance.setStartTime(add.getStartTime());
+        memberInsurance.setEndTime(add.getEndTime());
+        memberInsurance.setRelationType(Constants.ONE);
+        memberInsuranceJoinMapper.insert(memberInsurance);
+    }
+
+    /**
+     * 鍑忎繚鏁版嵁澶勭悊
+     * @param applyChange
+     * @param detail
+     * @param applyDetail
+     * @param price
+     * @param currentFee
+     * @param totalFee
+     */
+    public void reduceChangeDetailData(ApplyChange applyChange,ApplyChagneDetail detail,ApplyDetail applyDetail
+            ,BigDecimal price,BigDecimal currentFee,BigDecimal totalFee){
+        //鏌ヨ鍛樺伐鏄湪涓诲崟涓� 鏄惁瀛樺湪鐢熸晥涓殑鏁版嵁
+        ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda()
+                .eq(ApplyDetail::getApplyId, applyChange.getApplyId())
+                .eq(ApplyDetail::getMemberId, detail.getMemberId())
+                .orderByDesc(ApplyDetail::getCreateDate)
+                .last("limit 1"));
+        if (oldModel == null || oldModel.getStartTime() == null || oldModel.getStartTime().getTime() > applyChange.getApplyStartTime().getTime()) {
+            throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝鐢ㄦ埛銆�" + detail.getMemberName() + "銆戝師淇濆崟淇℃伅鏈夎锛屽綋鍓嶇敵璇蜂笉鏀寔鍑忎繚澶勭悊锛�");
+        }
+        //璁$畻宸茬敓鏁堝ぉ鏁�
+        //褰撳鎵规椂闂� 灏忎簬 褰撳墠鏃堕棿 璁$畻瀹為檯鍑忓皯閲戦 鍥犱负宸叉墸閲戦浼氬ぇ浜� 搴旀墸閲戦
+        BigDecimal pullFee = BigDecimal.ZERO;
+        //鍑忎繚鍑忓皯鐨勯噾棰�
+        BigDecimal reduceFee = BigDecimal.ZERO;
+        if (DateUtil.daysBetweenDates(DateUtil.getMontageDate(new Date(), 2),applyChange.getApplyStartTime()) > 0) {
+            //璁$畻澶氭墸閲戦
+            Integer days = DateUtil.daysBetweenDates(DateUtil.getMontageDate(new Date(), 2), applyChange.getApplyStartTime()) + 1;
+            pullFee = new BigDecimal(days).multiply(price).multiply(new BigDecimal(-1));
+        }
+        //璁$畻鎶曚繚鏄庣粏搴斿噺灏戠殑澶╂暟
+        Integer reduceDays = DateUtil.daysBetweenDates(DateUtil.getMontageDate(applyDetail.getEndTime(), 2), applyChange.getApplyStartTime()) + 1;
+        if(reduceDays>0){
+            reduceFee = new BigDecimal(reduceDays).multiply(price).multiply(new BigDecimal(-1));
+        }
+        applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
+                .setSql(" fee = ifnull(fee,0)+" + reduceFee)
+                .setSql(" current_fee = ifnull(current_fee,0)+" + pullFee)
+                .set(oldModel.getStartTime().compareTo(applyChange.getApplyStartTime())!=0,ApplyDetail::getEndTime, DateUtil.getMontageDate(applyChange.getApplyStartTime(), 3))
+                .set(oldModel.getStartTime().compareTo(applyChange.getApplyStartTime())==0,ApplyDetail::getEndTime, DateUtil.getMontageDate(applyChange.getApplyStartTime(), 2))
+                .set(ApplyDetail::getEditor, applyChange.getEditor())
+                .set(ApplyDetail::getEditDate, applyChange.getEditDate())
+                .eq(ApplyDetail::getId, oldModel.getId())
+        );
+        totalFee = totalFee.add(reduceFee);
+        currentFee = currentFee.add(pullFee);
+
+        //淇敼 鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
+        memberInsuranceJoinMapper.update(null, new UpdateWrapper<MemberInsurance>().lambda()
+                .setSql(" fee = ifnull(fee,0)+" + reduceFee)
+                .set(oldModel.getStartTime().compareTo(applyChange.getApplyStartTime())!=0,MemberInsurance::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(), 3))
+                .set(oldModel.getStartTime().compareTo(applyChange.getApplyStartTime())==0,MemberInsurance::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(), 2))
+                .eq(MemberInsurance::getRelationId, oldModel.getId())
+        );
+
+        //淇敼涓氬姟鏄庣粏琛屾暟鎹疄闄呮壒鍗曟棩鏈�
+        applyChagneDetailJoinMapper.update(null,new UpdateWrapper<ApplyChagneDetail>().lambda()
+                .setSql(" fee = ifnull(fee,0)+" + reduceFee)
+                .set(ApplyChagneDetail::getEndTime,DateUtil.getMontageDate(applyChange.getApplyStartTime(), 3))
+                .eq(ApplyChagneDetail::getId,detail.getId())
+        );
+    }
+
+    public void otherChangeDetailData(ApplyChange applyChange,ApplyChagneDetail detail,ApplyDetail applyDetail,BigDecimal price){
+
+        //瀹為檯鎵瑰崟鐢熸晥鏃ユ湡
+        Date applyStartTime = DateUtil.getMontageDate(applyChange.getApplyStartTime(),1);
+
+        //鏌ヨ鍑忎繚浜哄憳鏄惁瀛樺湪 鍐茬獊鐨� 淇濆崟鏄庣粏鏁版嵁
+        if(applyDetailJoinMapper.selectCount(new QueryWrapper<ApplyDetail>()
+                .lambda()
+                .eq(ApplyDetail::getApplyId,applyChange.getApplyId())
+                .eq(ApplyDetail::getIdcardNo,detail.getIdcardNo())
+                .le(ApplyDetail::getStartTime,applyStartTime)
+                .ge(ApplyDetail::getEndTime,applyStartTime)
+        )<=Constants.ZERO){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "褰撳墠淇濆崟涓嬶紝鎹㈠巶浜哄憳銆�" + detail.getMemberName() + "銆戞湭鏌ヨ鍒扮鍚堟壒鍗曟棩鏈熺殑鏁版嵁");
+        }
+
+        //鏌ヨ鍛樺伐鏄湪涓诲崟涓� 鏄惁瀛樺湪鐢熸晥涓殑鏁版嵁
+        ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda()
+                .eq(ApplyDetail::getApplyId, applyChange.getApplyId())
+                .eq(ApplyDetail::getMemberId, detail.getMemberId())
+                .le(ApplyDetail::getStartTime,applyStartTime)
+                .ge(ApplyDetail::getEndTime,applyStartTime)
+                .orderByDesc(ApplyDetail::getCreateDate)
+                .last("limit 1"));
+        if(oldModel == null  ){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"瀵逛笉璧凤紝鐢ㄦ埛銆�"+detail.getMemberName()+"銆戝師淇濆崟淇℃伅鏈夎锛屾壒鍗曟棩鏈熸湭鍦ㄤ繚鍗曟棩鏈熷唴锛�");
+        }
+        //濡傛灉瀹為檯鎵瑰崟鏃ユ湡 鍜� 鍘熻褰曟棩鏈熺浉绛� 鍒欑洿鎺ヤ慨鏀硅褰曟淳閬e崟浣嶄笌宸ョ淇℃伅
+        if(applyStartTime.compareTo(oldModel.getStartTime())!=Constants.ZERO){
+            //褰撳墠鏃ユ湡澶т簬鎵瑰崟鏃ユ湡 闇�瑕佸洖婊氭暟鎹疄闄呮暟鎹�
+            Boolean flag = DateUtil.getMontageDate(new Date(),2).compareTo(DateUtil.getMontageDate(applyStartTime,2))>0;
+            //鎹㈠巶鍚庡巻鍙茶褰曠殑璐圭敤 fee
+            Integer days = DateUtil.daysBetweenDates(DateUtil.getMontageDate(applyStartTime,3),DateUtil.getMontageDate(oldModel.getStartTime(),1))+1;
+            BigDecimal oldFee = new BigDecimal(days).multiply(price);
+            BigDecimal fee = oldModel.getFee();
+            BigDecimal oldCurrentFee = oldModel.getCurrentFee();
+
+            applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
+                    .set(ApplyDetail::getEditor,applyChange.getEditor())
+                    .set(ApplyDetail::getEditDate,applyChange.getEditDate())
+                    .set(ApplyDetail::getEndTime,DateUtil.getMontageDate(applyStartTime,3))
+                    .set(ApplyDetail::getFee,oldFee)
+                    .set(flag,ApplyDetail::getCurrentFee,oldFee)
+                    .eq(ApplyDetail::getId,oldModel.getId())
+            );
+
+            //淇敼 鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
+            memberInsuranceJoinMapper.update(null,new UpdateWrapper<MemberInsurance>().lambda()
+                    .set(MemberInsurance::getEndTime,applyStartTime)
+                    .set(MemberInsurance::getFee,oldFee)
+                    .eq(MemberInsurance::getRelationId,oldModel.getId())
+            );
+
+            ApplyDetail add = new ApplyDetail();
+            add.setApplyId(oldModel.getApplyId());
+            add.setCreateDate(new Date());
+            add.setCreator(applyChange.getEditor());
+            add.setMemberId(oldModel.getMemberId());
+            add.setIdcardNo(detail.getIdcardNo());
+            add.setSex(Constants.getSexByIdCard(detail.getIdcardNo()));
+            add.setMemberName(detail.getMemberName());
+            add.setStartTime(DateUtil.getMontageDate(applyStartTime,1));
+            add.setEndTime(oldModel.getEndTime());
+            add.setDuId(detail.getDuId());
+            add.setWorktypeId(detail.getWorktypeId());
+            add.setIdcardNo(oldModel.getIdcardNo());
+            add.setFee(fee.subtract(oldFee));
+            add.setIsdeleted(Constants.ZERO);
+            if(flag){
+                add.setCurrentFee(oldCurrentFee.multiply(oldFee));
+            }else{
+                add.setCurrentFee(BigDecimal.ZERO);
+            }
+            add.setSex(oldModel.getSex());
+            add.setMemberName(oldModel.getMemberName());
+            add.setFromId(detail.getId());
+            applyDetailJoinMapper.insert(add);
+
+            MemberInsurance memberInsurance = new MemberInsurance(applyDetail,applyChange.getId());
+            memberInsurance.setSolutionId(detail.getSolutionId());
+            memberInsurance.setWorktypeName(detail.getWorkTypeName());
+            memberInsurance.setDuName(detail.getDuName());
+            memberInsurance.setApplyChangeId(detail.getApplyChangeId());
+            memberInsurance.setSolutionName(detail.getSolutionsName());
+            memberInsurance.setPdCode(applyChange.getValidCode());
+            memberInsurance.setBdCode(applyChange.getApplyCode());
+            memberInsurance.setRelationType(Constants.ONE);
+            memberInsuranceJoinMapper.insert(memberInsurance);
+
+        }else{
+            applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda()
+                    .set(ApplyDetail::getEditor,applyChange.getEditor())
+                    .set(ApplyDetail::getEditDate,applyChange.getEditDate())
+                    .set(ApplyDetail::getDuId,detail.getDuId())
+                    .set(ApplyDetail::getWorktypeId,detail.getWorktypeId())
+                    .eq(ApplyDetail::getId,oldModel.getId())
+            );
+            //鍛樺伐鎶曚繚鏄庣粏璁板綍 鍘嗗彶鏁版嵁
+            memberInsuranceJoinMapper.update(null,new UpdateWrapper<MemberInsurance>().lambda()
+                    .set(MemberInsurance::getDuId,detail.getDuId())
+                    .set(MemberInsurance::getDuName,detail.getDuName())
+                    .set(MemberInsurance::getWorktypeId,detail.getWorktypeId())
+                    .set(MemberInsurance::getWorktypeName,detail.getWorkTypeName())
+                    .eq(MemberInsurance::getRelationId,oldModel.getId())
+            );
+
+        }
+
+
+
+
+    }
+
 }

--
Gitblit v1.9.3