|
|
@ -10,6 +10,8 @@ import java.util.Objects;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
@ -30,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class FileUploadUtils
|
|
|
|
public class FileUploadUtils
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(FileUploadUtils.class);
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 默认大小 50M
|
|
|
|
* 默认大小 50M
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -256,6 +259,7 @@ public class FileUploadUtils
|
|
|
|
b[i] += 256;
|
|
|
|
b[i] += 256;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info("file path :{}{}", uploadFilePath, imgClassPath);
|
|
|
|
// 保存图片
|
|
|
|
// 保存图片
|
|
|
|
OutputStream out = new FileOutputStream(uploadFilePath.concat(imgClassPath));
|
|
|
|
OutputStream out = new FileOutputStream(uploadFilePath.concat(imgClassPath));
|
|
|
|
out.write(b);
|
|
|
|
out.write(b);
|
|
|
@ -264,6 +268,7 @@ public class FileUploadUtils
|
|
|
|
// 返回图片的相对路径 = 图片分类路径+图片名+图片后缀
|
|
|
|
// 返回图片的相对路径 = 图片分类路径+图片名+图片后缀
|
|
|
|
return imgClassPath;
|
|
|
|
return imgClassPath;
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
logger.error("generateImage error", e);
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|