xin
2025-09-25 6416e025afd6b3d19347610b3e441ac6a12a0f8f
oying-tools/src/main/java/com/oying/service/impl/BucketStorageServiceImpl.java
@@ -14,6 +14,7 @@
import com.oying.service.BucketStorageService;
import com.oying.domain.dto.BucketStorageQueryCriteria;
import com.oying.mapper.BucketStorageMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -39,6 +40,8 @@
    private final BucketStorageMapper bucketStorageMapper;
    private final ObsProperties properties;
    private final FileProperties fileProperties;
    @Value("${oying.enabled}")
    private Boolean oyingEnabled;
    @Override
    public PageResult<BucketStorage> queryAll(BucketStorageQueryCriteria criteria, Page<Object> page) {
@@ -58,6 +61,9 @@
        String type = FileUtil.getFileType(suffix);
        String reaName = System.currentTimeMillis() + "." + suffix;
        String objectKey = type + "/" + reaName;
        if (oyingEnabled) {
            objectKey = "test/" +objectKey;
        }
        PutObjectResult result = ObsUtils.putObject(properties, file, objectKey, AccessControlList.REST_CANNED_PUBLIC_READ);
        if (ObjectUtil.isNull(result)) {
            throw new BadRequestException("上传失败");
@@ -83,6 +89,9 @@
        String type = FileUtil.getFileType(suffix);
        String reaName = IdUtil.getSnowflake(1, 1).nextId() + "." + suffix;
        String objectKey = type + "/" + reaName;
        if (oyingEnabled) {
            objectKey = "test/" +objectKey;
        }
        PutObjectResult result = ObsUtils.putObject(properties, FileUtil.toFile(file), objectKey, AccessControlList.REST_CANNED_PUBLIC_READ);
        if (ObjectUtil.isNull(result)) {
            throw new BadRequestException("上传失败");
@@ -123,16 +132,14 @@
        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);