From c9df4cfec262ca54af52715af60a1276c37d08c5 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 29 一月 2024 20:12:24 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/dao/business/model/Solutions.java                    |   10 
 server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java             |   11 
 server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java     |   15 +
 server/service/src/main/java/com/doumee/service/business/ApplyDetailService.java             |    1 
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java      |   40 ++
 server/company/src/main/java/com/doumee/api/business/MemberController.java                   |    2 
 server/service/src/main/java/com/doumee/dao/business/vo/CountCyclePriceVO.java               |   22 +
 server/service/src/main/java/com/doumee/biz/system/impl/SystemMenuBizImpl.java               |   35 ++
 server/company/src/main/java/com/doumee/api/business/SolutionsController.java                |    4 
 server/service/src/main/java/com/doumee/service/business/SolutionsService.java               |    2 
 server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java                   |   25 +
 server/service/src/main/java/com/doumee/core/utils/Constants.java                            |    5 
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |  215 ++++++++++++--
 server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java    |   39 ++
 server/service/src/main/java/com/doumee/dao/business/model/DispatchUnit.java                 |    4 
 server/company/src/main/java/com/doumee/api/business/InsuranceApplyController.java           |   15 +
 server/service/src/main/java/com/doumee/dao/business/join/DispatchUnitJoinMapper.java        |   13 
 server/company/src/main/java/com/doumee/api/business/ApplyDetailController.java              |    7 
 server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java          |    2 
 server/service/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java         |   12 
 server/service/src/main/java/com/doumee/core/utils/DateUtil.java                             |   79 +++++
 server/service/src/main/java/com/doumee/dao/business/model/DuWorktype.java                   |    5 
 server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java            |    4 
 server/service/src/main/java/com/doumee/dao/business/dto/DispatchUnitQueryDTO.java           |    2 
 server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java   |  168 +++++++++--
 server/service/src/main/java/com/doumee/dao/business/dto/CountCyclePriceDTO.java             |   25 +
 server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java               |   15 
 server/service/src/main/java/com/doumee/service/business/InsuranceApplyService.java          |    5 
 28 files changed, 673 insertions(+), 109 deletions(-)

diff --git a/server/company/src/main/java/com/doumee/api/business/ApplyDetailController.java b/server/company/src/main/java/com/doumee/api/business/ApplyDetailController.java
index 818feff..25331ba 100644
--- a/server/company/src/main/java/com/doumee/api/business/ApplyDetailController.java
+++ b/server/company/src/main/java/com/doumee/api/business/ApplyDetailController.java
@@ -75,6 +75,13 @@
         return ApiResponse.success(applyDetailService.findPageForCompany(pageWrap));
     }
 
+    @ApiOperation("鍒楄〃鏌ヨ")
+    @PostMapping("/findList")
+    @RequiresPermissions("business:applydetail:query")
+    public ApiResponse<List<ApplyDetail>> findList (@RequestBody ApplyDetailPageDTO applyDetailPageDTO) {
+        return ApiResponse.success(applyDetailService.findListForCompany(applyDetailPageDTO));
+    }
+
     @ApiOperation("瀵煎嚭鍦ㄤ繚浜哄憳璇﹀崟Excel")
     @PostMapping("/exportExcel")
     @RequiresPermissions("business:applydetail:exportExcel")
diff --git a/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java b/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
index 24ece38..201fd18 100644
--- a/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
+++ b/server/company/src/main/java/com/doumee/api/business/DispatchUnitController.java
@@ -4,6 +4,7 @@
 import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.annotation.pr.PreventRepeat;
 import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
 import com.doumee.dao.business.dto.DispatchUnitQueryDTO;
@@ -12,7 +13,8 @@
 import com.doumee.service.business.DispatchUnitService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;    
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
@@ -91,6 +93,8 @@
     @PostMapping("/page")
     @RequiresPermissions("business:dispatchunit:query")
     public ApiResponse<PageData<DispatchUnit>> findPage (@RequestBody PageWrap<DispatchUnit> pageWrap) {
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        pageWrap.getModel().setCompanyId(user.getCompanyId());
         return ApiResponse.success(dispatchUnitService.findPage(pageWrap));
     }
 
@@ -98,13 +102,16 @@
     @PostMapping("/exportExcel")
     @RequiresPermissions("business:dispatchunit:exportExcel")
     public void exportExcel (@RequestBody PageWrap<DispatchUnit> pageWrap, HttpServletResponse response) {
+
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        pageWrap.getModel().setCompanyId(user.getCompanyId());
         ExcelExporter.build(DispatchUnit.class).export(dispatchUnitService.findPage(pageWrap).getRecords(), "娲鹃仯鍗曚綅淇℃伅琛�", response);
     }
 
     @ApiOperation("鏍规嵁ID鏌ヨ")
     @GetMapping("/{id}")
     @RequiresPermissions("business:dispatchunit:query")
-    public ApiResponse findById(@PathVariable Integer id) {
+    public ApiResponse<DispatchUnit> findById(@PathVariable Integer id) {
         return ApiResponse.success(dispatchUnitService.detailById(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 c261b54..88dc869 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
@@ -6,9 +6,11 @@
 import com.doumee.core.model.ApiResponse;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
+import com.doumee.dao.business.dto.CountCyclePriceDTO;
 import com.doumee.dao.business.dto.InsuranceApplyOptDTO;
 import com.doumee.dao.business.dto.InsuranceApplyQueryDTO;
 import com.doumee.dao.business.model.InsuranceApply;
+import com.doumee.dao.business.vo.CountCyclePriceVO;
 import com.doumee.service.business.InsuranceApplyService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -39,6 +41,14 @@
     @RequiresPermissions("business:insuranceapply:create")
     public ApiResponse create(@RequestBody InsuranceApply insuranceApply) {
         return ApiResponse.success(insuranceApplyService.create(insuranceApply));
+    }
+
+    @PreventRepeat
+    @ApiOperation("淇敼")
+    @PostMapping("/updateData")
+    @RequiresPermissions("business:insuranceapply:create")
+    public ApiResponse updateData(@RequestBody InsuranceApply insuranceApply) {
+        return ApiResponse.success(insuranceApplyService.updateData(insuranceApply));
     }
 
     @ApiOperation("鏍规嵁ID鍒犻櫎")
@@ -118,5 +128,10 @@
     }
 
 
+    @ApiOperation("鑾峰彇淇濆崟姝㈡湡涓庡垵濮嬮噾棰�")
+    @PostMapping("/getCountCyclePriceVO")
+    public ApiResponse<CountCyclePriceVO> getCountCyclePriceVO (@RequestBody CountCyclePriceDTO countCyclePriceDTO) {
+        return ApiResponse.success("鎿嶄綔鎴愬姛",insuranceApplyService.getCountCyclePriceVO(countCyclePriceDTO));
+    }
 
 }
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 105bf42..b49c83e 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
@@ -114,7 +114,7 @@
     }
 
 
-    @ApiOperation("瀵煎叆妯℃澘")
+    @ApiOperation(value = "浜哄憳淇℃伅瀵煎叆" ,notes = "淇濆崟鐢宠")
     @PostMapping("/importExcel")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class),
diff --git a/server/company/src/main/java/com/doumee/api/business/SolutionsController.java b/server/company/src/main/java/com/doumee/api/business/SolutionsController.java
index 3f29c37..7e4c700 100644
--- a/server/company/src/main/java/com/doumee/api/business/SolutionsController.java
+++ b/server/company/src/main/java/com/doumee/api/business/SolutionsController.java
@@ -77,8 +77,8 @@
     @ApiOperation("鍒楄〃鏌ヨ")
     @PostMapping("/list")
     @RequiresPermissions("business:solutions:query")
-    public ApiResponse<List<Solutions>> findList (@RequestBody Solutions solutions) {
-        return ApiResponse.success(solutionsService.findList(solutions));
+    public ApiResponse<List<Solutions>> findList () {
+        return ApiResponse.success(solutionsService.findListForCompany());
     }
 
 //    @ApiOperation("鍒楄〃鏌ヨ")
diff --git a/server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java b/server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java
index cb00156..fd216af 100644
--- a/server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java
+++ b/server/platform/src/main/java/com/doumee/api/business/DispatchUnitController.java
@@ -4,6 +4,7 @@
 import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.annotation.pr.PreventRepeat;
 import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.model.PageData;
 import com.doumee.dao.business.dto.SaveDispatchUnitDTO;
@@ -11,7 +12,8 @@
 import com.doumee.service.business.DispatchUnitService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;    
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
diff --git a/server/service/src/main/java/com/doumee/biz/system/impl/SystemMenuBizImpl.java b/server/service/src/main/java/com/doumee/biz/system/impl/SystemMenuBizImpl.java
index 0d96c2f..1c971a7 100644
--- a/server/service/src/main/java/com/doumee/biz/system/impl/SystemMenuBizImpl.java
+++ b/server/service/src/main/java/com/doumee/biz/system/impl/SystemMenuBizImpl.java
@@ -3,11 +3,19 @@
 import com.doumee.biz.system.SystemMenuBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
+import com.doumee.core.model.LoginUserInfo;
+import com.doumee.core.utils.Constants;
+import com.doumee.dao.business.CompanyMapper;
+import com.doumee.dao.business.model.Company;
 import com.doumee.dao.system.dto.UpdateSystemMenuSortDTO;
 import com.doumee.dao.system.model.SystemMenu;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.dao.system.vo.SystemMenuListVO;
 import com.doumee.dao.system.vo.SystemMenuNodeVO;
+import com.doumee.service.business.CompanyService;
 import com.doumee.service.system.SystemMenuService;
+import com.doumee.service.system.SystemUserService;
+import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -16,12 +24,19 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 @Service
 public class SystemMenuBizImpl implements SystemMenuBiz {
 
     @Autowired
     private SystemMenuService systemMenuService;
+
+    @Autowired
+    private CompanyService companyService;
+
+    @Autowired
+    private SystemUserService systemUserService;
 
     @Override
     public Integer create(SystemMenu systemMenu) {
@@ -115,8 +130,26 @@
     public List<SystemMenuNodeVO> findTree (Integer userId,Integer type) {
         SystemMenu queryDto = new SystemMenu();
         queryDto.setDeleted(Boolean.FALSE);
-        List<SystemMenu> menus = systemMenuService.findByUserId(userId,type);
+        List<SystemMenu> menus = new ArrayList<SystemMenu>();
         List<SystemMenuNodeVO> rootNodes = new ArrayList<>();
+        menus = systemMenuService.findByUserId(userId,type);
+        if(type.equals(Constants.ONE)){
+            LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+            Company company = companyService.findById(loginUserInfo.getCompanyId());
+            if(Objects.isNull(company)){
+                return rootNodes;
+            }
+            SystemUser systemUser = systemUserService.findById(userId);
+            if(Objects.isNull(systemUser)){
+                return rootNodes;
+            }
+            if(company.getUsername().equals(systemUser.getUsername())){
+                SystemMenu systemMenu = new SystemMenu();
+                systemMenu.setType(type);
+                systemMenu.setDeleted(Boolean.FALSE);
+                menus = systemMenuService.findList(systemMenu);
+            }
+        }
         // 娣诲姞鏍硅彍鍗�
         for (SystemMenu menu : menus) {
             if (menu.getParentId() == null) {
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 2b41ebe..b2a5e09 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
@@ -79,6 +79,7 @@
     public static final String TAXES_FILE = "TAXES_FILE";
     public static final String APPLY_FILE ="APPLY_FILE" ;
     public static final String SETTLE_FILE ="SETTLE_FILE" ;
+    public static final String DU_FILE ="DU_FILE" ;
     public static final String SIGN_DONE_NOTIFY_URL = "SIGN_DONE_NOTIFY_URL";
 
     /**
@@ -166,8 +167,7 @@
         Integer sex = 1;
         if (matcher.matches()) {
             int genderCode = Integer.parseInt(idCard.substring(16, 17)); // 浠庣17浣嶅紑濮嬫彁鍙栨�у埆缂栫爜锛堝鏁颁负鐢锋�э紝鍋舵暟涓哄コ鎬э級
-
-            if ((genderCode % 2 == 1)) {
+            if ((genderCode % 2 == 1) ) {
                 sex = 1;
             } else {
                 sex = 2;
@@ -900,6 +900,7 @@
         }
         return solutions.getPrice().multiply(new BigDecimal(cycle));
     }
+
     public static BigDecimal countDetailFee(int timeUnit ,BigDecimal price,Date startDate, Date endDate){
         //鏌ヨ淇濋櫓瀹為檯鍛ㄦ湡
         Integer cycle = DateUtil.calculateBetween(endDate,startDate,timeUnit);
diff --git a/server/service/src/main/java/com/doumee/core/utils/DateUtil.java b/server/service/src/main/java/com/doumee/core/utils/DateUtil.java
index 0c1a728..45bdcc0 100644
--- a/server/service/src/main/java/com/doumee/core/utils/DateUtil.java
+++ b/server/service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -1298,9 +1298,16 @@
         calo.setTime(oldDate);
         caln.setTime(newDate);
         if(type==0||type==1){
-            return    calculateDaysBetweenDates(caln, calo) + 1;
+            return    calculateDaysBetweenDates(caln, calo) ;
         }else if(type==2){
-            return    calculateMonthsBetweenDates(caln, calo) + 1;
+
+            int day = caln.get(Calendar.DATE);
+            if(day == 1){
+                return    calculateMonthsBetweenDates(caln, calo) + 1;
+            }else{
+                return    calculateMonthsBetweenDates(caln, calo);
+            }
+
         }else if(type==3){
             return    calculateYearsBetweenDates(caln, calo) + 1;
         }
@@ -2794,13 +2801,6 @@
         return sdfLongTimePlus.parse(sdfLongTimePlus.format(date));
     }
 
-    public static void main(String[] args) {
-        try {
-            System.out.println(RandomStringUtils.randomNumeric(3));
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-    }
 
     /**
      *
@@ -2904,6 +2904,7 @@
         String nowDateString = dateTypeToString(new Date(), fFormatStr);
         return nowDateString;
     }
+
 
     /**
      * @ author zhangyong @ 鑾峰彇褰撴湀鐨勭涓�澶╋紝2009-05-01
@@ -3056,4 +3057,64 @@
         cal.add(Calendar.MINUTE,minutes);
         return cal.getTime();
     }
+
+
+    /**
+     * 璁$畻澶氬皯鑷劧骞�/鏈�/鏃ュ悗鐨勬棩鏈�
+     * @param startDate 寮�濮嬫棩鏈�
+     * @param type  0=鏃ワ紱1=鏈堬紱2=骞达紱
+     * @param cycle 鍛ㄦ湡  X鏈�
+     * @return
+     */
+    public static Date afterDateByType(Date startDate,Integer type,Integer cycle){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(startDate);
+        if(type==0){
+            calendar.add(Calendar.DATE, cycle);
+        }else if(type==1){
+            calendar.add(Calendar.MONTH, cycle);
+        }else if(type == 2) {
+            calendar.add(Calendar.YEAR, cycle);
+        }
+        return calendar.getTime();
+    }
+
+
+
+    public static Integer monthDays(Date date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        // 鑾峰彇褰撳墠骞翠唤銆佹湀浠斤紙娉ㄦ剰鏈堜唤浠�0寮�濮嬭绠楋級
+        int year = calendar.get(Calendar.YEAR);
+        int month = calendar.get(Calendar.MONTH) + 1;
+        // 鏍规嵁骞翠唤鍜屾湀浠藉垽鏂棸骞存儏鍐�
+        boolean isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
+
+        // 鏍规嵁涓嶅悓鏈堜唤璁惧畾姣忎釜鏈堢殑澶╂暟
+        switch (month) {
+            case 2:
+                if (isLeapYear) {
+                    return 29;
+                } else {
+                    return 28;
+                }
+            case 4:
+            case 6:
+            case 9:
+            case 11:
+                 return 30;
+            default:
+                 return 31;
+        }
+    }
+
+
+
+    public static void main(String[] args) {
+       System.out.println(DateUtil.DateToStr(DateUtil.afterDateByType(
+               DateUtil.stringToDate("2024-02-01","yyyy-MM-dd")
+               ,1,1),"yyyy-MM-dd HH:mm:ss"));
+    }
+
+
 }
\ No newline at end of file
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/CountCyclePriceDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/CountCyclePriceDTO.java
new file mode 100644
index 0000000..d997b60
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/CountCyclePriceDTO.java
@@ -0,0 +1,25 @@
+package com.doumee.dao.business.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @author RenKang
+ */
+@Data
+public class CountCyclePriceDTO {
+
+    @ApiModelProperty(value = "鏂规涓婚敭", example = "1")
+    private Integer solutionsId;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "鐢熸晥璧锋湡")
+    private Date startDate;
+
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/DispatchUnitQueryDTO.java b/server/service/src/main/java/com/doumee/dao/business/dto/DispatchUnitQueryDTO.java
index 19578e6..c7f7a88 100644
--- a/server/service/src/main/java/com/doumee/dao/business/dto/DispatchUnitQueryDTO.java
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/DispatchUnitQueryDTO.java
@@ -35,7 +35,7 @@
     @ApiModelProperty(value = "浼佷笟缂栫爜", example = "1")
     private Integer companyId;
 
-    @ApiModelProperty(value = "璁板綍绫诲瀷 0鍩鸿〃鏁版嵁 1鍘嗗彶鐗堟湰鏁版嵁", example = "1")
+    @ApiModelProperty(value = "璁板綍绫诲瀷 0鍩鸿〃鏁版嵁 1鍘嗗彶鐗堟湰鏁版嵁 2鏈�鏂扮増鏈�", example = "1")
     private Integer dataType;
 
     @ApiModelProperty(value = "鏂规涓婚敭")
diff --git a/server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java b/server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java
index 3b10169..e8ed9c6 100644
--- a/server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java
+++ b/server/service/src/main/java/com/doumee/dao/business/dto/MemberImport.java
@@ -15,27 +15,30 @@
 @ApiModel("鍛樺伐淇℃伅瀵煎叆")
 public class MemberImport {
 
+    @ExcelColumn(name="搴忓彿",value = "sn")
+    private Integer sn;
+
     @ExcelColumn(name="濮撳悕",value = "name")
     private String name;
 
-    @ExcelColumn(name="韬唤璇佸彿鐮�",value = "idCard")
+    @ExcelColumn(name="韬唤璇佸彿",value = "idCard")
     private String idCard;
 
     @ExcelColumn(name="骞撮緞",value = "age")
     private Integer age;
 
-    @ApiModelProperty(value = "娲鹃仯鍗曚綅涓婚敭")
-    private Integer duId;
+//    @ApiModelProperty(value = "娲鹃仯鍗曚綅涓婚敭")
+//    private Integer duId;
 
     @ApiModelProperty(value = "鎬у埆")
     private Integer sex;
 
-    @ApiModelProperty(value = "鎵�灞炲伐绉嶄富閿�")
-    private Integer workTypeId;
-
-    @ApiModelProperty(value = "娲鹃仯鍗曚綅鍚嶇О")
-    private String duName;
-
-    @ApiModelProperty(value = "鎵�灞炲伐绉嶅悕绉�")
-    private String workTypeName;
+//    @ApiModelProperty(value = "鎵�灞炲伐绉嶄富閿�")
+//    private Integer workTypeId;
+//
+//    @ApiModelProperty(value = "娲鹃仯鍗曚綅鍚嶇О")
+//    private String duName;
+//
+//    @ApiModelProperty(value = "鎵�灞炲伐绉嶅悕绉�")
+//    private String workTypeName;
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/join/DispatchUnitJoinMapper.java b/server/service/src/main/java/com/doumee/dao/business/join/DispatchUnitJoinMapper.java
new file mode 100644
index 0000000..29f89dd
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/join/DispatchUnitJoinMapper.java
@@ -0,0 +1,13 @@
+package com.doumee.dao.business.join;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.doumee.dao.business.model.DispatchUnit;
+import com.github.yulichang.base.mapper.MPJJoinMapper;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2024/01/16 10:03
+ */
+public interface DispatchUnitJoinMapper extends MPJJoinMapper<DispatchUnit> {
+
+}
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/DispatchUnit.java b/server/service/src/main/java/com/doumee/dao/business/model/DispatchUnit.java
index ea11c80..d8d52a5 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/DispatchUnit.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/DispatchUnit.java
@@ -134,5 +134,9 @@
     private List<DuLog> duLogList;
 
 
+    @ApiModelProperty(value = "娲鹃仯鍗曚綅鏂规绠″叧鑱斾富閿�")
+    @TableField(exist = false)
+    private Integer duSolutionId;
+
 
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/model/DuWorktype.java b/server/service/src/main/java/com/doumee/dao/business/model/DuWorktype.java
index 23be9f0..ed0c608 100644
--- a/server/service/src/main/java/com/doumee/dao/business/model/DuWorktype.java
+++ b/server/service/src/main/java/com/doumee/dao/business/model/DuWorktype.java
@@ -92,4 +92,9 @@
     @ApiModelProperty(value = "宸ョ鍚嶇О")
     @TableField(exist = false)
     private String workTypeName;
+
+    @ApiModelProperty(value = "瑙嗛璧勬枡鍦板潃鍏ㄨ矾寰�")
+    @TableField(exist = false)
+    private String videoUrlFull;
+
 }
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 0afb25a..452c5ae 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
@@ -38,7 +38,6 @@
 
     @ApiModelProperty(value = "鍒涘缓鏃堕棿")
     @ExcelColumn(name="鍒涘缓鏃堕棿")
-
     private Date createDate;
 
     @ApiModelProperty(value = "鏇存柊浜虹紪鐮�", example = "1")
@@ -72,19 +71,26 @@
 
     @ApiModelProperty(value = "鏈熸湜淇濋櫓鐢熸晥姝㈡湡")
     @ExcelColumn(name="鏈熸湜淇濋櫓鐢熸晥姝㈡湡")
-
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+     @JsonFormat(pattern="yyyy-MM-dd")
     private Date applyEndTime;
 
     @ApiModelProperty(value = "鏈熸湜淇濋櫓鐢熸晥璧锋湡")
     @ExcelColumn(name="鏈熸湜淇濋櫓鐢熸晥璧锋湡")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern="yyyy-MM-dd")
     private Date applyStartTime;
 
     @ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥姝㈡湡")
     @ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥姝㈡湡")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern="yyyy-MM-dd")
     private Date endTime;
 
     @ApiModelProperty(value = "瀹為檯淇濋櫓鐢熸晥璧锋湡")
     @ExcelColumn(name="瀹為檯淇濋櫓鐢熸晥璧锋湡")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern="yyyy-MM-dd")
     private Date startTime;
 
     @ApiModelProperty(value = "鏈�杩戞搷浣滄椂闂�")
@@ -178,7 +184,9 @@
     @TableField(exist = false)
     private String statusInfo;
 
-    public TaxesInvoicingVO getTaxesInvoicingVO(){
+
+
+    public TaxesInvoicingVO toTaxesInvoicingVO(){
         TaxesInvoicingVO taxesInvoicingVO = new TaxesInvoicingVO();
         taxesInvoicingVO.setId(this.getId());
         taxesInvoicingVO.setSolutionsName(this.getSolutionsName());
@@ -189,6 +197,7 @@
         taxesInvoicingVO.setType(Constants.ZERO);
         return taxesInvoicingVO;
     }
+
     @ApiModelProperty(value = "鍦ㄧ嚎绛剧珷鍦板潃")
     @TableField(exist = false)
     private String signLink;
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 4deeefd..771b7c1 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
@@ -148,6 +148,10 @@
     @ExcelColumn(name="鍩鸿〃缂栫爜锛堣嚜鍏宠仈锛�")
     private Integer baseId;
 
+    @ApiModelProperty(value = "寤惰繜澶╂暟鐢熸晥锛圴ALID_TYPE锛�0 浣跨敤锛�", example = "1")
+    @ExcelColumn(name="寤惰繜澶╂暟鐢熸晥锛圴ALID_TYPE锛�0 浣跨敤锛�")
+    private Integer validTypeNum;
+
     @ApiModelProperty(value = "鍛樺伐", example = "1")
     @TableField(exist = false)
     private Integer memberId;
@@ -155,12 +159,9 @@
     @TableField(exist = false)
     private String insuranceName;
 
-
     @ApiModelProperty(value = "淇濆崟涓婚敭", example = "1")
     @TableField(exist = false)
     private Integer applyId;
-
-
 
     @ApiModelProperty(value = "宸ョ缂栫爜闆嗗悎", example = "1")
     @TableField(exist = false)
@@ -169,5 +170,8 @@
     @TableField(exist = false)
     private  List<SolutionWorktype> worktypeList;
 
+    @ApiModelProperty(value = "鎬诲懆鏈熻垂鐢�", example = "1")
+    @TableField(exist = false)
+    private BigDecimal cyclePrice;
 
 }
diff --git a/server/service/src/main/java/com/doumee/dao/business/vo/CountCyclePriceVO.java b/server/service/src/main/java/com/doumee/dao/business/vo/CountCyclePriceVO.java
new file mode 100644
index 0000000..5238c8d
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/business/vo/CountCyclePriceVO.java
@@ -0,0 +1,22 @@
+package com.doumee.dao.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author RenKang
+ */
+@Data
+public class CountCyclePriceVO {
+
+    @ApiModelProperty(value = "鎬婚噾棰�", example = "1")
+    private BigDecimal cyclePrice;
+
+    @ApiModelProperty(value = "鐢熸晥姝㈡湡")
+    private Date endDate;
+
+
+}
diff --git a/server/service/src/main/java/com/doumee/service/business/ApplyDetailService.java b/server/service/src/main/java/com/doumee/service/business/ApplyDetailService.java
index ffd0d37..2395b87 100644
--- a/server/service/src/main/java/com/doumee/service/business/ApplyDetailService.java
+++ b/server/service/src/main/java/com/doumee/service/business/ApplyDetailService.java
@@ -90,6 +90,7 @@
 
     PageData<ApplyDetail> findPageForCompany(PageWrap<ApplyDetailPageDTO> pageWrap);
 
+    List<ApplyDetail> findListForCompany(ApplyDetailPageDTO applyDetailPageDTO);
 
 
     /**
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 5c27915..20a5497 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
@@ -2,9 +2,11 @@
 
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.dto.CountCyclePriceDTO;
 import com.doumee.dao.business.dto.InsuranceApplyOptDTO;
 import com.doumee.dao.business.dto.InsuranceApplyQueryDTO;
 import com.doumee.dao.business.model.InsuranceApply;
+import com.doumee.dao.business.vo.CountCyclePriceVO;
 import com.jzq.common.bean.sign.NotifyDataReq;
 
 import java.util.List;
@@ -23,6 +25,7 @@
      * @return Integer
      */
     Integer create(InsuranceApply insuranceApply);
+    Integer updateData(InsuranceApply insuranceApply);
 
     /**
      * 涓婚敭鍒犻櫎
@@ -127,4 +130,6 @@
     void dealSignResult(NotifyDataReq data);
 
     void dealWaitSignedData();
+
+    CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO);
 }
diff --git a/server/service/src/main/java/com/doumee/service/business/SolutionsService.java b/server/service/src/main/java/com/doumee/service/business/SolutionsService.java
index 0b80a30..53bb2f5 100644
--- a/server/service/src/main/java/com/doumee/service/business/SolutionsService.java
+++ b/server/service/src/main/java/com/doumee/service/business/SolutionsService.java
@@ -90,7 +90,7 @@
     PageData<Solutions> findPageCom(PageWrap<Solutions> pageWrap);
 
 
-
+    List<Solutions> findListForCompany();
     /**
      * 鏉′欢缁熻
      *
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 ce6f73d..638ff33 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
@@ -241,6 +241,44 @@
         return pageData;
     }
 
+
+
+
+    @Override
+    public List<ApplyDetail> findListForCompany(ApplyDetailPageDTO applyDetailPageDTO) {
+        MPJLambdaWrapper<ApplyDetail> queryWrapper = new MPJLambdaWrapper<>();
+        queryWrapper.selectAll(ApplyDetail.class);
+        queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName);
+        queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName);
+        queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo);
+        queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName);
+        queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId);
+        queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId);
+        queryWrapper.leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId);
+        queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getApplyId()),ApplyDetail::getApplyId,applyDetailPageDTO.getApplyId());
+        queryWrapper.ge(!Objects.isNull(applyDetailPageDTO.getApplyStatus())
+                        &&!applyDetailPageDTO.getApplyStatus().equals(Constants.ZERO),
+                ApplyDetail::getStartTime, DateUtil.getDate(new Date(),"yyyy-MM-dd")+" 00:00:00");
+        //鍦ㄤ繚
+        queryWrapper.le(!Objects.isNull(applyDetailPageDTO.getApplyStatus())
+                        &&applyDetailPageDTO.getApplyStatus().equals(Constants.ONE),
+                ApplyDetail::getEndTime, DateUtil.getDate(new Date(),"yyyy-MM-dd")+" 23:59:59");
+        //涓嶅湪淇�
+        queryWrapper.ge(!Objects.isNull(applyDetailPageDTO.getApplyStatus())
+                        &&applyDetailPageDTO.getApplyStatus().equals(Constants.TWO),
+                ApplyDetail::getEndTime, DateUtil.getDate(new Date(),"yyyy-MM-dd")+" 23:59:59");
+        queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getDuId()),ApplyDetail::getDuId,applyDetailPageDTO.getDuId());
+        queryWrapper.eq(!Objects.isNull(applyDetailPageDTO.getWorkTypeId()),ApplyDetail::getWorktypeId,applyDetailPageDTO.getWorkTypeId());
+        queryWrapper.like(StringUtils.isNotBlank(applyDetailPageDTO.getMemberName()),Member::getName,applyDetailPageDTO.getMemberName());
+        queryWrapper.ge(StringUtils.isNotBlank(applyDetailPageDTO.getStartTimeS()),ApplyDetail::getStartTime,applyDetailPageDTO.getStartTimeS()+" 00:00:00");
+        queryWrapper.le(StringUtils.isNotBlank(applyDetailPageDTO.getStartTimeE()),ApplyDetail::getStartTime,applyDetailPageDTO.getStartTimeE()+" 23:59:59");
+        queryWrapper.ge(StringUtils.isNotBlank(applyDetailPageDTO.getEndTimeS()),ApplyDetail::getEndTime,applyDetailPageDTO.getEndTimeS()+" 00:00:00");
+        queryWrapper.le(StringUtils.isNotBlank(applyDetailPageDTO.getEndTimeE()),ApplyDetail::getEndTime,applyDetailPageDTO.getEndTimeE()+" 23:59:59");
+        return  applyDetailJoinMapper.selectJoinList(ApplyDetail.class,queryWrapper);
+    }
+
+
+
     @Override
     public long count(ApplyDetail applyDetail) {
         QueryWrapper<ApplyDetail> wrapper = new QueryWrapper<>(applyDetail);
@@ -255,7 +293,6 @@
                         .selectAll(ApplyDetail.class)
                         .selectAs(DispatchUnit::getName,ApplyDetail::getDuName)
                         .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName)
-                        .selectAs(Member::getName,ApplyDetail::getMemberName)
                         .selectAs(Solutions::getName,ApplyDetail::getSolutionName)
                         .selectAs(ApplyChange::getValidCode,ApplyDetail::getValidCode)
                         .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId)
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
index 8483330..46b2958 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
@@ -1,5 +1,6 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
@@ -12,10 +13,12 @@
 import com.doumee.dao.business.DuSolutionMapper;
 import com.doumee.dao.business.DuWorktypeMapper;
 import com.doumee.dao.business.dto.*;
+import com.doumee.dao.business.join.DispatchUnitJoinMapper;
 import com.doumee.dao.business.join.DuLogJoinMapper;
 import com.doumee.dao.business.join.DuSolutionJoinMapper;
 import com.doumee.dao.business.join.DuWorkTypeJoinMapper;
 import com.doumee.dao.business.model.*;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.DispatchUnitService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -31,6 +34,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 娲鹃仯鍗曚綅淇℃伅琛⊿ervice瀹炵幇
@@ -42,6 +46,9 @@
 
     @Autowired
     private DispatchUnitMapper dispatchUnitMapper;
+
+    @Autowired
+    private DispatchUnitJoinMapper dispatchUnitJoinMapper;
 
     @Autowired
     private DuSolutionMapper duSolutionMapper;
@@ -60,6 +67,9 @@
 
     @Autowired
     private DuWorkTypeJoinMapper duWorkTypeJoinMapper;
+
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
 
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -125,7 +135,17 @@
         List<DuWorktype> newWorktypes = new ArrayList<>();
         List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda()
                 .eq(DuSolution::getIsdeleted,Constants.ZERO)
-                .eq(DuSolution::getDispatchUnitId,model.getSolutionId()));
+                .eq(DuSolution::getDispatchUnitId,model.getId()));
+
+        duSolutionMapper.update(null,new UpdateWrapper<DuSolution>().lambda()
+                        .set(DuSolution::getStatus,Constants.ONE)
+                .eq(DuSolution::getIsdeleted,Constants.ZERO)
+                .eq(DuSolution::getStatus,Constants.ZERO)
+                .eq(DuSolution::getDispatchUnitId,model.getId())
+        );
+
+
+
         if(solutions == null || solutions.size() ==0){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶆湭璁剧疆鏂规宸ョ淇℃伅锛屽鏍搁�氳繃澶辫触锛�");
         }
@@ -141,9 +161,18 @@
             List<DuWorktype> worktypes = duWorktypeMapper.selectList(new QueryWrapper<DuWorktype>().lambda()
                     .eq(DuWorktype::getIsdeleted,Constants.ZERO)
                     .eq(DuWorktype::getDuSolutionId,s.getId()));
+
+            duWorktypeMapper.update(null,new UpdateWrapper<DuWorktype>().lambda()
+                    .set(DuWorktype::getStatus,Constants.ONE)
+                    .eq(DuWorktype::getIsdeleted,Constants.ZERO)
+                    .eq(DuWorktype::getStatus,Constants.ZERO)
+                    .eq(DuWorktype::getDuSolutionId,s.getId()));
+
             if(worktypes == null || worktypes.size() ==0){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶆柟妗堝瓨鍦ㄦ柟妗堟槸鏈缃伐绉嶄俊鎭俊鎭紝瀹℃牳閫氳繃澶辫触锛�");
             }
+
+
             for (DuWorktype w : worktypes) {
                 DuWorktype nw = new DuWorktype();
                 BeanUtils.copyProperties(w, nw);
@@ -166,31 +195,34 @@
     public Integer check(DispatchUnit param) {
         if(Objects.isNull(param)
                 ||Objects.isNull(param.getId())
-                ||param.getStatus() == null
-                ||!(param.getStatus() ==Constants.ONE || param.getStatus() == Constants.TWO)){
+                ||param.getUnitStatus() == null
+                ||!(param.getUnitStatus() ==Constants.ONE || param.getUnitStatus() == Constants.TWO)){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         DispatchUnit model = dispatchUnitMapper.selectById(param.getId());
-        if(Objects.isNull(model) || Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ||!Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+        if(Objects.isNull(model) || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ||!Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌娲鹃仯鍗曚綅淇℃伅");
         }
-        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)){
+        if(!Constants.equalsInteger(model.getUnitStatus(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶅伐绉嶅凡瀹℃牳锛岃鍕块噸澶嶆彁浜");
         }
         DispatchUnit update = new DispatchUnit();
         update.setEditor(user.getId());
         update.setEditDate(new Date());
         update.setId(model.getId());
-        update.setStatus(param.getStatus());
+        update.setUnitStatus(param.getUnitStatus());
         update.setWorktypeStatus(param.getWorktypeStatus());
         update.setCheckDate(update.getEditDate());
         update.setCheckUserId(user.getId());
         update.setCheckInfo(param.getCheckInfo());
         dispatchUnitMapper.updateById(update);
-        if(Constants.equalsInteger(model.getStatus(),Constants.ONE)){
+        DispatchUnit dispatchUnit = dispatchUnitMapper.selectById(param.getId());
+        if(Constants.equalsInteger(param.getUnitStatus(),Constants.ONE)){
             //瀹℃牳閫氳繃锛屼慨鏀圭姸鎬侊紝浜х敓鍘嗗彶鐗堟湰
-            newVersionData(dispatchUnitMapper.selectById(param.getId()),update);
+            newVersionData(dispatchUnit,update);
+            //瀛樺偍鎿嶄綔鍘嗗彶
+            this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_PASS,null);
         }else{
             //鏇存柊鏄庣粏鏁版嵁涓哄鏍稿け璐�
             duSolutionMapper.update(null,new UpdateWrapper<DuSolution>().lambda()
@@ -199,6 +231,28 @@
                     .set(DuSolution::getCheckUserId,update.getCheckUserId())
                     .set(DuSolution::getCheckInfo,update.getCheckInfo())
                     .eq(DuSolution::getDispatchUnitId,update.getId()));
+
+
+            List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda()
+                    .eq(DuSolution::getIsdeleted,Constants.ZERO)
+                    .eq(DuSolution::getDispatchUnitId,model.getId()));
+
+            if(solutions == null || solutions.size() ==0){
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶆湭璁剧疆鏂规宸ョ淇℃伅锛屽鏍搁�氳繃澶辫触锛�");
+            }
+            for (DuSolution s : solutions){
+                duWorktypeMapper.update(null,new UpdateWrapper<DuWorktype>().lambda()
+                        .set(DuWorktype::getStatus,Constants.TWO)
+                        .set(DuWorktype::getCheckUserId,update.getCheckUserId())
+                        .set(DuWorktype::getCheckInfo,update.getCheckInfo())
+                        .set(DuWorktype::getCheckDate,new Date() )
+                        .eq(DuWorktype::getIsdeleted,Constants.ZERO)
+                        .eq(DuWorktype::getStatus,Constants.ZERO)
+                        .eq(DuWorktype::getDuSolutionId,s.getId()));
+            }
+
+            //瀛樺偍鎿嶄綔鍘嗗彶
+            this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_UN_PASS,update.getCheckInfo());
         }
         return  1;
     }
@@ -247,11 +301,19 @@
         this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.UPLOAD,null);
 
         List<SaveDuSolutionDTO> saveDuSolutionDTOList = saveDispatchUnitDTO.getSaveDuSolutionDTOList();
+
+        List<Integer> duSolutionIdS = saveDuSolutionDTOList.stream().map(m->m.getSolutionId()).collect(Collectors.toList());
+        HashSet<Integer> setDuSolutionIdS=new HashSet<>(duSolutionIdS);
+        if(duSolutionIdS.size()!=setDuSolutionIdS.size()){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏂规淇℃伅閲嶅");
+        }
+
         for (int i = 0; i < saveDuSolutionDTOList.size(); i++) {
             SaveDuSolutionDTO saveDuSolutionDTO = saveDuSolutionDTOList.get(i);
             DuSolution duSolution = new DuSolution();
             duSolution.setCreateDate(new Date());
             duSolution.setCreator(loginUserInfo.getId());
+            duSolution.setStatus(Constants.ZERO);
             duSolution.setIsdeleted(Constants.ZERO);
             duSolution.setDispatchUnitId(dispatchUnit.getId());
             duSolution.setSortnum(i);
@@ -259,6 +321,13 @@
             duSolutionMapper.insert(duSolution);
 
             List<SaveDuWorkTypeDTO> saveDuWorkTypeDTOList = saveDuSolutionDTO.getSaveDuWorkTypeDTOList();
+
+            List<Integer> duWorkTypeIdS = saveDuWorkTypeDTOList.stream().map(m->m.getWorkTypeId()).collect(Collectors.toList());
+            HashSet<Integer> setDuWorkTypeIdS=new HashSet<>(duWorkTypeIdS);
+            if(duWorkTypeIdS.size()!=setDuWorkTypeIdS.size()){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓嬪瓨鍦ㄩ噸澶嶅伐绉嶏紒");
+            }
+
             if(!CollectionUtils.isNotEmpty(saveDuSolutionDTOList)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓嬫湭閫夋嫨宸ョ锛�");
             }
@@ -269,6 +338,7 @@
                 duWorktype.setCreator(loginUserInfo.getId());
                 duWorktype.setIsdeleted(Constants.ZERO);
                 duWorktype.setDuSolutionId(duSolution.getId());
+                duWorktype.setStatus(Constants.ZERO);
                 duWorktype.setSortnum(j);
                 duWorktype.setWorkTypeId(saveDuWorkTypeDTO.getWorkTypeId());
                 duWorktype.setVideoUrl(saveDuWorkTypeDTO.getVideoUrl());
@@ -285,7 +355,6 @@
     public Integer editDispatchUnit(SaveDispatchUnitDTO saveDispatchUnitDTO) {
         if(Objects.isNull(saveDispatchUnitDTO)
                 ||Objects.isNull(saveDispatchUnitDTO.getId())
-                || CollectionUtils.isEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -314,7 +383,6 @@
         dispatchUnit.setContent(saveDispatchUnitDTO.getContent());
         dispatchUnit.setName(saveDispatchUnitDTO.getName());
         dispatchUnit.setUnitStatus(Constants.ZERO);
-        dispatchUnit.setWorktypeStatus(Constants.ZERO);
         dispatchUnit.setEditDate(new Date());
         dispatchUnit.setEditor(loginUserInfo.getId());
         dispatchUnitMapper.updateById(dispatchUnit);
@@ -322,7 +390,7 @@
         //瀛樺偍鎿嶄綔璁板綍
         this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.EDIT_UNIT,null);
 
-        this.dealDuData(saveDispatchUnitDTO,loginUserInfo);
+//        this.dealDuData(saveDispatchUnitDTO,loginUserInfo);
 
         return dispatchUnit.getId();
     }
@@ -338,7 +406,7 @@
     public Integer createSolution(SaveDispatchUnitDTO saveDispatchUnitDTO) {
         if(Objects.isNull(saveDispatchUnitDTO)
                 ||Objects.isNull(saveDispatchUnitDTO.getId())
-                || CollectionUtils.isEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList())
+                || !CollectionUtils.isNotEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -363,7 +431,10 @@
         List<SaveDuSolutionDTO> saveDuSolutionDTOList = saveDispatchUnitDTO.getSaveDuSolutionDTOList();
         for (int i = 0; i < saveDuSolutionDTOList.size(); i++) {
             SaveDuSolutionDTO saveDuSolutionDTO = saveDuSolutionDTOList.get(i);
-            DuSolution duSolution = duSolutionMapper.selectOne(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDuSolutionDTO.getId())
+            if(Objects.isNull(saveDuSolutionDTO.getSolutionId())){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓嬮�夋嫨鏂规淇℃伅寮傚父锛�");
+            }
+            DuSolution duSolution = duSolutionMapper.selectOne(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDispatchUnitDTO.getId())
                     .eq(DuSolution::getIsdeleted,Constants.ZERO)
                     .eq(DuSolution::getSolutionId,saveDuSolutionDTO.getSolutionId()).last("limit 1"));
             Integer duSolutionNum = duSolutionMapper.selectCount(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDuSolutionDTO.getId()));
@@ -372,6 +443,7 @@
                 duSolution.setCreateDate(new Date());
                 duSolution.setCreator(loginUserInfo.getId());
                 duSolution.setIsdeleted(Constants.ZERO);
+                duSolution.setStatus(Constants.ZERO);
                 duSolution.setDispatchUnitId(saveDispatchUnitDTO.getId());
                 duSolution.setSortnum(duSolutionNum + i);
                 duSolution.setSolutionId(saveDuSolutionDTO.getSolutionId());
@@ -383,10 +455,14 @@
             }
             for (int j = 0; j < saveDuWorkTypeDTOList.size(); j++) {
                 SaveDuWorkTypeDTO saveDuWorkTypeDTO = saveDuWorkTypeDTOList.get(j);
-                if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())
+                if(Objects.isNull(saveDuWorkTypeDTO.getWorkTypeId())){
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶄俊鎭紓甯�");
+                }
+                if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>()
+                        .lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())
                         .eq(DuWorktype::getIsdeleted,Constants.ZERO)
                         .eq(DuWorktype::getWorkTypeId,saveDuWorkTypeDTO.getWorkTypeId()))>0){
-                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶅凡瀛樺湪宸ョ宸插瓨鍦�");
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶅凡瀛樺湪");
                 }
                 Integer duWorkTypeNum = duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId()));
                 DuWorktype duWorktype = new DuWorktype();
@@ -394,6 +470,7 @@
                 duWorktype.setCreator(loginUserInfo.getId());
                 duWorktype.setIsdeleted(Constants.ZERO);
                 duWorktype.setDuSolutionId(duSolution.getId());
+                duWorktype.setStatus(Constants.ZERO);
                 duWorktype.setSortnum(duWorkTypeNum + j);
                 duWorktype.setWorkTypeId(saveDuWorkTypeDTO.getWorkTypeId());
                 duWorktype.setVideoUrl(saveDuWorkTypeDTO.getVideoUrl());
@@ -587,12 +664,14 @@
         QueryWrapper<DispatchUnit> wrapper = new QueryWrapper<>(dispatchUnit);
         return dispatchUnitMapper.selectList(wrapper);
     }
-  
+
+
     @Override
     public PageData<DispatchUnit> findPage(PageWrap<DispatchUnit> pageWrap) {
         IPage<DispatchUnit> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
         QueryWrapper<DispatchUnit> queryWrapper = new QueryWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
+        queryWrapper.lambda().eq(DispatchUnit::getIsdeleted,Constants.ZERO);
         if (pageWrap.getModel().getId() != null) {
             queryWrapper.lambda().eq(DispatchUnit::getId, pageWrap.getModel().getId());
         }
@@ -666,7 +745,8 @@
                 queryWrapper.orderByAsc(sortData.getProperty());
             }
         }
-        return PageData.from(dispatchUnitMapper.selectPage(page, queryWrapper));
+        PageData<DispatchUnit> dispatchUnitPageData = PageData.from(dispatchUnitMapper.selectPage(page, queryWrapper));
+        return dispatchUnitPageData;
     }
 
     @Override
@@ -685,7 +765,7 @@
                         .selectAll(DuSolution.class)
                         .selectAs(Solutions::getName,DuSolution::getSolutionName)
                         .leftJoin(Solutions.class,Solutions::getId,DuSolution::getSolutionId)
-                        .eq(DuSolution::getSolutionId,dispatchUnit.getId())
+                        .eq(DuSolution::getDispatchUnitId,dispatchUnit.getId())
                         .orderByAsc(DuSolution::getSortnum)
         );
         if(CollectionUtils.isNotEmpty(duSolutionList)){
@@ -698,6 +778,14 @@
                                 .leftJoin(Worktype.class,Worktype::getId,DuWorktype::getWorkTypeId)
                                 .eq(DuWorktype::getDuSolutionId,duSolution.getId())
                 );
+                if(CollectionUtils.isNotEmpty(duWorkTypeList)){
+                    String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.DU_FILE).getCode();
+                    duWorkTypeList.forEach(i->{
+                        if(StringUtils.isNotBlank(i.getVideoUrl())){
+                            i.setVideoUrlFull(path + i.getVideoUrl());
+                        }
+                    });
+                }
                 duSolution.setDuWorktypeList(duWorkTypeList);
             }
             dispatchUnit.setDuSolutionList(duSolutionList);
@@ -706,10 +794,10 @@
         List<DuLog> duLogList = duLogJoinMapper.selectJoinList(DuLog.class,
                 new MPJLambdaWrapper<DuLog>()
                         .selectAll(DuLog.class)
-                        .selectAs(Member::getName,DuLog::getCreatorName)
+                        .selectAs(SystemUser::getRealname,DuLog::getCreatorName)
                         .selectAs(Company::getName,DuLog::getCompanyName)
-                        .leftJoin(Member.class,Member::getId,DuLog::getCreator)
-                        .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+                        .leftJoin(SystemUser.class,SystemUser::getId,DuLog::getCreator)
+                        .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
                         .eq(DuLog::getDuId,dispatchUnit.getId())
                         .orderByAsc(DuLog::getCreateDate)
         );
@@ -725,17 +813,35 @@
     @Override
     public List<DispatchUnit> findByDTO(DispatchUnitQueryDTO dispatchUnitQueryDTO) {
         LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        List<DispatchUnit> dispatchUnitList = dispatchUnitMapper.selectList(new QueryWrapper<DispatchUnit>().lambda()
-                .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
-                .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
-                .eq(DispatchUnit::getStatus,Constants.ZERO)
-                .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
-                .apply(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()), " id in ( select d.dispatch_unit_id from du_solution d where d.solutionId = "+dispatchUnitQueryDTO.getSolutionId()+"  ) " )
-                .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()),
-                        " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " +
-                                " ad.du_id = t.id ")
-                .orderByAsc(DispatchUnit::getSortnum)
+//        List<DispatchUnit> dispatchUnitList = dispatchUnitMapper.selectList(new QueryWrapper<DispatchUnit>().lambda()
+//                .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
+//                .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
+//                .eq(DispatchUnit::getStatus,Constants.ZERO)
+//                .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
+//                .apply(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()), " id in ( select d.dispatch_unit_id from du_solution d where d.solution_id = "+dispatchUnitQueryDTO.getSolutionId()+"  ) " )
+//                .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()),
+//                        " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " +
+//                                " ad.du_id = t.id ")
+//                .orderByAsc(DispatchUnit::getSortnum)
+//        );
+
+
+        List<DispatchUnit> dispatchUnitList  = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class,
+                new MPJLambdaWrapper<DispatchUnit>().selectAll(DispatchUnit.class)
+                        .selectAs(DuSolution::getId,DispatchUnit::getDuSolutionId)
+                        .leftJoin(DuSolution.class,DuSolution::getDispatchUnitId,DispatchUnit::getId)
+                        .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
+                        .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
+                        .eq(DispatchUnit::getStatus,Constants.ZERO)
+                        .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
+                        .eq(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()),DuSolution::getSolutionId,dispatchUnitQueryDTO.getSolutionId())
+                        .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()),
+                                " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " +
+                                        " ad.du_id = t.id ")
         );
+
+
+
         return dispatchUnitList;
     }
 
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
index 518b750..606b538 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/DuWorktypeServiceImpl.java
@@ -1,7 +1,10 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.DuWorktypeMapper;
 import com.doumee.dao.business.model.DuWorktype;
@@ -15,6 +18,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 娲鹃仯鍗曚綅鏂规绠″伐绉嶅叧鑱斾俊鎭〃Service瀹炵幇
@@ -35,7 +39,16 @@
 
     @Override
     public void deleteById(Integer id) {
-        duWorktypeMapper.deleteById(id);
+        DuWorktype duWorktype = duWorktypeMapper.selectById(id);
+        if(Objects.isNull(duWorktype)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(duWorktype.getStatus().equals(Constants.TWO)){
+            duWorktypeMapper.deleteById(id);
+        }else{
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鐘舵�佹棤娉曡繘琛屽垹闄�");
+        }
+
     }
 
     @Override
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 70ba94a..072eaa4 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
@@ -12,12 +12,14 @@
 import com.doumee.core.utils.Utils;
 import com.doumee.core.utils.aliyun.ALiYunUtil;
 import com.doumee.dao.business.*;
+import com.doumee.dao.business.dto.CountCyclePriceDTO;
 import com.doumee.dao.business.dto.InsuranceApplyOptDTO;
 import com.doumee.dao.business.dto.InsuranceApplyQueryDTO;
 import com.doumee.dao.business.join.ApplyDetailJoinMapper;
 import com.doumee.dao.business.join.ApplyLogJoinMapper;
 import com.doumee.dao.business.join.InsuranceApplyJoinMapper;
 import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.vo.CountCyclePriceVO;
 import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.InsuranceApplyService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -606,16 +608,11 @@
         if(!loginUserInfo.getType().equals(Constants.ONE)){
             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛绫诲瀷閿欒锛氶潪浼佷笟鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
         }
-        Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
-        if(Objects.isNull(solutions)){
-            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏂规淇℃伅");
-        }
-
         List<ApplyDetail> applyDetailList = insuranceApply.getApplyDetailList();
         //鍒ゆ柇鏄惁瀛樺湪閲嶅淇℃伅
-        List<Integer> memberIdList = applyDetailList.stream().map(i->i.getMemberId()).collect(Collectors.toList());
-        Set<Integer> set = new HashSet<>(memberIdList);
-        if(memberIdList.size() != set.size()){
+        List<String> idCardList = applyDetailList.stream().map(i->i.getIdcardNo()).collect(Collectors.toList());
+        Set<String> set = new HashSet<>(idCardList);
+        if(idCardList.size() != set.size()){
             throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鍛樺伐淇℃伅瀛樺湪閲嶅淇℃伅");
         }
         Constants.InsuranceApplyStatus insuranceApplyStatus = Constants.InsuranceApplyStatus.UPLOAD;
@@ -624,14 +621,92 @@
         insuranceApply.setIsdeleted(Constants.ZERO);
         insuranceApply.setCompanyId(loginUserInfo.getCompanyId());
         insuranceApply.setCheckInfo(insuranceApplyStatus.getName());
+        insuranceApply.setStartTime(insuranceApply.getApplyStartTime());
+        insuranceApply.setEndTime(insuranceApply.getApplyEndTime());
         insuranceApply.setCheckDate(new Date());
+        insuranceApply.setCurrentFee(BigDecimal.ZERO);
         insuranceApply.setCheckUserId(loginUserInfo.getId());
         insuranceApply.setStatus(insuranceApplyStatus.getKey());
         insuranceApplyMapper.insert(insuranceApply);
+        //澶勭悊涓嬬骇鏁版嵁
+        this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo);
+        InsuranceApply updBean = new InsuranceApply();
+        updBean.setId(insuranceApply.getId());
+        updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add));
+        insuranceApplyMapper.updateById(updBean);
+        //瀛樺偍鏃ュ織鏁版嵁
+        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
+        return insuranceApply.getId();
+    }
+
+
+
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
+    public Integer updateData(InsuranceApply insuranceApply) {
+        if (Objects.isNull(insuranceApply)
+                || Objects.isNull(insuranceApply.getId())
+                || Objects.isNull(insuranceApply.getSolutionId())
+                || Objects.isNull(insuranceApply.getApplyStartTime())
+                || Objects.isNull(insuranceApply.getApplyEndTime())
+                || !CollectionUtils.isNotEmpty(insuranceApply.getApplyDetailList())
+        ) {
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        if(!loginUserInfo.getType().equals(Constants.ONE)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛绫诲瀷閿欒锛氶潪浼佷笟鐢ㄦ埛鏃犳硶杩涜璇ユ搷浣�");
+        }
+        InsuranceApply dbInsuranceApply = insuranceApplyMapper.selectById(insuranceApply.getId());
+        if(Objects.isNull(dbInsuranceApply)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌淇敼瀵硅薄淇℃伅");
+        }
+        if(!(dbInsuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey())
+                    || dbInsuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.FAIL_RETURN.getKey()))
+        ){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐘舵�侀敊璇紝褰撳墠鐘舵�佹棤娉曡繘琛岃鎿嶄綔");
+        }
+        List<ApplyDetail> applyDetailList = insuranceApply.getApplyDetailList();
+        //鍒ゆ柇鏄惁瀛樺湪閲嶅淇℃伅
+        List<String> idCardList = applyDetailList.stream().map(i->i.getIdcardNo()).collect(Collectors.toList());
+        Set<String> set = new HashSet<>(idCardList);
+        if(idCardList.size() != set.size()){
+            throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"鍛樺伐淇℃伅瀛樺湪閲嶅淇℃伅");
+        }
+        Constants.InsuranceApplyStatus insuranceApplyStatus = Constants.InsuranceApplyStatus.UPLOAD;
+        insuranceApply.setEditDate(new Date());
+        insuranceApply.setEditor(loginUserInfo.getId());
+        insuranceApply.setIsdeleted(Constants.ZERO);
+        insuranceApply.setCompanyId(loginUserInfo.getCompanyId());
+        insuranceApply.setCheckInfo(insuranceApplyStatus.getName());
+        insuranceApply.setStartTime(insuranceApply.getApplyStartTime());
+        insuranceApply.setEndTime(insuranceApply.getApplyEndTime());
+        insuranceApply.setCheckDate(new Date());
+        insuranceApply.setCurrentFee(BigDecimal.ZERO);
+        insuranceApply.setCheckUserId(loginUserInfo.getId());
+        insuranceApply.setStatus(insuranceApplyStatus.getKey());
+        applyDetailMapper.delete(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId()));
+        //澶勭悊涓嬬骇鏁版嵁
+        this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo);
+        insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add));
+        insuranceApplyMapper.updateById(insuranceApply);
+        //瀛樺偍鏃ュ織鏁版嵁
+        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
+        return insuranceApply.getId();
+    }
+
+
+
+    public void dealApplyDetailData(InsuranceApply insuranceApply,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo){
+        Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏈煡璇㈠埌鏂规淇℃伅");
+        }
         //鏌ヨ淇濋櫓鏂规涓嬬殑鎵�鏈夋淳閬e崟浣�
         List<DuSolution> duSolutionList = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda()
-                        .eq(DuSolution::getIsdeleted,Constants.ZERO)
-                        .eq(DuSolution::getStatus,Constants.ONE)
+                .eq(DuSolution::getIsdeleted,Constants.ZERO)
+                .eq(DuSolution::getStatus,Constants.ONE)
                 .eq(DuSolution::getSolutionId,insuranceApply.getSolutionId()));
         if(!CollectionUtils.isNotEmpty(duSolutionList)){
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏁版嵁寮傚父锛氫繚闄╂柟妗堜笅鏈煡璇㈠埌娲鹃仯鍗曚綅");
@@ -645,11 +720,13 @@
         if(!CollectionUtils.isNotEmpty(duWorktypeList)){
             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏁版嵁寮傚父锛氫繚闄╂柟妗堜笅鏈煡璇㈠埌宸ョ淇℃伅");
         }
+
         if(CollectionUtils.isNotEmpty(applyDetailList)){
             for (int i = 0; i < applyDetailList.size(); i++) {
                 ApplyDetail applyDetail = applyDetailList.get(i);
                 if(Objects.isNull(applyDetail)
-                        ||Objects.isNull(applyDetail.getMemberId())
+                        ||StringUtils.isBlank(applyDetail.getIdcardNo())
+                        ||StringUtils.isBlank(applyDetail.getMemberName())
                         ||Objects.isNull(applyDetail.getDuId())
                         ||Objects.isNull(applyDetail.getWorktypeId())
                 ){
@@ -658,15 +735,49 @@
                 applyDetail.setCreateDate(new Date());
                 applyDetail.setCreator(loginUserInfo.getId());
                 applyDetail.setIsdeleted(Constants.ZERO);
+                applyDetail.setStartTime(insuranceApply.getApplyStartTime());
+                applyDetail.setEndTime(insuranceApply.getApplyEndTime());
                 applyDetail.setSortnum(i);
                 applyDetail.setApplyId(insuranceApply.getId());
+                Member member = new Member();
                 if(Objects.isNull(applyDetail.getMemberId())){
-                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"銆�"+applyDetail.getMemberName()+"銆戝憳宸ヤ俊鎭瓨鍦ㄥ紓甯告暟鎹紒");
+                    //鏌ヨ鏄惁瀛樺湪璇ョ敤鎴�
+                    member = memberMapper.selectOne(new QueryWrapper<Member>().lambda()
+                            .eq(Member::getCompanyId,insuranceApply.getCompanyId())
+                            .eq(Member::getIsdeleted,Constants.ZERO)
+                            .eq(Member::getIdcardNo,applyDetail.getIdcardNo())
+                            .last(" limit 1")
+                    );
+                    if(Objects.isNull(member)){
+                        member = new Member();
+                        member.setCreateDate(new Date());
+                        member.setCreator(loginUserInfo.getId());
+                        member.setIsdeleted(Constants.ZERO);
+                        member.setName(applyDetail.getMemberName());
+                        member.setCompanyId(insuranceApply.getCompanyId());
+                        member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo()));
+                        member.setIdcardNo(applyDetail.getIdcardNo());
+                        member.setApplyId(insuranceApply.getId());
+                        member.setDuId(applyDetail.getDuId());
+                        member.setWorktypeId(applyDetail.getWorktypeId());
+                        memberMapper.insert(member);
+                    }else{
+                        member.setApplyId(insuranceApply.getId());
+                        member.setDuId(applyDetail.getDuId());
+                        member.setWorktypeId(applyDetail.getWorktypeId());
+                        memberMapper.updateById(member);
+                    }
+                }else{
+                    member = memberMapper.selectById(applyDetail.getMemberId());
+                    if(Objects.isNull(member)){
+                        throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"銆�"+applyDetail.getMemberName()+"銆戝憳宸ヤ俊鎭瓨鍦ㄥ紓甯告暟鎹紒");
+                    }
+                    member.setApplyId(insuranceApply.getId());
+                    member.setDuId(applyDetail.getDuId());
+                    member.setWorktypeId(applyDetail.getWorktypeId());
+                    memberMapper.updateById(member);
                 }
-                Member member = memberMapper.selectById(applyDetail.getMemberId());
-                if(Objects.isNull(member)){
-                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"銆�"+applyDetail.getMemberName()+"銆戝憳宸ヤ俊鎭瓨鍦ㄥ紓甯告暟鎹紒");
-                }
+                applyDetail.setMemberId(member.getId());
                 applyDetail.setIdcardNo(member.getIdcardNo());
                 applyDetail.setSex(member.getSex());
                 applyDetail.setFee(Constants.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime()));
@@ -674,18 +785,15 @@
                 if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){
                     throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"銆�"+applyDetail.getMemberName()+"銆戝憳宸ユ淳閬e崟浣嶆湭鏌ヨ鍒帮紒");
                 }
-                if(duWorktypeList.stream().filter(d->d.getDuSolutionId().equals(applyDetail.getDuId())&&d.getWorkTypeId().equals(applyDetail.getWorktypeId()))
+                if(duWorktypeList.stream().filter(d->d.getWorkTypeId().equals(applyDetail.getWorktypeId()))
                         .collect(Collectors.toList()).size()<=Constants.ZERO){
                     throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"銆�"+applyDetail.getMemberName()+"銆戝憳宸ュ伐绉嶄俊鎭湭鏌ヨ鍒帮紒");
                 }
             }
             applyDetailJoinMapper.insertBatchSomeColumn(applyDetailList);
         }
-
-        //瀛樺偍鏃ュ織鏁版嵁
-        this.saveApplyLog(insuranceApply,insuranceApplyStatus,null);
-        return insuranceApply.getId();
     }
+
 
     public void saveApplyLog(InsuranceApply insuranceApply,Constants.InsuranceApplyStatus insuranceApplyStatus,String content){
         LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
@@ -834,13 +942,18 @@
         if (pageWrap.getModel().getStatus() != null) {
             queryWrapper.eq(InsuranceApply::getStatus, pageWrap.getModel().getStatus());
         }
-        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
+        if(CollectionUtils.isNotEmpty(pageWrap.getSorts())){
+            for(PageWrap.SortData sortData: pageWrap.getSorts()) {
+                if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
+                    queryWrapper.orderByDesc(sortData.getProperty());
+                } else {
+                    queryWrapper.orderByAsc(sortData.getProperty());
+                }
             }
+        }else{
+            queryWrapper.orderByDesc(InsuranceApply::getCreateDate);
         }
+
         PageData<InsuranceApply> pageData = PageData.from(insuranceApplyJoinMapper.selectJoinPage(page,InsuranceApply.class, queryWrapper));
         if(pageData.getRecords()!=null){
             for (InsuranceApply apply : pageData.getRecords()){
@@ -952,10 +1065,10 @@
         List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class,
                 new MPJLambdaWrapper<ApplyLog>()
                         .selectAll(ApplyLog.class)
-                        .selectAs(Member::getName,ApplyLog::getCreatorName)
+                        .selectAs(SystemUser::getRealname,ApplyLog::getCreatorName)
                         .selectAs(Company::getName,ApplyLog::getCompanyName)
-                        .leftJoin(Member.class,Member::getId,ApplyLog::getCreator)
-                        .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+                        .leftJoin(SystemUser.class,SystemUser::getId,ApplyLog::getCreator)
+                        .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
                         .eq(ApplyLog::getApplyId,insuranceApply.getId())
                         .orderByAsc(ApplyLog::getCreateDate)
         );
@@ -1003,6 +1116,18 @@
                 }else if(Constants.equalsInteger(f.getObjType(),Constants.MultiFile.BD_DONE_PDF.getKey())){
                     //鏈�绲備繚闄╁崟
                     model.setBaoxiandanFile(f);
+                }
+
+                if(model.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())){
+                    //濡傛灉褰撳墠鏃堕棿澶т簬缁撴潫鏃ユ湡 鍒欎娇鐢ㄧ粨鏉熸棩鏈熷姣斿紑濮嬫棩鏈�
+                    if(DateUtil.compareDate(new Date(),model.getEndTime())>=Constants.ZERO){
+                        model.setServiceDays(DateUtil.daysBetweenDates(model.getEndTime(),model.getStartTime()));
+                    }else if(DateUtil.compareDate(model.getStartTime(),new Date())>=Constants.ZERO){
+                        //鏈紑濮�
+                        model.setServiceDays(Constants.ZERO);
+                    }else{
+                        model.setServiceDays(DateUtil.daysBetweenDates(new Date(),model.getStartTime()));
+                    }
                 }
             }
         }
@@ -1134,15 +1259,37 @@
             }
         }
 
-
-
-
-
-
     }
 
 
 
+    @Override
+    public CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO){
+        if(Objects.isNull(countCyclePriceDTO)
+            || Objects.isNull(countCyclePriceDTO.getSolutionsId())
+            || Objects.isNull(countCyclePriceDTO.getStartDate())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        Solutions solutions = solutionsMapper.selectById(countCyclePriceDTO.getSolutionsId());
+        if(Objects.isNull(solutions)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈡柟妗堜俊鎭�");
+        }
+        CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO();
+        if(solutions.getInsureCycleUnit().equals(Constants.ZERO)){
+            countCyclePriceVO.setEndDate(DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,solutions.getInsureCycle()));
+        }else if(solutions.getInsureCycleUnit().equals(Constants.TWO)){
+            Integer monthDays = DateUtil.monthDays(countCyclePriceDTO.getStartDate());
+            Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,monthDays);
+            countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1));
+        }else if(solutions.getInsureCycleUnit().equals(Constants.THREE)){
+            Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),2,solutions.getInsureCycle());
+            countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1));
+        }
+        countCyclePriceVO.setCyclePrice(Constants.countDetailFee(solutions,countCyclePriceVO.getEndDate(),countCyclePriceDTO.getStartDate()));
+        return countCyclePriceVO;
+    }
+
 
 
 }
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 f08ceb2..f5ec6a9 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
@@ -55,6 +55,7 @@
         return member.getId();
     }
 
+
     @Override
     public void deleteById(Integer id) {
         memberMapper.deleteById(id);
@@ -267,14 +268,17 @@
             if(CollectionUtils.isNotEmpty(list)){
                 Member member = list.stream().filter(m->m.getIdcardNo().equals(model.getIdCard())).findAny().get();
                 if(!Objects.isNull(member)){
-                    model.setWorkTypeId(member.getWorktypeId());
-                    model.setWorkTypeName(member.getWorkTypeName());
-                    model.setDuId(member.getDuId());
-                    model.setDuName(member.getDuName());
+//                    model.setWorkTypeId(member.getWorktypeId());
+//                    model.setWorkTypeName(member.getWorkTypeName());
+                    model.setIdCard(member.getIdcardNo());
+//                    model.setDuId(member.getDuId());
+//                    model.setDuName(member.getDuName());
                     model.setSex(member.getSex());
                 }else{
                     model.setSex(Constants.getSexByIdCard(model.getIdCard()));
                 }
+            }else{
+                model.setSex(Constants.getSexByIdCard(model.getIdCard()));
             }
         }
         return dataList;
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
index 4848973..ce9af65 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java
@@ -14,6 +14,7 @@
 import com.doumee.dao.business.join.SolutionWorktypeJoinMapper;
 import com.doumee.dao.business.join.SolutionsJoinMapper;
 import com.doumee.dao.business.model.*;
+import com.doumee.service.business.CompanyService;
 import com.doumee.service.business.SolutionsService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -408,6 +409,45 @@
         return PageData.from(solutionsMapper.selectPage(page, queryWrapper));
     }
 
+
+    @Override
+    public List<Solutions> findListForCompany() {
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        List<Solutions> solutionsList = solutionsJoinMapper.selectJoinList(Solutions.class,new MPJLambdaWrapper<Solutions>()
+                        .selectAll(Solutions.class)
+                .leftJoin(CompanySolution.class,CompanySolution::getSolutionBaseId,Solutions::getId)
+                .eq(Solutions::getIsdeleted,Constants.ZERO)
+                .eq(Solutions::getDataType,Constants.TWO)
+                .eq(CompanySolution::getIsdeleted,Constants.ZERO)
+                .eq(CompanySolution::getCompanyId,user.getCompanyId())
+                .orderByAsc(Solutions::getSortnum)
+        );
+
+//        solutionsList.forEach(i->{
+//            //淇濋櫓鏃堕棿鍗曚綅 涓� 鏈�灏忔姇淇濆懆鏈熸椂闂村崟浣� 瑙勫垯鐩稿悓 鎴栬�� 鏈�灏忔姇淇濆懆鏈熸椂闂村崟浣� 瑙勫垯涓� 澶╂椂 榛樿閲戦
+//            if(i.getTimeUnit().equals(i.getInsureCycleUnit())||i.getInsureCycleUnit().equals(Constants.ZERO)){
+//                i.setCyclePrice(i.getPrice());
+//            }else{
+//                if(i.getInsureCycleUnit().equals(Constants.ONE)){
+//                    //鏈�灏忔姇淇濆懆鏈熸椂闂村崟浣嶄负鍗婃湀
+//                    i.setCyclePrice(i.getPrice().multiply(new BigDecimal(15)));
+//                }else if(i.getInsureCycleUnit().equals(Constants.TWO)){
+//                    //鏈�灏忔姇淇濆懆鏈熸椂闂村崟浣嶄负鏈� 鍒欒绠楀綋鏈堝灏戝ぉ
+//                    if( ){
+//
+//                    }
+//                }
+//            }
+//        });
+        return solutionsList;
+    }
+
+
+
+
+
+
+
     @Override
     public long count(Solutions solutions) {
         QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
index e560f5e..b88ae19 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/TaxesServiceImpl.java
@@ -503,7 +503,7 @@
             }
         }
         if(!Objects.isNull(insuranceApply)){
-            TaxesInvoicingVO taxesInvoicingVO = insuranceApply.getTaxesInvoicingVO();
+            TaxesInvoicingVO taxesInvoicingVO = insuranceApply.toTaxesInvoicingVO();
             taxesInvoicingVOList.add(taxesInvoicingVO);
         }
     }

--
Gitblit v1.9.3