|
@@ -1,40 +1,58 @@
|
|
|
package com.jzg.quote.guoren.api.service.Impl;
|
|
package com.jzg.quote.guoren.api.service.Impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
|
|
+import com.jzg.commons.constants.InsuranceRisk;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
|
|
+import com.jzg.quotation.commons.constant.enums.base.PolicyPrintType;
|
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.InsuranceUploadImageVo;
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.InsuranceUploadImageVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteResultsVo;
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteResultsVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.UnderwritingVo;
|
|
import com.jzg.quotation.commons.entity.vo.aggregated.UnderwritingVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.base.OrderBase;
|
|
import com.jzg.quotation.commons.entity.vo.base.OrderBase;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.image.InsuranceImageVo;
|
|
|
|
|
+import com.jzg.quotation.commons.entity.vo.quote.AccidentalDrivingVo;
|
|
|
import com.jzg.quotation.commons.entity.vo.quote.CarInfoVo;
|
|
import com.jzg.quotation.commons.entity.vo.quote.CarInfoVo;
|
|
|
import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
|
|
import com.jzg.quotation.commons.standard.conversion.ConfigureParametersConversion;
|
|
|
import com.jzg.quotation.commons.utils.DateTimeUtil;
|
|
import com.jzg.quotation.commons.utils.DateTimeUtil;
|
|
|
|
|
+import com.jzg.quotation.commons.utils.HttpUtil;
|
|
|
|
|
+import com.jzg.quote.guoren.api.build.GuoRenApiQuoteResultsVoBuild;
|
|
|
import com.jzg.quote.guoren.api.component.GuoRenRequestApiComponent;
|
|
import com.jzg.quote.guoren.api.component.GuoRenRequestApiComponent;
|
|
|
|
|
+import com.jzg.quote.guoren.api.constant.enums.GuoRenRiskCode;
|
|
|
import com.jzg.quote.guoren.api.constant.enums.PlatformInterfaceCode;
|
|
import com.jzg.quote.guoren.api.constant.enums.PlatformInterfaceCode;
|
|
|
import com.jzg.quote.guoren.api.entity.GuoRenApiOrder;
|
|
import com.jzg.quote.guoren.api.entity.GuoRenApiOrder;
|
|
|
import com.jzg.quote.guoren.api.entity.GuoRenConfigureParameters;
|
|
import com.jzg.quote.guoren.api.entity.GuoRenConfigureParameters;
|
|
|
-import com.jzg.quote.guoren.api.entity.Request.CarPriceMuchRequest;
|
|
|
|
|
-import com.jzg.quote.guoren.api.entity.Request.CarPriceRequest;
|
|
|
|
|
-import com.jzg.quote.guoren.api.entity.Request.VinQueryRequest;
|
|
|
|
|
-import com.jzg.quote.guoren.api.entity.Response.CarPriceMuchResponse;
|
|
|
|
|
-import com.jzg.quote.guoren.api.entity.Response.CarPriceResponse;
|
|
|
|
|
-import com.jzg.quote.guoren.api.entity.Response.VinQueryResponse;
|
|
|
|
|
-import com.jzg.quote.guoren.api.entity.dto.ChannelInfoDTO;
|
|
|
|
|
|
|
+import com.jzg.quote.guoren.api.entity.Request.*;
|
|
|
|
|
+import com.jzg.quote.guoren.api.entity.Response.*;
|
|
|
|
|
+import com.jzg.quote.guoren.api.entity.vo.GuoRenAccidentalDrivingVo;
|
|
|
|
|
+import com.jzg.quote.guoren.api.entity.vo.GuoRenSpecialAgreementVo;
|
|
|
|
|
+import com.jzg.quote.guoren.api.properties.GuoRenApiConfigurationProperties;
|
|
|
import com.jzg.quote.guoren.api.service.GuoRenApiOrderService;
|
|
import com.jzg.quote.guoren.api.service.GuoRenApiOrderService;
|
|
|
import com.jzg.quote.guoren.api.service.GuoRenApiRequest;
|
|
import com.jzg.quote.guoren.api.service.GuoRenApiRequest;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import org.apache.commons.httpclient.methods.multipart.FilePart;
|
|
|
|
|
+import org.apache.commons.httpclient.methods.multipart.Part;
|
|
|
|
|
+import org.apache.commons.httpclient.methods.multipart.StringPart;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
-import java.util.Comparator;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
+import static com.jzg.quotation.commons.constant.CacheConstant.GR_SPECIAL_AGREEMENT_KEY;
|
|
|
|
|
+import static com.jzg.quotation.commons.constant.CacheConstant.GR_SPECIAL_AGREEMENT_TIME;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @description:
|
|
* @description:
|
|
|
* @author: shenwd
|
|
* @author: shenwd
|
|
@@ -43,9 +61,17 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(GuoRenApiRequestImpl.class);
|
|
|
|
|
+
|
|
|
private final GuoRenRequestApiComponent guoRenRequestApiComponent;
|
|
private final GuoRenRequestApiComponent guoRenRequestApiComponent;
|
|
|
|
|
|
|
|
private final GuoRenApiOrderService guoRenApiOrderService;
|
|
private final GuoRenApiOrderService guoRenApiOrderService;
|
|
|
|
|
+
|
|
|
|
|
+ private final GuoRenApiConfigurationProperties properties;
|
|
|
|
|
+
|
|
|
|
|
+ private final RedisTemplate redisTemplate;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 报价
|
|
* 报价
|
|
|
* @param quoteVo 报价实体
|
|
* @param quoteVo 报价实体
|
|
@@ -57,23 +83,59 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
//配置信息
|
|
//配置信息
|
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
- ChannelInfoDTO channelInfoDTO = gainChannelConfigInfo(orderBase);
|
|
|
|
|
//vin码查询
|
|
//vin码查询
|
|
|
VinQueryRequest vinQueryRequest = new VinQueryRequest();
|
|
VinQueryRequest vinQueryRequest = new VinQueryRequest();
|
|
|
vinQueryRequest.setEngineNo(carInfoVo.getEngineNo());
|
|
vinQueryRequest.setEngineNo(carInfoVo.getEngineNo());
|
|
|
vinQueryRequest.setFrameNo(carInfoVo.getVinNo());
|
|
vinQueryRequest.setFrameNo(carInfoVo.getVinNo());
|
|
|
vinQueryRequest.setLicenseNo(carInfoVo.getLicenseNo());
|
|
vinQueryRequest.setLicenseNo(carInfoVo.getLicenseNo());
|
|
|
|
|
|
|
|
- VinQueryResponse.DataDTO vinQuery = vinQuery(vinQueryRequest, channelInfoDTO);
|
|
|
|
|
|
|
+ VinQueryResponse.DataDTO vinQuery = vinQuery(vinQueryRequest, parameters);
|
|
|
AssertionUtils.isEmpty(vinQuery, "未找到匹配的车辆信息");
|
|
AssertionUtils.isEmpty(vinQuery, "未找到匹配的车辆信息");
|
|
|
|
|
|
|
|
//车价查询
|
|
//车价查询
|
|
|
- CarPriceResponse.DataDTO carPriceQuery = carPriceQuery(quoteVo, vinQuery, channelInfoDTO);
|
|
|
|
|
|
|
+ CarPriceResponse.DataDTO carPriceQuery = carPriceQuery(quoteVo, vinQuery, parameters);
|
|
|
AssertionUtils.isEmpty(carPriceQuery, "车价获取失败");
|
|
AssertionUtils.isEmpty(carPriceQuery, "车价获取失败");
|
|
|
|
|
|
|
|
|
|
+ //创建非车订单
|
|
|
|
|
+ boolean isNoCar = false;
|
|
|
|
|
+ String jsPremium = "0";
|
|
|
|
|
+ String orderCode = null;
|
|
|
|
|
+ String noCarPremium = "";
|
|
|
|
|
+ String goodsCode = "";
|
|
|
|
|
+ GuoRenAccidentalDrivingVo accidentalDrivingVo = getGuoRenAccidentalDrivingVo(quoteVo.getAccidentalDrivings());
|
|
|
|
|
+ if (accidentalDrivingVo != null) {
|
|
|
|
|
+ NonAutoInsOrderResponse nonAutoInsOrderResponse = nonAutoInsOrder(quoteVo, accidentalDrivingVo,
|
|
|
|
|
+ carPriceQuery.getInputvo(), parameters, vinQuery);
|
|
|
|
|
+ AssertionUtils.isEmpty(nonAutoInsOrderResponse.getData(), nonAutoInsOrderResponse.getMessage());
|
|
|
|
|
+ orderCode = nonAutoInsOrderResponse.getData().getOrderCode();
|
|
|
|
|
+ isNoCar = true;
|
|
|
|
|
+ jsPremium = nonAutoInsOrderResponse.getData().getNoCarPremium();
|
|
|
|
|
+ noCarPremium = nonAutoInsOrderResponse.getData().getNoCarPremium();
|
|
|
|
|
+ goodsCode = accidentalDrivingVo.getGoodsCode();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ //获取特约数据
|
|
|
|
|
+ List<GuoRenSpecialAgreementVo> specialAgreements = getSpecialAgreements(orderBase, parameters);
|
|
|
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ // 4、保费计算
|
|
|
|
|
+ PremiumResponse premiumResponse = premiumQuery(quoteVo, carPriceQuery, vinQuery, isNoCar,
|
|
|
|
|
+ specialAgreements, noCarPremium, goodsCode);
|
|
|
|
|
+ PremiumResponse.DataDTO premiumResult = premiumResponse.getData();
|
|
|
|
|
+ AssertionUtils.isEmpty(premiumResult, "保费计算失败");
|
|
|
|
|
+
|
|
|
|
|
+ //保存投保单 该接口返回投保单号
|
|
|
|
|
+ InsuranceSlipResponse insuranceSlipResponse = guoRenRequestApiComponent.insuranceSlip(quoteVo,
|
|
|
|
|
+ carPriceQuery.getInputvo(), orderCode, specialAgreements);
|
|
|
|
|
+
|
|
|
|
|
+ GuoRenApiOrder guoRenApiOrder = new GuoRenApiOrder();
|
|
|
|
|
+ guoRenApiOrder.setOrdersNo(orderBase.getOrdersNo());
|
|
|
|
|
+ guoRenApiOrder.setJqPremium(new BigDecimal(premiumResult.getSumPremiumCI()));
|
|
|
|
|
+ guoRenApiOrder.setSyPremium(new BigDecimal(premiumResult.getSumPremiumBI()));
|
|
|
|
|
+ guoRenApiOrder.setJqApplyNo(insuranceSlipResponse.getData().getProposalNoDetailVo().getProposalNoCI());
|
|
|
|
|
+ guoRenApiOrder.setSyApplyNo(insuranceSlipResponse.getData().getProposalNoDetailVo().getProposalNoBI());
|
|
|
|
|
+ guoRenApiOrderService.save(guoRenApiOrder);
|
|
|
|
|
+
|
|
|
|
|
+ return GuoRenApiQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo, premiumResponse);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -83,36 +145,81 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public void underwriting(UnderwritingVo underwritingVo) {
|
|
public void underwriting(UnderwritingVo underwritingVo) {
|
|
|
|
|
+ OrderBase orderBase = underwritingVo.getOrder();
|
|
|
|
|
+ //配置信息
|
|
|
|
|
+ GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
|
|
+ GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
|
|
|
|
|
|
|
+ SubmitAuditResponse auditResponse = guoRenRequestApiComponent.submitAudit(guoRenApiOrder, parameters);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取支付链接
|
|
* 获取支付链接
|
|
|
- *
|
|
|
|
|
* @param orderBase
|
|
* @param orderBase
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public String getPaymentLink(OrderBase orderBase) throws JsonProcessingException {
|
|
public String getPaymentLink(OrderBase orderBase) throws JsonProcessingException {
|
|
|
|
|
+ //配置信息
|
|
|
|
|
+ GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
|
|
+ GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
|
|
+
|
|
|
|
|
+ PayResponse.DataDTO dataDTO = guoRenRequestApiComponent.getPaid(guoRenApiOrder, parameters);
|
|
|
|
|
+
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 上传影像
|
|
* 上传影像
|
|
|
- *
|
|
|
|
|
* @param insuranceUploadImageVo
|
|
* @param insuranceUploadImageVo
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public void uploadImage(InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
public void uploadImage(InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
|
|
|
+ OrderBase orderBase = insuranceUploadImageVo.getOrder();
|
|
|
|
|
+ //配置信息
|
|
|
|
|
+ GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
|
|
|
|
|
|
|
+ GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(insuranceUploadImageVo.getOrder().getOrdersNo());
|
|
|
|
|
+ imageUpdate(guoRenApiOrder, parameters, insuranceUploadImageVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 下载保单
|
|
* 下载保单
|
|
|
- *
|
|
|
|
|
* @param orderBase
|
|
* @param orderBase
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public void downloadPolicy(OrderBase orderBase) {
|
|
public void downloadPolicy(OrderBase orderBase) {
|
|
|
|
|
+ //配置信息
|
|
|
|
|
+ GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
|
|
+
|
|
|
|
|
+ String policyPrintType = "";//以后增加赋值
|
|
|
|
|
+ GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
|
|
+ String riskCode = "";
|
|
|
|
|
+ String templateName;
|
|
|
|
|
+ String busNo = "";
|
|
|
|
|
+ String url;
|
|
|
|
|
+
|
|
|
|
|
+ if (InsuranceRisk.TRAFFIC.getCode().equals(riskCode)) {
|
|
|
|
|
+ PolicyResponse ciResponse = guoRenRequestApiComponent.policyPrint(guoRenApiOrder.getJqPolicyNo());
|
|
|
|
|
+ if (PolicyPrintType.PPT_1.getCode().equals(policyPrintType)) {
|
|
|
|
|
+ templateName = "-交强险标志.pdf";
|
|
|
|
|
+ //交强险标志
|
|
|
|
|
+ url = properties.getPolicyFlagUrl() + ciResponse.getData();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ templateName = "-交强险保单.pdf";
|
|
|
|
|
+ url = properties.getPolicyUrl() + ciResponse.getData();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (InsuranceRisk.BUSINESS.getCode().equals(riskCode)) {
|
|
|
|
|
+ templateName = "-商业险保单.pdf";
|
|
|
|
|
+ PolicyResponse biResponse = guoRenRequestApiComponent.policyPrint(guoRenApiOrder.getSyPolicyNo());
|
|
|
|
|
+ url = properties.getPolicyUrl() + biResponse.getData();
|
|
|
|
|
+ } else if (InsuranceRisk.ACCIDENT.getCode().equals(riskCode)) {
|
|
|
|
|
+ //busNo = policyPrintVo.getPolicyNumber();
|
|
|
|
|
+ url = guoRenRequestApiComponent.noCarElectronicPolicy(properties.getChannelCode(),
|
|
|
|
|
+ orderBase.getOrdersNo(), busNo);//以后需观察参数是否正确
|
|
|
|
|
+ templateName = busNo + "-非车险保单.pdf";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new SystemException("保险编号异常");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -123,18 +230,16 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public void queryOrderState(OrderBase orderBase) {
|
|
public void queryOrderState(OrderBase orderBase) {
|
|
|
|
|
+ //配置信息
|
|
|
|
|
+ GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
|
|
+ GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ OrderStateRequest orderStateRequest = new OrderStateRequest();
|
|
|
|
|
+ orderStateRequest.addProposalNos(guoRenApiOrder.getJqApplyNo());
|
|
|
|
|
+ orderStateRequest.addProposalNos(guoRenApiOrder.getSyApplyNo());
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取渠道配置信息
|
|
|
|
|
- * @author: lig
|
|
|
|
|
- * @date: 2023年08月25日 0025
|
|
|
|
|
- */
|
|
|
|
|
- private ChannelInfoDTO gainChannelConfigInfo(OrderBase orderBase) {
|
|
|
|
|
- ChannelInfoDTO channelInfoDTO = ConfigureParametersConversion.conversionEntity(ChannelInfoDTO.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
|
|
- AssertionUtils.isEmpty(channelInfoDTO, "请先配置保险公司渠道信息");
|
|
|
|
|
- return channelInfoDTO;
|
|
|
|
|
|
|
+ OrderStateResponse orderStateResponse = guoRenRequestApiComponent.request(orderStateRequest, PlatformInterfaceCode.API_IIRBT00010,
|
|
|
|
|
+ OrderStateResponse.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -143,8 +248,8 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
* @author: lig
|
|
* @author: lig
|
|
|
* @date: 2023年08月18日 0018
|
|
* @date: 2023年08月18日 0018
|
|
|
*/
|
|
*/
|
|
|
- public VinQueryResponse.DataDTO vinQuery(VinQueryRequest vinQueryReq, ChannelInfoDTO channelInfo) {
|
|
|
|
|
- VinQueryRequest req = new VinQueryRequest(vinQueryReq, channelInfo);
|
|
|
|
|
|
|
+ public VinQueryResponse.DataDTO vinQuery(VinQueryRequest vinQueryReq, GuoRenConfigureParameters parameters) {
|
|
|
|
|
+ VinQueryRequest req = new VinQueryRequest(vinQueryReq, parameters);
|
|
|
VinQueryResponse resp = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00009,
|
|
VinQueryResponse resp = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00009,
|
|
|
VinQueryResponse.class);
|
|
VinQueryResponse.class);
|
|
|
if (resp.getResultCode() == 1) {
|
|
if (resp.getResultCode() == 1) {
|
|
@@ -157,9 +262,9 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
* 车价查询
|
|
* 车价查询
|
|
|
*/
|
|
*/
|
|
|
public CarPriceResponse.DataDTO carPriceQuery(QuoteVo quoteVo, VinQueryResponse.DataDTO vinQ,
|
|
public CarPriceResponse.DataDTO carPriceQuery(QuoteVo quoteVo, VinQueryResponse.DataDTO vinQ,
|
|
|
- ChannelInfoDTO channelInfo) {
|
|
|
|
|
|
|
+ GuoRenConfigureParameters parameters) {
|
|
|
|
|
|
|
|
- CarPriceRequest req = CarPriceRequest.buildCarPriceParam(quoteVo, vinQ, channelInfo);
|
|
|
|
|
|
|
+ CarPriceRequest req = CarPriceRequest.buildCarPriceParam(quoteVo, vinQ, parameters);
|
|
|
JSONObject request = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00003);
|
|
JSONObject request = guoRenRequestApiComponent.request(req, PlatformInterfaceCode.API_IIRBT00003);
|
|
|
Object cars = request.get("cars");
|
|
Object cars = request.get("cars");
|
|
|
|
|
|
|
@@ -226,4 +331,154 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
return resp.getData();
|
|
return resp.getData();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 意外险转换
|
|
|
|
|
+ * @param accidentalDrivingVoList
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public GuoRenAccidentalDrivingVo getGuoRenAccidentalDrivingVo(List<AccidentalDrivingVo> accidentalDrivingVoList) {
|
|
|
|
|
+ GuoRenAccidentalDrivingVo guoRenAccidentalDrivingVo = new GuoRenAccidentalDrivingVo();
|
|
|
|
|
+ if (accidentalDrivingVoList != null && !accidentalDrivingVoList.isEmpty()) {
|
|
|
|
|
+ AccidentalDrivingVo accidentalDrivingVo = accidentalDrivingVoList.get(0);
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setAmount(accidentalDrivingVo.getSumAmount());
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setPremium(accidentalDrivingVo.getSumPremium());
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setRiskCode(accidentalDrivingVo.getRiskCode());
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setQuantity(accidentalDrivingVo.getQuantity());
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setProdCode(accidentalDrivingVo.getProductCode());
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setGoodsCode(accidentalDrivingVo.getProductCategoryCode());
|
|
|
|
|
+ guoRenAccidentalDrivingVo.setGoodsName(accidentalDrivingVo.getProductCategoryName());
|
|
|
|
|
+ }
|
|
|
|
|
+ return guoRenAccidentalDrivingVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 创建非车订单
|
|
|
|
|
+ * @author: lig
|
|
|
|
|
+ * @date: 2023-09-28
|
|
|
|
|
+ */
|
|
|
|
|
+ public NonAutoInsOrderResponse nonAutoInsOrder(QuoteVo quoteVo,
|
|
|
|
|
+ GuoRenAccidentalDrivingVo accidentalDrivingVo,
|
|
|
|
|
+ String carPriceUuid, GuoRenConfigureParameters channelInfo,
|
|
|
|
|
+ VinQueryResponse.DataDTO vinQ) {
|
|
|
|
|
+ //构造请求参数
|
|
|
|
|
+ NonAutoInsOrderRequest nonAutoInsOrderReq = new NonAutoInsOrderRequest(quoteVo, vinQ, accidentalDrivingVo,
|
|
|
|
|
+ channelInfo,
|
|
|
|
|
+ carPriceUuid, properties.getChannelCode());
|
|
|
|
|
+ return guoRenRequestApiComponent.request(nonAutoInsOrderReq, PlatformInterfaceCode.API_IIIRBT00054,
|
|
|
|
|
+ NonAutoInsOrderResponse.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询国任特约数据
|
|
|
|
|
+ * @param orderBase 原参数为agreementId,以后看orderbase中的配置信息map中是否可以获取
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<GuoRenSpecialAgreementVo> getSpecialAgreements(OrderBase orderBase, GuoRenConfigureParameters parameters) {
|
|
|
|
|
+ // 获取协议配置信息
|
|
|
|
|
+ String specialAgreementKey = GR_SPECIAL_AGREEMENT_KEY + orderBase.getOrdersNo();
|
|
|
|
|
+
|
|
|
|
|
+ // 从缓存中获取数据
|
|
|
|
|
+ String info = (String) redisTemplate.opsForValue().get(specialAgreementKey);
|
|
|
|
|
+ if (!StringUtils.isEmpty(info)) {
|
|
|
|
|
+ List<GuoRenSpecialAgreementVo> list = JSON.parseArray(info, GuoRenSpecialAgreementVo.class);
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<GuoRenSpecialAgreementVo> list = new ArrayList<>();
|
|
|
|
|
+ for (InsuranceRisk insuranceRisk : InsuranceRisk.getInsuranceRisk()) {
|
|
|
|
|
+ String riskCode = GuoRenRiskCode.toInsuranceRisk(insuranceRisk.getCode());
|
|
|
|
|
+ SpecialAgreementRequest specialAgreementRequest = new SpecialAgreementRequest(parameters.getComCode(),
|
|
|
|
|
+ riskCode);
|
|
|
|
|
+ SpecialAgreementResponse response = guoRenRequestApiComponent.request(specialAgreementRequest,
|
|
|
|
|
+ PlatformInterfaceCode.API_IIRBT00005, SpecialAgreementResponse.class);
|
|
|
|
|
+
|
|
|
|
|
+ AssertionUtils.isFail("1".equals(response.getResultCode().toString()), response.getResultMsg());
|
|
|
|
|
+
|
|
|
|
|
+ List<GuoRenSpecialAgreementVo> collect =
|
|
|
|
|
+ response.getData().stream().map(x -> new GuoRenSpecialAgreementVo(x, insuranceRisk)).collect(Collectors.toList());
|
|
|
|
|
+ list.addAll(collect);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 数据存入缓存
|
|
|
|
|
+ if (!list.isEmpty()) {
|
|
|
|
|
+ redisTemplate.opsForValue().set(specialAgreementKey, JSON.toJSONString(list), GR_SPECIAL_AGREEMENT_TIME,
|
|
|
|
|
+ TimeUnit.DAYS);
|
|
|
|
|
+ }
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public PremiumResponse premiumQuery(QuoteVo quoteVo, CarPriceResponse.DataDTO carPriceQuery, VinQueryResponse.DataDTO vinQuery, Boolean isNoCar,
|
|
|
|
|
+ List<GuoRenSpecialAgreementVo> specialAgreements, String noCarPremium, String goodsCode) {
|
|
|
|
|
+ //请求信息列表
|
|
|
|
|
+ List<String> requestInfoList = new ArrayList<>();
|
|
|
|
|
+ boolean boo;
|
|
|
|
|
+ //构造请求参数
|
|
|
|
|
+ PremiumRequest premiumRequest = PremiumRequest.buildQuoteParam(quoteVo, carPriceQuery, vinQuery, isNoCar, specialAgreements, noCarPremium, goodsCode);
|
|
|
|
|
+ PremiumResponse premiumResponse = guoRenRequestApiComponent.request(premiumRequest, PlatformInterfaceCode.API_IIRBT00004, PremiumResponse.class);
|
|
|
|
|
+
|
|
|
|
|
+ premiumResponse.getData().setCiStartDate(premiumRequest.getCi().getPrpTmain().getStartDate());
|
|
|
|
|
+ premiumResponse.getData().setCiEndDate(premiumRequest.getCi().getPrpTmain().getEndDate());
|
|
|
|
|
+ premiumResponse.getData().setBiStartDate(premiumRequest.getBi().getPrpTmain().getStartDate());
|
|
|
|
|
+ premiumResponse.getData().setBiEndDate(premiumRequest.getBi().getPrpTmain().getEndDate());
|
|
|
|
|
+
|
|
|
|
|
+ return premiumResponse;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 影像上传 调用三方
|
|
|
|
|
+ */
|
|
|
|
|
+ public void imageUpdate(GuoRenApiOrder guoRenApiOrder, GuoRenConfigureParameters parameters, InsuranceUploadImageVo insuranceUploadImageVo) {
|
|
|
|
|
+
|
|
|
|
|
+ //构造请求参数
|
|
|
|
|
+ Map<String, Object> formMap = new HashMap<>();
|
|
|
|
|
+ formMap.put("businessNo", StringUtils.isEmpty(guoRenApiOrder.getJqApplyNo()) ? guoRenApiOrder.getSyApplyNo() : guoRenApiOrder.getJqApplyNo());
|
|
|
|
|
+ formMap.put("operatorCode", parameters.getHandlerCode());
|
|
|
|
|
+ formMap.put("comCode", parameters.getComCode());
|
|
|
|
|
+ formMap.put("fileGroup", "DZ");
|
|
|
|
|
+
|
|
|
|
|
+ List<InsuranceImageVo> imageVoList = insuranceUploadImageVo.getImageVoList();
|
|
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ imageVoList.forEach(insuranceImageVo -> {
|
|
|
|
|
+ for (InsuranceImageVo.ImageDTO imageDTO : insuranceImageVo.getImageBase64List()) {
|
|
|
|
|
+ String imageBase64Str = imageDTO.getImageBase64Str();
|
|
|
|
|
+ byte[] imageBytes = Base64.getDecoder().decode(imageBase64Str);
|
|
|
|
|
+ try {
|
|
|
|
|
+ //需要设置一个临时图片路径
|
|
|
|
|
+ FileOutputStream fileOutputStream = new FileOutputStream("图片临时路径");
|
|
|
|
|
+ fileOutputStream.write(imageBytes);
|
|
|
|
|
+ fileOutputStream.close();
|
|
|
|
|
+ FilePart file1 = new FilePart("file", new File("图片临时路径"));
|
|
|
|
|
+
|
|
|
|
|
+ Part[] parts = {file1, new StringPart("businessNo", formMap.get("businessNo").toString()),
|
|
|
|
|
+ new StringPart("operatorCode",
|
|
|
|
|
+ formMap.get("operatorCode").toString()), new StringPart("comCode",
|
|
|
|
|
+ formMap.get("comCode").toString()),
|
|
|
|
|
+ new StringPart("fileGroup", formMap.get("fileGroup").toString())};
|
|
|
|
|
+
|
|
|
|
|
+ String result = HttpUtil.sendPostFromFile(parts, properties.getUploadUrl());
|
|
|
|
|
+ if (StringUtils.isEmpty(result)) {
|
|
|
|
|
+ throw new SystemException("国任,影像上传失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(result);
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.toInt(jsonObject.get("resultCode")) != 0) {
|
|
|
|
|
+ throw new SystemException("国任,影像上传失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put(insuranceImageVo.getImageCode(), imageDTO.getImageId());
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("国任上传影像异常:{}", e.getMessage());
|
|
|
|
|
+ // 上传的影像存入redis
|
|
|
|
|
+ //insImagesUploadCacheComponents.setUploadImageCache(insuranceUploadImageVo.getOrder().getOrdersNo(), map);
|
|
|
|
|
+ throw new SystemException("国任,影像上传失败,类型:" + insuranceImageVo.getImageType());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ //insImagesUploadCacheComponents.setUploadImageCache(iac.getCompanyId(), map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|