diff --git a/pom.xml b/pom.xml
index 20f6855cb..a2786cb4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,7 +46,8 @@
ruoyi-quartz
ruoyi-generator
ruoyi-common
-
+ ruoyi-exam
+
pom
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 0be310016..7fb9d467c 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -39,13 +39,6 @@
${swagger.version}
-
-
- com.ruoyi
- ruoyi-framework
- ${ruoyi.version}
-
-
com.ruoyi
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
index 69c355dd1..643355b20 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java
@@ -15,7 +15,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OnlineStatus;
import com.ruoyi.framework.shiro.session.OnlineSession;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.impl.SysUserOnlineServiceImpl;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
index 08da5deb9..1f3b7cfbc 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
@@ -14,7 +14,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
index 141a28ca4..21f2109e2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
@@ -15,7 +15,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.system.domain.SysDept;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysDeptService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
index e92361500..70a9e72fb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
@@ -14,7 +14,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysDictData;
import com.ruoyi.system.service.ISysDictDataService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
index f76a8f728..4c06b9a06 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
@@ -14,7 +14,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysDictType;
import com.ruoyi.system.service.ISysDictTypeService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
index 97d9d2794..b2df1400f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.ServletUtils;
+import com.ruoyi.framework.web.util.ServletUtils;
import com.ruoyi.framework.web.base.BaseController;
/**
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
index e02263fe6..f425c52de 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.system.domain.SysMenu;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysMenuService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
index b73473191..4e1ed7207 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
index 068fc97b1..5a2f457b8 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
@@ -14,7 +14,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
index f0031743b..44884a7bd 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
@@ -18,8 +18,8 @@ import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.shiro.service.SysPasswordService;
-import com.ruoyi.framework.util.FileUploadUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.FileUploadUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysUserService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
index e5970d39c..2d60dba14 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -15,7 +15,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.service.ISysRoleService;
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index c0fe2e03f..7c4a3bf22 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -17,7 +17,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.service.ISysPostService;
diff --git a/ruoyi-exam/pom.xml b/ruoyi-exam/pom.xml
new file mode 100644
index 000000000..3b7ffe873
--- /dev/null
+++ b/ruoyi-exam/pom.xml
@@ -0,0 +1,21 @@
+
+
+
+ ruoyi
+ com.ruoyi
+ 3.0
+
+ 4.0.0
+
+ ruoyi-exam
+
+
+ com.ruoyi
+ ruoyi-framework
+ 3.0
+
+
+
+
\ No newline at end of file
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
index 4e20738f8..435700621 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.base.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.system.domain.SysRole;
import com.ruoyi.system.domain.SysUser;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
index 557c68de4..6c1172b90 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
@@ -18,8 +18,8 @@ import com.ruoyi.common.json.JSON;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
-import com.ruoyi.framework.util.ServletUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ServletUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.domain.SysUser;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
index d924af510..cb157a42b 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
@@ -6,10 +6,10 @@ import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.AddressUtils;
import com.ruoyi.framework.shiro.session.OnlineSession;
-import com.ruoyi.framework.util.LogUtils;
-import com.ruoyi.framework.util.ServletUtils;
-import com.ruoyi.framework.util.ShiroUtils;
-import com.ruoyi.framework.util.SpringUtils;
+import com.ruoyi.framework.web.util.LogUtils;
+import com.ruoyi.framework.web.util.ServletUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
+import com.ruoyi.framework.web.util.SpringUtils;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.domain.SysUserOnline;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java
index e0298f388..248d00353 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java
@@ -20,7 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.framework.shiro.service.SysLoginService;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.exception.user.CaptchaException;
import com.ruoyi.framework.web.exception.user.RoleBlockedException;
import com.ruoyi.framework.web.exception.user.UserBlockedException;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java
index e8f677a81..f35edb3d8 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java
@@ -10,9 +10,9 @@ import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
-import com.ruoyi.framework.util.MessageUtils;
-import com.ruoyi.framework.util.ServletUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.MessageUtils;
+import com.ruoyi.framework.web.util.ServletUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.exception.user.CaptchaException;
import com.ruoyi.framework.web.exception.user.UserBlockedException;
import com.ruoyi.framework.web.exception.user.UserDeleteException;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java
index f3bd37f86..bb9daed9f 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
-import com.ruoyi.framework.util.MessageUtils;
+import com.ruoyi.framework.web.util.MessageUtils;
import com.ruoyi.framework.web.exception.user.UserPasswordNotMatchException;
import com.ruoyi.framework.web.exception.user.UserPasswordRetryLimitExceedException;
import com.ruoyi.system.domain.SysUser;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java
index aed924706..1308209ed 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java
@@ -7,7 +7,7 @@ import org.apache.shiro.session.mgt.SessionFactory;
import org.apache.shiro.web.session.mgt.WebSessionContext;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.IpUtils;
-import com.ruoyi.framework.util.ServletUtils;
+import com.ruoyi.framework.web.util.ServletUtils;
import eu.bitwalker.useragentutils.UserAgent;
/**
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java
index c371c2746..750477258 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java
@@ -12,8 +12,8 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
-import com.ruoyi.framework.util.MessageUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.MessageUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
/**
* 退出过滤器
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java
index 743d27933..0d25fad3c 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java
@@ -7,7 +7,7 @@ import org.apache.shiro.web.filter.AccessControlFilter;
import com.google.code.kaptcha.Constants;
import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
/**
* 验证码过滤器
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java
index 1e07f5301..a42dacc12 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java
@@ -13,7 +13,7 @@ import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.enums.OnlineStatus;
import com.ruoyi.framework.shiro.session.OnlineSession;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.system.domain.SysUser;
/**
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java
index 1c8edc6fd..aec76c503 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java
@@ -15,7 +15,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.framework.shiro.session.OnlineSession;
-import com.ruoyi.framework.util.SpringUtils;
+import com.ruoyi.framework.web.util.SpringUtils;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java
index 340feaf6d..db2572cab 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java
@@ -2,7 +2,7 @@ package com.ruoyi.framework.web.base;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.EntityUtils;
+import com.ruoyi.framework.web.util.EntityUtils;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableSupport;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java
index 8e2620c76..73865282e 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java
@@ -4,7 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUser;
import org.springframework.web.bind.WebDataBinder;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/DefaultExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/DefaultExceptionHandler.java
index 2dadddf26..c494522f9 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/DefaultExceptionHandler.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/DefaultExceptionHandler.java
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.exception.DemoModeException;
-import com.ruoyi.framework.util.PermissionUtils;
+import com.ruoyi.framework.web.util.PermissionUtils;
/**
* 自定义异常处理器
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java
index a1e33f6f0..89da4508a 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java
@@ -1,7 +1,7 @@
package com.ruoyi.framework.web.exception.base;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.MessageUtils;
+import com.ruoyi.framework.web.util.MessageUtils;
/**
* 基础异常
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java
index 375ccdbb7..46c4769c1 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java
@@ -1,7 +1,7 @@
package com.ruoyi.framework.web.page;
import com.ruoyi.common.constant.Constants;
-import com.ruoyi.framework.util.ServletUtils;
+import com.ruoyi.framework.web.util.ServletUtils;
/**
* 表格数据处理
diff --git a/ruoyi-system/src/main/java/com/ruoyi/framework/util/EntityUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/EntityUtils.java
similarity index 100%
rename from ruoyi-system/src/main/java/com/ruoyi/framework/util/EntityUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/EntityUtils.java
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/FileUploadUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/FileUploadUtils.java
similarity index 95%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/FileUploadUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/FileUploadUtils.java
index 6c1927f04..acf0697e5 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/FileUploadUtils.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/FileUploadUtils.java
@@ -1,161 +1,161 @@
-package com.ruoyi.framework.util;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.tomcat.util.http.fileupload.FileUploadBase.FileSizeLimitExceededException;
-import org.springframework.web.multipart.MultipartFile;
-import com.ruoyi.common.config.Global;
-import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException;
-import com.ruoyi.common.utils.Md5Utils;
-
-/**
- * 文件上传工具类
- *
- * @author ruoyi
- */
-public class FileUploadUtils
-{
- /**
- * 默认大小 50M
- */
- public static final long DEFAULT_MAX_SIZE = 52428800;
-
- /**
- * 默认上传的地址
- */
- private static String defaultBaseDir = Global.getProfile();
-
- /**
- * 默认的文件名最大长度
- */
- public static final int DEFAULT_FILE_NAME_LENGTH = 200;
-
- /**
- * 默认文件类型jpg
- */
- public static final String IMAGE_JPG_EXTENSION = ".jpg";
-
- private static int counter = 0;
-
- public static void setDefaultBaseDir(String defaultBaseDir)
- {
- FileUploadUtils.defaultBaseDir = defaultBaseDir;
- }
-
- public static String getDefaultBaseDir()
- {
- return defaultBaseDir;
- }
-
- /**
- * 以默认配置进行文件上传
- *
- * @param file 上传的文件
- * @return 文件名称
- * @throws Exception
- */
- public static final String upload(MultipartFile file) throws IOException
- {
- try
- {
- return upload(getDefaultBaseDir(), file, FileUploadUtils.IMAGE_JPG_EXTENSION);
- }
- catch (Exception e)
- {
- throw new IOException(e);
- }
- }
-
- /**
- * 根据文件路径上传
- *
- * @param baseDir 相对应用的基目录
- * @param file 上传的文件
- * @return 文件名称
- * @throws IOException
- */
- public static final String upload(String baseDir, MultipartFile file) throws IOException
- {
- try
- {
- return upload(baseDir, file, FileUploadUtils.IMAGE_JPG_EXTENSION);
- }
- catch (Exception e)
- {
- throw new IOException(e);
- }
- }
-
- /**
- * 文件上传
- *
- * @param baseDir 相对应用的基目录
- * @param file 上传的文件
- * @param needDatePathAndRandomName 是否需要日期目录和随机文件名前缀
- * @param extension 上传文件类型
- * @return 返回上传成功的文件名
- * @throws FileSizeLimitExceededException 如果超出最大大小
- * @throws FileNameLengthLimitExceededException 文件名太长
- * @throws IOException 比如读写文件出错时
- */
- public static final String upload(String baseDir, MultipartFile file, String extension)
- throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException
- {
-
- int fileNamelength = file.getOriginalFilename().length();
- if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
- {
- throw new FileNameLengthLimitExceededException(file.getOriginalFilename(), fileNamelength,
- FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
- }
-
- assertAllowed(file);
-
- String fileName = encodingFilename(file.getOriginalFilename(), extension);
-
- File desc = getAbsoluteFile(baseDir, baseDir + fileName);
- file.transferTo(desc);
- return fileName;
- }
-
- private static final File getAbsoluteFile(String uploadDir, String filename) throws IOException
- {
- File desc = new File(File.separator + filename);
-
- if (!desc.getParentFile().exists())
- {
- desc.getParentFile().mkdirs();
- }
- if (!desc.exists())
- {
- desc.createNewFile();
- }
- return desc;
- }
-
- /**
- * 编码文件名
- */
- private static final String encodingFilename(String filename, String extension)
- {
- filename = filename.replace("_", " ");
- filename = Md5Utils.hash(filename + System.nanoTime() + counter++) + extension;
- return filename;
- }
-
- /**
- * 文件大小校验
- *
- * @param file 上传的文件
- * @return
- * @throws FileSizeLimitExceededException 如果超出最大大小
- */
- public static final void assertAllowed(MultipartFile file) throws FileSizeLimitExceededException
- {
- long size = file.getSize();
- if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE)
- {
- throw new FileSizeLimitExceededException("not allowed upload upload", size, DEFAULT_MAX_SIZE);
- }
- }
-}
+package com.ruoyi.framework.web.util;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.tomcat.util.http.fileupload.FileUploadBase.FileSizeLimitExceededException;
+import org.springframework.web.multipart.MultipartFile;
+import com.ruoyi.common.config.Global;
+import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException;
+import com.ruoyi.common.utils.Md5Utils;
+
+/**
+ * 文件上传工具类
+ *
+ * @author ruoyi
+ */
+public class FileUploadUtils
+{
+ /**
+ * 默认大小 50M
+ */
+ public static final long DEFAULT_MAX_SIZE = 52428800;
+
+ /**
+ * 默认上传的地址
+ */
+ private static String defaultBaseDir = Global.getProfile();
+
+ /**
+ * 默认的文件名最大长度
+ */
+ public static final int DEFAULT_FILE_NAME_LENGTH = 200;
+
+ /**
+ * 默认文件类型jpg
+ */
+ public static final String IMAGE_JPG_EXTENSION = ".jpg";
+
+ private static int counter = 0;
+
+ public static void setDefaultBaseDir(String defaultBaseDir)
+ {
+ FileUploadUtils.defaultBaseDir = defaultBaseDir;
+ }
+
+ public static String getDefaultBaseDir()
+ {
+ return defaultBaseDir;
+ }
+
+ /**
+ * 以默认配置进行文件上传
+ *
+ * @param file 上传的文件
+ * @return 文件名称
+ * @throws Exception
+ */
+ public static final String upload(MultipartFile file) throws IOException
+ {
+ try
+ {
+ return upload(getDefaultBaseDir(), file, FileUploadUtils.IMAGE_JPG_EXTENSION);
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e);
+ }
+ }
+
+ /**
+ * 根据文件路径上传
+ *
+ * @param baseDir 相对应用的基目录
+ * @param file 上传的文件
+ * @return 文件名称
+ * @throws IOException
+ */
+ public static final String upload(String baseDir, MultipartFile file) throws IOException
+ {
+ try
+ {
+ return upload(baseDir, file, FileUploadUtils.IMAGE_JPG_EXTENSION);
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e);
+ }
+ }
+
+ /**
+ * 文件上传
+ *
+ * @param baseDir 相对应用的基目录
+ * @param file 上传的文件
+ * @param needDatePathAndRandomName 是否需要日期目录和随机文件名前缀
+ * @param extension 上传文件类型
+ * @return 返回上传成功的文件名
+ * @throws FileSizeLimitExceededException 如果超出最大大小
+ * @throws FileNameLengthLimitExceededException 文件名太长
+ * @throws IOException 比如读写文件出错时
+ */
+ public static final String upload(String baseDir, MultipartFile file, String extension)
+ throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException
+ {
+
+ int fileNamelength = file.getOriginalFilename().length();
+ if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
+ {
+ throw new FileNameLengthLimitExceededException(file.getOriginalFilename(), fileNamelength,
+ FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
+ }
+
+ assertAllowed(file);
+
+ String fileName = encodingFilename(file.getOriginalFilename(), extension);
+
+ File desc = getAbsoluteFile(baseDir, baseDir + fileName);
+ file.transferTo(desc);
+ return fileName;
+ }
+
+ private static final File getAbsoluteFile(String uploadDir, String filename) throws IOException
+ {
+ File desc = new File(File.separator + filename);
+
+ if (!desc.getParentFile().exists())
+ {
+ desc.getParentFile().mkdirs();
+ }
+ if (!desc.exists())
+ {
+ desc.createNewFile();
+ }
+ return desc;
+ }
+
+ /**
+ * 编码文件名
+ */
+ private static final String encodingFilename(String filename, String extension)
+ {
+ filename = filename.replace("_", " ");
+ filename = Md5Utils.hash(filename + System.nanoTime() + counter++) + extension;
+ return filename;
+ }
+
+ /**
+ * 文件大小校验
+ *
+ * @param file 上传的文件
+ * @return
+ * @throws FileSizeLimitExceededException 如果超出最大大小
+ */
+ public static final void assertAllowed(MultipartFile file) throws FileSizeLimitExceededException
+ {
+ long size = file.getSize();
+ if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE)
+ {
+ throw new FileSizeLimitExceededException("not allowed upload upload", size, DEFAULT_MAX_SIZE);
+ }
+ }
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/LogUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/LogUtils.java
similarity index 95%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/LogUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/LogUtils.java
index 96a38eb55..89c71d9a0 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/LogUtils.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/LogUtils.java
@@ -1,136 +1,136 @@
-package com.ruoyi.framework.util;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.shiro.SecurityUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.ruoyi.common.json.JSON;
-import com.ruoyi.common.utils.IpUtils;
-
-/**
- * 处理并记录日志文件
- *
- * @author ruoyi
- */
-public class LogUtils
-{
- public static final Logger ERROR_LOG = LoggerFactory.getLogger("sys-error");
- public static final Logger ACCESS_LOG = LoggerFactory.getLogger("sys-access");
-
- /**
- * 记录访问日志 [username][jsessionid][ip][accept][UserAgent][url][params][Referer]
- *
- * @param request
- * @throws Exception
- */
- public static void logAccess(HttpServletRequest request) throws Exception
- {
- String username = getUsername();
- String jsessionId = request.getRequestedSessionId();
- String ip = IpUtils.getIpAddr(request);
- String accept = request.getHeader("accept");
- String userAgent = request.getHeader("User-Agent");
- String url = request.getRequestURI();
- String params = getParams(request);
-
- StringBuilder s = new StringBuilder();
- s.append(getBlock(username));
- s.append(getBlock(jsessionId));
- s.append(getBlock(ip));
- s.append(getBlock(accept));
- s.append(getBlock(userAgent));
- s.append(getBlock(url));
- s.append(getBlock(params));
- s.append(getBlock(request.getHeader("Referer")));
- getAccessLog().info(s.toString());
- }
-
- /**
- * 记录异常错误 格式 [exception]
- *
- * @param message
- * @param e
- */
- public static void logError(String message, Throwable e)
- {
- String username = getUsername();
- StringBuilder s = new StringBuilder();
- s.append(getBlock("exception"));
- s.append(getBlock(username));
- s.append(getBlock(message));
- ERROR_LOG.error(s.toString(), e);
- }
-
- /**
- * 记录页面错误 错误日志记录 [page/eception][username][statusCode][errorMessage][servletName][uri][exceptionName][ip][exception]
- *
- * @param request
- */
- public static void logPageError(HttpServletRequest request)
- {
- String username = getUsername();
-
- Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
- String message = (String) request.getAttribute("javax.servlet.error.message");
- String uri = (String) request.getAttribute("javax.servlet.error.request_uri");
- Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception");
-
- if (statusCode == null)
- {
- statusCode = 0;
- }
-
- StringBuilder s = new StringBuilder();
- s.append(getBlock(t == null ? "page" : "exception"));
- s.append(getBlock(username));
- s.append(getBlock(statusCode));
- s.append(getBlock(message));
- s.append(getBlock(IpUtils.getIpAddr(request)));
-
- s.append(getBlock(uri));
- s.append(getBlock(request.getHeader("Referer")));
- StringWriter sw = new StringWriter();
-
- while (t != null)
- {
- t.printStackTrace(new PrintWriter(sw));
- t = t.getCause();
- }
- s.append(getBlock(sw.toString()));
- getErrorLog().error(s.toString());
-
- }
-
- public static String getBlock(Object msg)
- {
- if (msg == null)
- {
- msg = "";
- }
- return "[" + msg.toString() + "]";
- }
-
- protected static String getParams(HttpServletRequest request) throws Exception
- {
- Map params = request.getParameterMap();
- return JSON.marshal(params);
- }
-
- protected static String getUsername()
- {
- return (String) SecurityUtils.getSubject().getPrincipal();
- }
-
- public static Logger getAccessLog()
- {
- return ACCESS_LOG;
- }
-
- public static Logger getErrorLog()
- {
- return ERROR_LOG;
- }
-}
+package com.ruoyi.framework.web.util;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.shiro.SecurityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.ruoyi.common.json.JSON;
+import com.ruoyi.common.utils.IpUtils;
+
+/**
+ * 处理并记录日志文件
+ *
+ * @author ruoyi
+ */
+public class LogUtils
+{
+ public static final Logger ERROR_LOG = LoggerFactory.getLogger("sys-error");
+ public static final Logger ACCESS_LOG = LoggerFactory.getLogger("sys-access");
+
+ /**
+ * 记录访问日志 [username][jsessionid][ip][accept][UserAgent][url][params][Referer]
+ *
+ * @param request
+ * @throws Exception
+ */
+ public static void logAccess(HttpServletRequest request) throws Exception
+ {
+ String username = getUsername();
+ String jsessionId = request.getRequestedSessionId();
+ String ip = IpUtils.getIpAddr(request);
+ String accept = request.getHeader("accept");
+ String userAgent = request.getHeader("User-Agent");
+ String url = request.getRequestURI();
+ String params = getParams(request);
+
+ StringBuilder s = new StringBuilder();
+ s.append(getBlock(username));
+ s.append(getBlock(jsessionId));
+ s.append(getBlock(ip));
+ s.append(getBlock(accept));
+ s.append(getBlock(userAgent));
+ s.append(getBlock(url));
+ s.append(getBlock(params));
+ s.append(getBlock(request.getHeader("Referer")));
+ getAccessLog().info(s.toString());
+ }
+
+ /**
+ * 记录异常错误 格式 [exception]
+ *
+ * @param message
+ * @param e
+ */
+ public static void logError(String message, Throwable e)
+ {
+ String username = getUsername();
+ StringBuilder s = new StringBuilder();
+ s.append(getBlock("exception"));
+ s.append(getBlock(username));
+ s.append(getBlock(message));
+ ERROR_LOG.error(s.toString(), e);
+ }
+
+ /**
+ * 记录页面错误 错误日志记录 [page/eception][username][statusCode][errorMessage][servletName][uri][exceptionName][ip][exception]
+ *
+ * @param request
+ */
+ public static void logPageError(HttpServletRequest request)
+ {
+ String username = getUsername();
+
+ Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
+ String message = (String) request.getAttribute("javax.servlet.error.message");
+ String uri = (String) request.getAttribute("javax.servlet.error.request_uri");
+ Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception");
+
+ if (statusCode == null)
+ {
+ statusCode = 0;
+ }
+
+ StringBuilder s = new StringBuilder();
+ s.append(getBlock(t == null ? "page" : "exception"));
+ s.append(getBlock(username));
+ s.append(getBlock(statusCode));
+ s.append(getBlock(message));
+ s.append(getBlock(IpUtils.getIpAddr(request)));
+
+ s.append(getBlock(uri));
+ s.append(getBlock(request.getHeader("Referer")));
+ StringWriter sw = new StringWriter();
+
+ while (t != null)
+ {
+ t.printStackTrace(new PrintWriter(sw));
+ t = t.getCause();
+ }
+ s.append(getBlock(sw.toString()));
+ getErrorLog().error(s.toString());
+
+ }
+
+ public static String getBlock(Object msg)
+ {
+ if (msg == null)
+ {
+ msg = "";
+ }
+ return "[" + msg.toString() + "]";
+ }
+
+ protected static String getParams(HttpServletRequest request) throws Exception
+ {
+ Map params = request.getParameterMap();
+ return JSON.marshal(params);
+ }
+
+ protected static String getUsername()
+ {
+ return (String) SecurityUtils.getSubject().getPrincipal();
+ }
+
+ public static Logger getAccessLog()
+ {
+ return ACCESS_LOG;
+ }
+
+ public static Logger getErrorLog()
+ {
+ return ERROR_LOG;
+ }
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/MessageUtils.java
similarity index 89%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/MessageUtils.java
index b787e1bd3..2b6fec2d7 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/MessageUtils.java
@@ -1,24 +1,24 @@
-package com.ruoyi.framework.util;
-
-import org.springframework.context.MessageSource;
-
-/**
- * 获取i18n资源文件
- *
- * @author ruoyi
- */
-public class MessageUtils
-{
- /**
- * 根据消息键和参数 获取消息 委托给spring messageSource
- *
- * @param code 消息键
- * @param args 参数
- * @return
- */
- public static String message(String code, Object... args)
- {
- MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
- return messageSource.getMessage(code, args, null);
- }
-}
+package com.ruoyi.framework.web.util;
+
+import org.springframework.context.MessageSource;
+
+/**
+ * 获取i18n资源文件
+ *
+ * @author ruoyi
+ */
+public class MessageUtils
+{
+ /**
+ * 根据消息键和参数 获取消息 委托给spring messageSource
+ *
+ * @param code 消息键
+ * @param args 参数
+ * @return
+ */
+ public static String message(String code, Object... args)
+ {
+ MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
+ return messageSource.getMessage(code, args, null);
+ }
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/PermissionUtils.java
similarity index 95%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/PermissionUtils.java
index ddf222b28..40d5d2ad9 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/PermissionUtils.java
@@ -1,46 +1,46 @@
-package com.ruoyi.framework.util;
-
-import org.apache.commons.lang3.StringUtils;
-import com.ruoyi.common.constant.PermissionConstants;
-
-/**
- * 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.endsWithIgnoreCase(permission, PermissionConstants.EXPORT_PERMISSION))
- {
- msg = MessageUtils.message("no.export.permission", permission);
- }
- else if (StringUtils.endsWithAny(permission,
- new String[] { PermissionConstants.VIEW_PERMISSION, PermissionConstants.LIST_PERMISSION }))
- {
- msg = MessageUtils.message("no.view.permission", permission);
- }
- return msg;
- }
-}
+package com.ruoyi.framework.web.util;
+
+import org.apache.commons.lang3.StringUtils;
+import com.ruoyi.common.constant.PermissionConstants;
+
+/**
+ * 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.endsWithIgnoreCase(permission, PermissionConstants.EXPORT_PERMISSION))
+ {
+ msg = MessageUtils.message("no.export.permission", permission);
+ }
+ else if (StringUtils.endsWithAny(permission,
+ new String[] { PermissionConstants.VIEW_PERMISSION, PermissionConstants.LIST_PERMISSION }))
+ {
+ msg = MessageUtils.message("no.view.permission", permission);
+ }
+ return msg;
+ }
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/framework/util/ServletUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/ServletUtils.java
similarity index 100%
rename from ruoyi-system/src/main/java/com/ruoyi/framework/util/ServletUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/ServletUtils.java
diff --git a/ruoyi-system/src/main/java/com/ruoyi/framework/util/ShiroUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/ShiroUtils.java
similarity index 100%
rename from ruoyi-system/src/main/java/com/ruoyi/framework/util/ShiroUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/ShiroUtils.java
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/SpringUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/SpringUtils.java
similarity index 95%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/SpringUtils.java
rename to ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/SpringUtils.java
index 99b0f05b4..434c4bccf 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/SpringUtils.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/util/SpringUtils.java
@@ -1,101 +1,101 @@
-package com.ruoyi.framework.util;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * spring工具类 方便在非spring管理环境中获取bean
- *
- * @author ruoyi
- */
-@Component
-public final class SpringUtils implements BeanFactoryPostProcessor
-{
- /** Spring应用上下文环境 */
- private static ConfigurableListableBeanFactory beanFactory;
-
- @Override
- public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
- {
- SpringUtils.beanFactory = beanFactory;
- }
-
- /**
- * 获取对象
- *
- * @param name
- * @return Object 一个以所给名字注册的bean的实例
- * @throws org.springframework.beans.BeansException
- *
- */
- @SuppressWarnings("unchecked")
- public static T getBean(String name) throws BeansException
- {
- return (T) beanFactory.getBean(name);
- }
-
- /**
- * 获取类型为requiredType的对象
- *
- * @param clz
- * @return
- * @throws org.springframework.beans.BeansException
- *
- */
- public static T getBean(Class clz) throws BeansException
- {
- T result = (T) beanFactory.getBean(clz);
- return result;
- }
-
- /**
- * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
- *
- * @param name
- * @return boolean
- */
- public static boolean containsBean(String name)
- {
- return beanFactory.containsBean(name);
- }
-
- /**
- * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
- *
- * @param name
- * @return boolean
- * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
- *
- */
- public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
- {
- return beanFactory.isSingleton(name);
- }
-
- /**
- * @param name
- * @return Class 注册对象的类型
- * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
- *
- */
- public static Class> getType(String name) throws NoSuchBeanDefinitionException
- {
- return beanFactory.getType(name);
- }
-
- /**
- * 如果给定的bean名字在bean定义中有别名,则返回这些别名
- *
- * @param name
- * @return
- * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
- *
- */
- public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
- {
- return beanFactory.getAliases(name);
- }
-}
+package com.ruoyi.framework.web.util;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * spring工具类 方便在非spring管理环境中获取bean
+ *
+ * @author ruoyi
+ */
+@Component
+public final class SpringUtils implements BeanFactoryPostProcessor
+{
+ /** Spring应用上下文环境 */
+ private static ConfigurableListableBeanFactory beanFactory;
+
+ @Override
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
+ {
+ SpringUtils.beanFactory = beanFactory;
+ }
+
+ /**
+ * 获取对象
+ *
+ * @param name
+ * @return Object 一个以所给名字注册的bean的实例
+ * @throws org.springframework.beans.BeansException
+ *
+ */
+ @SuppressWarnings("unchecked")
+ public static T getBean(String name) throws BeansException
+ {
+ return (T) beanFactory.getBean(name);
+ }
+
+ /**
+ * 获取类型为requiredType的对象
+ *
+ * @param clz
+ * @return
+ * @throws org.springframework.beans.BeansException
+ *
+ */
+ public static T getBean(Class clz) throws BeansException
+ {
+ T result = (T) beanFactory.getBean(clz);
+ return result;
+ }
+
+ /**
+ * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
+ *
+ * @param name
+ * @return boolean
+ */
+ public static boolean containsBean(String name)
+ {
+ return beanFactory.containsBean(name);
+ }
+
+ /**
+ * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
+ *
+ * @param name
+ * @return boolean
+ * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
+ *
+ */
+ public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
+ {
+ return beanFactory.isSingleton(name);
+ }
+
+ /**
+ * @param name
+ * @return Class 注册对象的类型
+ * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
+ *
+ */
+ public static Class> getType(String name) throws NoSuchBeanDefinitionException
+ {
+ return beanFactory.getType(name);
+ }
+
+ /**
+ * 如果给定的bean名字在bean定义中有别名,则返回这些别名
+ *
+ * @param name
+ * @return
+ * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
+ *
+ */
+ public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
+ {
+ return beanFactory.getAliases(name);
+ }
+}
diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml
index bdbe15e96..a0d952410 100644
--- a/ruoyi-generator/pom.xml
+++ b/ruoyi-generator/pom.xml
@@ -28,12 +28,6 @@
${velocity.version}
-
-
- com.ruoyi
- ruoyi-common
- ${ruoyi.version}
-
com.ruoyi
ruoyi-framework
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
index f213e624d..5672fa106 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
@@ -14,7 +14,7 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ExcelUtil;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.quartz.domain.SysJob;
import com.ruoyi.quartz.service.ISysJobService;
diff --git a/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java
index 340feaf6d..db2572cab 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/AbstractBaseServiceImpl.java
@@ -2,7 +2,7 @@ package com.ruoyi.framework.web.base;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.EntityUtils;
+import com.ruoyi.framework.web.util.EntityUtils;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableSupport;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/BaseController.java b/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/BaseController.java
index 8e2620c76..73865282e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/BaseController.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/framework/web/base/BaseController.java
@@ -4,7 +4,7 @@ import com.github.pagehelper.PageInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.framework.util.ShiroUtils;
+import com.ruoyi.framework.web.util.ShiroUtils;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.system.domain.SysUser;
import org.springframework.web.bind.WebDataBinder;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/EntityUtils.java b/ruoyi-system/src/main/java/com/ruoyi/framework/web/util/EntityUtils.java
similarity index 97%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/EntityUtils.java
rename to ruoyi-system/src/main/java/com/ruoyi/framework/web/util/EntityUtils.java
index 805fd613e..d37f2af2d 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/EntityUtils.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/framework/web/util/EntityUtils.java
@@ -1,4 +1,4 @@
-package com.ruoyi.framework.util;
+package com.ruoyi.framework.web.util;
import java.lang.reflect.Method;
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ServletUtils.java b/ruoyi-system/src/main/java/com/ruoyi/framework/web/util/ServletUtils.java
similarity index 95%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/ServletUtils.java
rename to ruoyi-system/src/main/java/com/ruoyi/framework/web/util/ServletUtils.java
index 77b57faec..45b747a9b 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ServletUtils.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/framework/web/util/ServletUtils.java
@@ -1,139 +1,139 @@
-package com.ruoyi.framework.util;
-
-import com.ruoyi.common.support.Convert;
-import com.ruoyi.common.utils.StringUtils;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-
-/**
- * 客户端工具类
- *
- * @author ruoyi
- */
-public class ServletUtils
-{
- /**
- * 获取String参数
- */
- public static String getParameter(String name)
- {
- return getRequest().getParameter(name);
- }
-
- /**
- * 获取String参数
- */
- public static String getParameter(String name, String defaultValue)
- {
- return Convert.toStr(getRequest().getParameter(name), defaultValue);
- }
-
- /**
- * 获取Integer参数
- */
- public static Integer getParameterToInt(String name)
- {
- return Convert.toInt(getRequest().getParameter(name));
- }
-
- /**
- * 获取Integer参数
- */
- public static Integer getParameterToInt(String name, Integer defaultValue)
- {
- return Convert.toInt(getRequest().getParameter(name), defaultValue);
- }
-
- /**
- * 获取request
- */
- public static HttpServletRequest getRequest()
- {
- return getRequestAttributes().getRequest();
- }
-
- /**
- * 获取response
- */
- public static HttpServletResponse getResponse()
- {
- return getRequestAttributes().getResponse();
- }
-
- /**
- * 获取session
- */
- public static HttpSession getSession()
- {
- return getRequest().getSession();
- }
-
- public static ServletRequestAttributes getRequestAttributes()
- {
- RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
- return (ServletRequestAttributes) attributes;
- }
-
- /**
- * 将字符串渲染到客户端
- *
- * @param response 渲染对象
- * @param string 待渲染的字符串
- * @return null
- */
- public static String renderString(HttpServletResponse response, String string)
- {
- try
- {
- response.setContentType("application/json");
- response.setCharacterEncoding("utf-8");
- response.getWriter().print(string);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 是否是Ajax异步请求
- *
- * @param request
- */
- public static boolean isAjaxRequest(HttpServletRequest request)
- {
-
- String accept = request.getHeader("accept");
- if (accept != null && accept.indexOf("application/json") != -1)
- {
- return true;
- }
-
- String xRequestedWith = request.getHeader("X-Requested-With");
- if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
- {
- return true;
- }
-
- String uri = request.getRequestURI();
- if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
- {
- return true;
- }
-
- String ajax = request.getParameter("__ajax");
- if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
- {
- return true;
- }
-
- return false;
- }
-}
+package com.ruoyi.framework.web.util;
+
+import com.ruoyi.common.support.Convert;
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * 客户端工具类
+ *
+ * @author ruoyi
+ */
+public class ServletUtils
+{
+ /**
+ * 获取String参数
+ */
+ public static String getParameter(String name)
+ {
+ return getRequest().getParameter(name);
+ }
+
+ /**
+ * 获取String参数
+ */
+ public static String getParameter(String name, String defaultValue)
+ {
+ return Convert.toStr(getRequest().getParameter(name), defaultValue);
+ }
+
+ /**
+ * 获取Integer参数
+ */
+ public static Integer getParameterToInt(String name)
+ {
+ return Convert.toInt(getRequest().getParameter(name));
+ }
+
+ /**
+ * 获取Integer参数
+ */
+ public static Integer getParameterToInt(String name, Integer defaultValue)
+ {
+ return Convert.toInt(getRequest().getParameter(name), defaultValue);
+ }
+
+ /**
+ * 获取request
+ */
+ public static HttpServletRequest getRequest()
+ {
+ return getRequestAttributes().getRequest();
+ }
+
+ /**
+ * 获取response
+ */
+ public static HttpServletResponse getResponse()
+ {
+ return getRequestAttributes().getResponse();
+ }
+
+ /**
+ * 获取session
+ */
+ public static HttpSession getSession()
+ {
+ return getRequest().getSession();
+ }
+
+ public static ServletRequestAttributes getRequestAttributes()
+ {
+ RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
+ return (ServletRequestAttributes) attributes;
+ }
+
+ /**
+ * 将字符串渲染到客户端
+ *
+ * @param response 渲染对象
+ * @param string 待渲染的字符串
+ * @return null
+ */
+ public static String renderString(HttpServletResponse response, String string)
+ {
+ try
+ {
+ response.setContentType("application/json");
+ response.setCharacterEncoding("utf-8");
+ response.getWriter().print(string);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 是否是Ajax异步请求
+ *
+ * @param request
+ */
+ public static boolean isAjaxRequest(HttpServletRequest request)
+ {
+
+ String accept = request.getHeader("accept");
+ if (accept != null && accept.indexOf("application/json") != -1)
+ {
+ return true;
+ }
+
+ String xRequestedWith = request.getHeader("X-Requested-With");
+ if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
+ {
+ return true;
+ }
+
+ String uri = request.getRequestURI();
+ if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
+ {
+ return true;
+ }
+
+ String ajax = request.getParameter("__ajax");
+ if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java b/ruoyi-system/src/main/java/com/ruoyi/framework/web/util/ShiroUtils.java
similarity index 95%
rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java
rename to ruoyi-system/src/main/java/com/ruoyi/framework/web/util/ShiroUtils.java
index e4102b285..90b0278b2 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/framework/web/util/ShiroUtils.java
@@ -1,96 +1,96 @@
-package com.ruoyi.framework.util;
-
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.bean.BeanUtils;
-import com.ruoyi.framework.shiro.realm.UserRealm;
-import com.ruoyi.system.domain.SysUser;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.crypto.SecureRandomNumberGenerator;
-import org.apache.shiro.mgt.RealmSecurityManager;
-import org.apache.shiro.session.Session;
-import org.apache.shiro.subject.PrincipalCollection;
-import org.apache.shiro.subject.SimplePrincipalCollection;
-import org.apache.shiro.subject.Subject;
-
-/**
- * shiro 工具类
- *
- * @author ruoyi
- */
-public class ShiroUtils
-{
- public static Subject getSubjct()
- {
- return SecurityUtils.getSubject();
- }
-
- public static Session getSession()
- {
- return SecurityUtils.getSubject().getSession();
- }
-
- public static void logout()
- {
- getSubjct().logout();
- }
-
- public static SysUser getSysUser()
- {
- SysUser user = null;
- Object obj = getSubjct().getPrincipal();
- if (StringUtils.isNotNull(obj))
- {
- user = new SysUser();
- BeanUtils.copyBeanProp(user, obj);
- }
- return user;
- }
-
- public static void setSysUser(SysUser user)
- {
- Subject subject = getSubjct();
- PrincipalCollection principalCollection = subject.getPrincipals();
- String realmName = principalCollection.getRealmNames().iterator().next();
- PrincipalCollection newPrincipalCollection = new SimplePrincipalCollection(user, realmName);
- // 重新加载Principal
- subject.runAs(newPrincipalCollection);
- }
-
- public static void clearCachedAuthorizationInfo()
- {
- RealmSecurityManager rsm = (RealmSecurityManager) SecurityUtils.getSecurityManager();
- UserRealm realm = (UserRealm) rsm.getRealms().iterator().next();
- realm.clearCachedAuthorizationInfo();
- }
-
- public static Long getUserId()
- {
- return getSysUser().getUserId().longValue();
- }
-
- public static String getLoginName()
- {
- return getSysUser().getLoginName();
- }
-
- public static String getIp()
- {
- return getSubjct().getSession().getHost();
- }
-
- public static String getSessionId()
- {
- return String.valueOf(getSubjct().getSession().getId());
- }
-
- /**
- * 生成随机盐
- */
- public static String randomSalt()
- {
- // 一个Byte占两个字节,此处生成的3字节,字符串长度为6
- SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
- String hex = secureRandom.nextBytes(3).toHex();
- return hex;
- }
-}
+package com.ruoyi.framework.web.util;
+
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.framework.shiro.realm.UserRealm;
+import com.ruoyi.system.domain.SysUser;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.crypto.SecureRandomNumberGenerator;
+import org.apache.shiro.mgt.RealmSecurityManager;
+import org.apache.shiro.session.Session;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.subject.SimplePrincipalCollection;
+import org.apache.shiro.subject.Subject;
+
+/**
+ * shiro 工具类
+ *
+ * @author ruoyi
+ */
+public class ShiroUtils
+{
+ public static Subject getSubjct()
+ {
+ return SecurityUtils.getSubject();
+ }
+
+ public static Session getSession()
+ {
+ return SecurityUtils.getSubject().getSession();
+ }
+
+ public static void logout()
+ {
+ getSubjct().logout();
+ }
+
+ public static SysUser getSysUser()
+ {
+ SysUser user = null;
+ Object obj = getSubjct().getPrincipal();
+ if (StringUtils.isNotNull(obj))
+ {
+ user = new SysUser();
+ BeanUtils.copyBeanProp(user, obj);
+ }
+ return user;
+ }
+
+ public static void setSysUser(SysUser user)
+ {
+ Subject subject = getSubjct();
+ PrincipalCollection principalCollection = subject.getPrincipals();
+ String realmName = principalCollection.getRealmNames().iterator().next();
+ PrincipalCollection newPrincipalCollection = new SimplePrincipalCollection(user, realmName);
+ // 重新加载Principal
+ subject.runAs(newPrincipalCollection);
+ }
+
+ public static void clearCachedAuthorizationInfo()
+ {
+ RealmSecurityManager rsm = (RealmSecurityManager) SecurityUtils.getSecurityManager();
+ UserRealm realm = (UserRealm) rsm.getRealms().iterator().next();
+ realm.clearCachedAuthorizationInfo();
+ }
+
+ public static Long getUserId()
+ {
+ return getSysUser().getUserId().longValue();
+ }
+
+ public static String getLoginName()
+ {
+ return getSysUser().getLoginName();
+ }
+
+ public static String getIp()
+ {
+ return getSubjct().getSession().getHost();
+ }
+
+ public static String getSessionId()
+ {
+ return String.valueOf(getSubjct().getSession().getId());
+ }
+
+ /**
+ * 生成随机盐
+ */
+ public static String randomSalt()
+ {
+ // 一个Byte占两个字节,此处生成的3字节,字符串长度为6
+ SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
+ String hex = secureRandom.nextBytes(3).toHex();
+ return hex;
+ }
+}