|
|
@@ -38,9 +38,7 @@ import com.jzg.quotation.guoren.crawler.entity.response.*;
|
|
|
import com.jzg.quotation.guoren.crawler.service.GuoRenCrawlerOrderService;
|
|
|
import com.jzg.quotation.guoren.crawler.service.GuoRenCrawlerQuoteProcessService;
|
|
|
import com.jzg.quotation.guoren.crawler.service.GuoRenCrawlerRequest;
|
|
|
-import com.jzg.quotation.guoren.crawler.utils.TimeUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
@@ -51,7 +49,6 @@ import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
-@Slf4j
|
|
|
@QuoteCrawlerService(value = InsuranceCode.INSURANCE_XDCX)
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
@@ -154,8 +151,8 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
if (startTime == null) {
|
|
|
return GuoRenCrawlerQuoteResultsVoBuild.buildFailQuoteResultsVo(quoteVo, calculationPremium);
|
|
|
} else {
|
|
|
+ // 交强
|
|
|
RiskInfoVo ciRiskInfoVo = new RiskInfoVo();
|
|
|
-
|
|
|
if (startTime != null && startTime.endsWith("00:00:00")) {
|
|
|
ciRiskInfoVo.setInstantFlag(false);
|
|
|
endTime = TimeProcessing.minusOneSecondAfterYear(startTime);
|
|
|
@@ -170,13 +167,7 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
ciRiskInfoVo.setEndDate(endTime);
|
|
|
|
|
|
GuoRenPrpTmainDTO prpTMainDTO = new GuoRenPrpTmainDTO(ciRiskInfoVo, TimeProcessing.nowDate());
|
|
|
-
|
|
|
- // 交强
|
|
|
- prpTMainDTO.setEndDate(TimeUtils.extractDate(ciRiskInfoVo.getEndDate()));
|
|
|
- prpTMainDTO.setEndHour(24);
|
|
|
- prpTMainDTO.setEndMinute(0);
|
|
|
crawlerCalculationPremiumRequest.getCi().setPrpTmain(prpTMainDTO);
|
|
|
- crawlerCalculationPremiumRequest.getCi().setPrptitemkindList(GuoRenCrawlerCalculationPremiumRequest.PrptitemkindListDTO.getCiPrptitemkindList(prpTMainDTO));
|
|
|
|
|
|
crawlerCalculationPremiumRequest.getCi().getPrptitemkindList().forEach(item -> {
|
|
|
item.setStartDate(startDate);
|
|
|
@@ -221,15 +212,6 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
createOrderRequest = new GuoRenCrawlerCreateOrderRequest(quoteVo, crawlerCalculationPremiumRequest, queryLiabList);
|
|
|
// 第一步:驾意险校验
|
|
|
GuoRenCrawlerBaseResponse<GuoRenCrawlerCreateOrderCheckData> checkResponse = guoRenCrawlerRequestComponent.createOrderCheck(createOrderRequest, headers);
|
|
|
- if (!"0000".equals(checkResponse.getCode()) && "请输入正确的身份证有效期".equals(checkResponse.getMessage())) {
|
|
|
- // 翻转CertiValidity(4→2 或 2→4)后重试
|
|
|
- String currentValidity = createOrderRequest.getData().getOrderList().get(0).getInsuredList().get(0).getCertiValidity();
|
|
|
- String newValidity = "4".equals(currentValidity) ? "2" : "4";
|
|
|
- createOrderRequest.getData().getOrderList().get(0).getInsuredList().get(0).setCertiValidity(newValidity);
|
|
|
- createOrderRequest.getData().getOrderList().get(0).getOrderAppl().setCertiValidity(newValidity);
|
|
|
- log.info("驾意险校验身份证有效期错误,翻转CertiValidity:{} -> {},重试", currentValidity, newValidity);
|
|
|
- checkResponse = guoRenCrawlerRequestComponent.createOrderCheck(createOrderRequest, headers);
|
|
|
- }
|
|
|
if (!checkResponse.getCode().equals("0000")) {
|
|
|
throw new SystemException("驾意险订单校验失败:" + checkResponse.getMessage());
|
|
|
}
|
|
|
@@ -263,7 +245,7 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
|
|
|
/**
|
|
|
* 报价成功后,根据保司返回的报价信息更新交强险和商业险的起保日期和终保日期
|
|
|
- * 从 prpTmain 中取保险起止日期
|
|
|
+ * 从 prptitemkindList 中取第一个险种的日期作为保险起止日期
|
|
|
*
|
|
|
* @param quoteVo 报价单
|
|
|
* @param data 保费计算结果数据
|
|
|
@@ -273,25 +255,25 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
return;
|
|
|
}
|
|
|
// 更新交强险起保/终保日期
|
|
|
- if (data.getCi() != null && data.getCi().getPrpTmain() != null) {
|
|
|
- GuoRenCrawlerCalculationPremiumData.CiDTO.PrpTmainDTO prpTmain = data.getCi().getPrpTmain();
|
|
|
- if (prpTmain.getStartDate() != null && quoteVo.getCiRiskInfoVo() != null) {
|
|
|
- String ciStartDateTime = buildDateTimeString(prpTmain.getStartDate(),
|
|
|
- prpTmain.getStartHour(), prpTmain.getStartMinute());
|
|
|
- String ciEndDateTime = buildDateTimeString(prpTmain.getEndDate(),
|
|
|
- prpTmain.getEndHour(), prpTmain.getEndMinute());
|
|
|
+ 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 && data.getBi().getPrpTmain() != null) {
|
|
|
- GuoRenCrawlerCalculationPremiumData.BiDTO.PrpTmainDTO prpTmain = data.getBi().getPrpTmain();
|
|
|
- if (prpTmain.getStartDate() != null && quoteVo.getBiRiskInfoVo() != null) {
|
|
|
- String biStartDateTime = buildDateTimeString(prpTmain.getStartDate(),
|
|
|
- prpTmain.getStartHour(), prpTmain.getStartMinute());
|
|
|
- String biEndDateTime = buildDateTimeString(prpTmain.getEndDate(),
|
|
|
- prpTmain.getEndHour(), prpTmain.getEndMinute());
|
|
|
+ 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);
|
|
|
}
|