Przeglądaj źródła

修改bug:
平台协议应收-应收订单:模版无法下载、上传文件报错、无法导出Excel
解决方法:
导入、导出、导出模板功能均为实现,需要提供三个接口

jiakai 6 miesięcy temu
rodzic
commit
8a8c8229cf

+ 152 - 0
commons/src/main/java/com/jzg/commons/entity/finance/dto/ReceivableExportExcelDto.java

@@ -0,0 +1,152 @@
+package com.jzg.commons.entity.finance.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author tz
+ * @description 应收查询VO
+ * @createDate 2024-06-26 10:49:31
+ */
+@Data
+public class ReceivableExportExcelDto extends PageRequest {
+
+    @Schema(description = "选中类型")
+    @ExcelIgnore
+    // 1 全部数据选中  2 选中部分数据
+    private String selectedType;
+
+    @Schema(description = "选中id")
+    @ExcelIgnore
+    private List<String> selectedIds;
+
+    @Schema(description = "协议类型")
+    @ExcelProperty(value = "协议类型", index = 13)
+    private String agreementType;
+
+    @Schema(description = "id")
+    @ExcelIgnore
+    private String id;
+
+    @Schema(description = "ids")
+    @ExcelIgnore
+    private List<String> ids;
+
+    @Schema(description = "查询类型")
+    @ExcelProperty(value = "查询类型", index = 14)
+    private String queryType;
+
+    @Schema(description = "车牌号")
+    @ExcelProperty(value = "车牌号", index = 0)
+    private String licenseNo;
+
+    @Schema(description = "险种信息")
+    @ExcelProperty(value = "险种信息", index = 15)
+    private String productId;
+
+    @Schema(description = "保险公司")
+    @ExcelIgnore
+    private String companyId;
+
+    @Schema(description = "签单时间开始时间")
+    @ExcelProperty(value = "签单时间开始时间", index = 11)
+    private String signingTimeStart;
+
+    @Schema(description = "签单时间结束时间")
+    @ExcelProperty(value = "签单时间结束时间", index = 12)
+    private String signingTimeEnd;
+
+    @Schema(description = "订单号")
+    @ExcelProperty(value = "订单号", index = 16)
+    private String orderNo;
+
+    @Schema(description = "订单号集合")
+    @ExcelIgnore
+    private List<String> orderNos;
+
+    @Schema(description = "协议id")
+    @ExcelIgnore
+    private String agreementId;
+
+    @Schema(description = "出单机构")
+    @ExcelIgnore
+    private String deptId;
+
+    @Schema(description = "险种")
+    @ExcelProperty(value = "险种", index = 17)
+    private String riskCode;
+
+    @Schema(description = "订单类型")
+    @ExcelProperty(value = "订单类型", index = 18)
+    private String orderType;
+
+    @Schema(description = "被保人")
+    @ExcelProperty(value = "被保人", index = 19)
+    private String insuredName;
+
+    @Schema(description = "交强险保单号")
+    @ExcelProperty(value = "交强险保单号", index = 1)
+    private String jqPolicyNo;
+
+    @Schema(description = "交强险手续费比例")
+    @ExcelProperty(value = "交强险手续费比例(%)", index = 2)
+    private String jqSuperviseCostsProportion;
+
+    @Schema(description = "交强险跟单费比例")
+    @ExcelProperty(value = "交强险跟单费比例(%)", index = 3)
+    private String jqOtherCostsProportion;
+
+    @Schema(description = "商业险保单号")
+    @ExcelProperty(value = "商业险保单号", index = 4)
+    private String syPolicyNo;
+
+    @Schema(description = "商业险手续费比例")
+    @ExcelProperty(value = "商业险手续费比例(%)", index = 5)
+    private String sySuperviseCostsProportion;
+
+    @Schema(description = "商业险跟单费比例")
+    @ExcelProperty(value = "商业险跟单费比例(%)", index = 6)
+    private String syOtherCostsProportion;
+
+    @Schema(description = "驾意险保单号")
+    @ExcelProperty(value = "驾意险保单号", index = 7)
+    private String jyPolicyNo;
+
+    @Schema(description = "驾意险手续费比例")
+    @ExcelProperty(value = "驾意险手续费比例(%)", index = 8)
+    private String jySuperviseCostsProportion;
+
+    @Schema(description = "驾意险跟单费比例")
+    @ExcelProperty(value = "驾意险跟单费比例(%)", index = 9)
+    private String jyOtherCostsProportion;
+
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人", index = 10)
+    private String dockingPerson;
+
+    @Schema(description = "交强起保时间")
+    @ExcelProperty(value = "交强起保时间", index = 20)
+    private String jqStartDate;
+
+    @Schema(description = "交强到期时间")
+    @ExcelProperty(value = "交强到期时间", index = 21)
+    private String jqEndDate;
+
+    @Schema(description = "商业起保时间")
+    @ExcelProperty(value = "商业起保时间", index = 22)
+    private String syStartDate;
+
+    @Schema(description = "商业到期时间")
+    @ExcelProperty(value = "商业到期时间", index = 23)
+    private String syEndDate;
+
+    @Schema(description = "产品名称")
+    @ExcelProperty(value = "产品名称", index = 24)
+    private String productName;
+
+}

+ 187 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/ReceivableExportExcelVo.java

@@ -0,0 +1,187 @@
+package com.jzg.commons.entity.finance.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * @author tz
+ * @description 应收查询VO
+ * @createDate 2024-06-26 10:49:31
+ */
+@Data
+public class ReceivableExportExcelVo {
+
+    @Schema(description = "选中类型")
+    @ExcelIgnore
+    // 1 全部数据选中  2 选中部分数据
+    private String selectedType;
+
+    @Schema(description = "协议类型")
+    @ExcelProperty(value = "协议类型", index = 13)
+    private String agreementType;
+
+    @Schema(description = "id")
+    @ExcelIgnore
+    private String id;
+
+    @Schema(description = "查询类型")
+    @ExcelProperty(value = "查询类型", index = 14)
+    private String queryType;
+
+    @Schema(description = "车牌号")
+    @ExcelProperty(value = "车牌号", index = 0)
+    private String licenseNo;
+
+    @Schema(description = "险种信息")
+    @ExcelProperty(value = "险种信息", index = 15)
+    private String productId;
+
+    @Schema(description = "保险公司")
+    @ExcelIgnore
+    private String companyId;
+
+    @Schema(description = "签单时间开始时间")
+    @ExcelProperty(value = "签单时间开始时间", index = 11)
+    private String signingTimeStart;
+
+    @Schema(description = "签单时间结束时间")
+    @ExcelProperty(value = "签单时间结束时间", index = 12)
+    private String signingTimeEnd;
+
+    @Schema(description = "订单号")
+    @ExcelProperty(value = "订单号", index = 16)
+    private String orderNo;
+
+    @Schema(description = "协议id")
+    @ExcelIgnore
+    private String agreementId;
+
+    @Schema(description = "出单机构")
+    @ExcelIgnore
+    private String deptId;
+
+    @Schema(description = "险种")
+    @ExcelProperty(value = "险种", index = 17)
+    private String riskCode;
+
+    @Schema(description = "订单类型")
+    @ExcelProperty(value = "订单类型", index = 18)
+    private String orderType;
+
+    @Schema(description = "被保人")
+    @ExcelProperty(value = "被保人", index = 19)
+    private String insuredName;
+
+    @Schema(description = "交强险保单号")
+    @ExcelProperty(value = "交强险保单号", index = 1)
+    private String jqPolicyNo;
+
+    @Schema(description = "交强险手续费比例")
+    @ExcelProperty(value = "交强险手续费比例(%)", index = 2)
+    private String jqSuperviseCostsProportion;
+
+    @Schema(description = "交强险跟单费比例")
+    @ExcelProperty(value = "交强险跟单费比例(%)", index = 3)
+    private String jqOtherCostsProportion;
+
+    @Schema(description = "商业险保单号")
+    @ExcelProperty(value = "商业险保单号", index = 4)
+    private String syPolicyNo;
+
+    @Schema(description = "商业险手续费比例")
+    @ExcelProperty(value = "商业险手续费比例(%)", index = 5)
+    private String sySuperviseCostsProportion;
+
+    @Schema(description = "商业险跟单费比例")
+    @ExcelProperty(value = "商业险跟单费比例(%)", index = 6)
+    private String syOtherCostsProportion;
+
+    @Schema(description = "驾意险保单号")
+    @ExcelProperty(value = "驾意险保单号", index = 7)
+    private String jyPolicyNo;
+
+    @Schema(description = "驾意险手续费比例")
+    @ExcelProperty(value = "驾意险手续费比例(%)", index = 8)
+    private String jySuperviseCostsProportion;
+
+    @Schema(description = "驾意险跟单费比例")
+    @ExcelProperty(value = "驾意险跟单费比例(%)", index = 9)
+    private String jyOtherCostsProportion;
+
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人", index = 10)
+    private String dockingPerson;
+
+    @Schema(description = "交强起保时间")
+    @ExcelProperty(value = "交强起保时间", index = 20)
+    private String jqStartDate;
+
+    @Schema(description = "交强到期时间")
+    @ExcelProperty(value = "交强到期时间", index = 21)
+    private String jqEndDate;
+
+    @Schema(description = "商业起保时间")
+    @ExcelProperty(value = "商业起保时间", index = 22)
+    private String syStartDate;
+
+    @Schema(description = "商业到期时间")
+    @ExcelProperty(value = "商业到期时间", index = 23)
+    private String syEndDate;
+
+    @Schema(description = "产品名称")
+    @ExcelProperty(value = "产品名称", index = 24)
+    private String productName;
+
+    @Schema(description = "错误信息")
+    private String errorMessage;
+
+    public ImportResultVo checkEmpty(){
+        ImportResultVo resultVo = new ImportResultVo();
+        resultVo.setSuccess(false);
+        if(Objects.isNull(this.licenseNo) || Objects.equals(this.licenseNo,"")){
+            resultVo.setMessage("车牌号不能为空");
+        }
+        if(Objects.isNull(this.jqPolicyNo) || Objects.equals(this.jqPolicyNo,"")){
+            resultVo.setMessage("交强险保单号不能为空");
+        }
+        if(Objects.isNull(this.jqSuperviseCostsProportion) || Objects.equals(this.jqSuperviseCostsProportion,"")){
+            resultVo.setMessage("交强险手续费比例不能为空");
+        }
+        if(Objects.isNull(this.jqOtherCostsProportion) || Objects.equals(this.jqOtherCostsProportion,"")){
+            resultVo.setMessage("交强险跟单费比例不能为空");
+        }
+        if(Objects.isNull(this.syPolicyNo) || Objects.equals(this.syPolicyNo,"")){
+            resultVo.setMessage("商业险保单号不能为空");
+        }
+        if(Objects.isNull(this.sySuperviseCostsProportion) || Objects.equals(this.sySuperviseCostsProportion,"")){
+            resultVo.setMessage("商业险手续费比例不能为空");
+        }
+        if(Objects.isNull(this.syOtherCostsProportion) || Objects.equals(this.syOtherCostsProportion,"")){
+            resultVo.setMessage("商业险跟单费比例不能为空");
+        }
+        if(Objects.isNull(this.jyPolicyNo) || Objects.equals(this.jyPolicyNo,"")){
+            resultVo.setMessage("驾意险保单号不能为空");
+        }
+        if(Objects.isNull(this.jySuperviseCostsProportion) || Objects.equals(this.jySuperviseCostsProportion,"")){
+            resultVo.setMessage("驾意险手续费比例不能为空");
+        }
+        if(Objects.isNull(this.jyOtherCostsProportion) || Objects.equals(this.jyOtherCostsProportion,"")){
+            resultVo.setMessage("驾意险跟单费比例不能为空");
+        }
+        if(Objects.isNull(this.dockingPerson) || Objects.equals(this.dockingPerson,"")){
+            resultVo.setMessage("对接人不能为空");
+        }
+        if(Objects.isNull(resultVo.getMessage())){
+            resultVo.setSuccess(true);
+        }
+        return resultVo;
+    }
+
+}

+ 20 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java

@@ -201,6 +201,26 @@ public class ReceivableController {
         return HttpResult.ok(receivableService.getPlatFormReceivableList(receivableQueryVo));
     }
 
+    @PostMapping("/exportTemplatePlatFormReceivable")
+    @Operation(summary = "导出平台协议模板")
+    public HttpResult exportTemplatePlatFormReceivable() throws IOException {
+        return HttpResult.ok(receivableService.exportTemplatePlatFormReceivable());
+    }
+
+    @PostMapping("/exportPlatFormReceivable")
+    @Operation(summary = "导出平台协议数据")
+    public HttpResult exportPlatFormReceivable(@RequestBody ReceivableQueryVo receivableQueryVo) throws IOException {
+        return HttpResult.ok(receivableService.exportPlatFormReceivable(receivableQueryVo));
+    }
+
+
+    @PostMapping("/importPlatFormReceivable")
+    @Operation(summary = "导入平台协议")
+    public HttpResult importPlatFormReceivable(@RequestParam("file") MultipartFile file){
+        ImportExcelResultVo importExcelResultVo = receivableService.importPlatFormReceivable(file);
+        return HttpResult.ok(importExcelResultVo);
+    }
+
     @PostMapping("/invoiceRecord")
     @Operation(summary = "获取开票记录")
     public HttpResult getInvoiceRecord(@RequestBody InvoiceRecordQueryVo invoiceRecordQueryVo){

+ 26 - 0
tenant/organization/src/main/java/com/jzg/organization/excel/listener/ReceivbleExcelListener.java

@@ -0,0 +1,26 @@
+package com.jzg.organization.excel.listener;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.jzg.commons.entity.finance.vo.ReceivableExportExcelVo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ReceivbleExcelListener extends AnalysisEventListener<ReceivableExportExcelVo> {
+    private final List<ReceivableExportExcelVo> dataList = new ArrayList<>();
+
+    @Override
+    public void invoke(ReceivableExportExcelVo data, AnalysisContext context) {
+        dataList.add(data);
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        System.out.println("Total rows: " + dataList.size());
+    }
+
+    public List<ReceivableExportExcelVo> getDataList() {
+        return dataList;
+    }
+}

+ 25 - 3
tenant/organization/src/main/java/com/jzg/organization/service/ReceivableService.java

@@ -7,10 +7,7 @@ import com.jzg.commons.entity.finance.po.InsPlyIncome;
 import com.jzg.commons.entity.finance.po.InsPlyIncomeInvoiceSettlement;
 import com.jzg.commons.entity.finance.vo.*;
 import com.jzg.commons.entity.orders.po.InsOrderAdjust;
-import com.jzg.commons.entity.orders.po.InsOrders;
-import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
 import com.jzg.commons.entity.po.EsmInsCompany;
-import com.jzg.commons.entity.scheme.po.PtlScheme;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
@@ -123,6 +120,14 @@ public interface ReceivableService extends IService<InsPlyIncome> {
      */
     List<JyExcelVo> importJyExcel(MultipartFile file);
 
+    /**
+     * 导入平台应收excel
+     *
+     * @param file
+     * @return
+     */
+    List<ReceivableExportExcelVo> importReceivableExcel(MultipartFile file);
+
     /**
      * 导入手续费excel  并处理数据
      * @param file
@@ -144,6 +149,13 @@ public interface ReceivableService extends IService<InsPlyIncome> {
      */
     ImportExcelResultVo importJyData(MultipartFile file);
 
+    /**
+     * 导入平台协议Excel  并处理数据
+     * @param file
+     * @return
+     */
+    ImportExcelResultVo importPlatFormReceivable(MultipartFile file);
+
     /**
      * 批量修改
      * @param batchModifyVo
@@ -194,6 +206,16 @@ public interface ReceivableService extends IService<InsPlyIncome> {
      */
     void exportSuperviseSettlementExcel(Page page,SettlementQueryVo settlementQueryVo) throws IOException;
 
+    /**
+     * 导出平台协议Excel模板
+     */
+    String exportTemplatePlatFormReceivable() throws IOException;
+
+    /**
+     * 导出平台协议Excel
+     */
+    String exportPlatFormReceivable(ReceivableQueryVo receivableQueryVo) throws IOException;
+
     /**
      * 应收手续费结算明细
      */

+ 84 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/ExportBaseServiceImpl.java

@@ -0,0 +1,84 @@
+package com.jzg.organization.service.impl;
+
+import com.jzg.commons.entity.report.vo.ReportSearchCommonVo;
+import com.jzg.commons.util.MinioUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ *  @version 
+ *  @author: hxl
+ *  @Date: 2025/9/22 16:43
+ *  @Description:  基础的实现类处理导出excel逻辑
+ */
+@Slf4j
+@Service
+public class ExportBaseServiceImpl {
+
+    @Value("${minio.url:}")
+    private String minioUrl;
+
+    // 从配置文件获取存储桶名称
+    @Value("${minio.bucket-name:excel-files}")
+    private String bucketName;
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/9/24 10:28
+     *  @Description:  通用上传文件
+     */
+    public <T> String upLoadFile(Class<T> clazz, List<T> list, String upLoadName) {
+        //打印导入数据的时间
+        long startTime = System.currentTimeMillis();
+        long endTime = System.currentTimeMillis();
+        try{
+            String fileName = MinioUtils.exportAndUploadToMinIO(upLoadName, clazz, list,bucketName,minioUrl);
+            endTime = System.currentTimeMillis();
+            long duration = endTime - startTime;
+            double minutes = (double) duration / (1000 * 60);
+            log.info("方法执行时间: " + minutes + " 分钟");
+            log.debug("方法执行时间: " + minutes + " 分钟");
+            return fileName;
+        }catch (Exception e){
+            endTime = System.currentTimeMillis();
+            long duration = endTime - startTime;
+            double minutes = (double) duration / (1000 * 60);
+            log.info("方法执行时间: " + minutes + " 分钟");
+            log.debug("方法执行时间: " + minutes + " 分钟");
+        }
+        return "";
+    }
+
+
+    /**
+     * 动态字段导出(新增,不影响原有)
+     */
+    public <T> String upLoadFileDynamic(
+            Class<T> clazz,
+            List<T> list,
+            Set<String> includeFields,
+            String upLoadName
+    ) {
+        long startTime = System.currentTimeMillis();
+        try {
+            // 调用动态导出
+            String fileName = MinioUtils.exportAndUploadToMinIO(
+                    upLoadName, clazz, list, includeFields, bucketName, minioUrl
+            );
+            long duration = System.currentTimeMillis() - startTime;
+            double minutes = (double) duration / (1000 * 60);
+            log.info("方法执行时间: " + minutes + " 分钟");
+            return fileName;
+        } catch (Exception e) {
+            e.printStackTrace();
+            long duration = System.currentTimeMillis() - startTime;
+            double minutes = (double) duration / (1000 * 60);
+            log.info("方法执行时间: " + minutes + " 分钟");
+        }
+        return "";
+    }
+}

+ 134 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -1,6 +1,8 @@
 package com.jzg.organization.service.impl;
 
+import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.date.DateTime;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -26,6 +28,7 @@ import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.excel.listener.JyExcelListener;
 import com.jzg.organization.excel.listener.OtherExcelListener;
+import com.jzg.organization.excel.listener.ReceivbleExcelListener;
 import com.jzg.organization.excel.listener.SuperviseExcelListener;
 import com.jzg.organization.mapper.*;
 import com.jzg.organization.service.ReceivableService;
@@ -47,6 +50,7 @@ import java.math.BigInteger;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
@@ -90,6 +94,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
     @Autowired
     private SysUploadFilesMapper sysUploadFilesMapper;
 
+    @Autowired
+    private ExportBaseServiceImpl exportBaseService;
+
     @Value("${upload.file.path}")
     private String uploadPath;
 
@@ -404,6 +411,21 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         }
     }
 
+    @Override
+    public List<ReceivableExportExcelVo> importReceivableExcel(MultipartFile file) {
+        ReceivbleExcelListener listener = new ReceivbleExcelListener();
+        try (InputStream inputStream = file.getInputStream()) {
+            EasyExcel.read(inputStream, ReceivableExportExcelVo.class, listener)
+                    .sheet()
+                    .doRead();
+            List<ReceivableExportExcelVo> dataList = listener.getDataList();
+            return dataList;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
     @Override
     public List<JyExcelVo> importJyExcel(MultipartFile file) {
         JyExcelListener listener = new JyExcelListener();
@@ -607,6 +629,84 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         return importExcelResultVo;
     }
 
+    @Override
+    public ImportExcelResultVo importPlatFormReceivable(MultipartFile file) {
+        ImportExcelResultVo importExcelResultVo = new ImportExcelResultVo();
+
+        List<ReceivableExportExcelVo> receivableExportExcelVos = importReceivableExcel(file);
+        AssertionUtils.isEmpty(receivableExportExcelVos, "数据处理失败,导入失败");
+
+        // 获取保司名称
+        HttpResult<List<EsmInsCompany>> listHttpResult = esmInsCompanyClient.liveCompanyList();
+        AssertionUtils.isFail(listHttpResult.getCode() != 200, listHttpResult.getMsg());
+
+        int failedNumber = 0;
+        List<Object> failedExcel = new ArrayList<>();
+        List<InsPlyIncome> successExcel = new ArrayList<>();
+        // 处理数据
+        for (ReceivableExportExcelVo vo : receivableExportExcelVos) {
+            // 出现空数据则失败
+            ImportResultVo resultVo = vo.checkEmpty();
+            if (!resultVo.isSuccess()) {
+                failedNumber++;
+                vo.setErrorMessage(resultVo.getMessage());
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 检测是否有重复的保单号
+            InsPlyIncome checkInsPlyIncome = baseMapper.selectOne(new LambdaQueryWrapper<InsPlyIncome>()
+                    .eq(InsPlyIncome::getJqPolicyNo, vo.getJqPolicyNo()));
+            if (!Objects.isNull(checkInsPlyIncome)) {
+                failedNumber++;
+                vo.setErrorMessage("车险保单号重复");
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 判断应收数据是否已开票 / 已结算
+            InsPlyIncome checkInsPlyIncomeByOrderNo = baseMapper.selectOne(new LambdaQueryWrapper<InsPlyIncome>()
+                    .eq(InsPlyIncome::getOrderNo, vo.getOrderNo()));
+            if (ObjectUtil.isNotNull(checkInsPlyIncomeByOrderNo)){
+                if ("1".equals(checkInsPlyIncomeByOrderNo.getSuperviseSettlement()) || "1".equals(checkInsPlyIncomeByOrderNo.getOtherSettlement())
+                        || "1".equals(checkInsPlyIncomeByOrderNo.getJySuperviseSettlement()) || "1".equals(checkInsPlyIncomeByOrderNo.getJyOtherSettlement())){
+                    failedNumber++;
+                    vo.setErrorMessage("应收数据已结算");
+                    failedExcel.add(vo);
+                    continue;
+                }
+            }
+
+            // 判断应收数据是否已锁定,暂无逻辑
+
+
+            // 处理数据
+            InsPlyIncome insPlyIncome = new InsPlyIncome();
+            insPlyIncome.setId(IdGenerate.nextId());
+            insPlyIncome.setLicenseNo(vo.getLicenseNo());
+            insPlyIncome.setJqPolicyNo(vo.getJqPolicyNo());
+            insPlyIncome.setJqSuperviseCostsProportion(vo.getJqSuperviseCostsProportion());
+            insPlyIncome.setJqOtherCostsProportion(vo.getJqOtherCostsProportion());
+            insPlyIncome.setSyPolicyNo(vo.getSyPolicyNo());
+            insPlyIncome.setSySuperviseCostsProportion(vo.getSySuperviseCostsProportion());
+            insPlyIncome.setSyOtherCostsProportion(vo.getSyOtherCostsProportion());
+            insPlyIncome.setJyPolicyNo(vo.getJyPolicyNo());
+            insPlyIncome.setJySuperviseCostsProportion(vo.getJySuperviseCostsProportion());
+            insPlyIncome.setJyOtherCostsProportion(vo.getJyOtherCostsProportion());
+            insPlyIncome.setContactPerson(vo.getDockingPerson());
+            successExcel.add(insPlyIncome);
+        }
+
+        importExcelResultVo.setFailedData(failedExcel);
+        importExcelResultVo.setSuccessNumber(successExcel.size());
+        importExcelResultVo.setFailedNumber(failedNumber);
+
+        // 批量插入数据
+        baseMapper.insert(successExcel);
+
+        return importExcelResultVo;
+    }
+
     @Override
     public ImportExcelResultVo importJyData(MultipartFile file) {
         ImportExcelResultVo importExcelResultVo = new ImportExcelResultVo();
@@ -905,6 +1005,40 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         EasyExcelUtils.exportForWeb(ServletUtils.getResponse(), ExportSuperviseSettlementExcelDto.class, list, "车险手续费结算明细");
     }
 
+    /**
+     * 导出平台协议Excel
+     *
+     * @return
+     */
+    @Override
+    public String exportTemplatePlatFormReceivable() {
+        List<ReceivableExportExcelDto> emptyList = ListUtil.empty();
+
+        // 调用动态导出
+        return exportBaseService.upLoadFile(
+                ReceivableExportExcelDto.class,
+                emptyList,
+                "平台协议应收-批量导入-导出模板-" + Instant.now()
+        );
+    }
+
+    /**
+     * 导出平台协议Excel
+     *
+     * @return
+     */
+    @Override
+    public String exportPlatFormReceivable(ReceivableQueryVo receivableQueryVo) {
+        List<InsPlyIncome> receivableList = baseMapper.getReceivableList(receivableQueryVo);
+
+        // 调用动态导出
+        return exportBaseService.upLoadFile(
+                InsPlyIncome.class,
+                receivableList,
+                "平台协议应收-批量导入-导出-" + Instant.now()
+        );
+    }
+
     @Override
     public Page<ExportSuperviseSettlementDetailExcelDto> superviseSettlementDetailExcel(Page page, SettlementQueryVo settlementQueryVo) {
         Page<ExportSuperviseSettlementDetailExcelDto> exportSuperviseSettlementDetailExcelDtos = baseMapper.getSuperviseSettlementDetailExcelDtos(page, settlementQueryVo);

+ 9 - 1
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -248,7 +248,9 @@
         WHERE
             1=1
         AND NOT EXISTS ( SELECT 1 FROM ins_ply_income_invoice_link ipil WHERE ipil.income_id = ipi.id )
-        AND ipi.agreement_type = #{receivableQueryVo.agreementType}
+        <if test = "receivableQueryVo.agreementType != null and receivableQueryVo.agreementType == 1">
+            AND ipi.agreement_type = #{receivableQueryVo.agreementType}
+        </if>
         <if test = "receivableQueryVo.ids != null and receivableQueryVo.ids.size > 0">
             AND ipi.id in
             <foreach collection="receivableQueryVo.ids" item="id" open="(" separator="," close=")">
@@ -365,6 +367,12 @@
         <if test="receivableQueryVo.orderNo != null and receivableQueryVo.orderNo != ''">
             AND ipi.order_no = #{receivableQueryVo.orderNo}
         </if>
+        <if test="receivableQueryVo.ids != null and receivableQueryVo.ids != ''">
+            AND ipi.id IN
+            <foreach collection="receivableQueryVo.ids" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
         <if test="receivableQueryVo.orderNos != null and receivableQueryVo.orderNos != ''">
             AND ipi.order_no IN
             <foreach collection="receivableQueryVo.orderNos" item="orderNo" open="(" separator="," close=")">