Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

lixiaolong 1 месяц назад
Родитель
Сommit
24e50466aa
28 измененных файлов с 788 добавлено и 239 удалено
  1. 2 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalPageParam.java
  2. 26 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostCopyExternalParam.java
  3. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java
  4. 168 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/ExportPlatFormReceivableVO.java
  5. 4 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/importimcome/ImportContentExt.java
  6. 3 2
      commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementUndwrtRulesAttrLink.java
  7. 7 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/aggregated/QuoteEchoVo.java
  8. 3 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/orders/InsOrdersVo.java
  9. 1 1
      commons/src/main/java/com/jzg/commons/entity/vo/RuleAttrMappingVo.java
  10. 0 92
      commons/src/main/java/com/jzg/commons/util/BuildDescUtils.java
  11. 1 1
      tenant/insurance/quotation-chengtai/src/main/java/com/jzg/quotation/chengtai/api/build/ChengTaiAPIQuoteResultsVoBuild.java
  12. 1 1
      tenant/insurance/quotation-chengtai/src/main/java/com/jzg/quotation/chengtai/api/entity/request/PremiumCalculationRequest.java
  13. 17 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java
  14. 5 1
      tenant/insurance/quotation-yangguang/src/main/java/com/jzg/quotation/yangguang/api/entity/request/YangGuangAccuracyCalculateRequest.java
  15. 231 0
      tenant/organization/src/main/java/com/jzg/organization/component/BuildDescUtils.java
  16. 6 1
      tenant/organization/src/main/java/com/jzg/organization/controller/AreaController.java
  17. 11 0
      tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostExternalController.java
  18. 1 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalService.java
  19. 58 2
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java
  20. 12 2
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java
  21. 6 126
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementUndwrtRulesServiceImpl.java
  22. 106 9
      tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java
  23. 2 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysDeptServiceImpl.java
  24. 3 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/importincome/ImportIncomeServiceImpl.java
  25. 93 0
      tenant/organization/src/main/java/com/jzg/organization/utils/IncomeInvoiceLinkUtil.java
  26. 3 0
      tenant/organization/src/main/resources/mapper/PtlAgreementCostExternalMapper.xml
  27. 13 0
      tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml
  28. 2 0
      tenant/organization/src/main/resources/mapper/SysUserMapper.xml

+ 2 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalPageParam.java

@@ -31,6 +31,8 @@ public class CostExternalPageParam extends PageRequest {
 
     @Schema(description = "有效状态")
     private String validState;
+    @Schema(description = "协议id")
+    private String ptlAgreementId;
 
     @Schema(description = "生效时间")
     private List<String> effectiveTime;

+ 26 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostCopyExternalParam.java

@@ -0,0 +1,26 @@
+package com.jzg.commons.entity.dto;
+
+
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "协议费用复制参数")
+public class PtlAgreementCostCopyExternalParam extends PageRequest {
+
+    @Schema(description = "需要复制的费用id")
+    private List<String> costIds;
+
+    @Schema(description = "需要复制的协议id")
+    private String agreementId;
+
+    @Schema(description = "对接人姓名")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    private String contactMobile;
+}

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

+ 1 - 1
commons/src/main/java/com/jzg/commons/entity/vo/RuleAttrMappingVo.java

@@ -327,7 +327,7 @@ public class RuleAttrMappingVo {
         // 车牌地区
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseArea", insOrdersCarInfo.getLicenseNo().substring(0, 1)));
         // 系数
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("Coefficient", getCoefficient(insOrdersCarInfo, insOrdersCosts).toString()));
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("CoefficientFactor", getCoefficient(insOrdersCarInfo, insOrdersCosts).toString()));
         // 商业是否有费用
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("CiMessage", (insOrdersOther.getCiMessage() == null || "".equals(insOrdersOther.getCiMessage())) ? "0" : "1"));
 

+ 0 - 92
commons/src/main/java/com/jzg/commons/util/BuildDescUtils.java

@@ -1,92 +0,0 @@
-package com.jzg.commons.util;
-
-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.function.Function;
-import java.util.stream.Collectors;
-
-public class BuildDescUtils {
-
-
-    public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
-        StringBuilder desc = new StringBuilder();
-        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()));
-
-        for (PtlAgreementUndwrtRulesAttr link : linkList) {
-            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = attrMap.get(link.getAttrCode());
-            if (ptlAgreementUndwrtRulesAttr == null) {
-                continue;
-            }
-
-            String attrType = ptlAgreementUndwrtRulesAttr.getAttrType();
-
-            if ("inputNumber".equals(attrType)) {
-                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(",");
-            } else if ("radio".equals(attrType)) {
-                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(",");
-            } else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
-                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(",");
-                    }
-
-                }else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(",");
-                }
-            } else if ("inputTag".equals(attrType)) {
-                if (link.getOperator() != null && "1".equals(link.getOperator())) {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(",");
-                } else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(link.getMin()).append(",");
-                }
-            }
-        }
-        return desc.toString();
-    }
-
-    private static String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
-        Optional<PtlAgreementUndwrtRulesDictLabal> dictLabel = Optional.ofNullable(
-                        ptlAgreementUndwrtRulesAttr.getDictLabal())
-                .flatMap(list -> list.stream().filter(x -> x.getCode().equals(link.getMin())).findFirst());
-
-        return dictLabel.map(dl -> ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + dl.getName())
-                .orElse("");
-    }
-
-    private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
-        String operator = link.getOperator();
-        switch (operator) {
-            case "1":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "范围值" + link.getMin() + "到" + link.getMax();
-            case "2":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + link.getMin();
-            case "3":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + link.getMin();
-            case "4":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + link.getMax();
-            case "5":
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + link.getMax();
-            default:
-                return ptlAgreementUndwrtRulesAttr.getAttrName() + "未知操作符";
-        }
-    }
-
-
-
-}

+ 1 - 1
tenant/insurance/quotation-chengtai/src/main/java/com/jzg/quotation/chengtai/api/build/ChengTaiAPIQuoteResultsVoBuild.java

@@ -132,7 +132,7 @@ public final class ChengTaiAPIQuoteResultsVoBuild {
                     .orElse(null);
             scoreJson.add(new JSONObject()
                     .fluentPut("scoreName", "自主定价系数")
-                    .fluentPut("scoreKey","coefficient")
+                    .fluentPut("scoreKey","pricingCoefficient")
                     .fluentPut("score", coefficientVal));
             scoreJson.add(new JSONObject()
                     .fluentPut("scoreName", "一账通评分")

+ 1 - 1
tenant/insurance/quotation-chengtai/src/main/java/com/jzg/quotation/chengtai/api/entity/request/PremiumCalculationRequest.java

@@ -604,7 +604,7 @@ public class PremiumCalculationRequest {
             this.actualValue = actualValue;
             this.loanVehicleFlag = "0";
             this.seatNum = Integer.valueOf(vehicle.getSeat());
-            if (vehicle.getVehicleDisplacement().equals("")) {
+            if (vehicle.getVehicleDisplacement() == null || vehicle.getVehicleDisplacement().equals("") ) {
                 this.displacement = vehicle.getVehicleDisplacement();
             } else {
                 this.displacement = vehicle.getVehicleDisplacement();

+ 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. 处理车辆用户信息列表

+ 5 - 1
tenant/insurance/quotation-yangguang/src/main/java/com/jzg/quotation/yangguang/api/entity/request/YangGuangAccuracyCalculateRequest.java

@@ -742,7 +742,11 @@ public class YangGuangAccuracyCalculateRequest extends YangGuangBaseRequest{
             }
             this.LicenseCategory = carInfoVo.getCarTypeCode();
             this.CarCheckStatus = "2";
-            this.Inputnewenergyflag = carInfoVo.isNewEnergyMark() ? "1" : "0";
+            if (carInfoVo.getLicenseNo().length() == 8) {
+                this.Inputnewenergyflag = "1";
+            } else {
+                this.Inputnewenergyflag = "0";
+            }
             this.FuelType = carInfoVo.getEnergyTypeCode();
             this.SeatCount = carInfoVo.getSeatCount();
         }

+ 231 - 0
tenant/organization/src/main/java/com/jzg/organization/component/BuildDescUtils.java

@@ -0,0 +1,231 @@
+package com.jzg.organization.component;
+
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttr;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesAttrLink;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
+import com.jzg.commons.util.StringUtils;
+
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class BuildDescUtils {
+
+    /**
+     * 遍历费用属性描述文字
+     *
+     * @param linkList
+     * @param undwrtRulesAttrList
+     * @return
+     */
+    public static String buildDesc(String companyId, List<PtlAgreementUndwrtRulesAttr> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
+        StringBuilder desc = new StringBuilder();
+        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();
+        List<PtlAgreementUndwrtRulesAttr> sortedLinks = new ArrayList<>(linkList);
+
+        for (PtlAgreementUndwrtRulesAttr link : sortedLinks) {
+            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = attrMap.get(link.getAttrCode());
+            if (ptlAgreementUndwrtRulesAttr == null) {
+                continue;
+            }
+
+            String attrType = ptlAgreementUndwrtRulesAttr.getAttrType();
+
+            if ("inputNumber".equals(attrType)) {
+                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(";\t\t");
+            } else if ("radio".equals(attrType)) {
+                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, link)).append(";\t\t");
+            } else if ("checkbox".equals(attrType) || "select".equals(attrType)) {
+                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 : link.getDictLabal()) {
+                            if (Arrays.asList(link.getMinArray()).contains(x.getCode())) {
+                                ptlAgreementUndwrtRulesDictLabal = x;
+                                link.getMinArray()[k] = null;
+                                break;
+                            }
+                        }
+                        desc.append(null != ptlAgreementUndwrtRulesDictLabal ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
+                    }
+                    // 条件描述后补充一个分号
+                    desc.append(",");
+                }else {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(";\t\t");
+                }
+            } else if ("inputTag".equals(attrType)) {
+                if (link.getOperator() != null && "1".equals(link.getOperator())) {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(link.getMin()).append(";\t\t");
+                } else {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(link.getMin()).append(";\t\t");
+                }
+            }
+        }
+        return desc.toString();
+    }
+
+    private static String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
+        Optional<PtlAgreementUndwrtRulesDictLabal> dictLabel = Optional.ofNullable(
+                        ptlAgreementUndwrtRulesAttr.getDictLabal())
+                .flatMap(list -> list.stream().filter(x -> x.getCode().equals(link.getMin())).findFirst());
+
+        return dictLabel.map(dl -> ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + dl.getName())
+                .orElse("");
+    }
+
+    private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttr link) {
+        String operator = link.getOperator();
+        switch (operator) {
+            case "1":
+                return ptlAgreementUndwrtRulesAttr.getAttrName() + "范围值" + link.getMin() + "到" + link.getMax();
+            case "2":
+                return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + link.getMin();
+            case "3":
+                return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + link.getMin();
+            case "4":
+                return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + link.getMax();
+            case "5":
+                return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + link.getMax();
+            default:
+                return ptlAgreementUndwrtRulesAttr.getAttrName() + "未知操作符";
+        }
+    }
+
+
+    /**
+     * 遍历承保规则属性描述文字
+     *
+     * @param linkList
+     * @param undwrtRulesAttrList
+     * @return
+     */
+    public static String buildDesc(List<PtlAgreementUndwrtRulesAttrLink> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
+        StringBuilder desc = new StringBuilder();
+        // 这里进行排序,保证生成的承保规则描述是有序的
+        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(sortedLinks.get(finalI).getAttrCode()))
+                    .findAny()
+                    .get();
+
+            //数值范围判断
+
+            if ("inputNumber".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i))).append(",");
+            }
+            if ("radio".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.append(radioIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i))).append(",");
+            }
+            if ("select".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.append(selectIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i)));
+            }
+            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                desc.append(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr, sortedLinks.get(i)));
+            }
+            if ("inputTag".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
+                if (sortedLinks.get(i).getOperator() != null && sortedLinks.get(i).getOperator().equals("1")) {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("包含").append(sortedLinks.get(i).getMin()).append(",");
+                } else {
+                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(sortedLinks.get(i).getMin()).append(",");
+                }
+            }
+        }
+        // 相邻的","或","转换为"或"字
+        return StringUtils.convertAdjacentCommaToOr(desc.toString());
+    }
+
+    public static String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
+        PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x -> x.getCode().equals(ptlAgreementProductCostsAttrLink.getMin())).findAny().get();
+        return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
+    }
+
+    public static String selectIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
+        StringBuilder returnMsg = new StringBuilder();
+        returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
+        // 兼容 min 逗号分隔存储,保证 minArray 有值
+        if (ptlAgreementProductCostsAttrLink.getMinArray() == null) {
+            String minStr = ptlAgreementProductCostsAttrLink.getMin();
+            if (minStr != null && !minStr.isEmpty()) {
+                ptlAgreementProductCostsAttrLink.setMinArray(minStr.split(","));
+            }
+        }
+
+        // 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
+        List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(ptlAgreementUndwrtRulesAttr, ptlAgreementProductCostsAttrLink);
+
+        // 用字典标签的 code 匹配 minArray 中的每一项
+        if (ptlAgreementProductCostsAttrLink.getMinArray() != null) {
+            for (String item : ptlAgreementProductCostsAttrLink.getMinArray()) {
+                PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalList.stream()
+                        .filter(x -> x.getCode() != null && x.getCode().equals(item)).findAny().orElse(null);
+                if (ptlAgreementUndwrtRulesDictLabal != null) {
+                    returnMsg.append(ptlAgreementUndwrtRulesDictLabal.getName()).append(",");
+                }
+            }
+        }
+        return returnMsg.toString();
+    }
+
+    public static String checkBoxIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink linkList) {
+        StringBuilder returnMsg = new StringBuilder();
+        returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
+        // 兼容 min 逗号分隔存储,保证 minArray 有值
+        if (linkList.getMinArray() == null) {
+            String minStr = linkList.getMin();
+            if (minStr != null && !minStr.isEmpty()) {
+                linkList.setMinArray(minStr.split(","));
+            }
+        }
+        if (linkList.getMinArray() != null) {
+            // 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
+            List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = getDictLabalList(ptlAgreementUndwrtRulesAttr, linkList);
+            // code -> 字典标签 映射,避免 O(n²) 循环匹配
+            Map<String, PtlAgreementUndwrtRulesDictLabal> dictLabalMap = dictLabalList.stream()
+                    .filter(x -> x.getCode() != null)
+                    .collect(Collectors.toMap(PtlAgreementUndwrtRulesDictLabal::getCode, Function.identity(), (oldItem, newItem) -> newItem));
+            for (String code : linkList.getMinArray()) {
+                PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalMap.get(code);
+                returnMsg.append(ptlAgreementUndwrtRulesDictLabal != null ? ptlAgreementUndwrtRulesDictLabal.getName() : "").append(",");
+            }
+        }
+        return returnMsg.toString();
+    }
+
+    /**
+     * 获取字典标签列表:优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
+     */
+    private static List<PtlAgreementUndwrtRulesDictLabal> getDictLabalList(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink link) {
+        if (link.getDictLabal() != null && !link.getDictLabal().isEmpty()) {
+            return link.getDictLabal().toJavaList(PtlAgreementUndwrtRulesDictLabal.class);
+        }
+        if (ptlAgreementUndwrtRulesAttr.getDictLabal() != null) {
+            return ptlAgreementUndwrtRulesAttr.getDictLabal();
+        }
+        return Collections.emptyList();
+    }
+
+    private static String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
+        if ("1".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "范围值" + ptlAgreementProductCostsAttrLink.getMin() + "到" + ptlAgreementProductCostsAttrLink.getMax();
+        } else if ("2".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + ptlAgreementProductCostsAttrLink.getMin();
+        } else if ("3".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + ptlAgreementProductCostsAttrLink.getMin();
+        } else if ("4".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + ptlAgreementProductCostsAttrLink.getMax();
+        } else if ("5".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
+            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + ptlAgreementProductCostsAttrLink.getMax();
+        }
+        return "";
+    }
+
+}

+ 6 - 1
tenant/organization/src/main/java/com/jzg/organization/controller/AreaController.java

@@ -10,7 +10,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 区划管理接口
@@ -43,6 +45,9 @@ public class AreaController {
         SysArea sysArea = new SysArea();
         sysArea.setLevel(3);
         sysArea.setUpperCode(countyCode);
-        return HttpResult.ok(sysAreaService.queryAllParent(sysArea));
+        if(Objects.nonNull(countyCode)) {
+            return HttpResult.ok(sysAreaService.queryAllParent(sysArea));
+        }
+        return HttpResult.ok(new ArrayList<>());
     }
 }

+ 11 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostExternalController.java

@@ -118,5 +118,16 @@ public class PtlAgreementCostExternalController {
         return ptlAgreementCostExternalService.auditFailed(costReviewParam);
     }
 
+    @Operation(summary = "批量复制外部费用")
+    @PostMapping("copyCostExternal")
+    public HttpResult copyCostExternal(@RequestBody PtlAgreementCostCopyExternalParam costCopyParam){
+        try{
+            return ptlAgreementCostExternalService.copyCostExternal(costCopyParam);
+
+        }catch (Exception e){
+            return HttpResult.error("批量复制外部费用异常:"+e.getMessage());
+        }
+    }
+
 
 }

+ 1 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalService.java

@@ -37,4 +37,5 @@ public interface PtlAgreementCostExternalService extends IService<PtlAgreementCo
 
     HttpResult auditFailed(CostReviewParam costReviewParam);
 
+    HttpResult copyCostExternal(PtlAgreementCostCopyExternalParam costCopyParam);
 }

+ 58 - 2
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java

@@ -2,6 +2,8 @@ package com.jzg.organization.service.impl;
 
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -13,14 +15,15 @@ import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.StateResult;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.*;
-import com.jzg.commons.entity.po.PtlAgreementCostExternal;
-import com.jzg.commons.entity.po.PtlAgreementCostExternalType;
+import com.jzg.commons.entity.po.*;
 import com.jzg.commons.entity.vo.CostExternalListVo;
 import com.jzg.commons.entity.vo.CostExternalVo;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.DateTimeUtils;
 import com.jzg.commons.util.StringUtils;
+import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.mapper.PtlAgreementCostExternalMapper;
+import com.jzg.organization.mapper.PtlAgreementCostExternalTypeMapper;
 import com.jzg.organization.service.PtlAgreementCostExternalService;
 import com.jzg.organization.service.PtlAgreementCostExternalTypeService;
 import com.jzg.organization.state.listener.CostStateListener;
@@ -39,6 +42,8 @@ public class PtlAgreementCostExternalServiceImpl extends ServiceImpl<PtlAgreemen
 
     @Resource
     private PtlAgreementCostExternalTypeService ptlAgreementCostExternalTypeService;
+    @Resource
+    private PtlAgreementCostExternalTypeMapper ptlAgreementCostExternalTypeMapper;
 
     @Resource
     private CostStateListener costStateListener;
@@ -260,6 +265,57 @@ public class PtlAgreementCostExternalServiceImpl extends ServiceImpl<PtlAgreemen
         return audit(costReviewParam, false);
     }
 
+    @Override
+    @Transactional
+    public HttpResult copyCostExternal(PtlAgreementCostCopyExternalParam costCopyParam) {
+        // 参数校验:所有参数都不能为空
+        if (costCopyParam == null) {
+            return HttpResult.error("复制参数不能为空");
+        }
+        if (CollUtil.isEmpty(costCopyParam.getCostIds())) {
+            return HttpResult.error("费用ID列表不能为空");
+        }
+        if (StrUtil.isBlank(costCopyParam.getAgreementId())) {
+            return HttpResult.error("协议ID不能为空");
+        }
+        if (StrUtil.isBlank(costCopyParam.getContactPerson())) {
+            return HttpResult.error("对接人姓名不能为空");
+        }
+        if (StrUtil.isBlank(costCopyParam.getContactMobile())) {
+            return HttpResult.error("对接人手机号不能为空");
+        }
+        List<String> costIds = costCopyParam.getCostIds();
+        StringBuilder errMsg = new StringBuilder();
+        costIds.forEach(oldCostId-> {
+            PtlAgreementCostExternal oldCostExternal = baseMapper.selectOne(
+                    new LambdaQueryWrapper<PtlAgreementCostExternal>()
+                            .eq(PtlAgreementCostExternal::getId, oldCostId));
+            if(oldCostExternal != null){
+                List<PtlAgreementCostExternalType> ptlAgreementCostTypes = ptlAgreementCostExternalTypeMapper.selectList(new LambdaQueryWrapper<PtlAgreementCostExternalType>()
+                        .eq(PtlAgreementCostExternalType::getPtlAgreementCostExternalId, oldCostExternal.getId()));
+                // 调整数据 进行copy
+                oldCostExternal.setId(null);
+                oldCostExternal.setPtlAgreementId(Long.valueOf(costCopyParam.getAgreementId()));
+                oldCostExternal.setCostDescribe("复制的费用:" + oldCostExternal.getCostDescribe());
+                oldCostExternal.setCreateTime(LocalDateTime.now());
+                oldCostExternal.setUpdateTime(LocalDateTime.now());
+                oldCostExternal.setContactPerson(costCopyParam.getContactPerson());
+                oldCostExternal.setContactMobile(costCopyParam.getContactMobile());
+                // 复制的费用为待审核
+                oldCostExternal.setAuditStatus(0);
+                baseMapper.insert(oldCostExternal);
+                ptlAgreementCostTypes.forEach(item ->{
+                    item.setId(null);
+                });
+                saveOrUpdate(ptlAgreementCostTypes,oldCostExternal.getId());
+
+            }else{
+                errMsg.append("costId为"+oldCostId+"的费用信息已被删除;");
+            }
+        });
+        return HttpResult.ok(errMsg.toString());
+    }
+
     private HttpResult audit(CostReviewParam costReviewParam, boolean isSuccess) {
         // 批量查询所有记录
         List<PtlAgreementCostExternal> records = baseMapper.selectBatchIds(costReviewParam.getIds());

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

@@ -20,11 +20,11 @@ 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.commons.util.ListUtils;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.client.EsmInsCompanyClient;
+import com.jzg.organization.component.BuildDescUtils;
 import com.jzg.organization.mapper.PtlAgreementCostMapper;
 import com.jzg.organization.mapper.PtlAgreementCostRuleMapper;
 import com.jzg.organization.mapper.PtlAgreementCostTypeMapper;
@@ -95,6 +95,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     private PtlAgreementService ptlAgreementService;
     @Autowired
     private SysUserJzgInfoService sysUserJzgInfoService;
+    @Autowired
+    private PtlAreaLicenseService ptlAreaLicenseService;
 
     /**
      * 报价配置/费用管理/新增费用
@@ -212,7 +214,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
             return null;
         }
         String desc = BuildDescUtils.buildDesc(companyId, BeanUtil.copyToList(list, PtlAgreementUndwrtRulesAttr.class), agreementUndwrtRulesAttrService.getUndwrtRulesAttrList());
-        // 两个及以上相邻的逗号(中文","或英文",")合并为一个逗号
+        // buildDesc返回的条件间以相邻双逗号分隔,此处合并为单个分号
         return StringUtils.mergeAdjacentComma(desc);
     }
 
@@ -259,6 +261,14 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         }
         RList<SysDict> rules = redissonClient.getList(DICT_REDIS_KEY + "rule_operator");
         for (PtlAgreementCostRuleVo ruleCondition : ptlAgreementCostVo.getRuleConditions()) {
+            // LicenseNo/LicenseArea 属性中的车牌号、地区名称统一转换为地区编码
+            if (("LicenseNo".equals(ruleCondition.getAttrCode()) || "LicenseArea".equals(ruleCondition.getAttrCode()))
+                    && StringUtils.isNotEmpty(ruleCondition.getMin())) {
+                String value = ruleCondition.getMin();
+                value = ptlAreaLicenseService.convertLicense2AreaNumber(value);
+                value = ptlAreaLicenseService.convertAreaName2AreaNumber(value);
+                ruleCondition.setMin(value);
+            }
             String attrType = ruleCondition.getAttrType();
             if (StringUtils.isNotEmpty(attrType) && java.util.Arrays.stream(COST_TYPE_DICT_KEY).anyMatch(attrType::equals)){
                 if (StringUtils.isNotEmpty(ruleCondition.getMin()) && ruleCondition.getMin().contains(",")){

+ 6 - 126
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementUndwrtRulesServiceImpl.java

@@ -16,6 +16,7 @@ import com.jzg.commons.entity.vo.CostListVo;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.idgen.IdGenerate;
+import com.jzg.organization.component.BuildDescUtils;
 import com.jzg.organization.mapper.PtlAgreementUndwrtRulesAttrLinkMapper;
 import com.jzg.organization.mapper.PtlAgreementUndwrtRulesMapper;
 import com.jzg.organization.service.*;
@@ -195,7 +196,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
 
                 // andAttrLinks 为空时不设置 ruleDescription,避免 updateById 覆盖已有数据
                 if (CollUtil.isNotEmpty(andAttrLinks)) {
-                    rules.setRuleDescription(buildDesc(andAttrLinks, undwrtRulesAttrList));
+                    rules.setRuleDescription(BuildDescUtils.buildDesc(andAttrLinks, undwrtRulesAttrList));
                 }
                 baseMapper.insert(rules);
             }
@@ -219,7 +220,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
             }
         });
         agreementUndwrtRulesAttrLinkMapper.insert(costsAttrLink);
-        rules.setRuleDescription(buildDesc(costsAttrLink, undwrtRulesAttrList));
+        rules.setRuleDescription(BuildDescUtils.buildDesc(costsAttrLink, undwrtRulesAttrList));
         baseMapper.insert(rules);
         baseMapper.updateById(rules);
         return true;
@@ -393,7 +394,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
                 int currentOrderNum = isExisting ? oldOrderNum : ++maxOrderNum;
                 // ruleDescription:有新的属性链接则重新生成,否则保留旧值
                 String ruleDescription = CollUtil.isNotEmpty(andAttrLinks)
-                        ? buildDesc(andAttrLinks, undwrtRulesAttrList)
+                        ? BuildDescUtils.buildDesc(andAttrLinks, undwrtRulesAttrList)
                         : oldRuleDescription;
                 // 相邻的","或","转换为"或"字
                 ruleDescription = StringUtils.convertAdjacentCommaToOr(ruleDescription);
@@ -475,7 +476,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
         mergeAttrLinks(oldLinks, costsAttrLink);
         rules.setStartTime(param.getStartTime());
         rules.setEndTime(param.getEndTime());
-        rules.setRuleDescription(buildDesc(costsAttrLink, attrList));
+        rules.setRuleDescription(BuildDescUtils.buildDesc(costsAttrLink, attrList));
         baseMapper.updateById(rules);
         return true;
     }
@@ -658,7 +659,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
                 agreementUndwrtRulesAttrLinkMapper.insert(newAttrLinks);
             }
 
-            newRules.setRuleDescription(buildDesc(newAttrLinks, undwrtRulesAttrList));
+            newRules.setRuleDescription(BuildDescUtils.buildDesc(newAttrLinks, undwrtRulesAttrList));
             baseMapper.insert(newRules);
 
             // 组装返回的 groups
@@ -755,127 +756,6 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
         // 批量删除规则
         return baseMapper.deleteBatchIds(deleteRuleIds) > 0;
     }
-
-    /**
-     * 遍历费用属性描述文字
-     *
-     * @param linkList
-     * @param undwrtRulesAttrList
-     * @return
-     */
-    private String buildDesc(List<PtlAgreementUndwrtRulesAttrLink> linkList, List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList) {
-        StringBuilder desc = new StringBuilder();
-        for (int i = 0; i < linkList.size(); i++) {
-            int finalI = i;
-            PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr = undwrtRulesAttrList.stream()
-                    .filter(x -> x.getAttrCode().equals(linkList.get(finalI).getAttrCode()))
-                    .findAny()
-                    .get();
-
-            //数值范围判断
-
-            if ("inputNumber".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(inputNumberIdentifying(ptlAgreementUndwrtRulesAttr, linkList.get(i))).append(",");
-            }
-            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)));
-            }
-            if ("checkbox".equals(ptlAgreementUndwrtRulesAttr.getAttrType())) {
-                desc.append(checkBoxIdentifying(ptlAgreementUndwrtRulesAttr,linkList.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(",");
-                } else {
-                    desc.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("不包含").append(linkList.get(i).getMin()).append(",");
-                }
-            }
-        }
-        // 相邻的","或","转换为"或"字
-        return StringUtils.convertAdjacentCommaToOr(desc.toString());
-    }
-
-    private String radioIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
-        PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = ptlAgreementUndwrtRulesAttr.getDictLabal().stream().filter(x -> x.getCode().equals(ptlAgreementProductCostsAttrLink.getMin())).findAny().get();
-        return ptlAgreementUndwrtRulesAttr.getAttrName() + "为" + ptlAgreementUndwrtRulesDictLabal.getName();
-    }
-
-    private String selectIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
-        StringBuilder returnMsg = new StringBuilder();
-        returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
-        // 兼容 min 逗号分隔存储,保证 minArray 有值
-        if (ptlAgreementProductCostsAttrLink.getMinArray() == null) {
-            String minStr = ptlAgreementProductCostsAttrLink.getMin();
-            if (minStr != null && !minStr.isEmpty()) {
-                ptlAgreementProductCostsAttrLink.setMinArray(minStr.split(","));
-            }
-        }
-        // 优先取 link 上的字典标签列表(JSONArray -> List),为空时回退到属性自带字典
-        List<PtlAgreementUndwrtRulesDictLabal> dictLabalList = new ArrayList<>();
-        if (ptlAgreementProductCostsAttrLink.getDictLabal() != null && !ptlAgreementProductCostsAttrLink.getDictLabal().isEmpty()) {
-            dictLabalList = ptlAgreementProductCostsAttrLink.getDictLabal().toJavaList(PtlAgreementUndwrtRulesDictLabal.class);
-        } else if (ptlAgreementUndwrtRulesAttr.getDictLabal() != null) {
-            dictLabalList = ptlAgreementUndwrtRulesAttr.getDictLabal();
-        }
-        // 用字典标签的 code 匹配 minArray 中的每一项
-        if (ptlAgreementProductCostsAttrLink.getMinArray() != null) {
-            for (String item : ptlAgreementProductCostsAttrLink.getMinArray()) {
-                PtlAgreementUndwrtRulesDictLabal ptlAgreementUndwrtRulesDictLabal = dictLabalList.stream()
-                        .filter(x -> x.getCode() != null && x.getCode().equals(item)).findAny().orElse(null);
-                if (ptlAgreementUndwrtRulesDictLabal != null) {
-                    returnMsg.append(ptlAgreementUndwrtRulesDictLabal.getName()).append(",");
-                }
-            }
-        }
-        return returnMsg.toString();
-    }
-
-    private String checkBoxIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink linkList) {
-        StringBuilder returnMsg = new StringBuilder();
-        returnMsg.append(ptlAgreementUndwrtRulesAttr.getAttrName()).append("为");
-        if (linkList.getMinArray() == null) {
-            String minStr = linkList.getMin();
-            if (minStr != null && minStr.length() > 0) {
-                String[] minArray = minStr.split(",");
-                linkList.setMinArray(minArray);
-            }
-        }
-        if (linkList.getMinArray() != null) {
-            StringBuilder licenseInfo = new StringBuilder();
-            for(int i=0;i<linkList.getMinArray().length;i++) {
-                int finalI = i;
-                if(ptlAgreementUndwrtRulesAttr.getAttrCode().equals("LicenseNo") || ptlAgreementUndwrtRulesAttr.getAttrCode().equals("LicenseArea")) {
-                    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(",");
-                }
-            }
-            if(StrUtil.isNotEmpty(licenseInfo.toString())){
-                String licenseName = ptlAreaLicenseService.convertAreaNumber2License(licenseInfo.toString());
-                returnMsg.append(licenseName).append(",");
-            }
-        }
-        return returnMsg.toString();
-    }
-
-    private String inputNumberIdentifying(PtlAgreementUndwrtRulesAttr ptlAgreementUndwrtRulesAttr, PtlAgreementUndwrtRulesAttrLink ptlAgreementProductCostsAttrLink) {
-        if ("1".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "范围值" + ptlAgreementProductCostsAttrLink.getMin() + "到" + ptlAgreementProductCostsAttrLink.getMax();
-        } else if ("2".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于" + ptlAgreementProductCostsAttrLink.getMin();
-        } else if ("3".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "小于等于" + ptlAgreementProductCostsAttrLink.getMin();
-        } else if ("4".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于" + ptlAgreementProductCostsAttrLink.getMax();
-        } else if ("5".equals(ptlAgreementProductCostsAttrLink.getOperator())) {
-            return ptlAgreementUndwrtRulesAttr.getAttrName() + "大于等于" + ptlAgreementProductCostsAttrLink.getMax();
-        }
-        return "";
-    }
 }
 
 

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

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

@@ -310,7 +310,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
         //获取用户的角色 是否是管理员
         SysUser sysUser = userService.getById(userId);
         SysUserJzgInfo userJzgInfo = sysUserJzgInfoService.getOne(new LambdaQueryWrapper<SysUserJzgInfo>()
-                .eq(SysUserJzgInfo::getUserId, userId));
+                .eq(SysUserJzgInfo::getUserId, userId)
+                .eq(SysUserJzgInfo::getIsDelete, 0));
         List<String> userRoleName = userService.getUserRoleName(userId);
         if(userRoleName.contains("管理员")){
             throw new SystemException("管理员不允许变更机构或删除");

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

+ 3 - 0
tenant/organization/src/main/resources/mapper/PtlAgreementCostExternalMapper.xml

@@ -170,6 +170,9 @@
             <if test="costParam.productId != null and costParam.productId != ''">
                 AND ce.product_id = #{costParam.productId}
             </if>
+            <if test="costParam.ptlAgreementId != null and costParam.ptlAgreementId != ''">
+                AND ce.ptl_agreement_id = #{costParam.ptlAgreementId}
+            </if>
             <if test="costParam.rulesName != null and costParam.rulesName != ''">
                 AND ce.rule_description  like concat('%',#{costParam.rulesName},'%')
             </if>

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

@@ -410,12 +410,25 @@
                     #{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>
             <if test="costParam.auditTimeEnd != null and costParam.auditTimeEnd != ''">
                 and pc.audit_time &lt; #{costParam.auditTimeEnd}
             </if>
+            <if test="costParam.agreement != null and costParam.agreement != ''">
+            AND (pa.agreement_title  like concat('%',#{costParam.agreement},'%') or
+            pa.agreement_code  like concat('%',#{costParam.agreement},'%') or
+            pa.agreement_abbreviation  like concat('%',#{costParam.agreement},'%') or
+            pa.id = #{costParam.agreement})
+            </if>
             <if test="costParam.companyIdList != null and costParam.companyIdList.size() >0">
                 and pa.partner_company_id in
                 <foreach collection="costParam.companyIdList" item="partnerCompnayId" open="(" close=")" separator=",">

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