|
@ -59,9 +59,27 @@ public class FileUploadController extends EnvelopRestEndpoint {
|
|
|
public ObjEnvelop<UploadVO> uploadImg(@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.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
|
|
|
// String originalFilename = file.getOriginalFilename();
|
|
|
// InputStream inputStream = file.getInputStream();
|
|
|
// UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
|
|
|
// return success("上传成功", uploadVO);
|
|
|
UploadVO uploadVO = new UploadVO();
|
|
|
if (isClose.equalsIgnoreCase("1")){
|
|
|
Map<String, Object> map = fileUploadService.uploadImg(file);
|
|
|
uploadVO.setFullUri(map.get("accessory").toString());
|
|
|
}else if(isClose.equals("2")){
|
|
|
//内网上传
|
|
|
String rs = fileUploadService.request(remote_inner_url,file,null);
|
|
|
logger.info(rs);
|
|
|
JSONObject json = JSON.parseObject(rs);
|
|
|
uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
|
|
|
|
|
|
}else {
|
|
|
// 得到文件的完整名称 xxx.txt
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
InputStream inputStream = file.getInputStream();
|
|
|
uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
|
|
|
}
|
|
|
return success("上传成功", uploadVO);
|
|
|
}
|
|
|
|
|
@ -70,10 +88,30 @@ public class FileUploadController extends EnvelopRestEndpoint {
|
|
|
@ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
|
|
|
public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
|
|
|
@RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
InputStream inputStream = file.getInputStream();
|
|
|
UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
|
|
|
// String originalFilename = file.getOriginalFilename();
|
|
|
// InputStream inputStream = file.getInputStream();
|
|
|
//
|
|
|
// UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
|
|
|
// return success("上传成功", uploadVO);
|
|
|
UploadVO uploadVO = new UploadVO();
|
|
|
if (isClose.equalsIgnoreCase("1")){
|
|
|
Map<String, Object> map = fileUploadService.uploadImg(file);
|
|
|
uploadVO.setFullUri(map.get("accessory").toString());
|
|
|
}else if(isClose.equals("2")){
|
|
|
//内网上传
|
|
|
String rs = fileUploadService.request(remote_inner_url,file,null);
|
|
|
logger.info(rs);
|
|
|
JSONObject json = JSON.parseObject(rs);
|
|
|
uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
|
|
|
|
|
|
}else {
|
|
|
// 得到文件的完整名称 xxx.txt
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
InputStream inputStream = file.getInputStream();
|
|
|
uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
|
|
|
}
|
|
|
return success("上传成功", uploadVO);
|
|
|
// return uploadStream(file);
|
|
|
}
|
|
|
|
|
|
// @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
|