Qchen 1 éve
szülő
commit
8a5bdd6d14

+ 2 - 0
src/main/java/com/ydtech/modules/order/service/YangGuangOrderApiService.java

@@ -62,6 +62,8 @@ public interface YangGuangOrderApiService {
      */
     HttpResult<Object> autoWriteOff(String companyId) throws Exception;
 
+    boolean autoWriteOffOrder(String companyId) throws Exception;
+
     /**
      * 获取保单信息
      * @param subOrder

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsuranceCompanyPolymerizationServiceImpl.java

@@ -70,7 +70,7 @@ public class InsuranceCompanyPolymerizationServiceImpl implements InsuranceCompa
             return zhongMeiOrderApiService.cancelOrder(insAreaCompany);
         }
         else if (InsuranceEnum.YGBX.getCode().equals(code)) {
-            return yangGuangOrderApiService.autoWriteOff(companyId);
+            return yangGuangOrderApiService.autoWriteOffOrder(companyId);
         }
         return false;
     }

+ 43 - 0
src/main/java/com/ydtech/modules/order/service/impl/YangGuangOrderApiServiceImpl.java

@@ -699,6 +699,49 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
         return HttpResult.ok("撤单成功");
     }
 
+    @Override
+    public boolean autoWriteOffOrder(String companyId) throws Exception {
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
+        YangGuangConfigureParameters ygConfigureParameters = configureParametersComponents.toEntity(YangGuangConfigureParameters.class,
+                insAreaCompany.getAgreementId());
+        String productid = insAreaCompany.getProductid();
+        //单交
+        if (productid.equals("0330")) {
+            YangGuangAutoWriteOffRequest yangGuangAutoWriteOffRequest = new YangGuangAutoWriteOffRequest(ygConfigureParameters, insAreaCompany.getJqapplyno());
+            YangGuangAutoWriteOffResponse yangGuangAutoWriteOffResponse = yangGuangRequestApiComponents.autoWriteOff(yangGuangAutoWriteOffRequest);
+            if (yangGuangAutoWriteOffResponse.getErrorCode().equals("0")) {
+                insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
+                insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+                return true;
+            }
+        }
+        // 单商
+        if (productid.equals("034001")) {
+            YangGuangAutoWriteOffRequest yangGuangAutoWriteOffRequest = new YangGuangAutoWriteOffRequest(ygConfigureParameters, insAreaCompany.getSyapplyno());
+            YangGuangAutoWriteOffResponse yangGuangAutoWriteOffResponse = yangGuangRequestApiComponents.autoWriteOff(yangGuangAutoWriteOffRequest);
+            if (yangGuangAutoWriteOffResponse.getErrorCode().equals("0")) {
+                insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
+                insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+                return true;
+            }
+        }
+        //交商同保
+        if (insAreaCompany.getJqpolicyno() != null && insAreaCompany.getSypolicyno() != null && !insAreaCompany.getJqpolicyno().equals("") && !insAreaCompany.getSypolicyno().equals("")) {
+            YangGuangAutoWriteOffRequest yangGuangAutoWriteOffRequestJq = new YangGuangAutoWriteOffRequest(ygConfigureParameters, insAreaCompany.getJqapplyno());
+            YangGuangAutoWriteOffResponse yangGuangAutoWriteOffResponseJq = yangGuangRequestApiComponents.autoWriteOff(yangGuangAutoWriteOffRequestJq);
+            YangGuangAutoWriteOffRequest yangGuangAutoWriteOffRequestSy = new YangGuangAutoWriteOffRequest(ygConfigureParameters, insAreaCompany.getSyapplyno());
+            YangGuangAutoWriteOffResponse yangGuangAutoWriteOffResponseSy = yangGuangRequestApiComponents.autoWriteOff(yangGuangAutoWriteOffRequestSy);
+            if (yangGuangAutoWriteOffResponseJq.getErrorCode().equals("0") && yangGuangAutoWriteOffResponseSy.getErrorCode().equals("0")) {
+                insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode());
+                insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+                return true;
+            } else {
+                return false;
+            }
+        }
+        return true;
+    }
+
     public QuoteRespVo getQuoteRespVo (YangGuangAccuracyCalculateResponse yangGuangAccuracyCalculateResponse, BaseQuoteInfoVo yaQuoteInfoVo, List<YgQuoteAccidentVo> accidentalDrivingVo, boolean isEnergy) {
         double jqPremium = 0;
         double syPremium = 0;