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

Merge remote-tracking branch 'origin/master'

wangrq 3 месяцев назад
Родитель
Сommit
292dd37e9a

+ 1 - 1
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/quotation/ansheng/crawler/build/AnShengCrawlerQuoteResultsVoBuild.java

@@ -136,7 +136,7 @@ public final class AnShengCrawlerQuoteResultsVoBuild {
                 jsonObject.put("scoreKey","compulsoryInsure");
                 jsonObject.put("score",contract.getPlanDefine().getCompulsoryInsure() ? "是" : "否");
             }else if (StringUtils.equals("109",contract.getPlanDefine().getPlanCode())){
-                jsonObject.put("scoreName","交强");
+                jsonObject.put("scoreName","商业");
                 jsonObject.put("scoreKey","businessInsure");
                 jsonObject.put("score",contract.getPlanDefine().getBusinessInsure() ? "是" : "否");
             }

+ 1 - 4
tenant/insurance/quotation-dajia/src/main/java/com/jzg/quotation/dajia/crawler/build/DaJiaCrawlerQuoteResultsVoBuild.java

@@ -216,23 +216,20 @@ public final class DaJiaCrawlerQuoteResultsVoBuild {
                     .fluentPut("scoreName","商业险建议折扣")
                     .fluentPut("scoreKey","entireDiscount")
                     .fluentPut("score",coefficientInfo1.getEntireDiscount()));
-            scoreVo.setScoreJson(scoreArray);
             scoreArray.add(new JSONObject()
                     .fluentPut("scoreName","商业险手续费")
                     .fluentPut("scoreKey","handFeeBi")
                     .fluentPut("score",coefficientInfo1.getHandFeeBi()));
-            scoreVo.setScoreJson(scoreArray);
             scoreArray.add(new JSONObject()
                     .fluentPut("scoreName","无赔款优待系数")
                     .fluentPut("scoreKey","totalCoefNum")
                     .fluentPut("score",coefficientInfo1.getTotalCoefNum()));
-            scoreVo.setScoreJson(scoreArray);
             scoreArray.add(new JSONObject()
                     .fluentPut("scoreName","商业类型评分")
                     .fluentPut("scoreKey","syPubScores")
                     .fluentPut("score",coefficientInfo1.getPubScores()));
-            scoreVo.setScoreJson(scoreArray);
          }
+        scoreVo.setScoreJson(scoreArray);
         return scoreVo;
     }
 

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

@@ -230,9 +230,9 @@ public class QuoteVerificationAspect {
         insFeeOrders.setSyPremium(insOrdersCosts.getSyPremium());
         insFeeOrders.setJyPremium(insOrdersCosts.getJyPremium());
         insFeeOrders.setTotalPremium(insOrdersCosts.getSumPremium());
-        BigDecimal jqEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getJqEntranceFeeRatio());
-        BigDecimal syEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getSyEntranceFeeRatio());
-        BigDecimal jyEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getJyEntranceFeeRatio());
+        BigDecimal jqEntranceFeeRatio = agreementInfoVo.getAgreement().getJqEntranceFeeRatio();
+        BigDecimal syEntranceFeeRatio = agreementInfoVo.getAgreement().getSyEntranceFeeRatio();
+        BigDecimal jyEntranceFeeRatio = agreementInfoVo.getAgreement().getJyEntranceFeeRatio();
 
         // 2. 获取费用类型列表(处理空集合,避免NPE)
         List<PtlAgreementCostTypeVo> costTypeList = orgClient.queryByCostId(costId);
@@ -254,6 +254,14 @@ public class QuoteVerificationAspect {
                 agreementInfoVo.getAgreement().setJqEntranceFeeRatio(jqEntranceFeeRatio);
             }
         }
+        if(Objects.nonNull(insOrdersCosts.getJqPremium()) && insOrdersCosts.getJqPremium().compareTo(BigDecimal.ZERO) == 0){
+            jqEntranceFeeRatio = BigDecimal.ZERO;
+            agreementInfoVo.getAgreement().setJqEntranceFeeRatio(jqEntranceFeeRatio);
+            //如果没有保费的话 所有入口和手续费也为0
+            if(Objects.nonNull(jqCostType)){
+                jqCostType.setInlet(BigDecimal.ZERO);
+            }
+        }
 
         if(Objects.nonNull(syCostType))
         {
@@ -264,6 +272,15 @@ public class QuoteVerificationAspect {
             }
         }
 
+        if(Objects.nonNull(insOrdersCosts.getSyPremium()) && insOrdersCosts.getSyPremium().compareTo(BigDecimal.ZERO) == 0){
+            syEntranceFeeRatio = BigDecimal.ZERO;
+            agreementInfoVo.getAgreement().setSyEntranceFeeRatio(syEntranceFeeRatio);
+            //如果没有保费的话 所有入口和手续费也为0
+            if(Objects.nonNull(syCostType)){
+                syCostType.setInlet(BigDecimal.ZERO);
+            }
+        }
+
         if(Objects.nonNull(jyCostType)){
             BigDecimal jyInlet = BigDecimalUtil.divide(jyCostType.getInlet(), new BigDecimal(100));
             if (BigDecimalUtil.subtract(jyEntranceFeeRatio, jyInlet).compareTo(BigDecimal.ZERO) > 0) {
@@ -272,6 +289,15 @@ public class QuoteVerificationAspect {
             }
         }
 
+        if(Objects.nonNull(insOrdersCosts.getJyPremium()) && insOrdersCosts.getJyPremium().compareTo(BigDecimal.ZERO) == 0){
+            jyEntranceFeeRatio = BigDecimal.ZERO;
+            //如果没有保费的话 所有入口和手续费也为0
+            agreementInfoVo.getAgreement().setJyEntranceFeeRatio(jyEntranceFeeRatio);
+            if(Objects.nonNull(jyCostType)){
+                jyCostType.setInlet(BigDecimal.ZERO);
+            }
+        }
+
         // 4. 计算跟单费比例(入口比例 - 手续费比例)
         BigDecimal jqFollowRatio = calculateFollowRatio(jqCostType, jqEntranceFeeRatio);
         BigDecimal syFollowRatio = calculateFollowRatio(syCostType, syEntranceFeeRatio);
@@ -454,27 +480,16 @@ public class QuoteVerificationAspect {
         insFeeOrders.setTotalPayablePremium(totalPayable);
 
         // 计算出口费用 = (出口比列 * 保费)- 分销费
-//        BigDecimal firstDistributionFee = insFeeOrders.getFirstDistributionFee();
-//        BigDecimal secondDistributionFee = insFeeOrders.getSecondDistributionFee();
-//        BigDecimal thirdDistributionFee = insFeeOrders.getThirdDistributionFee();
         BigDecimal jqExportPremiumOrigin = insFeeOrders.getJqExportRatio().multiply(insFeeOrders.getJqPremium());
         BigDecimal jqExportPremium = jqExportPremiumOrigin.setScale(2,RoundingMode.DOWN);
-//        if (jqExportPremium.compareTo(BigDecimal.ZERO) > 0) {
-//            jqExportPremium = jqExportPremium.subtract(firstDistributionFee).subtract(secondDistributionFee).subtract(thirdDistributionFee);
-//        }
         insFeeOrders.setJqExportPremium(jqExportPremium);
 
         BigDecimal syExportPremiumOrigin = insFeeOrders.getSyExportRatio().multiply(insFeeOrders.getSyPremium());
         BigDecimal syExportPremium = syExportPremiumOrigin.setScale(2, RoundingMode.DOWN);
-//        if (syExportPremium.compareTo(BigDecimal.ZERO) > 0) {
-//            syExportPremium = syExportPremium.subtract(firstDistributionFee).subtract(secondDistributionFee).subtract(thirdDistributionFee);
-//        }
         insFeeOrders.setSyExportPremium(syExportPremium);
+
         BigDecimal jyExportPremiumOrigin = insFeeOrders.getJyExportRatio().multiply(insFeeOrders.getJyPremium());
         BigDecimal jyExportPremium = jyExportPremiumOrigin.setScale(2, RoundingMode.DOWN);
-//        if (jyExportPremium.compareTo(BigDecimal.ZERO) > 0) {
-//            jyExportPremium = jyExportPremium.subtract(firstDistributionFee).subtract(secondDistributionFee).subtract(thirdDistributionFee);
-//        }
         insFeeOrders.setJyExportPremium(jyExportPremium);
 
         // add by lipf, 2026年6月27日15:45:20 计算总的出口金额由5位调整为2位时,截断的所有金额
@@ -535,9 +550,9 @@ public class QuoteVerificationAspect {
      */
     private void saveRatio(InsFeeOrders insFeeOrders, AgreementInfoVo agreementInfoVo,PtlAgreementCostTypeVo jqCostType,PtlAgreementCostTypeVo syCostType,PtlAgreementCostTypeVo jyCostType) {
         // 手续费比例
-        insFeeOrders.setJqCommissionRatio(convertPercent(agreementInfoVo.getAgreement().getJqEntranceFeeRatio()));
-        insFeeOrders.setSyCommissionRatio(convertPercent(agreementInfoVo.getAgreement().getSyEntranceFeeRatio()));
-        insFeeOrders.setJyCommissionRatio(convertPercent(agreementInfoVo.getAgreement().getJyEntranceFeeRatio()));
+        insFeeOrders.setJqCommissionRatio(agreementInfoVo.getAgreement().getJqEntranceFeeRatio());
+        insFeeOrders.setSyCommissionRatio(agreementInfoVo.getAgreement().getSyEntranceFeeRatio());
+        insFeeOrders.setJyCommissionRatio(agreementInfoVo.getAgreement().getJyEntranceFeeRatio());
         // 入口比例
         insFeeOrders.setJqInletRatio(jqCostType != null
                 ? convertPercent(jqCostType.getInlet() != null ? jqCostType.getInlet() : BigDecimal.ZERO) : BigDecimal.ZERO);
@@ -582,18 +597,25 @@ public class QuoteVerificationAspect {
         BigDecimal firstDistributionRatio = Optional.ofNullable(insFeeOrders.getFirstDistributionRatio()).orElse(BigDecimal.ZERO);
         BigDecimal secondDistributionRatio = Optional.ofNullable(insFeeOrders.getSecondDistributionRatio()).orElse(BigDecimal.ZERO);
         BigDecimal thirdDistributionRatio = Optional.ofNullable(insFeeOrders.getThirdDistributionRatio()).orElse(BigDecimal.ZERO);
+
         insFeeOrders.setJqExportRatio(jqCostType == null ? BigDecimal.ZERO :
                         (jqCostType.getExport() != null && jqCostType.getExport().compareTo(BigDecimal.ZERO) > 0
-                                ? convertPercent(jqCostType.getExport()).subtract(firstDistributionRatio).subtract(secondDistributionRatio).subtract(thirdDistributionRatio)
+                                ? convertPercent(jqCostType.getExport()).subtract(convertPercent(firstDistributionRatio))
+                                  .subtract(convertPercent(secondDistributionRatio)).subtract(convertPercent(thirdDistributionRatio))
                                 : BigDecimal.ZERO));
+
         insFeeOrders.setSyExportRatio(syCostType == null ? BigDecimal.ZERO :
                         (syCostType.getExport() != null && syCostType.getExport().compareTo(BigDecimal.ZERO) > 0
-                                ? convertPercent(syCostType.getExport()).subtract(firstDistributionRatio).subtract(secondDistributionRatio).subtract(thirdDistributionRatio)
+                                ? convertPercent(syCostType.getExport()).subtract(convertPercent(firstDistributionRatio))
+                                  .subtract(convertPercent(secondDistributionRatio)).subtract(convertPercent(thirdDistributionRatio))
                                 : BigDecimal.ZERO));
+
         insFeeOrders.setJyExportRatio(jyCostType == null ?  BigDecimal.ZERO :
                         (jyCostType.getExport() != null && jyCostType.getExport().compareTo(BigDecimal.ZERO) > 0
-                                ? convertPercent(jyCostType.getExport()).subtract(firstDistributionRatio).subtract(secondDistributionRatio).subtract(thirdDistributionRatio)
+                                ? convertPercent(jyCostType.getExport()).subtract(convertPercent(firstDistributionRatio))
+                                  .subtract(convertPercent(secondDistributionRatio)).subtract(convertPercent(thirdDistributionRatio))
                                 : BigDecimal.ZERO));
+
         // 出口留点比例
         insFeeOrders.setJqExportKeepPointRatio(jqCostType != null
                 ? convertPercent(jqCostType.getExportKeepPointRatio() != null ? jqCostType.getExportKeepPointRatio() : BigDecimal.ZERO)
@@ -605,6 +627,34 @@ public class QuoteVerificationAspect {
                 ? convertPercent(jyCostType.getExportKeepPointRatio() != null ? jyCostType.getExportKeepPointRatio() : BigDecimal.ZERO)
                 : BigDecimal.ZERO);
 
+
+        // 如果保费为0的情况  出口相关的数据都为0
+        if(Objects.nonNull(insFeeOrders.getJqPremium()) && insFeeOrders.getJqPremium().compareTo(BigDecimal.ZERO) == 0)
+        {
+            insFeeOrders.setJqExportRatio(BigDecimal.ZERO);
+            insFeeOrders.setJqExportPremium(BigDecimal.ZERO);
+            insFeeOrders.setJqExportKeepPointRatio(BigDecimal.ZERO);
+            insFeeOrders.setJqExportKeepPointPremium(BigDecimal.ZERO);
+            insFeeOrders.setJqKeepPointRatio(BigDecimal.ZERO);
+        }
+        if(Objects.nonNull(insFeeOrders.getSyPremium()) && insFeeOrders.getSyPremium().compareTo(BigDecimal.ZERO) == 0)
+        {
+            insFeeOrders.setSyExportRatio(BigDecimal.ZERO);
+            insFeeOrders.setSyExportPremium(BigDecimal.ZERO);
+            insFeeOrders.setSyExportKeepPointRatio(BigDecimal.ZERO);
+            insFeeOrders.setSyExportKeepPointPremium(BigDecimal.ZERO);
+            insFeeOrders.setSyKeepPointRatio(BigDecimal.ZERO);
+        }
+
+        if(Objects.nonNull(insFeeOrders.getJyPremium()) && insFeeOrders.getJyPremium().compareTo(BigDecimal.ZERO) == 0)
+        {
+            insFeeOrders.setJyExportRatio(BigDecimal.ZERO);
+            insFeeOrders.setJyExportPremium(BigDecimal.ZERO);
+            insFeeOrders.setJyExportKeepPointRatio(BigDecimal.ZERO);
+            insFeeOrders.setJyExportKeepPointPremium(BigDecimal.ZERO);
+            insFeeOrders.setJyKeepPointRatio(BigDecimal.ZERO);
+        }
+
     }
 
     /**
@@ -612,7 +662,7 @@ public class QuoteVerificationAspect {
      */
     private BigDecimal calculateDistributionFee(InsOrdersCosts insOrdersCosts, InsFeeOrders insFeeOrders,InsOrders insOrders){
         // 总保费
-        BigDecimal totalPremium = insOrdersCosts.getSumPremium();
+        BigDecimal totalPremium = insOrdersCosts.getJqPremium().add(insOrdersCosts.getSyPremium()).add(insOrdersCosts.getJyPremium());
         // 获取当前租户信息
         HttpResult<SysUserJzgInfo> sysUserJzgInfoResult = orgClient.getUserInfoByMobile(insOrders.getRealQuoteUserId());
         SysUserJzgInfo currentUser = sysUserJzgInfoResult.getData();
@@ -678,7 +728,7 @@ public class QuoteVerificationAspect {
                 insFeeOrders.setFirstDistributorId(distributorId);
                 BigDecimal fee_5 = (totalPremium.multiply(setting.getCommissionRatioLevel1()).setScale(5,RoundingMode.DOWN));
                 insFeeOrders.setFirstDistributionFee(totalPremium.multiply(setting.getCommissionRatioLevel1()).setScale(2,RoundingMode.DOWN));
-                insFeeOrders.setFirstDistributionRatio(setting.getCommissionRatioLevel1());
+                insFeeOrders.setFirstDistributionRatio(setting.getCommissionRatioLevel1().multiply(new BigDecimal(100)));
                 BigDecimal diffAmount = fee_5.subtract(insFeeOrders.getFirstDistributionFee());
                 Map map = new HashMap();
                 map.put("id",distributorId);
@@ -707,7 +757,7 @@ public class QuoteVerificationAspect {
                 insFeeOrders.setSecondDistributorId(distributorId);
                 BigDecimal fee_5 = (totalPremium.multiply(setting.getCommissionRatioLevel2()).setScale(5,RoundingMode.DOWN));
                 insFeeOrders.setSecondDistributionFee(totalPremium.multiply(setting.getCommissionRatioLevel2()).setScale(2,RoundingMode.DOWN));
-                insFeeOrders.setSecondDistributionRatio(setting.getCommissionRatioLevel2());
+                insFeeOrders.setSecondDistributionRatio(setting.getCommissionRatioLevel2().multiply(new BigDecimal(100)));
                 BigDecimal diffAmount = fee_5.subtract(insFeeOrders.getSecondDistributionFee());
                 Map map = new HashMap();
                 map.put("id",distributorId);
@@ -735,7 +785,7 @@ public class QuoteVerificationAspect {
                 insFeeOrders.setThirdDistributorId(referrer.getReferrerId());
                 BigDecimal fee_5 = (totalPremium.multiply(setting.getCommissionRatioLevel3()).setScale(5,RoundingMode.DOWN));
                 insFeeOrders.setThirdDistributionFee(totalPremium.multiply(setting.getCommissionRatioLevel3()).setScale(2,RoundingMode.DOWN));
-                insFeeOrders.setThirdDistributionRatio(setting.getCommissionRatioLevel3());
+                insFeeOrders.setThirdDistributionRatio(setting.getCommissionRatioLevel3().multiply(new BigDecimal(100)));
                 BigDecimal diffAmount = fee_5.subtract(insFeeOrders.getThirdDistributionFee());
                 return diffAmount;
             } else {

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

@@ -1383,18 +1383,23 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 
         // 比例信息 分销员信息
         if (insFeeOrders != null) {
-            HttpResult<SysUserJzgInfo> firstDistributor = orgClient.getUserInfoById(insFeeOrders.getFirstDistributorId());
-            HttpResult<SysUserJzgInfo> secondDistributor = orgClient.getUserInfoById(insFeeOrders.getSecondDistributorId());
-            HttpResult<SysUserJzgInfo> thirdDistributor = orgClient.getUserInfoById(insFeeOrders.getThirdDistributorId());
-            if (firstDistributor.getData() != null) {
-                insFeeOrders.setFirstDistributorName(firstDistributor.getData().getName());
-            }
-            if (secondDistributor.getData() != null) {
-                insFeeOrders.setSecondDistributorName(secondDistributor.getData().getName());
-            }
-            if (thirdDistributor.getData() != null) {
-                insFeeOrders.setThirdDistributorName(thirdDistributor.getData().getName());
+            if(insFeeOrders.getFirstDistributorId() != null &&
+                    insFeeOrders.getSecondDistributorId() != null &&
+                    insFeeOrders.getThirdDistributorId() != null){
+                HttpResult<SysUserJzgInfo> firstDistributor = orgClient.getUserInfoById(insFeeOrders.getFirstDistributorId());
+                HttpResult<SysUserJzgInfo> secondDistributor = orgClient.getUserInfoById(insFeeOrders.getSecondDistributorId());
+                HttpResult<SysUserJzgInfo> thirdDistributor = orgClient.getUserInfoById(insFeeOrders.getThirdDistributorId());
+                if (firstDistributor.getData() != null) {
+                    insFeeOrders.setFirstDistributorName(firstDistributor.getData().getName());
+                }
+                if (secondDistributor.getData() != null) {
+                    insFeeOrders.setSecondDistributorName(secondDistributor.getData().getName());
+                }
+                if (thirdDistributor.getData() != null) {
+                    insFeeOrders.setThirdDistributorName(thirdDistributor.getData().getName());
+                }
             }
+
             resultVo.setCostRatio(new PtlAgreementCostRatioVo(insFeeOrders));
             resultVo.setInsFeeOrders(new InsFeeOrdersVo(insFeeOrders));
         }

+ 76 - 1
tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/service/impl/TaiShanCrawlerRequestImpl.java

@@ -15,6 +15,8 @@ import com.jzg.quotation.commons.entity.DetectLoginRequest;
 import com.jzg.quotation.commons.entity.GetCaptchaRequest;
 import com.jzg.quotation.commons.entity.GetCaptchaResponse;
 import com.jzg.quotation.commons.filter.CarModelsFilterUtils;
+import com.jzg.quotation.commons.utils.TimeProcessing;
+import com.jzg.commons.exception.SystemException;
 import com.jzg.quotation.taishan.crawler.build.TaiShanCrawlerQuoteRequestVoBuild;
 import com.jzg.quotation.taishan.crawler.build.TaiShanCrawlerQuoteResultsVoBuild;
 import com.jzg.quotation.taishan.crawler.component.TaiShanCrawlerRequestComponent;
@@ -40,6 +42,8 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.*;
 import java.util.function.Function;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 /**
@@ -63,6 +67,11 @@ public class TaiShanCrawlerRequestImpl implements TaiShanCrawlerRequest {
 
     public static final int CIRCULATE_NUMBER = 3;
 
+    /**
+     * 截取重复投保终保日期的正则表达式(泰山格式:保险止期为:YYYY-MM-DD HH:mm:ss)
+     */
+    private static final Pattern DUPLICATE_END_TIME_PATTERN = Pattern.compile("保险止期为:(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})");
+
     @Override
     public GetCaptchaResponse getCaptcha(GetCaptchaRequest sendCaptchaRequest) {
         return taiShanCrawlerQuoteProcessService.getCaptcha(sendCaptchaRequest);
@@ -145,7 +154,38 @@ public class TaiShanCrawlerRequestImpl implements TaiShanCrawlerRequest {
             // 3.1 保存报价信息接口
             this.resultCoverSave(quoteVo,taiShanCrawlerQuotationRequest,taiShanCrawlerQuotationResponse);
             log.info("taiShanCrawlerQuotationRequest:{}", JSON.toJSONString(taiShanCrawlerQuotationRequest));
-            taiShanCrawlerQuotationSaveResponse = taiShanCrawlerRequestComponent.saveQuotation(taiShanCrawlerQuotationRequest, headers);
+            try {
+                taiShanCrawlerQuotationSaveResponse = taiShanCrawlerRequestComponent.saveQuotation(taiShanCrawlerQuotationRequest, headers);
+            } catch (SystemException e) {
+                // 重复投保,延保
+                if (e.getMessage() != null && e.getMessage().contains("重复投保")) {
+                    String startTime = extractDuplicateEndTime(e.getMessage());
+                    if (StringUtils.hasLength(startTime)) {
+                        String newEndTime = TimeProcessing.minusOneSecondAfterYear(startTime);
+                        String startDate = TimeProcessing.dateTimeToDate(startTime);
+                        String endDate = TimeProcessing.minusDays(TimeProcessing.dateTimeToDate(newEndTime), 1);
+                        buildDuplicateInsuranceDate(startDate, endDate, quoteVo, taiShanCrawlerQuotationRequest);
+                        log.info("泰山报价重复投保日期参数: startTime={}, endTime={}", startTime, newEndTime);
+                        // 重新报价
+                        taiShanCrawlerQuotationResponse = taiShanCrawlerRequestComponent.quotation(taiShanCrawlerQuotationRequest, headers, CIRCULATE_NUMBER);
+                        log.info("泰山报价重复投保后报价响应: {}", JSON.toJSONString(taiShanCrawlerQuotationResponse));
+                        exception = taiShanCrawlerQuotationResponse.getResult().getException();
+                        if (!exception.getCode().equals("H1")) {
+                            errMsg = exception.getMsg();
+                            return TaiShanCrawlerQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo, null, null, errMsg, false);
+                        }
+                        // 更新报价信息
+                        this.resultCoverSave(quoteVo, taiShanCrawlerQuotationRequest, taiShanCrawlerQuotationResponse);
+                        // 重新保存
+                        taiShanCrawlerQuotationSaveResponse = taiShanCrawlerRequestComponent.saveQuotation(taiShanCrawlerQuotationRequest, headers);
+                        log.info("泰山报价重复投保后保存响应: {}", JSON.toJSONString(taiShanCrawlerQuotationSaveResponse));
+                    } else {
+                        throw e;
+                    }
+                } else {
+                    throw e;
+                }
+            }
             log.info("taiShanCrawlerQuotationSaveResponse参数的值:{}", JSON.toJSONString(taiShanCrawlerQuotationSaveResponse));
             TaiShanCrawlerQuotationSaveResponse.Result.Exception saveException = taiShanCrawlerQuotationSaveResponse.getResult().getException();
             if (saveException.getCode().equals("H1")){
@@ -649,5 +689,40 @@ public class TaiShanCrawlerRequestImpl implements TaiShanCrawlerRequest {
         return downloadPolicyResultVo;
     }
 
+    /**
+     * 提取重复投保消息中的终保日期
+     *
+     * @param returnMessage 返回消息
+     * @return 提取到的时间字符串,格式为 yyyy-MM-dd HH:mm:ss,未提取到返回 null
+     */
+    private String extractDuplicateEndTime(String returnMessage) {
+        if (returnMessage == null) {
+            return null;
+        }
+        Matcher matcher = DUPLICATE_END_TIME_PATTERN.matcher(returnMessage);
+        if (matcher.find()) {
+            return matcher.group(1);
+        }
+        return null;
+    }
+
+    /**
+     * 设置重复投保日期(从重复投保消息中提取结束时间作为新的起保时间)
+     *
+     * @param startDate 起保日期
+     * @param endDate   终保日期
+     * @param quoteVo   报价实体
+     * @param request   泰山报价请求
+     */
+    private void buildDuplicateInsuranceDate(String startDate, String endDate, QuoteVo quoteVo, TaiShanCrawlerQuotationRequest request) {
+        // 设置交强险起止日期
+        request.getCompulsoryInsurance().getProductInfo().setStartDate(startDate);
+        request.getCompulsoryInsurance().getProductInfo().setEndDate(endDate);
+        // 设置商业险起止日期(仅在有商业险时)
+        if (quoteVo.getBiRiskInfoVo() != null) {
+            request.getBusinessInsurance().getProductInfo().setStartDate(startDate);
+            request.getBusinessInsurance().getProductInfo().setEndDate(endDate);
+        }
+    }
 
 }

+ 7 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/AgreementRulesController.java

@@ -41,6 +41,13 @@ public class AgreementRulesController extends BaseController {
 
     }
 
+    @Operation(summary = "复制承保规则")
+    @GetMapping("/rulesCopy")
+    public HttpResult rulesCopy(String agreementId, String ruleId) {
+        AgreementRulesVo agreementRulesVo = agreementRulesService.rulesCopy(agreementId,ruleId);
+        return HttpResult.ok(agreementRulesVo);
+    }
+
     /**
      * 添加承保规则
      *

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

@@ -52,7 +52,7 @@ public interface PtlAgreementUndwrtRulesService extends IService<PtlAgreementUnd
      * @param ruleId
      * @return
      */
-    AgreementRulesVo rulesCopy(String ruleId);
+    AgreementRulesVo rulesCopy(String agreementId, String ruleId);
 
 
 

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

@@ -415,6 +415,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         // 调整数据 进行copy
         String costId = IdGenerate.nextId();
         ptlAgreementCost.setId(costId);
+        ptlAgreementCost.setCoverRuleId(costCopyParam.getCoverRuleId());
+        ptlAgreementCost.setPtlAgreementId(costCopyParam.getAgreementId());
         ptlAgreementCost.setCostDescribe("复制的费用:" + ptlAgreementCost.getCostDescribe());
         ptlAgreementCost.setCreateTime(LocalDateTime.now());
 

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

@@ -439,7 +439,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public AgreementRulesVo rulesCopy(String ruleId) {
+    public AgreementRulesVo rulesCopy(String agreementId, String ruleId) {
         PtlAgreementUndwrtRules rules = baseMapper.selectById(ruleId);
         if (rules == null) {
             log.info("承保规则不存在, ruleId={}", ruleId);
@@ -486,7 +486,7 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
             String newRuleId = IdGenerate.nextId();
             PtlAgreementUndwrtRules newRules = new PtlAgreementUndwrtRules();
             newRules.setId(newRuleId);
-            newRules.setAgreementId(rules.getAgreementId());
+            newRules.setAgreementId(agreementId);
             newRules.setStartTime(rules.getStartTime());
             newRules.setEndTime(rules.getEndTime());
             newRules.setInputDescription(rules.getInputDescription());