|
@@ -1,6 +1,7 @@
|
|
|
package com.jzg.quotation.hengbang.crawler.build;
|
|
package com.jzg.quotation.hengbang.crawler.build;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
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.dict.InsOrderStatusEnum;
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
@@ -10,6 +11,8 @@ import com.jzg.commons.entity.quote.vo.aggregated.QuoteResultsVo;
|
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
import com.jzg.quotation.hengbang.crawler.entity.response.HbCrawlerProposalResponse;
|
|
import com.jzg.quotation.hengbang.crawler.entity.response.HbCrawlerProposalResponse;
|
|
|
|
|
|
|
|
|
|
+import java.time.ZonedDateTime;
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
@@ -37,7 +40,7 @@ public final class HbCrawlerQuoteResultVoBuild {
|
|
|
//交强险
|
|
//交强险
|
|
|
quoteResultsVo.setCiRiskInfoVo(buildCiInfo(proposalResponse));
|
|
quoteResultsVo.setCiRiskInfoVo(buildCiInfo(proposalResponse));
|
|
|
//商业险
|
|
//商业险
|
|
|
- quoteResultsVo.setBiRiskInfoVo(buildbiInfo(proposalResponse));
|
|
|
|
|
|
|
+ quoteResultsVo.setBiRiskInfoVo(buildBiInfo(proposalResponse));
|
|
|
quoteResultsVo.setKindInfoVo(buildKindInfoList(proposalResponse, quoteVo));
|
|
quoteResultsVo.setKindInfoVo(buildKindInfoList(proposalResponse, quoteVo));
|
|
|
|
|
|
|
|
QuoteResultsVo.ScoreVo scoreVo = new QuoteResultsVo.ScoreVo();
|
|
QuoteResultsVo.ScoreVo scoreVo = new QuoteResultsVo.ScoreVo();
|
|
@@ -45,22 +48,13 @@ public final class HbCrawlerQuoteResultVoBuild {
|
|
|
JSONArray scoreJson = new JSONArray();
|
|
JSONArray scoreJson = new JSONArray();
|
|
|
if (proposalResponse.getForceLiability() != null && proposalResponse.getCarInsureLiabilityList().size() > 0) {
|
|
if (proposalResponse.getForceLiability() != null && proposalResponse.getCarInsureLiabilityList().size() > 0) {
|
|
|
//光博评分
|
|
//光博评分
|
|
|
- scoreJson.add(new JSONObject()
|
|
|
|
|
- .fluentPut("scoreName", "交强光博分")
|
|
|
|
|
- .fluentPut("scoreKey", "score")
|
|
|
|
|
- .fluentPut("score", proposalResponse.getBusiCarInsureRisk().getBillelr2()));
|
|
|
|
|
|
|
+ scoreJson.add(new JSONObject().fluentPut("scoreName", "交强光博分").fluentPut("scoreKey", "score").fluentPut("score", proposalResponse.getBusiCarInsureRisk().getBillelr2()));
|
|
|
} else if (proposalResponse.getForceLiability() != null) {
|
|
} else if (proposalResponse.getForceLiability() != null) {
|
|
|
//光博评分
|
|
//光博评分
|
|
|
- scoreJson.add(new JSONObject()
|
|
|
|
|
- .fluentPut("scoreName", "交强光博分")
|
|
|
|
|
- .fluentPut("scoreKey", "score")
|
|
|
|
|
- .fluentPut("score", proposalResponse.getForceCarInsureRisk().getBillelr2()));
|
|
|
|
|
|
|
+ scoreJson.add(new JSONObject().fluentPut("scoreName", "交强光博分").fluentPut("scoreKey", "score").fluentPut("score", proposalResponse.getForceCarInsureRisk().getBillelr2()));
|
|
|
} else if (proposalResponse.getCarInsureLiabilityList().size() > 0) {
|
|
} else if (proposalResponse.getCarInsureLiabilityList().size() > 0) {
|
|
|
//光博评分
|
|
//光博评分
|
|
|
- scoreJson.add(new JSONObject()
|
|
|
|
|
- .fluentPut("scoreName", "交强光博分")
|
|
|
|
|
- .fluentPut("scoreKey", "score")
|
|
|
|
|
- .fluentPut("score", proposalResponse.getBusiCarInsureRisk().getBillelr2()));
|
|
|
|
|
|
|
+ scoreJson.add(new JSONObject().fluentPut("scoreName", "交强光博分").fluentPut("scoreKey", "score").fluentPut("score", proposalResponse.getBusiCarInsureRisk().getBillelr2()));
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -78,20 +72,20 @@ public final class HbCrawlerQuoteResultVoBuild {
|
|
|
HbCrawlerProposalResponse.ForceCarInsureRiskDTO forceCarInsureRisk = proposalResponse.getForceCarInsureRisk();
|
|
HbCrawlerProposalResponse.ForceCarInsureRiskDTO forceCarInsureRisk = proposalResponse.getForceCarInsureRisk();
|
|
|
if (Objects.nonNull(forceCarInsureRisk)) {
|
|
if (Objects.nonNull(forceCarInsureRisk)) {
|
|
|
ciRiskInfoVo.setRiskCode(forceCarInsureRisk.getRiskcode());
|
|
ciRiskInfoVo.setRiskCode(forceCarInsureRisk.getRiskcode());
|
|
|
- ciRiskInfoVo.setStartDate(forceCarInsureRisk.getBegintime());
|
|
|
|
|
- ciRiskInfoVo.setEndDate(forceCarInsureRisk.getEndtime());
|
|
|
|
|
|
|
+ ciRiskInfoVo.setStartDate(parseDate(forceCarInsureRisk.getBegintime()));
|
|
|
|
|
+ ciRiskInfoVo.setEndDate(parseDate(forceCarInsureRisk.getEndtime()));
|
|
|
}
|
|
}
|
|
|
return ciRiskInfoVo;
|
|
return ciRiskInfoVo;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static RiskInfoVo buildbiInfo(HbCrawlerProposalResponse proposalResponse) {
|
|
|
|
|
|
|
+ public static RiskInfoVo buildBiInfo(HbCrawlerProposalResponse proposalResponse) {
|
|
|
RiskInfoVo biRiskInfoVo = new RiskInfoVo();
|
|
RiskInfoVo biRiskInfoVo = new RiskInfoVo();
|
|
|
HbCrawlerProposalResponse.BusiCarInsureRiskDTO busiCarInsureRisk = proposalResponse.getBusiCarInsureRisk();
|
|
HbCrawlerProposalResponse.BusiCarInsureRiskDTO busiCarInsureRisk = proposalResponse.getBusiCarInsureRisk();
|
|
|
if (Objects.nonNull(busiCarInsureRisk)) {
|
|
if (Objects.nonNull(busiCarInsureRisk)) {
|
|
|
biRiskInfoVo.setRiskCode(busiCarInsureRisk.getRiskcode());
|
|
biRiskInfoVo.setRiskCode(busiCarInsureRisk.getRiskcode());
|
|
|
- biRiskInfoVo.setStartDate(busiCarInsureRisk.getBegintime());
|
|
|
|
|
- biRiskInfoVo.setEndDate(busiCarInsureRisk.getEndtime());
|
|
|
|
|
|
|
+ biRiskInfoVo.setStartDate(parseDate(busiCarInsureRisk.getBegintime()));
|
|
|
|
|
+ biRiskInfoVo.setEndDate(parseDate(busiCarInsureRisk.getEndtime()));
|
|
|
}
|
|
}
|
|
|
return biRiskInfoVo;
|
|
return biRiskInfoVo;
|
|
|
}
|
|
}
|
|
@@ -131,4 +125,34 @@ public final class HbCrawlerQuoteResultVoBuild {
|
|
|
//设置非车保费
|
|
//设置非车保费
|
|
|
quoteResultsVo.getCosts().setNiPremium(proposalResponse.getAccidentTotalPremium());
|
|
quoteResultsVo.getCosts().setNiPremium(proposalResponse.getAccidentTotalPremium());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 将日期字符串标准化为 yyyy-MM-dd HH:mm:ss 格式
|
|
|
|
|
+ * 支持多种日期格式:
|
|
|
|
|
+ * - ISO格式:yyyy-MM-ddTHH:mm:ss+08:00(含时区)
|
|
|
|
|
+ * - 完整格式:yyyy-MM-dd HH:mm:ss
|
|
|
|
|
+ * - 简短格式:yyyy-MM-dd(自动补充时间为00:00:00)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param dateStr 日期字符串,可以为null或空字符串
|
|
|
|
|
+ * @return 标准化后的日期字符串,如果输入为空则返回null
|
|
|
|
|
+ */
|
|
|
|
|
+ private static String parseDate(String dateStr) {
|
|
|
|
|
+ if (StrUtil.isEmpty(dateStr)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理仅包含日期的字符串(长度为10),补充默认时间
|
|
|
|
|
+ if (dateStr.length() == 10) {
|
|
|
|
|
+ return dateStr + " 00:00:00";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果包含T或时区信息,使用ISO格式解析后转换
|
|
|
|
|
+ if (dateStr.contains("T") || dateStr.contains("+") || dateStr.contains("Z")) {
|
|
|
|
|
+ ZonedDateTime zonedDateTime = ZonedDateTime.parse(dateStr, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
|
|
|
|
+ return zonedDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 已满足 yyyy-MM-dd HH:mm:ss 格式,直接返回
|
|
|
|
|
+ return dateStr;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|