上传文件按日期存储及部分文件路径位置

This commit is contained in:
RuoYi
2019-01-31 11:45:55 +08:00
parent 4829163bab
commit 742846b421
34 changed files with 121 additions and 95 deletions

View File

@ -0,0 +1,19 @@
package com.ruoyi.common.exception.file;
import com.ruoyi.common.exception.base.BaseException;
/**
* 文件信息异常类
*
* @author ruoyi
*/
public class FileException extends BaseException
{
private static final long serialVersionUID = 1L;
public FileException(String code, Object[] args)
{
super("file", code, args, null);
}
}

View File

@ -1,39 +1,16 @@
package com.ruoyi.common.exception.file;
import org.apache.commons.fileupload.FileUploadException;
/**
* 文件名超长异常类
* 文件名超长限制异常类
*
* @author ruoyi
*/
public class FileNameLengthLimitExceededException extends FileUploadException
public class FileNameLengthLimitExceededException extends FileException
{
private static final long serialVersionUID = 1L;
private int length;
private int maxLength;
private String filename;
public FileNameLengthLimitExceededException(String filename, int length, int maxLength)
public FileNameLengthLimitExceededException(int defaultFileNameLength)
{
super("file name : [" + filename + "], length : [" + length + "], max length : [" + maxLength + "]");
this.length = length;
this.maxLength = maxLength;
this.filename = filename;
}
public String getFilename()
{
return filename;
}
public int getLength()
{
return length;
}
public int getMaxLength()
{
return maxLength;
super("upload.filename.exceed.length", new Object[] { defaultFileNameLength });
}
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.common.exception.file;
/**
* 文件名大小限制异常类
*
* @author ruoyi
*/
public class FileSizeLimitExceededException extends FileException
{
private static final long serialVersionUID = 1L;
public FileSizeLimitExceededException(long defaultMaxSize)
{
super("upload.exceed.maxSize", new Object[] { defaultMaxSize });
}
}