lipf il y a 3 semaines
Parent
commit
f97de639cb

+ 32 - 162
commons/src/main/java/com/jzg/commons/entity/finance/vo/importimcome/ImportContentExt.java

@@ -1,13 +1,12 @@
 package com.jzg.commons.entity.finance.vo.importimcome;
 
-import cn.hutool.core.collection.CollUtil;
+
 import cn.hutool.core.util.StrUtil;
+import com.jzg.commons.entity.finance.po.InsPlyIncome;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
 import java.io.Serial;
-import java.io.Serializable;
-import java.util.Objects;
 
 /**
  * Excel 表格字段填充后的完整数据信息
@@ -15,184 +14,55 @@ import java.util.Objects;
  * @date 2026/8/4 9:14
  */
 @Data
-public class ImportContentExt implements Serializable {
+public class ImportContentExt extends ExcelContent4Platform {
     @Serial
     private static final long serialVersionUID = 8609830028190910294L;
 
-    @Schema(description = "车牌号")
-    private String licenseNo;
-
-    @Schema(description = "交强险保单号")
-    private String jqPolicyNo;
-
-    @Schema(description = "商业险保单号")
-    private String syPolicyNo;
-
-    @Schema(description = "非车险保单号")
-    private String jyPolicyNo;
-
-    @Schema(description = "交强险手续费比例")
-    private String jqSuperviseCostsProportion;
-
-    @Schema(description = "交强险跟单费比例")
-    private String jqOtherCostsProportion;
-
-    @Schema(description = "商业险手续费比例")
-    private String sySuperviseCostsProportion;
-
-    @Schema(description = "商业险跟单费比例")
-    private String syOtherCostsProportion;
-
-
-    @Schema(description = "非车险手续费比例")
-    private String jySuperviseCostsProportion;
-
-    @Schema(description = "非车险跟单费比例")
-    private String jyOtherCostsProportion;
-
-
-    @Schema(description = "交强险入口比例")
-    private String jqInletRatio;
-
-    @Schema(description = "商业险入口比例")
-    private String syInletRatio;
-
-    @Schema(description = "非车险入口比例")
-    private String jyInletRatio;
-
-    @Schema(description = "选中类型")
-    // 1 全部数据选中  2 选中部分数据
-    private String selectedType;
-
     @Schema(description = "订单号")
     private String orderNo;
 
-    @Schema(description = "id")
-    private String id;
-
-    @Schema(description = "签单时间")
-    private String signingTime;
-
-    @Schema(description = "协议类型")
-    private String agreementType;
-
-    @Schema(description = "险种名称")
-    private String productName;
-
-    @Schema(description = "被保险人姓名")
-    private String insuredPerson;
+    @Schema(description = "保险机构")
+    private String parternerCompanyId;
 
-    @Schema(description = "公司名称")
-    private String companyName;
+    @Schema(description = "应收订单的ID")
+    private String incomeId;
 
     @Schema(description = "对接人")
     private String contactPerson;
 
-    @Schema(description = "对接人手机号")
-    private String contactPersonPhone;
-
-    @Schema(description = "错误信息")
-    private String errorMessage;
-
-    @Schema(description = "协议Id")
-    private String agreementId;
-
-    @Schema(description = "协议名称")
-    private String agreementName;
-
-    @Schema(description = "租户代码")
-    private String systemCode;
-
-    @Schema(description = "保险机构")
-    private String partnerCompanyId;
-
-    @Schema(description = "交强保费")
-    private String jqPremium;
-
-    @Schema(description = "商业保费")
-    private String syPremium;
+    @Schema(description = "应收订单")
+    private InsPlyIncome insPlyIncome;
 
-    @Schema(description = "驾意保费")
-    private String jyPremium;
+    //  20 表示平台协议  11表示车险手续费 12 表示非车险手续费
+    @Schema(description = "类型")
+    private String type;
 
     public ImportResultVo checkEmpty(){
-        ImportResultVo resultVo = new ImportResultVo();
-        resultVo.setSuccess(false);
-        // 基础必填字段校验
-        if (StrUtil.isBlank(this.getSigningTime())) {
-            resultVo.getMessage().add("签单时间不能为空");
-        }
-        if (StrUtil.isBlank(this.getOrderNo())) {
-            resultVo.getMessage().add("订单号不能为空");
-        }
-        if (StrUtil.isBlank(this.getLicenseNo())) {
-            resultVo.getMessage().add("车牌号不能为空");
-        }
-        if (StrUtil.isBlank(this.getProductName())) {
-            resultVo.getMessage().add("险种名称不能为空");
+        ImportResultVo vo = new ImportResultVo();
+        if(StrUtil.isEmpty(this.orderNo)){
+            vo.addMessage(String.format("订单不存在,车牌号是[%s]",this.getLicenseNo()));
+            return vo;
         }
-//        if (StrUtil.isBlank(this.getInsuredPerson())) {
-//            resultVo.getMessage().add("被保险人姓名不能为空");
-//        }
-        if (StrUtil.isBlank(this.getAgreementType())) {
-            resultVo.getMessage().add("协议类型不能为空");
+        if (StrUtil.isEmpty(this.incomeId)) {
+            vo.addMessage(String.format("订单没有进入应收,车牌号是[%s]",this.getLicenseNo()));
+            return vo;
         }
-//        if (StrUtil.isBlank(this.getContactPerson())) {
-//            resultVo.getMessage().add("对接人不能为空");
-//        }
-//        if (StrUtil.isBlank(this.getAgreementType())) {
-//            resultVo.getMessage().add("对接人手机号不能为空");
-//        }
-
-        // 交强险:有保单号 → 手续费、跟单费必填
-//        if (StrUtil.isNotBlank(this.getJqPolicyNo())
-//                || StrUtil.isNotBlank(this.getJqSuperviseCostsProportion())
-//                || StrUtil.isNotBlank(this.getJqOtherCostsProportion())) {
-//            if (StrUtil.isBlank(this.getJqPolicyNo())) {
-//                resultVo.getMessage().add("交强险保单号不能为空");
-//            }
-//            if (StrUtil.isBlank(this.getJqSuperviseCostsProportion())) {
-//                resultVo.getMessage().add("交强险手续费比例不能为空");
-//            }
-//            if (StrUtil.isBlank(this.getJqOtherCostsProportion())) {
-//                resultVo.getMessage().add("交强险跟单费比例不能为空");
-//            }
-//        }
-
-        // 商业险:有保单号 → 手续费、跟单费必填
-//        if (StrUtil.isNotBlank(this.getSyPolicyNo())
-//                || StrUtil.isNotBlank(this.getSySuperviseCostsProportion())
-//                || StrUtil.isNotBlank(this.getSyOtherCostsProportion())) {
-//            if (StrUtil.isBlank(this.getJqPolicyNo())) {
-//                resultVo.getMessage().add("商业险保单号不能为空");
-//            }
-//            if (StrUtil.isBlank(this.getSySuperviseCostsProportion())) {
-//                resultVo.getMessage().add("商业险手续费比例不能为空");
-//            }
-//            if (StrUtil.isBlank(this.getSyOtherCostsProportion())) {
-//                resultVo.getMessage().add("商业险跟单费比例不能为空");
-//            }
-//        }
-
-        // 非车险:有保单号 → 手续费、跟单费必填
-        if (StrUtil.isNotBlank(this.getJyPolicyNo())
-                || StrUtil.isNotBlank(this.getJySuperviseCostsProportion())
-                || StrUtil.isNotBlank(this.getJyOtherCostsProportion())) {
-            if (StrUtil.isBlank(this.getJqPolicyNo())) {
-                resultVo.getMessage().add("非车险保单号不能为空");
-            }
-            if (StrUtil.isBlank(this.getJySuperviseCostsProportion())) {
-                resultVo.getMessage().add("非车险手续费比例不能为空");
-            }
-            if (StrUtil.isBlank(this.getJyOtherCostsProportion())) {
-                resultVo.getMessage().add("非车险跟单费比例不能为空");
-            }
+        if(this.insPlyIncome == null){
+            vo.addMessage(String.format("根据订单号没有匹配到应收数据. 车牌号是[%s],订单号是[%s]",this.getLicenseNo(),this.getOrderNo()));
+            return vo;
         }
 
-        if(CollUtil.isEmpty(resultVo.getMessage())){
-            resultVo.setSuccess(true);
+        // TODO 校验手续费比例等信息表格里面的和数据库 ins_ply_income 里面是否一致
+        if("11".equals(this.type)){
+
+        }else if("20".equals(this.type)){
+
+        }else if ("12".equals(this.type)) {
+
+        }else{
+
         }
-        return resultVo;
+        return vo;
     }
 
 }

+ 1 - 1
commons/src/main/java/com/jzg/commons/util/SchemaDescriptionParser.java

@@ -113,6 +113,6 @@ public class SchemaDescriptionParser {
     // --- 测试主函数 ---
     public static void main(String[] args) {
         Map<String, String> result = SchemaDescriptionParser.getSchemaMap();
-        //result.forEach((k, v) -> System.out.println(k + " = " + v));
+        result.forEach((k, v) -> System.out.println(k + " = " + v));
     }
 }

+ 1 - 28
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -2561,7 +2561,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             } else {
                 existPolicyNoSet.add(policyNo);
             }
-            existCompanyIdSet.add(vo.getCompanyName());
+            existCompanyIdSet.add(vo.getParternerCompanyId());
         }
 
         // 导入只能一个保司
@@ -2570,27 +2570,6 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             throw new SystemException("导入数据不能包含多个保险公司");
         }
 
-        // 处理数据
-        for (ImportContentExt vo : datas) {
-            // 1. 空数据校验
-            ImportResultVo resultVo = vo.checkEmpty();
-            if (!resultVo.isSuccess()) {
-                vo.setErrorMessage(resultVo.convert2Str());
-                failedExcel.add(vo);
-                continue;
-            }
-
-            // 2. Excel内部保单号重复
-            if (repeatPolicyNoSet.contains(vo.getJqPolicyNo())) {
-                vo.setErrorMessage("保单号重复");
-                failedExcel.add(vo);
-                continue;
-            }
-            ImportContentExt errVO = importIncomeService.spliceData(vo, insertExcel, updateExcel);
-            if(errVO != null){
-                failedExcel.add(errVO);
-            }
-        }
 
         // 执行批量更新
         ImportUpdateExcelResultVo importExcelResultVo = importIncomeService.getDataManipulationResult(updateExcel, insertExcel,failedExcel);
@@ -2609,21 +2588,15 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
      */
     private List<ImportContentExt> parseAndFillContent(MultipartFile file, String type) {
         log.info("解析Excel内容并填充缺失的字段. type=[{}]", type);
-
         if("11".equals(type)){
             List<ExcelContent4PrivateSuperviseCar> excelContents2 = importIncomeService.parseImportExcel4PrivateCar(file);
             return importIncomeService.fillExcelContent4All(excelContents2);
         } if("12".equals(type)){
             List<ExcelContent4PrivateSuperviseNoCar> excelContents3 = importIncomeService.parseImportExcel4PrivateNoCar(file);
             return importIncomeService.fillExcelContent4All(excelContents3);
-//        } if("20".equals(type)){
-//            List<ExcelContent4Platform> excelContents = importIncomeService.parseImportExcel4Platform(file);
-//            return importIncomeService.fillExcelContent4All(excelContents);
         }else{
             List<ExcelContent4Platform> excelContents = importIncomeService.parseImportExcel4Platform(file);
             return importIncomeService.fillExcelContent4All(excelContents);
-//            log.info("解析Excel内容并填充缺失的字段.类型不支持 type=[{}]", type);
-//            return Collections.emptyList();
         }
     }
 

+ 24 - 119
tenant/organization/src/main/java/com/jzg/organization/service/impl/importincome/ImportIncomeServiceImpl.java

@@ -5,21 +5,12 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.jzg.commons.constants.ProductsType;
-import com.jzg.commons.core.base.BaseController;
-import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.finance.po.InsPlyIncome;
 import com.jzg.commons.entity.finance.vo.importimcome.*;
 import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
-import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
-import com.jzg.commons.entity.vo.AgreementVo;
-import com.jzg.commons.entity.vo.InsFeeOrdersVo;
-import com.jzg.commons.util.idgen.IdGenerate;
-import com.jzg.organization.client.InsOrdersClient;
 import com.jzg.organization.excel.listener.InvoiceReceivbleExcel4AllListener;
 import com.jzg.organization.mapper.InsOrdersPolicyMapper;
 import com.jzg.organization.mapper.InsPlyIncomeMapper;
-import com.jzg.organization.mapper.PtlAgreementMapper;
 import com.jzg.organization.service.impl.ExportBaseServiceImpl;
 import com.jzg.organization.service.importincome.ImportIncomeService;
 import org.slf4j.Logger;
@@ -30,8 +21,6 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.InputStream;
 import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -45,13 +34,9 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
     @Autowired
     private ExportBaseServiceImpl exportBaseService;
     @Autowired
-    private BaseController baseController;
-    @Autowired
-    private InsOrdersClient insOrdersClient;
-    @Autowired
     private InsOrdersPolicyMapper insOrdersPolicyMapper;
     @Autowired
-    private PtlAgreementMapper ptlAgreementMapper;
+    private InsPlyIncomeMapper insPlyIncomeMapper;
 
     private static final Logger log = LoggerFactory.getLogger(ImportIncomeServiceImpl.class);
 
@@ -107,89 +92,6 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
         return importExcelResultVo;
     }
 
-    /**
-     * 对表格中的内容进行扩展
-     *
-     * @param excelContents
-     * @author lipf
-     * @date 2026/8/4 9:22
-     */
-    @Override
-    public List<ImportContentExt> fillExcelContent4Private(List<ExcelContent4PrivateSuperviseNoCar> excelContents) {
-        log.info("为私有订单填充数据:excelContents.size=[{}]", CollUtil.size(excelContents));
-        return List.of();
-    }
-
-    /**
-     * 批量处理数据
-     * @param updateExcel 要修改的数据
-     * @param insertExcel 要新增的数据
-     */
-    @Override
-    public ImportContentExt spliceData(ImportContentExt vo,
-                                        List<InsPlyIncome> insertExcel,
-                                        List<InsPlyIncome> updateExcel) {
-
-        // 查询数据库中是否已存在该保单号
-        InsPlyIncome existIncome = baseMapper.selectOne(new LambdaQueryWrapper<InsPlyIncome>()
-                .eq(InsPlyIncome::getJqPolicyNo, vo.getJqPolicyNo()));
-
-        // 封装修改数据
-        InsPlyIncome insPlyIncome = new InsPlyIncome();
-        BeanUtil.copyProperties(vo,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());
-        // 签单时间
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        insPlyIncome.setSigningTime(LocalDateTime.parse(vo.getSigningTime(), formatter));
-//        // 协议编号
-//        insPlyIncome.setAgreementId(ptlAgreement.getId());
-//        insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
-//        insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
-//        insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
-        // 险种编号
-        insPlyIncome.setProductId(ProductsType.getCodeByDesc(vo.getProductName()));
-        // 险种名称
-        insPlyIncome.setProductName(vo.getProductName());
-        // 被保险人姓名
-        insPlyIncome.setInsuredPerson(vo.getInsuredPerson());
-        // 对接人信息
-        insPlyIncome.setContactPerson(vo.getContactPerson());
-        insPlyIncome.setContactPersonPhone(vo.getContactPersonPhone());
-        // 数据库不存在 → 直接失败
-        if (Objects.isNull(existIncome)) {
-            // 加入修改列表
-            // 机构id
-            insPlyIncome.setDeptId(baseController.getUserDeptId());
-            insPlyIncome.setOrderNo(vo.getOrderNo());
-            insertExcel.add(insPlyIncome);
-        }else{
-            // 数据库已存在 → 继续后续校验
-            // 判断已开票 / 已结算
-            String settlementFlag = "1";
-            if (settlementFlag.equals(existIncome.getSuperviseSettlement()) || settlementFlag.equals(existIncome.getOtherSettlement())
-                    || settlementFlag.equals(existIncome.getJySuperviseSettlement()) || settlementFlag.equals(existIncome.getJyOtherSettlement())
-                    || settlementFlag.equals(existIncome.getPlatformSuperviseSettlement()) || settlementFlag.equals(existIncome.getPlatformOtherSettlement())) {
-                vo.setErrorMessage("应收数据已结算");
-                return vo;
-            }
-            insPlyIncome.setId(existIncome.getId());
-            // 加入修改列表
-            updateExcel.add(insPlyIncome);
-        }
-        return null;
-    }
-
-
     /**
      * 对表格中的内容进行扩展
      * <p>
@@ -244,28 +146,31 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
             }
             log.info("处理订单号是[{}]的订单",orderNO);
             ext.setOrderNo(orderNO);
-            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(orderNO);
-            InsOrdersVo data = insOrdersVoHttpResult.getData();
-            if (data!= null){
-                BeanUtil.copyProperties(data,ext);
-                if(data.getSigningTime() != null){
-                    ext.setSigningTime(data.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                }
-                String agreementId = data.getAgreementId();
-                if(StrUtil.isNotEmpty(agreementId)){
-                    AgreementVo agreementVo = ptlAgreementMapper.queryById(agreementId);
-                    if(agreementVo != null){
-                        ext.setPartnerCompanyId(agreementVo.getPartnerCompanyId());
-                    }
-                }
-                InsFeeOrdersVo feeOrdersVo = data.getFeeOrdersVo();
-                if(BeanUtil.isEmpty(feeOrdersVo)){
-                    ext.setJqPremium(feeOrdersVo.getJqPremium());
-                    ext.setSyPremium(feeOrdersVo.getSyPremium());
-                    ext.setJyPremium(feeOrdersVo.getJyPremium());
-                }
 
+            LambdaQueryWrapper<InsPlyIncome> wrapper = new LambdaQueryWrapper();
+            wrapper.eq(InsPlyIncome::getOrderNo,orderNO);
+            List<InsPlyIncome> insPlyIncomes = insPlyIncomeMapper.selectList(wrapper);
+            if(CollUtil.isEmpty(insPlyIncomes)){
+                log.info("订单号为[{}]的数据没有进入应收",orderNO);
+                continue;
             }
+            InsPlyIncome insPlyIncome = insPlyIncomes.get(0);
+
+            ext.setIncomeId(insPlyIncome.getId());
+            ext.setContactPerson(insPlyIncome.getContactPerson());
+            ext.setParternerCompanyId(insPlyIncome.getPartnerCompanyId());
+
+
+            // 校验 手续费等比例是否一致
+            String jqSuperviseCostsProportion = insPlyIncome.getJqSuperviseCostsProportion();
+            String sySuperviseCostsProportion = insPlyIncome.getSySuperviseCostsProportion();
+            String jySuperviseCostsProportion = insPlyIncome.getJySuperviseCostsProportion();
+            String jqOtherCostsProportion = insPlyIncome.getJqOtherCostsProportion();
+            String syOtherCostsProportion = insPlyIncome.getSyOtherCostsProportion();
+            String jyOtherCostsProportion = insPlyIncome.getJyOtherCostsProportion();
+
+
+
             res.add(ext);
         }
         return res;

+ 0 - 17
tenant/organization/src/main/java/com/jzg/organization/service/importincome/ImportIncomeService.java

@@ -24,23 +24,6 @@ public interface ImportIncomeService {
      */
     <T extends InsuranceData> List<ImportContentExt> fillExcelContent4All(List<T> excelContents);
 
-    /**
-     * 对表格中的内容进行扩展
-     *
-     * @author lipf
-     * @date 2026/8/4 9:22
-     */
-    public List<ImportContentExt> fillExcelContent4Private(List<ExcelContent4PrivateSuperviseNoCar> excelContents);
-
-    /**
-     * 批量处理数据
-     * @param updateExcel
-     * @param insertExcel
-     */
-    public ImportContentExt spliceData(ImportContentExt vo,
-                                       List<InsPlyIncome> insertExcel,
-                                       List<InsPlyIncome> updateExcel);
-
     /**
      * <p>
      * 1. 获取保司名称