|
|
@@ -0,0 +1,68 @@
|
|
|
+package com.ydtech.modules.order.components.zj;
|
|
|
+
|
|
|
+
|
|
|
+import com.ydtech.constants.InsuranceEnum;
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
+import com.ydtech.modules.order.entity.api.zj.request.CalculatePremiumRequest;
|
|
|
+import com.ydtech.modules.order.entity.api.zj.request.ModelQueryRequest;
|
|
|
+import com.ydtech.modules.order.entity.api.zj.response.CalculatePremiumResponse;
|
|
|
+import com.ydtech.modules.order.utils.InsuranceLog;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.Getter;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 紫金财险 999 异常处理
|
|
|
+ * @author: wenks
|
|
|
+ * @date: 2023/9/22 14:27
|
|
|
+ **/
|
|
|
+
|
|
|
+@Data
|
|
|
+@Component
|
|
|
+public class ZijinSystemExceptionComponents {
|
|
|
+
|
|
|
+ private ZijinRequestApiComponents zijinRequestApiComponents;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public void setZijinRequestApiComponents(ZijinRequestApiComponents zijinRequestApiComponents) {
|
|
|
+ this.zijinRequestApiComponents = zijinRequestApiComponents;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理 93169 需要重新报价异常
|
|
|
+ */
|
|
|
+ public CalculatePremiumResponse exceptionProcessing(CalculatePremiumRequest calculatePremiumRequest, CalculatePremiumResponse calculatePremiumResponse, HttpHeaders httpHeaders, ModelQueryRequest modelQueryRequest) {
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.ZKIC.getPinyin(), "\n\t---------> {}\n\t---------> {}", "紫金财险 999 异常处理", calculatePremiumResponse.getRtnMsg());
|
|
|
+ String rtnMsg = calculatePremiumResponse.getRtnMsg();
|
|
|
+ if (rtnMsg.contains(ResultEnum.R_93169.getCode())) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ Thread.sleep(1000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ InsuranceLog.infoLog(InsuranceEnum.ZKIC.getPinyin(), e.getMessage());
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ }
|
|
|
+
|
|
|
+ return zijinRequestApiComponents.calculatePremium(calculatePremiumRequest, httpHeaders, modelQueryRequest);
|
|
|
+ }
|
|
|
+ throw new SystemException(calculatePremiumResponse.getRtnMsg());
|
|
|
+ }
|
|
|
+
|
|
|
+ @AllArgsConstructor
|
|
|
+ @Getter
|
|
|
+ public enum ResultEnum {
|
|
|
+
|
|
|
+ R_93169("93169", "系统异常:93169:找不到投保询价待校验信息(投保询价信息不存在,或投保询价已经成功)。");
|
|
|
+
|
|
|
+ private final String code;
|
|
|
+
|
|
|
+ private final String desc;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|