|
@@ -1,28 +1,42 @@
|
|
|
package com.jzg.quotation.taishan.crawler.build;
|
|
package com.jzg.quotation.taishan.crawler.build;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.jzg.commons.entity.po.InsCompanyClause;
|
|
import com.jzg.commons.entity.po.InsCompanyClause;
|
|
|
import com.jzg.commons.entity.quote.vo.*;
|
|
import com.jzg.commons.entity.quote.vo.*;
|
|
|
|
|
+import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.IDCardUtils;
|
|
import com.jzg.commons.util.IDCardUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.quotation.commons.utils.DateUtil;
|
|
import com.jzg.quotation.commons.utils.DateUtil;
|
|
|
|
|
+import com.jzg.quotation.taishan.crawler.component.TaiShanCrawlerRequestComponent;
|
|
|
|
|
+import com.jzg.quotation.taishan.crawler.constant.enums.RequestUrl;
|
|
|
import com.jzg.quotation.taishan.crawler.constant.enums.TaxTypeYn;
|
|
import com.jzg.quotation.taishan.crawler.constant.enums.TaxTypeYn;
|
|
|
import com.jzg.quotation.taishan.crawler.entity.TaiShanCrawlerConfigureParameters;
|
|
import com.jzg.quotation.taishan.crawler.entity.TaiShanCrawlerConfigureParameters;
|
|
|
import com.jzg.quotation.taishan.crawler.entity.request.TaiShanCrawlerQuotationRequest;
|
|
import com.jzg.quotation.taishan.crawler.entity.request.TaiShanCrawlerQuotationRequest;
|
|
|
import com.jzg.quotation.taishan.crawler.entity.response.TaiShanCrawlerCarResponse;
|
|
import com.jzg.quotation.taishan.crawler.entity.response.TaiShanCrawlerCarResponse;
|
|
|
import com.jzg.quotation.taishan.crawler.entity.response.TaiShanCrawlerDeptResponse;
|
|
import com.jzg.quotation.taishan.crawler.entity.response.TaiShanCrawlerDeptResponse;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
+import com.jzg.quotation.taishan.crawler.properties.TaiShanCrawlerProperties;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
|
|
+import org.springframework.web.util.UriComponentsBuilder;
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class TaiShanCrawlerQuoteRequestVoBuild {
|
|
public class TaiShanCrawlerQuoteRequestVoBuild {
|
|
|
|
|
|
|
|
- public static TaiShanCrawlerQuotationRequest toQuotationDto(QuoteVo quoteVo, TaiShanCrawlerCarResponse.CarModelInfo modelsDTO, String currentValue, TaiShanCrawlerConfigureParameters parameters, TaiShanCrawlerDeptResponse taiShanCrawlerDeptResponse, AttributionInformationVo attributionInformationVo, String policyPersonId, String insuredPersonId) {
|
|
|
|
|
|
|
+ public static TaiShanCrawlerQuotationRequest toQuotationDto(QuoteVo quoteVo, TaiShanCrawlerCarResponse.CarModelInfo modelsDTO, String currentValue, TaiShanCrawlerConfigureParameters parameters, TaiShanCrawlerDeptResponse taiShanCrawlerDeptResponse, AttributionInformationVo attributionInformationVo, String policyPersonId, String insuredPersonId, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
TaiShanCrawlerQuotationRequest request = new TaiShanCrawlerQuotationRequest();
|
|
TaiShanCrawlerQuotationRequest request = new TaiShanCrawlerQuotationRequest();
|
|
|
// 设置投保人信息
|
|
// 设置投保人信息
|
|
|
CustomerInfoVo policyHolderInfo = quoteVo.getPolicyHolderInfo();
|
|
CustomerInfoVo policyHolderInfo = quoteVo.getPolicyHolderInfo();
|
|
@@ -56,7 +70,6 @@ public class TaiShanCrawlerQuoteRequestVoBuild {
|
|
|
request.setHouseholdBInsurance(new Object());
|
|
request.setHouseholdBInsurance(new Object());
|
|
|
request.setHouseholdCInsurance(new Object());
|
|
request.setHouseholdCInsurance(new Object());
|
|
|
request.setDpInsurance(new Object());
|
|
request.setDpInsurance(new Object());
|
|
|
- request.setDiInsurance(new Object());
|
|
|
|
|
request.setMcInsurance(new Object());
|
|
request.setMcInsurance(new Object());
|
|
|
request.setGlInsurance(new Object());
|
|
request.setGlInsurance(new Object());
|
|
|
request.setTfInsurance(new Object());
|
|
request.setTfInsurance(new Object());
|
|
@@ -69,10 +82,464 @@ public class TaiShanCrawlerQuoteRequestVoBuild {
|
|
|
request.setRtInsurance(new Object());
|
|
request.setRtInsurance(new Object());
|
|
|
request.setFlatvhlInfo(new Object());
|
|
request.setFlatvhlInfo(new Object());
|
|
|
request.setBtInsurance(new Object());
|
|
request.setBtInsurance(new Object());
|
|
|
- request.setOpdInsurance(new Object());
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 1驾意险
|
|
|
|
|
+ // 1.1驾乘人员意外伤害险 UN1 50万以上险种 / UN2 50万以下
|
|
|
|
|
+ if (quoteVo.getAccidentalDrivings().isEmpty()) {
|
|
|
|
|
+ request.setDiInsurance(new TaiShanCrawlerQuotationRequest.DiInsurance());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ TaiShanCrawlerQuotationRequest.DiInsurance drivingDiInsuranceDto = toDrivingDiInsuranceDto(quoteVo, request, parameters, headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ if (Objects.nonNull(drivingDiInsuranceDto)) {
|
|
|
|
|
+ request.setDiInsurance(drivingDiInsuranceDto);
|
|
|
|
|
+ request.getProposalInfo().setDiMark("1");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ request.setDiInsurance(new TaiShanCrawlerQuotationRequest.DiInsurance());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 1.2车主门诊保险 0691_A
|
|
|
|
|
+ if (quoteVo.getAccidentalDrivings().isEmpty()) {
|
|
|
|
|
+ request.setOpdInsurance(new TaiShanCrawlerQuotationRequest.OpdInsurance());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ TaiShanCrawlerQuotationRequest.OpdInsurance drivingOpdInsuranceDto = toDrivingOpdInsuranceDto(quoteVo, request, parameters, headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ if (Objects.nonNull(drivingOpdInsuranceDto)) {
|
|
|
|
|
+ request.setOpdInsurance(drivingOpdInsuranceDto);
|
|
|
|
|
+ request.getProposalInfo().setOpdmark("1");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ request.setOpdInsurance(new TaiShanCrawlerQuotationRequest.OpdInsurance());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return request;
|
|
return request;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static TaiShanCrawlerQuotationRequest.DiInsurance toDrivingDiInsuranceDto(QuoteVo quoteVo, TaiShanCrawlerQuotationRequest request, TaiShanCrawlerConfigureParameters parameters, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ List<String> schemeList = List.of("UN1", "UN2");
|
|
|
|
|
+ TaiShanCrawlerQuotationRequest.DiInsurance diInsurance = null;
|
|
|
|
|
+ String startDate, endDate;
|
|
|
|
|
+ if (quoteVo.getBiRiskInfoVo() != null) {
|
|
|
|
|
+ startDate = quoteVo.getBiRiskInfoVo().getStartDate();
|
|
|
|
|
+ endDate = quoteVo.getBiRiskInfoVo().getEndDate();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ startDate = quoteVo.getCiRiskInfoVo().getStartDate();
|
|
|
|
|
+ endDate = quoteVo.getCiRiskInfoVo().getEndDate();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<String> accidentalDrivingsProductCodeList = new ArrayList<>();
|
|
|
|
|
+ for (AccidentalDrivingVo accidentalDriving : quoteVo.getAccidentalDrivings()) {
|
|
|
|
|
+ accidentalDrivingsProductCodeList.add(accidentalDriving.getProductCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean match = accidentalDrivingsProductCodeList.stream().anyMatch(schemeList::contains);
|
|
|
|
|
+ if (match) {
|
|
|
|
|
+ diInsurance = new TaiShanCrawlerQuotationRequest.DiInsurance();
|
|
|
|
|
+ diInsurance.setStartDate(startDate);
|
|
|
|
|
+ diInsurance.setEndDate(endDate);
|
|
|
|
|
+ diInsurance.setPremium("");
|
|
|
|
|
+ diInsurance.setRiskAmount("");
|
|
|
|
|
+ diInsurance.setProposalNo("");
|
|
|
|
|
+ diInsurance.setPolicyNo("");
|
|
|
|
|
+ diInsurance.setDay(365);
|
|
|
|
|
+ Map<String, Object> agreement1301Res = agreement1301(headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ log.info("diInsurance_agreement1301:{}", JSONObject.toJSONString(agreement1301Res));
|
|
|
|
|
+ String specialContent = String.valueOf(agreement1301Res.get("result"));
|
|
|
|
|
+ diInsurance.setSpecialContent(specialContent);
|
|
|
|
|
+ //自主定价系数
|
|
|
|
|
+ diInsurance.setResvNumAutonomy("0.5");
|
|
|
|
|
+ //自定义方案
|
|
|
|
|
+ diInsurance.setSchemeList("UN");
|
|
|
|
|
+ //驾意险份数
|
|
|
|
|
+ diInsurance.setNumber(String.valueOf(quoteVo.getAccidentalDrivings().get(0).getQuantity()));
|
|
|
|
|
+ diInsurance.setId("");
|
|
|
|
|
+ //目前根据python代码暂定驾意险只有一个,后续有问题再优化
|
|
|
|
|
+ diInsurance.setDiKinds(getDiKinds(accidentalDrivingsProductCodeList.get(0)));
|
|
|
|
|
+
|
|
|
|
|
+ // 复制报价参数
|
|
|
|
|
+ Map<String, Object> priceUncarDaData = new HashMap<>();
|
|
|
|
|
+ try {
|
|
|
|
|
+ priceUncarDaData = new ObjectMapper().readValue(JSONObject.toJSONString(request), new TypeReference<Map<String, Object>>() {});
|
|
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
|
|
+ throw new SystemException("diInsurance_复制报价参数异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ priceUncarDaData.put("diInsurance", diInsurance);
|
|
|
|
|
+ Map<String, Object> priceUncarDaRes = priceUncarDa(priceUncarDaData, headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ log.info("diInsurance_非车保费计算结果:{}", JSONObject.toJSONString(priceUncarDaRes));
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> resRoot = (Map<String, Object>) priceUncarDaRes.get("result");
|
|
|
|
|
+ Map<String, Object> diInsurancePrice = (Map<String, Object>) resRoot.get("diInsurance");
|
|
|
|
|
+ Map<String, Object> vehicleInfoRes = (Map<String, Object>) resRoot.get("vehicleInfo");
|
|
|
|
|
+ String syUuidRes = vehicleInfoRes == null ? "" : String.valueOf(vehicleInfoRes.get("syUuid"));
|
|
|
|
|
+ String jqUuidRes = vehicleInfoRes == null ? "" : String.valueOf(vehicleInfoRes.get("jqUuid"));
|
|
|
|
|
+ String iidd = String.valueOf(diInsurancePrice.get("id"));
|
|
|
|
|
+ String schemeListRes = String.valueOf(diInsurancePrice.get("schemeList"));
|
|
|
|
|
+ String numberRes = String.valueOf(diInsurancePrice.get("number"));
|
|
|
|
|
+ List<Map<String, Object>> diKindsRaw = (List<Map<String, Object>>) diInsurancePrice.get("diKinds");
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, Object>> diKindsFilter = new ArrayList<>();
|
|
|
|
|
+ for (Map<String, Object> item : diKindsRaw) {
|
|
|
|
|
+ if (!"0".equals(String.valueOf(item.get("perAmt")))) {
|
|
|
|
|
+ diKindsFilter.add(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String resvNumAutonomyVal = String.valueOf(diInsurancePrice.get("resvNumAutonomy"));
|
|
|
|
|
+ String specialContentVal = String.valueOf(diInsurancePrice.get("specialContent"));
|
|
|
|
|
+ String riskAmountVal = String.valueOf(diInsurancePrice.get("riskAmount"));
|
|
|
|
|
+ String premiumVal = String.valueOf(diInsurancePrice.get("premium"));
|
|
|
|
|
+ String sDateVal = String.valueOf(diInsurancePrice.get("startDate"));
|
|
|
|
|
+ String eDateVal = String.valueOf(diInsurancePrice.get("endDate"));
|
|
|
|
|
+
|
|
|
|
|
+ // 组装保存入参
|
|
|
|
|
+ Map<String, Object> diInsuranceSaveData = new HashMap<>();
|
|
|
|
|
+ diInsuranceSaveData.put("orderNo", "");
|
|
|
|
|
+ diInsuranceSaveData.put("jqProposalNo", "");
|
|
|
|
|
+ diInsuranceSaveData.put("syProposalNo", "");
|
|
|
|
|
+ diInsuranceSaveData.put("unCarTypeCode", "1301");
|
|
|
|
|
+ diInsuranceSaveData.put("premium", premiumVal);
|
|
|
|
|
+ diInsuranceSaveData.put("riskAmount", riskAmountVal);
|
|
|
|
|
+ diInsuranceSaveData.put("specialContent", specialContentVal);
|
|
|
|
|
+ diInsuranceSaveData.put("resvNumAutonomy", resvNumAutonomyVal);
|
|
|
|
|
+ diInsuranceSaveData.put("diKinds", diKindsFilter);
|
|
|
|
|
+ diInsuranceSaveData.put("uncarId", "");
|
|
|
|
|
+ diInsuranceSaveData.put("startDate", sDateVal);
|
|
|
|
|
+ diInsuranceSaveData.put("endDate", eDateVal);
|
|
|
|
|
+ diInsuranceSaveData.put("proposalNo", "");
|
|
|
|
|
+ diInsuranceSaveData.put("policyNo", "");
|
|
|
|
|
+ diInsuranceSaveData.put("number", numberRes);
|
|
|
|
|
+ diInsuranceSaveData.put("schemeList", schemeListRes);
|
|
|
|
|
+ diInsuranceSaveData.put("id", iidd);
|
|
|
|
|
+ String finalUuid = (syUuidRes != null && !syUuidRes.isBlank()) ? syUuidRes : jqUuidRes;
|
|
|
|
|
+ diInsuranceSaveData.put("uuid", finalUuid);
|
|
|
|
|
+ diInsuranceSaveData.put("dptCde", parameters.getComCode());
|
|
|
|
|
+ diInsuranceSaveData.put("useNatureShow", request.getVehicleInfo().getUseNatureShow());
|
|
|
|
|
+ diInsuranceSaveData.put("seatCount", request.getVehicleInfo().getSeatCount());
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> saveUnCarDARes = saveUnCarDA(diInsuranceSaveData,headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ Map<String, Object> saveRoot = (Map<String, Object>) saveUnCarDARes.get("result");
|
|
|
|
|
+ String newRiskAmount = String.valueOf(saveRoot.get("riskAmount"));
|
|
|
|
|
+ String newPremium = String.valueOf(saveRoot.get("premium"));
|
|
|
|
|
+ String newId = String.valueOf(saveRoot.get("id"));
|
|
|
|
|
+ List<Map<String, Object>> cvrgVOs = (List<Map<String, Object>>) saveRoot.get("cvrgVOs");
|
|
|
|
|
+
|
|
|
|
|
+ List<String> KEYS = List.of("pkId", "seqNo", "kindCode", "kindName", "amount", "premium", "dailyAllowance", "days", "amountLimit", "perAmt");
|
|
|
|
|
+ List<Map<String, Object>> diKindsFinal = new ArrayList<>();
|
|
|
|
|
+ for (Map<String, Object> item : diKindsFilter) {
|
|
|
|
|
+ // 匹配cvrgVOs赋值pkId、premium
|
|
|
|
|
+ for (Map<String, Object> cvr : cvrgVOs) {
|
|
|
|
|
+ if (item.get("kindCode").equals(cvr.get("kindCode"))) {
|
|
|
|
|
+ item.put("premium", cvr.get("premium"));
|
|
|
|
|
+ item.put("pkId", cvr.get("pkId"));
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 只保留指定key
|
|
|
|
|
+ Map<String, Object> newItem = new HashMap<>();
|
|
|
|
|
+ for (String k : KEYS) {
|
|
|
|
|
+ if (item.containsKey(k)) {
|
|
|
|
|
+ newItem.put(k, item.get(k));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ diKindsFinal.add(newItem);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 更新diInsurance
|
|
|
|
|
+ diInsurance.setStartDate(sDateVal);
|
|
|
|
|
+ diInsurance.setEndDate(eDateVal);
|
|
|
|
|
+ diInsurance.setPremium(newPremium);
|
|
|
|
|
+ diInsurance.setRiskAmount(newRiskAmount);
|
|
|
|
|
+ diInsurance.setProposalNo("");
|
|
|
|
|
+ diInsurance.setPolicyNo("");
|
|
|
|
|
+ diInsurance.setDay(365);
|
|
|
|
|
+ diInsurance.setSpecialContent(specialContentVal);
|
|
|
|
|
+ //自主定价系数
|
|
|
|
|
+ diInsurance.setResvNumAutonomy(resvNumAutonomyVal);
|
|
|
|
|
+ //自定义方案
|
|
|
|
|
+ diInsurance.setSchemeList(schemeListRes);
|
|
|
|
|
+ //驾意险份数
|
|
|
|
|
+ diInsurance.setNumber(numberRes);
|
|
|
|
|
+ diInsurance.setId(newId);
|
|
|
|
|
+ //目前根据python代码暂定驾意险只有一个,后续有问题再优化
|
|
|
|
|
+ diInsurance.setDiKinds(diKindsFinal);
|
|
|
|
|
+ //proposalInfo.put("diMark", "1");
|
|
|
|
|
+ }
|
|
|
|
|
+ return diInsurance;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static TaiShanCrawlerQuotationRequest.OpdInsurance toDrivingOpdInsuranceDto(QuoteVo quoteVo, TaiShanCrawlerQuotationRequest request, TaiShanCrawlerConfigureParameters parameters, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ List<String> accidentalDrivingsProductCodeList = new ArrayList<>();
|
|
|
|
|
+ for (AccidentalDrivingVo accidentalDriving : quoteVo.getAccidentalDrivings()) {
|
|
|
|
|
+ accidentalDrivingsProductCodeList.add(accidentalDriving.getProductCode());
|
|
|
|
|
+ }
|
|
|
|
|
+ TaiShanCrawlerQuotationRequest.OpdInsurance opdInsurance = null;
|
|
|
|
|
+ boolean match = accidentalDrivingsProductCodeList.contains("0691_A");
|
|
|
|
|
+ if (match) {
|
|
|
|
|
+ // 车主门诊保险逻辑
|
|
|
|
|
+ //ZGdrivingInsurances.put("resvNumAutonomy", "");
|
|
|
|
|
+ //ZGdrivingInsurances.put("name", "车主门诊保险");
|
|
|
|
|
+ String startDate, endDate, uuidVal;
|
|
|
|
|
+ if (quoteVo.getBiRiskInfoVo() != null) {
|
|
|
|
|
+ startDate = quoteVo.getBiRiskInfoVo().getStartDate();
|
|
|
|
|
+ endDate = quoteVo.getBiRiskInfoVo().getEndDate();
|
|
|
|
|
+ uuidVal = request.getVehicleInfo().getSyUuid();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ startDate = quoteVo.getCiRiskInfoVo().getStartDate();
|
|
|
|
|
+ endDate = quoteVo.getCiRiskInfoVo().getEndDate();
|
|
|
|
|
+ uuidVal = request.getVehicleInfo().getJqUuid();
|
|
|
|
|
+ }
|
|
|
|
|
+ String unCarTypeCode = "0691";
|
|
|
|
|
+ String schemeListSplit = quoteVo.getAccidentalDrivings().get(0).getProductCode().split("_")[1];
|
|
|
|
|
+ String dptCde = parameters.getComCode();
|
|
|
|
|
+ String useNatureShow = request.getVehicleInfo().getUseNatureShow();
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> unCarInsReq = new HashMap<>();
|
|
|
|
|
+ unCarInsReq.put("jqProposalNo", "");
|
|
|
|
|
+ unCarInsReq.put("syProposalNo", "");
|
|
|
|
|
+ unCarInsReq.put("unCarTypeCode", unCarTypeCode);
|
|
|
|
|
+ unCarInsReq.put("schemeList", schemeListSplit);
|
|
|
|
|
+ unCarInsReq.put("novhlAge", "");
|
|
|
|
|
+ unCarInsReq.put("uuid", uuidVal);
|
|
|
|
|
+ unCarInsReq.put("dptCde", dptCde);
|
|
|
|
|
+ unCarInsReq.put("useNatureShow", useNatureShow);
|
|
|
|
|
+ Map<String, Object> unCarInsRes = unCarIns(unCarInsReq, headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ log.info("opdInsurance_unCarInsRes: {}", unCarInsRes);
|
|
|
|
|
+ Map<String, Object> unCarRoot = (Map<String, Object>) unCarInsRes.get("result");
|
|
|
|
|
+ List<Map<String, Object>> novhlList = (List<Map<String, Object>>) unCarRoot.get("novhlList");
|
|
|
|
|
+ Map<String, Object> firstNovhl = novhlList.get(0);
|
|
|
|
|
+ Map<String, Object> baseInfo = (Map<String, Object>) firstNovhl.get("base");
|
|
|
|
|
+ String specialContent = String.valueOf(baseInfo.get("specialContent"));
|
|
|
|
|
+ Map<String, Object> cvrgListWrap = (Map<String, Object>) firstNovhl.get("cvrgList");
|
|
|
|
|
+ List<Map<String, Object>> cvrgVOs = (List<Map<String, Object>>) cvrgListWrap.get("cvrgVOs");
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal totalPrm = BigDecimal.ZERO;
|
|
|
|
|
+ for (Map<String, Object> item : cvrgVOs) {
|
|
|
|
|
+ item.put("schemeList", schemeListSplit);
|
|
|
|
|
+ BigDecimal prm = new BigDecimal(String.valueOf(item.get("premium")));
|
|
|
|
|
+ totalPrm = totalPrm.add(prm);
|
|
|
|
|
+ }
|
|
|
|
|
+ cvrgVOs.get(0).put("totalPrm", totalPrm.toString());
|
|
|
|
|
+
|
|
|
|
|
+ // 组装保存参数
|
|
|
|
|
+ Map<String, Object> saveUnCarData = new HashMap<>();
|
|
|
|
|
+ saveUnCarData.put("orderNo", "");
|
|
|
|
|
+ saveUnCarData.put("jqProposalNo", "");
|
|
|
|
|
+ saveUnCarData.put("syProposalNo", "");
|
|
|
|
|
+ saveUnCarData.put("unCarTypeCode", "0691");
|
|
|
|
|
+ saveUnCarData.put("uncarId", "");
|
|
|
|
|
+ saveUnCarData.put("startDate", startDate);
|
|
|
|
|
+ saveUnCarData.put("endDate", endDate);
|
|
|
|
|
+ saveUnCarData.put("premium", "");
|
|
|
|
|
+ saveUnCarData.put("riskAmount", "");
|
|
|
|
|
+ saveUnCarData.put("proposalNo", "");
|
|
|
|
|
+ saveUnCarData.put("policyNo", "");
|
|
|
|
|
+ saveUnCarData.put("number", String.valueOf(quoteVo.getAccidentalDrivings().get(0).getQuantity()));
|
|
|
|
|
+ saveUnCarData.put("specialContent", specialContent);
|
|
|
|
|
+ saveUnCarData.put("uncarShortRate", "");
|
|
|
|
|
+ //投保人信息
|
|
|
|
|
+ saveUnCarData.put("applicant", JSONObject.toJSONString(request.getApplicantInfo()));
|
|
|
|
|
+ //被保人信息
|
|
|
|
|
+ saveUnCarData.put("insured", JSONObject.toJSONString(request.getInsuredInfo()));
|
|
|
|
|
+ saveUnCarData.put("itemKinds", cvrgVOs);
|
|
|
|
|
+ saveUnCarData.put("schemeList", schemeListSplit);
|
|
|
|
|
+ saveUnCarData.put("amt", "");
|
|
|
|
|
+ saveUnCarData.put("prm", "");
|
|
|
|
|
+ saveUnCarData.put("seatCount", request.getVehicleInfo().getSeatCount());
|
|
|
|
|
+ saveUnCarData.put("uuid", uuidVal);
|
|
|
|
|
+ saveUnCarData.put("id", "");
|
|
|
|
|
+ saveUnCarData.put("dptCde", dptCde);
|
|
|
|
|
+ saveUnCarData.put("useNatureShow", useNatureShow);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("opdInsurance_非车保存data:{}", JSONObject.toJSONString(saveUnCarData));
|
|
|
|
|
+ Map<String, Object> saveUnCarRes = saveUnCar(saveUnCarData, headers, taiShanCrawlerRequestComponent);
|
|
|
|
|
+ log.info("opdInsurance_保存返回值:{}", JSONObject.toJSONString(saveUnCarRes));
|
|
|
|
|
+ Map<String, Object> saveUnRoot = (Map<String, Object>) saveUnCarRes.get("result");
|
|
|
|
|
+ Map<String, Object> saveBase = (Map<String, Object>) saveUnRoot.get("base");
|
|
|
|
|
+ String iidd = String.valueOf(saveBase.get("id"));
|
|
|
|
|
+
|
|
|
|
|
+ // 组装opdInsurance
|
|
|
|
|
+ opdInsurance = new TaiShanCrawlerQuotationRequest.OpdInsurance();
|
|
|
|
|
+ opdInsurance.setUncarId("");
|
|
|
|
|
+ opdInsurance.setStartDate(startDate);
|
|
|
|
|
+ opdInsurance.setEndDate(endDate);
|
|
|
|
|
+ opdInsurance.setPremium("");
|
|
|
|
|
+ opdInsurance.setRiskAmount("");
|
|
|
|
|
+ opdInsurance.setProposalNo("");
|
|
|
|
|
+ opdInsurance.setPolicyNo("");
|
|
|
|
|
+ opdInsurance.setNumber(String.valueOf(quoteVo.getAccidentalDrivings().get(0).getQuantity()));
|
|
|
|
|
+ opdInsurance.setUncarShortRate("");
|
|
|
|
|
+ opdInsurance.setSpecialContent(specialContent);
|
|
|
|
|
+ opdInsurance.setItemKinds(cvrgVOs);
|
|
|
|
|
+ opdInsurance.setSchemeList(schemeListSplit);
|
|
|
|
|
+ opdInsurance.setAmt("");
|
|
|
|
|
+ opdInsurance.setPrm("");
|
|
|
|
|
+ opdInsurance.setId(iidd);
|
|
|
|
|
+ //priceData.put("opdInsurance", opdInsurance);
|
|
|
|
|
+ //proposalInfo.put("opdmark", "1");
|
|
|
|
|
+
|
|
|
|
|
+ // 加入列表
|
|
|
|
|
+ //Map<String, Object> resJyxItem = new HashMap<>();
|
|
|
|
|
+ //resJyxItem.put("name", ZGdrivingInsurances.get("name"));
|
|
|
|
|
+ //resJyxItem.put("policy", "");
|
|
|
|
|
+ //resJyxItem.put("price", totalPrm.toString());
|
|
|
|
|
+ //this.resJyx.add(resJyxItem);
|
|
|
|
|
+ }
|
|
|
|
|
+ return opdInsurance;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static Map<String, Object> saveUnCar(Map<String, Object> saveUnCarData, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ Map map = taiShanCrawlerRequestComponent.post(RequestUrl.SAVE_UN_CAR, saveUnCarData, Map.class, headers);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static Map<String, Object> unCarIns(Map<String, Object> unCarInsReq, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ Map map = taiShanCrawlerRequestComponent.post(RequestUrl.UN_CAR_INS, unCarInsReq, Map.class, headers);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private static Map<String, Object> saveUnCarDA(Map<String, Object> diInsuranceSaveData, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ Map map = taiShanCrawlerRequestComponent.post(RequestUrl.SAVE_UN_CAR_DA, diInsuranceSaveData, Map.class, headers);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static Map<String, Object> priceUncarDa(Map<String, Object> priceUncarDaData, HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ Map map = taiShanCrawlerRequestComponent.post(RequestUrl.PRICE_UN_CAR_DA, priceUncarDaData, Map.class, headers);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static Map<String, Object> agreement1301(HttpHeaders headers, TaiShanCrawlerRequestComponent taiShanCrawlerRequestComponent) {
|
|
|
|
|
+ Map map = taiShanCrawlerRequestComponent.get(RequestUrl.AGREEMENT1301, new Object(), Map.class, headers);
|
|
|
|
|
+ return map;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static List<Map<String, Object>> getDiKinds(String productCode) {
|
|
|
|
|
+ List<Map<String, Object>> diKinds = new ArrayList<>();
|
|
|
|
|
+ if ("UN1".equals(productCode)) {
|
|
|
|
|
+ // UN1 50万以上配置
|
|
|
|
|
+ Map<String, Object> item1 = new HashMap<>();
|
|
|
|
|
+ item1.put("id", "");
|
|
|
|
|
+ item1.put("prodName", "驾乘人意外险");
|
|
|
|
|
+ item1.put("prodNo", "1301");
|
|
|
|
|
+ item1.put("kindName", "身故保险责任和伤残保险责任");
|
|
|
|
|
+ item1.put("kindCode", "130101");
|
|
|
|
|
+ item1.put("seqNo", "1");
|
|
|
|
|
+ item1.put("riskAmount", "0.0");
|
|
|
|
|
+ item1.put("rate", "0.0");
|
|
|
|
|
+ item1.put("premium", "0.0");
|
|
|
|
|
+ item1.put("otherId", "1301");
|
|
|
|
|
+ item1.put("amountLimit", "391008");
|
|
|
|
|
+ item1.put("appNo", "");
|
|
|
|
|
+ item1.put("schemeList", "");
|
|
|
|
|
+ item1.put("amountAll", "");
|
|
|
|
|
+ item1.put("premiumAll", "");
|
|
|
|
|
+ item1.put("perAmt", "20000");
|
|
|
|
|
+ item1.put("dailyAllowance", "");
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> item2 = new HashMap<>();
|
|
|
|
|
+ item2.put("id", "");
|
|
|
|
|
+ item2.put("prodName", "驾乘人意外险");
|
|
|
|
|
+ item2.put("prodNo", "1301");
|
|
|
|
|
+ item2.put("kindName", "医疗保险责任");
|
|
|
|
|
+ item2.put("kindCode", "130102");
|
|
|
|
|
+ item2.put("seqNo", "2");
|
|
|
|
|
+ item2.put("riskAmount", "0.0");
|
|
|
|
|
+ item2.put("rate", "0.0");
|
|
|
|
|
+ item2.put("premium", "0.0");
|
|
|
|
|
+ item2.put("otherId", "1301");
|
|
|
|
|
+ item2.put("amountLimit", "392001");
|
|
|
|
|
+ item2.put("appNo", "");
|
|
|
|
|
+ item2.put("schemeList", "");
|
|
|
|
|
+ item2.put("amountAll", "");
|
|
|
|
|
+ item2.put("premiumAll", "");
|
|
|
|
|
+ item2.put("perAmt", "10000");
|
|
|
|
|
+ item2.put("dailyAllowance", "");
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> item3 = new HashMap<>();
|
|
|
|
|
+ item3.put("id", "");
|
|
|
|
|
+ item3.put("prodName", "驾乘人意外险");
|
|
|
|
|
+ item3.put("prodNo", "1301");
|
|
|
|
|
+ item3.put("kindName", "附加住院津贴保险");
|
|
|
|
|
+ item3.put("kindCode", "130103");
|
|
|
|
|
+ item3.put("seqNo", "3");
|
|
|
|
|
+ item3.put("riskAmount", "0.0");
|
|
|
|
|
+ item3.put("rate", "0.0");
|
|
|
|
|
+ item3.put("premium", "0.0");
|
|
|
|
|
+ item3.put("otherId", "1301");
|
|
|
|
|
+ item3.put("amountLimit", "393001");
|
|
|
|
|
+ item3.put("appNo", "");
|
|
|
|
|
+ item3.put("schemeList", "");
|
|
|
|
|
+ item3.put("amountAll", "");
|
|
|
|
|
+ item3.put("premiumAll", "");
|
|
|
|
|
+ item3.put("perAmt", "100");
|
|
|
|
|
+ item3.put("dailyAllowance", "100");
|
|
|
|
|
+ item3.put("days", "180");
|
|
|
|
|
+
|
|
|
|
|
+ diKinds.add(item1);
|
|
|
|
|
+ diKinds.add(item2);
|
|
|
|
|
+ diKinds.add(item3);
|
|
|
|
|
+ } else if ("UN2".equals(productCode)) {
|
|
|
|
|
+ // UN2 50万以下配置
|
|
|
|
|
+ Map<String, Object> item1 = new HashMap<>();
|
|
|
|
|
+ item1.put("id", "");
|
|
|
|
|
+ item1.put("prodName", "驾乘人意外险");
|
|
|
|
|
+ item1.put("prodNo", "1301");
|
|
|
|
|
+ item1.put("kindName", "身故保险责任和伤残保险责任");
|
|
|
|
|
+ item1.put("kindCode", "130101");
|
|
|
|
|
+ item1.put("seqNo", "1");
|
|
|
|
|
+ item1.put("riskAmount", "0.0");
|
|
|
|
|
+ item1.put("rate", "0.0");
|
|
|
|
|
+ item1.put("premium", "0.0");
|
|
|
|
|
+ item1.put("otherId", "1301");
|
|
|
|
|
+ item1.put("amountLimit", "391007");
|
|
|
|
|
+ item1.put("appNo", "");
|
|
|
|
|
+ item1.put("schemeList", "");
|
|
|
|
|
+ item1.put("amountAll", "");
|
|
|
|
|
+ item1.put("premiumAll", "");
|
|
|
|
|
+ item1.put("perAmt", "10000");
|
|
|
|
|
+ item1.put("dailyAllowance", "");
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> item2 = new HashMap<>();
|
|
|
|
|
+ item2.put("id", "");
|
|
|
|
|
+ item2.put("prodName", "驾乘人意外险");
|
|
|
|
|
+ item2.put("prodNo", "1301");
|
|
|
|
|
+ item2.put("kindName", "医疗保险责任");
|
|
|
|
|
+ item2.put("kindCode", "130102");
|
|
|
|
|
+ item2.put("seqNo", "2");
|
|
|
|
|
+ item2.put("riskAmount", "0.0");
|
|
|
|
|
+ item2.put("rate", "0.0");
|
|
|
|
|
+ item2.put("premium", "0.0");
|
|
|
|
|
+ item2.put("otherId", "1301");
|
|
|
|
|
+ item2.put("amountLimit", "000000");
|
|
|
|
|
+ item2.put("appNo", "");
|
|
|
|
|
+ item2.put("schemeList", "");
|
|
|
|
|
+ item2.put("amountAll", "");
|
|
|
|
|
+ item2.put("premiumAll", "");
|
|
|
|
|
+ item2.put("perAmt", "0");
|
|
|
|
|
+ item2.put("dailyAllowance", "");
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> item3 = new HashMap<>();
|
|
|
|
|
+ item3.put("id", "");
|
|
|
|
|
+ item3.put("prodName", "驾乘人意外险");
|
|
|
|
|
+ item3.put("prodNo", "1301");
|
|
|
|
|
+ item3.put("kindName", "附加住院津贴保险");
|
|
|
|
|
+ item3.put("kindCode", "130103");
|
|
|
|
|
+ item3.put("seqNo", "3");
|
|
|
|
|
+ item3.put("riskAmount", "0.0");
|
|
|
|
|
+ item3.put("rate", "0.0");
|
|
|
|
|
+ item3.put("premium", "0.0");
|
|
|
|
|
+ item3.put("otherId", "1301");
|
|
|
|
|
+ item3.put("amountLimit", "000000");
|
|
|
|
|
+ item3.put("appNo", "");
|
|
|
|
|
+ item3.put("schemeList", "");
|
|
|
|
|
+ item3.put("amountAll", "");
|
|
|
|
|
+ item3.put("premiumAll", "");
|
|
|
|
|
+ item3.put("perAmt", "0");
|
|
|
|
|
+ item3.put("dailyAllowance", "0");
|
|
|
|
|
+ item3.put("days", "180");
|
|
|
|
|
+
|
|
|
|
|
+ diKinds.add(item1);
|
|
|
|
|
+ diKinds.add(item2);
|
|
|
|
|
+ diKinds.add(item3);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new SystemException("获取错误的非车方案,请核实");
|
|
|
|
|
+ }
|
|
|
|
|
+ return diKinds;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static TaiShanCrawlerQuotationRequest.CoefficientInfo toCoefficientInfoDto(QuoteVo quoteVo) {
|
|
private static TaiShanCrawlerQuotationRequest.CoefficientInfo toCoefficientInfoDto(QuoteVo quoteVo) {
|
|
|
RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();
|
|
RiskInfoVo biRiskInfoVo = quoteVo.getBiRiskInfoVo();
|
|
|
RiskInfoVo ciRiskInfoVo = quoteVo.getCiRiskInfoVo();
|
|
RiskInfoVo ciRiskInfoVo = quoteVo.getCiRiskInfoVo();
|
|
@@ -591,6 +1058,13 @@ public class TaiShanCrawlerQuoteRequestVoBuild {
|
|
|
"MJ1", "MJ2", "BD", "TY4"
|
|
"MJ1", "MJ2", "BD", "TY4"
|
|
|
));
|
|
));
|
|
|
|
|
|
|
|
|
|
+ /** 驾意险险种编码集合 */
|
|
|
|
|
+ private static final Set<String> DRIVINGINSURANCES_KIND_CODES = new HashSet<>(Arrays.asList(
|
|
|
|
|
+ "UN1", "UN2", "D3", "D4", "G1", "L", "F",
|
|
|
|
|
+ "SY_FJ_YBW1", "SY_FJ_YBW2", "SY_FJ_YBW3",
|
|
|
|
|
+ "MJ1", "MJ2", "BD", "TY4", "0691_A"
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
/** 【第三者责任险】限额档次 */
|
|
/** 【第三者责任险】限额档次 */
|
|
|
private static final List<String[]> THIRD_LIMIT_AMT = Arrays.asList(
|
|
private static final List<String[]> THIRD_LIMIT_AMT = Arrays.asList(
|
|
|
new String[]{"10万元", "306006005"},
|
|
new String[]{"10万元", "306006005"},
|
|
@@ -969,9 +1443,9 @@ public class TaiShanCrawlerQuoteRequestVoBuild {
|
|
|
vehicleInfo.setPrintUsageCde("");
|
|
vehicleInfo.setPrintUsageCde("");
|
|
|
vehicleInfo.setPrintUsageCdeFlag("0");
|
|
vehicleInfo.setPrintUsageCdeFlag("0");
|
|
|
LocalDate regDate = LocalDate.parse(vehicleInfo.getRegisterDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
LocalDate regDate = LocalDate.parse(vehicleInfo.getRegisterDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
- int regYear = regDate.getYear(); // 注册年份
|
|
|
|
|
- int currentYear = LocalDate.now().getYear(); // 当前年份
|
|
|
|
|
- int carAge = currentYear - regYear; // 车龄
|
|
|
|
|
|
|
+ //int regYear = regDate.getYear(); // 注册年份
|
|
|
|
|
+ //int currentYear = LocalDate.now().getYear(); // 当前年份
|
|
|
|
|
+ int carAge = (int) ChronoUnit.YEARS.between(regDate, LocalDate.now()); // 车龄
|
|
|
vehicleInfo.setCarAge(carAge + "");
|
|
vehicleInfo.setCarAge(carAge + "");
|
|
|
vehicleInfo.setPrintUsageCdeSub("");
|
|
vehicleInfo.setPrintUsageCdeSub("");
|
|
|
vehicleInfo.setJqCResvTxt20("");
|
|
vehicleInfo.setJqCResvTxt20("");
|