Selaa lähdekoodia

Merge remote-tracking branch 'origin/test' into test

haoyu 2 vuotta sitten
vanhempi
commit
76d852cf6a
87 muutettua tiedostoa jossa 4023 lisäystä ja 409 poistoa
  1. 2 0
      src/main/java/com/ydtech/SpringInsApplication.java
  2. 102 0
      src/main/java/com/ydtech/modules/admin/controller/AppReportController.java
  3. 14 0
      src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java
  4. 1 1
      src/main/java/com/ydtech/modules/admin/controller/SysUserBankController.java
  5. 25 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserAccountHistoryMapper.java
  6. 2 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserAccountMapper.java
  7. 3 0
      src/main/java/com/ydtech/modules/admin/dao/SysUserBankCardMapper.java
  8. 25 0
      src/main/java/com/ydtech/modules/admin/model/dto/AllpremiumDto.java
  9. 42 0
      src/main/java/com/ydtech/modules/admin/model/dto/EmployeeIncreaseReportAllDto.java
  10. 32 0
      src/main/java/com/ydtech/modules/admin/model/dto/EmployeeIncreaseReportDto.java
  11. 60 0
      src/main/java/com/ydtech/modules/admin/model/dto/PremiumReportAllDto.java
  12. 41 0
      src/main/java/com/ydtech/modules/admin/model/dto/PremiumReportDto.java
  13. 60 0
      src/main/java/com/ydtech/modules/admin/model/dto/RevenueReportAllDto.java
  14. 45 0
      src/main/java/com/ydtech/modules/admin/model/dto/RevenueReportDto.java
  15. 6 2
      src/main/java/com/ydtech/modules/admin/model/po/SysUserAccount.java
  16. 6 0
      src/main/java/com/ydtech/modules/admin/model/po/SysUserBankCard.java
  17. 34 0
      src/main/java/com/ydtech/modules/admin/model/vo/ReportQueryVo.java
  18. 4 1
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java
  19. 2 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserBankCardVO.java
  20. 46 0
      src/main/java/com/ydtech/modules/admin/service/AppReportService.java
  21. 3 0
      src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java
  22. 2 0
      src/main/java/com/ydtech/modules/admin/service/SysUserBankCardService.java
  23. 317 0
      src/main/java/com/ydtech/modules/admin/service/impl/AppReportServiceImpl.java
  24. 101 8
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java
  25. 6 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserBankCardServiceImpl.java
  26. 105 0
      src/main/java/com/ydtech/modules/admin/utils/SliceUpDateUtil.java
  27. 30 5
      src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java
  28. 43 21
      src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java
  29. 36 0
      src/main/java/com/ydtech/modules/fnc/controller/ImportAsyncController.java
  30. 178 68
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  31. 14 0
      src/main/java/com/ydtech/modules/fnc/dao/ImportAsyncMapper.java
  32. 2 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  33. 79 0
      src/main/java/com/ydtech/modules/fnc/entity/ImportResult.java
  34. 15 2
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  35. 4 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java
  36. 27 0
      src/main/java/com/ydtech/modules/fnc/service/ImportAsyncService.java
  37. 5 0
      src/main/java/com/ydtech/modules/fnc/service/InsFeeAuditService.java
  38. 9 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  39. 631 0
      src/main/java/com/ydtech/modules/fnc/service/impl/ImportAsyncServiceImpl.java
  40. 143 100
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  41. 177 17
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  42. 14 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  43. 56 0
      src/main/java/com/ydtech/modules/fnc/vo/ImportResultVo.java
  44. 3 0
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java
  45. 1 1
      src/main/java/com/ydtech/modules/ins/model/guoren/NonAutoInsOrderReq.java
  46. 7 0
      src/main/java/com/ydtech/modules/ins/model/vo/CarInfoVo.java
  47. 9 9
      src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java
  48. 43 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsBxOtherExcelDto.java
  49. 35 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsImportResult.java
  50. 32 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsNoBxOtherExcelDto.java
  51. 4 0
      src/main/java/com/ydtech/modules/order/components/huatai/HuaTaiRepeatInsuranceComponents.java
  52. 70 8
      src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java
  53. 2 2
      src/main/java/com/ydtech/modules/order/controller/YongChengOrderApiController.java
  54. 15 0
      src/main/java/com/ydtech/modules/order/dao/BatchOrderMapper.java
  55. 30 0
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java
  56. 30 0
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyPositionMapper.java
  57. 95 0
      src/main/java/com/ydtech/modules/order/entity/BatchOrder.java
  58. 64 0
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyPosition.java
  59. 21 0
      src/main/java/com/ydtech/modules/order/entity/vo/BatchOrderAuditVo.java
  60. 29 0
      src/main/java/com/ydtech/modules/order/entity/vo/BatchOrderQueryVo.java
  61. 28 0
      src/main/java/com/ydtech/modules/order/entity/vo/BatchOrderVo.java
  62. 43 0
      src/main/java/com/ydtech/modules/order/service/BatchOrderService.java
  63. 25 0
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyPositionService.java
  64. 1 0
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java
  65. 165 0
      src/main/java/com/ydtech/modules/order/service/impl/BatchOrderServiceImpl.java
  66. 58 0
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyPositionServiceImpl.java
  67. 11 11
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  68. 24 26
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  69. 0 1
      src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java
  70. 1 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java
  71. 4 1
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java
  72. 107 64
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  73. 20 22
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  74. 2 1
      src/main/java/com/ydtech/modules/ser/service/impl/SerRescueOrderServiceImpl.java
  75. 25 0
      src/main/java/com/ydtech/utils/StringOperations.java
  76. 25 0
      src/main/java/com/ydtech/utils/async/AsyncUtils.java
  77. 4 4
      src/main/resources/mapper/modules/admin/SysAmountAuditingMapper.xml
  78. 76 0
      src/main/resources/mapper/modules/admin/SysUserAccountHistoryMapper.xml
  79. 49 3
      src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml
  80. 13 0
      src/main/resources/mapper/modules/admin/SysUserBankCardMapper.xml
  81. 48 0
      src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml
  82. 30 0
      src/main/resources/mapper/modules/fnc/ImportAsyncMapper.xml
  83. 143 6
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  84. 68 25
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  85. 14 0
      src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml
  86. BIN
      src/main/resources/template/noHandlingFeeTemplate.xlsx
  87. BIN
      src/main/resources/template/otherBatchUpdate.xlsx

+ 2 - 0
src/main/java/com/ydtech/SpringInsApplication.java

@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 
@@ -31,6 +32,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @SpringBootApplication
 @MapperScan({"com.ydtech.modules.*.dao"})
 @EnableScheduling // 开启定时任务功能
+@EnableAsync     //开启异步
 @EnableCaching
 public class SpringInsApplication {
 

+ 102 - 0
src/main/java/com/ydtech/modules/admin/controller/AppReportController.java

@@ -0,0 +1,102 @@
+package com.ydtech.modules.admin.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.dto.AllpremiumDto;
+import com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportAllDto;
+import com.ydtech.modules.admin.model.dto.PremiumReportAllDto;
+import com.ydtech.modules.admin.model.dto.RevenueReportAllDto;
+import com.ydtech.modules.admin.model.vo.ReportQueryVo;
+import com.ydtech.modules.admin.service.AppReportService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@Api(tags = "app统计报表功能")
+@RestController
+@RequestMapping("/app/reporet")
+@RequiredArgsConstructor
+public class AppReportController {
+
+    @Autowired
+    private AppReportService appReportService;
+
+    @ApiOperation(value = "保费报表")
+    @PostMapping(value = "/premiumReport")
+    public HttpResult<PremiumReportAllDto> premiumReport(@RequestBody ReportQueryVo reportQueryVo) {
+        getListHttpResult(reportQueryVo);
+        try{
+            return appReportService.premiumReport(reportQueryVo);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 15:58
+     *  @Description: 参数验证
+     */
+    private static void getListHttpResult(ReportQueryVo reportQueryVo) {
+        if(StringUtils.isBlank(reportQueryVo.getSearchType())){
+            new SystemException("查询类型(1.年2.月3.日)searchtype不能为空");
+        }
+        //年
+        if("1".equals(reportQueryVo.getSearchType())){
+            if(StringUtils.isBlank(reportQueryVo.getSearchYear())){
+                new SystemException("查询类型为(1.年)时searchYear不能为空");
+            }
+        }
+        if("2".equals(reportQueryVo.getSearchType())){
+            if(StringUtils.isBlank(reportQueryVo.getSearchMonth()) || StringUtils.isBlank(reportQueryVo.getSearchYear()) ){
+                new SystemException("查询类型为(3.月)时searchYear,searchMonth不能为空");
+            }
+        }
+        if("3".equals(reportQueryVo.getSearchType())){
+            if(StringUtils.isBlank(reportQueryVo.getSearchDay()) || StringUtils.isBlank(reportQueryVo.getSearchMonth()) ||  StringUtils.isBlank(reportQueryVo.getSearchYear())){
+                new SystemException("查询类型为(3.日)时searchYear,searchMonth,searchDay不能为空");
+            }
+        }
+    }
+
+    @ApiOperation(value = "增员报表")
+    @PostMapping(value = "/employeeIncreaseReport")
+    public HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(@RequestBody ReportQueryVo reportQueryVo) {
+        getListHttpResult(reportQueryVo);
+        try{
+            return appReportService.employeeIncreaseReport(reportQueryVo);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+
+
+    @ApiOperation(value = "收入报表")
+    @PostMapping(value = "/revenueReport")
+    public HttpResult<RevenueReportAllDto> revenueReport(@RequestBody ReportQueryVo reportQueryVo) {
+        getListHttpResult(reportQueryVo);
+        try{
+            return appReportService.revenueReport(reportQueryVo);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+
+    @ApiOperation(value = "获取年度数据")
+    @GetMapping(value = "/getAllpremium")
+    public HttpResult<AllpremiumDto> getAllpremium(String year) {
+        if(StringUtils.isBlank(year)){
+            return HttpResult.error("年度year不能为空!!!");
+        }
+        try{
+            return HttpResult.ok(appReportService.getAllpremium(year));
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+}

+ 14 - 0
src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java

@@ -32,12 +32,26 @@ public class SysUserAccountController extends BaseController {
         return HttpResult.ok("success", result);
     }
 
+    @PostMapping("/queryPageList")
+    @ApiOperation(value = "用户账户表分页2")
+    public HttpResult<BasePageResult<SysUserAccount>> queryPageList(@RequestBody SysUserAccountVo sysUserAccountVo ) {
+        BasePageResult<SysUserAccount> result = sysUserAccountService.queryByVo1(sysUserAccountVo);
+        return HttpResult.ok("success", result);
+    }
+
+
     @PostMapping("/insert")
     @ApiOperation("提交")
     public HttpResult<Object> submit(@RequestBody SysUserAccountVo sysUserAccountVo) {
         return sysUserAccountService.inert(sysUserAccountVo);
     }
 
+    @PostMapping("/withdraw")
+    @ApiOperation("提现")
+    public HttpResult withdraw(@RequestBody SysUserAccountVo sysUserAccountVo) {
+        return sysUserAccountService.withdraw(sysUserAccountVo);
+    }
+
     @GetMapping(value = "/getSysUserAmount")
     @ApiOperation("用户账户余额")
     public HttpResult<SysUserAccount> getSysUserAmount(@RequestParam String userid) {

+ 1 - 1
src/main/java/com/ydtech/modules/admin/controller/SysUserBankController.java

@@ -71,7 +71,7 @@ public class SysUserBankController extends BaseController {
     @ApiOperation("审核卡号开户行")
     public HttpResult<Object> auditByBankNumber(@RequestBody SysUserBankCardVO sysUserBankCardVO) {
         bankCardService.auditByBankNumber(sysUserBankCardVO);
-        return HttpResult.ok("新增成功");
+        return HttpResult.ok("审核成功");
     }
 
     @GetMapping("getUserBankList")

+ 25 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserAccountHistoryMapper.java

@@ -1,8 +1,12 @@
 package com.ydtech.modules.admin.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.admin.model.dto.RevenueReportDto;
 import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
 
+import java.util.HashMap;
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【sys_user_account_history(用户账户表)】的数据库操作Mapper
@@ -11,6 +15,27 @@ import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
 */
 public interface SysUserAccountHistoryMapper extends BaseMapper<SysUserAccountHistory> {
 
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:38
+     *  @Description: 查询年分
+     */
+    List<RevenueReportDto> revenueReportYear(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:39
+     *  @Description: 月分
+     */
+    List<RevenueReportDto> revenueReportMonth(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:39
+     *  @Description: 日
+     */
+    List<RevenueReportDto> revenueReportDay(HashMap<String,String> map);
 }
 
 

+ 2 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserAccountMapper.java

@@ -20,6 +20,8 @@ public interface SysUserAccountMapper extends BaseMapper<SysUserAccount> {
 
     Page<SysUserAccount> queryPageOrder(SysUserAccountVo sysUserAccountVo,@Param("page") Page page);
 
+    Page<SysUserAccount> queryPageOrder1(SysUserAccountVo sysUserAccountVo,@Param("page") Page page);
+
     SysUserAccount getById(String userId);
 
 }

+ 3 - 0
src/main/java/com/ydtech/modules/admin/dao/SysUserBankCardMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.po.SysUserBankCard;
 import com.ydtech.modules.admin.model.vo.SysUserBankCardVO;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -18,6 +19,8 @@ public interface SysUserBankCardMapper extends BaseMapper<SysUserBankCard> {
 
     HttpResult<SysUserBankCardVO> getByUserId(String userId);
 
+    SysUserBankCard getByBankNumber(@Param("fromBankCardId") String bankNumber);
+
     List<SysUserBankCard> getUserBankList(String userId);
 }
 

+ 25 - 0
src/main/java/com/ydtech/modules/admin/model/dto/AllpremiumDto.java

@@ -0,0 +1,25 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/7 15:13
+ *  @Description:
+ */
+@Data
+@ApiModel("年度数据")
+public class AllpremiumDto implements Serializable {
+
+    @ApiModelProperty(value = "年度签单保费")
+    private BigDecimal sumPremium;
+
+    @ApiModelProperty(value = "年度签单数")
+    private int sumCount;
+}

+ 42 - 0
src/main/java/com/ydtech/modules/admin/model/dto/EmployeeIncreaseReportAllDto.java

@@ -0,0 +1,42 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/6 9:14
+ *  @Description: 保费统计的数据
+ */
+@Data
+@ApiModel("增援报表统计返回对象")
+public class EmployeeIncreaseReportAllDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "增员人数")
+    private int  employeeIncreaseCount;
+
+    @ApiModelProperty(value = "日期横向集合")
+    private List<String>  dateList=new ArrayList<String>();
+
+    @ApiModelProperty(value = "增员人数集合")
+    private List<Integer>  employeeIncreaseReportList=new ArrayList<Integer>();
+
+    public EmployeeIncreaseReportAllDto() {
+    }
+
+    public EmployeeIncreaseReportAllDto(String reportDate, int employeeIncreaseCount, List<String> dateList, List<Integer> employeeIncreaseReportList) {
+        this.reportDate = reportDate;
+        this.employeeIncreaseCount = employeeIncreaseCount;
+        this.dateList = dateList;
+        this.employeeIncreaseReportList = employeeIncreaseReportList;
+    }
+}

+ 32 - 0
src/main/java/com/ydtech/modules/admin/model/dto/EmployeeIncreaseReportDto.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:28
+ *  @Description: 增援报表统计  查询推荐人数据表
+ */
+@Data
+@ApiModel("增援报表统计")
+public class EmployeeIncreaseReportDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "增员人数")
+    private int  employeeIncreaseCount;
+
+    public EmployeeIncreaseReportDto() {
+    }
+
+    public EmployeeIncreaseReportDto(String reportDate, int employeeIncreaseCount) {
+        this.reportDate = reportDate;
+        this.employeeIncreaseCount = employeeIncreaseCount;
+    }
+}

+ 60 - 0
src/main/java/com/ydtech/modules/admin/model/dto/PremiumReportAllDto.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/6 9:14
+ *  @Description: 保费统计的数据
+ */
+@Data
+@ApiModel("保费报表统计返回对象")
+public class PremiumReportAllDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "交强保费")
+    private BigDecimal jqPremium;
+
+    @ApiModelProperty(value = "商业保费")
+    private BigDecimal syPremium;
+
+    @ApiModelProperty(value = "总保费")
+    private BigDecimal sumPremium;
+
+    @ApiModelProperty(value = "日期横向集合")
+    private List<String>  dateList=new ArrayList<String>();
+
+    @ApiModelProperty(value = "交强保费集合")
+    private List<BigDecimal>  jqPremiumList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "商业保费集合")
+    private List<BigDecimal>  syPremiumList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "总保费集合")
+    private List<BigDecimal>  sumPremiumList=new ArrayList<BigDecimal>();
+
+
+    public PremiumReportAllDto() {
+    }
+
+    public PremiumReportAllDto(String reportDate, BigDecimal jqPremium, BigDecimal syPremium, BigDecimal sumPremium, List<String> dateList, List<BigDecimal> jqPremiumList,List<BigDecimal> syPremiumList,List<BigDecimal> sumPremiumList) {
+        this.reportDate = reportDate;
+        this.jqPremium = jqPremium;
+        this.syPremium = syPremium;
+        this.sumPremium = sumPremium;
+        this.dateList = dateList;
+        this.jqPremiumList = jqPremiumList;
+        this.syPremiumList = syPremiumList;
+        this.sumPremiumList = sumPremiumList;
+    }
+}

+ 41 - 0
src/main/java/com/ydtech/modules/admin/model/dto/PremiumReportDto.java

@@ -0,0 +1,41 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:28
+ *  @Description: 保费报表统计  查询渠道的数据表
+ */
+@Data
+@ApiModel("保费报表统计")
+public class PremiumReportDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "交强保费")
+    private BigDecimal  jqPremium;
+
+    @ApiModelProperty(value = "商业保费")
+    private BigDecimal syPremium;
+
+    @ApiModelProperty(value = "总保费")
+    private BigDecimal sumPremium;
+
+    public PremiumReportDto() {
+    }
+
+    public PremiumReportDto(String reportDate, BigDecimal jqPremium, BigDecimal syPremium, BigDecimal sumPremium) {
+        this.reportDate = reportDate;
+        this.jqPremium = jqPremium;
+        this.syPremium = syPremium;
+        this.sumPremium = sumPremium;
+    }
+}

+ 60 - 0
src/main/java/com/ydtech/modules/admin/model/dto/RevenueReportAllDto.java

@@ -0,0 +1,60 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/6 9:14
+ *  @Description: 收入报表的数据
+ */
+@Data
+@ApiModel("收入报表统计返回对象")
+public class RevenueReportAllDto implements Serializable {
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "手续费金额")
+    private BigDecimal  haldingAmount;
+
+    @ApiModelProperty(value = "非跟单金额")
+    private BigDecimal documentaryAmount;
+
+    @ApiModelProperty(value = "推广费金额")
+    private BigDecimal promotionAmount;
+
+    @ApiModelProperty(value = "日期横向集合")
+    private List<String>  dateList=new ArrayList<String>();
+
+
+    @ApiModelProperty(value = "手续费金额集合")
+    private List<BigDecimal>  haldingAmountList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "非跟单金额集合")
+    private List<BigDecimal>  documentaryAmountList=new ArrayList<BigDecimal>();
+
+    @ApiModelProperty(value = "推广费金额集合")
+    private List<BigDecimal>  promotionAmountList=new ArrayList<BigDecimal>();
+
+    public RevenueReportAllDto() {
+    }
+
+    public RevenueReportAllDto(String reportDate, BigDecimal haldingAmount, BigDecimal documentaryAmount, BigDecimal promotionAmount, List<String> dateList, List<BigDecimal> haldingAmountList, List<BigDecimal> documentaryAmountList, List<BigDecimal> promotionAmountList) {
+        this.reportDate = reportDate;
+        this.haldingAmount = haldingAmount;
+        this.documentaryAmount = documentaryAmount;
+        this.promotionAmount = promotionAmount;
+        this.dateList = dateList;
+        this.haldingAmountList = haldingAmountList;
+        this.documentaryAmountList = documentaryAmountList;
+        this.promotionAmountList = promotionAmountList;
+    }
+}

+ 45 - 0
src/main/java/com/ydtech/modules/admin/model/dto/RevenueReportDto.java

@@ -0,0 +1,45 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:29
+ *  @Description: 收入报表统计  费用的记录表数据
+ */
+@Data
+@ApiModel("收入报表统计")
+public class RevenueReportDto implements Serializable {
+
+
+    @ApiModelProperty(value = "统计时间")
+    private String reportDate;
+
+    @ApiModelProperty(value = "手续费金额")
+    private BigDecimal  haldingAmount;
+
+    @ApiModelProperty(value = "非跟单金额")
+    private BigDecimal documentaryAmount;
+
+    @ApiModelProperty(value = "推广费金额")
+    private BigDecimal promotionAmount;
+
+
+    private String property;
+
+    public RevenueReportDto() {
+    }
+
+    public RevenueReportDto(String reportDate, BigDecimal haldingAmount, BigDecimal documentaryAmount, BigDecimal promotionAmount) {
+        this.reportDate = reportDate;
+        this.haldingAmount = haldingAmount;
+        this.documentaryAmount = documentaryAmount;
+        this.promotionAmount = promotionAmount;
+    }
+}

+ 6 - 2
src/main/java/com/ydtech/modules/admin/model/po/SysUserAccount.java

@@ -3,11 +3,13 @@ package com.ydtech.modules.admin.model.po;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 用户账户表
@@ -107,12 +109,14 @@ public class SysUserAccount implements Serializable {
     private  String  documentaryStatus;
     @TableField(exist = false)
     private String  suborderId;
-
     @TableField(exist = false)
     private  String  deptName;
     @TableField(exist = false)
     private  String  name;
-
     @TableField(exist = false)
     private  String  deptId;
+
+    @ApiModelProperty(value = "所属账户下的卡")
+    @TableField(exist = false)
+    List<SysUserBankCard> sysUserAccountCardList;
 }

+ 6 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysUserBankCard.java

@@ -66,6 +66,12 @@ public class SysUserBankCard implements Serializable {
     @TableField(value = "create_time",fill = FieldFill.INSERT_UPDATE)
     private Date createTime;
 
+    /**
+     * 备注
+     */
+    @TableField(value = "remark")
+    private String remark;
+
     @TableField(value = "audit_status")
     private String auditStatus;
 

+ 34 - 0
src/main/java/com/ydtech/modules/admin/model/vo/ReportQueryVo.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.admin.model.vo;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:20
+ *  @Description: 报表查询前台的分装
+ */
+@Data
+@ApiModel("报表查询前台查询实体")
+public class ReportQueryVo implements Serializable {
+
+
+    @ApiModelProperty("查询类型 1 年  2.月  3.日")
+    private String searchType;
+
+    @ApiModelProperty("年")
+    private String searchYear;
+
+    @ApiModelProperty("月")
+    private String searchMonth;
+
+    @ApiModelProperty("日")
+    private String searchDay;
+
+}

+ 4 - 1
src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java

@@ -74,6 +74,9 @@ public class SysUserAccountVo {
     @ApiModelProperty(value = "部门id")
     private String  deptName;
 
+    @ApiModelProperty(value = "卡号")
+    private String bankNumber;
+
 
 
 
@@ -100,7 +103,7 @@ public class SysUserAccountVo {
 
 
     @ApiModelProperty(value = "银行卡Id")
-    private Long fromBankCardId;
+    private String fromBankCardId;
 
 
     @ApiModelProperty(value = "预收手续费佣金")

+ 2 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserBankCardVO.java

@@ -54,6 +54,8 @@ public class SysUserBankCardVO {
     @TableField(value = "audit_user_id")
     private String auditUserId;
 
+    @TableField(value = "remark")
+    private String remark;
     @ApiModelProperty(value = "每页页数")
     @Min(value = 20, message = "页数最小为20")
     @Max(value = 100, message = "页数最大为100")

+ 46 - 0
src/main/java/com/ydtech/modules/admin/service/AppReportService.java

@@ -0,0 +1,46 @@
+package com.ydtech.modules.admin.service;
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.dto.AllpremiumDto;
+import com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportAllDto;
+import com.ydtech.modules.admin.model.dto.PremiumReportAllDto;
+import com.ydtech.modules.admin.model.dto.RevenueReportAllDto;
+import com.ydtech.modules.admin.model.vo.ReportQueryVo;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:24
+ *  @Description: app 相关报表统计
+ */
+public interface AppReportService {
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 15:58
+     *  @Description: 保费报表统计
+     */
+    HttpResult<PremiumReportAllDto> premiumReport(ReportQueryVo reportQueryVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:03
+     *  @Description: 增援报表统计
+     */
+    HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(ReportQueryVo reportQueryVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:04
+     *  @Description: 收入报表统计
+     */
+    HttpResult<RevenueReportAllDto> revenueReport(ReportQueryVo reportQueryVo);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/7 15:16
+     *  @Description: 获取所有的签单数和签单金额
+     */
+    AllpremiumDto getAllpremium(String year);
+}

+ 3 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java

@@ -18,9 +18,12 @@ public interface SysUserAccountService extends IService<SysUserAccount> {
 
     BasePageResult<SysUserAccount> queryByVo(SysUserAccountVo sysUserAccountVo);
 
+    BasePageResult<SysUserAccount> queryByVo1(SysUserAccountVo sysUserAccountVo);
 
     HttpResult<Object> inert(SysUserAccountVo sysUserAccountVo);
 
+    HttpResult withdraw(SysUserAccountVo sysUserAccountVo);
+
     SysUserAccount getSysUserAmount(String userid);
 
     SysUserAccountVo getSysAllAmount(String userId);

+ 2 - 0
src/main/java/com/ydtech/modules/admin/service/SysUserBankCardService.java

@@ -27,6 +27,8 @@ public interface SysUserBankCardService extends IService<SysUserBankCard> {
 
     HttpResult<SysUserBankCardVO>   getByUserId(String userId);
 
+    SysUserBankCard getByBankNumber(String bankNumber);
+
     void insertByBankNumber(SysUserBankCardVO sysUserBankCardVO);
 
     void auditByBankNumber(SysUserBankCardVO sysUserBankCardVO);

+ 317 - 0
src/main/java/com/ydtech/modules/admin/service/impl/AppReportServiceImpl.java

@@ -0,0 +1,317 @@
+package com.ydtech.modules.admin.service.impl;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.dao.SysUserAccountHistoryMapper;
+import com.ydtech.modules.admin.model.dto.*;
+import com.ydtech.modules.admin.model.vo.ReportQueryVo;
+import com.ydtech.modules.admin.service.AppReportService;
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.esm.dao.EsmUserReferrerMapper;
+import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/5 15:25
+ *  @Description:  报表统计页面
+ */
+@Service
+public class AppReportServiceImpl implements AppReportService {
+
+
+
+    @Autowired
+    private InsAreaCompanyMapper insAreaCompanyMapper;
+
+    @Autowired
+    private EsmUserReferrerMapper esmUserReferrerMapper;
+
+    @Autowired
+    private SysUserAccountHistoryMapper sysUserAccountHistoryMapper;
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:05
+     *  @Description: 保费报表统计
+     */
+    @Override
+    public HttpResult<PremiumReportAllDto> premiumReport(ReportQueryVo reportQueryVo) {
+        //年分查询当年12月的数据
+        if("1".equals(reportQueryVo.getSearchType())){
+            List<PremiumReportDto> allList= insAreaCompanyMapper.premiumReportYear(getDateMap(reportQueryVo));
+            return HttpResult.ok(getPremiumReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
+        }
+        //月分查询当月的数据
+        if("2".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
+            List<PremiumReportDto> allList= insAreaCompanyMapper.premiumReportMonth(getDateMap(reportQueryVo));
+            return HttpResult.ok(getPremiumReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
+        }
+        //日查询当日的前20条数据
+        if("3".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
+            List<PremiumReportDto> allList= insAreaCompanyMapper.premiumReportDay(getDateMap(reportQueryVo));
+            return HttpResult.ok(getPremiumReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
+        }
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:07
+     *  @Description:  处理日期返回对应的数据
+     */
+    private static List<String> getDateStrings(ReportQueryVo reportQueryVo) {
+        //获取所有的月分
+        if("1".equals(reportQueryVo.getSearchType())){
+            return SliceUpDateUtil.sliceUpDateRange(SliceUpDateUtil.getFirstDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear())),
+                    SliceUpDateUtil.getLastDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear())), 2);
+        }
+        //获取所有的日
+        if("2".equals(reportQueryVo.getSearchType())){
+            int year = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[0]);
+            int month = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[1].replaceAll("^0+", ""));
+            return SliceUpDateUtil.sliceUpDateRange(SliceUpDateUtil.getFirstDayStringByMonth(year,month),
+                    SliceUpDateUtil.getLastDayStringByMonth(year,month), 3);
+        }
+        //获取所有的时
+        if("3".equals(reportQueryVo.getSearchType())){
+            return SliceUpDateUtil.sliceUpDateRange(reportQueryVo.getSearchDay()+" 00",
+                    reportQueryVo.getSearchDay()+" 23", 4);
+        }
+        return new ArrayList<String>();
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 15:05
+     *  @Description:  获取开始和结束时间
+     */
+    private static HashMap<String,String> getDateMap(ReportQueryVo reportQueryVo) {
+        HashMap<String,String> map=new HashMap<String,String>();
+        String beginTime="";
+        String endTime="";
+        //获取所有的月分
+        if("1".equals(reportQueryVo.getSearchType())){
+            beginTime = SliceUpDateUtil.getFirstDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear()))+" 00:00:00";
+            endTime = SliceUpDateUtil.getLastDayStringByYear(Integer.parseInt(reportQueryVo.getSearchYear()))+" 23:59:59";
+        }
+        //获取所有的日
+        if("2".equals(reportQueryVo.getSearchType())){
+            int year = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[0]);
+            int month = Integer.parseInt(reportQueryVo.getSearchMonth().split("-")[1].replaceAll("^0+", ""));
+            beginTime = SliceUpDateUtil.getFirstDayStringByMonth(year,month)+" 00:00:00";
+            endTime = SliceUpDateUtil.getLastDayStringByMonth(year,month)+" 23:59:59";
+        }
+        //获取所有的时
+        if("3".equals(reportQueryVo.getSearchType())){
+            beginTime = reportQueryVo.getSearchDay()+" 00:00:00";
+            endTime = reportQueryVo.getSearchDay()+" 23:59:59";
+        }
+        map.put("beginTime",beginTime);
+        map.put("endTime",endTime);
+        map.put("userId",BaseController.getUser().getId());
+        return map;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:02
+     *  @Description:  处理保费的数据
+     */
+    private static PremiumReportAllDto getPremiumReportAllDto(List<PremiumReportDto> allList, List<String> dateStrs, String dateStr) {
+        List<PremiumReportDto> list =new ArrayList<>();
+        BigDecimal  jqPremium =BigDecimal.ZERO;
+        BigDecimal syPremium=BigDecimal.ZERO;
+        BigDecimal sumPremium=BigDecimal.ZERO;
+        List<BigDecimal> jqPremiumList =new ArrayList<>();
+        List<BigDecimal> syPremiumList =new ArrayList<>();
+        List<BigDecimal> sumPremiumList =new ArrayList<>();
+        LinkedHashMap<String,PremiumReportDto> map=new LinkedHashMap<String,PremiumReportDto>();
+        if(allList !=null && allList.size()>0){
+            for(PremiumReportDto premiumReportDto: allList){
+                map.put(premiumReportDto.getReportDate(),premiumReportDto);
+            }
+            for(String str: dateStrs){
+               if(map.get(str)==null){
+                   jqPremiumList.add(BigDecimal.ZERO);
+                   syPremiumList.add(BigDecimal.ZERO);
+                   sumPremiumList.add(BigDecimal.ZERO);
+                   list.add(new PremiumReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
+               }else{
+                   jqPremium=jqPremium.add(map.get(str).getJqPremium());
+                   syPremium=syPremium.add(map.get(str).getSyPremium());
+                   sumPremium=sumPremium.add(map.get(str).getSumPremium());
+                   jqPremiumList.add(map.get(str).getJqPremium());
+                   syPremiumList.add(map.get(str).getSyPremium());
+                   sumPremiumList.add(map.get(str).getSumPremium());
+                   list.add(map.get(str));
+               }
+            }
+        }else {
+            for (String str : dateStrs) {
+                jqPremiumList.add(BigDecimal.ZERO);
+                syPremiumList.add(BigDecimal.ZERO);
+                sumPremiumList.add(BigDecimal.ZERO);
+                list.add(new PremiumReportDto(str, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO));
+            }
+        }
+        return new PremiumReportAllDto(dateStr,jqPremium,syPremium,sumPremium,dateStrs,jqPremiumList,syPremiumList,sumPremiumList);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:02
+     *  @Description:  处理增员的数据
+     */
+    private static EmployeeIncreaseReportAllDto getEmployeeIncreaseReportAllDto(List<EmployeeIncreaseReportDto> allList, List<String> dateStrs, String dateStr) {
+        List<EmployeeIncreaseReportDto> list =new ArrayList<>();
+        LinkedHashMap<String,EmployeeIncreaseReportDto> map=new LinkedHashMap<String,EmployeeIncreaseReportDto>();
+        int  employeeIncreaseCount=0;
+        List<Integer> employeeIncreaseList =new ArrayList<>();
+        if(allList !=null && allList.size()>0){
+            for(EmployeeIncreaseReportDto employeeIncreaseReportDto: allList){
+                map.put(employeeIncreaseReportDto.getReportDate(),employeeIncreaseReportDto);
+            }
+            for(String str: dateStrs){
+                if(map.get(str)==null){
+                    employeeIncreaseList.add(0);
+                    list.add(new EmployeeIncreaseReportDto(str,0));
+                }else{
+                    employeeIncreaseCount+=(map.get(str).getEmployeeIncreaseCount());
+                    employeeIncreaseList.add(map.get(str).getEmployeeIncreaseCount());
+                    list.add(map.get(str));
+                }
+            }
+        }else{
+            for(String str: dateStrs){
+                employeeIncreaseList.add(0);
+                list.add(new EmployeeIncreaseReportDto(str,0));
+            }
+        }
+        return new EmployeeIncreaseReportAllDto(dateStr,employeeIncreaseCount,dateStrs,employeeIncreaseList);
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/6 9:02
+     *  @Description:  处理收入报表的数据
+     */
+    private static RevenueReportAllDto getRevenueReportAllDto(List<RevenueReportDto> allList, List<String> dateStrs,String dateStr) {
+        List<RevenueReportDto> list =new ArrayList<RevenueReportDto>();
+        BigDecimal  haldingAmount =BigDecimal.ZERO;
+        BigDecimal documentaryAmount=BigDecimal.ZERO;
+        BigDecimal promotionAmount=BigDecimal.ZERO;
+        List<BigDecimal> haldingAmountList =new ArrayList<>();
+        List<BigDecimal> documentaryAmountList =new ArrayList<>();
+        List<BigDecimal> promotionAmountList =new ArrayList<>();
+        LinkedHashMap<String,RevenueReportDto> map=new LinkedHashMap<String,RevenueReportDto>();
+        if(allList !=null && allList.size()>0){
+            for(RevenueReportDto revenueReportDto: allList){
+                map.put(revenueReportDto.getReportDate(),revenueReportDto);
+            }
+            for(String str: dateStrs){
+                if(map.get(str)==null){
+                    haldingAmountList.add(BigDecimal.ZERO);
+                    documentaryAmountList.add(BigDecimal.ZERO);
+                    promotionAmountList.add(BigDecimal.ZERO);
+                    list.add(new RevenueReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
+                }else{
+                    haldingAmount=haldingAmount.add(map.get(str).getHaldingAmount());
+                    documentaryAmount=documentaryAmount.add(map.get(str).getDocumentaryAmount());
+                    promotionAmount=promotionAmount.add(map.get(str).getPromotionAmount());
+                    haldingAmountList.add(map.get(str).getHaldingAmount());
+                    documentaryAmountList.add(map.get(str).getDocumentaryAmount());
+                    promotionAmountList.add(map.get(str).getPromotionAmount());
+                    list.add(map.get(str));
+                }
+            }
+        }else {
+            for (String str : dateStrs) {
+                haldingAmountList.add(BigDecimal.ZERO);
+                documentaryAmountList.add(BigDecimal.ZERO);
+                promotionAmountList.add(BigDecimal.ZERO);
+                list.add(new RevenueReportDto(str,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO));
+            }
+        }
+        return new RevenueReportAllDto(dateStr,haldingAmount,documentaryAmount,promotionAmount,dateStrs,haldingAmountList,documentaryAmountList,promotionAmountList);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:05
+     *  @Description: 增援报表统计
+     */
+    @Override
+    public HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(ReportQueryVo reportQueryVo) {
+        //年分查询当年12月的数据
+        if("1".equals(reportQueryVo.getSearchType())){
+            List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportYear(getDateMap(reportQueryVo));
+            return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
+        }
+        //月分查询当月的数据
+        if("2".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
+            List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportMonth(getDateMap(reportQueryVo));
+            return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
+        }
+        //日查询当日的前20条数据
+        if("3".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
+            List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportDay(getDateMap(reportQueryVo));
+            return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
+        }
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:05
+     *  @Description:  收入报表统计
+     */
+    @Override
+    public HttpResult<RevenueReportAllDto> revenueReport(ReportQueryVo reportQueryVo) {
+        //年分查询当年12月的数据
+        if("1".equals(reportQueryVo.getSearchType())){
+            List<RevenueReportDto> allList= sysUserAccountHistoryMapper.revenueReportYear(getDateMap(reportQueryVo));
+            return HttpResult.ok(getRevenueReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
+        }
+        //月分查询当月的数据
+        if("2".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
+            List<RevenueReportDto> allList= sysUserAccountHistoryMapper.revenueReportMonth(getDateMap(reportQueryVo));
+            return HttpResult.ok(getRevenueReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
+        }
+        //日查询当日的前20条数据
+        if("3".equals(reportQueryVo.getSearchType())){
+            reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
+            List<RevenueReportDto> allList= sysUserAccountHistoryMapper.revenueReportDay(getDateMap(reportQueryVo));
+            return HttpResult.ok(getRevenueReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
+        }
+        return null;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/7 15:17
+     *  @Description:  查询签单数据
+     */
+    @Override
+    public AllpremiumDto getAllpremium(String year) {
+        return insAreaCompanyMapper.getAllpremium(year, BaseController.getUser().getId());
+    }
+}

+ 101 - 8
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.constants.MoneyAttrConstants;
 import com.ydtech.modules.admin.constants.WithdrawTypeConstants;
 import com.ydtech.modules.admin.dao.SysUserAccountMapper;
@@ -35,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -135,6 +137,7 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             sysUserAccountHistory.setUserId(sysUserAccount.getUserId());
             sysUserAccountHistory.setDocumentary(Integer.valueOf(sysUserAccount.getDocumentaryStatus()));
             sysUserAccountHistory.setSuborder(sysUserAccount.getSuborderId());
+            sysUserAccountHistory.setCreateTime(new Date());
             //跟单费
             if (sysUserAccount.getDocumentary() != null && sysUserAccount.getDocumentary().compareTo(BigDecimal.ZERO) != 0) {
                 sysUserAccountHistory.setAmount(sysUserAccount.getDocumentary());
@@ -188,6 +191,14 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         return new BasePageResult<>(sysUserAccountVo.getPageNum(), page.getSize(), sysUserAccountHistoryPage.getTotal(), page.getPages(),
                 sysUserAccountHistoryPage.getRecords());
     }
+    //
+    @Override
+    public BasePageResult<SysUserAccount> queryByVo1(SysUserAccountVo sysUserAccountVo) {
+        Page<SysUserAccount> page = new Page<>(sysUserAccountVo.getPageNum(), sysUserAccountVo.getPageSize());
+        Page<SysUserAccount> sysUserAccountHistoryPage = baseMapper.queryPageOrder1(sysUserAccountVo, page);
+        return new BasePageResult<>(sysUserAccountVo.getPageNum(), page.getSize(), sysUserAccountHistoryPage.getTotal(), page.getPages(),
+                sysUserAccountHistoryPage.getRecords());
+    }
 
     @Override
     @Transactional
@@ -204,12 +215,12 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         SysAmountAuditingEntity sysAmountAuditingEntity = new SysAmountAuditingEntity();//审核记录表
         sysAmountAuditingEntity.setUserId(userId);
         sysAmountAuditingEntity.setAmount(sysUserAccountVo.getAmount());
-        SysAmountAuditingEntity judge = sysAmountAuditingService.getByUserId(userId, sysUserAccountVo.getAmountStatus());
-        if (ObjectUtils.isNotEmpty(judge)) {
-            return HttpResult.ok("有未提现审核单据, 请审核完成之后再提现");
-        }
+//        SysAmountAuditingEntity judge = sysAmountAuditingService.getByUserId(userId, sysUserAccountVo.getAmountStatus());
+//        if (ObjectUtils.isNotEmpty(judge)) {
+//            return HttpResult.ok("有未提现审核单据, 请审核完成之后再提现");
+//        }
 //      通过银行卡id 查询卡包
-        Long fromBankCardId = sysUserAccountVo.getFromBankCardId();
+        String fromBankCardId = sysUserAccountVo.getFromBankCardId();
         if (fromBankCardId != null) {
             SysUserBankCard byId = sysUserBankCardService.getById(fromBankCardId);
 //            String bankUserId = byId.getUserId();
@@ -235,20 +246,102 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                     beforeAmount = sysUserAccount.getHandlingFee();
                     afterAmount = beforeAmount.subtract(amount);
                     sysUserAccount.setHandlingFee(afterAmount);
-                    sysUserAccount.setHandlingAmountPayment(amount);
+                    sysUserAccount.setHandlingAmountPayment(sysUserAccount.getHandlingAmountPayment().add(amount));
+                    sysUserAccount.setHandlingAmountWithdrawal(sysUserAccount.getHandlingAmountWithdrawal().add(amount));
+                } else if ("2".equals(sysUserAccountVo.getAmountStatus())) {
+//                    用户当前 非跟单佣金
+                    beforeAmount = sysUserAccount.getDocumentary();
+                    afterAmount = beforeAmount.subtract(amount);
+                    sysUserAccount.setDocumentary(afterAmount);
+                    sysUserAccount.setDocumentaryAmountpayment(sysUserAccount.getDocumentaryAmountpayment().add(amount));
+                    sysUserAccount.setDocumentaryAmountWithdrawal(sysUserAccount.getDocumentaryAmountWithdrawal().add(amount));
+                } else {
+                    beforeAmount = sysUserAccount.getPromotion();
+                    afterAmount = beforeAmount.subtract(amount);
+                    sysUserAccount.setPromotion(afterAmount);
+                    sysUserAccount.setPromotionAmountPayment(sysUserAccount.getPromotionAmountPayment().add(amount));
+                    sysUserAccount.setPromotionAmountWithdrawal(sysUserAccount.getPromotionAmountWithdrawal().add(amount));
+                }
+//              用户相差
+                if (beforeAmount.compareTo(zero) == 0 || afterAmount.compareTo(zero) < 0) {
+                    return HttpResult.ok("余额不足");
+                }
+                sysUserAccountHistory.setAmount(amount);  // 金额
+                sysUserAccountHistory.setSurplusAmount(afterAmount); // 剩余金额
+                sysUserAccountHistory.setUserAmount(beforeAmount);   // 用户剩余金额
+                sysAmountAuditingEntity.setCreateTime(new Date());
+                sysAmountAuditingEntity.setAuditingStatus("2");   // 2  为待审核  3  审核通过
+                sysAmountAuditingEntity.setAmountStatus(sysUserAccountVo.getAmountStatus());
+//              新增金额记录
+                sysAmountAuditingService.save(sysAmountAuditingEntity);
+                sysUserAccountHistory.setAuditiingId(sysAmountAuditingEntity.getId());
+                sysUserAccountService.updateById(sysUserAccount);
+                sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
+            }
+
+        }
+        return HttpResult.ok("提现成功,等待审核");
+    }
+
+    @Override
+    @Transactional
+    public HttpResult withdraw(SysUserAccountVo sysUserAccountVo) {
+        String userId = sysUserAccountVo.getUserId();
+        BigDecimal zero = BigDecimal.ZERO;
+        BigDecimal beforeAmount;
+        BigDecimal afterAmount;
+//       用户当前金额
+        BigDecimal amount = sysUserAccountVo.getAmount();
+        SysUserAccountHistory sysUserAccountHistory = new SysUserAccountHistory();  // 记录
+        sysUserAccountHistory.setDocumentary(1);  // 1提现
+        sysUserAccountHistory.setUserId(userId);
+        SysAmountAuditingEntity sysAmountAuditingEntity = new SysAmountAuditingEntity();//审核记录表
+        sysAmountAuditingEntity.setUserId(userId);
+        sysAmountAuditingEntity.setAmount(sysUserAccountVo.getAmount());
+//        SysAmountAuditingEntity judge = sysAmountAuditingService.getByUserId(userId, sysUserAccountVo.getAmountStatus());
+//        if (ObjectUtils.isNotEmpty(judge)) {
+//            throw new SystemException("有未提现审核单据, 请审核完成之后再提现");
+//        }
+//      通过银行卡id 查询卡包
+        String fromBankCardId = sysUserAccountVo.getFromBankCardId();
+        SysUserBankCard byId = sysUserBankCardService.getByBankNumber(fromBankCardId);
+        if (byId == null) {
+            throw new SystemException("该卡未绑定此账号,或输入卡号错误,或该账号尚未审核通过,请检查");
+        }
+        if (fromBankCardId != null && byId.getUserId().equals(userId)) {
+            byId.setIsDefault(1);
+
+            sysAmountAuditingEntity.setBankNumber(byId.getBankNumber());
+            sysUserAccountHistory.setFromBankCard(byId.getBankNumber());
+            sysUserBankCardService.updateById(byId);
+        }
+
+        if (StringUtils.isNotEmpty(userId)) {
+            SysUserAccount sysUserAccount = baseMapper.getById(userId);
+
+
+            if (StringUtils.isNotEmpty(sysUserAccountVo.getAmountStatus())) {
+                sysUserAccountHistory.setProperty(Integer.valueOf(sysUserAccountVo.getAmountStatus()));   //金额类型
+
+                if ("1".equals(sysUserAccountVo.getAmountStatus())) {
+//                  用户当前费用金
+                    beforeAmount = sysUserAccount.getHandlingFee();
+                    afterAmount = beforeAmount.subtract(amount);
+                    sysUserAccount.setHandlingFee(afterAmount);
+                    sysUserAccount.setHandlingAmountPayment(sysUserAccount.getHandlingAmountPayment().add(amount));
                     sysUserAccount.setHandlingAmountWithdrawal(sysUserAccount.getHandlingAmountWithdrawal().add(amount));
                 } else if ("2".equals(sysUserAccountVo.getAmountStatus())) {
 //                    用户当前 非跟单佣金
                     beforeAmount = sysUserAccount.getDocumentary();
                     afterAmount = beforeAmount.subtract(amount);
                     sysUserAccount.setDocumentary(afterAmount);
-                    sysUserAccount.setDocumentaryAmountpayment(amount);
+                    sysUserAccount.setDocumentaryAmountpayment(sysUserAccount.getDocumentaryAmountpayment().add(amount));
                     sysUserAccount.setDocumentaryAmountWithdrawal(sysUserAccount.getDocumentaryAmountWithdrawal().add(amount));
                 } else {
                     beforeAmount = sysUserAccount.getPromotion();
                     afterAmount = beforeAmount.subtract(amount);
                     sysUserAccount.setPromotion(afterAmount);
-                    sysUserAccount.setPromotionAmountPayment(amount);
+                    sysUserAccount.setPromotionAmountPayment(sysUserAccount.getPromotionAmountPayment().add(amount));
                     sysUserAccount.setPromotionAmountWithdrawal(sysUserAccount.getPromotionAmountWithdrawal().add(amount));
                 }
 //              用户相差

+ 6 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysUserBankCardServiceImpl.java

@@ -89,6 +89,11 @@ public class SysUserBankCardServiceImpl extends ServiceImpl<SysUserBankCardMappe
         return baseMapper.getByUserId(userId);
     }
 
+    @Override
+    public SysUserBankCard getByBankNumber(String bankNumber) {
+        return baseMapper.getByBankNumber(bankNumber);
+    }
+
     @Override
     @Transactional
     public void insertByBankNumber(SysUserBankCardVO sysUserBankCardVO) {
@@ -119,6 +124,7 @@ public class SysUserBankCardServiceImpl extends ServiceImpl<SysUserBankCardMappe
         sysUserBankCard.setAuditTime(new Date());
         sysUserBankCard.setAuditUserId(BaseController.getUser().getId());
         sysUserBankCard.setAuditUserName(BaseController.getUser().getName());
+        sysUserBankCard.setRemark(sysUserBankCardVO.getRemark());
         sysUserBankCardService.updateById(sysUserBankCard);
     }
 

+ 105 - 0
src/main/java/com/ydtech/modules/admin/utils/SliceUpDateUtil.java

@@ -0,0 +1,105 @@
+package com.ydtech.modules.admin.utils;
+
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+public class SliceUpDateUtil {
+
+    /**
+     * 日期范围 - 切片
+     *
+     *
+     * @param startDate 起始日期
+     * @param endDate   结束日期
+     * @param type 切片类型 1年  2月  3日  4小时
+     * @return          切片日期
+     */
+    public static List<String> sliceUpDateRange(String startDate, String endDate , int type ) {
+        List<String> rs = new ArrayList<>();
+
+        try {
+            int dt = Calendar.DATE;
+            String pattern = "yyyy-MM-dd";
+            if (type==1) {
+                pattern = "yyyy";
+                dt = Calendar.YEAR;
+            } else if (type==2) {
+                pattern = "yyyy-MM";
+                dt = Calendar.MONTH;
+            } else if (type==3) {
+                pattern = "yyyy-MM-dd";
+                dt = Calendar.DATE;
+            }else if (type==4) {
+                pattern = "yyyy-MM-dd HH";
+                dt = Calendar.HOUR_OF_DAY;
+            }
+            SimpleDateFormat sd = new SimpleDateFormat(pattern);
+            Calendar sc = Calendar.getInstance();
+            Calendar ec = Calendar.getInstance();
+            sc.setTime(sd.parse(startDate));
+            ec.setTime(sd.parse(endDate));
+            while (sc.compareTo(ec) < 1) {
+                rs.add(sd.format(sc.getTime()));
+                sc.add(dt, 1);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return rs;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某年的第一天
+     */
+    public static String getFirstDayStringByYear(int year) {
+        LocalDate firstDayOfYear = LocalDate.of(year, 1, 1);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        String firstDayString = firstDayOfYear.format(formatter);
+        return firstDayString;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某年的最后一天
+     */
+    public static String getLastDayStringByYear(int year) {
+        LocalDate lastDayOfYear = LocalDate.of(year, 12, 31);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+        String lastDayString = lastDayOfYear.format(formatter);
+        return lastDayString;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某月的第一天
+     */
+    public static String getFirstDayStringByMonth(int year,int month) {
+        LocalDate firstDayOfMonth = LocalDate.of(year, month, 1);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        String firstDayString = firstDayOfMonth.format(formatter);
+        return firstDayString;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 17:20
+     *  @Description: 获取某月的最后一天
+     */
+    public static String getLastDayStringByMonth(int year,int month) {
+        LocalDate firstDayOfMonth = LocalDate.of(year, month, 1);
+        LocalDate lastDayOfMonth = firstDayOfMonth.withDayOfMonth(firstDayOfMonth.lengthOfMonth());
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        String lastDayString = lastDayOfMonth.format(formatter);
+        return lastDayString;
+    }
+}

+ 30 - 5
src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java

@@ -3,12 +3,11 @@ package com.ydtech.modules.esm.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserTeamDto;
 import com.ydtech.modules.admin.model.vo.AppCustomerManagementQueryVo;
 import com.ydtech.modules.admin.model.vo.SysReferrerVo;
-import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
-import com.ydtech.modules.admin.model.vo.SysUserVO;
 import com.ydtech.modules.base.model.dto.PageDto;
 import com.ydtech.modules.esm.model.EsmUserReferrer;
 import com.ydtech.modules.esm.model.QueryChannel;
@@ -18,7 +17,7 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
-import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 
 
@@ -201,6 +200,32 @@ public interface EsmUserReferrerMapper extends BaseMapper<EsmUserReferrer> {
 
     List<SysUserTeamDto> getByTeam(@Param("managementQueryVo") AppCustomerManagementQueryVo managementQueryVo, @Param("userId") String userId, @Param("level") int level);
 
-
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:10
+     *  @Description: 查询年分数据
+     */
+    List<EmployeeIncreaseReportDto> employeeIncreaseReportYear(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:15
+     *  @Description: 查询月分数据
+     */
+    List<EmployeeIncreaseReportDto> employeeIncreaseReportMonth(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 18:16
+     *  @Description: 查询天数数据
+     */
+    List<EmployeeIncreaseReportDto> employeeIncreaseReportDay(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/7 17:59
+     *  @Description:  通过用户id查询用户数据
+     */
+    List<String> findReferrerIds(@Param("userId") String userId);
 }

+ 43 - 21
src/main/java/com/ydtech/modules/fnc/controller/CarSettleController.java

@@ -2,6 +2,8 @@ package com.ydtech.modules.fnc.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.aop.request.RequestSingleParam;
+import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fee.service.FeeRuleSchemeService;
@@ -9,8 +11,12 @@ import com.ydtech.modules.fnc.entity.InsFeeAudit;
 import com.ydtech.modules.fnc.entity.InsFeeAuditHistory;
 import com.ydtech.modules.fnc.service.InsFeeAuditHistoryService;
 import com.ydtech.modules.fnc.service.InsFeeAuditService;
-import com.ydtech.modules.order.entity.*;
-import com.ydtech.modules.order.entity.vo.*;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.vo.AuditOrderFeeVo;
+import com.ydtech.modules.order.entity.vo.OrderQueryVo;
+import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import io.swagger.annotations.Api;
@@ -35,7 +41,9 @@ public class CarSettleController extends BaseController {
     private final InsFeeAuditHistoryService insFeeAuditHistoryService;
 
 
-    public CarSettleController(InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService, InsFeeAuditService insFeeAuditService, FeeRuleSchemeService feeRuleSchemeService, InsFeeAuditHistoryService insFeeAuditHistoryService) {
+    public CarSettleController(InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService,
+                               InsFeeAuditService insFeeAuditService, FeeRuleSchemeService feeRuleSchemeService,
+                               InsFeeAuditHistoryService insFeeAuditHistoryService) {
 
         this.insAreaCompanyService = insAreaCompanyService;
         this.insOrdersService = insOrdersService;
@@ -47,6 +55,7 @@ public class CarSettleController extends BaseController {
 
     /**
      * 根据费用审核状态查询订单 auditStatus
+     *
      * @param orderQueryVo
      * @return
      */
@@ -57,8 +66,10 @@ public class CarSettleController extends BaseController {
         BasePageResult<InsOrders> quoteResult = this.insOrdersService.queryPageOrder(orderQueryVo);
         return HttpResult.ok("success", quoteResult);
     }
+
     /**
      * 根据订单号查询费用明细
+     *
      * @param orderNo
      * @return
      */
@@ -66,18 +77,20 @@ public class CarSettleController extends BaseController {
     @ApiOperation(value = "[2]根据订单号查询费用明细")
     public HttpResult<OrderVo> queryFeeDetail(@RequestSingleParam(value = "orderNo") @Valid String orderNo) {
         //查询已承保的子订单号
-        List<InsAreaCompany> areaList =insAreaCompanyService.query()
-                .eq(StringUtils.isNotEmpty(orderNo),"orderno",orderNo)
-                .eq("orderstatus","3").list();//3已承保
+        List<InsAreaCompany> areaList = insAreaCompanyService.query()
+                .eq(StringUtils.isNotEmpty(orderNo), "orderno", orderNo)
+                .eq("orderstatus", "3").list();//3已承保
 
-        if(areaList!=null && !areaList.isEmpty()){
-            return insOrdersService.getByCompanyId(areaList.get(0).getId(),"accountingUser");
-        }else{
+        if (areaList != null && !areaList.isEmpty()) {
+            return insOrdersService.getByCompanyId(areaList.get(0).getId(), "accountingUser");
+        } else {
             return HttpResult.error("订单号有误-未承保");
         }
     }
+
     /**
      * 费用审核
+     *
      * @param
      * @return
      */
@@ -86,29 +99,38 @@ public class CarSettleController extends BaseController {
     public HttpResult auditFee(@RequestBody @Valid AuditOrderFeeVo auditOrderFeeVo) {
 //        订单号
         String orderNo = auditOrderFeeVo.getOrderNo();
+
         //查询改订单是已审核
-        List<InsFeeAudit> feeList =insFeeAuditService.query().eq("orderno",orderNo).list();
-        if(feeList!=null &&feeList.size()>0){
+        List<InsFeeAudit> feeList = insFeeAuditService.lambdaQuery()
+                .eq(InsFeeAudit::getOrderno, orderNo)
+                .eq(InsFeeAudit::getAuditstatus, FeeAuditAuditstatus.PASSED.getCode())
+                .list();
+
+        if (feeList != null && !feeList.isEmpty()) {
             return HttpResult.error("该订单已审核");
         }
+
         //查询已承保的子订单号
-        List<InsAreaCompany> areaList =insAreaCompanyService.query()
-                .eq(StringUtils.isNotEmpty(orderNo),"orderno",orderNo)
-                .eq("orderstatus","3").list();//3已承保
-        if(areaList!=null && areaList.size()>0){
-            try{
-                if("1".equals(auditOrderFeeVo.getUpdateFlag())){
+        List<InsAreaCompany> areaList = insAreaCompanyService.lambdaQuery()
+                .eq(StringUtils.isNotEmpty(orderNo), InsAreaCompany::getOrderno, orderNo)
+                .eq(InsAreaCompany::getOrderstatus, InsOrderStatusEnum.ACCEPT_INSURANCE.getCode())
+                .list();//3已承保
+
+        if (areaList != null && !areaList.isEmpty()) {
+            try {
+                if ("1".equals(auditOrderFeeVo.getUpdateFlag())) {
                     String userId = getUserId();
-                    feeRuleSchemeService.compareAndUpdateFeeOrderInfo( areaList.get(0).getId(),auditOrderFeeVo.getJqCostsProportionStr(),auditOrderFeeVo.getSyCostsProportionStr(),userId);
+                    feeRuleSchemeService.compareAndUpdateFeeOrderInfo(areaList.get(0).getId(), auditOrderFeeVo.getJqCostsProportionStr(),
+                            auditOrderFeeVo.getSyCostsProportionStr(), userId);
                 }
-                insFeeAuditService.feeAudit( orderNo, areaList.get(0).getId(),false);
-            }catch (Exception e){
+                insFeeAuditService.feeAudit(orderNo, areaList.get(0).getId(), false);
+            } catch (Exception e) {
                 e.printStackTrace();
                 return HttpResult.error("系统异常");
             }
 
             return HttpResult.ok();
-        }else{
+        } else {
             return HttpResult.error("订单号有误-未承保");
         }
 

+ 36 - 0
src/main/java/com/ydtech/modules/fnc/controller/ImportAsyncController.java

@@ -0,0 +1,36 @@
+package com.ydtech.modules.fnc.controller;
+
+
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.fnc.entity.ImportResult;
+import com.ydtech.modules.fnc.entity.InsPlyIncome;
+import com.ydtech.modules.fnc.service.ImportAsyncService;
+import com.ydtech.modules.fnc.vo.ImportResultVo;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+@Api(tags = "异步导出")
+@RequestMapping("/fnc/importAsync")
+@RestController
+public class ImportAsyncController {
+    @Autowired
+    private ImportAsyncService importAsyncService;
+
+    @PostMapping("/query")
+    @ApiOperation(value = "导入任务列表查询")
+    public HttpResult<BasePageResult<ImportResult>> query(@RequestBody @Valid ImportResultVo importResultVo) {
+
+        HttpResult<BasePageResult<ImportResult>> result=importAsyncService.selectAll(importResultVo);
+        return result;
+    }
+
+}

+ 178 - 68
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -6,15 +6,25 @@ import com.ydtech.modules.admin.model.vo.SysUserBankCardVO;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.service.ImportAsyncService;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
+import com.ydtech.modules.inv.model.dto.InsBxNoPlyIncomeExcelDto;
+import com.ydtech.modules.inv.model.dto.InsBxOtherExcelDto;
+import com.ydtech.modules.inv.model.dto.InsBxPlyIncomeExcelDto;
+import com.ydtech.modules.inv.model.dto.InsNoBxOtherExcelDto;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
+import com.ydtech.utils.SnowFlakeUtil;
 import com.ydtech.utils.StringUtils;
+import com.ydtech.utils.excel.ExcelEasypoiUtils;
+import com.ydtech.utils.idgen.IdWorker;
 import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -23,12 +33,14 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.io.IOException;
+import java.io.InputStream;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.Period;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * <p>
@@ -45,65 +57,78 @@ public class InsPlyIncomeController extends BaseController {
 
     @Autowired
     private InsPlyIncomeService insPlyIncomeService;
+    @Autowired
+    private ImportAsyncService importAsyncService;
 
     /**
-     *
      * @return
      */
     @PostMapping("/queryPage")
     @ApiOperation(value = "[1]保司费用查询")
     public HttpResult<BasePageResult<InsPlyIncome>> queryPage(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
 
-        if(StringUtils.isNullOrEmpty(insPlyIncomeVo.getCompanyId())
+        if (StringUtils.isNullOrEmpty(insPlyIncomeVo.getCompanyId())
                 && StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
                 && StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
                 && StringUtils.isNullOrEmpty(insPlyIncomeVo.getLicenseno())
-        ){
+        ) {
             return HttpResult.error("查询条件不能全为空!");
         }
-        if(!StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
-                &&!StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
-                &&Period.between(insPlyIncomeVo.getStartDate(),insPlyIncomeVo.getEndDate()).getDays()>100
-        ){
+        if (!StringUtils.isNullOrEmpty(insPlyIncomeVo.getStartDate())
+                && !StringUtils.isNullOrEmpty(insPlyIncomeVo.getEndDate())
+                && Period.between(insPlyIncomeVo.getStartDate(), insPlyIncomeVo.getEndDate()).getDays() > 100
+        ) {
             return HttpResult.error("查询时间区间不能超过3个月!");
         }
-        if(StringUtils.isNullOrEmpty(insPlyIncomeVo.getDeptId())){
+        if (StringUtils.isNullOrEmpty(insPlyIncomeVo.getDeptId())) {
             insPlyIncomeVo.setDeptId(getDeptId());
         }
-        HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.queryplyIncome(insPlyIncomeVo);
+        HttpResult<BasePageResult<InsPlyIncome>> result = insPlyIncomeService.queryplyIncome(insPlyIncomeVo);
 
         return result;
     }
+
     @PostMapping("/query")
     @ApiOperation(value = "[1]保司费用查询new")
     public HttpResult<BasePageResult<InsPlyIncome>> query(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
 
-        HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.queryNew(insPlyIncomeVo);
+        HttpResult<BasePageResult<InsPlyIncome>> result = insPlyIncomeService.queryNew(insPlyIncomeVo);
 
         return result;
     }
+
     @PostMapping("/totalAmount")
     @ApiModelProperty(value = "平台手续费合计金额")
-    public HttpResult<HashMap<String,Object>>totalAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo){
-        if(!CollectionUtils.isEmpty(insPlyIncomeVo.getSelectIds())){
-            HashMap<String,Object>  result = insPlyIncomeService.totalAmount(insPlyIncomeVo.getSelectIds());
-            return  HttpResult.ok(result);
-        }else {
+    public HttpResult<HashMap<String, Object>> totalAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+        if (!CollectionUtils.isEmpty(insPlyIncomeVo.getSelectIds())) {
+            HashMap<String, Object> result = insPlyIncomeService.totalAmount(insPlyIncomeVo.getSelectIds());
+            return HttpResult.ok(result);
+        } else {
             return HttpResult.ok();
         }
     }
+
     @PostMapping("/totalPinAmount")
     @ApiModelProperty(value = "平台结算未结算接口")
-    public HttpResult<List<InsPlyIncome>>totalPinAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo){
-        List<InsPlyIncome>  result = insPlyIncomeService.totalPinAmount(insPlyIncomeVo);
-        return  HttpResult.ok(result);
+    public HttpResult<List<InsPlyIncome>> totalPinAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+        List<InsPlyIncome> result = insPlyIncomeService.totalPinAmount(insPlyIncomeVo);
+        return HttpResult.ok(result);
     }
+
     @PostMapping("/bxTotalAmount")
     @ApiModelProperty(value = "保险手续费合计")
-    public HttpResult<InsPlyIncome>bxTotalPinAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo){
-        InsPlyIncome  result = insPlyIncomeService.bxTotalAmount(insPlyIncomeVo);
-        return  HttpResult.ok(result);
+    public HttpResult<InsPlyIncome> bxTotalPinAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+        InsPlyIncome result = insPlyIncomeService.bxTotalAmount(insPlyIncomeVo);
+        return HttpResult.ok(result);
+    }
+
+    @PostMapping("/ptTotalAmount")
+    @ApiModelProperty(value = "平台手续费合计")
+    public HttpResult<InsPlyIncome> ptTotalAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+        InsPlyIncome result = insPlyIncomeService.ptTotalAmount(insPlyIncomeVo);
+        return HttpResult.ok(result);
     }
+
     @PutMapping("/balance")
     @ApiModelProperty(value = "结算手续费")
     public HttpResult<Object> balance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
@@ -114,7 +139,7 @@ public class InsPlyIncomeController extends BaseController {
     @PostMapping("/totalQuery")
     @ApiOperation(value = "跟单费总数")
     public HttpResult<BasePageResult<InsPlyIncome>> totalQuery(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
-        HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.totalQuery(insPlyIncomeVo);
+        HttpResult<BasePageResult<InsPlyIncome>> result = insPlyIncomeService.totalQuery(insPlyIncomeVo);
         return result;
     }
 
@@ -122,38 +147,41 @@ public class InsPlyIncomeController extends BaseController {
     @ApiModelProperty(value = "开票跟单费")
     public HttpResult<Object> batchInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
 
-        return   insPlyIncomeService.batchInvoic(insPlyIncomeVo);
+        return insPlyIncomeService.batchInvoic(insPlyIncomeVo);
     }
 
     @PutMapping("/singleInvoic")
     @ApiModelProperty(value = "批量开票跟单费")
-    public HttpResult<Object> singleInvoic(@RequestBody  InsPlyIncomeVo  insPlyIncomeVo) {
-        return   insPlyIncomeService.singleInvoic(insPlyIncomeVo);
+    public HttpResult<Object> singleInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.singleInvoic(insPlyIncomeVo);
     }
+
     @PutMapping("/batchBalance")
     @ApiModelProperty(value = "批量结算跟单费")
     public HttpResult<Object> batchBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
 
-        return   insPlyIncomeService.batchBalance(insPlyIncomeVo);
+        return insPlyIncomeService.batchBalance(insPlyIncomeVo);
     }
+
     @PutMapping("/batchPinBalance")
     @ApiModelProperty(value = "平台批量结算")
     public HttpResult<Object> batchPinBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-        return   insPlyIncomeService.batchPinBalance(insPlyIncomeVo);
+        return insPlyIncomeService.batchPinBalance(insPlyIncomeVo);
     }
 
     @PostMapping("/NonSettlementQuery")
     @ApiOperation(value = "非跟单查询")
-    public HttpResult<BasePageResult<InsPlyIncome>>NonSettlementQuery(@Valid  @RequestBody InsPlyIncomeVo  insPlyIncomeVo) {
-        HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.nonSettlementQuery(insPlyIncomeVo);
+    public HttpResult<BasePageResult<InsPlyIncome>> NonSettlementQuery(@Valid @RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        HttpResult<BasePageResult<InsPlyIncome>> result = insPlyIncomeService.nonSettlementQuery(insPlyIncomeVo);
         return result;
     }
 
     @PostMapping("/NonSettldetail")
     @ApiOperation(value = "非跟单明细查询")
-    public HttpResult<List<InsPlyIncome>>   NonSettldetail (@Valid  @RequestBody InsPlyIncomeVo  insPlyIncomeVo){
-        return  insPlyIncomeService.nonSettldetail(insPlyIncomeVo);
+    public HttpResult<List<InsPlyIncome>> NonSettldetail(@Valid @RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.nonSettldetail(insPlyIncomeVo);
     }
+
     @PostMapping("/importData")
     @ApiOperation(value = "手续费导入(excel)")
     @ApiImplicitParams({
@@ -161,30 +189,98 @@ public class InsPlyIncomeController extends BaseController {
     })
     public HttpResult importData(@RequestParam MultipartFile multipartFile) {
 
-        HashMap<String, Object> result= insPlyIncomeService.importData(multipartFile);
+        HashMap<String, Object> result = insPlyIncomeService.importData(multipartFile);
 
         return HttpResult.ok(result);
     }
+
     @PostMapping("/bxImportData")
     @ApiOperation(value = "保险手续费导入(excel)")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
     })
-    public HttpResult<HashMap<String, Object>> bxImportData(@RequestParam MultipartFile multipartFile,@RequestParam("isNotCar")  String isNotCar) {
-        HashMap<String, Object> result= insPlyIncomeService.bxImportData(multipartFile,isNotCar);
-        return HttpResult.ok(result);
+    public HttpResult<String> bxImportData(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        try {
+            List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
+            String taskId = String.valueOf(new SnowFlakeUtil().nextId());
+            importAsyncService.importasync(dtoList, isNotCar, taskId);
+            return HttpResult.ok(taskId);
+
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
     }
+
     @PostMapping("/bxImportNoData")
     @ApiOperation(value = "保险非车手续费导入(excel)")
     @ApiImplicitParams({
-    @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<String> bxImportNoData(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        try {
+            List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
+            String taskId = String.valueOf(new SnowFlakeUtil().nextId());
+            importAsyncService.bxImportNoData(dtoList, multipartFile, taskId);
+            return HttpResult.ok(taskId);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+    @PostMapping("/bxImportOther")
+    @ApiOperation(value = "批量修改比例(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<HashMap<String, Object>> bxImportOther(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        HashMap<String, Object> result = insPlyIncomeService.bxImportOther(multipartFile, isNotCar);
+        return HttpResult.ok(result);
+    }
+
+    @PostMapping("/noBxImportOther")
+    @ApiOperation(value = "非车批量修改比例(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
     })
-    public HttpResult<HashMap<String, Object>> bxImportNoData(@RequestParam MultipartFile multipartFile,@RequestParam("isNotCar")  String isNotCar) {
-        HashMap<String, Object> result= insPlyIncomeService.bxImportNoData(multipartFile,isNotCar);
+    public HttpResult<HashMap<String, Object>> noBxImportOther(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        HashMap<String, Object> result = insPlyIncomeService.noBxImportOther(multipartFile, isNotCar);
         return HttpResult.ok(result);
     }
 
 
+    @PostMapping("/bxOtherImportData")
+    @ApiOperation(value = "跟单对账导入(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<String> bxOtherImportData(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        try {
+            List<InsBxOtherExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxOtherExcelDto.class, 0, 1, 1);
+            String taskId = String.valueOf(new SnowFlakeUtil().nextId());
+            importAsyncService.bxOtherImportData(dtoList, isNotCar, taskId);
+            return HttpResult.ok(taskId);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @PostMapping("/bxNoOtherImportData")
+    @ApiOperation(value = "非车跟单对账导入(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<String> bxNoOtherImportData(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        try {
+            List<InsNoBxOtherExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsNoBxOtherExcelDto.class, 0, 1, 1);
+            String taskId = String.valueOf(new SnowFlakeUtil().nextId());
+            importAsyncService.bxNoOtherImportData(dtoList, isNotCar, taskId);
+            return HttpResult.ok(taskId);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
 
     @PutMapping("/update")
     @ApiModelProperty(value = "修改")
@@ -192,118 +288,132 @@ public class InsPlyIncomeController extends BaseController {
         insPlyIncomeService.updateByEntity(insPlyIncomeVo);
         return HttpResult.ok("修改成功");
     }
+
     @PutMapping("/batchUpdate")
     @ApiModelProperty(value = "批量修改")
     public HttpResult<Object> batchUpdate(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
         insPlyIncomeService.batchUpdate(insPlyIncomeVo);
         return HttpResult.ok("批量修改成功");
     }
+
+    @PutMapping("/batchUpdateVoucher")
+    @ApiModelProperty(value = "批量修改上传凭证")
+    public HttpResult<Object> batchUpdateVoucher(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeService.batchUpdateVoucher(insPlyIncomeVo);
+        return HttpResult.ok("上传凭证成功");
+    }
+
+
     @PostMapping("/insert")
     @ApiModelProperty(value = "新增")
     public HttpResult<InsPlyIncome> insertByEntity(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
         return insPlyIncomeService.insertByEntity(insPlyIncomeVo);
     }
+
     @DeleteMapping("/delete")
     @ApiModelProperty(value = "删除")
-    public HttpResult<InsPlyIncome>  deleteById(@RequestBody InsPlyIncomeVo insPlyIncomeVo){
+    public HttpResult<InsPlyIncome> deleteById(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
 
-        return  insPlyIncomeService.deleteById(insPlyIncomeVo);
+        return insPlyIncomeService.deleteById(insPlyIncomeVo);
 
     }
+
     @GetMapping("/getById/{id}")
     @ApiModelProperty(value = "回显")
-    public HttpResult<InsPlyIncome> getById(@PathVariable("id") String  id){
+    public HttpResult<InsPlyIncome> getById(@PathVariable("id") String id) {
         InsPlyIncome item = insPlyIncomeService.getEntityById(id);
-        return  HttpResult.ok(item) ;
+        return HttpResult.ok(item);
     }
 
     @PostMapping("/totalBxAmount")
     @ApiModelProperty(value = "保险未开票金额")
-    public HttpResult<List<InsPlyIncome>>totalBxAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo){
-        List<InsPlyIncome>  result = insPlyIncomeService.totalBxAmount(insPlyIncomeVo);
-        return  HttpResult.ok(result);
+    public HttpResult<List<InsPlyIncome>> totalBxAmount(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+        List<InsPlyIncome> result = insPlyIncomeService.totalBxAmount(insPlyIncomeVo);
+        return HttpResult.ok(result);
     }
 
 
     @PutMapping("/batchInvoicing")
     @ApiModelProperty(value = "保险手续费批量开票")
     public HttpResult<Object> batchInvoicing(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-        return   insPlyIncomeService.batchInvoicing(insPlyIncomeVo);
+        return insPlyIncomeService.batchInvoicing(insPlyIncomeVo);
     }
 
     @PostMapping("/queryInvoicing")
     @ApiModelProperty(value = "查询开票金额")
     public HttpResult<InsPlyIncome> queryInvoicing(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-        return   insPlyIncomeService.queryInvoicing(insPlyIncomeVo);
+        return insPlyIncomeService.queryInvoicing(insPlyIncomeVo);
     }
+
     @PostMapping("/querySettInvoicing")
     @ApiModelProperty(value = "查询已开票已结算")
     public HttpResult<InsPlyIncome> querySettInvoicing(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-        return   insPlyIncomeService.querySettInvoicing(insPlyIncomeVo);
+        return insPlyIncomeService.querySettInvoicing(insPlyIncomeVo);
     }
 
     @PutMapping("/batchBxBalance")
     @ApiModelProperty(value = "保险批量结算")
     public HttpResult<Object> batchBxBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-        return   insPlyIncomeService.batchBxBalance(insPlyIncomeVo);
+        return insPlyIncomeService.batchBxBalance(insPlyIncomeVo);
     }
 
 
     @PostMapping("/allOtherAmount")
     @ApiModelProperty(value = "保险跟单总表")
     public HttpResult<List<InsPlyIncome>> allOtherAmount(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
-        return   insPlyIncomeService.allOtherAmount(insPlyIncomeVo);
+        return insPlyIncomeService.allOtherAmount(insPlyIncomeVo);
     }
 
 
     @ApiModelProperty("平台手续费导出")
     @PostMapping("pinHandlingExcel")
-    public HttpResult pinHandlingexcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo  insPlyIncomeVo , HttpServletRequest request, HttpServletResponse response ){
+    public HttpResult pinHandlingexcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
         return insPlyIncomeService.pinHandlingexcel(insPlyIncomeVo, request, response);
     }
 
     @ApiModelProperty("保险手续费导出")
     @PostMapping("bxHandlingExcel")
-    public HttpResult bxHandlingexcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo  insPlyIncomeVo , HttpServletRequest request, HttpServletResponse response ) throws IOException {
-            return  insPlyIncomeService.bxHandlingexcel(insPlyIncomeVo, request, response);
+    public HttpResult bxHandlingexcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) throws IOException {
+        return insPlyIncomeService.bxHandlingexcel(insPlyIncomeVo, request, response);
     }
+
     @ApiModelProperty("保险跟单导出")
     @PostMapping("bxOtherExcel")
-    public HttpResult bxOtherExcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo  insPlyIncomeVo , HttpServletRequest request, HttpServletResponse response ){
-            return insPlyIncomeService.bxOtherExcel(insPlyIncomeVo, request, response);
-        }
+    public HttpResult bxOtherExcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
+        return insPlyIncomeService.bxOtherExcel(insPlyIncomeVo, request, response);
+    }
 
     @ApiModelProperty("保险跟单明细导出")
     @PostMapping("/bxOtherDetailsExcel")
-    public HttpResult bxOtherDetailsExcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo  insPlyIncomeVo , HttpServletRequest request, HttpServletResponse response ){
-            return insPlyIncomeService.bxOtherDetailsExcel(insPlyIncomeVo, request, response);
-        }
+    public HttpResult bxOtherDetailsExcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
+        return insPlyIncomeService.bxOtherDetailsExcel(insPlyIncomeVo, request, response);
+    }
 
     @PostMapping("/invicdetail")
     @ApiOperation(value = "开票未结算详情查询")
-    public HttpResult<List<HashMap<String,Object>>>   invicdetail (@Valid  @RequestBody InsPlyIncomeVo  insPlyIncomeVo){
-        return  insPlyIncomeService.invicdetail(insPlyIncomeVo);
+    public HttpResult<List<HashMap<String, Object>>> invicdetail(@Valid @RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.invicdetail(insPlyIncomeVo);
     }
+
     @ApiModelProperty("保险非车跟单明细导出")
     @PostMapping("/bxNoOtherDetailsExcel")
-    public HttpResult bxNoOtherDetailsExcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo  insPlyIncomeVo , HttpServletRequest request, HttpServletResponse response ){
+    public HttpResult bxNoOtherDetailsExcel(@RequestBody @ApiParam(name = "insPlyIncomeVo") InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response) {
         return insPlyIncomeService.bxNoOtherDetailsExcel(insPlyIncomeVo, request, response);
     }
 
     @PostMapping("/otherSettldetail")
     @ApiOperation(value = "非跟单明细查询")
-    public HttpResult<List<HashMap<String,Object>>>   otherSettldetail (@RequestBody  InsPlyIncomeVo insPlyIncomeVo){
-        return  insPlyIncomeService.otherSettldetail(insPlyIncomeVo);
+    public HttpResult<List<HashMap<String, Object>>> otherSettldetail(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.otherSettldetail(insPlyIncomeVo);
     }
+
     @PostMapping("/otherTimeDetail")
     @ApiOperation(value = "非跟单明细查询")
-    public HttpResult<List<HashMap<String,Object>>>   otherTimeDetail (@RequestBody  InsPlyIncomeVo insPlyIncomeVo){
-        return  insPlyIncomeService.otherTimeDetail(insPlyIncomeVo);
+    public HttpResult<List<HashMap<String, Object>>> otherTimeDetail(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        return insPlyIncomeService.otherTimeDetail(insPlyIncomeVo);
     }
 
 
-
-
 }
 
 

+ 14 - 0
src/main/java/com/ydtech/modules/fnc/dao/ImportAsyncMapper.java

@@ -0,0 +1,14 @@
+package com.ydtech.modules.fnc.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.fnc.entity.ImportResult;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Mapper
+public interface ImportAsyncMapper  extends BaseMapper<ImportResult> {
+    List<ImportResult> queryNew(HashMap<String, Object> params);
+
+}

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -122,4 +122,6 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
     void updateByIds(String[] split);
 
     List<HashMap<String,Object>> otherTimeDetail(HashMap<String, Object> params);
+
+    InsPlyIncome ptTotalAmount(HashMap<String, Object> params);
 }

+ 79 - 0
src/main/java/com/ydtech/modules/fnc/entity/ImportResult.java

@@ -0,0 +1,79 @@
+package com.ydtech.modules.fnc.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.drinkjava2.jdialects.annotation.jpa.GenerationType;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.List;
+
+@Getter
+@Setter
+@TableName("import_task")
+@ApiModel(value = "import_task对象", description = "任务表导入")
+@NoArgsConstructor
+public class ImportResult implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("id")
+    @TableField("id")
+    private String id;
+
+    @ApiModelProperty("任务状态")
+    @TableField("status")
+    private String status; // PROCESSING, COMPLETED, FAILED
+
+    @ApiModelProperty("创建时间")
+    @TableField("create_time")
+    private LocalDateTime createTime;
+
+
+    @ApiModelProperty("开始时间")
+    @TableField("created_at")
+    private LocalDateTime createdAt;
+
+    @ApiModelProperty("完成时间")
+    @TableField("completed_at")
+    private LocalDateTime completedAt;
+
+
+    @ApiModelProperty("原因")
+    @TableField(exist = false)
+    private String reason;
+
+    @ApiModelProperty("金额")
+    @TableField("total_amount")
+    private BigDecimal totalAmount; // 导入后计算的金额
+    @ApiModelProperty("保险公司id")
+    @TableField("company_id")
+    private String companyId; // 导入后计算的金额
+    @ApiModelProperty("合作公司id")
+    @TableField("partner_companies_id")
+    private String partnerCompaniesId; // 导入后计算的金额
+    @ApiModelProperty("协议id")
+    @TableField("agreement_id")
+    private String agreementId; // 导入后计算的金额
+
+
+    @ApiModelProperty("导入路径")
+    @TableField("upload_url")
+    private String uploadUrl; // 导入路径
+
+    @ApiModelProperty("开票ids")
+    @TableField("ids")
+    private String ids; // 导入路径
+    @ApiModelProperty("标识")
+    @TableField("hand_status")
+    private String handStatus;
+
+
+}

+ 15 - 2
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -329,8 +329,8 @@ public class InsPlyIncome implements Serializable {
     @TableField("settle_other_status")
     private String settleOtherStatus;
 
-    @ApiModelProperty("跟单结算")
-    @TableField("settle_other_status")
+    @ApiModelProperty("对账截图")
+    @TableField("settlement_image_id")
     private String settlementImageId;
 
 
@@ -441,6 +441,19 @@ public class InsPlyIncome implements Serializable {
     @TableField(exist = false)
     private BigDecimal taxesFees;
 
+
+    @ApiModelProperty("结算人名称")
+    @TableField(exist = false)
+    private String settlementUserName;
+
+    @ApiModelProperty("修改人名称")
+    @TableField(exist = false)
+    private String updateUserName;
+
+    @ApiModelProperty("凭证图片路径")
+    @TableField(exist = false)
+    private String imageUrl;
+
     public InsPlyIncome(String orderno, String policyno, String syPolicyno, String noPolicyno, String settleno, String deptId, String deptName, String riskcode, LocalDateTime payDate, LocalDateTime signDate, String companyId, String companyName, String agreementId, String licenseno, BigDecimal taxamount, BigDecimal noTaxPremium, BigDecimal commissionFeerate, BigDecimal otherFeerate, BigDecimal commissionFeevalue, BigDecimal otherFeevalue, BigDecimal allFeeValue, BigDecimal finalFeeValue, BigDecimal doingFeeValue, LocalDate createTime, String voucherNumber, String contractId, String contractFileId, String handlingFeesStatus, String documentaryFeesStatus, String isNotCar, String isNotDocumentary) {
         this.orderno = orderno;
         this.policyno = policyno;

+ 4 - 0
src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java

@@ -126,6 +126,10 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("agreement_type")
     private String agreementType;
 
+    @ApiModelProperty("协议类型")
+    @TableField("agree_ment_id")
+    private String agreementId;
+
     @ApiModelProperty("结算凭证")
     @TableField("settlement_image_id")
     private String settlementImageId;

+ 27 - 0
src/main/java/com/ydtech/modules/fnc/service/ImportAsyncService.java

@@ -0,0 +1,27 @@
+package com.ydtech.modules.fnc.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.fnc.entity.ImportResult;
+import com.ydtech.modules.fnc.vo.ImportResultVo;
+import com.ydtech.modules.inv.model.dto.InsBxNoPlyIncomeExcelDto;
+import com.ydtech.modules.inv.model.dto.InsBxOtherExcelDto;
+import com.ydtech.modules.inv.model.dto.InsBxPlyIncomeExcelDto;
+import com.ydtech.modules.inv.model.dto.InsNoBxOtherExcelDto;
+import com.ydtech.modules.order.entity.BasePageResult;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public interface ImportAsyncService   extends IService<ImportResult> {
+    void importasync(List<InsBxPlyIncomeExcelDto> dtoList, String isNotCar, String taskId);
+
+    HttpResult<BasePageResult<ImportResult>> selectAll(ImportResultVo importResultVo);
+
+    void bxOtherImportData(List<InsBxOtherExcelDto> dtoList, String isNotCar, String taskId);
+
+    void bxNoOtherImportData(List<InsNoBxOtherExcelDto> dtoList, String isNotCar, String taskId);
+
+    void bxImportNoData(List<InsBxNoPlyIncomeExcelDto> dtoList, MultipartFile multipartFile, String taskId);
+
+}

+ 5 - 0
src/main/java/com/ydtech/modules/fnc/service/InsFeeAuditService.java

@@ -27,4 +27,9 @@ public interface InsFeeAuditService extends IService<InsFeeAudit> {
      InsFeeAudit saveInsFeeAuditAndHistory(String orderNo, String insOrderNo, boolean isAutoAudit, String auditstatus);
 
 
+     InsFeeAudit saveDefaultInsFeeAuditAndHistory(String orderNo, String insOrderNo, String auditstatus);
+
+
+
+
 }

+ 9 - 0
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -5,6 +5,7 @@ import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
+import com.ydtech.modules.inv.model.dto.InsBxPlyIncomeExcelDto;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
@@ -16,6 +17,7 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
 
 /**
  * <p>
@@ -127,4 +129,11 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
 
     void batchUpdate(InsPlyIncomeVo insPlyIncomeVo);
 
+    HashMap<String, Object> bxImportOther(MultipartFile multipartFile,String isNotCar);
+
+    InsPlyIncome ptTotalAmount(InsPlyIncomeVo insPlyIncomeVo);
+
+    HashMap<String, Object> noBxImportOther(MultipartFile multipartFile, String isNotCar);
+
+    void batchUpdateVoucher(InsPlyIncomeVo insPlyIncomeVo);
 }

+ 631 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/ImportAsyncServiceImpl.java

@@ -0,0 +1,631 @@
+package com.ydtech.modules.fnc.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.builder.ExcelWriterBuilder;
+import com.alibaba.excel.write.metadata.WriteSheet;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.fnc.dao.ImportAsyncMapper;
+import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
+import com.ydtech.modules.fnc.entity.ImportResult;
+import com.ydtech.modules.fnc.entity.InsPlyIncome;
+import com.ydtech.modules.fnc.service.ImportAsyncService;
+import com.ydtech.modules.fnc.vo.ImportResultVo;
+import com.ydtech.modules.ins.model.vo.res.BxNoOtherDetailsExcel;
+import com.ydtech.modules.ins.model.vo.res.BxOtherDetailsExcel;
+import com.ydtech.modules.ins.model.vo.res.BxSettlementFeesExcel;
+import com.ydtech.modules.inv.model.dto.*;
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.po.InsUploadFiles;
+import com.ydtech.modules.order.service.InsUploadFilesService;
+import com.ydtech.utils.excel.ExcelEasypoiUtils;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@Service
+public class ImportAsyncServiceImpl extends ServiceImpl<ImportAsyncMapper, ImportResult> implements ImportAsyncService {
+
+    @Autowired
+    private InsPlyIncomeMapper insPlyIncomeMapper;
+    @Autowired
+    private InsUploadFilesService insUploadFilesService;
+    @Value("${upload.file.path}")
+    private String uploadFilePath;
+    @Value("${upload.file.path}")
+    private String uploadPath;
+    @Value("${upload.file.url}")
+    private String uploadUrl;
+
+    @Async
+    @Override
+    public void importasync(List<InsBxPlyIncomeExcelDto> dtoList, String isNotCar, String taskId) {
+        BigDecimal totalAmount = BigDecimal.ZERO;
+        HashMap<String, Object> params = new HashMap<>();
+        StringBuffer strBuilder = new StringBuffer();
+        List<InsImportResult> insImportResultsExcel = new ArrayList<>();
+        String companyId  ="";
+        String partnerCompaniesId  ="";
+        String agreementId  ="";
+
+        boolean open = true;
+        String ids = "";
+        Integer i = 0;
+
+        //  创建任务
+        ImportResult importResult = new ImportResult();
+        importResult.setId(taskId);
+        importResult.setStatus("ready");
+        importResult.setCreateTime(LocalDateTime.now());
+        importResult.setCreatedAt(LocalDateTime.now());
+        baseMapper.insert(importResult);
+
+        if (!CollectionUtils.isEmpty(dtoList)) {
+            for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
+                String reason = "";
+                i = i + 1;
+                params.clear();
+                if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                    String licenseno = excelItem.getLicenseno();//车牌号
+                    params.put("licenseno", licenseno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据车牌号有问题";
+                    }
+                }
+                if (StringUtils.isNotEmpty(excelItem.getPolicyno())) {
+                    String policyno = excelItem.getPolicyno(); //交强保单号
+                    params.put("policyno", policyno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据交强保单号有问题";
+                    }
+                }
+
+                if (StringUtils.isNotEmpty(excelItem.getSyPolicyno())) {
+                    String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
+                    params.put("syPolicyno", syPolicyno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据商业保单号有问题";
+                    }
+                }
+
+                if (excelItem.getJqSuperviseCostsPremiums() != null && excelItem.getJqSuperviseCostsPremiums().compareTo(BigDecimal.ZERO) != 0) {
+                    params.put("jqSuperviseCostsPremiums", excelItem.getJqSuperviseCostsPremiums());
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据交强手续费金额有问题";
+                    }
+                }
+                if (excelItem.getJqSuperviseCostsProportion() != null && excelItem.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    params.put("jqSuperviseCostsProportion", excelItem.getJqSuperviseCostsProportion());
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据交强手续费比例有问题";
+                    }
+                }
+                if (excelItem.getSySuperviseCostsProportion() != null && excelItem.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    params.put("sySuperviseCostsProportion", excelItem.getSySuperviseCostsProportion());
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据商业手续费比例有问题";
+                    }
+                }
+
+                if (excelItem.getSySuperviseCostsPremiums() != null && excelItem.getSySuperviseCostsPremiums().compareTo(BigDecimal.ZERO) != 0) {
+                    params.put("sySuperviseCostsPremiums", excelItem.getSySuperviseCostsPremiums());
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据商业手续费金额有问题";
+                    }
+                }
+                if (excelItem.getJqPremium() != null && excelItem.getJqPremium().compareTo(BigDecimal.ZERO) != 0) {
+                    params.put("jqPremium", excelItem.getJqPremium());
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据交强保费有问题";
+                    }
+                }
+                if (excelItem.getSyPremium() != null && excelItem.getSyPremium().compareTo(BigDecimal.ZERO) != 0) {
+                    params.put("syPremium", excelItem.getSyPremium());
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据商业保费有问题";
+                    }
+                }
+//                  只查手续费
+                params.put("isOther", "0");
+                params.put("isNotCar", isNotCar);
+                InsPlyIncome insPlyIncome = insPlyIncomeMapper.findByBxLicenseno(params);
+                if (ObjectUtils.isNotEmpty(insPlyIncome) && open) {
+                    open = false;
+                    companyId = insPlyIncome.getCompanyId(); // 保险公司id
+                    partnerCompaniesId =  insPlyIncome.getPartnerCompaniesId(); //合作公司id
+                    agreementId = insPlyIncome.getAgreementId();  //协议id
+                }
+                if (ObjectUtils.isNotEmpty(insPlyIncome)) {  // 比配上汇总金额 未匹配则返回到数据当中
+                    strBuilder.append(insPlyIncome.getId()).append(",");
+                    if (insPlyIncome.getCommissionFeevalue() != null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO) != 0) {
+                        totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                    }
+                } else {
+                    InsImportResult insImportResult = new InsImportResult();
+                    if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                        insImportResult.setLicenseno(excelItem.getLicenseno());
+                    }
+                    if (StringUtils.isNotEmpty(excelItem.getPolicyno())) {
+                        insImportResult.setPolicyno(excelItem.getPolicyno());
+                    }
+                    if (StringUtils.isNotEmpty(excelItem.getSyPolicyno())) {
+                        insImportResult.setSyPolicyno(excelItem.getSyPolicyno());
+                    }
+                    if(StringUtils.isNotEmpty(reason)){
+                        insImportResult.setReason(reason);
+                    }
+                    insImportResultsExcel.add(insImportResult);
+                }
+            }
+        }
+        if(strBuilder.length() >0){
+            ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
+        }
+
+
+        String uploadPath = this.uploadFilePath + "/excel/" + taskId + "/";
+        File folder = new File(uploadPath);
+        // 路劲不存在创建目录
+        if (!folder.isDirectory()) {
+            folder.mkdirs();
+        }
+
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "保险跟单明细导出", InsImportResult.class, insImportResultsExcel);
+
+        ImportResult endTask = new ImportResult();
+        endTask.setTotalAmount(totalAmount);
+        endTask.setId(taskId);
+        endTask.setCompletedAt(LocalDateTime.now());
+        endTask.setStatus("complete");
+        if(!CollectionUtils.isEmpty(insImportResultsExcel)){
+            endTask.setUploadUrl("upload/excel/" + taskId + "/" + fileName);
+        }
+        endTask.setCompanyId(companyId);
+        endTask.setAgreementId(agreementId);
+        endTask.setPartnerCompaniesId(partnerCompaniesId);
+        endTask.setIds(ids);
+        endTask.setHandStatus("0");
+        baseMapper.updateById(endTask);
+    }
+
+    @Override
+    public HttpResult<BasePageResult<ImportResult>> selectAll(ImportResultVo importResultVo) {
+        try{
+            HashMap<String, Object> params = new HashMap<>();
+            PageInfo<List<InsPlyIncome>> pageHelper = null;
+            PageHelper.startPage(importResultVo.getPageNum(),importResultVo.getPageSize());
+            params.put("pageNum",importResultVo.getPageNum());
+            params.put("pageSize",importResultVo.getPageSize());
+            if(StringUtils.isNotEmpty(importResultVo.getHandStatus())){
+                params.put("handStatus",importResultVo.getHandStatus());
+            }
+            List<ImportResult> list= this.baseMapper.queryNew(params);
+
+            pageHelper=new PageInfo(list);
+            BasePageResult<ImportResult> pageResult=new BasePageResult<ImportResult>(importResultVo.getPageNum(), importResultVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
+            return HttpResult.ok(pageResult);
+        }catch (Exception e){
+            e.printStackTrace();
+            return HttpResult.error("查询异常");
+        }
+    }
+
+    @Override
+    public void bxOtherImportData(List<InsBxOtherExcelDto> dtoList, String isNotCar, String taskId) {
+
+        BigDecimal totalAmount = BigDecimal.ZERO;
+        HashMap<String, Object> params = new HashMap<>();
+        StringBuffer strBuilder = new StringBuffer();
+        List<InsImportResult> insImportResultsExcel = new ArrayList<>();
+        String companyId  ="";
+        String partnerCompaniesId  ="";
+        String agreementId  ="";
+
+        boolean open = true;
+        String ids = "";
+        Integer i = 0;
+
+        //  创建任务
+        ImportResult importResult = new ImportResult();
+        importResult.setId(taskId);
+        importResult.setStatus("ready");
+        importResult.setCreateTime(LocalDateTime.now());
+        importResult.setCreatedAt(LocalDateTime.now());
+        baseMapper.insert(importResult);
+
+        if (!CollectionUtils.isEmpty(dtoList)) {
+            for (InsBxOtherExcelDto excelItem : dtoList) {
+                String reason = "";
+                i = i + 1;
+                params.clear();
+                if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                    String licenseno = excelItem.getLicenseno();//车牌号
+                    params.put("licenseno", licenseno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据车牌号有问题";
+                    }
+                }
+                if (StringUtils.isNotEmpty(excelItem.getPolicyno())) {
+                    String policyno = excelItem.getPolicyno(); //交强保单号
+                    params.put("policyno", policyno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据交强保单号有问题";
+                    }
+                }
+
+                if (StringUtils.isNotEmpty(excelItem.getSyPolicyno())) {
+                    String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
+                    params.put("syPolicyno", syPolicyno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据商业保单号有问题";
+                    }
+                }
+
+                if (excelItem.getJqOtherCostsProportion()!=null  &&  excelItem.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    BigDecimal jqOtherCostsProportion = excelItem.getJqOtherCostsProportion();//商业保单号
+                    params.put("jqOtherCostsProportion", jqOtherCostsProportion);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据交强跟单比例有问题";
+                    }
+                }
+                if (excelItem.getSyOtherCostsProportion()!=null  &&  excelItem.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    BigDecimal syOtherCostsProportion = excelItem.getSyOtherCostsProportion();//商业保单号
+                    params.put("syOtherCostsProportion", syOtherCostsProportion);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据商业跟单比例有问题";
+                    }
+                }
+//                  只查手续费
+                params.put("isOther", "1");
+                params.put("isNotCar", isNotCar);
+                InsPlyIncome insPlyIncome = insPlyIncomeMapper.findByBxLicenseno(params);
+                if (ObjectUtils.isNotEmpty(insPlyIncome) && open) {
+                    open = false;
+                    companyId = insPlyIncome.getCompanyId(); // 保险公司id
+                    partnerCompaniesId =  insPlyIncome.getPartnerCompaniesId(); //合作公司id
+                    agreementId = insPlyIncome.getAgreementId();  //协议id
+                }
+                if (ObjectUtils.isNotEmpty(insPlyIncome)) {  // 比配上汇总金额 未匹配则返回到数据当中
+                    strBuilder.append(insPlyIncome.getId()).append(",");
+                    if (insPlyIncome.getCommissionFeevalue() != null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO) != 0) {
+                        totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                    }
+                } else {
+                    InsImportResult insImportResult = new InsImportResult();
+                    if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                        insImportResult.setLicenseno(excelItem.getLicenseno());
+                    }
+                    if (StringUtils.isNotEmpty(excelItem.getPolicyno())) {
+                        insImportResult.setPolicyno(excelItem.getPolicyno());
+                    }
+                    if (StringUtils.isNotEmpty(excelItem.getSyPolicyno())) {
+                        insImportResult.setSyPolicyno(excelItem.getSyPolicyno());
+                    }
+                    if(StringUtils.isNotEmpty(reason)){
+                        insImportResult.setReason(reason);
+                    }
+                    insImportResultsExcel.add(insImportResult);
+                }
+            }
+        }
+        if(strBuilder.length() >0){
+            ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
+        }
+        String uploadPath = this.uploadFilePath + "/excel/" + taskId + "/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "保险对账问题文件", InsImportResult.class, insImportResultsExcel);
+        String  url=uploadUrl + "excel/" + fileName;
+
+        ImportResult endTask = new ImportResult();
+        endTask.setTotalAmount(totalAmount);
+        endTask.setId(taskId);
+        endTask.setCompletedAt(LocalDateTime.now());
+        endTask.setStatus("complete");
+        if(!CollectionUtils.isEmpty(insImportResultsExcel)){
+            endTask.setUploadUrl("upload/excel/" + taskId + "/" + fileName);
+        }
+        endTask.setCompanyId(companyId);
+        endTask.setAgreementId(agreementId);
+        endTask.setPartnerCompaniesId(partnerCompaniesId);
+        endTask.setHandStatus("2");
+        endTask.setIds(ids);
+        baseMapper.updateById(endTask);
+    }
+
+    @Override
+    public void bxNoOtherImportData(List<InsNoBxOtherExcelDto> dtoList, String isNotCar, String taskId) {
+
+        BigDecimal totalAmount = BigDecimal.ZERO;
+        HashMap<String, Object> params = new HashMap<>();
+        StringBuffer strBuilder = new StringBuffer();
+        List<InsImportResult> insImportResultsExcel = new ArrayList<>();
+        String companyId  ="";
+        String partnerCompaniesId  ="";
+        String agreementId  ="";
+
+        boolean open = true;
+        String ids = "";
+        Integer i = 0;
+
+        //  创建任务
+        ImportResult importResult = new ImportResult();
+        importResult.setId(taskId);
+        importResult.setStatus("ready");
+        importResult.setCreateTime(LocalDateTime.now());
+        importResult.setCreatedAt(LocalDateTime.now());
+        baseMapper.insert(importResult);
+
+        if (!CollectionUtils.isEmpty(dtoList)) {
+            for (InsNoBxOtherExcelDto excelItem : dtoList) {
+                String reason = "";
+                i = i + 1;
+                params.clear();
+                if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                    String licenseno = excelItem.getLicenseno();//车牌号
+                    params.put("licenseno", licenseno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据车牌号有问题";
+                    }
+                }
+                if (StringUtils.isNotEmpty(excelItem.getNoPolicyno())) {
+                    String noPolicyno = excelItem.getNoPolicyno(); //交强保单号
+                    params.put("noPolicyno", noPolicyno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据非车保单号有问题";
+                    }
+                }
+                if (excelItem.getNoOtherCostsProportion()!=null  &&  excelItem.getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    BigDecimal noOtherCostsProportion = excelItem.getNoOtherCostsProportion();//商业保单号
+                    params.put("noOtherCostsProportion", noOtherCostsProportion);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据非车跟单比例有问题";
+                    }
+                }
+//                  只查手续费
+                params.put("isOther", "1");
+                params.put("isNotCar", isNotCar);
+                InsPlyIncome insPlyIncome = insPlyIncomeMapper.findByBxLicenseno(params);
+                if (ObjectUtils.isNotEmpty(insPlyIncome) && open) {
+                    open = false;
+                    companyId = insPlyIncome.getCompanyId(); // 保险公司id
+                    partnerCompaniesId =  insPlyIncome.getPartnerCompaniesId(); //合作公司id
+                    agreementId = insPlyIncome.getAgreementId();  //协议id
+                }
+                if (ObjectUtils.isNotEmpty(insPlyIncome)) {  // 比配上汇总金额 未匹配则返回到数据当中
+                    strBuilder.append(insPlyIncome.getId()).append(",");
+                    if (insPlyIncome.getCommissionFeevalue() != null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO) != 0) {
+                        totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                    }
+                } else {
+                    InsImportResult insImportResult = new InsImportResult();
+                    if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                        insImportResult.setLicenseno(excelItem.getLicenseno());
+                    }
+                    if (StringUtils.isNotEmpty(excelItem.getNoPolicyno())) {
+                        insImportResult.setPolicyno(excelItem.getNoPolicyno());
+                    }
+                    if(StringUtils.isNotEmpty(reason)){
+                        insImportResult.setReason(reason);
+                    }
+                    insImportResultsExcel.add(insImportResult);
+                }
+            }
+        }
+        if(strBuilder.length() >0){
+            ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
+        }
+        String uploadPath = this.uploadFilePath + "/excel/" + taskId + "/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "保险对账问题文件", InsImportResult.class, insImportResultsExcel);
+        String  url=uploadUrl + "excel/" + fileName;
+
+        ImportResult endTask = new ImportResult();
+        endTask.setTotalAmount(totalAmount);
+        endTask.setId(taskId);
+        endTask.setCompletedAt(LocalDateTime.now());
+        endTask.setStatus("complete");
+        if(!CollectionUtils.isEmpty(insImportResultsExcel)){
+            endTask.setUploadUrl("upload/excel/" + taskId + "/" + fileName);
+        }
+        endTask.setCompanyId(companyId);
+        endTask.setAgreementId(agreementId);
+        endTask.setPartnerCompaniesId(partnerCompaniesId);
+        endTask.setIds(ids);
+        endTask.setHandStatus("3");
+        baseMapper.updateById(endTask);
+
+    }
+
+    @Override
+    public void bxImportNoData(List<InsBxNoPlyIncomeExcelDto> dtoList, MultipartFile multipartFile, String taskId) {
+        BigDecimal totalAmount = BigDecimal.ZERO;
+        HashMap<String, Object> params = new HashMap<>();
+        StringBuffer strBuilder = new StringBuffer();
+        List<InsImportResult> insImportResultsExcel = new ArrayList<>();
+        String companyId  ="";
+        String partnerCompaniesId  ="";
+        String agreementId  ="";
+
+        boolean open = true;
+        String ids = "";
+        Integer i = 0;
+
+        //  创建任务
+        ImportResult importResult = new ImportResult();
+        importResult.setId(taskId);
+        importResult.setStatus("ready");
+        importResult.setCreateTime(LocalDateTime.now());
+        importResult.setCreatedAt(LocalDateTime.now());
+        baseMapper.insert(importResult);
+
+        if (!CollectionUtils.isEmpty(dtoList)) {
+            for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
+                String reason = "";
+                i = i + 1;
+                params.clear();
+                if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                    String licenseno = excelItem.getLicenseno();//车牌号
+                    params.put("licenseno", licenseno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据车牌号有问题";
+                    }
+                }
+                if (StringUtils.isNotEmpty(excelItem.getNoPolicyno())) {
+                    String noPolicyno = excelItem.getNoPolicyno(); //交强保单号
+                    params.put("noPolicyno", noPolicyno);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据非车保单号有问题";
+                    }
+                }
+                if (excelItem.getNoSuperviseCostsProportion()!=null  &&  excelItem.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0) {
+                    BigDecimal noSuperviseCostsProportion = excelItem.getNoSuperviseCostsProportion();//商业保单号
+                    params.put("noSuperviseCostsProportion", noSuperviseCostsProportion);
+                    InsPlyIncome byBxLicenseno = insPlyIncomeMapper.findByBxLicenseno(params);
+                    if (ObjectUtils.isEmpty(byBxLicenseno)) {
+                        reason = "该数据非车手续费比例有问题";
+                    }
+                }
+//                  只查手续费
+                params.put("isOther", "1");
+                params.put("isNotCar", "1");
+                InsPlyIncome insPlyIncome = insPlyIncomeMapper.findByBxLicenseno(params);
+                if (ObjectUtils.isNotEmpty(insPlyIncome) && open) {
+                    open = false;
+                    companyId = insPlyIncome.getCompanyId(); // 保险公司id
+                    partnerCompaniesId =  insPlyIncome.getPartnerCompaniesId(); //合作公司id
+                    agreementId = insPlyIncome.getAgreementId();  //协议id
+                }
+                if (ObjectUtils.isNotEmpty(insPlyIncome)) {  // 比配上汇总金额 未匹配则返回到数据当中
+                    strBuilder.append(insPlyIncome.getId()).append(",");
+                    if (insPlyIncome.getCommissionFeevalue() != null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO) != 0) {
+                        totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                    }
+                } else {
+                    InsImportResult insImportResult = new InsImportResult();
+                    if (StringUtils.isNotEmpty(excelItem.getLicenseno())) {
+                        insImportResult.setLicenseno(excelItem.getLicenseno());
+                    }
+                    if (StringUtils.isNotEmpty(excelItem.getNoPolicyno())) {
+                        insImportResult.setPolicyno(excelItem.getNoPolicyno());
+                    }
+                    if(StringUtils.isNotEmpty(reason)){
+                        insImportResult.setReason(reason);
+                    }
+                    insImportResultsExcel.add(insImportResult);
+                }
+            }
+        }
+        if(strBuilder.length() >0){
+            ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
+        }
+        String uploadPath = this.uploadFilePath + "/excel/" + taskId + "/";
+        Path path = Paths.get(uploadPath);
+        if (!Files.exists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        String fileName = EasyExcelUtils.downExcel(uploadPath, "保险对账问题文件", InsImportResult.class, insImportResultsExcel);
+        String  url=uploadUrl + "excel/" + fileName;
+
+        ImportResult endTask = new ImportResult();
+        endTask.setTotalAmount(totalAmount);
+        endTask.setId(taskId);
+        endTask.setCompletedAt(LocalDateTime.now());
+        endTask.setStatus("complete");
+        if(!CollectionUtils.isEmpty(insImportResultsExcel)){
+            endTask.setUploadUrl("upload/excel/" + taskId + "/" + fileName);
+        }
+        endTask.setCompanyId(companyId);
+        endTask.setAgreementId(agreementId);
+        endTask.setPartnerCompaniesId(partnerCompaniesId);
+        endTask.setIds(ids);
+        endTask.setHandStatus("3");
+        baseMapper.updateById(endTask);
+
+
+    }
+    private String getFileFolder(String type, boolean year, boolean month, boolean day) {
+        StringBuilder stringBuilder = new StringBuilder();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String dateString = dateFormat.format(new Date());
+        String[] split = dateString.split("-");
+        stringBuilder.append(type).append("/");
+        if (year) {
+            stringBuilder.append(split[0]).append("/");
+        }
+        if (month) {
+            stringBuilder.append(split[1]).append("/");
+        }
+        if (day) {
+            stringBuilder.append(split[2]).append("/");
+        }
+        return stringBuilder.toString();
+    }
+
+}

+ 143 - 100
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -3,28 +3,26 @@ package com.ydtech.modules.fnc.service.impl;
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
 import com.ydtech.constants.enums.dict.ins.InsFeeAuditDistributionStatusEnum;
 import com.ydtech.exception.SystemException;
-import com.ydtech.modules.admin.model.SysDept;
 import com.ydtech.modules.admin.model.SysDeptAccount;
-import com.ydtech.modules.admin.model.SysDeptAccountHistory;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
-import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fnc.dao.FncInsAreaCompanyMapper;
+import com.ydtech.modules.fnc.dao.InsFeeAuditMapper;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
+import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.fnc.entity.InsFeeAudit;
-import com.ydtech.modules.fnc.dao.InsFeeAuditMapper;
 import com.ydtech.modules.fnc.entity.InsFeeAuditHistory;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.service.InsFeeAuditHistoryService;
 import com.ydtech.modules.fnc.service.InsFeeAuditService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.ins.model.InsCommission;
 import com.ydtech.modules.ins.model.InsCompanyFee;
@@ -33,11 +31,8 @@ import com.ydtech.modules.ins.service.InsCommissionService;
 import com.ydtech.modules.ins.service.InsCompanyFeeService;
 import com.ydtech.modules.ins.service.InsDeptFeeService;
 import com.ydtech.modules.order.dao.InsOrdersMapper;
-import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsFeeOrder;
 import com.ydtech.modules.order.entity.InsOrders;
-import com.ydtech.modules.order.service.InsFeeOrderService;
-import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNewDistribution;
@@ -62,7 +57,7 @@ import java.util.List;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author gws
@@ -108,56 +103,59 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     private InsFeeOrderNewDistributionService insFeeOrderNewDistributionService;
 
 
-
-    public InsFeeAuditServiceImpl(FncInsAreaCompanyMapper insAreaCompanyMapper, InsOrdersMapper insOrdersMapper, InsDeptFeeService insDeptFeeService, EsmUserReferrerService esmUserReferrerService, SysUserService sysUserService, InsCommissionService insCommissionService, InsCompanyFeeService insCompanyFeeService, InsPlyIncomeMapper insPlyIncomeMapper) {
+    public InsFeeAuditServiceImpl(FncInsAreaCompanyMapper insAreaCompanyMapper, InsOrdersMapper insOrdersMapper,
+                                  InsDeptFeeService insDeptFeeService, EsmUserReferrerService esmUserReferrerService,
+                                  SysUserService sysUserService, InsCommissionService insCommissionService,
+                                  InsCompanyFeeService insCompanyFeeService, InsPlyIncomeMapper insPlyIncomeMapper) {
         this.insAreaCompanyMapper = insAreaCompanyMapper;
         this.insOrdersMapper = insOrdersMapper;
-        this.insDeptFeeService=insDeptFeeService;
-        this.esmUserReferrerService=esmUserReferrerService;
-        this.sysUserService=sysUserService;
-        this.insCommissionService=insCommissionService;
-        this.insCompanyFeeService=insCompanyFeeService;
-        this.insPlyIncomeMapper=insPlyIncomeMapper;
+        this.insDeptFeeService = insDeptFeeService;
+        this.esmUserReferrerService = esmUserReferrerService;
+        this.sysUserService = sysUserService;
+        this.insCommissionService = insCommissionService;
+        this.insCompanyFeeService = insCompanyFeeService;
+        this.insPlyIncomeMapper = insPlyIncomeMapper;
     }
+
     @Override
     @Transactional
     public void feeAudit(String orderNo, String insOrderNo, boolean isAutoAudit) {
         //添加费用审核表及轨迹信息
-        InsFeeAudit insFeeAudit = saveInsFeeAuditAndHistory(orderNo, insOrderNo,isAutoAudit, FeeAuditAuditstatus.PASSED.getCode());
+        InsFeeAudit insFeeAudit = saveInsFeeAuditAndHistory(orderNo, insOrderNo, isAutoAudit, FeeAuditAuditstatus.PASSED.getCode());
 
-        InsOrders order=insOrdersMapper.selectById(orderNo);
-        InsAreaCompany insAreaCompany=insAreaCompanyMapper.selectById(insFeeAudit.getInsOrderNo());
+        InsOrders order = insOrdersMapper.selectById(orderNo);
+        InsAreaCompany insAreaCompany = insAreaCompanyMapper.selectById(insFeeAudit.getInsOrderNo());
 
         //获取该订单的费用
         InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
                 .eq(InsFeeOrderNew::getInsOrderNo, insFeeAudit.getInsOrderNo()));
 
         //生成机构费用
-        gene_deptfee( order, insFeeOrderNew,insAreaCompany);
+        gene_deptfee(order, insFeeOrderNew, insAreaCompany);
         //结算费用生成
-        insPlyIncomeService.saveBalanceNew(order,insFeeOrderNew,insAreaCompany);
+        insPlyIncomeService.saveBalanceNew(order, insFeeOrderNew, insAreaCompany);
 
         //生成  用户账户表  数据
-        if(StringUtils.isNotEmpty(order.getUserid())){
-        //用戶賬戶表
+        if (StringUtils.isNotEmpty(order.getUserid())) {
+            //用戶賬戶表
             SysUserAccount sysUserAccount = new SysUserAccount();
             //add  by  hxl  2024-05-07  begin   ==========
             //判断当前用户是否是出单员,如果是直接给团队长结算   角色id为19为出单员
-            String userId="";
+            String userId = "";
             SysUserBaseVO sysUserBaseVO = sysUserService.selectUserById(order.getUserid());
-            if("19".equals(sysUserBaseVO.getRoleId())){
-               //查找该机构的团队长
+            if ("19".equals(sysUserBaseVO.getRoleId())) {
+                //查找该机构的团队长
                 userId = sysUserService.findTDZUserIdByDeptId(sysUserBaseVO.getDeptId());
-                if(userId==null || "".equals(userId)){
-                    throw new SystemException("出单员"+sysUserBaseVO.getName()+"所在机构缺少团队长,请设置!!!");
+                if (userId == null || "".equals(userId)) {
+                    throw new SystemException("出单员" + sysUserBaseVO.getName() + "所在机构缺少团队长,请设置!!!");
                 }
 
-            }else{
+            } else {
                 userId = order.getUserid();
             }
             sysUserAccount.setUserId(userId);
             // add by  hxl   2024-05-07  end ==================
-            if (ObjectUtils.isNotEmpty(insFeeOrderNew) ) {
+            if (ObjectUtils.isNotEmpty(insFeeOrderNew)) {
 
                 //用户出口手续费
                 BigDecimal totalPremiumAmount = new BigDecimal(0);
@@ -166,14 +164,15 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
                 //用户出口跟单费
                 BigDecimal totalOtherPremiumAmount = new BigDecimal(0);
-                totalOtherPremiumAmount = totalOtherPremiumAmount.add(insFeeOrderNew.getJqExportOtherCostsPremiums()).add(insFeeOrderNew.getSyExportOtherCostsPremiums()).add(insFeeOrderNew.getNoExportOtherCostsPremiums());
+                totalOtherPremiumAmount =
+                        totalOtherPremiumAmount.add(insFeeOrderNew.getJqExportOtherCostsPremiums()).add(insFeeOrderNew.getSyExportOtherCostsPremiums()).add(insFeeOrderNew.getNoExportOtherCostsPremiums());
 
 
                 //用戶
                 sysUserAccount.setHandlingFee(totalPremiumAmount);
                 sysUserAccount.setDocumentary(totalOtherPremiumAmount);
                 //算佣金
-                this.countUserAmount(insFeeOrderNew,orderNo);
+                this.countUserAmount(insFeeOrderNew, orderNo);
                 sysUserAccount.setDocumentaryStatus("2");  // 收入
                 sysUserAccount.setSuborderId(orderNo);  // 订单Id
                 sysUserAccountService.addOrUpdate(sysUserAccount);
@@ -250,14 +249,18 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     }
                     // 记录历史信息
                     // 拼接备注
-                    String remark = this.getDeptFeeHistoryLog(i,jqDeptPremiumsLevels,syDeptPremiumsLevels,noDeptPremiumsLevels,distributionFee);
-                    sysDeptAccountHistoryService.addHistory(levelDeptId, sumManagementFee, levelSysDeptAccount.getManagementFee(), "2", insOrderNo, BaseController.getUser().getId(), remark);
+                    String remark = this.getDeptFeeHistoryLog(i, jqDeptPremiumsLevels, syDeptPremiumsLevels, noDeptPremiumsLevels,
+                            distributionFee);
+                    sysDeptAccountHistoryService.addHistory(levelDeptId, sumManagementFee, levelSysDeptAccount.getManagementFee(), "2",
+                            insOrderNo, BaseController.getUser().getId(), remark);
                 }
             }
         }
     }
 
-    private void createInsFeeOrderNewDistribution(InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany, InsOrders insOrders, String userId, BigDecimal commissionRate, BigDecimal commissionAmount, String commissionLevel) {
+    private void createInsFeeOrderNewDistribution(InsFeeOrderNew insFeeOrderNew, InsAreaCompany insAreaCompany, InsOrders insOrders,
+                                                  String userId, BigDecimal commissionRate, BigDecimal commissionAmount,
+                                                  String commissionLevel) {
         InsFeeOrderNewDistribution insFeeOrderNewDistribution = new InsFeeOrderNewDistribution();
         insFeeOrderNewDistribution.setId(IdGenerate.nextId());
         insFeeOrderNewDistribution.setOrderNo(insFeeOrderNew.getInsOrderNo());
@@ -276,8 +279,8 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         insFeeOrderNewDistributionService.save(insFeeOrderNewDistribution);
     }
 
-    private String getDeptFeeHistoryLog(Integer index,BigDecimal[] jqDeptPremiumsLevels,BigDecimal[] syDeptPremiumsLevels,
-                                        BigDecimal[] noDeptPremiumsLevels,BigDecimal distributionFee){
+    private String getDeptFeeHistoryLog(Integer index, BigDecimal[] jqDeptPremiumsLevels, BigDecimal[] syDeptPremiumsLevels,
+                                        BigDecimal[] noDeptPremiumsLevels, BigDecimal distributionFee) {
         StringBuilder remarkBuilder = new StringBuilder();
         if (jqDeptPremiumsLevels[index - 1].compareTo(BigDecimal.ZERO) != 0) {
             remarkBuilder.append("交强").append(index).append("级机构管理费:");
@@ -394,26 +397,27 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
     /**
      * 生成保司费用(应收费用)
+     *
      * @param order
      * @param insFeeOrder
      * @throws Exception
      */
-    private void gene_orderIncome( InsOrders order, InsFeeOrderNew insFeeOrder,InsAreaCompany plyDto) throws Exception{
+    private void gene_orderIncome(InsOrders order, InsFeeOrderNew insFeeOrder, InsAreaCompany plyDto) throws Exception {
 
-        InsPlyIncome insPlyIncome =new InsPlyIncome();
+        InsPlyIncome insPlyIncome = new InsPlyIncome();
         insPlyIncome.setOrderno(order.getOrderno());
         insPlyIncome.setDeptId(order.getDeptid());
         insPlyIncome.setCompanyId(plyDto.getCompanyId());
         insPlyIncome.setAgreementId(String.valueOf(plyDto.getAgreementId()));
         insPlyIncome.setLicenseno(order.getLicenseno());
-        insPlyIncome.setPayDate(StringUtils.isNullOrEmpty(plyDto.getPayDate())?plyDto.getCreatetime():plyDto.getPayDate());
-        insPlyIncome.setSignDate(StringUtils.isNullOrEmpty(plyDto.getInsidePayTime())?plyDto.getPayDate():plyDto.getInsidePayTime());
-        insPlyIncome.setCreateTime(LocalDate.now() );
-        if(StringUtils.isNotEmpty(plyDto.getJqpolicyno())){
+        insPlyIncome.setPayDate(StringUtils.isNullOrEmpty(plyDto.getPayDate()) ? plyDto.getCreatetime() : plyDto.getPayDate());
+        insPlyIncome.setSignDate(StringUtils.isNullOrEmpty(plyDto.getInsidePayTime()) ? plyDto.getPayDate() : plyDto.getInsidePayTime());
+        insPlyIncome.setCreateTime(LocalDate.now());
+        if (StringUtils.isNotEmpty(plyDto.getJqpolicyno())) {
             insPlyIncome.setPolicyno(plyDto.getJqpolicyno());
             insPlyIncome.setRiskcode("交强");
             insPlyIncome.setTaxamount(plyDto.getTaxamount());
-            if(!ObjectUtils.isEmpty(insFeeOrder)){
+            if (!ObjectUtils.isEmpty(insFeeOrder)) {
                 insPlyIncome.setNoTaxPremium(insFeeOrder.getJqNoTaxPremium());
                 insPlyIncome.setCommissionFeerate(insFeeOrder.getJqSuperviseCostsProportion());
                 insPlyIncome.setOtherFeerate(insFeeOrder.getJqCostsProportion().subtract(insFeeOrder.getJqSuperviseCostsProportion()));
@@ -423,11 +427,11 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             }
             insPlyIncomeMapper.insert(insPlyIncome);
         }
-        if(StringUtils.isNotEmpty(plyDto.getSypolicyno())){
+        if (StringUtils.isNotEmpty(plyDto.getSypolicyno())) {
             insPlyIncome.setPolicyno(plyDto.getSypolicyno());
             insPlyIncome.setRiskcode("商业");
             insPlyIncome.setTaxamount(new BigDecimal(0));
-            if(!ObjectUtils.isEmpty(insFeeOrder)){
+            if (!ObjectUtils.isEmpty(insFeeOrder)) {
                 insPlyIncome.setNoTaxPremium(insFeeOrder.getSyNoTaxPremium());
                 insPlyIncome.setCommissionFeerate(insFeeOrder.getSySuperviseCostsProportion());
                 insPlyIncome.setOtherFeerate(insFeeOrder.getSyCostsProportion().subtract(insFeeOrder.getSySuperviseCostsProportion()));
@@ -439,33 +443,35 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         }
 
     }
+
     /**
      * 生成机构费用
+     *
      * @param order
      * @param insFeeOrder
      * @throws Exception
      */
-    private void gene_deptfee( InsOrders order, InsFeeOrderNew insFeeOrder,InsAreaCompany plyDto){
+    private void gene_deptfee(InsOrders order, InsFeeOrderNew insFeeOrder, InsAreaCompany plyDto) {
         InsDeptFee deptFee = new InsDeptFee();
         deptFee.setOrderno(order.getOrderno());
-        if(!ObjectUtils.isEmpty(insFeeOrder)){
+        if (!ObjectUtils.isEmpty(insFeeOrder)) {
             deptFee.setQuoteno(insFeeOrder.getInsOrderNo());
         }
         deptFee.setAgreeid(String.valueOf(plyDto.getAgreementId()));
         deptFee.setAuditstatus("1");
         deptFee.setSettlestatus("0");
-        if(plyDto.getInsidePayTime()!=null){
-            deptFee.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(),DateUtil.FULL_TIME_SPLIT_PATTERN));
+        if (plyDto.getInsidePayTime() != null) {
+            deptFee.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(), DateUtil.FULL_TIME_SPLIT_PATTERN));
 
         }
         deptFee.setInscompany(plyDto.getCompanyId());
-        if(StringUtils.isNotEmpty(plyDto.getJqpolicyno())){
+        if (StringUtils.isNotEmpty(plyDto.getJqpolicyno())) {
             deptFee.setPolicyno(plyDto.getJqpolicyno());
             deptFee.setRiskcode("交强");
             deptFee.setLicenseno(order.getLicenseno());
             geneJqInsDeptFee(order, insFeeOrder, deptFee);
         }
-        if(StringUtils.isNotEmpty(plyDto.getSypolicyno())){
+        if (StringUtils.isNotEmpty(plyDto.getSypolicyno())) {
             deptFee.setPolicyno(plyDto.getSypolicyno());
             deptFee.setRiskcode("商业");
             deptFee.setLicenseno(order.getLicenseno());
@@ -475,7 +481,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     }
 
     private void geneJqInsDeptFee(InsOrders order, InsFeeOrderNew insFeeOrder, InsDeptFee deptFee) {
-        if(!ObjectUtils.isEmpty(insFeeOrder)){
+        if (!ObjectUtils.isEmpty(insFeeOrder)) {
             if (insFeeOrder.getJqDeptPremiumsLevel1().doubleValue() > 0) {
                 deptFee.setComcode(order.getDeptid().substring(0, 2));  //99140302M01D01
                 deptFee.setComlevel("一级");
@@ -505,7 +511,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     }
 
     private void geneSyInsDeptFee(InsOrders order, InsFeeOrderNew insFeeOrder, InsDeptFee deptFee) {
-        if(!ObjectUtils.isEmpty(insFeeOrder)){
+        if (!ObjectUtils.isEmpty(insFeeOrder)) {
             if (insFeeOrder.getSyDeptPremiumsLevel1().doubleValue() > 0) {
                 deptFee.setComcode(order.getDeptid().substring(0, 2));  //99140302M01D01
                 deptFee.setComlevel("一级");
@@ -540,16 +546,15 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
      * @param order
      * @return
      */
-    public void saveRetail(InsOrders order,InsFeeOrder insFeeOrder,InsAreaCompany plyDto) throws Exception{
-        List<String> userlist=new ArrayList<>();
-        esmUserReferrerService.getUpUser(order.getUserid(),userlist);
+    public void saveRetail(InsOrders order, InsFeeOrder insFeeOrder, InsAreaCompany plyDto) throws Exception {
+        List<String> userlist = new ArrayList<>();
+        esmUserReferrerService.getUpUser(order.getUserid(), userlist);
 
         //userlist:包括本人在内向上所有人
-        if(userlist.size()-1>0){
-            if(userlist.size()-1>=1
-                    &&insFeeOrder.getThirdRetailPremiums().doubleValue()>0)
-            {//三级分销
-                SysUser user=sysUserService.getById(userlist.get(1));
+        if (userlist.size() - 1 > 0) {
+            if (userlist.size() - 1 >= 1
+                    && insFeeOrder.getThirdRetailPremiums().doubleValue() > 0) {//三级分销
+                SysUser user = sysUserService.getById(userlist.get(1));
                 InsCommission commission = new InsCommission();
                 commission.setOrderno(order.getOrderno());
                 commission.setQuoteno(insFeeOrder.getInsOrderNo());
@@ -562,9 +567,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 commission.setLevel("3");
                 commission.setAuditstatus("1");  //0未审核 1已审核
                 commission.setSettlestatus("0"); //0未结算 1已结算
-                commission.setInsuredtime(DateUtil.formatFullTime(plyDto.getPayDate(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-                commission.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-                if(StringUtils.isNotEmpty(plyDto.getJqpolicyno())){
+                commission.setInsuredtime(DateUtil.formatFullTime(plyDto.getPayDate(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+                commission.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+                if (StringUtils.isNotEmpty(plyDto.getJqpolicyno())) {
                     commission.setPolicyno(plyDto.getJqpolicyno());
                     commission.setRiskcode("交强");
                     commission.setLicenseno(order.getLicenseno());
@@ -572,7 +577,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     commission.setCommissionamount(insFeeOrder.getJqNoTaxPremium().multiply(insFeeOrder.getThirdRetailProportion()).divide(new BigDecimal(100)).doubleValue());
                     insCommissionService.insert(commission);
                 }
-                if(StringUtils.isNotEmpty(plyDto.getSypolicyno())){
+                if (StringUtils.isNotEmpty(plyDto.getSypolicyno())) {
                     commission.setPolicyno(plyDto.getSypolicyno());
                     commission.setRiskcode("商业");
                     commission.setLicenseno(order.getLicenseno());
@@ -582,10 +587,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 }
 
             }
-            if(userlist.size()-1>=2
-                    &&insFeeOrder.getSecondRetailPremiums().doubleValue()>0)
-            {//二级分销
-                SysUser user=sysUserService.getById(userlist.get(2));
+            if (userlist.size() - 1 >= 2
+                    && insFeeOrder.getSecondRetailPremiums().doubleValue() > 0) {//二级分销
+                SysUser user = sysUserService.getById(userlist.get(2));
                 InsCommission commission = new InsCommission();
                 commission.setOrderno(order.getOrderno());
                 commission.setQuoteno(insFeeOrder.getInsOrderNo());
@@ -600,9 +604,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 commission.setLevel("2");
                 commission.setAuditstatus("1");  //0未审核 1已审核
                 commission.setSettlestatus("0"); //0未结算 1已结算
-                commission.setInsuredtime(DateUtil.formatFullTime(plyDto.getPayDate(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-                commission.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-                if(StringUtils.isNotEmpty(plyDto.getJqpolicyno())){
+                commission.setInsuredtime(DateUtil.formatFullTime(plyDto.getPayDate(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+                commission.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+                if (StringUtils.isNotEmpty(plyDto.getJqpolicyno())) {
                     commission.setPolicyno(plyDto.getJqpolicyno());
                     commission.setRiskcode("交强");
                     commission.setLicenseno(order.getLicenseno());
@@ -610,7 +614,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     commission.setCommissionamount(insFeeOrder.getJqNoTaxPremium().multiply(insFeeOrder.getSecondRetailProportion()).divide(new BigDecimal(100)).doubleValue());
                     insCommissionService.insert(commission);
                 }
-                if(StringUtils.isNotEmpty(plyDto.getSypolicyno())){
+                if (StringUtils.isNotEmpty(plyDto.getSypolicyno())) {
                     commission.setPolicyno(plyDto.getSypolicyno());
                     commission.setRiskcode("商业");
                     commission.setLicenseno(order.getLicenseno());
@@ -619,10 +623,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     insCommissionService.insert(commission);
                 }
             }
-            if(userlist.size()-1>=3
-                    &&insFeeOrder.getFirstRetailPremiums().doubleValue()>0)
-            {//一级分销
-                SysUser user=sysUserService.getById(userlist.get(3));
+            if (userlist.size() - 1 >= 3
+                    && insFeeOrder.getFirstRetailPremiums().doubleValue() > 0) {//一级分销
+                SysUser user = sysUserService.getById(userlist.get(3));
                 InsCommission commission = new InsCommission();
                 commission.setOrderno(order.getOrderno());
                 commission.setQuoteno(insFeeOrder.getInsOrderNo());
@@ -637,9 +640,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 commission.setLevel("1");
                 commission.setAuditstatus("1");  //0未审核 1已审核
                 commission.setSettlestatus("0"); //0未结算 1已结算
-                commission.setInsuredtime(DateUtil.formatFullTime(plyDto.getPayDate(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-                commission.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-                if(StringUtils.isNotEmpty(plyDto.getJqpolicyno())){
+                commission.setInsuredtime(DateUtil.formatFullTime(plyDto.getPayDate(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+                commission.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+                if (StringUtils.isNotEmpty(plyDto.getJqpolicyno())) {
                     commission.setPolicyno(plyDto.getJqpolicyno());
                     commission.setRiskcode("交强");
                     commission.setLicenseno(order.getLicenseno());
@@ -647,7 +650,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     commission.setCommissionamount(insFeeOrder.getJqNoTaxPremium().multiply(insFeeOrder.getFirstRetailProportion()).divide(new BigDecimal(100)).doubleValue());
                     insCommissionService.insert(commission);
                 }
-                if(StringUtils.isNotEmpty(plyDto.getSypolicyno())){
+                if (StringUtils.isNotEmpty(plyDto.getSypolicyno())) {
                     commission.setPolicyno(plyDto.getSypolicyno());
                     commission.setRiskcode("商业");
                     commission.setLicenseno(order.getLicenseno());
@@ -662,11 +665,12 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
     /**
      * 生成个代费用
+     *
      * @param order
      * @param insFeeOrder
      * @throws Exception
      */
-    public void saveInsCompanyFee(InsOrders order,InsFeeOrder insFeeOrder,InsAreaCompany plyDto) throws Exception {
+    public void saveInsCompanyFee(InsOrders order, InsFeeOrder insFeeOrder, InsAreaCompany plyDto) throws Exception {
 
         InsCompanyFee insCompanyFee = new InsCompanyFee();
         insCompanyFee.setOrderno(order.getOrderno());
@@ -680,30 +684,30 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         insCompanyFee.setDeptname(order.getDeptname());
         insCompanyFee.setSettletype("B");
         insCompanyFee.setSettlestatus("0");
-        insCompanyFee.setCreatetime(DateUtil.getDateFormat(new Date(),DateUtil.FULL_TIME_SPLIT_PATTERN));
-        if(plyDto.getInsidePayTime()!=null){
-            insCompanyFee.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(),DateUtil.FULL_TIME_SPLIT_PATTERN));
+        insCompanyFee.setCreatetime(DateUtil.getDateFormat(new Date(), DateUtil.FULL_TIME_SPLIT_PATTERN));
+        if (plyDto.getInsidePayTime() != null) {
+            insCompanyFee.setSignDate(DateUtil.formatFullTime(plyDto.getInsidePayTime(), DateUtil.FULL_TIME_SPLIT_PATTERN));
         }
-        if(ObjectUtils.isNotEmpty(insFeeOrder)){
-            BigDecimal dept_rate=insFeeOrder.getFirstDeptProportion()
+        if (ObjectUtils.isNotEmpty(insFeeOrder)) {
+            BigDecimal dept_rate = insFeeOrder.getFirstDeptProportion()
                     .add(insFeeOrder.getSecondDeptProportion())
                     .add(insFeeOrder.getThirdDeptProportion())
                     .add(insFeeOrder.getForthDeptProportion())
                     .add(insFeeOrder.getFifthDeptProportion());
-            BigDecimal retail_rate=insFeeOrder.getFirstRetailProportion()
+            BigDecimal retail_rate = insFeeOrder.getFirstRetailProportion()
                     .add(insFeeOrder.getSecondRetailProportion())
                     .add(insFeeOrder.getThirdRetailProportion());
-            if(StringUtils.isNotEmpty(plyDto.getJqpolicyno())){
+            if (StringUtils.isNotEmpty(plyDto.getJqpolicyno())) {
                 insCompanyFee.setPolicyno(plyDto.getJqpolicyno());
                 insCompanyFee.setRiskcode("交强");
                 //交强费用比例=交强险费用比例-五级机构管理费比例-三级分销比例
                 insCompanyFee.setFeerate(insFeeOrder.getJqCostsProportion().subtract(dept_rate).subtract(retail_rate).doubleValue());
-                insCompanyFee.setFeeamount(insFeeOrder.getJqNoTaxPremium().multiply(insFeeOrder.getJqCostsProportion().subtract(dept_rate).subtract(retail_rate)).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
+                insCompanyFee.setFeeamount(insFeeOrder.getJqNoTaxPremium().multiply(insFeeOrder.getJqCostsProportion().subtract(dept_rate).subtract(retail_rate)).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
                 insCompanyFee.setJqpremium(insFeeOrder.getJqNoTaxPremium().doubleValue());
                 //保存业务员费用
                 insCompanyFeeService.insert(insCompanyFee);
             }
-            if(StringUtils.isNotEmpty(plyDto.getSypolicyno())){
+            if (StringUtils.isNotEmpty(plyDto.getSypolicyno())) {
                 insCompanyFee.setPolicyno(plyDto.getSypolicyno());
                 insCompanyFee.setRiskcode("商业");
                 insCompanyFee.setFeerate(0);
@@ -711,7 +715,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                 insCompanyFee.setJqpremium(0);
                 //商业费用比例=商业险费用比例-五级机构管理费比例-三级分销比例
                 insCompanyFee.setDisrate(insFeeOrder.getSyCostsProportion().subtract(dept_rate).subtract(retail_rate).doubleValue());
-                insCompanyFee.setDisamount(insFeeOrder.getSyNoTaxPremium().multiply(insFeeOrder.getSyCostsProportion().subtract(dept_rate).subtract(retail_rate)).divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
+                insCompanyFee.setDisamount(insFeeOrder.getSyNoTaxPremium().multiply(insFeeOrder.getSyCostsProportion().subtract(dept_rate).subtract(retail_rate)).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
                 insCompanyFee.setSypremium(insFeeOrder.getSyNoTaxPremium().doubleValue());
                 //保存业务员费用
                 insCompanyFeeService.insert(insCompanyFee);
@@ -735,22 +739,61 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         //查询费用审核表
         InsFeeAudit insFeeAudit = getOne(new LambdaQueryWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
 
+        String userId;
+        // 填充审核人
+        if (isAutoAudit) {
+            userId = "自动审核";
+        } else {
+            userId = StpUtil.getLoginId().toString();
+        }
+
         //添加审核轨迹表
         InsFeeAuditHistory insFeeAuditHistory = new InsFeeAuditHistory();
         if (insFeeAudit == null) {
             insFeeAudit = new InsFeeAudit();
-            // 填充审核人
-            if (isAutoAudit) {
-                insFeeAudit.setAudituser("自动审核");
-            } else {
-                insFeeAudit.setAudituser(StpUtil.getLoginId().toString());
-            }
             // 设置订单号和保险订单号
+            insFeeAudit.setAudituser(userId);
             insFeeAudit.setOrderno(orderNo);
             insFeeAudit.setInsOrderNo(insOrderNo);
             insFeeAudit.setAudittime(LocalDateTime.now());
             insFeeAudit.setAuditstatus(auditstatus);
             this.save(insFeeAudit);
+        } else {
+            //状态码为已审核且数据不为空,则更新审核状态
+            insFeeAudit.setAuditstatus(auditstatus);
+            insFeeAudit.setAudituser(userId);
+            this.update(insFeeAudit, new LambdaUpdateWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
+        }
+        //复制审核对象的属性
+        BeanUtils.copyProperties(insFeeAudit, insFeeAuditHistory);
+
+        InsAreaCompany insAreaCompany = insAreaCompanyMapper.selectById(insFeeAudit.getInsOrderNo());
+
+        // 设置操作时间和操作人及保险公司名称
+        insFeeAuditHistory.setInsCompany(insAreaCompany.getInscompany());
+        insFeeAuditHistory.setOperatorTime(LocalDateTime.now());
+        insFeeAuditHistory.setOperator(BaseController.getUser().getName());
+
+        // 保存审核轨迹
+        insFeeAuditHistoryService.save(insFeeAuditHistory);
+
+        return insFeeAudit;
+    }
+
+    @Override
+    public InsFeeAudit saveDefaultInsFeeAuditAndHistory(String orderNo, String insOrderNo, String auditstatus) {
+        //查询费用审核表
+        InsFeeAudit insFeeAudit = getOne(new LambdaQueryWrapper<InsFeeAudit>().eq(InsFeeAudit::getOrderno, orderNo));
+
+        //添加审核轨迹表
+        InsFeeAuditHistory insFeeAuditHistory = new InsFeeAuditHistory();
+        if (insFeeAudit == null) {
+            insFeeAudit = new InsFeeAudit();
+            // 设置订单号和保险订单号
+            insFeeAudit.setOrderno(orderNo);
+            insFeeAudit.setInsOrderNo(insOrderNo);
+            insFeeAudit.setAuditstatus(auditstatus);
+            this.save(insFeeAudit);
         } else {
             //状态码为已审核且数据不为空,则更新审核状态
             insFeeAudit.setAuditstatus(auditstatus);

+ 177 - 17
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -17,11 +17,9 @@ import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
-import com.ydtech.modules.fnc.entity.InsAreaCompany;
-import com.ydtech.modules.fnc.entity.InsPlyIncome;
+import com.ydtech.modules.fnc.entity.*;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
-import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
-import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import com.ydtech.modules.fnc.service.ImportAsyncService;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
@@ -108,6 +106,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     private PtlAgreementService  ptlAgreementService;
     @Autowired
     private EsmInsCompanyService EsmInsCompanyService;
+    @Autowired
+    private ImportAsyncService  importAsyncService;
 
     @Value("${upload.file.path}")
     private String uploadPath;
@@ -1228,11 +1228,17 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setIsNotCar(insPlyIncomeVo.getIsNotCar());   // 是否是非车
         insPlyIncome.setIsNotDocumentary(insPlyIncomeVo.getIsNotDocumentary());  //是否是跟单
 
+        HashMap<String, Object> params = new HashMap<>();
+        params.put("companyId",insPlyIncomeVo.getCompanyId());
+        params.put("partnerCompaniesId",insPlyIncomeVo.getPartnerCompaniesId());
+
+        PtlAgreement ptlAgreement =   ptlAgreementService.selectAgreeId(params);
+        insPlyIncome.setAgreementId(ptlAgreement.getId());
         baseMapper.insert(insPlyIncome);
-//        insPlyIncomeVo.setId(insPlyIncome.getId());
-//        insPlyIncomeVo.setCrudStatus("1");
-//        this.saveLog(insPlyIncomeVo);   //添加日志
-//
+        insPlyIncomeVo.setId(insPlyIncome.getId());
+        insPlyIncomeVo.setCrudStatus("1");
+        this.saveLog(insPlyIncomeVo);   //添加日志
+
 //        HashMap<String, Object> params = new HashMap<>();
 //
 //        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
@@ -1374,8 +1380,11 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar()); // 是否是非车
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod());  //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints());  //税点
-//            allAmount =insPlyIncomeVo.getInvoicCommissionFeevalue().multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100))));
-        settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getInvoicCommissionFeevalue().multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+        if ("0".equals(insPlyIncomeVo.getInvoicingMethod())) {
+            settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getSettlementAmount().multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+        } else {
+            settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getSettlementAmount());   //进账金额
+        }
         settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());   //进账金额
         settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
         settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());
@@ -1435,8 +1444,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     @Transactional
     public HttpResult<Object> batchInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
+        ImportResult importResult = importAsyncService.getById(insPlyIncomeVo.getSelectIds().get(0));
+
         //      开票时生成  记录 用来合计已经开票数据
-        String ids = insPlyIncomeVo.getIds();
+        String ids = importResult.getIds();
         if(StringUtils.isNotEmpty(ids)){
             String[] split = ids.split(",");
             for (String id :  split){
@@ -1447,13 +1458,16 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 baseMapper.updateById(insPlyIncome);
             }
         }
-        insPlyIncomeVo.setNoInvoicCommissionFeevalue(insPlyIncomeVo.getTotalAmount());
-        insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setNoInvoicCommissionFeevalue(importResult.getTotalAmount());
+        insPlyIncomeVo.setOtherFeevalue(importResult.getTotalAmount());
         insPlyIncomeVo.setHandlingFeesStatus("0");  // 0手续费 1  跟单费
         insPlyIncomeVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
-        insPlyIncomeVo.setAgreementId(insPlyIncomeVo.getAgreementId());
-        insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setAgreementId(importResult.getAgreementId());
+        insPlyIncomeVo.setPartnerCompaniesId(importResult.getPartnerCompaniesId());
+        insPlyIncomeVo.setSettlementAmount(importResult.getTotalAmount());
         insPlyIncomeVo.setContractId(insPlyIncomeVo.getInvoicId());
+        insPlyIncomeVo.setCompanyId(importResult.getCompanyId());
+        insPlyIncomeVo.setIds(importResult.getIds());
         this.batchInvoic(insPlyIncomeVo);
         return HttpResult.ok();
     }
@@ -1623,11 +1637,11 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
         settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
         settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
+        settlementDocumentaryFeesVo.setAgreementId(insPlyIncomeVo.getAgreementId());
         settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue());  //其他费用金额
         settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
         settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
         settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
-        settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
         settlementDocumentaryFeesVo.setSettlementStatus("1");
         settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getContractId())){
@@ -1638,9 +1652,11 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
         settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIds());
         //  税点支出
-        if(BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) !=null && insPlyIncomeVo.getTaxPoints().compareTo(BigDecimal.ZERO) != 0   && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) !=null){
+        if( "0".equals(insPlyIncomeVo.getInvoicingMethod()) && BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) !=null && insPlyIncomeVo.getTaxPoints().compareTo(BigDecimal.ZERO) != 0   && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) !=null){
             BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();
             settlementDocumentaryFeesVo.setExpendAmount(settlementAmount.multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+        }else {
+            settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getSettlementAmount());
         }
         return  settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
     }
@@ -1742,6 +1758,14 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         InsPlyIncome totalledAmount =baseMapper.bxTotalAmount(params);  //总金额
         return totalledAmount;
     }
+    @Override
+    public InsPlyIncome ptTotalAmount(InsPlyIncomeVo insPlyIncomeVo) {
+        HashMap<String, Object> params = new HashMap<>();
+        params = this.saveParams(insPlyIncomeVo, params);
+        InsPlyIncome totalledAmount =baseMapper.ptTotalAmount(params);  //总金额
+        return totalledAmount;
+    }
+
     @Override
     public HttpResult<List<HashMap<String,Object>>> otherTimeDetail(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
@@ -1816,4 +1840,140 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
     }
 
+    @Override
+    @Transactional
+    public HashMap<String, Object> bxImportOther(MultipartFile multipartFile,String  isNotCar) {
+        HashMap<String, Object> resultMap = new HashMap<>();
+        List<HashMap<String,Object>>  resultList=new ArrayList<>();
+        HashMap<String, Object> params = new HashMap<>();
+        BigDecimal allAmount = BigDecimal.ZERO;
+        params.put("isNotCar",isNotCar);
+        try {
+            List<InsBxOtherExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxOtherExcelDto.class, 0, 1, 1);
+            for (InsBxOtherExcelDto  item  : dtoList){
+                if(StringUtils.isNotEmpty(item.getLicenseno())){
+                    params.put("licenseno",item.getLicenseno());
+                }
+                if(StringUtils.isNotEmpty(item.getPolicyno())){
+                    params.put("policyno",item.getPolicyno());
+                }
+
+                if(StringUtils.isNotEmpty(item.getSyPolicyno())){
+                    params.put("syPolicyno",item.getSyPolicyno());
+                }
+                params.put("handlingFeesStatus","0");
+                InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+
+                if (item.getJqOtherCostsProportion() ==null){
+                    item.setJqOtherCostsProportion(BigDecimal.ZERO);
+                }
+                if(item.getSyOtherCostsProportion() == null){
+                    item.setSyOtherCostsProportion(BigDecimal.ZERO);
+                }
+
+                if(byBxLicenseno.getJqOtherCostsProportion().compareTo(item.getJqOtherCostsProportion()) !=0 ||  byBxLicenseno.getSyOtherCostsProportion().compareTo(item.getSyOtherCostsProportion()) != 0){
+                // 如果比例不相等
+                    BigDecimal jqOtherCostsProportion = item.getJqOtherCostsProportion();
+                    BigDecimal syOtherCostsProportion = item.getSyOtherCostsProportion();
+
+                    BigDecimal jqNoTaxPremium = byBxLicenseno.getJqNoTaxPremium();//交强不含税保费
+                    BigDecimal syNoTaxPremium = byBxLicenseno.getSyNoTaxPremium();// 商业不含税比例
+                    BigDecimal jqOtherAmount = jqNoTaxPremium.multiply(item.getJqOtherCostsProportion().divide(new BigDecimal(100)));  //交强跟单费用
+                    BigDecimal syOtherAmount = syNoTaxPremium.multiply(item.getSyOtherCostsProportion().divide(new BigDecimal(100)));
+
+                    byBxLicenseno.setJqOtherCostsPremium(jqOtherAmount);
+                    byBxLicenseno.setSyOtherCostsPremium(syOtherAmount);
+                    byBxLicenseno.setJqOtherCostsProportion(jqOtherCostsProportion);
+                    byBxLicenseno.setSyOtherCostsProportion(syOtherCostsProportion);
+                    byBxLicenseno.setOtherFeevalue(this.calculateTotal(jqOtherAmount,syOtherAmount,null));
+                    byBxLicenseno.setOtherFeerate(this.calculateTotal(jqOtherCostsProportion,syOtherCostsProportion ,null));
+                    baseMapper.updateById(byBxLicenseno);
+
+
+                    HashMap<String, Object> map = new HashMap<>();
+                    map.put("licenseno",item.getLicenseno());
+                    map.put("policyno",item.getPolicyno());
+                    map.put("syPolicyno",item.getSyPolicyno());
+                    map.put("jqOtherCostsPremium",jqOtherAmount);
+                    map.put("syOtherCostsProportion",syOtherAmount);
+
+                    map.put("otherFeevalue",byBxLicenseno.getOtherFeevalue());
+                    map.put("otherFeerate",byBxLicenseno.getOtherFeerate());
+                    resultList.add(map);
+                    allAmount = allAmount.add(jqOtherAmount).add(syOtherAmount);
+                }
+
+            }
+            resultMap.put("allAmount",allAmount);
+            resultMap.put("resultList",resultList);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return resultMap;
+    }
+
+    @Override
+    @Transactional
+    public HashMap<String, Object> noBxImportOther(MultipartFile multipartFile, String isNotCar) {
+        HashMap<String, Object> resultMap = new HashMap<>();
+        List<HashMap<String,Object>>  resultList=new ArrayList<>();
+        HashMap<String, Object> params = new HashMap<>();
+        BigDecimal allAmount = BigDecimal.ZERO;
+        params.put("isNotCar",isNotCar);
+        try {
+            List<InsNoBxOtherExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsNoBxOtherExcelDto.class, 0, 1, 1);
+            for (InsNoBxOtherExcelDto  item  : dtoList){
+                if(StringUtils.isNotEmpty(item.getLicenseno())){
+                    params.put("licenseno",item.getLicenseno());
+                }
+                if(StringUtils.isNotEmpty(item.getNoPolicyno())){
+                    params.put("noPolicyno",item.getNoPolicyno());
+                }
+
+                params.put("handlingFeesStatus","0");
+                InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                if(byBxLicenseno.getNoOtherCostsProportion().compareTo(item.getNoOtherCostsProportion()) !=0 ){
+                    // 如果比例不相等
+                    BigDecimal noOtherCostsProportion = item.getNoOtherCostsProportion();
+
+                    BigDecimal noNoTaxPremium = byBxLicenseno.getNoNoTaxPremium();
+
+                    BigDecimal noOtherAmount = noNoTaxPremium.multiply(item.getNoOtherCostsProportion().divide(new BigDecimal(100)));  //交强跟单费用
+
+                    byBxLicenseno.setOtherFeevalue(this.calculateTotal(noOtherAmount,null,null));
+                    byBxLicenseno.setOtherFeerate(this.calculateTotal(noOtherCostsProportion,null ,null));
+                    baseMapper.updateById(byBxLicenseno);
+
+                    resultMap.put("licenseno",item.getLicenseno());
+                    resultMap.put("noPolicyno",item.getNoPolicyno());
+                    resultMap.put("noOtherCostsPremium",noOtherAmount);
+
+                    resultMap.put("otherFeevalue",byBxLicenseno.getOtherFeevalue());
+                    resultMap.put("otherFeerate",byBxLicenseno.getOtherFeerate());
+                    resultList.add(resultMap);
+                    allAmount = allAmount.add(noOtherAmount);
+                }
+
+            }
+            resultMap.put("allAmount",allAmount);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return resultMap;
+    }
+
+    @Override
+    public void batchUpdateVoucher(InsPlyIncomeVo insPlyIncomeVo) {
+        String s = insPlyIncomeVo.getSelectIds().get(0);
+        ImportResult importResult = importAsyncService.getById(s);
+        String[] split = importResult.getIds().split(",");
+        InsPlyIncome insPlyIncome = new InsPlyIncome();
+        for (String  id :split){
+            insPlyIncome.setId(id);
+            insPlyIncome.setSettlementImageId(insPlyIncomeVo.getSettlementImageId());
+            insPlyIncome.setSettleOtherStatus("1");
+            baseMapper.updateById(insPlyIncome);
+        }
+    }
+
 }

+ 14 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java

@@ -8,6 +8,7 @@ import com.github.pagehelper.PageInfo;
 import com.google.gson.Gson;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
 import com.ydtech.modules.fnc.dao.SettlementDocumentaryFeesMapper;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
@@ -35,6 +36,8 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
 
     @Autowired
     private SettlementDocumentaryLogService settlementDocumentaryLogService;
+    @Autowired
+    private InsPlyIncomeMapper  insPlyIncomeMapper;
 
 
     @Override
@@ -175,6 +178,17 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
      */
     @Override
     public void voidInvoicing(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+        SettlementDocumentaryFeesEntity oldSettlementDocumentaryFeesEntity = baseMapper.selectById(settlementDocumentaryFeesVo.getId());
+        String[] split = oldSettlementDocumentaryFeesEntity.getIds().split(",");
+        InsPlyIncome insPlyIncome = new InsPlyIncome();
+        for (String   id :split){
+            insPlyIncome.setId(id);
+            insPlyIncome.setHandlingFeesStatus("0");  //0 为未开票
+//            insPlyIncomeMapper.(split);
+            insPlyIncomeMapper.updateById(insPlyIncome);
+        }
+
+
         SettlementDocumentaryFeesEntity settlementDocumentaryFeesEntity = new SettlementDocumentaryFeesEntity();
         BeanUtils.copyProperties(settlementDocumentaryFeesVo,settlementDocumentaryFeesEntity);
         settlementDocumentaryFeesEntity.setSettlementStatus("3");  // 3  为作废

+ 56 - 0
src/main/java/com/ydtech/modules/fnc/vo/ImportResultVo.java

@@ -0,0 +1,56 @@
+package com.ydtech.modules.fnc.vo;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Getter
+@Setter
+public class ImportResultVo {
+    @ApiModelProperty("id")
+    private String id;
+
+    @ApiModelProperty("任务状态")
+    private String status; // PROCESSING, COMPLETED, FAILED
+
+    @ApiModelProperty("创建时间")
+    private LocalDateTime createTime;
+
+
+    @ApiModelProperty("开始时间")
+    private LocalDateTime createdAt;
+
+    @ApiModelProperty("完成时间")
+    private LocalDateTime completedAt;
+
+
+    @ApiModelProperty("原因")
+    private String reason;
+
+    @ApiModelProperty("原因")
+    private String handStatus;
+
+    @ApiModelProperty("金额")
+    private BigDecimal totalAmount; // 导入后计算的金额
+
+    @ApiModelProperty("导入路径")
+    private String uploadUrl; // 导入路径
+
+
+    @ApiModelProperty(value = "每页页数")
+    @Min(value = 20, message = "页数最小为20")
+    @Max(value = 100, message = "页数最大为100")
+    private int pageSize=20;
+
+    @ApiModelProperty(value = "页数")
+    @Min(value = 1, message = "页数最小为1")
+    private int pageNum=1;
+}

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java

@@ -109,6 +109,9 @@ public class SettlementDocumentaryFeesVo implements Serializable {
     @ApiModelProperty("协议类型")
     private String agreementType;
 
+    @ApiModelProperty("协议id")
+    private String agreementId;
+
     @ApiModelProperty("结算凭证")
     private String settlementImageId;
 }

+ 1 - 1
src/main/java/com/ydtech/modules/ins/model/guoren/NonAutoInsOrderReq.java

@@ -406,7 +406,7 @@ public class NonAutoInsOrderReq {
                     this.licenseNo = carInfo.getLicenseNo();
                     this.planNo = "1";
                     this.purchasePrice = Double.valueOf(vinQ.getPriceShow());
-                    this.seatNum = Integer.valueOf(vinQ.getSeatCountBC());
+                    this.seatNum = Float.valueOf(vinQ.getSeatCountBC()).intValue();
                     this.toncount = Double.valueOf(vinQ.getTonCount());
                 }
 

+ 7 - 0
src/main/java/com/ydtech/modules/ins/model/vo/CarInfoVo.java

@@ -181,6 +181,13 @@ public class CarInfoVo {
         return EnergyType.isNewEnergy(energyType);
     }
 
+    /**
+     * 获取核定载质量吨位
+     * @return
+     */
+    public Double limitLoadTon(){
+        return Double.parseDouble(limitLoad) / 1000;
+    }
 
     public CarModelDTO toCarModelDTO() {
         CarModelDTO carModelDTO = new CarModelDTO();

+ 9 - 9
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java

@@ -224,13 +224,17 @@ public class Applicant {
     @JacksonXmlProperty(localName = "CAreaCde")
     private String CAreaCde;
 
+    /**
+     * 团车标志
+     */
+    @JacksonXmlProperty(localName = "CMassCarMrk")
+    private String CMassCarMrk;
+
 
     public static Applicant buildApplicant(CustomerInfoVo ownerInfo, CustomerInfoVo policyHolderInfo,YcConfigureParameters ycConfigureParameters) {
 //    public static Applicant buildApplicant(YaQuoteInfoVo yaQuoteInfoVo){
-
 //        CustomerInfoVo ownerInfo = yaQuoteInfoVo.getOwnerInfo();
 //        CustomerInfoVo policyHolderInfo = yaQuoteInfoVo.getPolicyHolderInfo();
-
         Applicant applicant = new Applicant();
 
         applicant.setCAppNme(policyHolderInfo.getName());
@@ -243,21 +247,17 @@ public class Applicant {
         applicant.setCAreaCde("103132");
         applicant.setTBirthday(IDCardUtils.GetBirthday(policyHolderInfo.getIdentifyNumber()));
         applicant.setCSex(IDCardUtils.GetYcSex(policyHolderInfo.getIdentifyNumber()));
-//        applicant.setCCntrNme("天勤");
-        applicant.setCCntrNme(ycConfigureParameters.getCCntrNme());
+        applicant.setCCntrNme(policyHolderInfo.getName());
         if(StringUtils.isNullOrEmpty(applicant.getCCntrNme())){
             applicant.setCCntrNme(policyHolderInfo.getName());
         }
+        // 增加团车标志
+        applicant.setCMassCarMrk(ycConfigureParameters.getCCntrNme());
 
 //        applicant.setCProvince(Province.buildProvince(policyHolderInfo.getAddr()));
 //        applicant.setCCity(City.buildCity(policyHolderInfo.getAddr()));
-
         applicant.setCRelCde(ownerInfo.getName().equals(policyHolderInfo.getName()) ? "601005" : "601008");
-
-
         applicant.setTCertfClsValiDate(policyHolderInfo.getIdentifyValidEndDate());
-
-
         return applicant;
     }
 

+ 43 - 0
src/main/java/com/ydtech/modules/inv/model/dto/InsBxOtherExcelDto.java

@@ -0,0 +1,43 @@
+package com.ydtech.modules.inv.model.dto;
+
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class InsBxOtherExcelDto {
+
+    /**
+     * 车牌号
+     */
+    @Excel(name = "车牌号")
+    private String licenseno;
+
+    /**
+     * 交强保单号
+     */
+    @Excel(name = "交强保单号")
+    private String policyno;
+
+    /**
+     * 商业保单号
+     */
+    @Excel(name =  "商业保单号")
+    private String syPolicyno;
+
+    /**
+     * 交强跟单比例
+     */
+    @Excel(name = "交强跟单比例")
+    private BigDecimal jqOtherCostsProportion;
+
+    /**
+     * 商业保单号
+     */
+    @Excel(name = "商业跟单比例")
+    private BigDecimal syOtherCostsProportion;
+
+
+}

+ 35 - 0
src/main/java/com/ydtech/modules/inv/model/dto/InsImportResult.java

@@ -0,0 +1,35 @@
+package com.ydtech.modules.inv.model.dto;
+
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class InsImportResult {
+    /**
+     * 车牌号
+     */
+    @ExcelProperty(value = "车牌号", index = 0)
+    private String licenseno;
+
+    /**
+     * 交强保单号
+     */
+    @ExcelProperty(value = "交强保单号", index = 1)
+    private String policyno;
+
+    /**
+     * 商业保单号
+     */
+    @ExcelProperty(value = "商业保单号", index = 2)
+    private String syPolicyno;
+
+    /**
+     * 错误原因
+     */
+    @ExcelProperty(value = "错误原因", index = 3)
+    private String reason;
+}

+ 32 - 0
src/main/java/com/ydtech/modules/inv/model/dto/InsNoBxOtherExcelDto.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.inv.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+@Data
+public class InsNoBxOtherExcelDto {
+
+    /**
+     * 车牌号
+     */
+    @ExcelProperty(value = "车牌号", index = 0)
+    private String licenseno;
+
+    /**
+     * 非车保单号
+     */
+    @ExcelProperty(value = "非车保单号", index = 1)
+    private String noPolicyno;
+
+    /**
+     * 非车跟单比例
+     */
+    @ExcelProperty(value = "非车跟单比例", index = 2)
+    private BigDecimal noOtherCostsProportion;
+
+
+
+}

+ 4 - 0
src/main/java/com/ydtech/modules/order/components/huatai/HuaTaiRepeatInsuranceComponents.java

@@ -9,6 +9,7 @@ import com.ydtech.modules.order.entity.api.huatai.request.HuaTaiQuotedPriceReque
 import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiQuotedPriceResponse;
 import com.ydtech.modules.order.entity.api.zhongmei.constants.TimeConstants;
 import com.ydtech.modules.order.utils.InsuranceLog;
+import com.ydtech.utils.StringOperations;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -75,6 +76,8 @@ public class HuaTaiRepeatInsuranceComponents {
         if (StringUtils.isNotEmpty(returnMessage) && returnMessage.contains("重复投保")) {
             String jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(returnMessage,
                     GuorenDuplicateInsuranceComponent.THE_FIRST_REGEX);
+            StringOperations.nullException(jqEndDate, returnMessage);
+
             warnMessageList.add(returnMessage);
             getPeriodDate(jqEndDate, contractMain);
             return true;
@@ -123,6 +126,7 @@ public class HuaTaiRepeatInsuranceComponents {
             String syEndDate = GuorenDuplicateInsuranceComponent.getEndDate(reInsureMsg,
                     GuorenDuplicateInsuranceComponent.THE_FIRST_REGEX);
             warnMessageList.add(reInsureMsg);
+            StringOperations.nullException(syEndDate, reInsureMsg);
             getPeriodDate(syEndDate, contractMain);
             return true;
         }

+ 70 - 8
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -14,15 +14,10 @@ import com.ydtech.modules.base.model.dto.PageDto;
 import com.ydtech.modules.ins.model.InsOrdersExcelVo;
 import com.ydtech.modules.order.components.InsOrdersComponents;
 import com.ydtech.modules.order.constants.OrderLinkTypeConstants;
-import com.ydtech.modules.order.entity.BasePageResult;
-import com.ydtech.modules.order.entity.InsAccidentalDriving;
-import com.ydtech.modules.order.entity.InsAreaCompany;
-import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.*;
 import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
 import com.ydtech.modules.order.entity.vo.*;
-import com.ydtech.modules.order.service.InsAccidentalDrivingService;
-import com.ydtech.modules.order.service.InsAreaCompanyService;
-import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
 import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
@@ -54,14 +49,21 @@ public class InsOrdersController extends BaseController {
 
     private final SysUserIsDialService sysUserIsDialService;
 
+    private final BatchOrderService batchOrderService;
+
+    private final InsAreaCompanyPositionService insAreaCompanyPositionService;
+
     public InsOrdersController(InsAreaCompanyService insAreaCompanyService, InsOrdersService insOrdersService,
                                InsOrdersComponents insOrdersComponents, InsAccidentalDrivingService insAccidentalDrivingService,
-                               SysUserIsDialService sysUserIsDialService) {
+                               SysUserIsDialService sysUserIsDialService, BatchOrderService batchOrderService,
+                               InsAreaCompanyPositionService insAreaCompanyPositionService) {
         this.insAreaCompanyService = insAreaCompanyService;
         this.insOrdersService = insOrdersService;
         this.insOrdersComponents = insOrdersComponents;
         this.insAccidentalDrivingService = insAccidentalDrivingService;
         this.sysUserIsDialService = sysUserIsDialService;
+        this.batchOrderService = batchOrderService;
+        this.insAreaCompanyPositionService = insAreaCompanyPositionService;
     }
 
     @GetMapping("/getAgreementInsCompany")
@@ -334,4 +336,64 @@ public class InsOrdersController extends BaseController {
         orderExpirationQueryVo.setUserid(getUserId());
         return HttpResult.ok(insOrdersService.getExpirationInsureCount(orderExpirationQueryVo));
     }
+
+    /**
+     * 批单操作
+     * @param batchOrderVo
+     * @return
+     */
+    @PostMapping("/batchOrder")
+    @ApiOperation(value = "批单")
+    public HttpResult batchOrder(@RequestBody BatchOrderVo batchOrderVo){
+        boolean result = batchOrderService.batchOrder(batchOrderVo);
+        if(result){
+            return HttpResult.ok("批单修改成功,等待审核");
+        }else{
+            return HttpResult.error("批单修改失败");
+        }
+    }
+
+    /**
+     * 获取批单信息
+     * @param subOrderNo
+     * @return
+     */
+    @GetMapping("/getBatchOrder")
+    @ApiOperation(value = "获取批单信息")
+    public HttpResult getBatchOrder(String subOrderNo){
+        BatchOrder batchOrderBySubOrderNo = batchOrderService.getBatchOrderBySubOrderNo(subOrderNo);
+        if(batchOrderBySubOrderNo != null){
+            return HttpResult.ok(batchOrderBySubOrderNo);
+        }else{
+            return HttpResult.error("获取批单失败");
+        }
+    }
+
+    @PostMapping("/getBatchOrderList")
+    @ApiOperation(value = "获取批单列表")
+    public HttpResult getBatchOrderList(@RequestBody BatchOrderQueryVo batchOrderQueryVo){
+        Page page = buildPageRequest(batchOrderQueryVo.getPageDto());
+        if(batchOrderQueryVo.getIsAudit() == null){
+            batchOrderQueryVo.setIsAudit(0);
+        }
+        return HttpResult.ok(batchOrderService.getBatchOrderList(page,batchOrderQueryVo));
+
+    }
+
+    @PostMapping("/auditBatchOrder")
+    @ApiOperation(value = "批单审核")
+    public HttpResult auditBatchOrder(@RequestBody BatchOrderAuditVo batchOrderAuditVo){
+        boolean result = batchOrderService.auditBatchOrder(batchOrderAuditVo);
+        if(result){
+            return HttpResult.ok("批单审核成功");
+        }else{
+            return HttpResult.error("批单审核失败");
+        }
+    }
+
+    @PostMapping("/savePosition")
+    @ApiOperation(value = "保存位置信息")
+    public HttpResult savePosition(@RequestBody InsAreaCompanyPosition insAreaCompanyPosition){
+        return HttpResult.ok(insAreaCompanyPositionService.save(insAreaCompanyPosition));
+    }
 }

+ 2 - 2
src/main/java/com/ydtech/modules/order/controller/YongChengOrderApiController.java

@@ -62,8 +62,8 @@ public class YongChengOrderApiController {
     @ApiOperation(value = "永诚API方式 - 影像上传")
     @PostMapping(value = "/uploadImage")
     public HttpResult uploadImageApi(@RequestSingleParam(value = "companyId") String companyId) {
-//        return yongchengOrderApiService.uploadImageApi(companyId);
-        return HttpResult.ok("ok");
+        return yongchengOrderApiService.uploadImageApi(companyId);
+//        return HttpResult.ok("ok");
     }
 
     @ApiOperation(value = "永诚API方式 -电子保单")

+ 15 - 0
src/main/java/com/ydtech/modules/order/dao/BatchOrderMapper.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.BatchOrder;
+import com.ydtech.modules.order.entity.vo.dajia.InsAccidentalDrivingDajia;
+
+/**
+ * @author Administrator
+ * @description 针对表【batchOrder(批单)】的数据库操作Mapper
+ * @createDate 2024-6-5 16:19:14
+ * @Entity generator.domain.InsAccidentalDriving
+ */
+public interface BatchOrderMapper extends BaseMapper<BatchOrder> {
+
+}

+ 30 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -2,6 +2,8 @@ package com.ydtech.modules.order.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.AllpremiumDto;
+import com.ydtech.modules.admin.model.dto.PremiumReportDto;
 import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -91,6 +93,34 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
      *  @Description: 获取订单详情页面
      */
     SubOrder getSubOrderDetails(String subOrderId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:19
+     *  @Description: 保费报表统计
+     */
+    List<PremiumReportDto> premiumReportYear(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:19
+     *  @Description: 保费报表统计
+     */
+    List<PremiumReportDto> premiumReportMonth(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/5 16:19
+     *  @Description: 保费报表统计
+     */
+    List<PremiumReportDto> premiumReportDay(HashMap<String,String> map);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/7 15:21
+     *  @Description: 查询总的签单数
+     */
+    AllpremiumDto getAllpremium(@Param("year") String year,@Param("userId") String userId);
 }
 
 

+ 30 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyPositionMapper.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.dto.PremiumReportDto;
+import com.ydtech.modules.admin.model.vo.SubOrder;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsAreaCompanyPosition;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
+import com.ydtech.modules.order.entity.vo.OrderQueryVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_area_company_position(报价位置)】的数据库操作Mapper
+ * @createDate 2023-01-31 15:51:19
+ * @Entity generator.domain.InsAreaCompanyPosition
+ */
+public interface InsAreaCompanyPositionMapper extends BaseMapper<InsAreaCompanyPosition> {
+
+
+}
+
+
+
+

+ 95 - 0
src/main/java/com/ydtech/modules/order/entity/BatchOrder.java

@@ -0,0 +1,95 @@
+package com.ydtech.modules.order.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.ydtech.modules.order.entity.vo.BatchOrderVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.time.LocalDateTime;
+
+
+@TableName("ins_orders_batch")
+@Data
+public class BatchOrder {
+
+    @TableId(value = "id")
+    private String id;
+
+    /**
+     * 订单号
+     */
+    @ApiModelProperty("订单号")
+    @TableField(value = "sub_order_no")
+    private String subOrderNo;
+
+    @ApiModelProperty("车辆信息")
+    @TableField(value = "carinfo",typeHandler = FastjsonTypeHandler.class)
+    private JSONObject carInfo;
+
+    @ApiModelProperty("车主信息")
+    @TableField(value = "ownerinfo",typeHandler = FastjsonTypeHandler.class)
+    private JSONObject ownerInfo;
+
+    @ApiModelProperty("投保人信息")
+    @TableField(value = "applyinfo",typeHandler = FastjsonTypeHandler.class)
+    private JSONObject applyInfo;
+
+    @ApiModelProperty("被保人信息")
+    @TableField(value = "insureinfo",typeHandler = FastjsonTypeHandler.class)
+    private JSONObject insureInfo;
+
+    @ApiModelProperty("修改内容")
+    @TableField(value = "modify_content")
+    private String modifyContent;
+
+    @ApiModelProperty("是否审核")
+    @TableField(value = "is_audit")
+    private Integer isAudit;
+
+    @ApiModelProperty("驳回原因")
+    @TableField(value = "reject_reason")
+    private String rejectReason;
+
+    @ApiModelProperty("审核时间")
+    @TableField(value = "audit_time")
+    private LocalDateTime auditTime;
+
+    @ApiModelProperty("审核人")
+    @TableField(value = "audit_user")
+    private String auditUser;
+
+
+    public BatchOrder(){
+
+    }
+
+    public void setCarInfo(String carInfo) {
+        this.carInfo = JSONObject.parseObject(carInfo);
+    }
+
+    public void setOwnerInfo(String ownerInfo) {
+        this.ownerInfo = JSONObject.parseObject(ownerInfo);
+    }
+
+    public void setApplyInfo(String applyInfo) {
+        this.applyInfo = JSONObject.parseObject(applyInfo);
+    }
+
+    public void setInsureInfo(String insureInfo) {
+        this.insureInfo = JSONObject.parseObject(insureInfo);
+    }
+
+    public BatchOrder(BatchOrderVo batchOrderVo) {
+        this.subOrderNo = batchOrderVo.getSubOrderNo();
+        this.carInfo = batchOrderVo.getCarInfo();
+        this.ownerInfo = batchOrderVo.getOwnerInfo();
+        this.applyInfo = batchOrderVo.getApplyInfo();
+        this.insureInfo = batchOrderVo.getInsureInfo();
+    }
+}

+ 64 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyPosition.java

@@ -0,0 +1,64 @@
+package com.ydtech.modules.order.entity;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
+import com.ydtech.modules.ins.model.vo.QuoteRespVo;
+import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
+import com.ydtech.utils.StringUtils;
+import com.ydtech.utils.idgen.IdGenerate;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 报价渠道
+ *
+ * @TableName ins_area_company_position
+ */
+@TableName(value = "ins_area_company_position", autoResultMap = true)
+@Data
+@ApiModel(value = "报价定位")
+public class InsAreaCompanyPosition implements Serializable {
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = -6827009009645748868L;
+    /**
+     * 主键
+     */
+    @TableId(value = "sub_order_no")
+    private String subOrderNo;
+    /**
+     * 经度
+     */
+    @TableField(value = "lng")
+    private String lng;
+    /**
+     * 纬度
+     */
+    @TableField(value = "lat")
+    private String lat;
+
+    public InsAreaCompanyPosition(){
+
+    }
+
+    public InsAreaCompanyPosition(String subOrderNo, String lng, String lat) {
+        this.subOrderNo = subOrderNo;
+        this.lng = lng;
+        this.lat = lat;
+    }
+}
+

+ 21 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BatchOrderAuditVo.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.order.entity.vo;
+
+
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "批单审核实体")
+public class BatchOrderAuditVo {
+
+    @ApiModelProperty("订单号")
+    private String orderNo;
+
+    @ApiModelProperty("是否审核")
+    private Integer isAudit;
+
+    @ApiModelProperty("驳回原因")
+    private String rejectReason;
+}

+ 29 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BatchOrderQueryVo.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.order.entity.vo;
+
+
+import com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "批单列表实体")
+public class BatchOrderQueryVo extends PageRequest {
+
+    @ApiModelProperty("订单号")
+    private String orderNo;
+
+    @ApiModelProperty("审核状态")
+    private Integer isAudit;
+
+    @ApiModelProperty("车牌号")
+    private String licenseNo;
+
+    @ApiModelProperty("车辆识别代码")
+    private String frameNo;
+
+    @ApiModelProperty("发动机号")
+    private String engineNo;
+
+
+}

+ 28 - 0
src/main/java/com/ydtech/modules/order/entity/vo/BatchOrderVo.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.order.entity.vo;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "批单实体")
+public class BatchOrderVo {
+
+    @ApiModelProperty("子订单号")
+    private String subOrderNo;
+
+    @ApiModelProperty("车辆信息")
+    private JSONObject carInfo;
+
+    @ApiModelProperty("车主信息")
+    private JSONObject ownerInfo;
+
+    @ApiModelProperty("投保人信息")
+    private JSONObject applyInfo;
+
+    @ApiModelProperty("被保人信息")
+    private JSONObject insureInfo;
+}

+ 43 - 0
src/main/java/com/ydtech/modules/order/service/BatchOrderService.java

@@ -0,0 +1,43 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.ins.model.vo.QuoteRespVo;
+import com.ydtech.modules.order.entity.BatchOrder;
+import com.ydtech.modules.order.entity.vo.*;
+
+import java.util.List;
+
+/**
+ * 批单服务
+ */
+public interface BatchOrderService {
+
+    /**
+     * 批单
+     * @param batchOrderVo
+     * @return
+     */
+    boolean batchOrder(BatchOrderVo batchOrderVo);
+
+    /**
+     * 批单审核
+     * @param batchOrderAuditVo
+     * @return
+     */
+    boolean auditBatchOrder(BatchOrderAuditVo batchOrderAuditVo);
+
+    /**
+     * 根据子订单id获取批单信息
+     * @param subOrderNo
+     * @return
+     */
+    BatchOrder getBatchOrderBySubOrderNo(String subOrderNo);
+
+    /**
+     * 获取批单列表
+     * @param batchOrderQueryVo
+     * @return
+     */
+    Page<BatchOrder> getBatchOrderList(Page page, BatchOrderQueryVo batchOrderQueryVo);
+}

+ 25 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyPositionService.java

@@ -0,0 +1,25 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
+import com.ydtech.modules.order.entity.InsAreaCompanyPosition;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
+import com.ydtech.modules.order.entity.vo.OrderQueryVo;
+import com.ydtech.modules.order.entity.vo.OrderVo;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+
+import java.util.List;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_area_company_position(报价定位)】的数据库操作Service
+ * @createDate 2023-01-31 15:51:19
+ */
+public interface InsAreaCompanyPositionService extends IService<InsAreaCompanyPosition> {
+
+
+}

+ 1 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
+import com.ydtech.modules.order.entity.InsAreaCompanyPosition;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;

+ 165 - 0
src/main/java/com/ydtech/modules/order/service/impl/BatchOrderServiceImpl.java

@@ -0,0 +1,165 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.dao.BatchOrderMapper;
+import com.ydtech.modules.order.entity.BatchOrder;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.vo.BatchOrderAuditVo;
+import com.ydtech.modules.order.entity.vo.BatchOrderQueryVo;
+import com.ydtech.modules.order.entity.vo.BatchOrderVo;
+import com.ydtech.modules.order.service.BatchOrderService;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.Objects;
+
+@Service
+public class BatchOrderServiceImpl extends ServiceImpl<BatchOrderMapper, BatchOrder> implements BatchOrderService {
+
+    @Autowired
+    private InsOrdersService insOrdersService;
+
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+
+    /**
+     * 批单
+     * @param batchOrderVo
+     * @return
+     */
+    public boolean batchOrder(BatchOrderVo batchOrderVo){
+        String subOrderNo = batchOrderVo.getSubOrderNo();
+        BatchOrder batchOrderOne = baseMapper.selectOne(new LambdaQueryWrapper<>(BatchOrder.class)
+                .eq(BatchOrder::getSubOrderNo, subOrderNo)
+                .eq(BatchOrder::getIsAudit, 0));
+        if(batchOrderOne != null){
+            throw new SystemException("该订单已经批单待审核,请勿重复操作");
+        }
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(batchOrderVo.getSubOrderNo());
+        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
+        if (insOrders == null) {
+            return false;
+        }
+        if(batchOrderVo.getOwnerInfo().getString("mobile").contains("*")){
+            batchOrderVo.getOwnerInfo().put("mobile", insOrders.getOwnerinfo().getString("mobile"));
+        }
+        if(batchOrderVo.getApplyInfo().getString("mobile").contains("*")){
+            batchOrderVo.getApplyInfo().put("mobile", insOrders.getApplyinfo().getString("mobile"));
+        }
+        if(batchOrderVo.getInsureInfo().getString("mobile").contains("*")){
+            batchOrderVo.getInsureInfo().put("mobile", insOrders.getInsureinfo().getString("mobile"));
+        }
+        StringBuilder modifyContent  = new StringBuilder();
+        JSONObject carinfo = insOrders.getCarinfo();
+        JSONObject ownerinfo = insOrders.getOwnerinfo();
+        JSONObject applyinfo = insOrders.getApplyinfo();
+        JSONObject insureinfo = insOrders.getInsureinfo();
+        for(String key : carinfo.keySet()){
+            if(!batchOrderVo.getCarInfo().getString(key).equals(carinfo.getString(key))){
+                modifyContent.append("车辆信息:").append(key).append("由").append(carinfo.getString(key)).append("修改为").append(batchOrderVo.getCarInfo().getString(key)).append(";");
+            }
+        }
+        for(String key : ownerinfo.keySet()){
+            if(!batchOrderVo.getOwnerInfo().getString(key).equals(ownerinfo.getString(key))){
+                modifyContent.append("车主信息:").append(key).append("由").append(ownerinfo.getString(key)).append("修改为").append(batchOrderVo.getOwnerInfo().getString(key)).append(";");
+            }
+        }
+        for(String key : applyinfo.keySet()){
+            if(!batchOrderVo.getApplyInfo().getString(key).equals(applyinfo.getString(key))){
+                modifyContent.append("投保人信息:").append(key).append("由").append(applyinfo.getString(key)).append("修改为").append(batchOrderVo.getApplyInfo().getString(key)).append(";");
+            }
+        }
+        for(String key : insureinfo.keySet()){
+            if(!batchOrderVo.getInsureInfo().getString(key).equals(insureinfo.getString(key))){
+                modifyContent.append("被保人信息:").append(key).append("由").append(insureinfo.getString(key)).append("修改为").append(batchOrderVo.getInsureInfo().getString(key)).append(";");
+            }
+        }
+        BatchOrder  batchOrder = new BatchOrder(batchOrderVo);
+        batchOrder.setModifyContent(modifyContent.toString());
+        return this.save(batchOrder);
+    }
+
+    /**
+     * 根据子订单id获取批单信息
+     * @param subOrderNo
+     * @return
+     */
+    public BatchOrder getBatchOrderBySubOrderNo(String subOrderNo){
+        BatchOrder batchOrder = baseMapper.selectOne(new LambdaQueryWrapper<BatchOrder>()
+                .eq(BatchOrder::getSubOrderNo, subOrderNo));
+        return batchOrder;
+    }
+
+    /**
+     * 获取批单列表
+     * @param batchOrderQueryVo
+     * @return
+     */
+    @Override
+    public Page<BatchOrder> getBatchOrderList(Page page, BatchOrderQueryVo batchOrderQueryVo) {
+        LambdaQueryWrapper<BatchOrder> queryWrapper = new LambdaQueryWrapper<BatchOrder>().eq(BatchOrder::getIsAudit, batchOrderQueryVo.getIsAudit());
+        if(batchOrderQueryVo.getLicenseNo() != null){
+            queryWrapper.apply("JSON_EXTRACT(carinfo, '$.licenseNo') = '"+batchOrderQueryVo.getLicenseNo()+"'");
+        }
+        if(batchOrderQueryVo.getFrameNo() != null){
+            queryWrapper.apply("JSON_EXTRACT(carinfo, '$.frameNo') = '"+batchOrderQueryVo.getFrameNo()+"'");
+        }
+        if(batchOrderQueryVo.getEngineNo() != null){
+            queryWrapper.apply("JSON_EXTRACT(carinfo, '$.engineNo') = '"+batchOrderQueryVo.getEngineNo()+"'");
+        }
+
+        Page batchOrderList = baseMapper.selectPage(page, queryWrapper);
+        return batchOrderList;
+    }
+
+    /**
+     * 批单审核
+     * @param batchOrderAuditVo
+     * @return
+     */
+    @Override
+    @Transactional
+    public boolean auditBatchOrder(BatchOrderAuditVo batchOrderAuditVo) {
+        BatchOrder batchOrder = baseMapper.selectOne(new LambdaQueryWrapper<BatchOrder>().eq(BatchOrder::getSubOrderNo,batchOrderAuditVo.getOrderNo()));
+        if (Objects.isNull(batchOrder)) {
+            return false;
+        }
+        InsAreaCompany byInsOrderNo = insAreaCompanyService.getById(batchOrderAuditVo.getOrderNo());
+        InsOrders insOrders = insOrdersService.getById(byInsOrderNo.getOrderno());
+        JSONObject carInfo = batchOrder.getCarInfo();
+        JSONObject ownerInfo = batchOrder.getOwnerInfo();
+        JSONObject applyInfo = batchOrder.getApplyInfo();
+        JSONObject insureInfo = batchOrder.getInsureInfo();
+        insOrders.setCarinfo(carInfo);
+        insOrders.setOwnerinfo(ownerInfo);
+        insOrders.setApplyinfo(applyInfo);
+        insOrders.setInsureinfo(insureInfo);
+
+        insOrders.setLicenseno(batchOrder.getCarInfo().getString("licenseno"));
+        insOrders.setFrameno(batchOrder.getCarInfo().getString("frameno"));
+        insOrders.setInsuredname(batchOrder.getInsureInfo().getString("name"));
+
+        batchOrder.setIsAudit(batchOrderAuditVo.getIsAudit());
+        batchOrder.setRejectReason(batchOrderAuditVo.getRejectReason());
+        batchOrder.setAuditTime(LocalDateTime.now());
+
+        batchOrder.setAuditUser(BaseController.getUser().getId());
+        this.updateById(batchOrder);
+        insOrdersService.updateById(insOrders);
+        return true;
+    }
+
+
+
+
+}

+ 58 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyPositionServiceImpl.java

@@ -0,0 +1,58 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.fnc.service.InsFeeAuditService;
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
+import com.ydtech.modules.message.constants.MessageTypeConstants;
+import com.ydtech.modules.message.service.MessageSecretaryService;
+import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
+import com.ydtech.modules.order.dao.InsAreaCompanyPositionMapper;
+import com.ydtech.modules.order.dao.InsOrdersMapper;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
+import com.ydtech.modules.order.entity.InsAreaCompanyPosition;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
+import com.ydtech.modules.order.entity.vo.OrderQueryVo;
+import com.ydtech.modules.order.entity.vo.OrderVo;
+import com.ydtech.modules.order.service.*;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.utils.idgen.IdGenerate;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
+
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @author Administrator
+ * @description 针对表【ins_area_company_position(报价定位)】的数据库操作Service实现
+ * @createDate 2023-01-31 15:51:19
+ */
+@Service
+public class InsAreaCompanyPositionServiceImpl extends ServiceImpl<InsAreaCompanyPositionMapper, InsAreaCompanyPosition>
+        implements InsAreaCompanyPositionService {
+
+}
+
+
+
+

+ 11 - 11
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
+import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
@@ -95,21 +97,19 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         //生成结算
         //判断协议是否为人工还是自动审核
         PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
-        if(ptlAgreement.getAuditType() == 2 && insAreaCompany.getOrderstatus().equals("3"))
+        if(ptlAgreement.getAuditType() == 2 && insAreaCompany.getOrderstatus().equals(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()))
         {
             //如果为自动审核 则自动进行审核
-            insFeeAuditService.feeAudit( insAreaCompany.getOrderno(),insAreaCompany.getId(), true);
+            insFeeAuditService.saveInsFeeAuditAndHistory( insAreaCompany.getOrderno(),insAreaCompany.getId(), true,FeeAuditAuditstatus.PASSED.getCode());
+        }else if(ptlAgreement.getAuditType() == 1 && insAreaCompany.getOrderstatus().equals(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()))
+        {
+            //添加默认审核 添加审核表及轨迹信息
+            insFeeAuditService.saveDefaultInsFeeAuditAndHistory(insAreaCompany.getOrderno(), insAreaCompany.getId(), FeeAuditAuditstatus.UNREVICEWED.getCode());
         }
+
         //添加订单消息
-        if(insAreaCompany.getOrderstatus().equals("1")){
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3, BaseController.getUser().getId(),"订单号"+insAreaCompany.getOrderno()+"待核保");
-        }else if(insAreaCompany.getOrderstatus().equals("2")){
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3,BaseController.getUser().getId(),"订单号"+insAreaCompany.getOrderno()+"已核保待缴费");
-        }else if(insAreaCompany.getOrderstatus().equals("3")){
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3,BaseController.getUser().getId(),"订单号"+insAreaCompany.getOrderno()+"已经承保成功");
-        }else if(insAreaCompany.getOrderstatus().equals("4")) {
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3, BaseController.getUser().getId(), "订单号" + insAreaCompany.getOrderno() + "核保退回");
-        }
+        messageSecretaryService.addMessage(MessageTypeConstants.M_3, BaseController.getUser().getId(),
+                "订单号"+insAreaCompany.getOrderno()+InsOrderStatusEnum.matchKey(insAreaCompany.getOrderstatus()).getDesc());
         insOrdersTrackService.addingTrajectories(insAreaCompany);
         insOrdersService.updateByOrderStatus(insAreaCompany);
     }

+ 24 - 26
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -209,31 +209,25 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         }
 
         String orderStatus = insAreaCompany.getOrderstatus();
+        InsOrders insOrders = getById(insAreaCompany.getOrderno());
+        // 查出最新状态的子订单修改
+        if (!InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())) {
+            orderStatus = insAreaCompanyService.queryLatestStatus(insAreaCompany.getOrderno());
+        } else {
+            insOrders.setCompanyId(insAreaCompany.getCompanyId());
+            insOrders.setInsCompany(insAreaCompany.getInscompany());
+        }
 
-        if (!ObjectUtils.isEmpty(insAreaCompany)) {
-            InsOrders insOrders = getById(insAreaCompany.getOrderno());
-
-            // 查出最新状态的子订单修改
-            if (!InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())) {
-                orderStatus = insAreaCompanyService.queryLatestStatus(insAreaCompany.getOrderno());
-            } else {
-                insOrders.setCompanyId(insAreaCompany.getCompanyId());
-                insOrders.setInsCompany(insAreaCompany.getInscompany());
-            }
-
-            if (InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insOrders.getOrderstatus())) {
-                return;
-            }
+        if (InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insOrders.getOrderstatus())) {
+            return;
+        }
 
-            insOrders.setOrderstatus(orderStatus);
-            LambdaQueryWrapper<InsOrders> insOrdersLambdaQueryWrapper = new LambdaQueryWrapper<>();
-            insOrdersLambdaQueryWrapper.ne(InsOrders::getOrderstatus, InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
-            insOrdersLambdaQueryWrapper.eq(InsOrders::getOrderno, insAreaCompany.getOrderno());
-            update(insOrders, insOrdersLambdaQueryWrapper);
+        insOrders.setOrderstatus(orderStatus);
+        LambdaQueryWrapper<InsOrders> insOrdersLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        insOrdersLambdaQueryWrapper.ne(InsOrders::getOrderstatus, InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
+        insOrdersLambdaQueryWrapper.eq(InsOrders::getOrderno, insAreaCompany.getOrderno());
+        update(insOrders, insOrdersLambdaQueryWrapper);
 
-            //添加审核表及轨迹信息
-            insFeeAuditService.saveInsFeeAuditAndHistory(insAreaCompany.getOrderno(), insAreaCompany.getId(), true, FeeAuditAuditstatus.UNREVICEWED.getCode());
-        }
     }
 
 
@@ -553,10 +547,14 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             }
         }
         orderAndAreaCompany.setMobile(sysUser.getMobile());
-        orderAndAreaCompany.setProvince(sysAreas.get(2).getAreaCname());
-        orderAndAreaCompany.setCity(sysAreas.get(1).getAreaCname());
-        orderAndAreaCompany.setPrefecture(sysAreas.get(0).getAreaCname());
-        orderAndAreaCompany.setDeptAreaInfo(null);
+        //归属信息判断是否为空  用户id是否为管理员
+        if(!sysAreas.isEmpty() && !orderAndAreaCompany.getUserid().equals("admin")){
+            orderAndAreaCompany.setProvince(sysAreas.get(2).getAreaCname());
+            orderAndAreaCompany.setCity(sysAreas.get(1).getAreaCname());
+            orderAndAreaCompany.setPrefecture(sysAreas.get(0).getAreaCname());
+            orderAndAreaCompany.setDeptAreaInfo(null);
+        }
+
         //推荐人信息查询
         EsmUserReferrer esmUserReferrer = esmUserReferrerService.getById(orderAndAreaCompany.getUserid());
         if(esmUserReferrer != null){

+ 0 - 1
src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java

@@ -225,7 +225,6 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
 
         //构造车辆信息
         gainVehicleModel(ycConfigureParameters, carInfo, coreModelsVo);
-        JSONObject obj = JSON.parseObject(JSON.toJSONString(quoteVo.getAccidentalDrivingVo()));
         AccidentalDrivingVo adVo = quoteVo.getAccidentalDrivingVo();
 
         //组装参数

+ 1 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java

@@ -26,6 +26,7 @@ public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
     List<HashMap<String, Object>> getDockingPersonList();
 
 
+    PtlAgreement selectAgreeId(HashMap<String, Object> params);
 }
 
 

+ 4 - 1
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -182,8 +182,9 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @param ptlAgreement     协议信息
      * @param agreementSaveDto 协议添加实体
      * @param attribution      协议归属添加实体
+     * @param verificationLogin 验证登录
      */
-    EsmInsCompany verifyLogin(PtlAgreement ptlAgreement, PtlAgreementSaveDto agreementSaveDto, PtlAgreementAttributionDto attribution);
+    EsmInsCompany verifyLogin(PtlAgreement ptlAgreement, PtlAgreementSaveDto agreementSaveDto, PtlAgreementAttributionDto attribution, boolean verificationLogin);
 
     /**
      * 根据协议编码,归属保险公司获取非车险费用配置信息
@@ -226,4 +227,6 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
     List<HashMap<String, Object>> getDockingPersonList();
 
 
+    PtlAgreement selectAgreeId(HashMap<String, Object> params);
+
 }

+ 107 - 64
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.config.DictEnumConfig;
 import com.ydtech.constants.enums.dict.DictionaryData;
 import com.ydtech.constants.enums.dict.DictionaryManagement;
-import com.ydtech.constants.enums.dict.agreement.AgreementType;
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.core.page.PageResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmInsCompany;
@@ -84,11 +82,17 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
 
     public PtlAgreementServiceImpl(PtlAgreementProductCostsService ptlAgreementProductCostsService,
-                                   PtlAgreementAttributionService ptlAgreementAttributionService, PtlAgreementDeptService ptlAgreementDeptService,
-                                   EsmInsCompanyService esmInsCompanyService, PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService,
-                                   @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject, PtlNonCarInsuranceProductService ptlNonCarInsuranceProductService, @Lazy PtlAgreementUndwrtRulesService ptlAgreementUndwrtRulesService,
-                                   PtlAgreementHistoryService ptlAgreementHistoryService, PtlAgreementProductCostsHistoryService ptlAgreementProductCostsHistoryService,
-                                   PtlAgreementUndwrtRulesHistoryService ptlAgreementUndwrtRulesHistoryService, PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService) {
+                                   PtlAgreementAttributionService ptlAgreementAttributionService,
+                                   PtlAgreementDeptService ptlAgreementDeptService,
+                                   EsmInsCompanyService esmInsCompanyService,
+                                   PtlAgreementNonCarProductCostsService ptlAgreementNonCarProductCostsService,
+                                   @Lazy InsCrawlerOrderService insCrawlerOrderController, @Lazy PtlAgreementService proxyObject,
+                                   PtlNonCarInsuranceProductService ptlNonCarInsuranceProductService,
+                                   @Lazy PtlAgreementUndwrtRulesService ptlAgreementUndwrtRulesService,
+                                   PtlAgreementHistoryService ptlAgreementHistoryService,
+                                   PtlAgreementProductCostsHistoryService ptlAgreementProductCostsHistoryService,
+                                   PtlAgreementUndwrtRulesHistoryService ptlAgreementUndwrtRulesHistoryService,
+                                   PtlAgreementAttributionHistoryService ptlAgreementAttributionHistoryService) {
         this.ptlAgreementProductCostsService = ptlAgreementProductCostsService;
         this.ptlAgreementAttributionService = ptlAgreementAttributionService;
         this.ptlAgreementDeptService = ptlAgreementDeptService;
@@ -157,7 +161,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         PtlAgreement ptlAgreement = new PtlAgreement();
         BeanUtils.copyProperties(agreementSaveDto, ptlAgreement);
 
-        EsmInsCompany esmInsCompany = proxyObject.verifyLogin(ptlAgreement, agreementSaveDto, attribution);
+        EsmInsCompany esmInsCompany = proxyObject.verifyLogin(ptlAgreement, agreementSaveDto, attribution, true);
 //        ptlAgreement.setId(IdGenerate.nextId());
         ptlAgreement.setProductsCode(agreementSaveDto.getProductsCode());
         ptlAgreement.setCreator(userName);
@@ -170,16 +174,19 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         String batchNo = IdGenerate.nextId();
         //添加授权部门历史信息
         List<String> dept = agreement.getDept();
-        List<PtlAgreementDeptHistory> ptlAgreementDeptList = PtlAgreementDeptHistory.toPtlAgreementDeptHistoryList(ptlAgreement.getId(), dept, batchNo);
+        List<PtlAgreementDeptHistory> ptlAgreementDeptList = PtlAgreementDeptHistory.toPtlAgreementDeptHistoryList(ptlAgreement.getId(),
+                dept, batchNo);
         ptlAgreementDeptHistoryService.saveBatch(ptlAgreementDeptList);
-        PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD, ptlAgreement);
+        PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD,
+                ptlAgreement);
         ptlAgreementHistory.setStartDate(ptlAgreement.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         ptlAgreementHistory.setEndDate(ptlAgreement.getEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         ptlAgreementHistory.setAgreementId(ptlAgreement.getId());
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("add");
         ptlAgreementHistoryService.saveAgreementHistory(ptlAgreementHistory);
-        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, ptlAgreement.getId(), esmInsCompany.getId(), esmInsCompany.getName(), agreement.getAttribution());
+        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, ptlAgreement.getId(),
+                esmInsCompany.getId(), esmInsCompany.getName(), agreement.getAttribution());
         ptlAgreementAttributionHistory.setId(IdGenerate.nextId());
         if (StringUtils.isNotEmpty(attribution.getTemplateId())) {
             ptlAgreementAttributionHistoryService.save(ptlAgreementAttributionHistory);
@@ -192,7 +199,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Transactional
     public HttpResult<Object> saveAgreementProduct(PtlAgreementProductCosts ptlAgreementProductCosts, String userName) {
 
-        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementProductCosts.getAgreementId()));
+        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId,
+                ptlAgreementProductCosts.getAgreementId()));
         if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
@@ -204,7 +212,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         // 产品费用
         ptlAgreementProductCostsService.save(ptlAgreementProductCosts);
         // 添加 历史记录表
-        PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),
+        PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd " +
+                "HH:mm:ss"),
                 HistoryStatusConstants.HISTORY_TYPE_UPDATE, ptlAgreementProductCosts);
         ptlAgreementProductCostsHistoryService.save(history);
         return HttpResult.ok("添加成功");
@@ -212,7 +221,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     @Override
     public HttpResult<Object> updateAgreementProduct(PtlAgreementProductCosts agreement, String userName) {
-        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, agreement.getAgreementId()));
+        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId,
+                agreement.getAgreementId()));
         if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
@@ -224,7 +234,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         // 产品费用
         ptlAgreementProductCostsService.updateById(agreement);
         // 添加 历史记录表
-        PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),
+        PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd " +
+                "HH:mm:ss"),
                 HistoryStatusConstants.HISTORY_TYPE_UPDATE, agreement);
         ptlAgreementProductCostsHistoryService.save(history);
         return HttpResult.ok("修改成功");
@@ -237,7 +248,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         if (ptlAg == null) {
             throw new SystemException("协议产品费用不存在");
         }
-        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAg.getAgreementId()));
+        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId,
+                ptlAg.getAgreementId()));
         if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
@@ -248,7 +260,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         baseMapper.updateById(ptlAgreement);
         //删除协议
         ptlAgreementProductCostsService.removeById(id);
-        PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"),
+        PtlAgreementProductCostsHistory history = new PtlAgreementProductCostsHistory(userName, DateUtil.format(new Date(), "yyyy-MM-dd " +
+                "HH:mm:ss"),
                 HistoryStatusConstants.HISTORY_TYPE_DELETE, ptlAg);
         ptlAgreementProductCostsHistoryService.save(history);
         return HttpResult.ok("删除成功");
@@ -290,7 +303,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Override
     @Transactional
     public HttpResult<Object> saveAgreementUndwrtRules(PtlAgreementUndwrtRules ptlAgreementUndwrtRules, String userName) {
-        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementUndwrtRules.getAgreementId()));
+        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId,
+                ptlAgreementUndwrtRules.getAgreementId()));
         if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
@@ -302,7 +316,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //添加承保规则
         ptlAgreementUndwrtRulesService.save(ptlAgreementUndwrtRules);
         //添加历史记录
-        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName, HistoryStatusConstants.HISTORY_TYPE_ADD, ptlAgreementUndwrtRules);
+        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName,
+                HistoryStatusConstants.HISTORY_TYPE_ADD, ptlAgreementUndwrtRules);
         ptlAgreementUndwrtRulesHistoryService.save(ptlAgreementUndwrtRulesHistory);
         return HttpResult.ok("添加成功");
     }
@@ -310,7 +325,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Override
     @Transactional
     public HttpResult<Object> updateAgreementUndwrtRules(PtlAgreementUndwrtRules ptlAgreementUndwrtRules, String userName) {
-        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementUndwrtRules.getAgreementId()));
+        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId,
+                ptlAgreementUndwrtRules.getAgreementId()));
         if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
@@ -322,7 +338,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //添加承保规则
         ptlAgreementUndwrtRulesService.updateById(ptlAgreementUndwrtRules);
         //添加历史记录
-        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName, HistoryStatusConstants.HISTORY_TYPE_UPDATE, ptlAgreementUndwrtRules);
+        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName,
+                HistoryStatusConstants.HISTORY_TYPE_UPDATE, ptlAgreementUndwrtRules);
         ptlAgreementUndwrtRulesHistoryService.save(ptlAgreementUndwrtRulesHistory);
         return HttpResult.ok("修改成功");
     }
@@ -330,11 +347,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     @Override
     @Transactional
     public HttpResult<Object> deleteAgreementUndwrtRules(String id, String userName) {
-        PtlAgreementUndwrtRules ptlAgreementUndwrtRules = ptlAgreementUndwrtRulesService.getOne(new LambdaQueryWrapper<PtlAgreementUndwrtRules>().eq(PtlAgreementUndwrtRules::getId, id));
+        PtlAgreementUndwrtRules ptlAgreementUndwrtRules =
+                ptlAgreementUndwrtRulesService.getOne(new LambdaQueryWrapper<PtlAgreementUndwrtRules>().eq(PtlAgreementUndwrtRules::getId
+                        , id));
         if (ptlAgreementUndwrtRules == null) {
             throw new SystemException("协议承保规则不存在");
         }
-        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId, ptlAgreementUndwrtRules.getAgreementId()));
+        PtlAgreement ptlAgreement = baseMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getId,
+                ptlAgreementUndwrtRules.getAgreementId()));
         if (ptlAgreement == null) {
             throw new SystemException("协议不存在");
         }
@@ -346,37 +366,47 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //删除承保规则
         ptlAgreementUndwrtRulesService.removeById(id);
         //添加历史记录
-        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName, HistoryStatusConstants.HISTORY_TYPE_DELETE, ptlAgreementUndwrtRules);
+        PtlAgreementUndwrtRulesHistory ptlAgreementUndwrtRulesHistory = new PtlAgreementUndwrtRulesHistory(userName,
+                HistoryStatusConstants.HISTORY_TYPE_DELETE, ptlAgreementUndwrtRules);
         ptlAgreementUndwrtRulesHistoryService.save(ptlAgreementUndwrtRulesHistory);
         return HttpResult.ok("删除成功");
     }
 
     @Override
-    public Page<PtlAgreement> pageAgreement(Page page,PtlAgreementPageVo ptlAgreementPageVo) {
+    public Page<PtlAgreement> pageAgreement(Page page, PtlAgreementPageVo ptlAgreementPageVo) {
 
         LambdaQueryWrapper<PtlAgreement> wrapper = new LambdaQueryWrapper<>();
         // 获取供应商本级id 及其 下级id
         List<String> lowerId = esmInsCompanyService.getByLowerId(ptlAgreementPageVo.getPartnerCompaniesId());
         //是否有效
-        wrapper.eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getValidStatus()), PtlAgreement::getValidStatus, ptlAgreementPageVo.getValidStatus())
+        wrapper.eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getValidStatus()), PtlAgreement::getValidStatus,
+                        ptlAgreementPageVo.getValidStatus())
                 // 供应商类型
-                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCompaniesType()), PtlAgreement::getCompaniesType, ptlAgreementPageVo.getCompaniesType())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCompaniesType()), PtlAgreement::getCompaniesType,
+                        ptlAgreementPageVo.getCompaniesType())
                 // 协议类型
-                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementType()), PtlAgreement::getAgreementType, ptlAgreementPageVo.getAgreementType())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementType()), PtlAgreement::getAgreementType,
+                        ptlAgreementPageVo.getAgreementType())
                 // 录入人
                 .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCreator()), PtlAgreement::getCreator, ptlAgreementPageVo.getCreator())
                 // 修改人
-                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getModifiedBy()), PtlAgreement::getModifiedBy, ptlAgreementPageVo.getModifiedBy())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getModifiedBy()), PtlAgreement::getModifiedBy,
+                        ptlAgreementPageVo.getModifiedBy())
                 // 修改人名字
-                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getModifiedName()), PtlAgreement::getModifiedName, ptlAgreementPageVo.getModifiedName())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getModifiedName()), PtlAgreement::getModifiedName,
+                        ptlAgreementPageVo.getModifiedName())
                 // 合作公司
-                .in(!StringUtils.isEmpty(ptlAgreementPageVo.getPartnerCompaniesId()) && !lowerId.isEmpty(), PtlAgreement::getPartnerCompaniesId, lowerId)
+                .in(!StringUtils.isEmpty(ptlAgreementPageVo.getPartnerCompaniesId()) && !lowerId.isEmpty(),
+                        PtlAgreement::getPartnerCompaniesId, lowerId)
                 // 费用描述
-                .like(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCostsDescription()), PtlAgreement::getUnderwritingDescription, ptlAgreementPageVo.getCostsDescription())
+                .like(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCostsDescription()), PtlAgreement::getUnderwritingDescription,
+                        ptlAgreementPageVo.getCostsDescription())
                 // 协议起期
-                .le(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementStartDate()), PtlAgreement::getStartDate, ptlAgreementPageVo.getAgreementStartDate())
+                .le(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementStartDate()), PtlAgreement::getStartDate,
+                        ptlAgreementPageVo.getAgreementStartDate())
                 // 协议止期
-                .ge(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementEndDate()), PtlAgreement::getEndDate, ptlAgreementPageVo.getAgreementEndDate());
+                .ge(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAgreementEndDate()), PtlAgreement::getEndDate,
+                        ptlAgreementPageVo.getAgreementEndDate());
         // 录入时间
         if (!ObjectUtils.isEmpty(ptlAgreementPageVo.getStartDate()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getEndDate())) {
             LocalDateTime startDateTime = ptlAgreementPageVo.getStartDate().atTime(LocalTime.MIN);
@@ -388,7 +418,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         if (!ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateStarTime()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateEndTime())) {
             LocalDateTime startDateTime = ptlAgreementPageVo.getUpdateStarTime().atTime(LocalTime.MIN);
             LocalDateTime endDateTime = ptlAgreementPageVo.getUpdateEndTime().atTime(LocalTime.MAX);
-            wrapper.between(!ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateStarTime()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateEndTime()), PtlAgreement::getUpdateTime, startDateTime,endDateTime);
+            wrapper.between(!ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateStarTime()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getUpdateEndTime()), PtlAgreement::getUpdateTime, startDateTime, endDateTime);
         }
         // 省市县
         if (ptlAgreementPageVo.getAreaCode() != null && !"".equals(ptlAgreementPageVo.getAreaCode()) && ptlAgreementPageVo.getLevel() != null) {
@@ -424,15 +454,20 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         // 获取供应商本级id 及其 下级id
         List<String> lowerId = esmInsCompanyService.getByLowerId(ptlAgreementPageVo.getPartnerCompaniesId());
         // 审核状态
-        wrapper.eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAuditStatus()), PtlAgreement::getAuditStatus, ptlAgreementPageVo.getAuditStatus())
+        wrapper.eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getAuditStatus()), PtlAgreement::getAuditStatus,
+                        ptlAgreementPageVo.getAuditStatus())
                 //是否有效
-                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getValidStatus()), PtlAgreement::getValidStatus, ptlAgreementPageVo.getValidStatus())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getValidStatus()), PtlAgreement::getValidStatus,
+                        ptlAgreementPageVo.getValidStatus())
                 // 供应商类型
-                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCompaniesType()), PtlAgreement::getCompaniesType, ptlAgreementPageVo.getCompaniesType())
+                .eq(!ObjectUtils.isEmpty(ptlAgreementPageVo.getCompaniesType()), PtlAgreement::getCompaniesType,
+                        ptlAgreementPageVo.getCompaniesType())
                 // 合作公司
-                .in(!StringUtils.isEmpty(ptlAgreementPageVo.getPartnerCompaniesId()) && !lowerId.isEmpty(), PtlAgreement::getPartnerCompaniesId, lowerId)
+                .in(!StringUtils.isEmpty(ptlAgreementPageVo.getPartnerCompaniesId()) && !lowerId.isEmpty(),
+                        PtlAgreement::getPartnerCompaniesId, lowerId)
                 // 录入时间
-                .between(!ObjectUtils.isEmpty(ptlAgreementPageVo.getStartDate()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getEndDate()), PtlAgreement::getCreateTime, ptlAgreementPageVo.getStartDate(), ptlAgreementPageVo.getEndDate());
+                .between(!ObjectUtils.isEmpty(ptlAgreementPageVo.getStartDate()) && !ObjectUtils.isEmpty(ptlAgreementPageVo.getEndDate())
+                        , PtlAgreement::getCreateTime, ptlAgreementPageVo.getStartDate(), ptlAgreementPageVo.getEndDate());
 
         List<PtlAgreement> agreementPage = list(wrapper);
         return HttpResult.ok(agreementPage);
@@ -490,9 +525,12 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
             deptHistory.setBatch(batchNo);
         }
         ptlAgreementDeptHistoryService.saveBatch(histories);
-        PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD, byAgreementId.getData().getAgreement());
-        ptlAgreementHistory.setStartDate(byAgreementId.getData().getAgreement().getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-        ptlAgreementHistory.setEndDate(byAgreementId.getData().getAgreement().getEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+        PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD,
+                byAgreementId.getData().getAgreement());
+        ptlAgreementHistory.setStartDate(byAgreementId.getData().getAgreement().getStartDate().format(DateTimeFormatter.ofPattern("yyyy" +
+                "-MM-dd")));
+        ptlAgreementHistory.setEndDate(byAgreementId.getData().getAgreement().getEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"
+        )));
         ptlAgreementHistory.setAgreementId(ptlAgreementHistory.getId());
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("delete");
@@ -517,13 +555,12 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         PtlAgreement ptlAgreement = proxyObject.ifExistsById(agreementId);
         BeanUtils.copyProperties(agreementSaveDto, ptlAgreement);
 
-        EsmInsCompany esmInsCompany = proxyObject.verifyLogin(ptlAgreement, agreementSaveDto, attribution);
+        EsmInsCompany esmInsCompany = proxyObject.verifyLogin(ptlAgreement, agreementSaveDto, attribution, false);
 
         ptlAgreement.setProductsCode(agreementSaveDto.getProductsCode());
         ptlAgreement.setModifiedBy(userName);
         ptlAgreement.setModifiedName(BaseController.getUser().getName());
         ptlAgreement.setUpdateTime(LocalDateTime.now());
-        HttpResult<PtlAgreementQueryVo> byAgreementId = this.getByAgreementId(agreementId);
         // 修改协议
         boolean b = updateById(ptlAgreement);
         AssertionUtils.isSucceed(b, "协议信息修改失败");
@@ -537,16 +574,19 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         String batchNo = IdGenerate.nextId();
         //添加授权部门历史信息
         List<String> dept = agreement.getDept();
-        List<PtlAgreementDeptHistory> ptlAgreementDeptList = PtlAgreementDeptHistory.toPtlAgreementDeptHistoryList(ptlAgreement.getId(), dept, batchNo);
+        List<PtlAgreementDeptHistory> ptlAgreementDeptList = PtlAgreementDeptHistory.toPtlAgreementDeptHistoryList(ptlAgreement.getId(),
+                dept, batchNo);
         ptlAgreementDeptHistoryService.saveBatch(ptlAgreementDeptList);
-        PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD, ptlAgreement);
+        PtlAgreementHistory ptlAgreementHistory = new PtlAgreementHistory(batchNo, userName, HistoryStatusConstants.HISTORY_TYPE_ADD,
+                ptlAgreement);
         ptlAgreementHistory.setStartDate(ptlAgreement.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         ptlAgreementHistory.setEndDate(ptlAgreement.getEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         ptlAgreementHistory.setAgreementId(ptlAgreement.getId());
         ptlAgreementHistory.setId(IdGenerate.nextId());
         ptlAgreementHistory.setOperatorType("update");
         ptlAgreementHistoryService.saveAgreementHistory(ptlAgreementHistory);
-        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, ptlAgreement.getId(), esmInsCompany.getId(), esmInsCompany.getName(), agreement.getAttribution());
+        PtlAgreementAttributionHistory ptlAgreementAttributionHistory = new PtlAgreementAttributionHistory(batchNo, ptlAgreement.getId(),
+                esmInsCompany.getId(), esmInsCompany.getName(), agreement.getAttribution());
         ptlAgreementAttributionHistory.setId(IdGenerate.nextId());
         if (StringUtils.isNotEmpty(attribution.getTemplateId())) {
             ptlAgreementAttributionHistoryService.save(ptlAgreementAttributionHistory);
@@ -588,22 +628,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     }
 
     @Override
-    public EsmInsCompany verifyLogin(PtlAgreement ptlAgreement, PtlAgreementSaveDto agreementSaveDto, PtlAgreementAttributionDto attribution) {
+    public EsmInsCompany verifyLogin(PtlAgreement ptlAgreement, PtlAgreementSaveDto agreementSaveDto,
+                                     PtlAgreementAttributionDto attribution, boolean verificationLogin) {
         EsmInsCompany esmInsCompany;
 
-        // 获取保险公司
-//        if (AgreementType.AT2.getCode().equals(agreementSaveDto.getAgreementType())) {
-//            String message = String.format("协议为 %s 保险公司必须传入", AgreementType.AT2.getDesc());
-//            AssertionUtils.isStringEmpty(agreementSaveDto.getAssociationCompaniesId(), message);
-//            esmInsCompany = esmInsCompanyService.isExists(agreementSaveDto.getAssociationCompaniesId());
-//        } else {
-//            esmInsCompany = esmInsCompanyService.getBySubsidiary(agreementSaveDto.getPartnerCompaniesId());
-//        }
-
         esmInsCompany = esmInsCompanyService.getBySubsidiary(agreementSaveDto.getPartnerCompaniesId());
 
         // 验证用户名密码 python api 对接需要验证用户名
-        if (!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType()) {
+        if (!ObjectUtils.isEmpty(attribution.getApiType()) && PtlApiType.PTL_API_2.getCode() == attribution.getApiType() && verificationLogin) {
             String nameSimple = esmInsCompany.getNamesimple();
             String id = esmInsCompany.getId();
             insCrawlerOrderController.isLogin(attribution, id, nameSimple);
@@ -659,7 +691,9 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
                     //然后根据协议ID 查询所有已配置费用的产品进行赋值
                     if (agreementId != null && !"".equals(agreementId)) {
                         //使用协议ID  产品ID  获取已经配置好的信息
-                        PtlAgreementNonCarProductCosts agreementNonCarProductCosts = ptlAgreementNonCarProductCostsService.getNonCarProductCostsInfo(agreementId, tempProductDto.getProductCode());
+                        PtlAgreementNonCarProductCosts agreementNonCarProductCosts =
+                                ptlAgreementNonCarProductCostsService.getNonCarProductCostsInfo(agreementId,
+                                        tempProductDto.getProductCode());
                         //赋值已配置的费用比例
                         if (agreementNonCarProductCosts != null) {
                             costsVo.setCostsProportion(agreementNonCarProductCosts.getCostsProportion());
@@ -690,7 +724,9 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
                 }
                 for (int j = 0; j < resultList.size(); j++) {
                     PtlAgreement agreement = resultList.get(j);
-                    String tempCompanyId = agreement.getAssociationCompaniesId() != null && !"".equals(agreement.getAssociationCompaniesId()) ? agreement.getAssociationCompaniesId() : agreement.getPartnerCompaniesId();
+                    String tempCompanyId =
+                            agreement.getAssociationCompaniesId() != null && !"".equals(agreement.getAssociationCompaniesId()) ?
+                                    agreement.getAssociationCompaniesId() : agreement.getPartnerCompaniesId();
                     EsmInsCompany tempCompany = esmInsCompanyService.getById(tempCompanyId);
                     agreement.setInsuranceCompany(tempCompany.getName());
                 }
@@ -698,6 +734,7 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         }
         return HttpResult.ok(resultList);
     }
+
     /**
      * @version
      * @author: hxl
@@ -718,13 +755,14 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
     public List<PtlAgreement> getCurrentAgreementList(String agreementId) {
         PtlAgreement ptlAgreement = this.getById(agreementId);
         String insuranceCompanyId = ptlAgreement.getInsuranceCompanyId();
-        List<PtlAgreement> ptlAgreements = baseMapper.selectList(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getInsuranceCompanyId, insuranceCompanyId));
+        List<PtlAgreement> ptlAgreements =
+                baseMapper.selectList(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getInsuranceCompanyId, insuranceCompanyId));
         return ptlAgreements;
     }
 
     @Override
     public PtlAgreement getByAgreementIdNew(String agreementId) {
-        PtlAgreement   ptlAgreement= baseMapper.getByAgreementIdNew(agreementId);
+        PtlAgreement ptlAgreement = baseMapper.getByAgreementIdNew(agreementId);
         return ptlAgreement;
     }
 
@@ -735,7 +773,12 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
     @Override
     public List<HashMap<String, Object>> getDockingPersonList() {
-        return   baseMapper.getDockingPersonList();
+        return baseMapper.getDockingPersonList();
+    }
+
+    @Override
+    public PtlAgreement selectAgreeId(HashMap<String, Object> params) {
+        return baseMapper.selectAgreeId(params);
     }
 
 

+ 20 - 22
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -1314,42 +1314,40 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
         insFeeOrderNew.setNoExportOtherCostsPremiums(exportFeeList.get(2).getOtherCostsPremiums());
 
         //region 重新计算一级机构管理费
-        //入口 - 出口 - 机构管理费 2-4级 - 分销费  = 差值  + 一级管理费
+        //入口 - 出口 - 机构管理费 5级 - 分销费  = 差值
 
         //分销交强费用
-        BigDecimal jqFenXiao = insFeeOrderNew.getJqPremium().multiply(retailStoreFee.getRetailStoreRadio().divide(new BigDecimal(100)));
+        BigDecimal jqFenXiao = insFeeOrderNew.getJqPremium().multiply(retailStoreFee.getRetailStoreRadio().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
         //分销商业费用
-        BigDecimal syFenXiao = insFeeOrderNew.getSyPremium().multiply(retailStoreFee.getRetailStoreRadio().divide(new BigDecimal(100)));
+        BigDecimal syFenXiao = insFeeOrderNew.getSyPremium().multiply(retailStoreFee.getRetailStoreRadio().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
         //分销非车费用
-        BigDecimal noFenXiao = insFeeOrderNew.getNoPremium().multiply(retailStoreFee.getRetailStoreRadio().divide(new BigDecimal(100)));
+        BigDecimal noFenXiao = insFeeOrderNew.getNoPremium().multiply(retailStoreFee.getRetailStoreRadio().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
 
-        BigDecimal jqDifference = insFeeOrderNew.getJqCostsPremiums().subtract(
-                        (insFeeOrderNew.getJqExportSuperviseCostsPremiums().add(insFeeOrderNew.getJqExportOtherCostsPremiums())))
+        BigDecimal jqDifference = jqEntranceFee.getTotalAmount().subtract(
+                        (jqExportFee.getSuperviseCostsPremiums().add(jqExportFee.getOtherCostsPremiums())))
                 .subtract(
-                        (insFeeOrderNew.getJqDeptPremiumsLevel2().add(insFeeOrderNew.getJqDeptPremiumsLevel3()).add(insFeeOrderNew.getJqDeptPremiumsLevel4()).add(insFeeOrderNew.getJqDeptPremiumsLevel5()))
+                        (jqDeptManagerFee.getDeptPremiumsLevelOne().add(jqDeptManagerFee.getDeptPremiumsLevelTwo().add(jqDeptManagerFee.getDeptPremiumsLevelThree()).add(jqDeptManagerFee.getDeptPremiumsLevelFoure()).add(jqDeptManagerFee.getDeptPremiumsLevelFive())))
                 )
-                .subtract(jqFenXiao);
-        insFeeOrderNew.setJqDeptPremiumsLevel1(jqDifference);
-        deptManagerFeeList.get(0).setDeptPremiumsLevelOne(jqDifference);
+                .subtract(jqFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setJqProfitMarginPremiums(jqDifference);
 
-
-        BigDecimal syDifference = insFeeOrderNew.getSyCostsPremiums().subtract(
-                        (insFeeOrderNew.getSyExportSuperviseCostsPremiums().add(insFeeOrderNew.getSyExportOtherCostsPremiums())))
+        BigDecimal syDifference = syEntranceFee.getTotalAmount().subtract(
+                        (syExportFee.getSuperviseCostsPremiums().add(syExportFee.getOtherCostsPremiums())))
                 .subtract(
-                        (insFeeOrderNew.getSyDeptPremiumsLevel2().add(insFeeOrderNew.getSyDeptPremiumsLevel3()).add(insFeeOrderNew.getSyDeptPremiumsLevel4()).add(insFeeOrderNew.getSyDeptPremiumsLevel5()))
+                        (syDeptManagerFee.getDeptPremiumsLevelOne().add(syDeptManagerFee.getDeptPremiumsLevelTwo().add(syDeptManagerFee.getDeptPremiumsLevelThree()).add(syDeptManagerFee.getDeptPremiumsLevelFoure()).add(syDeptManagerFee.getDeptPremiumsLevelFive())))
                 )
-                .subtract(syFenXiao);
-        insFeeOrderNew.setSyDeptPremiumsLevel1(syDifference);
-        deptManagerFeeList.get(1).setDeptPremiumsLevelOne(syDifference);
+                .subtract(syFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setSyProfitMarginPremiums(syDifference);
+
 
-        BigDecimal noDifference = insFeeOrderNew.getNoCostsPremiums().subtract(
-                        (insFeeOrderNew.getNoExportSuperviseCostsPremiums().add(insFeeOrderNew.getNoExportOtherCostsPremiums())))
+        BigDecimal noDifference = noEntranceFee.getTotalAmount().subtract(
+                        (noExportFee.getSuperviseCostsPremiums().add(noExportFee.getOtherCostsPremiums())))
                 .subtract(
-                        (insFeeOrderNew.getNoDeptPremiumsLevel2().add(insFeeOrderNew.getNoDeptPremiumsLevel3()).add(insFeeOrderNew.getNoDeptPremiumsLevel4()).add(insFeeOrderNew.getNoDeptPremiumsLevel5()))
+                        (noDeptManagerFee.getDeptPremiumsLevelOne().add(noDeptManagerFee.getDeptPremiumsLevelTwo().add(noDeptManagerFee.getDeptPremiumsLevelThree()).add(noDeptManagerFee.getDeptPremiumsLevelFoure()).add(noDeptManagerFee.getDeptPremiumsLevelFive())))
                 )
-                .subtract(noFenXiao);
+                .subtract(noFenXiao).setScale(5, BigDecimal.ROUND_HALF_DOWN);
 
-        insFeeOrderNew.setNoDeptPremiumsLevel1(noDifference);
+        insFeeOrderNew.setNoProfitMarginPremiums(noDifference);
         deptManagerFeeList.get(2).setDeptPremiumsLevelOne(noDifference);
         //endregion
 

+ 2 - 1
src/main/java/com/ydtech/modules/ser/service/impl/SerRescueOrderServiceImpl.java

@@ -20,7 +20,7 @@ import com.ydtech.modules.ser.utils.PositionUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
+import java.time.LocalDateTime;
 import java.util.Objects;
 
 @Service
@@ -66,6 +66,7 @@ public class SerRescueOrderServiceImpl extends ServiceImpl<SerRescueOrderMapper,
     public HttpResult<Object> insertRescueOrder(RescueOrder rescueOrder) {
         rescueOrder.setModifier(BaseController.getUser().getName());
         rescueOrder.setOrderState(OderStateEnum.UNPAID.getCode());
+        rescueOrder.setCreateTime(LocalDateTime.now());
         save(rescueOrder);
         return HttpResult.ok();
     }

+ 25 - 0
src/main/java/com/ydtech/utils/StringOperations.java

@@ -1,13 +1,38 @@
 package com.ydtech.utils;
 
+import com.ydtech.exception.SystemException;
+
+/**
+ * @version
+ * @description: 业务中字符串处理
+ * @author: wenks
+ * @date: 2024/6/6 10:15
+ **/
+
 public class StringOperations {
 
     private StringOperations() {
         throw new IllegalStateException("Utility class");
     }
 
+    /**
+     * 将空字符串和null 都处理为null
+     * @param s 字符
+     * @return
+     */
     public static String emptyStringToNull(String s){
         return StringUtils.isEmpty(s) ? null : s;
     }
 
+    /**
+     * 字符串为空报错
+     * @param s 字符
+     * @return
+     */
+    public static void nullException(String s, String message){
+        if (StringUtils.isEmpty(s)) {
+            throw new SystemException(message);
+        }
+    }
+
 }

+ 25 - 0
src/main/java/com/ydtech/utils/async/AsyncUtils.java

@@ -0,0 +1,25 @@
+package com.ydtech.utils.async;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.AsyncConfigurer;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+
+@Configuration
+@EnableAsync
+public class AsyncUtils  implements AsyncConfigurer {
+    @Override
+    @Bean
+    public Executor getAsyncExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(5);
+        executor.setMaxPoolSize(10);
+        executor.setQueueCapacity(25);
+        executor.initialize();
+        return executor;
+    }
+
+}

+ 4 - 4
src/main/resources/mapper/modules/admin/SysAmountAuditingMapper.xml

@@ -9,7 +9,7 @@
         <result property="bankNumber" column="bank_number" jdbcType="VARCHAR"/>
         <result property="amount" column="amount" jdbcType="DECIMAL"/>
         <result property="userId" column="user_id" jdbcType="VARCHAR"/>
-        <result property="property" column="auditing_status" jdbcType="VARCHAR"/>
+        <result property="auditingStatus" column="auditing_status" jdbcType="VARCHAR"/>
         <result property="amountStatus" column="amount_status" jdbcType="VARCHAR"/>
         <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
     </resultMap>
@@ -84,10 +84,10 @@
             </if>
 
             <if test="sysAmountAuditingVo.timeFiltering !=null and sysAmountAuditingVo.timeFiltering != '' ">
-                AND   DATE_FORMAT(a.auditing_time, '%Y-%m') = #{sysAmountAuditingVo.timeFiltering}
+                AND   DATE_FORMAT(a.auditing_time, '%Y-%m-%d') = #{sysAmountAuditingVo.timeFiltering}
             </if>
             <if test="sysAmountAuditingVo.withdrawalTime !=null and sysAmountAuditingVo.withdrawalTime != '' ">
-                AND   DATE_FORMAT(a.create_time, '%Y-%m') = #{sysAmountAuditingVo.withdrawalTime}
+                AND   DATE_FORMAT(a.create_time, '%Y-%m-%d') = #{sysAmountAuditingVo.withdrawalTime}
             </if>
         </where>
 
@@ -146,7 +146,7 @@
              AND   DATE_FORMAT(a.auditing_time, '%Y-%m') = #{timeFiltering}
             </if>
         </where>
-
+        order by a.auditing_time desc
     </select>
 
     <select id="getProgressIng" resultType="com.ydtech.modules.admin.model.po.SysAmountAuditingEntity">

+ 76 - 0
src/main/resources/mapper/modules/admin/SysUserAccountHistoryMapper.xml

@@ -23,4 +23,80 @@
         from_bank_card,to_bank_card,user_id,
         create_time
     </sql>
+
+    <select id="revenueReportYear" resultType="com.ydtech.modules.admin.model.dto.RevenueReportDto">
+        SELECT
+            a.reportDate AS reportDate,
+            MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
+            MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
+            MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
+        FROM
+            (
+                SELECT
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0')) reportDate,
+                    property as property,
+                    sum(amount)  as amount
+                FROM
+                    sys_user_account_history
+                WHERE
+                    documentary=2
+                  and create_time &gt;= #{beginTime}  and  create_time &lt;= #{endTime}
+                  and user_id=#{userId}
+                GROUP BY
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0')),
+                    property
+            ) a
+        GROUP BY
+            a.reportDate
+    </select>
+    <select id="revenueReportMonth" resultType="com.ydtech.modules.admin.model.dto.RevenueReportDto">
+        SELECT
+            a.reportDate AS reportDate,
+            MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
+            MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
+            MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
+        FROM
+            (
+                SELECT
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0'),'-',LPAD(Day(create_time), 2, '0')) reportDate,
+                    property as property,
+                    sum(amount)  as amount
+                FROM
+                    sys_user_account_history
+                WHERE
+                    documentary=2
+                  and create_time &gt;= #{beginTime}  and  create_time &lt;= #{endTime}
+                  and user_id=#{userId}
+                GROUP BY
+                    CONCAT(YEAR(create_time),'-',LPAD(MONTH(create_time), 2, '0'),'-',LPAD(Day(create_time), 2, '0')),
+                    property
+            ) a
+        GROUP BY
+            a.reportDate
+    </select>
+    <select id="revenueReportDay" resultType="com.ydtech.modules.admin.model.dto.RevenueReportDto">
+        SELECT
+            a.reportDate AS reportDate,
+            MAX( CASE WHEN a.property = 1 THEN a.amount ELSE 0 END ) AS haldingAmount,
+            MAX( CASE WHEN a.property = 2 THEN a.amount ELSE 0 END ) AS documentaryAmount,
+            MAX( CASE WHEN a.property = 3 THEN a.amount ELSE 0 END ) AS promotionAmount
+        FROM
+            (
+                SELECT
+                    CONCAT(YEAR ( create_time ),'-',LPAD( MONTH ( create_time ), 2, '0' ),'-',LPAD( DAY ( create_time ), 2, '0' ),' ',LPAD( HOUR ( create_time ), 2, '0' )) reportDate,
+                    property as property,
+                    sum( amount ) as amount
+                FROM
+                    sys_user_account_history
+                WHERE
+                    documentary=2
+                  and create_time &gt;= #{beginTime}  and  create_time &lt;= #{endTime}
+                  and user_id=#{userId}
+                GROUP BY
+                    CONCAT(YEAR ( create_time ),'-',LPAD( MONTH ( create_time ), 2, '0' ),'-',LPAD( DAY ( create_time ), 2, '0' ),' ',LPAD( HOUR ( create_time ), 2, '0' )),
+                    property
+            ) a
+        GROUP BY
+            a.reportDate
+    </select>
 </mapper>

+ 49 - 3
src/main/resources/mapper/modules/admin/SysUserAccountMapper.xml

@@ -10,6 +10,9 @@
             <result property="documentary" column="documentary" jdbcType="DECIMAL"/>
             <result property="promotion" column="promotion" jdbcType="DECIMAL"/>
             <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="deptId" column="deptId" jdbcType="VARCHAR"/>
+            <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
             <result property="handlingAmountWithdrawal" column="handling_amount_withdrawal" jdbcType="DECIMAL"/>
             <result property="handlingAmountAccount" column="handling_amount_account" jdbcType="DECIMAL"/>
             <result property="handlingAmountPayment" column="handling_amount_payment" jdbcType="DECIMAL"/>
@@ -19,7 +22,14 @@
             <result property="promotionAmountWithdrawal" column="promotion_amount_withdrawal" jdbcType="DECIMAL"/>
             <result property="promotionAmountAccount" column="promotion_amount_account" jdbcType="DECIMAL"/>
             <result property="promotionAmountPayment" column="promotion_amount_payment" jdbcType="DECIMAL"/>
+            <collection property="sysUserAccountCardList" ofType="com.ydtech.modules.admin.model.po.SysUserBankCard"
+                    resultMap="sysUserAccountCardList"/>
+    </resultMap>
 
+    <resultMap id="sysUserAccountCardList" type="com.ydtech.modules.admin.model.po.SysUserBankCard">
+        <result property="bankNumber" column="bank_number" jdbcType="VARCHAR"/>
+        <result property="bankAccount" column="bank_account" jdbcType="VARCHAR"/>
+        <result property="bankAddress" column="bank_address" jdbcType="VARCHAR"/>
     </resultMap>
 
     <sql id="Base_Column_List">
@@ -83,9 +93,45 @@
         </where>
     </select>
 
-    <select id="selectPromotionBy" resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
-        select 
-
+    <select id="queryPageOrder1"  resultMap="BaseResultMap">
+        select
+        a.user_id,
+        a.handling_fee,
+        a.documentary,
+        a.promotion,
+        a.create_time,
+        a.handling_amount_withdrawal,
+        a.handling_amount_account,
+        a.handling_amount_payment,
+        a.documentary_amount_withdrawal,
+        a.documentary_amount_account,
+        a.documentary_amount_payment,
+        a.promotion_amount_withdrawal,
+        a.promotion_amount_account,
+        a.promotion_amount_payment,
+        b.dept_id  as  deptId,
+        b.name  as  name,
+        sd.name  as  deptName,
+        c.bank_number,
+        c.bank_account,
+        c.bank_address
+        from
+        sys_user_account a
+        left join   sys_user  b  on  a.user_id  = b.id
+        left join   sys_dept  sd  on  sd.id =b.dept_id
+        left join   sys_user_bank_card c on c.user_id = a.user_id and c.audit_status = '1'
+        <where>
+            1=1
+            <if test="sysUserAccountVo.userId != null and sysUserAccountVo.userId != ''">
+                and a.user_id = #{sysUserAccountVo.userId}
+            </if>
+            <if test="sysUserAccountVo.deptId != null and sysUserAccountVo.deptId != ''">
+                and b.dept_id like concat(#{sysUserAccountVo.deptId},'%')
+            </if>
+            <if test="sysUserAccountVo.bankNumber != null and sysUserAccountVo.bankNumber != ''">
+                and c.bank_number = #{sysUserAccountVo.bankNumber}
+            </if>
+        </where>
     </select>
 
 

+ 13 - 0
src/main/resources/mapper/modules/admin/SysUserBankCardMapper.xml

@@ -35,6 +35,19 @@
 
 
     </select>
+
+    <select id="getByBankNumber" resultType="com.ydtech.modules.admin.model.po.SysUserBankCard">
+        select
+        a.*
+        from sys_user_bank_card a
+        <where>
+            a.audit_status ='1'
+            <if test="fromBankCardId !=null and  fromBankCardId !=''">
+                and a.bank_number =#{fromBankCardId}
+            </if>
+        </where>
+    </select>
+
     <select id="getUserBankList" resultType="com.ydtech.modules.admin.model.po.SysUserBankCard">
             select
                   a.id as "id",

+ 48 - 0
src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml

@@ -137,5 +137,53 @@
         </if>
     </select>
 
+    <select id="employeeIncreaseReportYear" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
+        SELECT
+            CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0')) reportDate,
+            count(0) as employeeIncreaseCount
+        FROM
+            esm_user_referrer eur
+                LEFT JOIN sys_user us ON eur.id = us.id
+        WHERE
+            us.create_time &gt;= #{beginTime}  and  us.create_time &lt;= #{endTime}
+            and eur.referrer_id=#{userId}
+        GROUP BY  CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0'))
+    </select>
+
+    <select id="employeeIncreaseReportMonth" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
+        SELECT
+            CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0'),'-',LPAD(Day(us.create_time), 2, '0')) reportDate,
+            count(0) as employeeIncreaseCount
+        FROM
+            esm_user_referrer eur
+                LEFT JOIN sys_user us ON eur.id = us.id
+        WHERE
+            us.create_time &gt;= #{beginTime}  and  us.create_time &lt;= #{endTime}
+            and eur.referrer_id=#{userId}
+        GROUP BY  CONCAT(YEAR(us.create_time),'-',LPAD(MONTH(us.create_time), 2, '0'),'-',LPAD(Day(us.create_time), 2, '0'))
+    </select>
+
+
+    <select id="employeeIncreaseReportDay" resultType="com.ydtech.modules.admin.model.dto.EmployeeIncreaseReportDto">
+        SELECT
+            CONCAT(YEAR ( us.create_time ),'-',LPAD( MONTH ( us.create_time ), 2, '0' ),'-',LPAD( DAY ( us.create_time ), 2, '0' ),' ',LPAD( HOUR ( us.create_time ), 2, '0' ))
+                          reportDate,
+            count( 0 ) AS employeeIncreaseCount
+        FROM
+            esm_user_referrer eur
+                LEFT JOIN sys_user us ON eur.id = us.id
+        WHERE
+            us.create_time &gt;= #{beginTime}  and  us.create_time &lt;= #{endTime}
+            and eur.referrer_id=#{userId}
+        GROUP BY  CONCAT(YEAR ( us.create_time ),'-',LPAD( MONTH ( us.create_time ), 2, '0' ),'-',LPAD( DAY ( us.create_time ), 2, '0' ),' ',LPAD( HOUR ( us.create_time ), 2, '0' ))
+    </select>
+
+    <select id="findReferrerIds" resultType="java.lang.String">
+        SELECT
+           id as id
+        FROM
+            esm_user_referrer eur
+            where eur.referrer_id=#{userId}
+    </select>
 
 </mapper>

+ 30 - 0
src/main/resources/mapper/modules/fnc/ImportAsyncMapper.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.fnc.dao.ImportAsyncMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.ImportResult">
+        <id column="id" property="id" />
+        <result column="create_time" property="createTime" />
+        <result column="created_at" property="createdAt" />
+        <result column="completed_at" property="completedAt" />
+        <result column="status" property="status" />
+        <result column="amount" property="amount" />
+        <result column="upload_url" property="uploadUrl" />
+        <result column="company_id" property="companyId" />
+        <result column="partner_companies_id" property="partnerCompaniesId" />
+        <result column="agreement_id" property="agreementId" />
+        <result column="ids" property="ids" />
+        <result column="hand_status" property="handStatus" />
+    </resultMap>
+
+    <select id="queryNew" resultType="com.ydtech.modules.fnc.entity.ImportResult">
+        select  * from  import_task
+
+        <where>
+            <if test="handStatus !=null  and  handStatus  !=''">
+                hand_status =#{handStatus}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 143 - 6
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -75,6 +75,8 @@
         <result column="sy_start_date" property="syStartDate"/>
         <result column="sy_end_date" property="syEndDate"/>
         <result column="settle_other_status" property="settleOtherStatus"/>
+        <result column="settlement_image_id" property="settlementImageId"/>
+
     </resultMap>
     <sql id="income_com">
                 a.id      as  "id",
@@ -147,6 +149,7 @@
                 a.settle_other_status  as  "settleOtherStatus",
                 a.user_id  as  "userId",
                 a.invoicing_method  as  "invoicingMethod",
+                a.settlement_image_id as "settlementImageId",
                 a.create_time  as  "createTime"
     </sql>
 
@@ -155,11 +158,13 @@
                 pa.agreement_name  as "agreementName",
                 pa.agreement_type  as "agreementType",
                 pa.docking_person  as "dockingPerson",
+                upf.url as "imageUrl",
                 su.name  as "userName",
                 <include refid="income_com"/>
                 from  ins_ply_income a
                 LEFT  JOIN  ptl_agreement  pa  on  a.agreement_id  = pa.id
                 LEFT  JOIN  sys_user   su  on su.id=a.user_id
+                LEFT  JOIN   ins_upload_files  upf   on  a.settlement_image_id=upf.id
             <where>
                 <if test="startDate !=null  and  startDate!='' and  endDate !=null and endDate !=''">
                     and DATE_FORMAT( a.signdate, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
@@ -449,6 +454,10 @@
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+
             <if test="jqSuperviseCostsPremiums !=null  and  jqSuperviseCostsPremiums  !=''">
                 and a.jq_supervise_costs_premiums =#{jqSuperviseCostsPremiums}
             </if>
@@ -712,6 +721,134 @@
             </where>
     </select>
 
+    <select id="ptTotalAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+            SELECT
+            SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS commissionFeevalue,
+            SUM( CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "noInvoicCommissionFeevalue",
+            SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "readyCommissionFeevalue"
+            FROM
+            ins_ply_income a
+            LEFT JOIN
+            ptl_agreement pa ON pa.id = a.agreement_id
+            <where>
+                1=1
+                <if test="startDate !=null  and  startDate!='' and  endDate !=null and endDate !=''">
+                    and DATE_FORMAT( a.signdate, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
+                </if>
+                <if test="agreementType !=null  and  agreementType  !=''">
+                    and pa.agreement_type =#{agreementType}
+                </if>
+                <if test="orderno !=null  and  orderno  !=''">
+                    and a.orderno =#{orderno}
+                </if>
+                <if test="companyName !=null  and  companyName  !=''">
+                    and a.company_id =#{companyName}
+                </if>
+                <if test="signDateEnd !=null  and  signDateEnd!='' and  signDateStart !=null and signDateStart !=''">
+                    and a.signdate   between #{signDateStart} and #{signDateEnd}
+                </if>
+                <if test="policyno !=null  and  policyno  !=''">
+                    and a.policyno =#{policyno}
+                </if>
+
+                <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                    and a.handling_fees_status =#{handlingFeesStatus}
+                </if>
+
+                <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                    and a.documentary_fees_status =#{documentaryFeesStatus}
+                </if>
+
+                <if test="isNotCar !=null  and  isNotCar  !=''">
+                    and a.is_not_car =#{isNotCar}
+                </if>
+                <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
+                    AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate}  AND a.jq_start_date &gt; = #{jqStartDate}
+                </if>
+                <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
+                    AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate}  AND a.sy_start_date &gt; = #{syStartDate}
+                </if>
+
+                <if test="isOther !=null  and  isOther  !=''">
+                    and a.is_not_documentary   =#{isOther}
+                </if>
+                <if test="licenseno != null and licenseno != ''  ">
+                    and a.licenseno  =#{licenseno}
+                </if>
+
+                <if test="deptId !=null  and  deptId  !=''">
+                    and pa.dept_id =#{deptId}
+                </if>
+
+
+                <if test="ids != null and ids != '' and ids.length > 0">
+                    and a.id in
+                    <foreach collection="ids" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+
+                <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                    and a.id in
+                    <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="syPolicyno != null and syPolicyno != ''  ">
+                    and a.sy_policyno =#{syPolicyno}
+                </if>
+
+                <if test="noPolicyno != null and noPolicyno != ''">
+                    and a.no_policyno =#{noPolicyno}
+                </if>
+                <if test="signdate !=null  and  signdate  !=''">
+                   AND a.signdate =#{signdate}
+                </if>
+                <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                   AND  a.partner_companies_id =#{partnerCompaniesId}
+                </if>
+
+                <if test="createTime !=null  and  createTime  !=''">
+                   AND a.create_time =#{createTime}
+                </if>
+                <if test="settlementTime !=null  and  settlementTime  !=''">
+                   AND a.settlement_time =#{settlementTime}
+                </if>
+
+                <if test="partnerCompaniesName !=null  and  partnerCompaniesName  !=''">
+                    AND   a.partner_companies_name =#{partnerCompaniesName}
+                </if>
+
+                <if test="userId !=null  and  userId  !=''">
+                    and a.userId   =#{userId}
+                </if>
+                <if test="companyId !=null  and  companyId  !=''">
+                    and a.company_id   =#{companyId}
+                </if>
+                <if test="riskcode !=null  and  riskcode  !=''">
+                    and a.riskcode   =#{riskcode}
+                </if>
+                <if test="year !=null  and  year  !=''">
+                    AND YEAR(a.signdate) =#{year}
+                </if>
+                <if test="month !=null  and  month !=''">
+                    AND month(a.signdate) =#{month}
+                </if>
+                <if test="day !=null  and  day !=''">
+                    AND day(a.signdate) =#{day}
+                </if>
+                <if test="insuredName !=null  and  insuredName !=''">
+                    AND  a.insured_name =#{insuredName}
+                </if>
+                <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
+                    and a.partner_companies_id in
+                    <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+            </where>
+    </select>
+
 
     <select id="totalPinAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
                 select
@@ -844,9 +981,9 @@
         WHEN (IFNULL(MAX(d.settleMentAmount), 0.00) - IFNULL(MAX(f.settleMentAmount), 0.00)) = 0.00
         THEN   IFNULL ( MAX(d.settleMentAmount) ,0.00)
         ELSE (IFNULL(MAX(d.settleMentAmount), 0.00) - IFNULL(MAX(f.settleMentAmount), 0.00))
-        END AS "allInvoicCommissionFeevalue",
+        END AS "invoicCommissionFeevalue",
         IFNULL(max(f.settleMentAmount) , 0.00)  as  "readyCommissionFeevalue",
-        IFNULL ( max(d.settleMentAmount),0.00) as "invoicCommissionFeevalue",
+        IFNULL ( max(d.settleMentAmount),0.00) as "allInvoicCommissionFeevalue",
         sum(COALESCE( a.commission_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
         sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
         IFNULL(MAX(f.expendAmount),0.00) as   "expendAmount",
@@ -960,8 +1097,8 @@
         IFNULL ( max(d.settleMentAmount),0.00)-IFNULL(max(f.settleMentAmount) , 0.00)  as "invoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
-        IFNULL(MAX(f.expendAmount),0.00) as   "expendAmount",
-        MAX(COALESCE( f.settleMentAmount,0.00) )-IFNULL ( max(f.expendAmount),0.00)  as "taxesFees",
+        IFNULL(IFNULL(max(f.settleMentAmount) , 0.00)  *  MAX(f.taxPoints) /100,0) as  "taxesFees",
+        IFNULL  ( IFNULL(max(f.settleMentAmount) , 0.00)  - ( IFNULL(max(f.settleMentAmount) , 0.00)  *  MAX(f.taxPoints) /100) ,0) as   "expendAmount",
         sum( a.other_feevalue ) AS "otherFeevalue"
         FROM
         ins_ply_income a
@@ -986,8 +1123,8 @@
         ) d ON d.partnerCompaniesId = a.partner_companies_id
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
         settlement_amount ) AS "settleMentAmount",
-        SUM(CASE WHEN a.invoicing_method = '0' THEN a.expend_amount ELSE 0 END) as  "expendAmount",
-        SUM(CASE WHEN a.invoicing_method = '0' THEN a.tax_points ELSE 0 END) as  "taxPoints"
+        SUM(a.expend_amount) as  "expendAmount",
+        SUM(a.tax_points) as  "taxPoints"
         FROM settlement_documentary_fees a
         WHERE a.settlement_status = '2'
           and  a.handling_fees_status ='1'

+ 68 - 25
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -173,41 +173,25 @@
         pa.agreement_code as agreementCode,
         pa.agreement_name as agreementName
         FROM
-        ins_orders io
-        LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno and iac.orderstatus = 3
-        LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
+        ins_fee_audit ifa
+        LEFT JOIN ins_orders io ON io.orderno = ifa.orderno
+        LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno
+        AND iac.orderstatus = 3
         LEFT JOIN sys_user su ON su.id = io.userid
         LEFT JOIN sys_dept sd ON sd.id = su.dept_id
         LEFT JOIN sys_user su2 ON ifa.audituser = su2.id
         LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
-        LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
-        WHERE
-        io.orderno IN (
-        SELECT
-        orderno
-        FROM
-        ins_area_company iac,(
-        SELECT
-        ins_order_no
-        FROM
-        ins_fee_order_new AS o
+        LEFT JOIN esm_ins_company eic ON eic.id = pa.partner_companies_id
         WHERE
-        <if test="params.auditStatus != null and params.auditStatus == 0">
-            NOT EXISTS
+        iac.id = ifa.ins_order_no
+        AND iac.orderstatus = 3
+        <if test="params.auditStatus != null and params.auditStatus != ''">
+            and ifa.auditstatus = #{params.auditStatus}
         </if>
-        <if test="params.auditStatus != null and params.auditStatus == 1">
-            ins_order_no in
-        </if>
-        ( SELECT ins_order_no FROM ins_fee_audit AS a WHERE a.ins_order_no = o.ins_order_no )
-        ) a
-        WHERE
-        iac.id = a.ins_order_no
-        AND orderstatus = 3
         <if test="params.quoteStartDateStr != null and params.quoteStartDateStr != '' and params.quoteEndDateStr != null and params.quoteEndDateStr != ''">
             and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{params.quoteStartDateStr} AND
             #{params.quoteEndDateStr}
         </if>
-        )
         <if test="params.taskNo != null and params.taskNo != ''">
             AND io.orderno = #{params.taskNo}
         </if>
@@ -586,4 +570,63 @@
         WHERE
             iac.id=#{subOrderId}
     </select>
+
+
+    <select id="premiumReportYear" resultType="com.ydtech.modules.admin.model.dto.PremiumReportDto">
+        SELECT
+            CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0')) reportDate,
+            sum(jqpremium) jqpremium,
+            sum(sypremium) sypremium,
+            sum(sumpremium) sumpremium
+        FROM
+            ins_area_company iac  left join ins_orders io on iac.orderno=io.orderno
+        WHERE
+            iac.orderstatus = 3  and
+            iac.createtime &gt;= #{beginTime}  and  iac.createtime &lt;= #{endTime}
+            and io.userid=#{userId}
+        GROUP BY CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0'))
+    </select>
+
+    <select id="premiumReportMonth" resultType="com.ydtech.modules.admin.model.dto.PremiumReportDto">
+        SELECT
+            CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0'),'-',LPAD(Day(iac.createtime), 2, '0')) reportDate,
+            sum(jqpremium) jqpremium,
+            sum(sypremium) sypremium,
+            sum(sumpremium) sumpremium
+        FROM
+            ins_area_company iac  left join ins_orders io on iac.orderno=io.orderno
+        WHERE
+            iac.orderstatus = 3  and
+            iac.createtime &gt;= #{beginTime}  and  iac.createtime &lt;= #{endTime}
+            and io.userid=#{userId}
+        GROUP BY  CONCAT(YEAR(iac.createtime),'-',LPAD(MONTH(iac.createtime), 2, '0'),'-',LPAD(Day(iac.createtime), 2, '0'))
+    </select>
+
+    <select id="premiumReportDay" resultType="com.ydtech.modules.admin.model.dto.PremiumReportDto">
+        SELECT
+            CONCAT(YEAR ( iac.createtime ),'-',LPAD( MONTH ( iac.createtime ), 2, '0' ),'-',LPAD( DAY ( iac.createtime ), 2, '0' ),' ',LPAD( HOUR ( iac.createtime ), 2, '0' ))
+                              reportDate,
+            sum( jqpremium ) jqpremium,
+            sum( sypremium ) sypremium,
+            sum( sumpremium ) sumpremium
+        FROM
+            ins_area_company iac  left join ins_orders io on iac.orderno=io.orderno
+        WHERE
+            iac.orderstatus = 3  and
+            iac.createtime &gt;= #{beginTime}  and  iac.createtime &lt;= #{endTime}
+            and io.userid=#{userId}
+        GROUP BY   CONCAT(YEAR ( iac.createtime ),'-',LPAD( MONTH ( iac.createtime ), 2, '0' ),'-',LPAD( DAY ( iac.createtime ), 2, '0' ),' ',LPAD( HOUR ( iac.createtime ), 2, '0' ))
+    </select>
+
+    <select id="getAllpremium" resultType="com.ydtech.modules.admin.model.dto.AllpremiumDto">
+        SELECT
+            ifnull(sum(  iac.sumpremium ),0) as sumPremium,
+            count( 0 ) as sumCount
+        FROM
+            ins_area_company iac  left join ins_orders io on iac.orderno=io.orderno
+        WHERE
+                iac.orderstatus = 3
+                and io.userid=#{userId}
+                AND YEAR (iac.createtime) = #{year}
+    </select>
 </mapper>

+ 14 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -121,4 +121,18 @@
         GROUP BY docking_person
     </select>
 
+    <select id="selectAgreeId" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
+        select
+            *
+        from  ptl_agreement a
+        <where>
+            <if test="companyId  !=null  and   companyId  !=''" >
+                    a.association_companies_id =#{companyId}
+            </if>
+            <if test="partnerCompaniesId  !=null  and   partnerCompaniesId  !=''" >
+                  and   a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+        </where>
+
+    </select>
 </mapper>

BIN
src/main/resources/template/noHandlingFeeTemplate.xlsx


BIN
src/main/resources/template/otherBatchUpdate.xlsx