lipf пре 2 недеља
родитељ
комит
0f19ddd820
15 измењених фајлова са 468 додато и 53 уклоњено
  1. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java
  2. 168 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/ExportPlatFormReceivableVO.java
  3. 4 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/importimcome/ImportContentExt.java
  4. 3 2
      commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementUndwrtRulesAttrLink.java
  5. 7 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/aggregated/QuoteEchoVo.java
  6. 3 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/orders/InsOrdersVo.java
  7. 17 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java
  8. 26 23
      tenant/organization/src/main/java/com/jzg/organization/component/BuildDescUtils.java
  9. 1 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java
  10. 25 18
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementUndwrtRulesServiceImpl.java
  11. 106 9
      tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java
  12. 3 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/importincome/ImportIncomeServiceImpl.java
  13. 93 0
      tenant/organization/src/main/java/com/jzg/organization/utils/IncomeInvoiceLinkUtil.java
  14. 7 0
      tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml
  15. 2 0
      tenant/organization/src/main/resources/mapper/SysUserMapper.xml

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java

@@ -41,6 +41,9 @@ public class PtlAgreementCostParam extends PageRequest {
     @Schema(description = "费用规则")
     private List<String> costRulesList;
 
+    @Schema(description = "费用描述")
+    private String[] costDescribes;
+
     @Schema(description = "费用状态")
     private String agreementStatus;
 

+ 168 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/ExportPlatFormReceivableVO.java

@@ -0,0 +1,168 @@
+package com.jzg.commons.entity.finance.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jzg.commons.core.base.BaseModel;
+import com.jzg.commons.entity.po.InsFeeOrders;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Schema(description = "财务应收表")
+public class ExportPlatFormReceivableVO extends BaseModel {
+
+    @Serial
+    private static final long serialVersionUID = 6161862008963938376L;
+
+    @ExcelIgnore
+    private String id;
+
+    // ==================== 以下为按表头顺序导出的字段 ====================
+
+    @Schema(description = "子订单号")
+    @ExcelProperty(value = "子订单号", index = 0)
+    private String orderNo;
+
+    @Schema(description = "协议号")
+    @ExcelProperty(value = "协议号", index = 1)
+    private String agreementId;
+
+    @Schema(description = "签单日期 yyyy-mm-dd 格式")
+    @TableField(exist = false)
+    @ExcelProperty(value = "签单日期", index = 2)
+    private String signDate;
+
+    @Schema(description = "车牌号")
+    @ExcelProperty(value = "车牌号", index = 3)
+    private String licenseNo;
+
+    @Schema(description = "被保险人")
+    @ExcelProperty(value = "被保险人", index = 4)
+    private String insuredPerson;
+
+    @Schema(description = "保险公司名称")
+    @TableField(exist = false)
+    @ExcelProperty(value = "保险公司名称", index = 5)
+    private String companyName;
+
+    @Schema(description = "险种")
+    @ExcelProperty(value = "险种", index = 6)
+    private String productName;
+
+    @Schema(description = "保司机构")
+    @TableField(exist = false)
+    @ExcelProperty(value = "保司机构", index = 7)
+    private String partnerCompanySimplyName;
+
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人", index = 8)
+    private String contactPerson;
+
+    @Schema(description = "交强险保单号")
+    @ExcelProperty(value = "交强险保单号", index = 9)
+    private String jqPolicyNo;
+
+    @Schema(description = "商业保单号")
+    @ExcelProperty(value = "商业保单号", index = 10)
+    private String syPolicyNo;
+
+    @Schema(description = "非车保单号")
+    @ExcelProperty(value = "非车保单号", index = 11)
+    private String jyPolicyNo;
+
+    @Schema(description = "交强险保费")
+    @ExcelProperty(value = "交强险保费", index = 12)
+    private String jqPremium;
+
+    @Schema(description = "车船税")
+    @ExcelProperty(value = "车船税", index = 13)
+    private String taxPremium;
+
+    @Schema(description = "商业险保费")
+    @ExcelProperty(value = "商业险保费", index = 14)
+    private String syPremium;
+
+    @Schema(description = "非车保费")
+    @ExcelProperty(value = "非车保费", index = 15)
+    private String jyPremium;
+
+    @Schema(description = "交强险应收比例")
+    @TableField(exist = false)
+    @ExcelProperty(value = "交强险应收比例", index = 16)
+    private String jqTotalProportion;
+
+    @Schema(description = "交强险手续费比例")
+    @ExcelProperty(value = "交强险手续费比例", index = 17)
+    private String jqSuperviseCostsProportion;
+
+    @Schema(description = "交强险非跟单比例")
+    @ExcelProperty(value = "交强险非跟单比例", index = 18)
+    private String jqOtherCostsProportion;
+
+    @Schema(description = "商业应收比例")
+    @TableField(exist = false)
+    @ExcelProperty(value = "商业应收比例", index = 19)
+    private String syTotalProportion;
+
+    @Schema(description = "商业手续费比例")
+    @ExcelProperty(value = "商业手续费比例", index = 20)
+    private String sySuperviseCostsProportion;
+
+    @Schema(description = "商业非跟单比例")
+    @ExcelProperty(value = "商业非跟单比例", index = 21)
+    private String syOtherCostsProportion;
+
+    @Schema(description = "非车应收比例")
+    @TableField(exist = false)
+    @ExcelProperty(value = "非车应收比例", index = 22)
+    private String jyTotalProportion;
+
+    @Schema(description = "非车手续费比例")
+    @ExcelProperty(value = "非车手续费比例", index = 23)
+    private String jySuperviseCostsProportion;
+
+    @Schema(description = "非车非跟单比例")
+    @ExcelProperty(value = "非车非跟单比例", index = 24)
+    private String jyOtherCostsProportion;
+
+    @Schema(description = "手续费金额")
+    @TableField(exist = false)
+    @ExcelProperty(value = "手续费金额", index = 25)
+    private String superviseCostsPremiums;
+
+    @Schema(description = "非跟单金额")
+    @TableField(exist = false)
+    @ExcelProperty(value = "非跟单金额", index = 26)
+    private String otherCostsPremiums;
+
+    @Schema(description = "创建日期")
+    @TableField(exist = false)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ExcelProperty(value = "创建日期", index = 27)
+    private LocalDateTime createTime;
+
+    @Schema(description = "结算日期")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ExcelProperty(value = "结算日期", index = 28)
+    private LocalDateTime settlementTime;
+
+    @Schema(description = "结算人")
+    @TableField(exist = false)
+    @ExcelProperty(value = "结算人", index = 29)
+    private String settlementPerson;
+
+    @Schema(description = "结算状态")
+    @TableField(exist = false)
+    @ExcelProperty(value = "结算状态", index = 30)
+    private String settlementStatusName;
+
+
+}

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/importimcome/ImportContentExt.java

@@ -3,6 +3,7 @@ package com.jzg.commons.entity.finance.vo.importimcome;
 
 import cn.hutool.core.util.StrUtil;
 import com.jzg.commons.entity.finance.po.InsPlyIncome;
+import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -33,6 +34,9 @@ public class ImportContentExt extends ExcelContent4Platform {
     @Schema(description = "应收订单")
     private InsPlyIncome insPlyIncome;
 
+    @Schema(description = "车险订单信息")
+    private InsOrdersPolicy insOrdersPolicy;
+
     //  20 表示平台协议  11表示车险手续费 12 表示非车险手续费
     @Schema(description = "类型")
     private String type;

+ 3 - 2
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementUndwrtRulesAttrLink.java

@@ -1,7 +1,6 @@
 package com.jzg.commons.entity.po;
 
-import java.io.Serializable;
-import java.util.Date;
+import java.io.Serial;
 
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.TableField;
@@ -17,6 +16,8 @@ import lombok.Data;
 @Data
 public class PtlAgreementUndwrtRulesAttrLink extends BaseModel {
 
+    @Serial
+    private static final long serialVersionUID = -3935263637863405461L;
     /** 主键/自增 */
     @Schema(description = "主键/自增")
     private String id;

+ 7 - 0
commons/src/main/java/com/jzg/commons/entity/quote/vo/aggregated/QuoteEchoVo.java

@@ -78,6 +78,12 @@ public class QuoteEchoVo extends QuoteVo {
         private String agreementId;
         private String agreementName;
         private String agreementType;
+
+        /**
+         * 协议归属
+         */
+        private String agreementOwnership;
+
         private String createBy;
 
         /**
@@ -357,6 +363,7 @@ public class QuoteEchoVo extends QuoteVo {
         this.setOrdersNo(insOrdersVo.getId());
         this.getOrder().setAgreementId(insOrdersVo.getInsOrders().getAgreementId());
         this.getOrder().setAgreementName(insOrdersVo.getAgreementName());
+        this.getOrder().setAgreementOwnership(insOrdersVo.getAgreementOwnership());
         this.getOrder().setAgreementType(insOrdersVo.getAgreementType());
         this.getOrder().setOrdersNo(insOrdersVo.getId());
         this.getOrder().setQuoteNo(insOrdersVo.getQuoteNo());

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/quote/vo/orders/InsOrdersVo.java

@@ -52,6 +52,9 @@ public class InsOrdersVo extends QuoteVo {
     @Schema(description = "协议id")
     private String agreementId;
 
+    @Schema(description = "协议归属名称")
+    private String agreementOwnership;
+
     @Schema(description = "审核状态")
     private Integer auditStatus;
 

+ 17 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java

@@ -753,6 +753,14 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             if (ptlAgreement.getData() != null && ptlAgreement.getData().getAgreement() != null) {
                 insOrdersVo.setAgreementType(ptlAgreement.getData().getAgreement().getAgreementType());
                 insOrdersVo.setAgreementName(ptlAgreement.getData().getAgreement().getAgreementName());
+                // 根据ptlAgreement获取deptId,根据deptId查询sys_dept,然后根据sys_dept的name给agreementAttributionName赋值
+                String deptId = ptlAgreement.getData().getAgreement().getDeptId();
+                if (StringUtils.isNotEmpty(deptId)) {
+                    HttpResult<SysDeptVo> deptResult = orgClient.deptGet(deptId);
+                    if (deptResult != null && deptResult.getData() != null) {
+                        insOrdersVo.setAgreementOwnership(deptResult.getData().getName());
+                    }
+                }
             }
         }
 
@@ -912,6 +920,15 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             if (ptlAgreement.getData() != null && ptlAgreement.getData().getAgreement() != null) {
                 insOrdersVo.setAgreementType(ptlAgreement.getData().getAgreement().getAgreementType());
                 insOrdersVo.setAgreementName(ptlAgreement.getData().getAgreement().getAgreementName());
+
+                // 根据ptlAgreement获取deptId,根据deptId查询sys_dept,然后根据sys_dept的name给agreementAttributionName赋值
+                String deptId = ptlAgreement.getData().getAgreement().getDeptId();
+                if (StringUtils.isNotEmpty(deptId)) {
+                    HttpResult<SysDeptVo> deptResult = orgClient.deptGet(deptId);
+                    if (deptResult != null && deptResult.getData() != null) {
+                        insOrdersVo.setAgreementOwnership(deptResult.getData().getName());
+                    }
+                }
             }
         }
         // 2. 处理车辆用户信息列表

+ 26 - 23
commons/src/main/java/com/jzg/commons/util/BuildDescUtils.java → tenant/organization/src/main/java/com/jzg/organization/component/BuildDescUtils.java

@@ -1,24 +1,35 @@
-package com.jzg.commons.util;
+package com.jzg.organization.component;
 
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
 import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
 public class BuildDescUtils {
 
 
+    public static final Map<String, String> CODE_TO_LICENSE_MAP = Map.ofEntries(
+            Map.entry("1401", "晋A"),
+            Map.entry("1402", "晋B"),
+            Map.entry("1403", "晋C"),
+            Map.entry("1404", "晋D"),
+            Map.entry("1405", "晋E"),
+            Map.entry("1406", "晋F"),
+            Map.entry("1407", "晋K"),
+            Map.entry("1408", "晋M"),
+            Map.entry("1409", "晋H"),
+            Map.entry("1410", "晋L"),
+            Map.entry("1411", "晋J")
+    );
+
     public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
-        StringBuilder desc = new StringBuilder();
+        StringJoiner desc = new StringJoiner(",","","");
         Map<String, PtlAgreementUndwrtRulesAttr> attrMap = undwrtRulesAttrList.stream()
                 .filter(attr -> "all".equals(attr.getCompanyIds()) || (attr.getCompanyIds() != null && attr.getCompanyIds().equals(companyId)))
                 .collect(Collectors.toMap(PtlAgreementUndwrtRulesAttr::getAttrCode, Function.identity()));
-
+        linkList = linkList.stream().sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttr::getAttrCode)).toList();
         for (PtlAgreementUndwrtRulesAttr link : linkList) {
             PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = attrMap.get(link.getAttrCode());
             if (ptlAgreementUndwrtRulesAttr == null) {
@@ -28,32 +39,24 @@ public class BuildDescUtils {
             String attrType = ptlAgreementUndwrtRulesAttr.getAttrType();
 
             if ("inputNumber".equals(attrType)) {
-                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(",");
+                desc.add(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link));
             } else if ("radio".equals(attrType)) {
-                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(",");
+                desc.add(radioIdentifying(ptlAgreementUndwrtRulesAttr, link));
             } else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
+                StringJoiner license = new StringJoiner(",", ptlAgreementUndwrtRulesAttr.getAttrName() + "包含" ,"");
                 if(link.getMinArray() != null && link.getMinArray().length > 0){
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含");
                     for (int k=0 ; k<link.getMinArray().length; k++){
-                        PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = null;
-                        for (PtlAgreementUndwrtRulesDictLabal x : ptlAgreementUndwrtRulesAttr.getDictLabal()) {
-                            if (Arrays.asList(link.getMinArray()).contains("select".equals(attrType) ? x.getName() : x.getCode())) {
-                                ptlAgreementUndwrtRulesDictLabal = x;
-                                link.getMinArray()[k] = null;
-                                break;
-                            }
-                        }
-                        desc.append(null != ptlAgreementUndwrtRulesDictLabal ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
+                        license.add(CODE_TO_LICENSE_MAP.get(link.getMinArray()[k]));
                     }
-
                 }else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(",");
+                    license.add(link.getMin());
                 }
+                desc.add(license.toString());;
             } else if ("inputTag".equals(attrType)) {
                 if (link.getOperator() != null && "1".equals(link.getOperator())) {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(",");
+                    desc.add(ptlAgreementUndwrtRulesAttr.getAttrName() + "包含" + link.getMin());
                 } else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(link.getMin()).append(",");
+                    desc.add(ptlAgreementUndwrtRulesAttr.getAttrName() + "不包含" + link.getMin());
                 }
             }
         }

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

@@ -20,7 +20,7 @@ import com.jzg.commons.entity.vo.CostsListVo;
 import com.jzg.commons.entity.vo.PtlAgreementCostRuleVo;
 import com.jzg.commons.entity.vo.PtlAgreementCostVo;
 import com.jzg.commons.exception.SystemException;
-import com.jzg.commons.util.BuildDescUtils;
+import com.jzg.organization.component.BuildDescUtils;
 import com.jzg.commons.util.ListUtils;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.idgen.IdGenerate;

+ 25 - 18
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementUndwrtRulesServiceImpl.java

@@ -764,33 +764,39 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
      * @return
      */
     private String buildDesc(List<PtlAgreementUndwrtRulesAttrLink> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
-        StringBuilder desc = new StringBuilder();
-        for (int i = 0; i < linkList.size(); i++) {
+        log.info("遍历费用属性描述文字: linkList=[{}]", JSONUtil.toJsonStr(linkList));
+        StringJoiner desc = new StringJoiner(",","","");
+        // 这里进行排序,保证生成的承保规则描述是有序的
+        linkList = linkList.stream().sorted(Comparator.comparing(PtlAgreementUndwrtRulesAttrLink::getAttrCode)).toList();
+        List<PtlAgreementUndwrtRulesAttrLink> sortedLinks = new ArrayList<>(linkList);
+        for (int i = 0; i < sortedLinks.size(); i++) {
             int finalI = i;
             PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream()
-                    .filter(x -> x.getAttrCode().equals(linkList.get(finalI).getAttrCode()))
+                    .filter(x -> x.getAttrCode().equals(sortedLinks.get(finalI).getAttrCode()))
                     .findAny()
                     .get();
 
             //数值范围判断
-
             if ("inputNumber".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i))).append(",");
+                desc.add(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i)));
             }
             if ("radio".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i))).append(",");
-            }
-            if ("select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(selectIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i)));
+                desc.add(radioIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i)));
             }
-            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr,linkList.get(i)));
+//            if ("select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+//                desc.append(selectIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i)));
+//            }
+//            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+//                desc.append(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr,linkList.get(i)));
+//            }
+            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType()) || "select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.add(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr,sortedLinks.get(i)));
             }
             if ("inputTag".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                if (linkList.get(i).getOperator() != null && linkList.get(i).getOperator().equals("1")) {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(linkList.get(i).getMin()).append(",");
+                if (sortedLinks.get(i).getOperator() != null && sortedLinks.get(i).getOperator().equals("1")) {
+                    desc.add(ptlAgreementUndwrtRulesAttr.getAttrName() + "包含" + sortedLinks.get(i).getMin());
                 } else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(linkList.get(i).getMin()).append(",");
+                    desc.add(ptlAgreementUndwrtRulesAttr.getAttrName() + "包含" + sortedLinks.get(i).getMin());
                 }
             }
         }
@@ -834,8 +840,8 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
     }
 
     private String checkBoxIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink linkList) {
-        StringBuilder returnMsg = new StringBuilder();
-        returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
+        StringJoiner returnMsg = new StringJoiner(",",ptlAgreementUndwrtRulesAttr.getAttrName() + "为", "");
+        returnMsg.setEmptyValue("");
         if (linkList.getMinArray() == null) {
             String minStr = linkList.getMin();
             if (minStr != null && minStr.length() > 0) {
@@ -851,14 +857,15 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
                     licenseInfo.append(linkList.getMinArray()[i]).append(",");
                 }else {
                     PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x -> x.getCode().equals(linkList.getMinArray()[finalI])).findAny().get();
-                    returnMsg.append(ptlAgreementUndwrtRulesDictLabal.getName()).append(",");
+                    returnMsg.add(ptlAgreementUndwrtRulesDictLabal.getName());
                 }
             }
             if(StrUtil.isNotEmpty(licenseInfo.toString())){
                 String licenseName = ptlAreaLicenseService.convertAreaNumber2License(licenseInfo.toString());
-                returnMsg.append(licenseName).append(",");
+                returnMsg.add(licenseName);
             }
         }
+        log.info("承保规则描述:ptlAgreementUndwrtRulesAttr=[{}]. returnMsg=[{}]", JSONUtil.toJsonStr(ptlAgreementUndwrtRulesAttr), returnMsg.toString());
         return returnMsg.toString();
     }
 

+ 106 - 9
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.lang.tree.Tree;
 import cn.hutool.core.lang.tree.TreeNodeConfig;
 import cn.hutool.core.lang.tree.TreeUtil;
@@ -30,6 +31,7 @@ import com.jzg.commons.entity.finance.po.*;
 import com.jzg.commons.entity.finance.vo.*;
 import com.jzg.commons.entity.finance.vo.importimcome.*;
 import com.jzg.commons.entity.orders.po.InsOrderAdjust;
+import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
 import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.InsFeeOrders;
 import com.jzg.commons.entity.po.PtlAgreement;
@@ -53,6 +55,7 @@ import com.jzg.organization.mapper.*;
 import com.jzg.organization.service.ReceivableService;
 import com.jzg.organization.service.SysUserJzgInfoSalesmanService;
 import com.jzg.organization.service.importincome.ImportIncomeService;
+import com.jzg.organization.utils.IncomeInvoiceLinkUtil;
 import org.apache.ibatis.annotations.Param;
 import org.jetbrains.annotations.NotNull;
 import org.redisson.api.RBucket;
@@ -87,6 +90,7 @@ import java.util.function.BiConsumer;
 import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * @author tz
@@ -868,7 +872,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                             || invoiceType.equals(income.getInvoiceType()))
                     .collect(Collectors.toCollection(ArrayList::new));
             List<InsPlyIncomeDto> copyList = CollUtil.newArrayList();
-            if (CollUtil.isNotEmpty(incomeDtoList) && InvoiceTypeEnum.FEE_2.getCode().equals(invoiceType)){
+            if (CollUtil.isNotEmpty(incomeDtoList) && (StrUtil.isBlank(invoiceType) || InvoiceTypeEnum.FEE_2.getCode().equals(invoiceType))){
                 // 如果有发票类型为4的,则复制一条4的数据,完全一致,但发票类型为2
                 incomeDtoList.stream().filter(item -> InvoiceTypeEnum.FEE_4.getCode().equals(item.getInvoiceType())).forEach(item -> {
                     InsPlyIncomeDto incomeDto = new InsPlyIncomeDto();
@@ -899,11 +903,14 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             return resultList;
         }
 
-        // 如果status = 0或1,则直接返回空的filterIncomeList,如果status = 2,则查询所有ins_ply_follow_invoice_link表,过滤掉disableFlag为1 的,保留为0 的数据
-        List<InsPlyIncomeDto> filterIncomeList = insPlyIncomes.stream()
-                .filter(income -> "0".equals(income.getDisableFlag()))
-                .map(income -> BeanUtil.copyProperties(income, InsPlyIncomeDto.class))
-                .collect(Collectors.toList());
+        List<InsPlyIncomeDto> filterIncomeList = BeanUtil.copyToList(insPlyIncomes, InsPlyIncomeDto.class);
+        if ("2".equals(status)){
+            // 如果status = 0或1,则直接返回空的filterIncomeList,如果status = 2,则查询所有ins_ply_follow_invoice_link表,过滤掉disableFlag为1 的,保留为0 的数据
+            filterIncomeList = insPlyIncomes.stream()
+                    .filter(income -> "0".equals(income.getDisableFlag()))
+                    .map(income -> BeanUtil.copyProperties(income, InsPlyIncomeDto.class))
+                    .collect(Collectors.toList());
+        }
 
         // 5. 将其他费用收入合并进结果集合
         mergeOtherCostIncomeToResult(filterIncomeList, resultList, companyMap);
@@ -2637,14 +2644,73 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 errrMsg.append("该批数据的保险机构为空. ");
             }
         }
+        errrMsg.append(this.validatePolicy(datas));
+        errrMsg.append(this.validateProportion(datas));
+        return errrMsg.toString();
+    }
 
-
+    /**
+     * 校验保单号是否一致
+     *
+     * @author lipf
+     * @date 2026/8/20 10:35
+     */
+    private String validatePolicy(List<ImportContentExt> datas) {
+        StringBuilder errrMsg = new StringBuilder();
+        for (ImportContentExt data : datas) {
+            boolean all = false;
+            boolean jq = false;
+            boolean sy = false;
+            boolean jy = false;
+            InsOrdersPolicy insOrdersPolicy = data.getInsOrdersPolicy();
+            if(insOrdersPolicy == null){
+                continue;
+            }
+            if(!Objects.equals(insOrdersPolicy.getJqPolicyNo(), data.getJqPolicyNo())){
+                all = true;
+                jq = true;
+            }
+            if(!Objects.equals(insOrdersPolicy.getSyPolicyNo(), data.getSyPolicyNo())){
+                all = true;
+                sy = true;
+            }
+            if(!Objects.equals(insOrdersPolicy.getJyPolicyNo(), data.getJyPolicyNo())){
+                all = true;
+                jy = true;
+            }
+            if(all){
+                errrMsg.append("车牌号为[").append(data.getLicenseNo()).append("]的保单号不一致: ");
+                if(jq){
+                    errrMsg.append("交强险保单号不一致. 应收数据的交强险保单号是[").append(insOrdersPolicy.getJqPolicyNo()).append("].excel维护的交强险保单号是[").append(data.getJqPolicyNo()).append("].");
+                }
+                if(sy){
+                    errrMsg.append("商业险保单号不一致. 应收数据的商业险保单号是[").append(insOrdersPolicy.getSyPolicyNo()).append("].excel维护的商业险保单号是[").append(data.getSyPolicyNo()).append("].");
+                }
+                if(jy){
+                    errrMsg.append("驾意险保单号不一致. 应收数据的驾意险保单号是[").append(insOrdersPolicy.getJyPolicyNo()).append("].excel维护的驾意险保单号是[").append(data.getJyPolicyNo()).append("].");
+                }
+            }
+        }
+        return errrMsg.toString();
+    }
+    /**
+     * 校验应收比例
+     *
+     *
+     * @author lipf
+     * @date 2026/8/20 10:27
+     */
+    private static String validateProportion(List<ImportContentExt> datas) {
+        StringBuilder errrMsg = new StringBuilder();
         for (ImportContentExt data : datas) {
             boolean all = false;
             boolean jq = false;
             boolean sy = false;
             boolean jy = false;
             InsPlyIncome insPlyIncome = data.getInsPlyIncome();
+            if(insPlyIncome == null){
+                continue;
+            }
             String jqadd = BigDecimalUtil.add(insPlyIncome.getJqSuperviseCostsProportion(), insPlyIncome.getJqOtherCostsProportion());
             BigDecimal jqsubtract = BigDecimalUtil.subtract(new BigDecimal(jqadd), new BigDecimal(data.getJqInletRatio()));
             if(BigDecimal.ZERO.compareTo(jqsubtract) != 0){
@@ -5414,11 +5480,42 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
 
         List<InsPlyIncome> receivableList = baseMapper.getReceivableList(receivableQueryVo);
         receivableList = this.fillOtherInfo(receivableList, null);
+        // 类型转换
+        List<ExportPlatFormReceivableVO> exportPlatFormReceivableVOS = BeanUtil.copyToList(receivableList, ExportPlatFormReceivableVO.class);
+        // 用ins_ply_income的id关联查到ins_ply_income_invoice_link再关联到ins_ply_income_invoice_settlement,取出结算日期、结算人
+        if (CollUtil.isNotEmpty(exportPlatFormReceivableVOS)) {
+            //1.拿到所有incomeId集合
+            List<Long> incomeIdList = exportPlatFormReceivableVOS.stream()
+                    .map(item -> Long.valueOf(item.getId()))
+                    .collect(Collectors.toList());
+
+            Map<String, InsPlyIncomeInvoiceSettlement> settlementMap = IncomeInvoiceLinkUtil.querySettlementByIncomeList(incomeIdList, insPlyIncomeInvoiceLinkMapper, insPlyIncomeInvoiceSettlementMapper);
+            Map<String, List<InsPlyIncomeInvoiceLink>> linkGroupByIncomeId = IncomeInvoiceLinkUtil.queryInvoiceLinkByIncomeId(incomeIdList, insPlyIncomeInvoiceLinkMapper);
+
+            //回填vo
+            for (ExportPlatFormReceivableVO vo : exportPlatFormReceivableVOS) {
+                List<InsPlyIncomeInvoiceLink> linkList = linkGroupByIncomeId.getOrDefault(vo.getId(), CollUtil.newArrayList());
+                if (CollUtil.isEmpty(linkList)) {
+                    continue;
+                }
+                // 取第一条有结算数据的link,可按业务修改:比如取最新一条
+                for (InsPlyIncomeInvoiceLink link : linkList) {
+                    InsPlyIncomeInvoiceSettlement settlement = settlementMap.get(link.getInvoiceId());
+                    if (settlement != null) {
+                        //结算日期
+                        vo.setSettlementTime(LocalDateTimeUtil.of(settlement.getReceivePaymentDate()));
+                        //结算人:创建人即为结算操作人
+                        vo.setSettlementPerson(settlement.getCreateBy());
+                        break;
+                    }
+                }
+            }
+        }
 
         // 调用动态导出
         return exportBaseService.upLoadFile(
-                InsPlyIncome.class,
-                receivableList,
+                ExportPlatFormReceivableVO.class,
+                exportPlatFormReceivableVOS,
                 "平台协议应收-批量导入-导出-" + Instant.now()
         );
     }

+ 3 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/importincome/ImportIncomeServiceImpl.java

@@ -123,6 +123,7 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
                 queryWrapper.eq(InsOrdersPolicy::getJqPolicyNo,excelContent.getJqPolicyNo());
                 List<InsOrdersPolicy> insOrdersPolicies = insOrdersPolicyMapper.selectList(queryWrapper);
                 if(CollUtil.isNotEmpty(insOrdersPolicies)){
+                    ext.setInsOrdersPolicy(insOrdersPolicies.get(0));
                     orderNO  = insOrdersPolicies.get(0).getOrderNo();
                 }
             }
@@ -131,6 +132,7 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
                 queryWrapper.eq(InsOrdersPolicy::getSyPolicyNo,excelContent.getSyPolicyNo());
                 List<InsOrdersPolicy> insOrdersPolicies = insOrdersPolicyMapper.selectList(queryWrapper);
                 if(CollUtil.isNotEmpty(insOrdersPolicies)){
+                    ext.setInsOrdersPolicy(insOrdersPolicies.get(0));
                     orderNO  = insOrdersPolicies.get(0).getOrderNo();
                 }
             }
@@ -139,6 +141,7 @@ public class ImportIncomeServiceImpl implements ImportIncomeService {
                 queryWrapper.eq(InsOrdersPolicy::getJyPolicyNo,excelContent.getJyPolicyNo());
                 List<InsOrdersPolicy> insOrdersPolicies = insOrdersPolicyMapper.selectList(queryWrapper);
                 if(CollUtil.isNotEmpty(insOrdersPolicies)){
+                    ext.setInsOrdersPolicy(insOrdersPolicies.get(0));
                     orderNO  = insOrdersPolicies.get(0).getOrderNo();
                 }
             }

+ 93 - 0
tenant/organization/src/main/java/com/jzg/organization/utils/IncomeInvoiceLinkUtil.java

@@ -0,0 +1,93 @@
+package com.jzg.organization.utils;
+
+import cn.hutool.core.collection.CollUtil;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import com.jzg.commons.entity.finance.po.InsPlyIncomeInvoiceLink;
+import com.jzg.commons.entity.finance.po.InsPlyIncomeInvoiceSettlement;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.jzg.organization.mapper.InsPlyIncomeInvoiceLinkMapper;
+import com.jzg.organization.mapper.InsPlyIncomeInvoiceSettlementMapper;
+
+public class IncomeInvoiceLinkUtil {
+
+    private IncomeInvoiceLinkUtil() {
+    }
+
+    /**
+     * 根据incomeId集合 查询应收开票结算
+     * @param incomeIdList 应收主表id集合
+     * @param linkMapper link表mapper
+     * @param settlementMapper settlement表mapper
+     * @return key: invoiceId, value: settlement结算记录,旧值会被新值替换,按创建时间倒序
+     */
+    public static Map<String, InsPlyIncomeInvoiceSettlement> querySettlementByIncomeList(List<Long> incomeIdList,
+                                                                          InsPlyIncomeInvoiceLinkMapper linkMapper,
+                                                                          InsPlyIncomeInvoiceSettlementMapper settlementMapper) {
+        if (CollUtil.isEmpty(incomeIdList)) {
+            return null;
+        }
+
+        List<InsPlyIncomeInvoiceLink> invoiceLinkList = getInvoiceLinkList(incomeIdList, linkMapper);
+        if (CollUtil.isEmpty(invoiceLinkList)) {
+            return null;
+        }
+
+        // 2、拿到所有invoiceId
+        List<String> invoiceIdList = invoiceLinkList.stream()
+                .map(InsPlyIncomeInvoiceLink::getInvoiceId)
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+
+        // 3、key: invoiceId, value: settlement结算记录
+        Map<String, InsPlyIncomeInvoiceSettlement> settlementMap = new HashMap<>();
+        if (CollUtil.isNotEmpty(invoiceIdList)) {
+            LambdaQueryWrapper<InsPlyIncomeInvoiceSettlement> settlementWrapper = new LambdaQueryWrapper<>();
+            settlementWrapper.in(InsPlyIncomeInvoiceSettlement::getInvoiceId, invoiceIdList);
+            settlementWrapper.eq(InsPlyIncomeInvoiceSettlement::getIsDelete, 0);
+            List<InsPlyIncomeInvoiceSettlement> settlementList = settlementMapper.selectList(settlementWrapper);
+            // 按创建时间倒序
+            settlementList.sort((a,b)->b.getCreateTime().compareTo(a.getCreateTime()));
+            settlementMap = settlementList.stream()
+                    .collect(Collectors.toMap(InsPlyIncomeInvoiceSettlement::getInvoiceId, s -> s, (exist, newVal) -> newVal));
+        }
+
+
+
+        return settlementMap;
+    }
+
+
+    /**
+     * 根据incomeId获取invoiceLink的Map分组
+     * @param incomeIdList
+     * @param linkMapper
+     * @return
+     */
+    public static Map<String, List<InsPlyIncomeInvoiceLink>> queryInvoiceLinkByIncomeId(List<Long> incomeIdList,
+                                                                                   InsPlyIncomeInvoiceLinkMapper linkMapper) {
+
+        List<InsPlyIncomeInvoiceLink> invoiceLinkList = getInvoiceLinkList(incomeIdList, linkMapper);
+        if (CollUtil.isEmpty(invoiceLinkList)) {
+            return null;
+        }
+
+        // 按incomeId分组,一个income可能多条link
+        return invoiceLinkList.stream()
+                .collect(Collectors.groupingBy(InsPlyIncomeInvoiceLink::getIncomeId));
+    }
+
+
+    // 单纯获取InsPlyIncomeInvoiceLink的列表
+    public static List<InsPlyIncomeInvoiceLink> getInvoiceLinkList(List<Long> incomeIdList, InsPlyIncomeInvoiceLinkMapper linkMapper) {
+        // 1、查询link关联表
+        LambdaQueryWrapper<InsPlyIncomeInvoiceLink> linkWrapper = new LambdaQueryWrapper<>();
+        linkWrapper.in(InsPlyIncomeInvoiceLink::getIncomeId, incomeIdList);
+        linkWrapper.eq(InsPlyIncomeInvoiceLink::getIsDelete, 0);
+        return linkMapper.selectList(linkWrapper);
+    }
+}

+ 7 - 0
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -410,6 +410,13 @@
                     #{phone}
                 </foreach>
             </if>
+            <if test="costParam.costDescribes != null and costParam.costDescribes.length >0 ">
+                and (
+                    <foreach  collection="costParam.costDescribes" close=")" open="(" separator="and " item="costDescribe">
+                        pc.cost_describe like concat('%', #{costDescribe} ,'%')
+                    </foreach>
+                )
+            </if>
             <if test="costParam.auditTimeBegin != null and costParam.auditTimeBegin != ''">
                 and pc.audit_time &gt;= #{costParam.auditTimeBegin}
             </if>

+ 2 - 0
tenant/organization/src/main/resources/mapper/SysUserMapper.xml

@@ -64,6 +64,8 @@
                 AND su.mobile = #{mobile}
             </if>
         </where>
+        order by su.id desc
+        LIMIT 1
     </select>
 
     <select id="getUserRoleName" resultType="String">