|
@@ -103,10 +103,7 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
|
|
|
// 文件名校验长度
|
|
|
String prefix = StringUtils.substringBeforeLast(fileName, ".");
|
|
|
if (prefix.length() > 50) {
|
|
|
-
|
|
|
- // return Result.failure(3003, "文件名称不允许超过50个字节");
|
|
|
prefix = StrUtil.sub(prefix, 0, 50);
|
|
|
-
|
|
|
}
|
|
|
String suffix = StringUtils.substringAfterLast(fileName, ".");
|
|
|
String newName = time + "." + suffix;
|
|
@@ -166,10 +163,13 @@ public class FodderServiceImpl extends IBaseServiceImpl<FodderEntity, Long> impl
|
|
|
ossUrl = configConstant.ossDomain + ossPath;
|
|
|
|
|
|
if (type.equals("image")) {
|
|
|
- // 图片大于1MB生成缩略图, 小于1MB使用原图作为缩略图
|
|
|
-
|
|
|
- iconPath = ossUrl;
|
|
|
-
|
|
|
+ // 2022-10-27,图片大于1MB生成缩略图, 小于1MB使用原图作为缩略图
|
|
|
+ if (size > 1024){
|
|
|
+ iconPath = convertAndUploadOss(
|
|
|
+ savePath, configConstant.ossBasePath + "fodder", configConstant.ossDomain, 300, 150, "/thumb_" + newName);
|
|
|
+ } else {
|
|
|
+ iconPath = ossUrl;
|
|
|
+ }
|
|
|
|
|
|
// todo 这个是很耗新能的,如果新能有问题,改用前端
|
|
|
dpi = ImageUtil.dpi(file);
|