|
|
@@ -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})");
|
|
|
|