xuqiang 1 год назад
Родитель
Сommit
9539bdd609

+ 6 - 1
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/api/component/HuiTaiUploadImageComponent.java

@@ -88,6 +88,7 @@ public class HuiTaiUploadImageComponent {
                             imageIds.add(imageDTO.getImageId());
                         } catch (Exception e) {
                             insImagesUploadCacheComponent.setUploadImageCache(companyId, map);
+                            log.error(fileTypeEnum.getName() + "上传异常,", e);
                             throw new SystemException(fileTypeEnum.getName() + "上传异常, 请重试");
                         }
 
@@ -169,7 +170,11 @@ public class HuiTaiUploadImageComponent {
         httpHeaders.setContentType(MediaType.APPLICATION_JSON);
         HttpEntity<HuaTaiSaveFileIdxRequest> httpEntity = new HttpEntity<>(huaTaiSaveFileIdxRequest, httpHeaders);
         String saveFileIdxUrl = domain + SAVE_FILE_IDX;
-        restTemplate.postForEntity(saveFileIdxUrl, httpEntity, String.class);
+        try {
+            restTemplate.postForEntity(saveFileIdxUrl, httpEntity, String.class);
+        }catch (Exception e){
+            log.error("保存异常,", e);
+        }
     }
 
 

+ 8 - 8
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/api/entity/request/HuaTaiSaveFileIdxRequest.java

@@ -162,12 +162,12 @@ public class HuaTaiSaveFileIdxRequest {
             this.createUser = response.getOptUserId();
             this.createUserName = response.getOptUserName();
             this.appSource = response.getAppSource();
-            this.docId = response.getDocId();
-            this.bussNo = response.getBussNo();
-            this.bussType = response.getBussType();
-            this.bussTypeName = response.getBussTypeName();
-            this.riskCode = response.getRiskCode();
-            this.riskCodeName = response.getRiskCodeName();
+            this.docId = childrenDTO.getDocId();
+            this.bussNo = childrenDTO.getBussNo();
+            this.bussType = childrenDTO.getBussType();
+            this.bussTypeName = childrenDTO.getBussTypeName();
+            this.riskCode = childrenDTO.getRiskCode();
+            this.riskCodeName = childrenDTO.getRiskCodeName();
             this.comCode = response.getComCode();
             this.comName = response.getComName();
             this.bussDate = response.getBussDate();
@@ -177,7 +177,7 @@ public class HuaTaiSaveFileIdxRequest {
             this.editable = true;
             this.deletable = true;
             this.voType = "C";
-            this.archType = response.getArchType();
+            this.archType = childrenDTO.getArchType();
 
             this.picFileFlag = 1;
             this.fileSize = fileupload.getFileSize();
@@ -189,7 +189,7 @@ public class HuaTaiSaveFileIdxRequest {
             this.fileTitle = uuidLower;
             this.fileOrgName = uuidLower + substring;
 
-            this.fileName = fileupload.getFilePath().substring(fileupload.getFilePath().lastIndexOf("/")+1);;
+            this.fileName = fileupload.getFilePath().substring(fileupload.getFilePath().lastIndexOf("/")+1);
 
             this.typePath = childrenDTO.getTypePath();
             this.typePathName = childrenDTO.getTypePathName();

+ 7 - 13
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/UnifyOrderManager.java

@@ -1,6 +1,5 @@
 package com.jzg.quotation.summary.controller;
 
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -18,14 +17,10 @@ import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.MinioUtils;
 import com.jzg.quotation.commons.client.OrgClient;
 import com.jzg.quotation.commons.client.PlatformClient;
-import com.jzg.quotation.commons.constant.enums.base.QuoteRuleCategory;
-import com.jzg.quotation.commons.constant.enums.base.QuoteRuleGroup;
 import com.jzg.quotation.commons.entity.vo.aggregated.*;
 import com.jzg.quotation.commons.entity.vo.orders.InsOrdersVo;
 import com.jzg.quotation.commons.service.QuotationApiBaseService;
 import com.jzg.quotation.commons.utils.SnowFlakeUtil;
-import com.jzg.quotation.summary.converter.QuoteInfoConverter;
-import com.jzg.quotation.summary.entity.po.QuoteRuleMapping;
 import com.jzg.quotation.summary.factory.CompanyFactory;
 import com.jzg.quotation.summary.mapper.SysUploadFilesMapper;
 import com.jzg.quotation.summary.service.*;
@@ -44,7 +39,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 
 import java.io.IOException;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 
 
@@ -195,13 +189,13 @@ public class UnifyOrderManager {
         quoteVo.getOrder().setOrdersNo(ordersNo);
 
         //保司相关代码转换
-        Map<String, List<QuoteRuleMapping>> quoteKindMappingMap = quoteRuleMappingService.getByInsuranceCompanyCode(esmInsCompanyHttpResult.getData().getCode());
-        QuoteInfoConverter.converterCarInfoVo(quoteVo.getCarInfoVo(), quoteKindMappingMap.get(QuoteRuleCategory.QUOTE_INFO.getCode()));
-        if(CollUtil.isNotEmpty(quoteVo.getKindInfoVo())){
-            QuoteInfoConverter.converterKindInfoVo(quoteVo.getKindInfoVo(),
-                    quoteKindMappingMap.get(QuoteRuleCategory.KIND.getCode()),
-                    quoteVo.getCarInfoVo());
-        }
+//        Map<String, List<QuoteRuleMapping>> quoteKindMappingMap = quoteRuleMappingService.getByInsuranceCompanyCode(esmInsCompanyHttpResult.getData().getCode());
+//        QuoteInfoConverter.converterCarInfoVo(quoteVo.getCarInfoVo(), quoteKindMappingMap.get(QuoteRuleCategory.QUOTE_INFO.getCode()));
+//        if(CollUtil.isNotEmpty(quoteVo.getKindInfoVo())){
+//            QuoteInfoConverter.converterKindInfoVo(quoteVo.getKindInfoVo(),
+//                    quoteKindMappingMap.get(QuoteRuleCategory.KIND.getCode()),
+//                    quoteVo.getCarInfoVo());
+//        }
 
 
         // 报价

+ 27 - 16
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/factory/decorator/image/ImageParamHandlerDecorator.java

@@ -1,30 +1,16 @@
 package com.jzg.quotation.summary.factory.decorator.image;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
 import com.jzg.commons.entity.vo.ImagesVo;
 import com.jzg.commons.entity.vo.InsTaskImagesVo;
-import com.jzg.commons.exception.SystemException;
-import com.jzg.commons.util.MinioUtils;
 import com.jzg.quotation.commons.entity.vo.aggregated.InsuranceUploadImageVo;
-import com.jzg.quotation.commons.entity.vo.aggregated.QuoteResultsVo;
-import com.jzg.quotation.commons.entity.vo.aggregated.QuoteVo;
-import com.jzg.quotation.commons.entity.vo.aggregated.UploadImageVo;
 import com.jzg.quotation.commons.entity.vo.image.InsuranceImageVo;
 import com.jzg.quotation.commons.service.QuotationApiBaseService;
-import com.jzg.quotation.summary.entity.vo.QuoteNumRedisVo;
 import com.jzg.quotation.summary.service.InsTaskImagesService;
-import com.jzg.quotation.summary.service.SysQuoteConfigService;
-import com.jzg.quotation.summary.service.SysQuoteRedisService;
 import io.minio.GetObjectArgs;
 import io.minio.MinioClient;
-import io.minio.errors.*;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.math.BigDecimal;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -74,8 +60,9 @@ public class ImageParamHandlerDecorator {
                 InsuranceImageVo.ImageDTO imageDTO = new InsuranceImageVo.ImageDTO();
                 imageDTO.setImageId(imageVo.getImageId());
                 imageDTO.setImageName(imageVo.getFileName());
-                String fileBase64 = getFileBase64(minioClient, bucketName, imageVo.getFileName());
-                imageDTO.setImageBase64Str(fileBase64);
+                byte[] fileToByte = getFileToByte(minioClient, bucketName, imageVo.getFileName());
+                imageDTO.setImageBase64Str(Base64.getEncoder().encodeToString(fileToByte));
+                imageDTO.setImageByte(fileToByte);
                 return imageDTO;
             }).collect(Collectors.toList());
             vo.setImageBase64List(imageDTOList);
@@ -120,4 +107,28 @@ public class ImageParamHandlerDecorator {
         }
     }
 
+
+    /**
+     * 获取文件bytes数组
+     * @param minioClient
+     * @param bucketName
+     * @return
+     */
+    public byte[] getFileToByte(MinioClient minioClient,String bucketName,String imageName){
+        try (InputStream stream = minioClient.getObject(
+                GetObjectArgs.builder().bucket(bucketName).object(imageName).build());
+             ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
+            // 读取流数据
+            byte[] buffer = new byte[4096];
+            int bytesRead;
+            while ((bytesRead = stream.read(buffer)) != -1) {
+                outputStream.write(buffer, 0, bytesRead);
+            }
+            return outputStream.toByteArray();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
 }