|
|
@@ -1,7 +1,9 @@
|
|
|
package com.jzg.quotation.guoren.crawler.service.impl;
|
|
|
|
|
|
+import com.jzg.commons.constants.InsuranceRisk;
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrders;
|
|
|
+import com.jzg.commons.entity.po.InsCompanyClause;
|
|
|
import com.jzg.commons.entity.quote.vo.AttributionInformationVo;
|
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
|
@@ -14,12 +16,14 @@ import com.jzg.quotation.commons.entity.GetCaptchaRequest;
|
|
|
import com.jzg.quotation.commons.entity.GetCaptchaResponse;
|
|
|
import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
|
|
|
import com.jzg.quotation.commons.utils.TimeProcessing;
|
|
|
+import com.jzg.quotation.guoren.api.entity.vo.GuoRenSpecialAgreementVo;
|
|
|
import com.jzg.quotation.guoren.crawler.build.GuoRenCrawlerQuoteResultsVoBuild;
|
|
|
import com.jzg.quotation.guoren.crawler.component.GuoRenCrawlerRequestComponent;
|
|
|
import com.jzg.quotation.guoren.crawler.constant.enums.RequestUrl;
|
|
|
import com.jzg.quotation.guoren.crawler.entity.GuoRenCrawlerConfigureParameters;
|
|
|
import com.jzg.quotation.guoren.crawler.entity.dto.GuoRenPrpTitemCarDTO;
|
|
|
import com.jzg.quotation.guoren.crawler.entity.dto.PrpTMainDTO;
|
|
|
+import com.jzg.quotation.guoren.crawler.entity.dto.PrptengageListDTO;
|
|
|
import com.jzg.quotation.guoren.crawler.entity.po.GuoRenCrawlerOrder;
|
|
|
import com.jzg.quotation.guoren.crawler.entity.po.OrderCommon;
|
|
|
import com.jzg.quotation.guoren.crawler.entity.request.GuoRenCrawlerCalculationPremiumRequest;
|
|
|
@@ -32,9 +36,11 @@ import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@QuoteCrawlerService(value = InsuranceCode.INSURANCE_XDCX)
|
|
|
@Service
|
|
|
@@ -90,8 +96,25 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
GuoRenCrawlerWriteBackAddressData policyHolderAddr = writeBackAddress(quoteVo.getPolicyHolderInfo().getAddr(), quoteVo.getOwnersInfo().getAddr(), ownersAddr, headers);
|
|
|
// 被保人 回填地址信息
|
|
|
GuoRenCrawlerWriteBackAddressData insuredPersonAddr = writeBackAddress(quoteVo.getInsuredPersonInfo().getAddr(), quoteVo.getPolicyHolderInfo().getAddr(), ownersAddr, headers);
|
|
|
+ // 获取并处理特约数据
|
|
|
+ List<GuoRenSpecialAgreementVo> specialAgreements = getSpecialAgreements(quoteVo);
|
|
|
+ // 处理车主约定特约T0028占位符替换
|
|
|
+ processSpecialAgreementT0028(specialAgreements, quoteVo);
|
|
|
// 保费计算
|
|
|
GuoRenCrawlerCalculationPremiumRequest crawlerCalculationPremiumRequest = new GuoRenCrawlerCalculationPremiumRequest(quoteVo, prpTmainDTO, prpTitemCar, policyHolderAddr, insuredPersonAddr, insuredTypeTmp);
|
|
|
+ // 按险种设置特约数据
|
|
|
+ if (crawlerCalculationPremiumRequest.getCi() != null) {
|
|
|
+ List<GuoRenSpecialAgreementVo> trafficSpecialAgreements = specialAgreements.stream()
|
|
|
+ .filter(x -> InsuranceRisk.TRAFFIC.getCode().equals(x.getRiskCode()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ crawlerCalculationPremiumRequest.getCi().setPrptengageList(PrptengageListDTO.fromSpecialAgreementVo(trafficSpecialAgreements));
|
|
|
+ }
|
|
|
+ if (crawlerCalculationPremiumRequest.getBi() != null) {
|
|
|
+ List<GuoRenSpecialAgreementVo> businessSpecialAgreements = specialAgreements.stream()
|
|
|
+ .filter(x -> InsuranceRisk.BUSINESS.getCode().equals(x.getRiskCode()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ crawlerCalculationPremiumRequest.getBi().setPrptengageList(PrptengageListDTO.fromSpecialAgreementVo(businessSpecialAgreements));
|
|
|
+ }
|
|
|
GuoRenCrawlerBaseResponse<GuoRenCrawlerCalculationPremiumData> calculationPremium = guoRenCrawlerRequestComponent.calculationPremium(crawlerCalculationPremiumRequest, headers);
|
|
|
// 处理重复投保
|
|
|
String message = calculationPremium.getResultMsg();
|
|
|
@@ -163,6 +186,42 @@ public class GuoRenCrawlerRequestImpl implements GuoRenCrawlerRequest {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取特约数据
|
|
|
+ * 从报价单中的特约条款列表转换为国任特约VO列表
|
|
|
+ *
|
|
|
+ * @param quoteVo 报价单
|
|
|
+ * @return 特约VO列表(按交强/商业险拆分)
|
|
|
+ */
|
|
|
+ private List<GuoRenSpecialAgreementVo> getSpecialAgreements(QuoteVo quoteVo) {
|
|
|
+ List<InsCompanyClause> companyClauseVos = quoteVo.getSpecialInfoVo();
|
|
|
+ List<GuoRenSpecialAgreementVo> list = new ArrayList<>();
|
|
|
+ for (InsuranceRisk insuranceRisk : InsuranceRisk.getInsuranceRisk()) {
|
|
|
+ List<GuoRenSpecialAgreementVo> collect = companyClauseVos.stream()
|
|
|
+ .map(x -> new GuoRenSpecialAgreementVo(x, insuranceRisk))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ list.addAll(collect);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理T0028车主约定特约,替换占位符
|
|
|
+ * 将特约内容中的下划线占位符替换为被保人姓名和车主姓名
|
|
|
+ *
|
|
|
+ * @param specialAgreements 特约列表
|
|
|
+ * @param quoteVo 报价单
|
|
|
+ */
|
|
|
+ private void processSpecialAgreementT0028(List<GuoRenSpecialAgreementVo> specialAgreements, QuoteVo quoteVo) {
|
|
|
+ specialAgreements.forEach(item -> {
|
|
|
+ if ("T0028".equals(item.getClauseCode())) {
|
|
|
+ String replace = item.getClausesContext().replaceFirst("_", quoteVo.getInsuredPersonInfo().getName());
|
|
|
+ replace = replace.replaceFirst("_", quoteVo.getOwnersInfo().getName());
|
|
|
+ item.setClausesContext(replace);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public UnderwritingResultsVo underwriting(UnderwritingVo underwritingVo) throws Exception {
|
|
|
String username = underwritingVo.getOrder().getAttributionInformationVo().getUsername();
|