Преглед изворни кода

1.处理上传文件接口报错问题
2.处理非车保单号生成错误问题
3.处理燃油类型转换错误bug

hxl13994548489 пре 2 година
родитељ
комит
ff4589aa72

+ 18 - 0
src/main/java/com/ydtech/modules/order/entity/api/guoren/constants/FuelType.java

@@ -33,4 +33,22 @@ public enum FuelType {
         return Arrays.asList(ENERGY);
     }
 
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/14 10:39
+     *  @Description:  根据值获取code
+     */
+    public static String getCodeByValue(String value) {
+        if("汽油".equals(value)){
+            value="燃油";
+        }
+        for (FuelType fuelType : FuelType.values()) {
+            if (fuelType.desc.equals(value)) {
+                return fuelType.code;
+            }
+        }
+       return null;
+    }
+
 }

+ 5 - 2
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/CarConfirmRequest.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.order.entity.api.pingan.request;
 
 import com.ydtech.modules.ins.model.vo.CarInfoVo;
 import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
+import com.ydtech.modules.order.entity.api.guoren.constants.FuelType;
 import com.ydtech.modules.order.entity.api.pingan.constants.dict.SexCodeEnum;
 import com.ydtech.modules.order.entity.api.pingan.response.SearchPAVehicleListResponse;
 import com.ydtech.modules.order.entity.api.pingan.utils.NetworkUtils;
@@ -775,7 +776,7 @@ public class CarConfirmRequest extends PingAnBaseRequest {
          * 北京:
          * A:汽油,B:柴油,c:电,D:混合油,E:天然气,F:液化石油气,L:甲醇,M:乙醇,N:太阳能,O:混合动力,Y:无,Z:其它
          *
-         * 其他地区:
+         * 其他地区:  [A,B,C,D,E,F,L,M,N,O,Y,Z,0,1,2,3,4]
          * 0: 燃油
          * 1: 纯电动
          * 2: 燃料电池
@@ -787,7 +788,9 @@ public class CarConfirmRequest extends PingAnBaseRequest {
         private String fuelType;
 
         public ForceQuoteDTO(String fuelType) {
-            this.fuelType = fuelType;
+            //转换成枚举的code
+            String value = FuelType.getCodeByValue(fuelType);
+            this.fuelType = value;
         }
     }
     /***

+ 31 - 28
src/main/java/com/ydtech/modules/order/entity/api/pingan/request/UploadFilesRequest.java

@@ -31,7 +31,28 @@ public class UploadFilesRequest extends PingAnBaseRequest{
     public UploadFilesRequest(List<DocListDTO> list) {
         this.setDocList(list);
     }
-
+    /***
+     * 投保单号
+     * m
+     */
+    @CheckNotEmpty(fieldName = "投保单号", message = "投保单号不能为空")
+    private String applyPolicyNo;
+    /***
+     * 关联投保保单号
+     * c
+     */
+    private String relationApplyPolicyNo;
+    /***
+     * 用户ID
+     * c
+     */
+    private String userId;
+    /***
+     * 数据来源 openApi
+     *  m
+     */
+    @CheckNotEmpty(fieldName = "数据来源", message = "数据来源不能为空")
+    private String dataSource;
 
     /***
      *  文件信息
@@ -77,44 +98,26 @@ public class UploadFilesRequest extends PingAnBaseRequest{
          * c
          */
         private String documentSize;
-        /***
-         * 投保单号
-         * m
-         */
-        @CheckNotEmpty(fieldName = "投保单号", message = "投保单号不能为空")
-        private String applyPolicyNo;
-        /***
-         * 关联投保保单号
-         * c
-         */
-        private String relationApplyPolicyNo;
-        /***
-         * 用户ID
-         * c
-         */
-        private String userId;
-        /***
-         * 数据来源 openApi
-         *  m
-         */
-        @CheckNotEmpty(fieldName = "数据来源", message = "数据来源不能为空")
-        private String dataSource;
 
 
-        public DocListDTO(String docId, String documentClass, String documentType, String documentName, String documentFormat, String documentSize, String applyPolicyNo, String relationApplyPolicyNo, String userId, String dataSource) {
+        public DocListDTO(String docId, String documentClass, String documentType, String documentName, String documentFormat, String documentSize) {
             this.docId = docId;
             this.documentClass = documentClass;
             this.documentType = documentType;
             this.documentName = documentName;
             this.documentFormat = documentFormat;
             this.documentSize = documentSize;
-            this.applyPolicyNo = applyPolicyNo;
-            this.relationApplyPolicyNo = relationApplyPolicyNo;
-            this.userId = userId;
-            this.dataSource = dataSource;
         }
     }
 
+    public UploadFilesRequest(List<DocListDTO> docList, String applyPolicyNo, String relationApplyPolicyNo, String userId, String dataSource) {
+        this.docList = docList;
+        this.applyPolicyNo = applyPolicyNo;
+        this.relationApplyPolicyNo = relationApplyPolicyNo;
+        this.userId = userId;
+        this.dataSource = dataSource;
+    }
+
     @Validate
     public void validate() {
         // 执行验证逻辑

+ 59 - 27
src/main/java/com/ydtech/modules/order/service/impl/PingAnOrderApiServiceImpl.java

@@ -558,24 +558,18 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
     @Override
     public HttpResult<Object> submitImage(String subOrderNo) {
         InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(subOrderNo);
-
         // 账号信息
         PtlAgreementAttribution ptlAgreementAttribution = ptlAgreementAttributionService.getById(insAreaCompany.getAgreementId());
         // 通过 协议id获取配置实体
         PingAnConfigureParameters parameters = configureParametersComponents.toEntity(PingAnConfigureParameters.class,
                 ptlAgreementAttribution);
         PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),subOrderNo,insAreaCompany.getAgreementId());
-        InsOrders insOrders = insOrdersService.existOrder(insAreaCompany.getOrderno());
-
         //图片
         List<InsUploadImagesDto> imgList = insTaskImagesMapper.getByOrderNoInsUploadImagesDtoList(insAreaCompany.getOrderno());
 
-        // List<InsTaskImagesBase64> insTaskImagesBase64s = insTaskImagesService.findByOrderNo(insOrders.getOrderno(),
-        //         insAreaCompany.getId(), true);
         if (imgList.isEmpty()) {
             return HttpResult.error("影像集合为空");
         } else {
-            List<InsTaskImages> listNew = new ArrayList<InsTaskImages>();
             List<UploadFilesRequest.DocListDTO> list = new ArrayList<>();
             // 获取当前项目的目录
             File projectFile =new File(System.getProperty("user.dir"));
@@ -597,17 +591,17 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                 String documentFormat = fileName.split("\\.")[1];
                 boolean upLoadFileFlag = PingAnUpLoadUtils.getUpLoadFile(properties.getHost(), properties.getBucket(), properties.getAk(), properties.getSk(), file, key);
                 if(!upLoadFileFlag){
-                    // throw new SystemException("上传影像文件失败");
+                    throw new SystemException("上传影像文件失败");
                 }
                 UploadFilesRequest.DocListDTO docListDTO = new UploadFilesRequest.DocListDTO(key, documentClass, documentType, documentName,documentFormat ,
-                        null, insAreaCompany.getJqapplyno(),null, parameters.getUserId(), "openApi");
+                        null);
                 list.add(docListDTO);
             }
             if(insTaskImages!=null && insTaskImages.size()>0){
                 boolean b = insTaskImagesService.updateBatchById(insTaskImages);
             }
             //调用文件上传
-            UploadFilesRequest uploadRequest = new UploadFilesRequest(list);
+            UploadFilesRequest uploadRequest = new UploadFilesRequest(list,insAreaCompany.getJqapplyno(),null, parameters.getUserId(), "openApi");
 
             UploadFilesResponse uploadFilesResponse = null;
             try {
@@ -634,6 +628,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
     public HttpResult<Object> audit(SpecialAuditVo<SubmitVerifyRequest.EngageListDTO> vo) {
         String companyId = vo.getCompanyId();
         List<SubmitVerifyRequest.EngageListDTO> engageList = vo.getEngageList();
+        //特约处理  暂时获取不到
         if(engageList!=null && engageList.size()>0){
 
         }
@@ -647,23 +642,16 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         String flowid = insAreaCompany.getFlowid();
         InsOrders insOrders = insOrdersService.existOrder(insAreaCompany.getOrderno());
         PinganApiLog pinganApiLog = new PinganApiLog(insAreaCompany.getOrderno(),companyId,insAreaCompany.getAgreementId());
-        //组装上传的资料信息提交
-        List<SubmitApplyRequest.DocListDTO> docList =new ArrayList<SubmitApplyRequest.DocListDTO>();
-        //通过报价单号查询上传的影像
-        LambdaQueryWrapper<InsTaskImages> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(InsTaskImages::getQuoteNo, insOrders.getQuoteno());
-        List<InsTaskImages> insTaskImagesListAll = insTaskImagesService.list(queryWrapper);
-        //组装平安影像
-        for(InsTaskImages insTaskImages :insTaskImagesListAll){
-            InsUploadFiles fiels = insUploadFilesService.getById(insTaskImages.getImageId());
-            SubmitApplyRequest.DocListDTO  dto=new SubmitApplyRequest.DocListDTO().getDocListDTOMsg(fiels,insTaskImages);
-            docList.add(dto);
-        }
+
+
         //交强特约
         List<SubmitApplyRequest.BizSpecialPromiseListDTO> bizSpecialPromiseList=new ArrayList<SubmitApplyRequest.BizSpecialPromiseListDTO>();
         //商业特约
         List<SubmitApplyRequest.BizSpecialPromiseListDTO> forceSpecialPromiseList=new ArrayList<SubmitApplyRequest.BizSpecialPromiseListDTO>();
-
+        //UploadFilesResponse uploadFilesResponse = getUploadResponseByParam(insAreaCompany,pinganApiLog,parameters.getUserId());
+       // if (uploadFilesResponse != null & !"0".equals(uploadFilesResponse.getResultCode()) ) {
+        //    throw new SystemException(uploadFilesResponse.getResultMessage());
+       // }
         //调用6.1 补充信息并核保
         SubmitApplyRequest submitApplyRequest = new SubmitApplyRequest(parameters,flowid, "true",insOrders,null,null,null);
         SubmitApplyResponse submitApplyResponse = null;
@@ -675,7 +663,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         if (submitApplyResponse != null) {
             // 事中资料  15 时上传资料
             if("15".equals(submitApplyResponse.getResultCode())){
-                submitApplyRequest.setDocList(docList);
+                submitApplyRequest.setDocList(null);
                 try {
                     submitApplyResponse = pinganRequestApiComponents.submitApply(submitApplyRequest,pinganApiLog);
                 } catch (Exception e) {
@@ -757,9 +745,16 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
                             JSONArray objects = JSON.parseArray(JSON.toJSONString(jyList));
                             insAreaCompany.setCrossInsurance(objects);
                         }
+                        pinganApiLog.setId(null);
+                        //上传影像
+
                         //说明核保成功,更新大订单和小订单的状态为1  更新为已核保待缴费
                         insAreaCompany.setOrderstatus(InsOrderStatusEnum.WAIT_PAY.getCode());
                         insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+                        UploadFilesResponse uploadFilesResponse = getUploadResponseByParam(insAreaCompany,pinganApiLog,parameters.getUserId());
+                        if (uploadFilesResponse != null & !"0".equals(uploadFilesResponse.getResultCode()) ) {
+                             throw new SystemException(uploadFilesResponse.getResultMessage());
+                        }
                         return HttpResult.ok("提交核保成功");
                     }
                 } else {
@@ -771,7 +766,45 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         }
         return HttpResult.error("提交核保接口失败");
     }
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/14 8:52
+     *  @Description:   上传文件
+     */
+    private UploadFilesResponse getUploadResponseByParam(InsAreaCompany insAreaCompany,PinganApiLog pinganApiLog,String userId){
+        //组装上传的资料信息提交
+        UploadFilesResponse uploadFilesResponse = null;
+        //通过报价单号查询上传的影像
+        List<InsUploadImagesDto> imgList = insTaskImagesMapper.getByOrderNoInsUploadImagesDtoList(insAreaCompany.getOrderno());
+        if (imgList.isEmpty()) {
+            throw  new SystemException("影像集合为空");
+        } else {
+            List<UploadFilesRequest.DocListDTO> list = new ArrayList<>();
+            for (InsUploadImagesDto insUploadImagesDto : imgList) {
+                InsUploadFiles fiels = insUploadFilesService.getById(insUploadImagesDto.getImageId());
+                InsTaskImages imagevo = insTaskImagesService.getById(insUploadImagesDto.getId());
+                String key = imagevo.getPinganKey();
+                File file = new File(fiels.getFilePath());
+                PingAnDocumentClassEnum fileEnum = PingAnDocumentClassEnum.getCode(insUploadImagesDto.getImageType());
+                String documentClass = fileEnum.getDocument();
+                String documentType = fileEnum.getDocumentType();
+                String fileName = file.getName();
+                String documentName = fileName.split("\\.")[0];
+                String documentFormat = fileName.split("\\.")[1];
+                UploadFilesRequest.DocListDTO docListDTO = new UploadFilesRequest.DocListDTO(key, documentClass, documentType, documentName, documentFormat,null);
+                list.add(docListDTO);
+            }
+            //调用文件上传
+            UploadFilesRequest uploadRequest = new UploadFilesRequest(list,insAreaCompany.getJqapplyno(),insAreaCompany.getJqapplyno(),userId,"openApi");
+            try {
+                uploadFilesResponse = pinganRequestApiComponents.uploadFiles(uploadRequest, pinganApiLog);
+            } catch (Exception e) {
+                throw new SystemException(e.getMessage());
+            }
+        }
+        return uploadFilesResponse;
+    }
     /**
      * @Description 获取保单pdf地址  调用 002
      * @Author hxl
@@ -802,11 +835,10 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         //非车保单号
         String application = null;
         if(crossInsurance!=null && crossInsurance.size() > 0) {
-            application = crossInsurance.getJSONObject(0).getString("application");
+            application = crossInsurance.getJSONObject(0).getString("policy");
         }
         CrawlerPolicyPrintVo  crawlerPolicyPrintVo =new CrawlerPolicyPrintVo();
         //交强
-
         if(StringUtils.isNotBlank(jqpolicyno) ){
             String fileName="_交强险保单";
             String fileBZName="-交强险标志";
@@ -870,7 +902,7 @@ public class PingAnOrderApiServiceImpl implements PingAnOrderApiService {
         String fileBZName="";
         //驾意险
         if(type==3){
-             flag="true";
+            flag="true";
             fileName="_非车险保单";
         }else if(type==1){
             //交强