一些优化细节

This commit is contained in:
RuoYi
2018-07-26 12:37:33 +08:00
parent f65728611a
commit 791c767aed
15 changed files with 96 additions and 33 deletions

View File

@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* 通用Map数据
* 通用数据库映射Map数据
*
* @author ruoyi
*/
@ -39,7 +39,7 @@ public class CommonMap
javaTypeMap.put("text", "String");
javaTypeMap.put("mediumtext", "String");
javaTypeMap.put("longtext", "String");
javaTypeMap.put("time", "Date");
javaTypeMap.put("time", "Date");
javaTypeMap.put("date", "Date");
javaTypeMap.put("datetime", "Date");
javaTypeMap.put("timestamp", "Date");

View File

@ -45,21 +45,21 @@ public class Constants
/**
* 当前记录起始索引
*/
public static String PAGENUM = "pageNum";
public static String PAGE_NUM = "pageNum";
/**
* 每页显示记录数
*/
public static String PAGESIZE = "pageSize";
public static String PAGE_SIZE = "pageSize";
/**
* 排序列
*/
public static String ORDERBYCOLUMN = "orderByColumn";
public static String ORDER_BY_COLUMN = "orderByColumn";
/**
* 排序的方向 "desc" 或者 "asc".
*/
public static String ISASC = "isAsc";
public static String IS_ASC = "isAsc";
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.common.constant;
/**
* 权限通用常量
*
* @author ruoyi
*/
public class PermissionConstants
{
/** 新增权限 */
public static final String ADD_PERMISSION = "add";
/** 修改权限 */
public static final String EDIT_PERMISSION = "edit";
/** 删除权限 */
public static final String REMOVE_PERMISSION = "remove";
/** 显示权限 */
public static final String VIEW_PERMISSION = "view";
/** 查询权限 */
public static final String LIST_PERMISSION = "list";
}

View File

@ -19,8 +19,7 @@ public class InvalidExtensionException extends FileUploadException
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
{
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : ["
+ Arrays.toString(allowedExtension) + "]");
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
this.allowedExtension = allowedExtension;
this.extension = extension;
this.filename = filename;

View File

@ -30,7 +30,7 @@ public class AddressUtils
}
catch (Exception e)
{
log.error("根据IP获取所在位置----------错误消息:" + e.getMessage());
log.error("获取地理位置异常:", e);
}
return address;
}

View File

@ -12,7 +12,7 @@ import com.ruoyi.common.support.StrFormatter;
*
* @author ruoyi
*/
public class StringUtils
public class StringUtils extends org.apache.commons.lang3.StringUtils
{
/** 空字符串 */
private static final String NULLSTR = "";

View File

@ -304,7 +304,7 @@ public class ExcelUtil<T>
}
catch (Exception e)
{
log.error("导出Excel失败{}", e);
log.error("导出Excel失败{}", e.getMessage());
}
}
}
@ -319,7 +319,7 @@ public class ExcelUtil<T>
}
catch (Exception e)
{
log.error("关闭flush失败{}", e);
log.error("关闭flush失败{}", e.getMessage());
return AjaxResult.error("导出Excel失败请联系网站管理员");
}
}

View File

@ -0,0 +1,42 @@
package com.ruoyi.common.utils.security;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.common.constant.PermissionConstants;
import com.ruoyi.common.utils.MessageUtils;
/**
* permission 工具类
*
* @author ruoyi
*/
public class PermissionUtils
{
/**
* 权限错误消息提醒
*
* @param errorMsg 错误信息
* @return
*/
public static String getMsg(String permissionsStr)
{
String permission = StringUtils.substringBetween(permissionsStr, "[", "]");
String msg = MessageUtils.message("no.view.permission", permission);
if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.ADD_PERMISSION))
{
msg = MessageUtils.message("no.create.permission", permission);
}
else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.EDIT_PERMISSION))
{
msg = MessageUtils.message("no.update.permission", permission);
}
else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.REMOVE_PERMISSION))
{
msg = MessageUtils.message("no.delete.permission", permission);
}
else if (StringUtils.endsWithAny(permission, new String[] { PermissionConstants.VIEW_PERMISSION, PermissionConstants.LIST_PERMISSION }))
{
msg = MessageUtils.message("no.view.permission", permission);
}
return msg;
}
}