Browse Source

阳光电子保单压缩包转为pdf

Qchen 1 year ago
parent
commit
77c049552b

+ 23 - 1
src/main/java/com/ydtech/modules/order/entity/api/yangguang/request/YangGuangSubmitRequest.java

@@ -1,5 +1,7 @@
 package com.ydtech.modules.order.entity.api.yangguang.request;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.TypeReference;
 import com.alibaba.fastjson.annotation.JSONField;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -119,6 +121,11 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
      */
     @JSONField(name = "insuredList")
     private List<InsuredList> insuredList;
+    /**
+     * 非车信息
+     */
+    @JSONField(name = "NonVehicleProductInformationList")
+    private List<NonVehicleProductInformationList> NonVehicleProductInformationList;
 
     public YangGuangSubmitRequest(InsOrders insOrders, InsAreaCompany insAreaCompany,String productId, YangGuangConfigureParameters ygConfigureParameters) {
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -135,13 +142,13 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
             this.PolicyType = "3";
         }
         if (insAreaCompany.getAccidentInfo() != null) {
+            this.NonVehicleProductInformationList =JSONArray.parseObject(insAreaCompany.getAccidentInfo().toJSONString(), new TypeReference<List<NonVehicleProductInformationList>>(){});
             this.CasualtyFlag = "1";
         } else {
             this.CasualtyFlag = "0";
         }
 
 
-
     }
 
     /**
@@ -273,4 +280,19 @@ public class YangGuangSubmitRequest extends YangGuangBaseRequest{
         @JSONField(name = "Name")
         private String Name;
     }
+
+    @Data
+    public static class NonVehicleProductInformationList implements Serializable {
+        /**
+         * 产品代码
+         */
+        @JSONField(name = "ProductCode")
+        private String ProductCode;
+
+        /**
+         * 产品份数
+         */
+        @JSONField(name = "QuantityCasualty")
+        private String QuantityCasualty;
+    }
 }

+ 3 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsOrderPdfUrlServiceImpl.java

@@ -282,9 +282,10 @@ public class InsOrderPdfUrlServiceImpl extends ServiceImpl<InsOrderPdfUrlMapper,
         else if (subOrder.getCompanyId().contains(InsuranceEnum.YGBX.getCode())) {
             if (subOrder.getApiType()!=null && subOrder.getApiType() == 1) {
                 return yangGuangOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
-            } else if (subOrder.getApiType() != null && subOrder.getApiType() == 2) {
-                return yangGuangOrderApiService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
             }
+//            else if (subOrder.getApiType() != null && subOrder.getApiType() == 2) {
+//                return insCrawlerOrderService.getPolicyByCompanyIdPdfList(subOrder,insOrders,flag);
+//            }
         }
         //平安财险   上线再调式
         else if(subOrder.getCompanyId().contains(InsuranceEnum.PAIC.getCode())){

+ 24 - 9
src/main/java/com/ydtech/modules/order/service/impl/YangGuangOrderApiServiceImpl.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.order.service.impl;
 
 import cn.hutool.core.util.ArrayUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -14,6 +15,7 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.ins.model.vo.*;
 import com.ydtech.modules.order.components.ConfigureParametersComponents;
+import com.ydtech.modules.order.components.FileComponents;
 import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
 import com.ydtech.modules.order.components.yangguang.YangGuangRequestApiComponents;
 import com.ydtech.modules.order.constants.InsuranceTypeCorrespondence;
@@ -23,7 +25,6 @@ import com.ydtech.modules.order.entity.api.yangguang.request.*;
 import com.ydtech.modules.order.entity.api.yangguang.response.*;
 import com.ydtech.modules.order.entity.api.zijin.constants.enums.BusType;
 import com.ydtech.modules.order.entity.config.YangGuangConfigureParameters;
-import com.ydtech.modules.order.entity.crawler.vo.CrawlerPolicyPrintVo;
 import com.ydtech.modules.order.entity.dto.ReadPdfUrlListDto;
 import com.ydtech.modules.order.entity.filter.CarModelsFilterUtils;
 import com.ydtech.modules.order.entity.po.InsTaskImagesBase64;
@@ -77,6 +78,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
 
     private final InsImagesUploadCacheComponents insImagesUploadCacheComponents;
 
+    private final FileComponents fileComponents;
 
     @Value("${upload.file.path}")
     private String uploadFilePath;
@@ -136,7 +138,6 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
                 boolean isEnergy = carInfo.isNewEnergy();
 
                 if (!yangGuangAccuracyCalculateResponse1.getErrorCode().equals("0")) {
-                    QuoteRespVo resp  = new QuoteRespVo();
                     InsOrders order = insOrdersService.getById(quoteInfoVo.getOrderNo());
                     InsOrderStatusEnum insOrderStatusEnum = InsOrderStatusEnum.QUOTE_FAILED;
                     if (yangGuangAccuracyCalculateResponse1.getErrorMessage().contains("重复投保")) {
@@ -424,6 +425,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
             insAreaCompany.setSypolicyno(yangGuangProposalStatusQueryResponse.getBiPolicyNo());
             insAreaCompany.setJqapplyno(yangGuangProposalStatusQueryResponse.getCiProposalNo());
             insAreaCompany.setSyapplyno(yangGuangProposalStatusQueryResponse.getBiProposalNo());
+            insAreaCompany.setAccidentStrInfo(yangGuangProposalStatusQueryResponse.getFCPolicyNo());
             insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
             insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
             return HttpResult.ok("更新状态成功");
@@ -452,6 +454,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
         String busNo;
         BusType busType;
         String templateName;
+        boolean flag = false;
         switch (policyPrintVo.getRiskCode()) {
             case InsuranceRisk.TRAFFIC_CODE:
                 busNo = insAreaCompany.getJqpolicyno();
@@ -464,7 +467,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
                 templateName = "-商业险保单.pdf";
                 break;
             case InsuranceRisk.ACCIDENT_CODE:
-                busNo = policyPrintVo.getPolicyNumber();
+                busNo = insAreaCompany.getAccidentStrInfo();
                 busType = BusType.BT_4;
                 templateName = busNo + "-非车险保单.pdf";
                 break;
@@ -476,7 +479,8 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
         if (!yangGuangGetEpolicyPdfUrlResponse.getErrorCode().equals("0")) {
             return HttpResult.error("电子保单生成失败, 原因:" + yangGuangGetEpolicyPdfUrlResponse.getErrorMessage());
         }
-        String transferUrl = gainCarInsPolicy(yangGuangGetEpolicyPdfUrlResponse.getEPolicyPDFURL(), licensePlate + templateName, insAreaCompany.getId());
+        String transferUrl = fileComponents.gainCarInsPolicyNew(yangGuangGetEpolicyPdfUrlResponse.getEPolicyPDFURL(),
+                licensePlate + "-" + templateName, insAreaCompany.getId(), customerInfoVo.getIdentifyNumber(), flag);
         return HttpResult.ok("电子保单生成成功", transferUrl);
     }
 
@@ -505,9 +509,15 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
 
     @Override
     public ReadPdfUrlListDto getPolicyByCompanyIdPdfList(InsAreaCompany insAreaCompany, InsOrders insOrders, boolean flag) {
-        String jqPath =  getPdfUrl(insAreaCompany, insOrders,InsuranceRisk.TRAFFIC_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(),insAreaCompany.getJqpolicyno(),flag);
-        String syPath = getPdfUrl(insAreaCompany,insOrders,InsuranceRisk.BUSINESS_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(), insAreaCompany.getSypolicyno(),flag);
-        InsAreaCompanyExternalPolicy insAreaCompanyExternalPolicy =new InsAreaCompanyExternalPolicy(insAreaCompany.getId(),jqPath,syPath,null,null);
+        String jqPath = getPdfUrl(insAreaCompany,insOrders,InsuranceRisk.TRAFFIC_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(),insAreaCompany.getJqpolicyno(),flag);
+        String syPath = getPdfUrl(insAreaCompany,insOrders,InsuranceRisk.BUSINESS_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(),insAreaCompany.getSypolicyno(),flag);
+        String fcPath = "";
+        if (insAreaCompany.getAccidentStrInfo() != null && !insAreaCompany.getAccidentStrInfo().equals("")) {
+            //获取非车保单号
+            String FcProposalNo = insAreaCompany.getAccidentStrInfo();
+            fcPath = getPdfUrl(insAreaCompany,insOrders,InsuranceRisk.ACCIDENT_CODE,PolicyPrintVo.PolicyPrintType.PPT_2.getCode(), FcProposalNo, flag);
+        }
+        InsAreaCompanyExternalPolicy insAreaCompanyExternalPolicy =new InsAreaCompanyExternalPolicy(insAreaCompany.getId(),jqPath,syPath,fcPath,null);
         return new ReadPdfUrlListDto(insAreaCompanyExternalPolicy,insAreaCompany,null);
     }
 
@@ -526,9 +536,12 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
                 ptlAgreementAttribution);
         // 车牌号
         String licensePlate = insOrders.getLicenseno();
+
+        CustomerInfoVo customerInfoVo = insOrders.getApplyinfo().toJavaObject(CustomerInfoVo.class);
         // 被保人信息
         String templateName = null;
         String url = null;
+        String transferUrl;
         try{
             YangGuangGetEpolicyPdfUrlRequest request = new YangGuangGetEpolicyPdfUrlRequest(parameters,policyNo);
             YangGuangGetEpolicyPdfUrlResponse response = yangGuangRequestApiComponents.getEpolicyPDFURL(request);
@@ -542,10 +555,12 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
                     url = response.getEPolicyPDFURL();
                     break;
             }
+            transferUrl = fileComponents.gainCarInsPolicyNew(response.getEPolicyPDFURL(),
+                    licensePlate + "-" + templateName, insAreaCompany.getId(),
+                    customerInfoVo.getIdentifyNumber(),flag);
         } catch (Exception e){
             throw new SystemException(e.toString());
         }
-        String transferUrl = gainCarInsPolicyNew(url, templateName, insAreaCompany.getId(),flag);
         return transferUrl;
     }
 
@@ -715,7 +730,7 @@ public class YangGuangOrderApiServiceImpl implements YangGuangOrderApiService {
                 insAreaCompanyAccidentalDriving.setRideRiskName(accidentalDriving.getProductName());
                 insAreaCompanyAccidentalDrivings.add(insAreaCompanyAccidentalDriving);
             });
-
+            insAreaCompany.setAccidentInfo(JSONArray.parseArray(JSONArray.toJSONString(accidentalDrivingVo)));
             insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDrivings);
         } else {
             insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, new ArrayList<>());