1. fix
This commit is contained in:
2026-04-07 16:20:43 +08:00
parent 279e04f3e9
commit 85f669aa34

View File

@@ -32,6 +32,7 @@ import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.oss.model.BladeFile; import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.model.OssFile; import org.springblade.core.oss.model.OssFile;
import org.springblade.core.secure.annotation.IsAdmin; import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS; import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.FileUtil; import org.springblade.core.tool.utils.FileUtil;
@@ -102,6 +103,7 @@ public class OssEndpoint {
* @return R * @return R
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@PostMapping("/copy-file") @PostMapping("/copy-file")
public R copyFile(@RequestParam String bucketName, @RequestParam String fileName, @RequestParam String destBucketName, String destFileName) { public R copyFile(@RequestParam String bucketName, @RequestParam String fileName, @RequestParam String destBucketName, String destFileName) {
ossBuilder.template().copyFile(bucketName, fileName, destBucketName, destFileName); ossBuilder.template().copyFile(bucketName, fileName, destBucketName, destFileName);
@@ -115,6 +117,7 @@ public class OssEndpoint {
* @return InputStream * @return InputStream
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@GetMapping("/stat-file") @GetMapping("/stat-file")
public R<OssFile> statFile(@RequestParam String fileName) { public R<OssFile> statFile(@RequestParam String fileName) {
return R.data(ossBuilder.template().statFile(fileName)); return R.data(ossBuilder.template().statFile(fileName));
@@ -127,6 +130,7 @@ public class OssEndpoint {
* @return String * @return String
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@GetMapping("/file-path") @GetMapping("/file-path")
public R<String> filePath(@RequestParam String fileName) { public R<String> filePath(@RequestParam String fileName) {
return R.data(ossBuilder.template().filePath(fileName)); return R.data(ossBuilder.template().filePath(fileName));
@@ -140,6 +144,7 @@ public class OssEndpoint {
* @return String * @return String
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@GetMapping("/file-link") @GetMapping("/file-link")
public R<String> fileLink(@RequestParam String fileName) { public R<String> fileLink(@RequestParam String fileName) {
return R.data(ossBuilder.template().fileLink(fileName)); return R.data(ossBuilder.template().fileLink(fileName));
@@ -151,6 +156,7 @@ public class OssEndpoint {
* @param file 文件 * @param file 文件
* @return ObjectStat * @return ObjectStat
*/ */
@PreAuth("hasAnyRole('administrator', 'admin', 'operator', 'APP', 'Market')")
@SneakyThrows @SneakyThrows
@PostMapping("/put-file") @PostMapping("/put-file")
public R<BladeFile> putFile(@RequestParam MultipartFile file) { public R<BladeFile> putFile(@RequestParam MultipartFile file) {
@@ -166,6 +172,7 @@ public class OssEndpoint {
* @return ObjectStat * @return ObjectStat
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@PostMapping("/put-file-by-name") @PostMapping("/put-file-by-name")
public R<BladeFile> putFile(@RequestParam String fileName, @RequestParam MultipartFile file) { public R<BladeFile> putFile(@RequestParam String fileName, @RequestParam MultipartFile file) {
BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
@@ -179,6 +186,7 @@ public class OssEndpoint {
* @return ObjectStat * @return ObjectStat
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@PostMapping("/put-file-attach") @PostMapping("/put-file-attach")
public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) { public R<BladeFile> putFileAttach(@RequestParam MultipartFile file) {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
@@ -196,6 +204,7 @@ public class OssEndpoint {
* @return ObjectStat * @return ObjectStat
*/ */
@SneakyThrows @SneakyThrows
@IsAdmin
@PostMapping("/put-file-attach-by-name") @PostMapping("/put-file-attach-by-name")
public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) { public R<BladeFile> putFileAttach(@RequestParam String fileName, @RequestParam MultipartFile file) {
BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());