田源
2023-09-11 49a1394faab127c1b76ddcff004620696f8513ff
Source/UBCS/ubcs-ops/ubcs-resource/src/main/java/com/vci/ubcs/resource/endpoint/OssEndpoint.java
@@ -28,12 +28,17 @@
import org.springblade.core.tool.utils.Func;
import com.vci.ubcs.resource.builder.oss.OssBuilder;
import com.vci.ubcs.resource.service.IAttachService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
 * 对象存储端点
 *
 * 这个类不使用,统一用fileController
 *
 * @author Chill
 */
@NonDS
@@ -41,6 +46,7 @@
@AllArgsConstructor
@RequestMapping("/oss/endpoint")
@Api(value = "对象存储端点", tags = "对象存储端点")
@Deprecated
public class OssEndpoint {
   /**
@@ -53,6 +59,7 @@
    */
   private final IAttachService attachService;
   /**
    * 创建存储桶
    *
@@ -68,7 +75,7 @@
   }
   /**
    * 创建存储桶
    * 删除存储桶
    *
    * @param bucketName 存储桶名称
    * @return R
@@ -108,6 +115,7 @@
      return R.data(ossBuilder.template().statFile(fileName));
   }
   /**
    * 获取文件相对路径
    *
@@ -160,37 +168,37 @@
      return R.data(bladeFile);
   }
   /**
    * 上传文件并保存至附件表
    *
    * @param file 文件
    * @return ObjectStat
    */
   @SneakyThrows
   @PostMapping("/put-file-attach")
   public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
      String fileName = file.getOriginalFilename();
      BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
      Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
      bladeFile.setAttachId(attachId);
      return R.data(bladeFile);
   }
// /**
//  * 上传文件并保存至附件表
//  *
//  * @param file 文件
//  * @return ObjectStat
//  */
// @SneakyThrows
// @PostMapping("/put-file-attach")
// public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
//    String fileName = file.getOriginalFilename();
//    BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
//    Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
//    bladeFile.setAttachId(attachId);
//    return R.data(bladeFile);
// }
   /**
    * 上传文件并保存至附件表
    *
    * @param fileName 存储桶对象名称
    * @param file     文件
    * @return ObjectStat
    */
   @SneakyThrows
   @PostMapping("/put-file-attach-by-name")
   public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
      BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
      Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
      bladeFile.setAttachId(attachId);
      return R.data(bladeFile);
   }
// /**
//  * 上传文件并保存至附件表
//  *
//  * @param fileName 存储桶对象名称
//  * @param file     文件
//  * @return ObjectStat
//  */
// @SneakyThrows
// @PostMapping("/put-file-attach-by-name")
// public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
//    BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
//    Long attachId = buildAttach(fileName, file.getSize(), bladeFile);
//    bladeFile.setAttachId(attachId);
//    return R.data(bladeFile);
// }
   /**
    * 构建附件表