mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-05-05 11:31:27 +08:00
add 整合 seata 1.4.2 对接 nacos 注册中心 配置中心
This commit is contained in:
@@ -5,9 +5,8 @@ import com.ruoyi.common.core.utils.file.FileUtils;
|
||||
import com.ruoyi.file.api.domain.SysFile;
|
||||
import com.ruoyi.file.service.ISysFileService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -18,12 +17,12 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags = "文件处理")
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
public class SysFileController {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
||||
|
||||
@Autowired
|
||||
private ISysFileService sysFileService;
|
||||
private final ISysFileService sysFileService;
|
||||
|
||||
/**
|
||||
* 文件上传请求
|
||||
|
||||
@@ -31,6 +31,9 @@ public class RemoteFileServiceImpl implements RemoteFileService {
|
||||
*/
|
||||
@Override
|
||||
public SysFile upload(String name, String originalFilename, String contentType, byte[] file) {
|
||||
// todo 临时用于测试 seata
|
||||
// throw new ServiceException("上传文件失败");
|
||||
|
||||
MultipartFile multipartFile = getMultipartFile(name, originalFilename, contentType, file);
|
||||
try {
|
||||
// 上传并返回访问地址
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.ruoyi.file.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysFileService {
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
package com.ruoyi.file.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysFileService {
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
*/
|
||||
String uploadFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user