From edbc02bbaf5262dfcd5e9a93d1a8235a78d6fd9f Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Mon, 1 Mar 2021 11:43:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=A5=E5=BF=97=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/IUserDetailCheckService.java | 14 ++ .../route/log/LogRouteController.java | 45 ++++ .../service/user/UserDetailServiceImpl.java | 3 +- .../resources/templates/default-home.html | 2 +- .../resources/templates/default-main.html | 4 +- .../log/list-department-adjustment.html | 188 ++++++++++++++++ .../log/list-department-user-adjustment.html | 188 ++++++++++++++++ .../templates/log/list-login-log.html | 181 +++++++++++++++ .../templates/log/list-user-adjustment.html | 210 ++++++++++++++++++ .../menu/startup/ServiceMenuStartUp.java | 160 ++++++++++++- .../templates/user/update-password.html | 7 +- 11 files changed, 990 insertions(+), 12 deletions(-) create mode 100644 basic-interface/src/main/java/ink/wgink/interfaces/user/IUserDetailCheckService.java create mode 100644 login-base/src/main/java/ink/wgink/login/base/controller/route/log/LogRouteController.java create mode 100644 login-base/src/main/resources/templates/log/list-department-adjustment.html create mode 100644 login-base/src/main/resources/templates/log/list-department-user-adjustment.html create mode 100644 login-base/src/main/resources/templates/log/list-login-log.html create mode 100644 login-base/src/main/resources/templates/log/list-user-adjustment.html diff --git a/basic-interface/src/main/java/ink/wgink/interfaces/user/IUserDetailCheckService.java b/basic-interface/src/main/java/ink/wgink/interfaces/user/IUserDetailCheckService.java new file mode 100644 index 00000000..bcd0ba81 --- /dev/null +++ b/basic-interface/src/main/java/ink/wgink/interfaces/user/IUserDetailCheckService.java @@ -0,0 +1,14 @@ +package ink.wgink.interfaces.user; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: IUserDetailCheckService + * @Description: 登录业务检查 + * @Author: wanggeng + * @Date: 2021/3/1 10:50 上午 + * @Version: 1.0 + */ +public interface IUserDetailCheckService { +} diff --git a/login-base/src/main/java/ink/wgink/login/base/controller/route/log/LogRouteController.java b/login-base/src/main/java/ink/wgink/login/base/controller/route/log/LogRouteController.java new file mode 100644 index 00000000..156b3b4a --- /dev/null +++ b/login-base/src/main/java/ink/wgink/login/base/controller/route/log/LogRouteController.java @@ -0,0 +1,45 @@ +package ink.wgink.login.base.controller.route.log; + +import ink.wgink.interfaces.consts.ISystemConstant; +import io.swagger.annotations.Api; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: LogRouteController + * @Description: 日志 + * @Author: wanggeng + * @Date: 2021/3/1 10:41 上午 + * @Version: 1.0 + */ +@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "日志") +@Controller +@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/log") +public class LogRouteController { + + @GetMapping("list-department-adjustment") + public ModelAndView listDepartmentAdjustment() { + return new ModelAndView("log/list-department-adjustment"); + } + + @GetMapping("list-department-user-adjustment") + public ModelAndView listDepartmentUserAdjustment() { + return new ModelAndView("log/list-department-user-adjustment"); + } + + @GetMapping("list-login-log") + public ModelAndView listLoginLog() { + return new ModelAndView("log/list-login-log"); + } + + @GetMapping("list-user-adjustment") + public ModelAndView listUserAdjustment() { + return new ModelAndView("log/list-user-adjustment"); + } + +} diff --git a/login-base/src/main/java/ink/wgink/login/base/service/user/UserDetailServiceImpl.java b/login-base/src/main/java/ink/wgink/login/base/service/user/UserDetailServiceImpl.java index 4d2116a3..da12181f 100644 --- a/login-base/src/main/java/ink/wgink/login/base/service/user/UserDetailServiceImpl.java +++ b/login-base/src/main/java/ink/wgink/login/base/service/user/UserDetailServiceImpl.java @@ -8,6 +8,7 @@ import ink.wgink.interfaces.position.IPositionUserBaseService; import ink.wgink.interfaces.role.IRoleMenuBaseService; import ink.wgink.interfaces.role.IRolePermissionBaseService; import ink.wgink.interfaces.role.IRoleUserBaseService; +import ink.wgink.interfaces.user.IUserDetailCheckService; import ink.wgink.login.base.exceptions.UserAuthenticationException; import ink.wgink.login.base.manager.ConfigManager; import ink.wgink.pojo.bos.LoginUser; @@ -41,7 +42,7 @@ import java.util.*; * @Version: 1.0 **/ @Service -public class UserDetailServiceImpl implements UserDetailsService { +public class UserDetailServiceImpl implements UserDetailsService, IUserDetailCheckService { private static final Logger LOG = LoggerFactory.getLogger(UserDetailServiceImpl.class); diff --git a/login-base/src/main/resources/templates/default-home.html b/login-base/src/main/resources/templates/default-home.html index 160aa3d5..ec972235 100644 --- a/login-base/src/main/resources/templates/default-home.html +++ b/login-base/src/main/resources/templates/default-home.html @@ -180,7 +180,7 @@ {{userAdjustment.userName}} 变更了用户名为 {{userAdjustment.newValue}} - {{userAdjustment.userName}} 修改了密码 + {{userAdjustment.userName}} 修改了密码 {{userAdjustment.userName}} 重置了密码为 {{userAdjustment.newValue}} diff --git a/login-base/src/main/resources/templates/default-main.html b/login-base/src/main/resources/templates/default-main.html index f10505d9..c9795a7f 100644 --- a/login-base/src/main/resources/templates/default-main.html +++ b/login-base/src/main/resources/templates/default-main.html @@ -174,9 +174,7 @@ title: '修改密码', width: '400px', height: '290px', - onClose: function() { - window.location.href = 'oauth/logout'; - } + onClose: function() {} }); } diff --git a/login-base/src/main/resources/templates/log/list-department-adjustment.html b/login-base/src/main/resources/templates/log/list-department-adjustment.html new file mode 100644 index 00000000..0715220f --- /dev/null +++ b/login-base/src/main/resources/templates/log/list-department-adjustment.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/login-base/src/main/resources/templates/log/list-department-user-adjustment.html b/login-base/src/main/resources/templates/log/list-department-user-adjustment.html new file mode 100644 index 00000000..6e659a46 --- /dev/null +++ b/login-base/src/main/resources/templates/log/list-department-user-adjustment.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/login-base/src/main/resources/templates/log/list-login-log.html b/login-base/src/main/resources/templates/log/list-login-log.html new file mode 100644 index 00000000..3c95b188 --- /dev/null +++ b/login-base/src/main/resources/templates/log/list-login-log.html @@ -0,0 +1,181 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/login-base/src/main/resources/templates/log/list-user-adjustment.html b/login-base/src/main/resources/templates/log/list-user-adjustment.html new file mode 100644 index 00000000..6e0c6267 --- /dev/null +++ b/login-base/src/main/resources/templates/log/list-user-adjustment.html @@ -0,0 +1,210 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/service-menu/src/main/java/ink/wgink/module/menu/startup/ServiceMenuStartUp.java b/service-menu/src/main/java/ink/wgink/module/menu/startup/ServiceMenuStartUp.java index 68a10f7a..23911401 100644 --- a/service-menu/src/main/java/ink/wgink/module/menu/startup/ServiceMenuStartUp.java +++ b/service-menu/src/main/java/ink/wgink/module/menu/startup/ServiceMenuStartUp.java @@ -9,6 +9,7 @@ import ink.wgink.interfaces.permission.IPermissionCheckService; import ink.wgink.interfaces.position.IPositionCheckService; import ink.wgink.interfaces.role.IRoleCheckService; import ink.wgink.interfaces.user.IUserCheckService; +import ink.wgink.interfaces.user.IUserDetailCheckService; import ink.wgink.pojo.dtos.menu.MenuDTO; import ink.wgink.module.menu.dao.IMenuDao; import ink.wgink.util.UUIDUtil; @@ -55,6 +56,8 @@ public class ServiceMenuStartUp implements ApplicationRunner { private IPermissionCheckService permissionCheckService; @Autowired(required = false) private IRoleCheckService roleCheckService; + @Autowired(required = false) + private IUserDetailCheckService userDetailCheckService; @Override public void run(ApplicationArguments args) throws Exception { @@ -97,7 +100,8 @@ public class ServiceMenuStartUp implements ApplicationRunner { } initSystemManage(params, menuId); initUserPermissionManage(params, menuId); - initPermissionManager(params, menuId); + initPermissionManage(params, menuId); + initLogManage(params, menuId); } private void initSystemManage(Map params, String menuParentId) { @@ -404,7 +408,7 @@ public class ServiceMenuStartUp implements ApplicationRunner { * @param params * @param menuParentId */ - private void initPermissionManager(Map params, String menuParentId) { + private void initPermissionManage(Map params, String menuParentId) { if (permissionCheckService == null && roleCheckService == null) { return; } @@ -581,4 +585,156 @@ public class ServiceMenuStartUp implements ApplicationRunner { menuDao.save(params); } } + + /** + * 日志管理 + * + * @param params + * @param menuParentId + */ + private void initLogManage(Map params, String menuParentId) { + if (userDetailCheckService == null) { + return; + } + LOG.debug("初始化菜单:日志管理"); + params.remove("menuId"); + params.put("menuCode", "00010004"); + MenuDTO menuDTO = menuDao.getSimple(params); + String menuId; + if (menuDTO == null) { + menuId = UUIDUtil.getUUID(); + params.put("menuId", menuId); + params.put("menuParentId", menuParentId); + params.put("menuName", "日志管理"); + params.put("menuSummary", "日志管理"); + params.put("menuUrl", "javascript:void(0);"); + params.put("menuType", "1"); + params.put("menuIcon", "fa-icon-color-white fa fa-history"); + params.put("menuOrder", "4"); + params.put("menuStatus", "0"); + params.put("openType", "1"); + menuDao.save(params); + } else { + menuId = menuDTO.getMenuId(); + } + + initLoginLogManage(params, menuId); + initUserAdjustmentManage(params, menuId); + initDepartmentAdjustmentManage(params, menuId); + initDepartmentUserAdjustmentManage(params, menuId); + } + + /** + * 登录日志 + * + * @param params + * @param menuParentId + */ + private void initLoginLogManage(Map params, String menuParentId) { + LOG.debug("初始化菜单:登录日志"); + params.remove("menuId"); + params.put("menuCode", "000100040001"); + MenuDTO menuDTO = menuDao.getSimple(params); + String menuId; + if (menuDTO == null) { + menuId = UUIDUtil.getUUID(); + params.put("menuId", menuId); + params.put("menuParentId", menuParentId); + params.put("menuName", "登录日志"); + params.put("menuSummary", "登录日志"); + params.put("menuUrl", "/route/log/list-login-log"); + params.put("menuType", "1"); + params.put("menuIcon", "fa-icon-color-white fa fa-history"); + params.put("menuOrder", "1"); + params.put("menuStatus", "0"); + params.put("openType", "1"); + menuDao.save(params); + } + } + + /** + * 用户调整 + * + * @param params + * @param menuParentId + */ + private void initUserAdjustmentManage(Map params, String menuParentId) { + LOG.debug("初始化菜单:用户调整"); + params.remove("menuId"); + params.put("menuCode", "000100040002"); + MenuDTO menuDTO = menuDao.getSimple(params); + String menuId; + if (menuDTO == null) { + menuId = UUIDUtil.getUUID(); + params.put("menuId", menuId); + params.put("menuParentId", menuParentId); + params.put("menuName", "用户调整"); + params.put("menuSummary", "用户调整"); + params.put("menuUrl", "/route/log/list-user-adjustment"); + params.put("menuType", "1"); + params.put("menuIcon", "fa-icon-color-white fa fa-history"); + params.put("menuOrder", "2"); + params.put("menuStatus", "0"); + params.put("openType", "1"); + menuDao.save(params); + } + } + + /** + * 部门调整 + * + * @param params + * @param menuParentId + */ + private void initDepartmentAdjustmentManage(Map params, String menuParentId) { + LOG.debug("初始化菜单:部门调整"); + params.remove("menuId"); + params.put("menuCode", "000100040003"); + MenuDTO menuDTO = menuDao.getSimple(params); + String menuId; + if (menuDTO == null) { + menuId = UUIDUtil.getUUID(); + params.put("menuId", menuId); + params.put("menuParentId", menuParentId); + params.put("menuName", "部门调整"); + params.put("menuSummary", "部门调整"); + params.put("menuUrl", "/route/log/list-department-adjustment"); + params.put("menuType", "1"); + params.put("menuIcon", "fa-icon-color-white fa fa-history"); + params.put("menuOrder", "3"); + params.put("menuStatus", "0"); + params.put("openType", "1"); + menuDao.save(params); + } + } + + /** + * 部门用户调整 + * + * @param params + * @param menuParentId + */ + private void initDepartmentUserAdjustmentManage(Map params, String menuParentId) { + LOG.debug("初始化菜单:部门用户调整"); + params.remove("menuId"); + params.put("menuCode", "000100040004"); + MenuDTO menuDTO = menuDao.getSimple(params); + String menuId; + if (menuDTO == null) { + menuId = UUIDUtil.getUUID(); + params.put("menuId", menuId); + params.put("menuParentId", menuParentId); + params.put("menuName", "部门用户调整"); + params.put("menuSummary", "部门用户调整"); + params.put("menuUrl", "/route/log/list-department-user-adjustment"); + params.put("menuType", "1"); + params.put("menuIcon", "fa-icon-color-white fa fa-history"); + params.put("menuOrder", "4"); + params.put("menuStatus", "0"); + params.put("openType", "1"); + menuDao.save(params); + } + } + + } diff --git a/service-user/src/main/resources/templates/user/update-password.html b/service-user/src/main/resources/templates/user/update-password.html index 792cc150..9597994a 100644 --- a/service-user/src/main/resources/templates/user/update-password.html +++ b/service-user/src/main/resources/templates/user/update-password.html @@ -66,15 +66,12 @@ top.dialog.close(index); var loadLayerIndex; top.restAjax.put(top.restAjax.path('api/user/update-password', []), formData.field, null, function(code, data) { - var layerIndex = top.dialog.msg('修改成功,继续修改?窗口关闭后,需重新登录系统', { + var layerIndex = top.dialog.msg('修改成功,请重新登录系统', { time: 0, - btn: [top.dataMessage.button.yes, top.dataMessage.button.no], + btn: [top.dataMessage.button.yes], shade: 0.3, yes: function(index) { top.dialog.close(index); - window.location.reload(); - }, - btn2: function() { closeBox(); } });