ソースを参照

处理费用失效还能报价的问题、第三方接口请求失败(DNS解析失败或连接异常)

lixiaolong 2 ヶ月 前
コミット
0539c1b122

+ 19 - 0
tenant/insurance/quotation-commons/src/main/java/com/jzg/quotation/commons/component/RequestComponent.java

@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.util.MultiValueMap;
 import org.springframework.web.reactive.function.BodyInserters;
 import org.springframework.web.reactive.function.client.WebClient;
+import org.springframework.web.reactive.function.client.WebClientRequestException;
 import org.springframework.web.reactive.function.client.WebClientResponseException;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
@@ -299,6 +300,15 @@ public class RequestComponent {
                                 null
                         )
                 )
+                .onErrorMap(WebClientRequestException.class, ex ->
+                        new WebClientResponseException(
+                                502,
+                                "第三方接口请求失败(DNS解析失败或连接异常):" + url + ",原因:" + ex.getMessage(),
+                                HttpHeaders.EMPTY,
+                                null,
+                                null
+                        )
+                )
                 .block();
     }
 
@@ -418,6 +428,15 @@ public class RequestComponent {
                                     null
                             )
                     )
+                    .onErrorMap(WebClientRequestException.class, ex ->
+                            new WebClientResponseException(
+                                    502,
+                                    "第三方接口请求失败(DNS解析失败或连接异常):" + url + ",原因:" + ex.getMessage(),
+                                    HttpHeaders.EMPTY,
+                                    null,
+                                    null
+                            )
+                    )
                     .block();
             if (rawResponse == null) {
                 throw new WebClientResponseException(

+ 22 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java

@@ -94,6 +94,28 @@ public class QuoteVerificationAspect {
             // 获取协议信息
             HttpResult<AgreementInfoVo> ptlAgreement = orgClient.queryAgreementById(insOrders.getAgreementId());
             AgreementInfoVo agreementInfoVo = ptlAgreement.getData();
+            // 校验协议有效性
+            if (agreementInfoVo != null && agreementInfoVo.getAgreement() != null) {
+                AgreementVo agreementVo = agreementInfoVo.getAgreement();
+                if ("1".equals(agreementVo.getValidStatus())) {
+                    result.setCode(500);
+                    result.setMsg("协议已失效,请重新配置协议后再次报价");
+                    return;
+                }
+                if ("1".equals(String.valueOf(agreementVo.getIsEnable()))) {
+                    result.setCode(500);
+                    result.setMsg("协议已停用,请重新配置协议后再次报价");
+                    return;
+                }
+                if (agreementVo.getStartDate() != null && agreementVo.getEndDate() != null) {
+                    java.time.LocalDateTime now = java.time.LocalDateTime.now();
+                    if (now.isBefore(agreementVo.getStartDate()) || now.isAfter(agreementVo.getEndDate())) {
+                        result.setCode(500);
+                        result.setMsg("协议已超出有效期,请重新配置协议后再次报价");
+                        return;
+                    }
+                }
+            }
             // 通过协议id和产品id查询费用列表
             CostAgreementParam costAgreementParam = new CostAgreementParam();
             costAgreementParam.setPtlAgreementId(insOrders.getAgreementId());