Просмотр исходного кода

紫金人工核保状态跟新

wks 2 лет назад
Родитель
Сommit
8f52163974

+ 6 - 0
src/main/java/com/ydtech/modules/order/controller/ZijinOrderApiController.java

@@ -96,4 +96,10 @@ public class ZijinOrderApiController {
         return this.zijinOrderApiService.getPolicyPrint(policyPrintVo);
     }
 
+    @PostMapping("/auditStatusQuery")
+    @ApiOperation(value = "核保状态查询")
+    public HttpResult<Object> auditStatusQuery(@RequestSingleParam(value = "companyId") String companyId) {
+        return this.zijinOrderApiService.auditStatusQuery(companyId);
+    }
+
 }

+ 5 - 0
src/main/java/com/ydtech/modules/order/service/ZijinOrderApiService.java

@@ -83,4 +83,9 @@ public interface ZijinOrderApiService {
     HttpResult<Object> paymentCallbacks(PaymentCallbacksRequest paymentCallbacksRequest);
 
 
+    /**
+     * 核保状态查询
+     * @param companyId 子订单号
+     */
+    HttpResult<Object> auditStatusQuery(String companyId);
 }

+ 40 - 0
src/main/java/com/ydtech/modules/order/service/impl/ZijinOrderApiServiceImpl.java

@@ -410,6 +410,46 @@ public class ZijinOrderApiServiceImpl implements ZijinOrderApiService {
         return null;
     }
 
+    @Override
+    public HttpResult<Object> auditStatusQuery(String companyId) {
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
+        // 1 通过 协议id获取配置实体
+        PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
+        ZjConfigureParameters zjConfigureParameters = configureParametersComponents.toEntity(ZjConfigureParameters.class,
+                ptlAgreementAttribution);
+        HttpHeaders httpHeaders = zijinRequestApiComponents.getHttpHeaders(insAreaCompany.getAgreementId());
+        // 2 请求查看订单状态
+        QueryOrderDetailRequest queryOrderDetailRequest = new QueryOrderDetailRequest(insAreaCompany.getInsOrderNo());
+        QueryOrderStateResponse response = zijinRequestApiComponents.queryOrderDetail(queryOrderDetailRequest,
+                httpHeaders);
+        // 3. 订单生效以后修改状态
+        String uwFlag = response.getUwFlag();
+
+        if (OrderStatusEnum.O_2.getCode().equals(uwFlag)) {
+            insAreaCompany.setJqpolicyno(response.getTciProposalNo());
+            insAreaCompany.setSypolicyno(response.getVciProposalNo());
+            // 2.2 投保单号
+            insAreaCompany.setJqapplyno(response.getTciPolicyNo());
+            insAreaCompany.setSyapplyno(response.getVciPolicyNo());
+            insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
+            // 3. 聚合支付服务
+            BigDecimal multiply = insAreaCompany.getSumpremium().multiply(new BigDecimal(100));
+            ZbfAggregatePayRequest zbfAggregatePayRequest = new ZbfAggregatePayRequest(String.valueOf(multiply.intValue()),
+                    zjConfigureParameters.getAppKey(), insAreaCompany.getId());
+            ZbfAggregatePayResponse zbfAggregatePayResponse = zijinRequestApiComponents.zbfAggregatePay(zbfAggregatePayRequest,
+                    httpHeaders);
+            insAreaCompany.setPaymentLink(zbfAggregatePayResponse.getPayUrl());
+            insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+            return HttpResult.ok("核保成功");
+        } else if (OrderStatusEnum.O_3.getCode().equals(uwFlag)) {
+            insAreaCompany.setOrderstatus(InsOrderStatusEnum.TO_BACK.getCode());
+            insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+            return HttpResult.error(OrderStatusEnum.O_3.getName() + ":" + response.getUwMsg());
+        }
+
+        return HttpResult.ok("核保状态未修改");
+    }
+
     public QuoteRespVo getQuoteRespVo(CalculatePremiumResponse calculatePremiumResponse, BaseQuoteInfoVo yaQuoteInfoVo,
                                       List<ZjQuoteAccidentVo> accidentalDrivingVo, boolean isEnergy) {
         double jqPremium = 0;