Browse Source

ossController

dev_shibei_match
jianjun 4 years ago
parent
commit
d2f9bdd5cc
  1. 6
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java

6
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java

@ -14,6 +14,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AliyunGroup;
@ -62,6 +63,8 @@ public class OssController {
private OssService ossService;
@Autowired
private ParamsRemoteService paramsRemoteService;
@Autowired
private RedisUtils redisUtils;
private final static String KEY = ModuleConstant.CLOUD_STORAGE_CONFIG_KEY;
@ -226,13 +229,14 @@ public class OssController {
, EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg());
}
if (ModuleConstant.FILE_CONTENT_TYPE_PDF.equals(file.getContentType())) {
// 校验文件体积,不超过2m
// 校验文件体积,不超过5m
long maxSize = 5 * 1024 * 1024;
long size = file.getSize();
if (size > maxSize) {
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode()
, EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg());
}
//todo 获取url 缓存半小时 删除时获取并调用删除方法
} else {
// 校验文件体积,不超过2m
long maxSize = 2 * 1024 * 1024;

Loading…
Cancel
Save