|
|
|
@@ -70,7 +70,7 @@ public class UploadController extends BaseController { |
|
|
|
@PostMapping(value = "/awsImgUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") |
|
|
|
@ApiOperation("上传图片") |
|
|
|
@SystemControllerLog(description = "上传图片") |
|
|
|
public ResultData awsImgUpload(@RequestParam("file") MultipartFile multiReq,@RequestBody Map<String,String> paramMap) throws Exception{ |
|
|
|
public ResultData awsImgUpload(@RequestParam("file") MultipartFile multiReq,@RequestParam("w") Integer width,@RequestParam("h") Integer hight,@RequestParam("size") Long maxSize) { |
|
|
|
logger.info("[" + getIpAddr() + "] UploadController::awsImgUpload"); |
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
|
|
@@ -89,18 +89,15 @@ public class UploadController extends BaseController { |
|
|
|
try { |
|
|
|
String imgFormat = ImgUtil.getImgFormat(fileFormat); |
|
|
|
if(StringUtils.isNotBlank(imgFormat)) { |
|
|
|
long maxSize = Long.parseLong(paramMap.get("size")); |
|
|
|
if(maxSize > 0 && size > maxSize*1024){ |
|
|
|
if(maxSize != null && size > maxSize*1024){ |
|
|
|
return new ResultData(ErrorCode.PICTURE_SIZE_CUSTOMIZE); |
|
|
|
} |
|
|
|
int width = Integer.parseInt(paramMap.get("width")); |
|
|
|
int hight = Integer.parseInt(paramMap.get("hight")); |
|
|
|
BufferedImage bufferedImage = ImageIO.read(multiReq.getInputStream()); |
|
|
|
if(bufferedImage != null){ |
|
|
|
Integer relWidth = bufferedImage.getWidth(); |
|
|
|
Integer relHeight = bufferedImage.getHeight(); |
|
|
|
if((width > 0 && width != relWidth.intValue()) |
|
|
|
|| (hight > 0 && hight != relHeight.intValue())){ |
|
|
|
if((width != null && width != relWidth.intValue()) |
|
|
|
|| (hight != null && hight != relHeight.intValue())){ |
|
|
|
return new ResultData(ErrorCode.PICTURE_W_H_CUSTOMIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|