|
|
@@ -1,5 +1,7 @@
|
|
|
package com.jzg.quotation.taiping.crawler.build;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
import com.jzg.commons.entity.quote.vo.ExpenseFactor;
|
|
|
@@ -12,6 +14,9 @@ import com.jzg.quotation.taiping.crawler.entity.response.TaiPingCrawlerPremiumCa
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
public class TaiPingCrawlerQuoteResultsVoBuild {
|
|
|
@@ -122,7 +127,41 @@ public class TaiPingCrawlerQuoteResultsVoBuild {
|
|
|
premiumCalculateData.getPfRiskDtoList()
|
|
|
.stream().filter(riskDto -> riskDto.getRiskCode().equals("0802"))
|
|
|
.findFirst().ifPresent(syRiskDto -> scoreVo.setSyAdjustRate(String.valueOf(syRiskDto.getDiscount())));
|
|
|
+ Integer score = getCarScoreFromFlowApproveDto(premiumCalculateData.getFlowApproveDto());
|
|
|
+ JSONArray scoreJson = new JSONArray();
|
|
|
+ scoreJson.add(new JSONObject()
|
|
|
+ .fluentPut("scoreName", "太平评分")
|
|
|
+ .fluentPut("scoreKey","taipingScore")
|
|
|
+ .fluentPut("score", score));
|
|
|
+ scoreVo.setScoreJson(scoreJson);
|
|
|
return scoreVo;
|
|
|
}
|
|
|
|
|
|
+ public static Integer getCarScoreFromFlowApproveDto(List<TaiPingCrawlerPremiumCalculateData.FlowApproveDtoDTO> flowApproveDtoList) {
|
|
|
+ // 空集合直接返回null
|
|
|
+ if (flowApproveDtoList == null || flowApproveDtoList.isEmpty()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Pattern pattern = Pattern.compile("该车评分值为\\s*(\\d+)");
|
|
|
+
|
|
|
+ Optional<TaiPingCrawlerPremiumCalculateData.FlowApproveDtoDTO> dtoOpt = flowApproveDtoList.stream()
|
|
|
+ .filter(dto -> dto.getDescription() != null)
|
|
|
+ .filter(dto -> dto.getDescription().contains("该车评分值为"))
|
|
|
+ .findFirst();
|
|
|
+
|
|
|
+ if (dtoOpt.isPresent()) {
|
|
|
+ String desc = dtoOpt.get().getDescription();
|
|
|
+ Matcher matcher = pattern.matcher(desc);
|
|
|
+ if (matcher.find()) {
|
|
|
+ String numStr = matcher.group(1);
|
|
|
+ try {
|
|
|
+ return Integer.parseInt(numStr);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|