|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
@@ -14,8 +15,7 @@ import com.ydtech.modules.order.components.bohai.BoHaiRequestApiComponent;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
import com.ydtech.modules.order.entity.TaxArrears;
|
|
|
-import com.ydtech.modules.order.entity.api.bohai.constants.Coverages;
|
|
|
-import com.ydtech.modules.order.entity.api.bohai.constants.ResponseCode;
|
|
|
+import com.ydtech.modules.order.entity.api.bohai.constants.*;
|
|
|
import com.ydtech.modules.order.entity.api.bohai.request.*;
|
|
|
import com.ydtech.modules.order.entity.api.bohai.response.*;
|
|
|
import com.ydtech.modules.order.entity.config.BoHaiConfigureParameters;
|
|
|
@@ -31,6 +31,7 @@ import com.ydtech.modules.order.service.BoHaiOrderApiService;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
import com.ydtech.modules.order.service.InsTaskImagesService;
|
|
|
+import com.ydtech.modules.order.utils.SignatureUtils;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
|
|
|
import com.ydtech.utils.CalculateUtils;
|
|
|
@@ -41,6 +42,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@@ -135,7 +137,7 @@ public class BoHaiOrderApiServiceImpl implements BoHaiOrderApiService {
|
|
|
QuotationRequest quotationRequest = new QuotationRequest(parameters, quoteInfoVo.getRiskList(), quoteInfoVo.getKindList(),
|
|
|
currentValue, orderNo, carInfo);
|
|
|
QuotationResponse response = boHaiRequestApiComponent.quotation(quotationRequest);
|
|
|
- QuoteRespVo quoteRespVo = getQuoteRespVo(response, quoteInfoVo);
|
|
|
+ QuoteRespVo quoteRespVo = getQuoteRespVo(response, quoteInfoVo, vehicleModelsDTO);
|
|
|
return responseOrder(response, quoteRespVo, ptlAgreementAttribution, orderNo);
|
|
|
}
|
|
|
|
|
|
@@ -184,7 +186,7 @@ public class BoHaiOrderApiServiceImpl implements BoHaiOrderApiService {
|
|
|
// 支付请求
|
|
|
PaymentRequest paymentRequest = new PaymentRequest(parameters, insAreaCompany.getId(), insAreaCompany.getInsOrderNo());
|
|
|
PaymentResponse paymentResponse = boHaiRequestApiComponent.payment(paymentRequest);
|
|
|
- String payUrl = paymentResponse.getData().getPayUrl();
|
|
|
+ String payUrl = paymentResponse.getData().getQrCodeUrl();
|
|
|
insAreaCompany.setPaymentLink(payUrl);
|
|
|
insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
return HttpResult.ok("核保通过");
|
|
|
@@ -230,7 +232,109 @@ public class BoHaiOrderApiServiceImpl implements BoHaiOrderApiService {
|
|
|
return HttpResult.ok(crawlerPolicyPrintVo);
|
|
|
}
|
|
|
|
|
|
- public QuoteRespVo getQuoteRespVo(QuotationResponse response, BaseQuoteInfoVo yaQuoteInfoVo) {
|
|
|
+ @Override
|
|
|
+ public HttpResult<Object> getOrderDetail(String subOrderNo) throws Exception {
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(subOrderNo);
|
|
|
+ List<StatusDocumentsResponse.DataDTO.DocumentListDTO> documentList = getDocumentListDTO(insAreaCompany);
|
|
|
+ List<StatusDocumentsResponse.DataDTO.DocumentListDTO> documentListDTOS =
|
|
|
+ documentList.stream().filter(x -> ResultCode.RC_B5.getCode().equals(x.getStatus())).collect(Collectors.toList());
|
|
|
+ if (documentListDTOS.size() == documentList.size()) {
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
+ return HttpResult.ok("承保成功");
|
|
|
+ }
|
|
|
+ return HttpResult.error("承保失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpResult<Object> auditStatusQuery(String subOrderNo) throws Exception {
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(subOrderNo);
|
|
|
+ List<StatusDocumentsResponse.DataDTO.DocumentListDTO> documentList = getDocumentListDTO(insAreaCompany);
|
|
|
+ List<StatusDocumentsResponse.DataDTO.DocumentListDTO> documentListDTOS =
|
|
|
+ documentList.stream().filter(x -> ResultCode.RC_A0.getCode().equals(x.getStatus())).collect(Collectors.toList());
|
|
|
+ if (documentListDTOS.size() == documentList.size()) {
|
|
|
+ // 支付请求
|
|
|
+ String payUrl = getQrCodeUrl(insAreaCompany);
|
|
|
+ insAreaCompany.setPaymentLink(payUrl);
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
+ return HttpResult.ok("人工核保成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ return HttpResult.error("人工核保失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String underwritingCallback(PaymentCallbackRequest coverageRequest) throws Exception{
|
|
|
+ String requestNo = coverageRequest.getBaseParam().getRequestNo();
|
|
|
+ ResponseCode responseCode;
|
|
|
+ try {
|
|
|
+ String busUniqueId = coverageRequest.getBusUniqueId();
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByInsOrderNo(busUniqueId);
|
|
|
+ if (PayResult.P_1.getCode().equals(coverageRequest.getPayResult())) {
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
+ }
|
|
|
+ responseCode = ResponseCode.R_Z00001;
|
|
|
+ } catch (Exception e) {
|
|
|
+ responseCode = ResponseCode.R_Z00002;
|
|
|
+ }
|
|
|
+ return boHaiRequestApiComponent.encryptionCallbackResponse(responseCode, requestNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String auditCallback(ManualReviewRequest approvedRequest) throws Exception{
|
|
|
+ String requestNo = approvedRequest.getBaseParam().getRequestNo();
|
|
|
+ ResponseCode responseCode;
|
|
|
+ try {
|
|
|
+ String busUniqueId = approvedRequest.getUnderwritingCallBackReq().getBusUniqueId();
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getByInsOrderNo(busUniqueId);
|
|
|
+ List<ManualReviewRequest.UnderwritingCallBackReqDTO.UnderwritingBacksDTO> underwritingBacks =
|
|
|
+ approvedRequest.getUnderwritingCallBackReq().getUnderwritingBacks();
|
|
|
+
|
|
|
+ List<ManualReviewRequest.UnderwritingCallBackReqDTO.UnderwritingBacksDTO> collect =
|
|
|
+ underwritingBacks.stream().filter(x -> AuditStatus.A_1.getCode().equals(x.getAuditStatus())).collect(Collectors.toList());
|
|
|
+ if (collect.size() == underwritingBacks.size()) {
|
|
|
+ String payUrl = getQrCodeUrl(insAreaCompany);
|
|
|
+ insAreaCompany.setPaymentLink(payUrl);
|
|
|
+ insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
|
|
|
+ insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
|
|
|
+ }
|
|
|
+ responseCode = ResponseCode.R_Z00001;
|
|
|
+ } catch (Exception e) {
|
|
|
+ responseCode = ResponseCode.R_Z00002;
|
|
|
+ }
|
|
|
+ return boHaiRequestApiComponent.encryptionCallbackResponse(responseCode, requestNo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getQrCodeUrl(InsAreaCompany insAreaCompany) throws Exception {
|
|
|
+ // 账号信息
|
|
|
+ PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
|
|
|
+ // 通过 协议id获取配置实体
|
|
|
+ BoHaiConfigureParameters parameters = configureParametersComponents.toEntity(BoHaiConfigureParameters.class,
|
|
|
+ ptlAgreementAttribution);
|
|
|
+ PaymentRequest paymentRequest = new PaymentRequest(parameters, insAreaCompany.getId(), insAreaCompany.getInsOrderNo());
|
|
|
+ PaymentResponse paymentResponse = boHaiRequestApiComponent.payment(paymentRequest);
|
|
|
+ return paymentResponse.getData().getQrCodeUrl();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<StatusDocumentsResponse.DataDTO.DocumentListDTO> getDocumentListDTO(InsAreaCompany insAreaCompany) throws Exception {
|
|
|
+ // 账号信息
|
|
|
+ PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
|
|
|
+ // 通过 协议id获取配置实体
|
|
|
+ BoHaiConfigureParameters parameters = configureParametersComponents.toEntity(BoHaiConfigureParameters.class,
|
|
|
+ ptlAgreementAttribution);
|
|
|
+
|
|
|
+ String applyno = StringUtils.isEmpty(insAreaCompany.getJqapplyno()) ? insAreaCompany.getJqapplyno() : insAreaCompany.getSyapplyno();
|
|
|
+ StatusDocumentsRequest statusDocumentsRequest = new StatusDocumentsRequest(parameters, insAreaCompany.getId(), applyno);
|
|
|
+ StatusDocumentsResponse response = boHaiRequestApiComponent.statusDocuments(statusDocumentsRequest);
|
|
|
+ return response.getData().getDocumentList();
|
|
|
+ }
|
|
|
+
|
|
|
+ public QuoteRespVo getQuoteRespVo(QuotationResponse response,
|
|
|
+ BaseQuoteInfoVo yaQuoteInfoVo,
|
|
|
+ VehicleTypeQueryResponse.DataDTO.VehicleModelsDTO vehicleModelsDTO) {
|
|
|
double jyPremium = 0;
|
|
|
QuoteRespVo quoteRespVo = new QuoteRespVo();
|
|
|
// 交强险
|
|
|
@@ -290,6 +394,7 @@ public class BoHaiOrderApiServiceImpl implements BoHaiOrderApiService {
|
|
|
quoteRespVo.setSumPermium(CalculateUtils.add(jqPremium, syPremium, sumPayTax, jyPremium));//保费合计
|
|
|
quoteRespVo.setTotalAdjustRate(0);
|
|
|
quoteRespVo.setOrderno(yaQuoteInfoVo.getOrderNo()); //订单号
|
|
|
+ quoteRespVo.setCoreModels(vehicleModelsDTO.toCoreModelsVo());
|
|
|
return quoteRespVo;
|
|
|
}
|
|
|
|
|
|
@@ -314,4 +419,5 @@ public class BoHaiOrderApiServiceImpl implements BoHaiOrderApiService {
|
|
|
return HttpResult.ok("报价成功", quoteRespVo);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|