Przeglądaj źródła

修改保单路径为空再次调用重新生成保单接口

hxl13994548489 1 rok temu
rodzic
commit
6ea28be1b5

+ 56 - 13
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPdfUrlServiceImpl.java

@@ -1,10 +1,7 @@
 package com.ydtech.modules.order.service.impl;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.InsuranceEnum;
-import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.dao.InsOrderPdfUrlMapper;
@@ -122,18 +119,64 @@ public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper,
             InsAreaCompanyExternalPolicy  insAreaCompanyExternalPolicy  =new InsAreaCompanyExternalPolicy(subOrder.getId(),
                     jqUrlEntity.getJqUrl(),jqUrlEntity.getSyUrl(),jqUrlEntity.getJyUrl(),jqUrlEntity.getJqSignUrl());
             subOrder.setJyPolicyNo(jqUrlEntity.getJyNo());
-            return  new ReadPdfUrlListDto(insAreaCompanyExternalPolicy,subOrder, insOrders.getIsExternal()==null?"0":String.valueOf(insOrders.getIsExternal()));
-        }else{
-            ReadPdfUrlListDto orderPdfData =null;
-            try{
-               orderPdfData = getOrderPdfData(subOrder, insOrders, flag);
-            }catch(Exception e){
-                throw  new SystemException(e.getMessage());
+            boolean checkFlag = checkData(insAreaCompanyExternalPolicy,subOrder);
+            if(!checkFlag){
+                //重新调用
+                return getReadPdfUrlListDto(subOrder, insOrders, true);
+            }else{
+               return new ReadPdfUrlListDto(insAreaCompanyExternalPolicy, subOrder, insOrders.getIsExternal() == null ? "0" : String.valueOf(insOrders.getIsExternal()));
             }
-            InsOrderPdfUrl insOrderPdfUrl = tranferData(orderPdfData, subOrder.getId(), subOrder.getProduct());
-            this.saveOrUpdate(insOrderPdfUrl);
-            return orderPdfData;
+        }else{
+            return getReadPdfUrlListDto(subOrder, insOrders, flag);
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 17:05
+     *  @Description: 生成保单
+     */
+    private ReadPdfUrlListDto getReadPdfUrlListDto(InsAreaCompany subOrder, InsOrders insOrders, boolean flag) {
+        ReadPdfUrlListDto orderPdfData =null;
+        try{
+           orderPdfData = getOrderPdfData(subOrder, insOrders, flag);
+        }catch(Exception e){
+            throw  new SystemException(e.getMessage());
+        }
+        InsOrderPdfUrl insOrderPdfUrl = tranferData(orderPdfData, subOrder.getId(), subOrder.getProduct());
+        this.saveOrUpdate(insOrderPdfUrl);
+        return orderPdfData;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/10/25 17:02
+     *  @Description:  验证保单路径是否为空
+     */
+    public  boolean  checkData(InsAreaCompanyExternalPolicy insAreaCompanyExternalPolicy,InsAreaCompany subOrder){
+        boolean  flag =false;
+        boolean  jqFlag =false;
+        boolean  syFlag =false;
+        boolean  jyFlag =false;
+        //判断交强保单号不为空,路径为null 返回false
+        if (StringUtils.isNotBlank(subOrder.getJqpolicyno())) {
+            jqFlag = StringUtils.isBlank(insAreaCompanyExternalPolicy.getJqPolicy());
+        }
+        //商业保单号处理
+        if (StringUtils.isNotBlank(subOrder.getSypolicyno())) {
+            syFlag = StringUtils.isBlank(insAreaCompanyExternalPolicy.getSyPolicy());
+        }
+        //驾意险保单号处理
+        if (StringUtils.isNotBlank(subOrder.getJyPolicyNo())) {
+            jyFlag = StringUtils.isBlank(insAreaCompanyExternalPolicy.getNoPolicy());
+        }
+        if(jqFlag  || syFlag || jyFlag){
+            flag=false;
+        }else{
+            flag =true;
         }
+        return flag;
     }
     public  ReadPdfUrlListDto  getOrderPdfData(InsAreaCompany subOrder,InsOrders insOrders,boolean flag){
         //处理驾意险保单号

+ 4 - 6
src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java

@@ -65,7 +65,6 @@ import com.ydtech.modules.order.entity.api.yongcheng.constants.MessageStatusCode
 import com.ydtech.modules.order.entity.api.yongcheng.request.AccidentUnderwritingRequest;
 import com.ydtech.modules.order.entity.api.yongcheng.request.ProposalPolicyReturnRequest;
 import com.ydtech.modules.order.entity.api.yongcheng.response.AccidentUnderwritingResponse;
-import com.ydtech.modules.order.entity.api.zhongmei.response.OrderStatusResponse;
 import com.ydtech.modules.order.entity.crawler.request.RecognitionRequest;
 import com.ydtech.modules.order.entity.crawler.response.RecognitionResponse;
 import com.ydtech.modules.order.entity.dto.DrivingInsuranceDto;
@@ -79,7 +78,6 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.utils.DateTimeUtil;
-import com.ydtech.utils.OrderUtils;
 import com.ydtech.utils.StringUtils;
 import com.ydtech.utils.baidu.FileUtil;
 import lombok.AllArgsConstructor;
@@ -1562,26 +1560,26 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
                 //标志
                 if (StringUtils.isNotEmpty(pResp.getPolicyBZUrl())) {
                     String bzInsUrl = pResp.getPolicyBZUrl().replaceAll(";pkid", "&pkid");
-                    String jqFlagUrl = gainCarInsPolicyNew(bzInsUrl, insAreaCompany.getInscompany()+"-"+insAreaCompany.getId()+"-"+insOrders.getLicenseno() +"-"+policyNo +"-"+ InsuranceOrderPdf.JQBZ.getDesc(), insAreaCompany.getId(),flag);
+                    String jqFlagUrl = gainCarInsPolicyNew(bzInsUrl, insAreaCompany.getInscompany()+"-"+insOrders.getLicenseno() +"-"+insAreaCompany.getId()+"-"+policyNo +"-"+ InsuranceOrderPdf.JQBZ.getDesc(), insAreaCompany.getId(),flag);
                     cipDto.setJqFlagUrl(jqFlagUrl);
                 }
                 //交强
                 if (StringUtils.isNotEmpty(pResp.getJqpolicyUrl())) {
                     String jqInsUrl = pResp.getJqpolicyUrl().replace(";pkid", "&pkid");
-                    String jqUrl = gainCarInsPolicyNew(jqInsUrl, insAreaCompany.getInscompany()+"-"+insAreaCompany.getId()+"-"+insOrders.getLicenseno() +"-"+policyNo +"-"+  InsuranceOrderPdf.JQBD.getDesc(), insAreaCompany.getId(),flag);
+                    String jqUrl = gainCarInsPolicyNew(jqInsUrl, insAreaCompany.getInscompany()+"-"+insOrders.getLicenseno() +"-"+insAreaCompany.getId()+"-"+policyNo +"-"+  InsuranceOrderPdf.JQBD.getDesc(), insAreaCompany.getId(),flag);
                     cipDto.setJqUrl(jqUrl);
                 }
                 //商业
                 if (StringUtils.isNotEmpty(pResp.getSypolicyUrl())) {
                     String syInsUrl = pResp.getSypolicyUrl().replace(";pkid", "&pkid");
-                    String syUrl = gainCarInsPolicyNew(syInsUrl, insAreaCompany.getInscompany()+"-"+insAreaCompany.getId()+"-"+insOrders.getLicenseno() +"-"+policyNo +"-"+  InsuranceOrderPdf.SYBD.getDesc(), insAreaCompany.getId(),flag);
+                    String syUrl = gainCarInsPolicyNew(syInsUrl, insAreaCompany.getInscompany()+"-"+insOrders.getLicenseno()+"-"+ insAreaCompany.getId()+"-"+policyNo +"-"+  InsuranceOrderPdf.SYBD.getDesc(), insAreaCompany.getId(),flag);
                     cipDto.setSyUrl(syUrl);
 
                 }
                 // 非车险
                 if (StringUtils.isNotEmpty(pResp.getYwpolicUrl())) {
                     String jyInsUrl = pResp.getYwpolicUrl().replace(";pkid", "&pkid");
-                    String jyUrl = gainCarInsPolicyNew(jyInsUrl, insAreaCompany.getInscompany()+"-"+insAreaCompany.getId()+"-"+insOrders.getLicenseno() +"-"+ policyNo + "-"+InsuranceOrderPdf.JYBD.getDesc(), insAreaCompany.getId(),flag);
+                    String jyUrl = gainCarInsPolicyNew(jyInsUrl, insAreaCompany.getInscompany()+"-"+insOrders.getLicenseno() +"-"+insAreaCompany.getId()+"-"+ policyNo + "-"+InsuranceOrderPdf.JYBD.getDesc(), insAreaCompany.getId(),flag);
                     cipDto.setJyUrl(jyUrl);
                 }
             }