核心代码
/**
* 上传文件
*/
@PostMapping("/upload")
@ApiOperationSupport(order = 8)
@ApiOperation(value = "上传文件", notes = "上传文件")
public R upload(MultipartFile file) throws IOException {
BladeFile bf = getFile(file);
bf.transfer(false);
// 生成缩略图
BufferedImage src =ImageUtil.readImage(bf.getUploadPath());
FileOutputStream output = new FileOutputStream("d://1.png");
ImageUtil.zoomFixed(src, output, null, 800, 800, true, null);
org.springblade.core.oss.model.BladeFile bladeFile = new org.springblade.core.oss.model.BladeFile();
bladeFile.setOriginalName(bf.getOriginalFileName());
bladeFile.setName(bf.getFileName());
bladeFile.setLink(SystemConstant.me().getDomain() + bf.getUploadVirtualPath());
return R.data(bladeFile);
}