Spring通过FeignClient调用文件上传服务上传本地磁盘文件代码如下:
//2. 图片解码并保存
String filename = UUID.randomUUID() + ".jpg";//文件名+后缀名
String originalFilename = uploadPath + tbYingqushebei.getCampId() + File.separator + filename;
log.info("图片路径:{}", uploadPath + tbYingqushebei.getCampId() + File.separator + filename);
FileUtils.generateImage(zhoujieruqingaojingjiluAO.getGaojingtupian(), originalFilename);
File originalFile = new File(originalFilename);
DiskFileItem fileItem = new DiskFileItem("file", "image/jpeg", false, originalFile.getName(), (int) originalFile.length(), originalFile.getParentFile());
try (InputStream input = new FileInputStream(originalFile); OutputStream os = fileItem.getOutputStream()) {
IOUtils.copy(input, os);
log.info(fileItem.getStoreLocation() + "--getStoreLocation");
} catch (Exception e) {
throw new IllegalArgumentException("Invalid file:" + e, e);
}
MultipartFile multipartFile = new CommonsMultipartFile(fileItem);
// 调用文件上传服务上传告警图片
R<SysFile> file = remoteFileService.upload(multipartFile);
SysFile sysFile = file.getData();
if (ObjectUtils.isNotEmpty(originalFile) && originalFile.exists()) {
originalFile.delete();
}
log.info("周杰告警图片url--{}", sysFile.getUrl());
最新评论
楼主大宝宝听的那个asmr网站发我呗
如果是买的美国地域的,那是不是节点就只有美国的?
已经在内容偏好选择关闭了 还是看不到的 去搜索R18,TIKTOK直接显示社区没这样的内容
看不到R18内容的