From c1d20b425b10e8ba59f102dd1ab413055883eed0 Mon Sep 17 00:00:00 2001
From: 彭雪彬 <1724387007@qq.com>
Date: Mon, 14 Jul 2025 16:57:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/xin' into pxb

---
 oying-tools/src/main/java/com/oying/service/impl/BucketStorageServiceImpl.java |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/oying-tools/src/main/java/com/oying/service/impl/BucketStorageServiceImpl.java b/oying-tools/src/main/java/com/oying/service/impl/BucketStorageServiceImpl.java
index 8e652c7..fca0ba4 100644
--- a/oying-tools/src/main/java/com/oying/service/impl/BucketStorageServiceImpl.java
+++ b/oying-tools/src/main/java/com/oying/service/impl/BucketStorageServiceImpl.java
@@ -1,5 +1,6 @@
 package com.oying.service.impl;
 
+import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.obs.services.model.AccessControlList;
 import com.obs.services.model.PutObjectResult;
@@ -80,7 +81,7 @@
         FileUtil.checkSize(fileProperties.getMaxSize(), file.getSize());
         String suffix = FileUtil.getExtensionName(file.getOriginalFilename());
         String type = FileUtil.getFileType(suffix);
-        String reaName = System.currentTimeMillis() + "." + suffix;
+        String reaName = IdUtil.getSnowflake(1, 1).nextId() + "." + suffix;
         String objectKey = type + "/" + reaName;
         PutObjectResult result = ObsUtils.putObject(properties, FileUtil.toFile(file), objectKey, AccessControlList.REST_CANNED_PUBLIC_READ);
         if (ObjectUtil.isNull(result)) {
@@ -102,7 +103,7 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void deleteAll(List<Long> ids) {
-        for(Long id : ids) {
+        for (Long id : ids) {
             BucketStorage storage = bucketStorageMapper.selectById(id);
             ObsUtils.deleteObject(properties, storage.getPath());
         }
@@ -110,20 +111,26 @@
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteById(String path) {
+        BucketStorage storage = bucketStorageMapper.findByPath(path);
+        ObsUtils.deleteObject(properties, storage.getPath());
+        bucketStorageMapper.deleteById(storage.getBucketId());
+    }
+
+    @Override
     public void download(List<BucketStorage> all, HttpServletResponse response) throws IOException {
         List<Map<String, Object>> list = new ArrayList<>();
         for (BucketStorage bucketStorage : all) {
             Map<String, Object> map = new LinkedHashMap<>();
-            map.put("文件真实的名称", bucketStorage.getRealName());
-            map.put("文件名", bucketStorage.getName());
-            map.put("后缀", bucketStorage.getSuffix());
-            map.put("路径", bucketStorage.getPath());
-            map.put("类型", bucketStorage.getType());
-            map.put("大小", bucketStorage.getSize());
+            map.put("文件名称", bucketStorage.getRealName());
+            map.put("备注名称", bucketStorage.getName());
+            map.put("文件类型", bucketStorage.getSuffix());
+            map.put("文件路径", bucketStorage.getPath());
+            map.put("文件分类", bucketStorage.getType());
+            map.put("文件大小", bucketStorage.getSize());
             map.put("创建人", bucketStorage.getCreateBy());
             map.put("创建时间", bucketStorage.getCreateTime());
-            map.put("修改者", bucketStorage.getUpdateBy());
-            map.put("修改时间", bucketStorage.getUpdateTime());
             list.add(map);
         }
         FileUtil.downloadExcel(list, response);

--
Gitblit v1.9.3