|
@ -27,6 +27,8 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
|
|
|
private String fastdfs_file_url;
|
|
|
@Autowired
|
|
|
FileUploadService fileUploadService;
|
|
|
@Value("${testPattern.sign}")
|
|
|
private String isClose;
|
|
|
|
|
|
@PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
|
|
|
@ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
|
|
@ -54,10 +56,15 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
|
|
|
public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
|
|
|
@RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
|
|
|
// 得到文件的完整名称 xxx.txt
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
InputStream inputStream = file.getInputStream();
|
|
|
UploadVO uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
|
|
|
UploadVO uploadVO = new UploadVO();
|
|
|
if (isClose.equalsIgnoreCase("1")){
|
|
|
fileUploadService.uploadImg(file);
|
|
|
}else {
|
|
|
// 得到文件的完整名称 xxx.txt
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
InputStream inputStream = file.getInputStream();
|
|
|
uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
|
|
|
}
|
|
|
return success("上传成功", uploadVO);
|
|
|
}
|
|
|
|