From 876068589d213fa585cf593fa19b39f9592e47d5 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 24 四月 2026 11:17:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro

---
 src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java       |   23 --
 src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java |   28 --
 src/main/java/com/ruoyi/basic/dto/StorageAttachmentDTO.java                        |    2 
 src/main/java/com/ruoyi/sales/service/ShippingInfoService.java                     |    5 
 src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java                             |    5 
 src/main/java/com/ruoyi/basic/dto/StorageAttachmentVO.java                         |   14 +
 /dev/null                                                                          |  433 ---------------------------------------
 src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java            |   13 
 src/main/java/com/ruoyi/basic/dto/StorageBlobDTO.java                              |   17 +
 src/main/java/com/ruoyi/basic/service/StorageAttachmentService.java                |    8 
 src/main/java/com/ruoyi/basic/utils/FileUtil.java                                  |   77 +++---
 src/main/java/com/ruoyi/project/common/CommonController.java                       |   10 
 src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java                            |    2 
 13 files changed, 83 insertions(+), 554 deletions(-)

diff --git a/src/main/java/com/ruoyi/basic/dto/StorageAttachmentDTO.java b/src/main/java/com/ruoyi/basic/dto/StorageAttachmentDTO.java
index 685e29e..ef97145 100644
--- a/src/main/java/com/ruoyi/basic/dto/StorageAttachmentDTO.java
+++ b/src/main/java/com/ruoyi/basic/dto/StorageAttachmentDTO.java
@@ -10,5 +10,5 @@
     /**
      * 瀛樺偍鏂囦欢鍒楄〃
      */
-    private List<StorageBlobVO> storageBlobVOS;
+    private List<StorageBlobDTO> storageBlobDTOs;
 }
diff --git a/src/main/java/com/ruoyi/basic/dto/StorageAttachmentVO.java b/src/main/java/com/ruoyi/basic/dto/StorageAttachmentVO.java
new file mode 100644
index 0000000..232ffe6
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/dto/StorageAttachmentVO.java
@@ -0,0 +1,14 @@
+package com.ruoyi.basic.dto;
+
+import com.ruoyi.basic.pojo.StorageAttachment;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class StorageAttachmentVO extends StorageAttachment {
+    /**
+     * 瀛樺偍鏂囦欢鍒楄〃
+     */
+    private List<StorageBlobVO> storageBlobVOS;
+}
diff --git a/src/main/java/com/ruoyi/basic/dto/StorageBlobDTO.java b/src/main/java/com/ruoyi/basic/dto/StorageBlobDTO.java
new file mode 100644
index 0000000..62857d0
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/dto/StorageBlobDTO.java
@@ -0,0 +1,17 @@
+package com.ruoyi.basic.dto;
+
+import com.ruoyi.basic.pojo.StorageBlob;
+import lombok.Data;
+
+@Data
+public class StorageBlobDTO extends StorageBlob {
+    /**
+     * 棰勮鍦板潃
+     */
+    private String previewURL;
+
+    /**
+     * 涓嬭浇鍦板潃
+     */
+    private String downloadURL;
+}
diff --git a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
index c26b57a..7e7a146 100644
--- a/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
+++ b/src/main/java/com/ruoyi/basic/enums/RecordTypeEnum.java
@@ -1,7 +1,7 @@
 package com.ruoyi.basic.enums;
 
 public enum RecordTypeEnum {
-    FILE("file");
+    ShippingInfo("shipping_info");
 
     private final String type;
     RecordTypeEnum(String type) { this.type = type; }
diff --git a/src/main/java/com/ruoyi/basic/service/StorageAttachmentService.java b/src/main/java/com/ruoyi/basic/service/StorageAttachmentService.java
index 4db9fad..7fbaf64 100644
--- a/src/main/java/com/ruoyi/basic/service/StorageAttachmentService.java
+++ b/src/main/java/com/ruoyi/basic/service/StorageAttachmentService.java
@@ -16,14 +16,6 @@
  * @since 2025-05-29
  */
 public interface StorageAttachmentService extends IService<StorageAttachment> {
-    /**
-     * 鏌ヨ閫氱敤鏂囦欢涓婁紶鐨勯檮浠朵俊鎭�
-     * @param recordId 鍏宠仈璁板綍id
-     * @param recordType 鍏宠仈璁板綍绫诲瀷
-     * @param fileType 鏂囦欢绫诲瀷
-     * @return 鏂囦欢淇℃伅鍒楄〃
-     */
-    List<StorageAttachment> selectStorageAttachments(Long recordId, StorageAttachmentRecordType recordType, String fileType);
 
     /**
      * 淇濆瓨閫氱敤鏂囦欢涓婁紶鐨勯檮浠朵俊鎭�
diff --git a/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
index fbf1e00..f3f3ae3 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
@@ -8,7 +8,6 @@
 import com.ruoyi.basic.service.StorageBlobService;
 import com.ruoyi.common.constant.StorageAttachmentConstants;
 import com.ruoyi.common.enums.StorageAttachmentRecordType;
-import com.ruoyi.common.utils.MinioUtils;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 
@@ -31,28 +30,6 @@
 
     private final StorageBlobService storageBlobService;
 
-    private final MinioUtils minioUtils;
-
-    @Override
-    public List<StorageAttachment> selectStorageAttachments(Long recordId, StorageAttachmentRecordType recordType, String fileType) {
-        // todo fileChange
-//        List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>()
-//                .eq(StorageAttachment::getRecordId, recordId)
-//                .eq(StorageAttachment::getRecordType, recordType.ordinal())
-//                .eq(StorageAttachment::getName, fileType));
-//        if (storageAttachments != null) {
-//            for (StorageAttachment storageAttachment : storageAttachments) {
-//                StorageBlob storageBlob = storageBlobMapper.selectById(storageAttachment.getStorageBlobId());
-//                StorageBlobDTO storageBlobDTO = new StorageBlobDTO();
-//                BeanUtils.copyProperties(storageBlob, storageBlobDTO);
-//                storageBlobDTO.setUrl(minioUtils.getPreviewUrl(storageBlob.getBucketName(), storageBlob.getBucketName(), true));
-//                storageAttachment.setStorageBlobDTO(storageBlobDTO);
-//            }
-//        }
-
-//        return storageAttachments;
-        return null;
-    }
 
     @Override
     public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, StorageAttachmentConstants fileType) {
diff --git a/src/main/java/com/ruoyi/basic/utils/FileUtil.java b/src/main/java/com/ruoyi/basic/utils/FileUtil.java
index 19ac77c..b97f1d1 100644
--- a/src/main/java/com/ruoyi/basic/utils/FileUtil.java
+++ b/src/main/java/com/ruoyi/basic/utils/FileUtil.java
@@ -2,7 +2,8 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.ruoyi.basic.dto.StorageAttachmentDTO;
+import com.ruoyi.basic.dto.StorageAttachmentVO;
+import com.ruoyi.basic.dto.StorageBlobDTO;
 import com.ruoyi.basic.dto.StorageBlobVO;
 import com.ruoyi.basic.enums.ApplicationTypeEnum;
 import com.ruoyi.basic.enums.RecordTypeEnum;
@@ -48,10 +49,10 @@
      * @param application     鏂囦欢鐢ㄩ��
      * @param recordType      鍏宠仈璁板綍绫诲瀷
      * @param recordId        鍏宠仈璁板綍id
-     * @param storageBlobVOS 鏂囦欢淇℃伅
+     * @param storageBlobDTOS 鏂囦欢淇℃伅
      */
-    public void saveStorageAttachment(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, List<StorageBlobVO> storageBlobVOS) {
-        if (CollectionUtils.isEmpty(storageBlobVOS)) {
+    public void saveStorageAttachment(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, List<StorageBlobDTO> storageBlobDTOS) {
+        if (CollectionUtils.isEmpty(storageBlobDTOS)) {
             throw new RuntimeException("鏂囦欢淇℃伅涓嶈兘涓虹┖");
         }
         if (application == null) {
@@ -66,12 +67,12 @@
         // 鍒犻櫎鏃ч檮浠朵俊鎭�
         deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId);
         List<StorageAttachment> storageAttachments = new ArrayList<>();
-        for (StorageBlobVO storageBlobVO : storageBlobVOS) {
+        for (StorageBlobDTO storageBlobDTO : storageBlobDTOS) {
             StorageAttachment storageAttachment = new StorageAttachment();
             storageAttachment.setApplication(application.getType());
             storageAttachment.setRecordType(recordType.getType());
             storageAttachment.setRecordId(recordId);
-            storageAttachment.setStorageBlobId(storageBlobVO.getId());
+            storageAttachment.setStorageBlobId(storageBlobDTO.getId());
             storageAttachment.setDeleted(0L);
         }
         storageAttachmentMapper.insert(storageAttachments);
@@ -238,24 +239,24 @@
      *
      * @param storageAttachmentIds 鏂囦欢id
      */
-    public List<StorageAttachmentDTO> getStorageAttachmentDTOsByStorageAttachmentIds(List<Long> storageAttachmentIds) {
+    public List<StorageAttachmentVO> getStorageAttachmentVOSByStorageAttachmentIds(List<Long> storageAttachmentIds) {
         List<StorageAttachment> storageAttachments = getStorageAttachmentsByStorageAttachmentIds(storageAttachmentIds);
         if (CollectionUtils.isEmpty(storageAttachments)) {
             return new ArrayList<>();
         }
-        List<StorageAttachmentDTO> storageAttachmentDTOS = new ArrayList<>();
+        List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>();
         for (StorageAttachment storageAttachment : storageAttachments) {
-            StorageAttachmentDTO storageAttachmentDTO = new StorageAttachmentDTO();
-            BeanUtils.copyProperties(storageAttachment, storageAttachmentDTO);
+            StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO();
+            BeanUtils.copyProperties(storageAttachment, storageAttachmentVO);
             List<StorageBlobVO> storageBlobVOS = getStorageBlobDTOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()));
             if (CollectionUtils.isEmpty(storageBlobVOS)) {
-                storageAttachmentDTO.setStorageBlobVOS(new ArrayList<>());
+                storageAttachmentVO.setStorageBlobVOS(new ArrayList<>());
             } else {
-                storageAttachmentDTO.setStorageBlobVOS(storageBlobVOS);
+                storageAttachmentVO.setStorageBlobVOS(storageBlobVOS);
             }
-            storageAttachmentDTOS.add(storageAttachmentDTO);
+            storageAttachmentVOS.add(storageAttachmentVO);
         }
-        return storageAttachmentDTOS;
+        return storageAttachmentVOS;
     }
 
     /**
@@ -264,24 +265,24 @@
      * @param storageAttachmentIds 鏂囦欢id
      * @param expired              杩囨湡鏃堕棿
      */
-    public List<StorageAttachmentDTO> getStorageAttachmentDTOsByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired) {
+    public List<StorageAttachmentVO> getStorageAttachmentVOSByStorageAttachmentIds(List<Long> storageAttachmentIds, BigDecimal expired) {
         List<StorageAttachment> storageAttachments = getStorageAttachmentsByStorageAttachmentIds(storageAttachmentIds);
         if (CollectionUtils.isEmpty(storageAttachments)) {
             return new ArrayList<>();
         }
-        List<StorageAttachmentDTO> storageAttachmentDTOS = new ArrayList<>();
+        List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>();
         for (StorageAttachment storageAttachment : storageAttachments) {
-            StorageAttachmentDTO storageAttachmentDTO = new StorageAttachmentDTO();
-            BeanUtils.copyProperties(storageAttachment, storageAttachmentDTO);
+            StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO();
+            BeanUtils.copyProperties(storageAttachment, storageAttachmentVO);
             List<StorageBlobVO> storageBlobVOS = getStorageBlobDTOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()), expired);
             if (CollectionUtils.isEmpty(storageBlobVOS)) {
-                storageAttachmentDTO.setStorageBlobVOS(new ArrayList<>());
+                storageAttachmentVO.setStorageBlobVOS(new ArrayList<>());
             } else {
-                storageAttachmentDTO.setStorageBlobVOS(storageBlobVOS);
+                storageAttachmentVO.setStorageBlobVOS(storageBlobVOS);
             }
-            storageAttachmentDTOS.add(storageAttachmentDTO);
+            storageAttachmentVOS.add(storageAttachmentVO);
         }
-        return storageAttachmentDTOS;
+        return storageAttachmentVOS;
     }
 
     /**
@@ -291,24 +292,24 @@
      * @param recordType  璁板綍绫诲瀷
      * @param recordId    璁板綍id
      */
-    public List<StorageAttachmentDTO> getStorageAttachmentDTOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) {
+    public List<StorageAttachmentVO> getStorageAttachmentVOSByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId) {
         List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId);
         if (CollectionUtils.isEmpty(storageAttachments)) {
             return new ArrayList<>();
         }
-        List<StorageAttachmentDTO> storageAttachmentDTOS = new ArrayList<>();
+        List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>();
         for (StorageAttachment storageAttachment : storageAttachments) {
-            StorageAttachmentDTO storageAttachmentDTO = new StorageAttachmentDTO();
-            BeanUtils.copyProperties(storageAttachment, storageAttachmentDTO);
+            StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO();
+            BeanUtils.copyProperties(storageAttachment, storageAttachmentVO);
             List<StorageBlobVO> storageBlobVOS = getStorageBlobDTOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()));
             if (CollectionUtils.isEmpty(storageBlobVOS)) {
-                storageAttachmentDTO.setStorageBlobVOS(new ArrayList<>());
+                storageAttachmentVO.setStorageBlobVOS(new ArrayList<>());
             } else {
-                storageAttachmentDTO.setStorageBlobVOS(storageBlobVOS);
+                storageAttachmentVO.setStorageBlobVOS(storageBlobVOS);
             }
-            storageAttachmentDTOS.add(storageAttachmentDTO);
+            storageAttachmentVOS.add(storageAttachmentVO);
         }
-        return storageAttachmentDTOS;
+        return storageAttachmentVOS;
     }
 
     /**
@@ -319,24 +320,24 @@
      * @param recordId    璁板綍id
      * @param expired     杩囨湡鏃堕棿
      */
-    public List<StorageAttachmentDTO> getStorageAttachmentDTOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired) {
+    public List<StorageAttachmentVO> getStorageAttachmentVOSByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum application, RecordTypeEnum recordType, Long recordId, BigDecimal expired) {
         List<StorageAttachment> storageAttachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType, recordId);
         if (CollectionUtils.isEmpty(storageAttachments)) {
             return new ArrayList<>();
         }
-        List<StorageAttachmentDTO> storageAttachmentDTOS = new ArrayList<>();
+        List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>();
         for (StorageAttachment storageAttachment : storageAttachments) {
-            StorageAttachmentDTO storageAttachmentDTO = new StorageAttachmentDTO();
-            BeanUtils.copyProperties(storageAttachment, storageAttachmentDTO);
+            StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO();
+            BeanUtils.copyProperties(storageAttachment, storageAttachmentVO);
             List<StorageBlobVO> storageBlobVOS = getStorageBlobDTOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()), expired);
             if (CollectionUtils.isEmpty(storageBlobVOS)) {
-                storageAttachmentDTO.setStorageBlobVOS(new ArrayList<>());
+                storageAttachmentVO.setStorageBlobVOS(new ArrayList<>());
             } else {
-                storageAttachmentDTO.setStorageBlobVOS(storageBlobVOS);
+                storageAttachmentVO.setStorageBlobVOS(storageBlobVOS);
             }
-            storageAttachmentDTOS.add(storageAttachmentDTO);
+            storageAttachmentVOS.add(storageAttachmentVO);
         }
-        return storageAttachmentDTOS;
+        return storageAttachmentVOS;
     }
 
     /**
diff --git a/src/main/java/com/ruoyi/common/config/MinioConfig.java b/src/main/java/com/ruoyi/common/config/MinioConfig.java
deleted file mode 100644
index 28f489f..0000000
--- a/src/main/java/com/ruoyi/common/config/MinioConfig.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.ruoyi.common.config;
-
-import io.minio.MinioClient;
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.stereotype.Component;
-
-@Configuration
-@Component
-@ConfigurationProperties(prefix = "minio")
-@Data
-public class MinioConfig {
-    private String endpoint;
-    private int port;
-    private String accessKey;
-    private String secretKey;
-    private Boolean secure;
-
-    @Bean
-    public MinioClient getMinioClient() {
-        return MinioClient.builder().endpoint(endpoint, port, secure)
-                .credentials(accessKey, secretKey)
-                .build();
-    }
-}
diff --git a/src/main/java/com/ruoyi/common/utils/MinioUtils.java b/src/main/java/com/ruoyi/common/utils/MinioUtils.java
deleted file mode 100644
index 19f0dcd..0000000
--- a/src/main/java/com/ruoyi/common/utils/MinioUtils.java
+++ /dev/null
@@ -1,433 +0,0 @@
-package com.ruoyi.common.utils;
-
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.ruoyi.common.exception.UtilException;
-import com.ruoyi.common.exception.file.InvalidExtensionException;
-import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.common.utils.file.MimeTypeUtils;
-import com.ruoyi.framework.web.domain.MinioResult;
-import io.minio.*;
-import io.minio.http.Method;
-import io.minio.messages.DeleteError;
-import io.minio.messages.DeleteObject;
-import jakarta.servlet.ServletOutputStream;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.springframework.util.FastByteArrayOutputStream;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.InputStream;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-@Component
-@RequiredArgsConstructor
-public class MinioUtils {
-
-    private final MinioClient minioClient;
-
-    @Value("${minio.preview-expiry}")
-    private Integer previewExpiry;
-
-    /**
-     * -- GETTER --
-     *  鑾峰彇榛樿瀛樺偍妗跺悕绉�
-     *
-     * @return
-     */
-    @Getter
-    @Value("${minio.default-bucket}")
-    private String defaultBucket;
-
-    /**
-     * 鍒ゆ柇瀛樺偍妗舵槸鍚﹀瓨鍦紝涓嶅瓨鍦ㄥ垯鍒涘缓
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     */
-    public void existBucket(String bucketName) {
-        try {
-            boolean exists = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build());
-            if (!exists) {
-                minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 鍒涘缓瀛樺偍妗�
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @return 鏄惁鍒涘缓鎴愬姛
-     */
-    public Boolean makeBucket(String bucketName) {
-        try {
-            minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 鍒犻櫎瀛樺偍妗�
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @return 鏄惁鍒犻櫎鎴愬姛
-     */
-    public Boolean removeBucket(String bucketName) {
-        try {
-            minioClient.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build());
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 鍒ゆ柇瀵硅薄鏄惁瀛樺湪
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param originalFileName MinIO涓瓨鍌ㄥ璞″叏璺緞
-     * @return 瀵硅薄鏄惁瀛樺湪
-     */
-    public boolean existObject(String bucketName, String originalFileName) {
-        try {
-            minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(originalFileName).build());
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * 鏂囦欢涓婁紶
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param file       鏂囦欢
-     * @return 妗朵腑浣嶇疆
-     */
-    public MinioResult upload(String bucketName, MultipartFile file, Boolean isPreviewExpiry) throws InvalidExtensionException {
-        MultipartFile[] fileArr = {file};
-        List<MinioResult> fileNames = upload(bucketName, fileArr, isPreviewExpiry);
-        return fileNames.isEmpty() ? null : fileNames.get(0);
-    }
-
-    /**
-     * 涓婁紶鏂囦欢
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param fileList   鏂囦欢鍒楄〃
-     * @return 妗朵腑浣嶇疆鍒楄〃
-     */
-    public List<MinioResult> upload(String bucketName, List<MultipartFile> fileList, Boolean isPreviewExpiry) throws InvalidExtensionException {
-        MultipartFile[] fileArr = fileList.toArray(new MultipartFile[0]);
-        return upload(bucketName, fileArr, isPreviewExpiry);
-    }
-
-    /**
-     * description: 涓婁紶鏂囦欢
-     *
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param fileArr    鏂囦欢鍒楄〃
-     * @return 妗朵腑浣嶇疆鍒楄〃
-     */
-    public List<MinioResult> upload(String bucketName, MultipartFile[] fileArr, Boolean isPreviewExpiry) throws InvalidExtensionException {
-        for (MultipartFile file : fileArr) {
-            FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
-        }
-        // 淇濊瘉妗朵竴瀹氬瓨鍦�
-        existBucket(bucketName);
-        // 鎵ц姝e父鎿嶄綔
-        List<MinioResult> bucketFileNames = new ArrayList<>(fileArr.length);
-        for (MultipartFile file : fileArr) {
-            // 鑾峰彇鍘熷鏂囦欢鍚嶇О
-            String originalFileName = file.getOriginalFilename();
-            // 鑾峰彇褰撳墠鏃ユ湡锛屾牸寮忎緥濡傦細2020-11
-            String datePath = new SimpleDateFormat("yyyy-MM").format(new Date());
-            // 鏂囦欢鍚嶇О
-            String uuid = IdWorker.get32UUID();
-            // 鑾峰彇鏂囦欢鍚庣紑
-            String suffix = originalFileName.substring(originalFileName.lastIndexOf("."));
-            String bucketFilePath = datePath + "/" + uuid + suffix;
-
-            // 鎺ㄩ�佹枃浠跺埌MinIO
-            try (InputStream in = file.getInputStream()) {
-                minioClient.putObject(PutObjectArgs.builder()
-                        .bucket(bucketName)
-                        .object(bucketFilePath)
-                        .stream(in, in.available(), -1)
-                        .contentType(file.getContentType())
-                        .build()
-                );
-            } catch (Exception e) {
-                throw new UtilException("MinioUtils锛氫笂浼犳枃浠跺伐鍏风被寮傚父:" + e);
-            }
-            MinioResult minioResult = new MinioResult();
-            minioResult.setBucketFileName(bucketFilePath);
-            // 杩斿洖姘镐箙棰勮鍦板潃
-            if (isPreviewExpiry) {
-                String previewUrl = getPreviewUrl(bucketFilePath, bucketName, isPreviewExpiry);
-                minioResult.setPreviewExpiry(previewUrl);
-            }
-            minioResult.setOriginalName(originalFileName);
-            bucketFileNames.add(minioResult);
-        }
-        return bucketFileNames;
-    }
-
-    /**
-     * 鏂囦欢涓嬭浇
-     *
-     * @param bucketName       瀛樺偍妗跺悕绉�
-     * @param bucketFileName   妗朵腑鏂囦欢鍚嶇О
-     * @param originalFileName 鍘熷鏂囦欢鍚嶇О
-     * @param response         response瀵硅薄
-     */
-    public void download(String bucketName, String bucketFileName, String originalFileName, HttpServletResponse response) {
-        GetObjectArgs objectArgs = GetObjectArgs.builder().bucket(bucketName).object(bucketFileName).build();
-        try (GetObjectResponse objResponse = minioClient.getObject(objectArgs)) {
-            byte[] buf = new byte[1024];
-            int len;
-            try (FastByteArrayOutputStream os = new FastByteArrayOutputStream()) {
-                while ((len = objResponse.read(buf)) != -1) {
-                    os.write(buf, 0, len);
-                }
-                os.flush();
-                byte[] bytes = os.toByteArray();
-                response.setCharacterEncoding("utf-8");
-                //璁剧疆寮哄埗涓嬭浇涓嶆墦寮�
-                response.setContentType("application/force-download");
-                // 璁剧疆闄勪欢鍚嶇О缂栫爜
-                originalFileName = new String(originalFileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
-                // 璁剧疆闄勪欢鍚嶇О
-                response.addHeader("Content-Disposition", "attachment;fileName=" + originalFileName);
-                // 鍐欏叆鏂囦欢
-                try (ServletOutputStream stream = response.getOutputStream()) {
-                    stream.write(bytes);
-                    stream.flush();
-                }
-            }
-        } catch (Exception e) {
-            throw new UtilException("MinioUtils锛氫笂浼犳枃浠跺伐鍏风被寮傚父");
-        }
-    }
-
-    /**
-     * 鑾峰彇宸蹭笂浼犲璞$殑鏂囦欢娴侊紙鍚庣鍥犱负涓氬姟闇�瑕佽幏鍙栨枃浠舵祦鍙互璋冪敤璇ユ柟娉曪級
-     *
-     * @param bucketName     瀛樺偍妗跺悕绉�
-     * @param bucketFileName 妗朵腑鏂囦欢鍚嶇О
-     * @return 鏂囦欢娴�
-     */
-    public InputStream getFileStream(String bucketName, String bucketFileName) throws Exception {
-        GetObjectArgs objectArgs = GetObjectArgs.builder().bucket(bucketName).object(bucketFileName).build();
-        return minioClient.getObject(objectArgs);
-    }
-
-    /**
-     * 鎵归噺鍒犻櫎鏂囦欢瀵硅薄缁撴灉
-     *
-     * @param bucketName      瀛樺偍妗跺悕绉�
-     * @param bucketFileName 妗朵腑鏂囦欢鍚嶇О
-     * @return 鍒犻櫎缁撴灉
-     */
-    public DeleteError removeObjectsResult(String bucketName, String bucketFileName) {
-        List<DeleteError> results = removeObjectsResult(bucketName, Collections.singletonList(bucketFileName));
-        return !results.isEmpty() ? results.get(0) : null;
-    }
-
-    /**
-     * 鎵归噺鍒犻櫎鏂囦欢瀵硅薄缁撴灉
-     *
-     * @param bucketName      瀛樺偍妗跺悕绉�
-     * @param bucketFileNames 妗朵腑鏂囦欢鍚嶇О闆嗗悎
-     * @return 鍒犻櫎缁撴灉
-     */
-    public List<DeleteError> removeObjectsResult(String bucketName, List<String> bucketFileNames) {
-        Iterable<Result<DeleteError>> results = removeObjects(bucketName, bucketFileNames);
-        List<DeleteError> res = new ArrayList<>();
-        for (Result<DeleteError> result : results) {
-            try {
-                res.add(result.get());
-            } catch (Exception e) {
-                throw new UtilException("MinioUtils锛氫笂浼犳枃浠跺伐鍏风被寮傚父");
-            }
-        }
-        return res;
-    }
-
-    /**
-     * 鎵归噺鍒犻櫎鏂囦欢瀵硅薄
-     *
-     * @param bucketName      瀛樺偍妗跺悕绉�
-     * @param bucketFileNames 妗朵腑鏂囦欢鍚嶇О闆嗗悎
-     */
-    private Iterable<Result<DeleteError>> removeObjects(String bucketName, List<String> bucketFileNames) {
-        List<DeleteObject> dos = bucketFileNames.stream().map(DeleteObject::new).collect(Collectors.toList());
-        return minioClient.removeObjects(RemoveObjectsArgs.builder().bucket(bucketName).objects(dos).build());
-    }
-
-    /**
-     * 鏌ヨ棰勮url
-     * @param bucketFileName minio鏂囦欢鍚嶇О
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param isPreviewExpiry 鏄惁闇�瑕佽繃鏈熸椂闂� 榛樿24灏忔椂
-     * @return
-     */
-    public String getPreviewUrl(String bucketFileName, String bucketName, Boolean isPreviewExpiry) {
-        if (StringUtils.isNotBlank(bucketFileName)) {
-            try {
-                minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(bucketFileName).build());
-                // 涓篺alse鍙敓鎴�24灏忔椂鏈夋晥鏃堕暱鐨剈rl閾炬帴锛屽彲浠ヨ闂鏂囦欢
-                if (isPreviewExpiry){
-                    return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().method(Method.GET).bucket(bucketName).object(bucketFileName).build());
-                }else {
-                    return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().method(Method.GET).bucket(bucketName).object(bucketFileName).expiry(previewExpiry, TimeUnit.HOURS).build());
-                }
-            } catch (Exception e) {
-                throw new UtilException("MinioUtils锛氫笂浼犳枃浠跺伐鍏风被寮傚父");
-            }
-        }
-        return null;
-    }
-
-    /**
-     * 鐢熸垚棰勮URL
-     * @param bucketFilename 鏂囦欢鍦∕inIO涓殑鍞竴鏍囪瘑
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param useDefaultExpiry 鏄惁浣跨敤榛樿杩囨湡鏃堕棿锛坱rue=浣跨敤榛樿杩囨湡鏃堕棿锛宖alse=姘镐箙鏈夋晥锛�
-     * @return 棰勮URL
-     */
-    public String getPreviewUrls(String bucketFilename, String bucketName, boolean useDefaultExpiry) {
-        if (StringUtils.isBlank(bucketFilename)) {
-            return null;
-        }
-
-        try {
-            // 楠岃瘉鏂囦欢瀛樺湪鎬�
-            minioClient.statObject(StatObjectArgs.builder()
-                    .bucket(bucketName)
-                    .object(bucketFilename)
-                    .build());
-
-            GetPresignedObjectUrlArgs.Builder builder = GetPresignedObjectUrlArgs.builder()
-                    .method(Method.GET)
-                    .bucket(bucketName)
-                    .object(bucketFilename);
-
-            // 璁剧疆杩囨湡鏃堕棿锛歶seDefaultExpiry=true 浣跨敤閰嶇疆鐨勮繃鏈熸椂闂�
-            if (useDefaultExpiry) {
-                builder.expiry(previewExpiry, TimeUnit.HOURS);
-            }
-
-            return minioClient.getPresignedObjectUrl(builder.build());
-        } catch (Exception e) {
-            throw new UtilException("鐢熸垚棰勮URL澶辫触: " + e.getMessage(), e);
-        }
-    }
-
-
-    /**
-     * 鐢熸垚涓嬭浇URL锛堝己鍒舵祻瑙堝櫒涓嬭浇锛�
-     * @param bucketFilename 鏂囦欢鍦∕inIO涓殑鍞竴鏍囪瘑
-     * @param bucketName 瀛樺偍妗跺悕绉�
-     * @param originalFileName 鍘熷鏂囦欢鍚嶏紙鐢ㄤ簬涓嬭浇鏃舵樉绀猴級
-     * @param useDefaultExpiry 鏄惁浣跨敤榛樿杩囨湡鏃堕棿锛坱rue=浣跨敤榛樿锛宖alse=鏃犺繃鏈熸椂闂达級
-     * @return 涓嬭浇URL
-     */
-    public String getDownloadUrls(String bucketFilename, String bucketName, String originalFileName, boolean useDefaultExpiry) {
-        if (StringUtils.isBlank(bucketFilename)) {
-            return null;
-        }
-
-        try {
-            // 楠岃瘉鏂囦欢瀛樺湪鎬�
-            minioClient.statObject(StatObjectArgs.builder()
-                    .bucket(bucketName)
-                    .object(bucketFilename)
-                    .build());
-
-            // 姝g‘缂栫爜鏂囦欢鍚嶏細鏇挎崲 + 涓� %20
-            String encodedFileName = URLEncoder.encode(originalFileName, String.valueOf(StandardCharsets.UTF_8))
-                    .replace("+", "%20");
-
-            Map<String, String> reqParams = new HashMap<>();
-            reqParams.put("response-content-disposition",
-                    "attachment; filename=\"" + encodedFileName + "\"");
-
-            GetPresignedObjectUrlArgs.Builder builder = GetPresignedObjectUrlArgs.builder()
-                    .method(Method.GET)
-                    .bucket(bucketName)
-                    .object(bucketFilename)
-                    .extraQueryParams(reqParams);
-
-            // 鏍规嵁鍙傛暟鍐冲畾鏄惁璁剧疆杩囨湡鏃堕棿
-            if (useDefaultExpiry) {
-                // 浣跨敤榛樿杩囨湡鏃堕棿锛堜粠閰嶇疆璇诲彇锛�
-                builder.expiry(previewExpiry, TimeUnit.HOURS);
-            } else {
-                // 涓嶈缃繃鏈熸椂闂达紙MinIO 榛樿7澶╋級
-            }
-            return minioClient.getPresignedObjectUrl(builder.build());
-        } catch (Exception e) {
-            throw new UtilException("鐢熸垚涓嬭浇URL澶辫触: " + e.getMessage(), e);
-        }
-    }
-
-    public String getDownloadUrl(String bucketFileName, String bucketName) {
-        if (StringUtils.isNotBlank(bucketFileName)) {
-            try {
-                // 妫�鏌ユ枃浠舵槸鍚﹀瓨鍦�
-                minioClient.statObject(StatObjectArgs.builder()
-                        .bucket(bucketName)
-                        .object(bucketFileName)
-                        .build());
-
-                // 璁剧疆鍝嶅簲澶�
-                Map<String, String> reqParams = new HashMap<>();
-                // 鎻愬彇鍘熷鏂囦欢鍚嶏紙濡傛灉瀛樺偍鏃朵繚鐣欎簡鍘熷鍚嶇О锛�
-                String originalFileName = extractOriginalFileName(bucketFileName);
-                reqParams.put("response-content-disposition",
-                        "attachment; filename=\"" + URLEncoder.encode(originalFileName, String.valueOf(StandardCharsets.UTF_8)) + "\"");
-
-                // 鏋勫缓棰勭鍚峌RL鍙傛暟
-                GetPresignedObjectUrlArgs args = GetPresignedObjectUrlArgs.builder()
-                        .method(Method.GET)
-                        .bucket(bucketName)
-                        .object(bucketFileName)
-                        .expiry(previewExpiry, TimeUnit.HOURS)
-                        .extraQueryParams(reqParams)
-                        .build();
-
-                return minioClient.getPresignedObjectUrl(args);
-            } catch (Exception e) {
-                throw new UtilException("MinioUtils锛氱敓鎴愪笅杞介摼鎺ュ紓甯�", e);
-            }
-        }
-        return null;
-    }
-
-    private String extractOriginalFileName(String bucketFileName) {
-        // 绀轰緥锛氬鏋滃瓨鍌ㄦ牸寮忎负 "鍘熷鏂囦欢鍚峗UUID"
-        int underscoreIndex = bucketFileName.lastIndexOf("_");
-        if (underscoreIndex > 0) {
-            return bucketFileName.substring(0, underscoreIndex);
-        }
-        // 濡傛灉娌℃湁鐗规畩鏍煎紡锛岀洿鎺ヨ繑鍥炲畬鏁存枃浠跺悕
-        return bucketFileName;
-    }
-
-}
diff --git a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
index d8c4ba7..4cc8230 100644
--- a/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/inspectiontask/service/impl/InspectionTaskServiceImpl.java
@@ -5,13 +5,10 @@
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.StorageBlobVO;
 import com.ruoyi.basic.mapper.StorageAttachmentMapper;
 import com.ruoyi.basic.mapper.StorageBlobMapper;
-import com.ruoyi.basic.pojo.StorageBlob;
 import com.ruoyi.basic.service.StorageAttachmentService;
 import com.ruoyi.common.enums.FileNameType;
-import com.ruoyi.common.utils.MinioUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
@@ -53,8 +50,6 @@
     private final StorageBlobMapper storageBlobMapper;
 
     private final StorageAttachmentMapper storageAttachmentMapper;
-
-    private final MinioUtils minioUtils;
 
     private final SysUserMapper sysUserMapper;
 
@@ -165,29 +160,6 @@
         BeanUtils.copyProperties(entityPage, resultPage);
         resultPage.setRecords(dtoList);
         return resultPage;
-    }
-
-    // 鎻愬彇鍒涘缓BlobDTO鐨勫叕鍏辨柟娉�
-    private StorageBlobVO createBlobDto(StorageBlob blob) {
-        StorageBlobVO dto = new StorageBlobVO();
-        BeanUtils.copyProperties(blob, dto);
-
-        // todo fileChange
-//        // 璁剧疆URL
-//        dto.setUrl(minioUtils.getPreviewUrls(
-//                blob.getBucketFilename(),
-//                blob.getBucketName(),
-//                true
-//        ));
-//
-//        // 璁剧疆涓嬭浇URL
-//        dto.setDownloadUrl(minioUtils.getDownloadUrls(
-//                blob.getBucketFilename(),
-//                blob.getBucketName(),
-//                blob.getOriginalFilename(),
-//                true
-//        ));
-        return dto;
     }
 
     @Override
diff --git a/src/main/java/com/ruoyi/project/common/CommonController.java b/src/main/java/com/ruoyi/project/common/CommonController.java
index d3069a5..e327a95 100644
--- a/src/main/java/com/ruoyi/project/common/CommonController.java
+++ b/src/main/java/com/ruoyi/project/common/CommonController.java
@@ -77,16 +77,6 @@
 //    }
 //
 //    /**
-//     * minio閫氱敤涓婁紶璇锋眰锛堝涓級
-//     */
-//    @PostMapping("/minioUploads")
-//    @Operation(summary = "minio閫氱敤涓婁紶璇锋眰")
-//    public AjaxResult minioUploadFiles(List<MultipartFile> files, String bucketName, Long type) throws Exception
-//    {
-//        return AjaxResult.success();
-//    }
-//
-//    /**
 //     * 閫氱敤涓婁紶璇锋眰锛堝崟涓級
 //     */
 //    @PostMapping("/upload")
diff --git a/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java b/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
index 675bba1..7ada625 100644
--- a/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
@@ -1,10 +1,9 @@
 package com.ruoyi.sales.dto;
 
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.basic.dto.StorageBlobDTO;
 import com.ruoyi.sales.pojo.CommonFile;
 import com.ruoyi.sales.pojo.ShippingInfo;
-import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
 import java.util.List;
@@ -33,4 +32,6 @@
 
     private String productName;
 
+    private List<StorageBlobDTO> storageBlobDTOs;
+
 }
diff --git a/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java b/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
index 2aa1a13..a701bf2 100644
--- a/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
+++ b/src/main/java/com/ruoyi/sales/service/ShippingInfoService.java
@@ -3,13 +3,10 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto;
 import com.ruoyi.sales.dto.SalesLedgerProductDto;
 import com.ruoyi.sales.dto.ShippingInfoDto;
 import com.ruoyi.sales.pojo.ShippingInfo;
-import org.apache.ibatis.annotations.Param;
 
-import java.io.IOException;
 import java.util.List;
 
 /**
@@ -19,7 +16,7 @@
 public interface ShippingInfoService extends IService<ShippingInfo>{
     IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req);
 
-    boolean deductStock(ShippingInfoDto req) throws IOException;
+    boolean deductStock(ShippingInfoDto req);
 
     boolean delete(List<Long> ids);
 
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
index f524ffe..3d105fd 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -6,6 +6,9 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.approve.pojo.ApproveProcess;
 import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
+import com.ruoyi.basic.enums.ApplicationTypeEnum;
+import com.ruoyi.basic.enums.RecordTypeEnum;
+import com.ruoyi.basic.utils.FileUtil;
 import com.ruoyi.common.enums.FileNameType;
 import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.other.service.impl.TempFileServiceImpl;
@@ -22,7 +25,6 @@
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 
-import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 
@@ -41,6 +43,7 @@
     private final StockUtils stockUtils;
     private final CommonFileServiceImpl commonFileService;
     private final ApproveProcessServiceImpl approveProcessService;
+    private final FileUtil fileUtil;
 
     @Override
     public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) {
@@ -52,7 +55,7 @@
     }
 
     @Override
-    public boolean deductStock(ShippingInfoDto req) throws IOException {
+    public boolean deductStock(ShippingInfoDto req) {
         ShippingInfo byId = this.getById(req.getId());
         if (byId == null) {
             throw new RuntimeException("鍙戣揣淇℃伅涓嶅瓨鍦�");
@@ -68,10 +71,8 @@
         byId.setShippingCarNumber(req.getShippingCarNumber());
         byId.setShippingDate(req.getShippingDate());
         boolean update = this.updateById(byId);
-        // 杩佺Щ鏂囦欢
-        if(CollectionUtils.isNotEmpty(req.getTempFileIds())){
-            tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue());
-        }
+        // 淇濆瓨鏂囦欢
+        fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.ShippingInfo, req.getId(), req.getStorageBlobDTOs());
         return update ;
     }
 

--
Gitblit v1.9.3