Bladeren bron

fix 国任 商业日期止期与核心匹配不上

liub 1 maand geleden
bovenliggende
commit
f4b3302c37

+ 2 - 2
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/entity/request/GuoRenCrawlerCreateOrderRequest.java

@@ -126,7 +126,7 @@ public class GuoRenCrawlerCreateOrderRequest implements Serializable {
         insuredListDTO.setInsuredType("1");
         insuredListDTO.setCertiStartDate(insuredPersonInfo.getIdentifyValidDate());
         insuredListDTO.setCertiEndDate("");
-        insuredListDTO.setCertiValidity("2");
+        insuredListDTO.setCertiValidity("4");
         insuredListDTO.setCountryCode("156");
         insuredListDTO.setCountryName("中国");
         insuredListDTO.setCustomerRelations("01");
@@ -200,7 +200,7 @@ public class GuoRenCrawlerCreateOrderRequest implements Serializable {
         orderAppl.setContactMobile(null);
         orderAppl.setCertiStartDate(policyHolderInfo.getIdentifyValidDate());
         orderAppl.setCertiEndDate("");
-        orderAppl.setCertiValidity("2");
+        orderAppl.setCertiValidity("4");
         orderAppl.setCountryCode("156");
         orderAppl.setCountryName("中国");
         orderAppl.setAddrProvince(policyHolderInfo.getProvince());

+ 53 - 1
tenant/insurance/quotation-guoren/src/main/java/com/jzg/quotation/guoren/crawler/service/impl/GuoRenCrawlerRequestImpl.java

@@ -193,6 +193,8 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
         } else if (calculationPremium.getResultCode() == 1) {
             return GuoRenCrawlerQuoteResultsVoBuild.buildFailQuoteResultsVo(quoteVo, calculationPremium);
         }
+        // 报价成功后,根据保司返回信息更新交强险和商业险的起保日期和终保日期
+        updateInsuranceDates(quoteVo, calculationPremium.getData());
         // 驾意险(非车险)处理:查询 → 校验 → 投保
         String niPolicyNumber = null;
         GuoRenCrawlerCreateOrderRequest createOrderRequest = null;
@@ -221,7 +223,6 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
             }
         }
 
-
         // 投保验证码处理
         GuoRenCrawlerCalculationPremiumData calculationPremiumData = guoRenCrawlerQuoteProcessService.insuranceVerificationCodeProcessing(crawlerCalculationPremiumRequest, calculationPremium.getData(), headers);
         // 保存投保单号
@@ -239,6 +240,57 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
         return guoRenCrawlerRequestComponent.writeBackAddress(addressNew, headers);
     }
 
+    /**
+     * 报价成功后,根据保司返回的报价信息更新交强险和商业险的起保日期和终保日期
+     * 从 prptitemkindList 中取第一个险种的日期作为保险起止日期
+     *
+     * @param quoteVo 报价单
+     * @param data    保费计算结果数据
+     */
+    private void updateInsuranceDates(QuoteVo quoteVo, GuoRenCrawlerCalculationPremiumData data) {
+        if (data == null) {
+            return;
+        }
+        // 更新交强险起保/终保日期
+        if (data.getCi() != null && CollUtil.isNotEmpty(data.getCi().getPrptitemkindList())) {
+            GuoRenCrawlerCalculationPremiumData.CiDTO.PrptitemkindListDTO firstKind = data.getCi().getPrptitemkindList().get(0);
+            if (firstKind.getStartDate() != null && quoteVo.getCiRiskInfoVo() != null) {
+                String ciStartDateTime = buildDateTimeString(firstKind.getStartDate(),
+                        firstKind.getStartHour(), 0);
+                String ciEndDateTime = buildDateTimeString(firstKind.getEndDate(),
+                        firstKind.getEndHour(), 0);
+                quoteVo.getCiRiskInfoVo().setStartDate(ciStartDateTime);
+                quoteVo.getCiRiskInfoVo().setEndDate(ciEndDateTime);
+            }
+        }
+        // 更新商业险起保/终保日期
+        if (data.getBi() != null && CollUtil.isNotEmpty(data.getBi().getPrptitemkindList())) {
+            GuoRenCrawlerCalculationPremiumData.BiDTO.PrptitemkindListDTO firstKind = data.getBi().getPrptitemkindList().get(0);
+            if (firstKind.getStartDate() != null && quoteVo.getBiRiskInfoVo() != null) {
+                String biStartDateTime = buildDateTimeString(firstKind.getStartDate(),
+                        firstKind.getStartHour(), 0);
+                String biEndDateTime = buildDateTimeString(firstKind.getEndDate(),
+                        firstKind.getEndHour(), 0);
+                quoteVo.getBiRiskInfoVo().setStartDate(biStartDateTime);
+                quoteVo.getBiRiskInfoVo().setEndDate(biEndDateTime);
+            }
+        }
+    }
+
+    /**
+     * 拼接日期、时、分为完整时间字符串
+     *
+     * @param date   日期,格式 yyyy-MM-dd
+     * @param hour   小时
+     * @param minute 分钟
+     * @return 完整时间字符串,格式 yyyy-MM-dd HH:mm:ss
+     */
+    private static String buildDateTimeString(String date, Integer hour, Integer minute) {
+        int h = hour != null ? hour : 0;
+        int m = minute != null ? minute : 0;
+        return date + " " + String.format("%02d", h) + ":" + String.format("%02d", m) + ":00";
+    }
+
     // 截取重复投保终保日期
     private static final Pattern DUPLICATE_END_TIME_PATTERN = Pattern.compile("终保日期 (\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2})");