소스 검색

1.結算调整优化

wuhp 2 년 전
부모
커밋
b2f2dc8f2d
28개의 변경된 파일1579개의 추가작업 그리고 93개의 파일을 삭제
  1. 2 0
      src/main/java/com/ydtech/SpringInsApplication.java
  2. 2 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java
  3. 36 0
      src/main/java/com/ydtech/modules/fnc/controller/ImportAsyncController.java
  4. 178 68
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  5. 14 0
      src/main/java/com/ydtech/modules/fnc/dao/ImportAsyncMapper.java
  6. 2 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  7. 79 0
      src/main/java/com/ydtech/modules/fnc/entity/ImportResult.java
  8. 15 2
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  9. 4 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java
  10. 27 0
      src/main/java/com/ydtech/modules/fnc/service/ImportAsyncService.java
  11. 9 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  12. 631 0
      src/main/java/com/ydtech/modules/fnc/service/impl/ImportAsyncServiceImpl.java
  13. 177 17
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  14. 14 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  15. 56 0
      src/main/java/com/ydtech/modules/fnc/vo/ImportResultVo.java
  16. 3 0
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java
  17. 43 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsBxOtherExcelDto.java
  18. 35 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsImportResult.java
  19. 32 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsNoBxOtherExcelDto.java
  20. 1 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java
  21. 2 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java
  22. 5 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  23. 25 0
      src/main/java/com/ydtech/utils/async/AsyncUtils.java
  24. 30 0
      src/main/resources/mapper/modules/fnc/ImportAsyncMapper.xml
  25. 143 6
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  26. 14 0
      src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml
  27. BIN
      src/main/resources/template/noHandlingFeeTemplate.xlsx
  28. 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 {
 

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

@@ -36,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;
@@ -136,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());

+ 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);
+
+}

+ 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();
+    }
+
+}

+ 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;
 }

+ 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;
+
+
+
+}

+ 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);
 }
 
 

+ 2 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -227,4 +227,6 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
     List<HashMap<String, Object>> getDockingPersonList();
 
 
+    PtlAgreement selectAgreeId(HashMap<String, Object> params);
+
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -776,5 +776,10 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         return baseMapper.getDockingPersonList();
     }
 
+    @Override
+    public PtlAgreement selectAgreeId(HashMap<String, Object> params) {
+        return baseMapper.selectAgreeId(params);
+    }
+
 
 }

+ 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;
+    }
+
+}

+ 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'

+ 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