Quellcode durchsuchen

Merge remote-tracking branch 'origin/dev_jzg_lipf_v20260622' into dev_jzg_lipf_v20260622

lipf vor 3 Wochen
Ursprung
Commit
7a85561dcf
21 geänderte Dateien mit 379 neuen und 101 gelöschten Zeilen
  1. 6 0
      commons/src/main/java/com/jzg/commons/entity/dto/AgreementCopyParam.java
  2. 1 1
      commons/src/main/java/com/jzg/commons/entity/dto/InsOrdersParamVO.java
  3. 2 0
      commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeVo.java
  4. 13 2
      commons/src/main/java/com/jzg/commons/entity/vo/RuleAttrMappingVo.java
  5. 1 0
      gateway/src/main/resources/application-prod.yml
  6. 12 5
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/component/DaDiCrawlerRequestComponent.java
  7. 19 5
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiInsurancePlanRequest.java
  8. 21 0
      tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DadiInsuredInfoRequest.java
  9. 12 4
      tenant/insurance/quotation-hengbang/src/main/java/com/jzg/quotation/hengbang/crawler/service/Impl/HengBangCrawlerRequestImpl.java
  10. 4 0
      tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Response/HtCrawlerPaymentLinkResponse.java
  11. 24 0
      tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java
  12. 22 9
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/FactorMatch.java
  13. 11 11
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/AuditVerificationAspect.java
  14. 1 1
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java
  15. 16 9
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java
  16. 74 53
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersMapper.xml
  17. 4 0
      tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerQuoteRequest.java
  18. 12 0
      tenant/organization/src/main/java/com/jzg/organization/controller/AgreementController.java
  19. 2 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementService.java
  20. 120 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementServiceImpl.java
  21. 2 1
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

+ 6 - 0
commons/src/main/java/com/jzg/commons/entity/dto/AgreementCopyParam.java

@@ -18,4 +18,10 @@ public class AgreementCopyParam {
 //    @NotEmpty(message = "费用id不能为空")
 //    @NotEmpty(message = "费用id不能为空")
     @Schema(description = "费用id数组")
     @Schema(description = "费用id数组")
     private List<String> costIds;
     private List<String> costIds;
+
+    @Schema(description = "对接人")
+    private String dockingPerson;
+
+    @Schema(description = "对接人电话")
+    private String dockingPhone;
 }
 }

+ 1 - 1
commons/src/main/java/com/jzg/commons/entity/dto/InsOrdersParamVO.java

@@ -59,7 +59,7 @@ public class InsOrdersParamVO extends PageRequest {
     private String[] recordingTime;
     private String[] recordingTime;
 
 
     @Schema(description = "主订单标识")
     @Schema(description = "主订单标识")
-    private Integer parentId;
+    private String parentId;
 
 
     @Schema(description = "投保人")
     @Schema(description = "投保人")
     private String policyholder;
     private String policyholder;

+ 2 - 0
commons/src/main/java/com/jzg/commons/entity/scheme/vo/PtlSchemeVo.java

@@ -39,6 +39,8 @@ public class PtlSchemeVo extends PageRequest {
 
 
     @Schema(description = "规则描述")
     @Schema(description = "规则描述")
     private String ruleDesc;
     private String ruleDesc;
+    @Schema(description = "排序")
+    private String sort;
 
 
 
 
 }
 }

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

@@ -2,6 +2,7 @@ package com.jzg.commons.entity.vo;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.jzg.commons.constants.quote.enums.base.InsuranceEnum;
 import com.jzg.commons.constants.quote.enums.quote.CarKindCode;
 import com.jzg.commons.constants.quote.enums.quote.CarKindCode;
 import com.jzg.commons.constants.quote.enums.quote.KindCode;
 import com.jzg.commons.constants.quote.enums.quote.KindCode;
 import com.jzg.commons.constants.quote.enums.quote.VehicleUseCode;
 import com.jzg.commons.constants.quote.enums.quote.VehicleUseCode;
@@ -37,7 +38,7 @@ public class RuleAttrMappingVo {
     public static List<RuleAttrMappingVo> getRuleAttrMappingVoList(InsOrdersOther insOrdersOther,
     public static List<RuleAttrMappingVo> getRuleAttrMappingVoList(InsOrdersOther insOrdersOther,
                                                                    InsOrdersCarInfo insOrdersCarInfo, List<InsOrdersRisk> riskList,
                                                                    InsOrdersCarInfo insOrdersCarInfo, List<InsOrdersRisk> riskList,
                                                                    List<InsOrdersCarUserInfo> insOrdersCarUserInfos, List<InsOrdersKind> kindList,
                                                                    List<InsOrdersCarUserInfo> insOrdersCarUserInfos, List<InsOrdersKind> kindList,
-                                                                   InsOrdersCosts insOrdersCosts, InsOrdersAccidentalDriving insOrdersAccidentalDriving,Boolean isNewCar) {
+                                                                   InsOrdersCosts insOrdersCosts, InsOrdersAccidentalDriving insOrdersAccidentalDriving, Boolean isNewCar, String companyId) {
         List<RuleAttrMappingVo> ruleAttrMappingVoList = new ArrayList<>();
         List<RuleAttrMappingVo> ruleAttrMappingVoList = new ArrayList<>();
         //车牌号
         //车牌号
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseNo", insOrdersCarInfo.getLicenseNo()));
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("LicenseNo", insOrdersCarInfo.getLicenseNo()));
@@ -67,7 +68,17 @@ public class RuleAttrMappingVo {
         //注册日期
         //注册日期
 //        ruleAttrMappingVoList.add(new RuleAttrMappingVo("RegistrationDate", insOrdersCarInfo.getRegisterDate()));
 //        ruleAttrMappingVoList.add(new RuleAttrMappingVo("RegistrationDate", insOrdersCarInfo.getRegisterDate()));
         //是否过户
         //是否过户
-        ruleAttrMappingVoList.add(new RuleAttrMappingVo("Transfer", String.valueOf(insOrdersCarInfo.getTransfer())));
+        int transfer = insOrdersCarInfo.getTransfer();
+        //大地、中煤保司:发证日期距当前日期未满一年的标记为过户车
+        if (transfer != 1 && StringUtils.isNotBlank(companyId)
+                && (companyId.contains(InsuranceEnum.CCIC.getCode()) || companyId.contains(InsuranceEnum.ZMBX.getCode()))
+                && insOrdersCarInfo.getIssueDate() != null) {
+            LocalDate issueDate = insOrdersCarInfo.getIssueDate().toLocalDate();
+            if (issueDate.plusYears(1).isAfter(LocalDate.now())) {
+                transfer = 1;
+            }
+        }
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("Transfer", String.valueOf(transfer)));
         //交强起保日期
         //交强起保日期
         riskList.stream().filter(risk -> risk.getRiskCode().equals("0507"))
         riskList.stream().filter(risk -> risk.getRiskCode().equals("0507"))
                 .findFirst().ifPresent(risk -> ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime", risk.getStartDate().toString())));
                 .findFirst().ifPresent(risk -> ruleAttrMappingVoList.add(new RuleAttrMappingVo("JqStartTime", risk.getStartDate().toString())));

+ 1 - 0
gateway/src/main/resources/application-prod.yml

@@ -119,6 +119,7 @@ spring:
                   - /rightsGrant/**
                   - /rightsGrant/**
                   - /insOrderRights/**
                   - /insOrderRights/**
                   - /order/searchHistory/**
                   - /order/searchHistory/**
+                  - /insFeeOrder/updateAvailableAmount
 
 
         - id: costsorrule_route
         - id: costsorrule_route
           uri: http://172.24.144.225:8085/
           uri: http://172.24.144.225:8085/

+ 12 - 5
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/component/DaDiCrawlerRequestComponent.java

@@ -223,7 +223,7 @@ public class DaDiCrawlerRequestComponent {
                 vehicleModelVO = daDiVehicleChannelInfo.getCarModels().get(0);
                 vehicleModelVO = daDiVehicleChannelInfo.getCarModels().get(0);
             } else {
             } else {
                 for (DaDiVehicleChannelInfoResponse.CarModel item : daDiVehicleChannelInfo.getCarModels()) {
                 for (DaDiVehicleChannelInfoResponse.CarModel item : daDiVehicleChannelInfo.getCarModels()) {
-                    if (item.getSeatCount() >= Integer.parseInt(carInfo.getSeatCount()) || item.getPurchasePrice() == Double.parseDouble(carInfo.getPurchasePrice()) || TextUtils.isEmpty(carInfo.getCarYear()) ? true : item.getMarketYear() == carInfo.getCarYear()) {
+                    if (item.getSeatCount() >= Integer.parseInt(carInfo.getSeatCount()) || item.getPurchasePrice() == Double.parseDouble(carInfo.getPurchasePrice()) || TextUtils.isEmpty(carInfo.getCarYear()) || item.getMarketYear() == carInfo.getCarYear()) {
                         vehicleModelVO = item;
                         vehicleModelVO = item;
                         break;
                         break;
                     }
                     }
@@ -231,7 +231,7 @@ public class DaDiCrawlerRequestComponent {
                         vehicleModelVO = item;
                         vehicleModelVO = item;
                         break;
                         break;
                     }
                     }
-                    if (item.getSeatCount() >= Integer.parseInt(carInfo.getSeatCount()) || TextUtils.isEmpty(carInfo.getCarYear()) ? true : item.getMarketYear() == carInfo.getCarYear()) {
+                    if (item.getSeatCount() >= Integer.parseInt(carInfo.getSeatCount()) || TextUtils.isEmpty(carInfo.getCarYear()) || item.getMarketYear() == carInfo.getCarYear()) {
                         vehicleModelVO = item;
                         vehicleModelVO = item;
                         break;
                         break;
                     }
                     }
@@ -494,8 +494,11 @@ public class DaDiCrawlerRequestComponent {
         if (TextUtils.isEmpty(startTime) && !TextUtils.isEmpty(trafficErrorMessage)) {
         if (TextUtils.isEmpty(startTime) && !TextUtils.isEmpty(trafficErrorMessage)) {
             Matcher jqMatcher = JQ_PATTERN.matcher(trafficErrorMessage);
             Matcher jqMatcher = JQ_PATTERN.matcher(trafficErrorMessage);
             if (jqMatcher.find()) {
             if (jqMatcher.find()) {
-                startTime = jqMatcher.group(1);
-                endTime = jqMatcher.group(2);
+                // 起保时间取终保日期(老保单终保时间),endTime 为终保时间一年后
+                String endDateStr = jqMatcher.group(2);
+                startTime = endDateStr;
+                String beginDateStr = DateUtil.strAllToDateToStr(endDateStr + ":00", "yyyy-MM-dd HH:mm:ss", "yyyyMMddHHmmss");
+                endTime = DateUtil.getNextYearDateStrTranfer(beginDateStr);
             } else {
             } else {
                 throw new ValidateException(trafficErrorMessage);
                 throw new ValidateException(trafficErrorMessage);
             }
             }
@@ -507,6 +510,10 @@ public class DaDiCrawlerRequestComponent {
             ciRisk.setStartDate(startTime);
             ciRisk.setStartDate(startTime);
             ciRisk.setEndDate(endTime);
             ciRisk.setEndDate(endTime);
             quoteVo.setCiRiskInfoVo(ciRisk);
             quoteVo.setCiRiskInfoVo(ciRisk);
+            RiskInfoVo biRisk = quoteVo.getBiRiskInfoVo();
+            biRisk.setStartDate(startTime);
+            biRisk.setEndDate(endTime);
+            quoteVo.setBiRiskInfoVo(biRisk);
             return getDaDiQuote(headers, orderId, new ArrayList<>(), quoteVo, daDiVehicleChannelRequest, vehicleModelVO, agentInfoVo, vehiclePricVo);
             return getDaDiQuote(headers, orderId, new ArrayList<>(), quoteVo, daDiVehicleChannelRequest, vehicleModelVO, agentInfoVo, vehiclePricVo);
         }
         }
 
 
@@ -784,7 +791,7 @@ public class DaDiCrawlerRequestComponent {
                 // 获取文件名
                 // 获取文件名
                 String fileName = uploadFile.getFileName();
                 String fileName = uploadFile.getFileName();
                 // 获取文件流
                 // 获取文件流
-                String imgUrl = minioUtils.getPresignedObjectUrl(uploadFile.getBucketName(), fileName);
+                String imgUrl = MinioUtils.getPresignedObjectUrl(uploadFile.getBucketName(), fileName);
                 log.info("大地影像上传,获取文件预签名URL,imgUrl:{}", imgUrl);
                 log.info("大地影像上传,获取文件预签名URL,imgUrl:{}", imgUrl);
                 InputStream inputStream = minioUtils.getObject(uploadFile.getBucketName(), fileName);
                 InputStream inputStream = minioUtils.getObject(uploadFile.getBucketName(), fileName);
                 log.info("大地影像上传,获取获取文件流,inputStream:{}", inputStream);
                 log.info("大地影像上传,获取获取文件流,inputStream:{}", inputStream);

+ 19 - 5
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DaDiInsurancePlanRequest.java

@@ -14,7 +14,10 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.NotNull;
 
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @author Liub
  * @author Liub
@@ -389,8 +392,8 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
         RiskInfoVo biRisk = quoteVo.getBiRiskInfoVo();
         RiskInfoVo biRisk = quoteVo.getBiRiskInfoVo();
         if (biRisk != null) {
         if (biRisk != null) {
             this.businessChecked = "1";
             this.businessChecked = "1";
-            this.businessEffectiveStartDate = biRisk.getStartDate();
-            this.businessEffectiveEndDate = biRisk.getEndDate();
+            this.businessEffectiveStartDate = normalizeEffectiveDate(biRisk.getStartDate());
+            this.businessEffectiveEndDate = normalizeEffectiveDate(biRisk.getEndDate());
             this.businessIsEffective = biRisk.isInstantFlag() ? "1" : "0";
             this.businessIsEffective = biRisk.isInstantFlag() ? "1" : "0";
         } else {
         } else {
             this.businessChecked = "0";
             this.businessChecked = "0";
@@ -424,8 +427,8 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
         RiskInfoVo ciRisk = quoteVo.getCiRiskInfoVo();
         RiskInfoVo ciRisk = quoteVo.getCiRiskInfoVo();
         if (ciRisk != null) {
         if (ciRisk != null) {
             this.trafficChecked = "1";
             this.trafficChecked = "1";
-            this.trafficEffectiveStartDate = ciRisk.getStartDate();
-            this.trafficEffectiveEndDate = ciRisk.getEndDate();
+            this.trafficEffectiveStartDate = normalizeEffectiveDate(ciRisk.getStartDate());
+            this.trafficEffectiveEndDate = normalizeEffectiveDate(ciRisk.getEndDate());
             this.trafficIsEffective = ciRisk.isInstantFlag() ? "1" : "0";
             this.trafficIsEffective = ciRisk.isInstantFlag() ? "1" : "0";
             this.trafficSumInsured = 200000;
             this.trafficSumInsured = 200000;
             if (ciRisk.getRiskCode().contains("B") || ciRisk.getRiskCode().contains("D3")) {
             if (ciRisk.getRiskCode().contains("B") || ciRisk.getRiskCode().contains("D3")) {
@@ -631,6 +634,17 @@ public class DaDiInsurancePlanRequest extends DaDiBaseRequest {
         }
         }
     }
     }
 
 
+    static String normalizeEffectiveDate(String dateTime) {
+        if (dateTime == null) {
+            return null;
+        }
+        String normalized = dateTime.trim();
+        if (normalized.matches("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}")) {
+            return normalized + ":00";
+        }
+        return normalized;
+    }
+
     @NotNull
     @NotNull
     private static Tax getTax(QuoteVo quoteVo, DaDiTaxConfigResponse taxConfig) {
     private static Tax getTax(QuoteVo quoteVo, DaDiTaxConfigResponse taxConfig) {
         Tax tax = new Tax();
         Tax tax = new Tax();

+ 21 - 0
tenant/insurance/quotation-dadi/src/main/java/com/jzg/quotation/dadi/crawler/entity/request/DadiInsuredInfoRequest.java

@@ -1,12 +1,14 @@
 package com.jzg.quotation.dadi.crawler.entity.request;
 package com.jzg.quotation.dadi.crawler.entity.request;
 
 
 import com.jzg.commons.entity.quote.vo.CarInfoVo;
 import com.jzg.commons.entity.quote.vo.CarInfoVo;
+import com.jzg.commons.entity.quote.vo.CustomerInfoVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiCurTaskResponse;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiCurTaskResponse;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiQuoteResponse;
 import com.jzg.quotation.dadi.crawler.entity.response.DaDiQuoteResponse;
 import com.jzg.quotation.dadi.utils.DaDiVehicleUtils;
 import com.jzg.quotation.dadi.utils.DaDiVehicleUtils;
 import lombok.Data;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
+import org.springframework.util.StringUtils;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
@@ -103,6 +105,25 @@ public class DadiInsuredInfoRequest {
                                   String comCode, String userCode) {
                                   String comCode, String userCode) {
         DaDiApplicantInfoRequest applicant = new DaDiApplicantInfoRequest(quoteVo.getPolicyHolderInfo());
         DaDiApplicantInfoRequest applicant = new DaDiApplicantInfoRequest(quoteVo.getPolicyHolderInfo());
         DaDiApplicantInfoRequest insured = new DaDiApplicantInfoRequest(quoteVo.getInsuredPersonInfo());
         DaDiApplicantInfoRequest insured = new DaDiApplicantInfoRequest(quoteVo.getInsuredPersonInfo());
+        // 投保人/被保人与车辆关系(relationFlag 与 vehicleRelation 同步设置):
+        // 1-所有 2-使用 3-管理;被保人与车主不为同一人时,关系不能为"所有",
+        // 按车主证件号判断:同一人则"所有",不同一人则"使用"
+        CustomerInfoVo owner = quoteVo.getOwnersInfo();
+        CustomerInfoVo insuredPerson = quoteVo.getInsuredPersonInfo();
+        CustomerInfoVo policyHolder = quoteVo.getPolicyHolderInfo();
+        if (owner != null && StringUtils.hasText(owner.getIdentifyNumber())) {
+            String ownerIdentifyNumber = owner.getIdentifyNumber();
+            if (insuredPerson != null && StringUtils.hasText(insuredPerson.getIdentifyNumber())) {
+                String insuredRelation = ownerIdentifyNumber.equals(insuredPerson.getIdentifyNumber()) ? "1" : "2";
+                insured.setRelationFlag(insuredRelation);
+                insured.setVehicleRelation(insuredRelation);
+            }
+            if (policyHolder != null && StringUtils.hasText(policyHolder.getIdentifyNumber())) {
+                String applicantRelation = ownerIdentifyNumber.equals(policyHolder.getIdentifyNumber()) ? "1" : "2";
+                applicant.setRelationFlag(applicantRelation);
+                applicant.setVehicleRelation(applicantRelation);
+            }
+        }
         DadiInvoiceRequest invoice = new DadiInvoiceRequest(quoteVo);
         DadiInvoiceRequest invoice = new DadiInvoiceRequest(quoteVo);
         this.orderId = orderId;
         this.orderId = orderId;
         this.applicant = applicant;
         this.applicant = applicant;

+ 12 - 4
tenant/insurance/quotation-hengbang/src/main/java/com/jzg/quotation/hengbang/crawler/service/Impl/HengBangCrawlerRequestImpl.java

@@ -198,12 +198,20 @@ public class HengBangCrawlerRequestImpl implements HengBangCrawlerRequest {
             // 统一调整为次日北京时间0点(已0点则不变),避免继续判定为重复投保
             // 统一调整为次日北京时间0点(已0点则不变),避免继续判定为重复投保
             utcTime = DateUtil.getNextDayMidnightUtc(utcTime);
             utcTime = DateUtil.getNextDayMidnightUtc(utcTime);
 
 
-            // 根据重复投保类型分别设置起保时间:交强险只改 begintimeCi,商业险只改 begintimeBi
-            // 注意:商业险错误信息不含"商业险平台返回",故通过"交强险平台返回"反推
-            if (errorMsg.contains("交强险平台返回")) {
+            // 根据本次投保险种类型分别设置起保时间:
+            // 单交(仅交强险)只改 begintimeCi,单商(仅商业险)只改 begintimeBi;
+            // 交商(交强险+商业险同时投保)时商业险时间和交强险时间都需要修改,否则仅改其一仍会被判定重复投保
+            boolean hasCiRisk = quoteVo.getCiRiskInfoVo() != null;
+            boolean hasBiRisk = CollUtil.isNotEmpty(quoteVo.getKindInfoVo());
+            if (hasCiRisk && hasBiRisk) {
+                // 交商:商业险、交强险起保时间都修改
+                calculationRequest.setBegintimeCi(utcTime);
+                calculationRequest.setBegintimeBi(utcTime);
+            } else if (hasCiRisk) {
+                // 单交:仅修改交强险起保时间
                 calculationRequest.setBegintimeCi(utcTime);
                 calculationRequest.setBegintimeCi(utcTime);
             } else {
             } else {
-                // 不含交强险标识则为商业险重复投保
+                // 单商:仅修改商业险起保时间
                 calculationRequest.setBegintimeBi(utcTime);
                 calculationRequest.setBegintimeBi(utcTime);
             }
             }
             // 驾意险不支持即时起保:北京时间0点则直接复用,非0点则自动设为下一日0点
             // 驾意险不支持即时起保:北京时间0点则直接复用,非0点则自动设为下一日0点

+ 4 - 0
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Response/HtCrawlerPaymentLinkResponse.java

@@ -22,4 +22,8 @@ public class HtCrawlerPaymentLinkResponse implements Serializable {
      */
      */
     private String img;
     private String img;
     private Integer sumAmount;
     private Integer sumAmount;
+    /**
+     * 获取支付链接结果描述
+     */
+    private String resMsg;
 }
 }

+ 24 - 0
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java

@@ -951,8 +951,21 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         paymentLinkVo.setOrder(vo.getOrder());
         paymentLinkVo.setOrder(vo.getOrder());
         HtCrawlerPaymentLinkResponse pl = queryPaymentLink(order, params, paymentLinkVo);
         HtCrawlerPaymentLinkResponse pl = queryPaymentLink(order, params, paymentLinkVo);
         log.info("handlePassedUnderwriting_paymentLinkResponse: {}", JSONObject.toJSONString(pl));
         log.info("handlePassedUnderwriting_paymentLinkResponse: {}", JSONObject.toJSONString(pl));
+        if ("N".equals(pl.getErrorInfo())) {
+            r.setUnderwritingStatus(InsOrderStatusEnum.AUDIT_FAIL);
+            if (StringUtils.isBlank(pl.getResMsg())) {
+                r.setUnderwritingResult("华表财险提核--:很抱歉,无法进行支付,具体可咨询分公司承保部,谢谢!");
+            } else {
+                r.setUnderwritingResult(pl.getResMsg());
+            }
+            orderService.update(order);
+            return r;
+        }
+
         if (pl == null || pl.getImg() == null) {
         if (pl == null || pl.getImg() == null) {
             orderService.update(order);
             orderService.update(order);
+            r.setUnderwritingStatus(InsOrderStatusEnum.AUDIT_FAIL);
+            r.setUnderwritingResult("华表财险提核--:很抱歉,无法进行支付,具体可咨询分公司承保部,谢谢!");
             return r;
             return r;
         }
         }
         r.setPaymentLink(pl.getImg());
         r.setPaymentLink(pl.getImg());
@@ -969,6 +982,17 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
         HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
         HtCrawlerConfigureParameters params = ConfigureParametersConversion.conversionEntity(
                 HtCrawlerConfigureParameters.class, attr.getConfigInfo());
                 HtCrawlerConfigureParameters.class, attr.getConfigInfo());
         HtCrawlerPaymentLinkResponse pl = queryPaymentLink(order, params, vo);
         HtCrawlerPaymentLinkResponse pl = queryPaymentLink(order, params, vo);
+        if ("N".equals(pl.getErrorInfo())) {
+            PaymentLinkResultsVo r = new PaymentLinkResultsVo();
+            r.setPayLinkStatus(false);
+            if (StringUtils.isBlank(pl.getResMsg())) {
+                r.setErrorMsg("华表财险提核--:很抱歉,无法进行支付,具体可咨询分公司承保部,谢谢!");
+            } else {
+                r.setErrorMsg(pl.getResMsg());
+            }
+            orderService.update(order);
+            return r;
+        }
         if (pl == null || pl.getImg() == null) {
         if (pl == null || pl.getImg() == null) {
             return new PaymentLinkResultsVo(false, null, "暂时获取不到支付链接,请耐心等待~");
             return new PaymentLinkResultsVo(false, null, "暂时获取不到支付链接,请耐心等待~");
         }
         }

+ 22 - 9
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/FactorMatch.java

@@ -304,8 +304,6 @@ public class FactorMatch {
                 if (CollUtil.isNotEmpty(collect)) {
                 if (CollUtil.isNotEmpty(collect)) {
                     logs.append("<span style=\"color:red;\">规则匹配失败:" + collect.get(0).getAttrName() + "</span>\n");
                     logs.append("<span style=\"color:red;\">规则匹配失败:" + collect.get(0).getAttrName() + "</span>\n");
                 }
                 }
-                //如果有一个匹配上就返回
-                return true;
             }
             }
         }
         }
         log.info("承保规则校验-所有条件均未命中, 规则组通过, useFlag={}", useFlag);
         log.info("承保规则校验-所有条件均未命中, 规则组通过, useFlag={}", useFlag);
@@ -330,7 +328,22 @@ public class FactorMatch {
         // 字典还原依据:参与比较的这条因子元数据 ptlAgreementUndwrtRulesAttr 自身挂的 dictId,
         // 字典还原依据:参与比较的这条因子元数据 ptlAgreementUndwrtRulesAttr 自身挂的 dictId,
         // 再到 undwrtRulesDictList 中按 name 找 code(如 "家庭自用" -> "04")。
         // 再到 undwrtRulesDictList 中按 name 找 code(如 "家庭自用" -> "04")。
         Integer dictId = ptlAgreementUndwrtRulesAttr.getDictId();
         Integer dictId = ptlAgreementUndwrtRulesAttr.getDictId();
-
+        // ===== 新增:把传入的 name 还原成 code 再参与比较 =====
+        // 只对依赖字典的 select/radio/checkbox 做还原;input/inputNumber/date 等保留原值
+        if (CollUtil.isNotEmpty(undwrtRulesDictList)
+                && dictId != null
+                && !ptlAgreementCostRule.getAttrCode().equals("LicenseArea") // 车牌归属地无字典,纯文本
+                && !ptlAgreementCostRule.getAttrCode().equals("LicenseNo")) {
+            String normalized = value;
+            for (PtlAgreementUndwrtRulesDictLabal label : undwrtRulesDictList) {
+                if (Objects.equals(label.getDictId(), dictId) && label.getName().equals(value)) {
+                    normalized = label.getCode();
+                    break;
+                }
+            }
+            value = normalized;
+        }
+        // ====================================================
         boolean result = false;
         boolean result = false;
         if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("checkbox")) {
         if (ptlAgreementUndwrtRulesAttr.getAttrType().equals("checkbox")) {
             result = checkBoxEqual(ptlAgreementCostRule, value, dictId, undwrtRulesDictList);
             result = checkBoxEqual(ptlAgreementCostRule, value, dictId, undwrtRulesDictList);
@@ -382,9 +395,6 @@ public class FactorMatch {
         String[] split = ptlAgreementCostRule.getMin().split(",");
         String[] split = ptlAgreementCostRule.getMin().split(",");
         for (String sp : split) {
         for (String sp : split) {
             String spTrim = sp.trim();
             String spTrim = sp.trim();
-            if (spTrim.equals(value.trim())) {
-                return true;
-            }
             if (dictId == null && CollUtil.isNotEmpty(undwrtRulesDictList)) {
             if (dictId == null && CollUtil.isNotEmpty(undwrtRulesDictList)) {
                 for (PtlAgreementUndwrtRulesDictLabal label : undwrtRulesDictList) {
                 for (PtlAgreementUndwrtRulesDictLabal label : undwrtRulesDictList) {
                     if (label.getCode().equals(spTrim) && value.trim().equals(label.getName())) {
                     if (label.getCode().equals(spTrim) && value.trim().equals(label.getName())) {
@@ -392,6 +402,9 @@ public class FactorMatch {
                     }
                     }
                 }
                 }
             }
             }
+            if (spTrim.equals(value.trim())) {
+                return true;
+            }
         }
         }
         return false;
         return false;
     }
     }
@@ -510,9 +523,6 @@ public class FactorMatch {
             }
             }
         } else {
         } else {
             // dictId 为空时(无字典):把 min 里的 code 翻成 name,再用实际 value(汉字)与 name 比较
             // dictId 为空时(无字典):把 min 里的 code 翻成 name,再用实际 value(汉字)与 name 比较
-            if (ptlAgreementCostRule.getMin().contains(value)) {
-                return true;
-            }
             if (dictId == null && CollUtil.isNotEmpty(undwrtRulesDictList)) {
             if (dictId == null && CollUtil.isNotEmpty(undwrtRulesDictList)) {
                 for (PtlAgreementUndwrtRulesDictLabal label : undwrtRulesDictList) {
                 for (PtlAgreementUndwrtRulesDictLabal label : undwrtRulesDictList) {
                     if (label.getCode().equals(ptlAgreementCostRule.getMin()) && value.equals(label.getName())) {
                     if (label.getCode().equals(ptlAgreementCostRule.getMin()) && value.equals(label.getName())) {
@@ -520,6 +530,9 @@ public class FactorMatch {
                     }
                     }
                 }
                 }
             }
             }
+            if (ptlAgreementCostRule.getMin().contains(value)) {
+                return true;
+            }
         }
         }
         return false;
         return false;
     }
     }

+ 11 - 11
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/AuditVerificationAspect.java

@@ -142,7 +142,7 @@ public class AuditVerificationAspect {
                     "协议已失效,请重新报价"
                     "协议已失效,请重新报价"
                 );
                 );
                 AssertionUtils.isFail(
                 AssertionUtils.isFail(
-                    agreementVo.getIsEnable() != null && "1".equals(agreementVo.getIsEnable().toString()),
+                    agreementVo.getIsEnable() != null && "1".equals(agreementVo.getIsEnable()),
                     "协议已停用,请重新报价"
                     "协议已停用,请重新报价"
                 );
                 );
 
 
@@ -193,7 +193,7 @@ public class AuditVerificationAspect {
                         e);
                         e);
                 throw new SystemException("承保规则校验服务暂时不可用,请稍后重试");
                 throw new SystemException("承保规则校验服务暂时不可用,请稍后重试");
             } catch (Exception e) {
             } catch (Exception e) {
-                log.error("承保规则校验异常, {}", logs.toString(), e);
+                log.error("承保规则校验异常, {}", logs, e);
                 throw new SystemException("承保规则校验异常,"+e.getMessage());
                 throw new SystemException("承保规则校验异常,"+e.getMessage());
             }
             }
         }
         }
@@ -210,12 +210,12 @@ public class AuditVerificationAspect {
         boolean isNewCar = false;
         boolean isNewCar = false;
         if(comparenew.getCode()== 200) {
         if(comparenew.getCode()== 200) {
             // 新旧车判断
             // 新旧车判断
-            isNewCar = comparenew.getData().equals("true") ? true : false;
+            isNewCar = comparenew.getData().equals("true");
         }
         }
         List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = orgClient.list().getData();
         List<PtlAgreementUndwrtRulesAttr> undwrtRulesAttrList = orgClient.list().getData();
         //获取所有费用属性关联
         //获取所有费用属性关联
         List<RuleAttrMappingVo> ruleAttrMappingVoList = RuleAttrMappingVo.getRuleAttrMappingVoList(insOrdersOther,insOrdersCarInfo,
         List<RuleAttrMappingVo> ruleAttrMappingVoList = RuleAttrMappingVo.getRuleAttrMappingVoList(insOrdersOther,insOrdersCarInfo,
-                riskList, insOrdersCarUserInfos, kindList, insOrdersCosts, insOrdersAccidentalDriving, isNewCar);
+                riskList, insOrdersCarUserInfos, kindList, insOrdersCosts, insOrdersAccidentalDriving, isNewCar, insOrders.getCompanyId());
 
 
         List<PtlAgreementUndwrtRulesDictLabal> undwrtRulesDictList = ptlNewAgreementClient.getUndwrtRulesDictList();
         List<PtlAgreementUndwrtRulesDictLabal> undwrtRulesDictList = ptlNewAgreementClient.getUndwrtRulesDictList();
 
 
@@ -250,20 +250,20 @@ public class AuditVerificationAspect {
             // 有一个匹配上  或者都没匹配上 都返回true
             // 有一个匹配上  或者都没匹配上 都返回true
             boolean ruleMatched = FactorMatch.judgementsUnderwrite(ptlAgreementUndwrtRulesNews, ruleAttrMappingVoList, undwrtRulesAttrList, ruleLogs, undwrtRulesDictList);
             boolean ruleMatched = FactorMatch.judgementsUnderwrite(ptlAgreementUndwrtRulesNews, ruleAttrMappingVoList, undwrtRulesAttrList, ruleLogs, undwrtRulesDictList);
 
 
-            log.info("规则组[{}]匹配结果: ruleMatched={}, 错误日志=[{}]", groupIndex, ruleMatched, ruleLogs.toString());
+            log.info("规则组[{}]匹配结果: ruleMatched={}, 错误日志=[{}]", groupIndex, ruleMatched, ruleLogs);
 
 
-            if (ruleMatched && StringUtils.isNotBlank(ruleLogs)) {//ruleLogs 不为空 表示有一个匹配上
+            allErrorLogs.append(ruleLogs);
+
+            if (ruleMatched) {
                 anyRuleMatched = true;
                 anyRuleMatched = true;
                 log.info("规则组[{}]匹配成功, 订单通过!", groupIndex);
                 log.info("规则组[{}]匹配成功, 订单通过!", groupIndex);
-                log.info("=== 承保规则校验成功,规则组[{}]通过 ===", groupIndex);
-                throw new SystemException(ruleLogs.toString());
+                break; // OR关系:任一条规则通过即可
             }
             }
-            allErrorLogs.append(ruleLogs);
         }
         }
 
 
         if (!anyRuleMatched) {
         if (!anyRuleMatched) {
-            log.info("=== 承保规则校验失败, 所有规则组均未通过 ===");
-            log.info("=== 承保规则校验需要通过 ===");
+            log.info("=== 承保规则校验失败, 所有规则组均未通过, 抛出异常 ===");
+            throw new SystemException(allErrorLogs.toString());
         }
         }
     }
     }
 
 

+ 1 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java

@@ -257,7 +257,7 @@ public class QuoteVerificationAspect {
 //        }
 //        }
         //获取所有费用属性关联
         //获取所有费用属性关联
         List<RuleAttrMappingVo> ruleAttrMappingVoList = RuleAttrMappingVo.getRuleAttrMappingVoList(insOrdersOther,insOrdersCarInfo,
         List<RuleAttrMappingVo> ruleAttrMappingVoList = RuleAttrMappingVo.getRuleAttrMappingVoList(insOrdersOther,insOrdersCarInfo,
-                riskList, insOrdersCarUserInfos, kindList, insOrdersCosts, insOrdersAccidentalDriving, isNewCar);
+                riskList, insOrdersCarUserInfos, kindList, insOrdersCosts, insOrdersAccidentalDriving, isNewCar, insOrders.getCompanyId());
 
 
         // 字典数据在一次报价内是只读不变的,提到循环外避免N+1远程调用
         // 字典数据在一次报价内是只读不变的,提到循环外避免N+1远程调用
         // 修复批量报价时该方法被 organization 服务打爆的问题
         // 修复批量报价时该方法被 organization 服务打爆的问题

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

@@ -723,7 +723,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 List<InsOrdersPolicy> list = insOrdersPolicyService.list(wrapper);
                 List<InsOrdersPolicy> list = insOrdersPolicyService.list(wrapper);
                 if(list != null && !list.isEmpty()){
                 if(list != null && !list.isEmpty()){
                     // 修改订单时,排除原订单的问题
                     // 修改订单时,排除原订单的问题
-                    if(!list.get(0).getOrderNo().equals(insOrdersExternalPolicy.getOrderNo())){
+                    if(!list.get(0).getOrderNo().equals(ordersEnd.getInsOrders().getId())){
                         return HttpResult.error("该交强险保单号信息已存在!");
                         return HttpResult.error("该交强险保单号信息已存在!");
                     }
                     }
                 }
                 }
@@ -733,7 +733,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 wrapper.eq(InsOrdersPolicy::getSyPolicyNo, insOrdersExternalPolicy.getSyPolicy());
                 wrapper.eq(InsOrdersPolicy::getSyPolicyNo, insOrdersExternalPolicy.getSyPolicy());
                 List<InsOrdersPolicy> list = insOrdersPolicyService.list(wrapper);
                 List<InsOrdersPolicy> list = insOrdersPolicyService.list(wrapper);
                 if(list != null && !list.isEmpty()){
                 if(list != null && !list.isEmpty()){
-                    if(!list.get(0).getOrderNo().equals(insOrdersExternalPolicy.getOrderNo())){
+                    if(!list.get(0).getOrderNo().equals(ordersEnd.getInsOrders().getId())){
                         return HttpResult.error("该商业保单号信息已存在!");
                         return HttpResult.error("该商业保单号信息已存在!");
                     }
                     }
                 }
                 }
@@ -1566,6 +1566,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Override
     @Override
     public String exportDynamicFields(InsOrdersParamVO insOrdersParam) {
     public String exportDynamicFields(InsOrdersParamVO insOrdersParam) {
         log.info("导出订单列表。支持动态选择要导出的字段:导出车险订单=[{}]", JSONUtil.toJsonStr(insOrdersParam));
         log.info("导出订单列表。支持动态选择要导出的字段:导出车险订单=[{}]", JSONUtil.toJsonStr(insOrdersParam));
+        insOrdersParam.setSystemCode(baseController.getSystemCode());
         List<OrderListVo> orderListVos = insOrdersMapper.queryOrderListAll(insOrdersParam);
         List<OrderListVo> orderListVos = insOrdersMapper.queryOrderListAll(insOrdersParam);
         log.info("导出订单列表,导出[{}]条记录", CollUtil.size(orderListVos));
         log.info("导出订单列表,导出[{}]条记录", CollUtil.size(orderListVos));
         // 动态设置要导出的字段
         // 动态设置要导出的字段
@@ -2293,9 +2294,13 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         BigDecimal jqAddThrow = nvl(request.getJqAddThrow());
         BigDecimal jqAddThrow = nvl(request.getJqAddThrow());
         BigDecimal syAddThrow = nvl(request.getSyAddThrow());
         BigDecimal syAddThrow = nvl(request.getSyAddThrow());
         BigDecimal jyAddThrow = nvl(request.getJyAddThrow());
         BigDecimal jyAddThrow = nvl(request.getJyAddThrow());
-        BigDecimal jqExport = this.calExportByIsRecordByLeader(request.isIsrecordByLeader(), nvl(request.getJqExport()));
-        BigDecimal syExport = this.calExportByIsRecordByLeader(request.isIsrecordByLeader(), nvl(request.getSyExport()));
-        BigDecimal jyExport = this.calExportByIsRecordByLeader(request.isIsrecordByLeader(), nvl(request.getJyExport()));
+        // 代课录单扣减1
+
+        BigDecimal jqExport = nvl(request.getJqExport());
+        BigDecimal syExport = nvl(request.getSyExport());
+        BigDecimal jyExport = nvl(request.getJyExport());
+
+
 
 
         BigDecimal jqEKP = nvl(request.getJqKeepPointRatio());
         BigDecimal jqEKP = nvl(request.getJqKeepPointRatio());
         BigDecimal syEKP = nvl(request.getSyKeepPointRatio());
         BigDecimal syEKP = nvl(request.getSyKeepPointRatio());
@@ -2382,13 +2387,15 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         feeOrders.setSyKeepPointRatio(div100(nvl(feeOrders.getSyKeepPointRatio())));
         feeOrders.setSyKeepPointRatio(div100(nvl(feeOrders.getSyKeepPointRatio())));
         feeOrders.setJyKeepPointRatio(div100(nvl(feeOrders.getJyKeepPointRatio())));
         feeOrders.setJyKeepPointRatio(div100(nvl(feeOrders.getJyKeepPointRatio())));
 
 
-        // 出口比例 = 入口比例 +加投比例 - 分销比例 -留点比例
+        // 出口比例 = 入口比例 +加投比例 - 分销比例 -留点比例-代课录单比例
         BigDecimal firstDist = nvl(feeOrders.getFirstDistributionRatio());
         BigDecimal firstDist = nvl(feeOrders.getFirstDistributionRatio());
         BigDecimal secondDist = nvl(feeOrders.getSecondDistributionRatio());
         BigDecimal secondDist = nvl(feeOrders.getSecondDistributionRatio());
         BigDecimal thirdDist = nvl(feeOrders.getThirdDistributionRatio());
         BigDecimal thirdDist = nvl(feeOrders.getThirdDistributionRatio());
-        feeOrders.setJqExportRatio(jqInlet.compareTo(BigDecimal.ZERO) > 0 ? div100(jqInlet).add(div100(request.getJqAddThrow())).subtract(div100(firstDist)).subtract(div100(secondDist)).subtract(div100(thirdDist)).subtract(div100(jqEKP)) : BigDecimal.ZERO);
-        feeOrders.setSyExportRatio(syInlet.compareTo(BigDecimal.ZERO) > 0 ? div100(syInlet).add(div100(request.getSyAddThrow())).subtract(div100(firstDist)).subtract(div100(secondDist)).subtract(div100(thirdDist)).subtract(div100(syEKP)) : BigDecimal.ZERO);
-        feeOrders.setJyExportRatio(jyInlet.compareTo(BigDecimal.ZERO) > 0 ? div100(jyInlet).add(div100(request.getJyAddThrow())).subtract(div100(firstDist)).subtract(div100(secondDist)).subtract(div100(thirdDist)).subtract(div100(jyEKP)) : BigDecimal.ZERO);
+        // 代课录单比例
+        BigDecimal IsrecordByLeader = request.isIsrecordByLeader() ? new BigDecimal("0.01") :BigDecimal.ZERO;
+        feeOrders.setJqExportRatio(jqInlet.compareTo(BigDecimal.ZERO) > 0 ? div100(jqInlet).add(div100(request.getJqAddThrow())).subtract(div100(firstDist)).subtract(div100(secondDist)).subtract(div100(thirdDist)).subtract(div100(jqEKP)).subtract(IsrecordByLeader) : BigDecimal.ZERO);
+        feeOrders.setSyExportRatio(syInlet.compareTo(BigDecimal.ZERO) > 0 ? div100(syInlet).add(div100(request.getSyAddThrow())).subtract(div100(firstDist)).subtract(div100(secondDist)).subtract(div100(thirdDist)).subtract(div100(syEKP)).subtract(IsrecordByLeader) : BigDecimal.ZERO);
+        feeOrders.setJyExportRatio(jyInlet.compareTo(BigDecimal.ZERO) > 0 ? div100(jyInlet).add(div100(request.getJyAddThrow())).subtract(div100(firstDist)).subtract(div100(secondDist)).subtract(div100(thirdDist)).subtract(div100(jyEKP)).subtract(IsrecordByLeader) : BigDecimal.ZERO);
 
 
         feeOrders.setJqExportKeepPointRatio(div100(request.getJqExportKeepPointRatio()!=null? request.getJqExportKeepPointRatio() : new BigDecimal(0)));
         feeOrders.setJqExportKeepPointRatio(div100(request.getJqExportKeepPointRatio()!=null? request.getJqExportKeepPointRatio() : new BigDecimal(0)));
         feeOrders.setSyExportKeepPointRatio(div100(request.getSyExportKeepPointRatio()!=null? request.getSyExportKeepPointRatio() : new BigDecimal(0)));
         feeOrders.setSyExportKeepPointRatio(div100(request.getSyExportKeepPointRatio()!=null? request.getSyExportKeepPointRatio() : new BigDecimal(0)));

+ 74 - 53
tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersMapper.xml

@@ -870,6 +870,7 @@
         io.create_time,
         io.create_time,
         io.create_by,
         io.create_by,
         io.error_message,
         io.error_message,
+        io.parent_id,
         ioci.license_no,
         ioci.license_no,
         ioci.vin_no,
         ioci.vin_no,
         owner_u.name as owner_name,
         owner_u.name as owner_name,
@@ -948,6 +949,9 @@
             <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
             <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
                 AND io.id = #{insOrdersParam.orderNo}
                 AND io.id = #{insOrdersParam.orderNo}
             </if>
             </if>
+            <if test="insOrdersParam.parentId != null and insOrdersParam.parentId != ''">
+                AND io.parent_id = #{insOrdersParam.parentId}
+            </if>
             <if test="insOrdersParam.licenseNo != null and insOrdersParam.licenseNo != ''">
             <if test="insOrdersParam.licenseNo != null and insOrdersParam.licenseNo != ''">
                 AND ioci.license_no = #{insOrdersParam.licenseNo}
                 AND ioci.license_no = #{insOrdersParam.licenseNo}
             </if>
             </if>
@@ -1086,72 +1090,79 @@
         ioa1.after_premium as adjustPremium
         ioa1.after_premium as adjustPremium
         FROM
         FROM
         ins_orders io
         ins_orders io
-        LEFT JOIN ins_orders_car_info ioci ON ioci.order_no = io.id and ioci.is_delete = 0
-        LEFT JOIN
-        ins_orders_car_user_info owner_u on owner_u.order_no = io.id and owner_u.policy_person_type = 1 and owner_u.is_delete = 0
-        left JOIN
-        ins_orders_car_user_info policy_u on policy_u.order_no = io.id and policy_u.policy_person_type = 2 and policy_u.is_delete = 0
-        left JOIN
-        ins_orders_car_user_info insur_u on insur_u.order_no = io.id and insur_u.policy_person_type = 3 and insur_u.is_delete = 0
-        left join
-        ins_orders_risk iorci on iorci.order_no = io.id and iorci.risk_code = '0507' and iorci.is_delete = 0
-        left join
-        ins_orders_risk iorbi on iorbi.order_no = io.id and iorbi.risk_code = '0510' and iorbi.is_delete = 0
-        LEFT JOIN
-        ins_orders_costs iorco on iorco.order_no = io.id and iorco.is_delete = 0
-        left join
-        sys_user su on su.mobile = io.real_quote_user_id and su.is_delete = 0
-        left join
-        sys_user_jzg_info suji on suji.user_id = su.id and suji.system_code = #{insOrdersParam.systemCode} and suji.is_delete = 0
-        left join
-        sys_user_jzg_info_salesman sujis ON suji.id = sujis.sys_user_jzg_info_id AND sujis.is_delete = 0
-        left join
-        sys_dept sd on sd.id = suji.dept_id and sd.is_delete = 0
-        left join
-        ptl_agreement pa on pa.id = io.agreement_id and pa.is_delete = 0
-        left join
-        (
-        SELECT *
-        FROM (
-        SELECT t.*,
-        ROW_NUMBER() OVER(PARTITION BY t.order_no ORDER BY t.create_time DESC) AS rn
-        FROM ins_order_adjust t where t.is_delete = 0
-        ) x WHERE x.rn = 1
-        ) ioa ON io.id = ioa.order_no
-        left join
-        (
-        SELECT *
-        FROM (
-        SELECT t.*,
-        ROW_NUMBER() OVER(PARTITION BY t.order_no ORDER BY t.create_time DESC) AS rn
-        FROM ins_order_adjust t where t.status = 2 and t.is_delete = 0
-        ) x WHERE x.rn = 1
-        ) ioa1 ON io.id = ioa1.order_no
+        LEFT JOIN ins_orders_car_info ioci
+        ON ioci.order_no = io.id and ioci.is_delete = 0
+        LEFT JOIN ins_orders_car_user_info owner_u
+        ON owner_u.order_no = io.id and owner_u.policy_person_type = 1 and owner_u.is_delete = 0
+        LEFT JOIN ins_orders_car_user_info policy_u
+        ON policy_u.order_no = io.id and policy_u.policy_person_type = 2 and policy_u.is_delete = 0
+        LEFT JOIN ins_orders_car_user_info insur_u
+        ON insur_u.order_no = io.id and insur_u.policy_person_type = 3 and insur_u.is_delete = 0
+        LEFT JOIN ins_orders_risk iorci
+        ON iorci.order_no = io.id and iorci.risk_code = '0507' and iorci.is_delete = 0
+        LEFT JOIN ins_orders_risk iorbi
+        ON iorbi.order_no = io.id and iorbi.risk_code = '0510' and iorbi.is_delete = 0
+        LEFT JOIN ins_orders_costs iorco
+        ON iorco.order_no = io.id and iorco.is_delete = 0
+        LEFT JOIN sys_user su
+        ON su.mobile = io.real_quote_user_id and su.is_delete = 0
+        LEFT JOIN sys_user_jzg_info suji
+        ON suji.user_id = su.id and suji.system_code = #{insOrdersParam.systemCode} and suji.is_delete = 0
+        LEFT JOIN sys_user_jzg_info_salesman sujis
+        ON suji.id = sujis.sys_user_jzg_info_id AND sujis.is_delete = 0
+        LEFT JOIN sys_dept sd
+        ON sd.id = suji.dept_id and sd.is_delete = 0
+        LEFT JOIN ptl_agreement pa
+        ON pa.id = io.agreement_id and pa.is_delete = 0
+
+        <!-- 优化1: 替代原 ROW_NUMBER() 获取最新一条 adjust 记录 -->
+        LEFT JOIN ins_order_adjust ioa
+        ON ioa.id = (
+        SELECT t.id
+        FROM ins_order_adjust t
+        WHERE t.order_no = io.id AND t.is_delete = 0
+        ORDER BY t.create_time DESC, t.id DESC
+        LIMIT 1
+        )
+
+        <!-- 优化2: 替代原 ROW_NUMBER() 获取 status=2 的最新一条 adjust 记录 -->
+        LEFT JOIN ins_order_adjust ioa1
+        ON ioa1.id = (
+        SELECT t.id
+        FROM ins_order_adjust t
+        WHERE t.order_no = io.id AND t.status = 2 AND t.is_delete = 0
+        ORDER BY t.create_time DESC, t.id DESC
+        LIMIT 1
+        )
+
         <where>
         <where>
             and io.is_delete = 0 and sujis.type_attr NOT IN (1,2,3,4)
             and io.is_delete = 0 and sujis.type_attr NOT IN (1,2,3,4)
+
             <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
             <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
                 AND io.id = #{insOrdersParam.orderNo}
                 AND io.id = #{insOrdersParam.orderNo}
             </if>
             </if>
-<!--            <if test="insOrdersParam.parentId != null">-->
-<!--                AND io.parent_id = #{insOrdersParam.parentId}-->
-<!--            </if>-->
             <if test="insOrdersParam.licenseNo != null and insOrdersParam.licenseNo != ''">
             <if test="insOrdersParam.licenseNo != null and insOrdersParam.licenseNo != ''">
                 AND ioci.license_no = #{insOrdersParam.licenseNo}
                 AND ioci.license_no = #{insOrdersParam.licenseNo}
             </if>
             </if>
-            <if test="insOrdersParam.orderStatus!= null and insOrdersParam.orderStatus!= ''">
+            <if test="insOrdersParam.orderStatus != null and insOrdersParam.orderStatus != ''">
                 AND io.order_status = #{insOrdersParam.orderStatus}
                 AND io.order_status = #{insOrdersParam.orderStatus}
             </if>
             </if>
-            <if test="insOrdersParam.adjustStatus!= null and insOrdersParam.adjustStatus!= ''">
+            <if test="insOrdersParam.adjustStatus != null and insOrdersParam.adjustStatus != ''">
                 AND ioa.status = #{insOrdersParam.adjustStatus}
                 AND ioa.status = #{insOrdersParam.adjustStatus}
             </if>
             </if>
-            <if test="insOrdersParam.salesman!= null">
+            <if test="insOrdersParam.salesman != null">
                 AND io.real_quote_user_id = #{insOrdersParam.salesman}
                 AND io.real_quote_user_id = #{insOrdersParam.salesman}
             </if>
             </if>
             <if test="insOrdersParam.companyId != null and insOrdersParam.companyId != ''">
             <if test="insOrdersParam.companyId != null and insOrdersParam.companyId != ''">
                 AND io.company_id = #{insOrdersParam.companyId}
                 AND io.company_id = #{insOrdersParam.companyId}
             </if>
             </if>
-            <if test="insOrdersParam.startDate != null and insOrdersParam.startDate != ''and insOrdersParam.endDate != null and insOrdersParam.endDate != ''">
-                AND io.create_time BETWEEN #{insOrdersParam.startDate} and #{insOrdersParam.endDate}
+
+            <!-- 创建时间范围 -->
+            <if test="insOrdersParam.startDate != null and insOrdersParam.startDate != ''">
+                AND io.create_time &gt;= #{insOrdersParam.startDate}
+            </if>
+            <if test="insOrdersParam.endDate != null and insOrdersParam.endDate != ''">
+                AND io.create_time &lt;= #{insOrdersParam.endDate}
             </if>
             </if>
 
 
             <if test="insOrdersParam.companyName != null and insOrdersParam.companyName != ''">
             <if test="insOrdersParam.companyName != null and insOrdersParam.companyName != ''">
@@ -1232,11 +1243,21 @@
             <if test="insOrdersParam.adjustPremium != null">
             <if test="insOrdersParam.adjustPremium != null">
                 AND ioa1.after_premium = #{insOrdersParam.adjustPremium}
                 AND ioa1.after_premium = #{insOrdersParam.adjustPremium}
             </if>
             </if>
-            <if test="insOrdersParam.startSigningTime != null and insOrdersParam.startSigningTime != ''and insOrdersParam.endSigningTime != null and insOrdersParam.endSigningTime != ''">
-                AND io.signing_time BETWEEN #{insOrdersParam.startSigningTime} and #{insOrdersParam.endSigningTime}
+
+            <!-- 签单时间范围优化 -->
+            <if test="insOrdersParam.startSigningTime != null and insOrdersParam.startSigningTime != ''">
+                AND io.signing_time &gt;= #{insOrdersParam.startSigningTime}
             </if>
             </if>
-            <if test="insOrdersParam.startPayTime != null and insOrdersParam.startPayTime != ''and insOrdersParam.endPayTime != null and insOrdersParam.endPayTime != ''">
-                AND io.pay_time BETWEEN #{insOrdersParam.startPayTime} and #{insOrdersParam.endPayTime}
+            <if test="insOrdersParam.endSigningTime != null and insOrdersParam.endSigningTime != ''">
+                AND io.signing_time &lt;= #{insOrdersParam.endSigningTime}
+            </if>
+
+            <!-- 支付时间范围优化 -->
+            <if test="insOrdersParam.startPayTime != null and insOrdersParam.startPayTime != ''">
+                AND io.pay_time &gt;= #{insOrdersParam.startPayTime}
+            </if>
+            <if test="insOrdersParam.endPayTime != null and insOrdersParam.endPayTime != ''">
+                AND io.pay_time &lt;= #{insOrdersParam.endPayTime}
             </if>
             </if>
         </where>
         </where>
         order by io.create_time desc
         order by io.create_time desc

+ 4 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerQuoteRequest.java

@@ -140,8 +140,12 @@ public class ZhongAnCrawlerQuoteRequest{
         } else {
         } else {
             NonAutoInfoDto jtywxV24 = new NonAutoInfoDto("kp_nhjcb_v1", "0", null);
             NonAutoInfoDto jtywxV24 = new NonAutoInfoDto("kp_nhjcb_v1", "0", null);
             NonAutoInfoDto wjsGabV6 = new NonAutoInfoDto("wjs_gab_v10", "0", null);
             NonAutoInfoDto wjsGabV6 = new NonAutoInfoDto("wjs_gab_v10", "0", null);
+            NonAutoInfoDto wjs_cwyjtywx_v1 = new NonAutoInfoDto("wjs_cwyjtywx_v1", "0", null);
+            NonAutoInfoDto kp_czwyjcx_v1 = new NonAutoInfoDto("kp_czwyjcx_v1", "0", null);
             nonAutoInfoDtos.add(jtywxV24);
             nonAutoInfoDtos.add(jtywxV24);
             nonAutoInfoDtos.add(wjsGabV6);
             nonAutoInfoDtos.add(wjsGabV6);
+            nonAutoInfoDtos.add(wjs_cwyjtywx_v1);
+            nonAutoInfoDtos.add(kp_czwyjcx_v1);
         }
         }
         this.nonAutoInfo = JSONObject.toJSONString(nonAutoInfoDtos);
         this.nonAutoInfo = JSONObject.toJSONString(nonAutoInfoDtos);
     }
     }

+ 12 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/AgreementController.java

@@ -217,6 +217,18 @@ public class AgreementController extends BaseController {
         return HttpResult.ok("复制成功");
         return HttpResult.ok("复制成功");
     }
     }
 
 
+    /**
+     * 协议外部协议复制内部协议
+     * @param param
+     * @return
+     */
+    @Operation(summary = "外部协议复制内部协议")
+    @PostMapping("/agreementCopyOutToIn")
+    public HttpResult agreementCopyOutToIn(@Validated @RequestBody AgreementCopyParam param) {
+        agreementService.agreementCopyOutToIn(param);
+        return HttpResult.ok("复制成功");
+    }
+
     /**
     /**
      * 批量修改协议费用有效期
      * 批量修改协议费用有效期
      * @param param 参数
      * @param param 参数

+ 2 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementService.java

@@ -166,4 +166,6 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      * @date 2026/7/28 9:14
      * @date 2026/7/28 9:14
      */
      */
     List<ContractVO> queryContractVos();
     List<ContractVO> queryContractVos();
+
+    void agreementCopyOutToIn(AgreementCopyParam param);
 }
 }

+ 120 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementServiceImpl.java

@@ -19,6 +19,7 @@ import com.jzg.commons.util.MinioUtils;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.client.EsmInsCompanyClient;
+import com.jzg.organization.mapper.PtlAgreementCostExternalMapper;
 import com.jzg.organization.mapper.PtlAgreementMapper;
 import com.jzg.organization.mapper.PtlAgreementMapper;
 import com.jzg.organization.mapper.SysUploadFilesMapper;
 import com.jzg.organization.mapper.SysUploadFilesMapper;
 import com.jzg.organization.mapper.SysUserMapper;
 import com.jzg.organization.mapper.SysUserMapper;
@@ -83,6 +84,8 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
 
 
     @Autowired
     @Autowired
     private PtlAgreementCostExternalService ptlAgreementCostExternalService;
     private PtlAgreementCostExternalService ptlAgreementCostExternalService;
+    @Autowired
+    private PtlAgreementCostExternalTypeService ptlAgreementCostExternalTypeService;
 
 
     /**
     /**
      * 协议分页查询
      * 协议分页查询
@@ -437,6 +440,123 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         // 复制承保规则和费用
         // 复制承保规则和费用
         this.copyRuleAndCost(costGroup, allCostIds, costList, newAgreement);
         this.copyRuleAndCost(costGroup, allCostIds, costList, newAgreement);
 
 
+    }
+
+
+    /**
+     * 内部协议复制到外部协议
+     *
+     */
+    @Override
+    @Transactional(rollbackFor = {Exception.class})
+    public void agreementCopyOutToIn(AgreementCopyParam param) {
+        log.info("内部协议复制到外部协议。 param=[{}]", JSONUtil.toJsonStr(param));
+        if(param.getId().isEmpty()){
+            throw new SystemException("请选择您要复制的协议信息");
+        }
+        if(param.getDockingPerson().isEmpty()){
+            throw new SystemException("请填写对接人信息");
+        }
+        if(param.getDockingPhone().isEmpty()){
+            throw new SystemException("请填写对接人信息");
+        }
+
+        PtlAgreement agreement = getById(param.getId());
+        // 获取保险公司信息
+        HttpResult<EsmInsCompany> result = companyClient.findById(agreement.getCompanyId());
+        String companyCode;
+        if(result.getCode() == 200 && Objects.nonNull(result.getData())){
+            companyCode = result.getData().getCompanyCode();
+        }else{
+            log.info("根据协议agreement[{}]中的companyId[{}]无法获取到保险公司信息", JSONUtil.toJsonStr(agreement), agreement.getId());
+            throw new SystemException("根据公司id"+agreement.getCompanyId()+"无法获取到保险公司信息");
+        }
+        String sysCode = baseController.getUserSystemCode();
+        PtlAgreement newAgreement = new PtlAgreement();
+        BeanUtils.copyProperties(agreement,newAgreement);
+        newAgreement.setId(null);
+        newAgreement.setAgreementTitle(LocalDateTime.now().getSecond() + agreement.getAgreementTitle());
+        newAgreement.setAgreementCode(sysCode + companyCode + System.currentTimeMillis());
+        newAgreement.setAuditStatus(0);
+        newAgreement.setCreateTime(LocalDateTime.now());
+        newAgreement.setUpdateTime(LocalDateTime.now());
+        // 外部协议
+        newAgreement.setIsExternal(1);
+        // 根据测试反馈,复制后的协议,默认应该是停用状态
+        newAgreement.setIsEnable(1);
+        save(newAgreement);
+
+        List<String> costIds = param.getCostIds();
+        if(CollUtil.isEmpty(costIds)){
+            return;
+        }
+        List<PtlAgreementCost> selectedCostList = agreementCostService.listByIds(costIds);
+        if (CollUtil.isEmpty(selectedCostList)) {
+            return;
+        }
+        Set<String> allCostIds = selectedCostList.stream().map(PtlAgreementCost::getId).collect(Collectors.toSet());
+        LambdaQueryWrapper<PtlAgreementCostType> costTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        costTypeLambdaQueryWrapper.in(PtlAgreementCostType::getPtlAgreementCostId, allCostIds);
+        List<PtlAgreementCostType> costTypeList = agreementCostTypeService.list(costTypeLambdaQueryWrapper);
+        Map<String, List<PtlAgreementCostType>> costTypeMap = costTypeList.stream().collect(
+                Collectors.groupingBy(PtlAgreementCostType::getPtlAgreementCostId));
+
+        for(PtlAgreementCost cost :selectedCostList){
+            PtlAgreementCostExternal costExternal = new PtlAgreementCostExternal();
+            // 同名同类型字段直接复制
+            // 关联新协议ID:String -> Long
+            costExternal.setPtlAgreementId(Long.valueOf(newAgreement.getId()));
+            costExternal.setProductName(cost.getProductName());
+            costExternal.setProductId(cost.getProductId());
+            costExternal.setEffectiveTime(cost.getEffectiveTime());
+            costExternal.setFailureTime(cost.getFailureTime());
+            costExternal.setAuditMethod(cost.getAuditMethod());
+            costExternal.setCostDescribe(cost.getCostDescribe());
+            costExternal.setReviewDescription(cost.getReviewDescription());
+            costExternal.setIsEnabled(cost.getIsEnabled());
+            costExternal.setAuditTime(cost.getAuditTime());
+            costExternal.setAuditPerson(cost.getAuditPerson());
+            // 默认非现询,非现询为1
+            costExternal.setIsInquiry(1);
+
+            // 类型转换:Integer -> String
+            if (cost.getPriorityLevel() != null) {
+                costExternal.setPriorityLevel(String.valueOf(cost.getPriorityLevel()));
+            }
+            // 复制的费用默认待审核
+            costExternal.setAuditStatus(0);
+            // 复制对接人信息
+            costExternal.setContactPerson(param.getDockingPerson());
+            costExternal.setContactMobile(param.getDockingPhone());
+            ptlAgreementCostExternalService.save(costExternal);
+
+            List<PtlAgreementCostType> costTypes = costTypeMap.get(cost.getId());
+            if (CollUtil.isNotEmpty(costTypes)) {
+                List<PtlAgreementCostExternalType> costExternalTypes = new ArrayList<>();
+                for(PtlAgreementCostType costType :costTypes){
+                    PtlAgreementCostExternalType costExternalType = new PtlAgreementCostExternalType();
+                    // 同名同类型字段直接复制
+                    costExternalType.setCostType(costType.getCostType());
+                    costExternalType.setInlet(costType.getInlet());
+                    costExternalType.setExport(costType.getExport());
+                    costExternalType.setAddThrow(costType.getAddThrow());
+                    costExternalType.setKeepPointRatio(costType.getKeepPointRatio());
+                    // 关联新外部费用ID:String -> Long
+                    costExternalType.setPtlAgreementCostExternalId(costExternal.getId());
+                    costExternalType.setCreateTime(LocalDateTime.now());
+                    costExternalType.setUpdateTime(LocalDateTime.now());
+                    costExternalTypes.add(costExternalType);
+
+                }
+                ptlAgreementCostExternalTypeService.saveBatch(costExternalTypes);
+            }
+
+
+        }
+
+
+
+
     }
     }
 
 
     @Override
     @Override

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

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.constants.ProductsType;
 import com.jzg.commons.constants.ProductsType;
+import com.jzg.commons.constants.quote.enums.quote.EnergyTypeCode;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.action.enums.ActionEnum;
 import com.jzg.commons.entity.action.enums.ActionEnum;
@@ -827,7 +828,7 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
         // 过滤类型
         // 过滤类型
         List<SchemeResultVo.SchemeVo> newSchemeList = schemeInsuranceInfo.stream()
         List<SchemeResultVo.SchemeVo> newSchemeList = schemeInsuranceInfo.stream()
                 .filter(scheme -> scheme.getVehicleType().contains(vehicleType)
                 .filter(scheme -> scheme.getVehicleType().contains(vehicleType)
-                        && scheme.getEnergyType().contains(energyType)
+                        && scheme.getEnergyType().contains(EnergyTypeCode.isNewEnergy(energyType) ? "1" : "0")
                         && scheme.getCarnature().contains(carnature))
                         && scheme.getCarnature().contains(carnature))
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());