From b5336d957680a1deb65d0565eed9c9eca630a738 Mon Sep 17 00:00:00 2001 From: weidy <lastanimals@163.com> Date: 星期二, 13 六月 2023 20:43:36 +0800 Subject: [PATCH] 文件服务的初步代码 --- Source/UBCS/ubcs-ops/ubcs-resource/src/main/java/com/vci/ubcs/resource/endpoint/OssEndpoint.java | 74 +++++++++++++++++++++--------------- 1 files changed, 43 insertions(+), 31 deletions(-) diff --git a/Source/UBCS/ubcs-ops/ubcs-resource/src/main/java/com/vci/ubcs/resource/endpoint/OssEndpoint.java b/Source/UBCS/ubcs-ops/ubcs-resource/src/main/java/com/vci/ubcs/resource/endpoint/OssEndpoint.java index 9252704..dacf234 100644 --- a/Source/UBCS/ubcs-ops/ubcs-resource/src/main/java/com/vci/ubcs/resource/endpoint/OssEndpoint.java +++ b/Source/UBCS/ubcs-ops/ubcs-resource/src/main/java/com/vci/ubcs/resource/endpoint/OssEndpoint.java @@ -17,6 +17,10 @@ package com.vci.ubcs.resource.endpoint; import com.vci.ubcs.resource.entity.Attach; +import com.vci.ubcs.resource.service.IFileService; +import com.vci.ubcs.resource.utils.FileDownloadUtil; +import com.vci.ubcs.starter.web.util.LangBaseUtil; +import com.vci.ubcs.starter.web.util.VciBaseUtil; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import lombok.SneakyThrows; @@ -28,11 +32,16 @@ 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; + /** * 瀵硅薄瀛樺偍绔偣 + * + * 杩欎釜绫讳笉浣跨敤锛岀粺涓�鐢╢ileController * * @author Chill */ @@ -41,6 +50,7 @@ @AllArgsConstructor @RequestMapping("/oss/endpoint") @Api(value = "瀵硅薄瀛樺偍绔偣", tags = "瀵硅薄瀛樺偍绔偣") +@Deprecated public class OssEndpoint { /** @@ -52,6 +62,7 @@ * 闄勪欢琛ㄦ湇鍔� */ private final IAttachService attachService; + /** * 鍒涘缓瀛樺偍妗� @@ -68,7 +79,7 @@ } /** - * 鍒涘缓瀛樺偍妗� + * 鍒犻櫎瀛樺偍妗� * * @param bucketName 瀛樺偍妗跺悕绉� * @return R @@ -107,6 +118,7 @@ public R<OssFile> statFile(@RequestParam String fileName) { return R.data(ossBuilder.template().statFile(fileName)); } + /** * 鑾峰彇鏂囦欢鐩稿璺緞 @@ -160,37 +172,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); +// } /** * 鏋勫缓闄勪欢琛� -- Gitblit v1.9.3