|
|
@@ -10,10 +10,13 @@ import com.jzg.commons.core.page.HttpResult;
|
|
|
import com.jzg.commons.entity.agreement.po.PtlAgreementUrl;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrders;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
|
|
|
+import com.jzg.commons.entity.po.InsCompanyClause;
|
|
|
import com.jzg.commons.entity.quote.vo.AccidentalDrivingVo;
|
|
|
import com.jzg.commons.entity.quote.vo.CarInfoVo;
|
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
|
+import com.jzg.commons.entity.vo.CompanyClauseVo;
|
|
|
+import com.jzg.commons.entity.vo.InsCompanyClauseVo;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
@@ -96,7 +99,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
public QuoteResultsVo quote(QuoteVo quoteVo) throws JsonProcessingException {
|
|
|
OrderBase orderBase = quoteVo.getOrder();
|
|
|
//配置信息
|
|
|
- String url = getApiUrl(orderBase.getInsuranceCompanyCode());
|
|
|
+ String url = getApiUrl(orderBase.getInsuranceCompanyId());
|
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
CarInfoVo carInfoVo = quoteVo.getCarInfoVo();
|
|
|
//vin码查询
|
|
|
@@ -131,7 +134,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
}
|
|
|
|
|
|
//获取特约数据
|
|
|
- List<GuoRenSpecialAgreementVo> specialAgreements = getSpecialAgreements(orderBase, parameters,url);
|
|
|
+ List<GuoRenSpecialAgreementVo> specialAgreements = getSpecialAgreements(quoteVo);
|
|
|
|
|
|
// 4、保费计算
|
|
|
PremiumResponse premiumResponse = premiumQuery(quoteVo, carPriceQuery, vinQuery, isNoCar,
|
|
|
@@ -183,7 +186,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
@Override
|
|
|
public UnderwritingResultsVo underwriting(UnderwritingVo underwritingVo) {
|
|
|
OrderBase orderBase = underwritingVo.getOrder();
|
|
|
- String url = getApiUrl(orderBase.getInsuranceCompanyCode());
|
|
|
+ String url = getApiUrl(orderBase.getInsuranceCompanyId());
|
|
|
//配置信息
|
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, orderBase.getAttributionInformationVo().getConfigInfo());
|
|
|
GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrdersNo());
|
|
|
@@ -251,7 +254,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
@Override
|
|
|
public PaymentLinkResultsVo getPaymentLink(PaymentLinkVo paymentLinkVo) {
|
|
|
//配置信息
|
|
|
- String url = getApiUrl(paymentLinkVo.getOrder().getInsuranceCompanyCode());
|
|
|
+ String url = getApiUrl(paymentLinkVo.getOrder().getInsuranceCompanyId());
|
|
|
GuoRenConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(GuoRenConfigureParameters.class, paymentLinkVo.getOrder().getAttributionInformationVo().getConfigInfo());
|
|
|
GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(paymentLinkVo.getOrder().getOrdersNo());
|
|
|
|
|
|
@@ -281,7 +284,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
*/
|
|
|
@Override
|
|
|
public DownloadPolicyResultVo downloadPolicy(DownloadPolicyVo downloadPolicyVo) {
|
|
|
- String url = getApiUrl(downloadPolicyVo.getOrder().getInsuranceCompanyCode());
|
|
|
+ String url = getApiUrl(downloadPolicyVo.getOrder().getInsuranceCompanyId());
|
|
|
InsOrdersPolicy policie = downloadPolicyVo.getPolicie();
|
|
|
DownloadPolicyResultVo downloadPolicyResultVo = new DownloadPolicyResultVo();
|
|
|
GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(downloadPolicyVo.getOrder().getOrdersNo());
|
|
|
@@ -315,7 +318,7 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
//查询投保单信息
|
|
|
InsOrdersPolicy insOrdersPolicy = orderBase.getInsOrdersPolicy();
|
|
|
InsOrders insOrders = orderBase.getInsOrders();
|
|
|
- String url = getApiUrl(orderBase.getOrder().getInsuranceCompanyCode());
|
|
|
+ String url = getApiUrl(orderBase.getOrder().getInsuranceCompanyId());
|
|
|
// 获取保司订单状态
|
|
|
OrderStateResponse orderStateResponse = insOrderStatus(insOrdersPolicy,url);
|
|
|
GuoRenApiOrder guoRenApiOrder = guoRenApiOrderService.findByOrdersNo(orderBase.getOrder().getOrdersNo());
|
|
|
@@ -507,40 +510,44 @@ public class GuoRenApiRequestImpl implements GuoRenApiRequest {
|
|
|
|
|
|
/**
|
|
|
* 查询国任特约数据
|
|
|
- * @param orderBase 原参数为agreementId,以后看orderbase中的配置信息map中是否可以获取
|
|
|
+ * @param quoteVo 原参数为agreementId,以后看orderbase中的配置信息map中是否可以获取
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<GuoRenSpecialAgreementVo> getSpecialAgreements(OrderBase orderBase, GuoRenConfigureParameters parameters,String url) {
|
|
|
- // 获取协议配置信息
|
|
|
- String specialAgreementKey = GR_SPECIAL_AGREEMENT_KEY + orderBase.getOrdersNo();//现在用ordersNo替换agreementId
|
|
|
-
|
|
|
- // 从缓存中获取数据
|
|
|
- String info = (String) redisTemplate.opsForValue().get(specialAgreementKey);
|
|
|
- if (!StringUtils.isEmpty(info)) {
|
|
|
- List<GuoRenSpecialAgreementVo> list = JSON.parseArray(info, GuoRenSpecialAgreementVo.class);
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
+// public List<GuoRenSpecialAgreementVo> getSpecialAgreements(OrderBase orderBase, GuoRenConfigureParameters parameters,String url) {
|
|
|
+// // 获取协议配置信息
|
|
|
+// String specialAgreementKey = GR_SPECIAL_AGREEMENT_KEY + orderBase.getOrdersNo();//现在用ordersNo替换agreementId
|
|
|
+//
|
|
|
+// // 从缓存中获取数据
|
|
|
+// 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,url);
|
|
|
+//
|
|
|
+// 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);
|
|
|
+// }
|
|
|
+// return list;
|
|
|
+// }
|
|
|
+
|
|
|
+ public List<GuoRenSpecialAgreementVo> getSpecialAgreements(QuoteVo quoteVo) {
|
|
|
+ List<InsCompanyClause> companyClauseVos = quoteVo.getSpecialInfoVo();
|
|
|
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,url);
|
|
|
-
|
|
|
- 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<GuoRenSpecialAgreementVo> collect = companyClauseVos.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;
|
|
|
}
|
|
|
|