From bd9f3d7178a56be201a9cdd2f54bdf7e627abcc1 Mon Sep 17 00:00:00 2001 From: penggle Date: Thu, 11 May 2017 18:43:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xproject/admin/consts/AdminConstants.java | 2 +- .../controller/AdminUserMgtController.java | 8 +- .../src/main/webapp/admin/user/index.html | 49 +++++- .../main/webapp/resources/css/admin-login.css | 1 + .../resources/images/default-user-avatar.png | Bin 0 -> 6888 bytes .../resources/images/default-user-icon.png | Bin 4626 -> 0 bytes .../resources/scripts/admin/user/index.js | 148 ++++++++++++++++-- .../xproject/admin/dao/AdminUserDAO.java | 8 + .../admin/dao/impl/AdminUserDAOImpl.java | 8 +- .../service/impl/AdminRoleServiceImpl.java | 3 +- .../service/impl/AdminUserServiceImpl.java | 3 +- .../mybatis/mapper/AdminUserMapper.xml | 5 + 12 files changed, 211 insertions(+), 24 deletions(-) create mode 100644 xproject-admin/src/main/webapp/resources/images/default-user-avatar.png delete mode 100644 xproject-admin/src/main/webapp/resources/images/default-user-icon.png diff --git a/xproject-admin/src/main/java/com/certusnet/xproject/admin/consts/AdminConstants.java b/xproject-admin/src/main/java/com/certusnet/xproject/admin/consts/AdminConstants.java index 904c937..05c6d38 100644 --- a/xproject-admin/src/main/java/com/certusnet/xproject/admin/consts/AdminConstants.java +++ b/xproject-admin/src/main/java/com/certusnet/xproject/admin/consts/AdminConstants.java @@ -14,7 +14,7 @@ public class AdminConstants extends AbstractConstants { /** * 用户默认头像 */ - public static final String DEFAULT_USER_ICON = valueOf("/resources/images/default-user-icon.png"); + public static final String DEFAULT_USER_AVATAR = valueOf("/resources/images/default-user-avatar.png"); /** * 用户头像默认保存路径,相对于#GlobalConstants.IMAGE_SERVER_ROOT diff --git a/xproject-admin/src/main/java/com/certusnet/xproject/admin/web/controller/AdminUserMgtController.java b/xproject-admin/src/main/java/com/certusnet/xproject/admin/web/controller/AdminUserMgtController.java index fda4221..af7deef 100644 --- a/xproject-admin/src/main/java/com/certusnet/xproject/admin/web/controller/AdminUserMgtController.java +++ b/xproject-admin/src/main/java/com/certusnet/xproject/admin/web/controller/AdminUserMgtController.java @@ -85,7 +85,7 @@ public Object addUser(HttpServletRequest request, HttpServletResponse response, userAddForm.setUserType(AdminUserTypeEnum.ADMIN_USER_TYPE_NORMAL.getTypeCode()); if(StringUtils.isEmpty(userAddForm.getUserIcon())){ - userAddForm.setUserIcon(AdminConstants.DEFAULT_USER_ICON); + userAddForm.setUserIcon(AdminConstants.DEFAULT_USER_AVATAR); }else{ String userIcon = userAddForm.getUserIcon(); if(userIcon.toLowerCase().startsWith(GlobalConstants.DEFAULT_UPLOAD_SAVE_PATH)){ @@ -115,7 +115,7 @@ public Object editUser(HttpServletRequest request, HttpServletResponse response, userEditForm.setUpdateTime(DateTimeUtils.formatNow()); if(StringUtils.isEmpty(userEditForm.getUserIcon())){ - userEditForm.setUserIcon(AdminConstants.DEFAULT_USER_ICON); + userEditForm.setUserIcon(AdminConstants.DEFAULT_USER_AVATAR); }else{ String userIcon = userEditForm.getUserIcon(); if(userIcon.toLowerCase().startsWith(GlobalConstants.DEFAULT_UPLOAD_SAVE_PATH)){ @@ -138,9 +138,9 @@ public Object editUser(HttpServletRequest request, HttpServletResponse response, * @return */ @RequestMapping(value="/admin/user/del") - public Object delUser(HttpServletRequest request, HttpServletResponse response, Long userId) { + public Object delUser(HttpServletRequest request, HttpServletResponse response, Long id) { AdminUser user = new AdminUser(); - user.setUserId(userId); + user.setUserId(id); adminUserService.deleteUserById(user); return genSuccessResult("删除成功!", null); } diff --git a/xproject-admin/src/main/webapp/admin/user/index.html b/xproject-admin/src/main/webapp/admin/user/index.html index 448f621..f4c5fdf 100644 --- a/xproject-admin/src/main/webapp/admin/user/index.html +++ b/xproject-admin/src/main/webapp/admin/user/index.html @@ -113,7 +113,7 @@

@@ -124,6 +124,7 @@

查看详情 修改用户 + 修改密码 配置用户角色 删除用户 @@ -379,6 +380,52 @@

关 闭 + + 修改用户密码 +
+ + + + + + {{changePwdForm.userName}} + + + + + + + + + + + + + +

由6~20位个字母或数字组成.

+
+
+
+
+ + + + + + + +

请再次确认您输入的密码.

+
+
+
+
+
+
+
+ 取 消 + 确 定 +
+
diff --git a/xproject-admin/src/main/webapp/resources/css/admin-login.css b/xproject-admin/src/main/webapp/resources/css/admin-login.css index 7950899..262141b 100644 --- a/xproject-admin/src/main/webapp/resources/css/admin-login.css +++ b/xproject-admin/src/main/webapp/resources/css/admin-login.css @@ -108,6 +108,7 @@ html, body, .el-container { float: right; font-size: 12px; color: #999; + line-height: 30px; } .admin-login-forgotpwd:hover { color: #337ab7; diff --git a/xproject-admin/src/main/webapp/resources/images/default-user-avatar.png b/xproject-admin/src/main/webapp/resources/images/default-user-avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..d77bd4cf8888890bf3d1e8c452c63b0b7a6c8254 GIT binary patch literal 6888 zcmVP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D8huGbK~#8N?Og|W z6=k~4?%ln6cke1S^~~ufg#-c!h`K5Yx@+5AT{|KwQlus%Aq3DxQ9+~=K&c^xKtd9V zARt9Lp_foXODG~pAf)%?z2EoG97y6Mgk(-Y_kPdwJ}2kQKQrI|&NuJ>{beRj_nO&k zw)-s>i@{(pKd(1hKh~Sf%k+BlPRVFFrZZSC>Gb9zon$J}8!T7#2HPov!MfXEvaOK} z)+t7#t-HI?%ZGMu=H%4j_sSvv-`LD%vzK0PecfQNjg=(pdP#4+VlY}^Fxu)3$zaab z8?4Dh{B+4^>!sIQI(BjD@;l{}|2d}9=_I|$vmZs|8X`8G$uXI|VKjLWJc%rZI*D}w zAA=zu(-V^3c15qZ?WBu2T9PcSeSLlZTXE&rXCw)KU^y_FEb~YLuE=EAiB%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RB?C)i1_^I30FnbGsI=iW_7h zrTIp?Wf@?qq$hKWeGH|&44GH5)*QB#)D%j}%i*4_$4{wcbjNFqshP($>0LCmKa1Cs zz!FR)Pp?SSV_HNBCWh%SCq^gg%(zg3cf)m+UzJ@3S*9UcFB^ic_a-1el^UL}TRR>4z9@R}48 z9HaCku#}F)_>uBcB6!G`;**O8tWGjv5((xJu;da8t{FMp-ewxY8>sD{Q;j&1W55ks z0$D6W%eIF2n>;KiI%HPiCT$RcZqoXjMdB%Hucu{X6B+qQtR53cz-033x5*~VjII$p zBdSE)fXOsh*~4>%U;_>3Qv4@Whc6NgB$PzbO?0BRTrv$fdEJO~@@kb>l6Zrovd2a? z=wXJkvO2FUXP7H1kZUMMRH2bPZ^n$~iwT zmh*ai5K)X-G|V@o=t!VhY-G|)%b^!bP|fQl>ab4#wzC@l2hI8hN3E_Jr2qf`07*qo IM6N<$g0g_>vj6}9 diff --git a/xproject-admin/src/main/webapp/resources/scripts/admin/user/index.js b/xproject-admin/src/main/webapp/resources/scripts/admin/user/index.js index 126de78..40a7a83 100644 --- a/xproject-admin/src/main/webapp/resources/scripts/admin/user/index.js +++ b/xproject-admin/src/main/webapp/resources/scripts/admin/user/index.js @@ -1,5 +1,9 @@ var ADMIN_USER_TYPE_SYSTEM = 0; var IMAGE_TYPES = ['image/jpeg', 'image/jpg', 'image/png']; +var USER_STATUS = { + 1: '启用', + 0: '禁用' +}; var vm = null; Vue.onDocumentReady(function() { vm = new Vue({ @@ -24,6 +28,7 @@ Vue.onDocumentReady(function() { userList: [], editDialogVisible: false, viewConfigDialogVisible: false, + changePwdDialogVisible: false, viewConfigActiveTabName: 'userDetail', uploadHeaders: { Accept: 'application/json' @@ -66,6 +71,12 @@ Vue.onDocumentReady(function() { lastLoginTime: '', loginTimes: '' }, + changePwdForm: { + userId: '', + userName: '', + password: '', + repassword: '' + }, userEditRules: { userName: [{ required: true, @@ -119,6 +130,32 @@ Vue.onDocumentReady(function() { message: 'EMAIL不合法!' }] }, + changePwdRules: { + password: [{ + required: true, + message: '请输入账户密码!' + },{ + validator: regex, + regex: /^[a-zA-Z0-9]{6,20}$/, + message: '账户密码由6~20个字母或数字组成!' + }], + repassword: [{ + required: true, + message: '请再次输入账户密码!' + },{ + validator: regex, + regex: /^[a-zA-Z0-9]{6,20}$/, + message: '账户密码由6~20个字母或数字组成!' + },{ + validator: equalTo, + compareTarget: { + vue: 'vm', + form: 'changePwdForm', + field: 'password' + }, + message: '两次密码不一致!' + }] + }, roleQuering: false, userRoleQueryForm: { userId: '', @@ -259,6 +296,8 @@ Vue.onDocumentReady(function() { this.deleteUser(row); }else if(cmd == 'conf'){ this.openUserViewConfigDialog(cmd, row); + }else if(cmd == 'changepwd'){ + this.openChangePwdDialog(cmd, row); } }, openUserEditDialog: function(cmd, row){ @@ -274,6 +313,10 @@ Vue.onDocumentReady(function() { } this.editDialogVisible = true; }, + closeEditDialog: function(){ + this.editDialogVisible = false; + this.$refs.userEditForm.resetFields(); + }, openUserViewConfigDialog: function(cmd, row){ this.currentActionType = cmd; this.userViewConfigForm.userId = row.userId; @@ -302,6 +345,26 @@ Vue.onDocumentReady(function() { } this.viewConfigDialogVisible = true; }, + closeUserViewConfigDialog: function(){ + this.viewConfigDialogVisible = false; + this.resetUserRoleQueryForm(); + this.userRoleList = []; + if(this.currentActionType == 'conf'){ + this.resetRoleQueryForm(); + this.roleList = []; + this.selectedRoleIds = []; + } + }, + openChangePwdDialog: function(cmd, row){ + this.currentActionType = cmd; + this.changePwdForm.userId = row.userId; + this.changePwdForm.userName = row.userName; + this.changePwdDialogVisible = true; + }, + closeChangePwdDialog: function(){ + this.changePwdDialogVisible = false; + this.$refs.changePwdForm.resetFields(); + }, saveUser: function(){ var url = ''; if(this.currentActionType == 'add'){ @@ -364,10 +427,77 @@ Vue.onDocumentReady(function() { }); } }, - closeEditDialog: function(){ - this.editDialogVisible = false; - this.$refs.userEditForm.resetFields(); - }, + changePasswd: function(){ + var url = ADMIN_CONTEXT_PATH + '/admin/user/changepwd/submit?forceUpdate=true'; + var _this = this; + this.$refs.changePwdForm.validate(function(valid){ + if(valid && !_this.submiting){ + _this.$confirm('你确定要修改该用户的密码?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + callback: function(action, instance){ + if(action == 'confirm'){ + _this.submiting = true; + setTimeout(function(){ + axios.post(url, _this.changePwdForm).then(function(response){ + _this.submiting = false; + var result = response.data; + if(result.success){ + _this.closeChangePwdDialog(); + _this.$message.success('修改成功!'); + }else{ + _this.$message.error(result.message); + } + }).catch(function(error){ + _this.submiting = false; + _this.$message.error('请求出错!'); + }); + }, 1500); + } + } + }); + }else{ + return false; + } + }); + }, + changeUserStatus: function(event, row){ + if(ADMIN_USER_TYPE_SYSTEM == row.userType){ + this.$message.error('系统用户禁止此操作!'); + }else{ + //var switchVm = event.currentTarget.__vue__; + var targetStatus = row.status == 1 ? 0 : 1; + var url = ''; + if(targetStatus == 1){ + url = ADMIN_CONTEXT_PATH + '/admin/user/enable?userId=' + row.userId; + }else{ + url = ADMIN_CONTEXT_PATH + '/admin/user/disable?userId=' + row.userId; + } + this.$confirm('你确定要' + USER_STATUS[targetStatus] + '该用户?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + callback: function(action, instance){ + if(action == 'confirm'){ + axios.get(url).then(function(response){ + var result = response.data; + if(result.success){ + //_this.$message.success('操作成功!'); + row.status = targetStatus; + }else{ + _this.$message.error(result.message); + } + }).catch(function(error){ + _this.$message.error('请求出错!'); + }); + } + } + }); + } + event.preventDefault(); + return false; + }, queryUserRoleList: function(loading){ this.userRoleQueryForm.userId = this.userViewConfigForm.userId; var _this = this; @@ -445,16 +575,6 @@ Vue.onDocumentReady(function() { resetRoleQueryForm: function(){ this.$refs.roleQueryForm.resetFields(); }, - closeUserViewConfigDialog: function(){ - this.viewConfigDialogVisible = false; - this.resetUserRoleQueryForm(); - this.userRoleList = []; - if(this.currentActionType == 'conf'){ - this.resetRoleQueryForm(); - this.roleList = []; - this.selectedRoleIds = []; - } - }, delUserRoleConfig: function(){ if(this.selectedRoleIds.length){ var userId = this.userViewConfigForm.userId; diff --git a/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/AdminUserDAO.java b/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/AdminUserDAO.java index 8689345..4ff58c2 100644 --- a/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/AdminUserDAO.java +++ b/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/AdminUserDAO.java @@ -123,6 +123,14 @@ public interface AdminUserDAO */ public void deleteUserRoles(Long userId, List roleIdList); + /** + * 删除用户的所有角色 + * + * @param userId + * @param roleIdList + */ + public void deleteUserAllRoles(Long userId); + /** * 根据用户名获取用户信息 * diff --git a/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/impl/AdminUserDAOImpl.java b/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/impl/AdminUserDAOImpl.java index e824314..0649993 100644 --- a/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/impl/AdminUserDAOImpl.java +++ b/xproject-service/src/main/java/com/certusnet/xproject/admin/dao/impl/AdminUserDAOImpl.java @@ -98,10 +98,14 @@ public void deleteUserRoles(Long userId, List roleIdList) { Map paramMap = new HashMap(); paramMap.put("userId", userId); paramMap.put("roleIdList", roleIdList); - getSqlSessionTemplate().insert(getMapperKey("deleteUserRoles"), paramMap); + getSqlSessionTemplate().delete(getMapperKey("deleteUserRoles"), paramMap); } - public AdminUser getUserByUserName(String userName, boolean fatUser) { + public void deleteUserAllRoles(Long userId) { + getSqlSessionTemplate().delete(getMapperKey("deleteUserAllRoles"), userId); + } + + public AdminUser getUserByUserName(String userName, boolean fatUser) { if (fatUser) { return getSqlSessionTemplate().selectOne(getMapperKey("getUserByUserName"), userName, new AdminUserModelHandler()); } diff --git a/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminRoleServiceImpl.java b/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminRoleServiceImpl.java index 3bd2502..abe1ea4 100644 --- a/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminRoleServiceImpl.java +++ b/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminRoleServiceImpl.java @@ -59,7 +59,8 @@ public void deleteRoleById(Long roleId) { ValidationAssert.notNull(role, "该角色已经不存在了!"); BusinessAssert.isTrue(!AdminRoleTypeEnum.ADMIN_ROLE_TYPE_SYSTEM.getTypeCode().equals(role.getRoleType()), "删除角色失败,系统角色不允许删除!"); BusinessAssert.isTrue(!role.isInuse(), "删除角色失败,该角色已经在使用不允许删除!"); - roleDAO.deleteRoleById(roleId); + roleDAO.deleteRoleById(roleId); //删除角色信息 + roleDAO.deleteRoleResourcesByRoleId(roleId); //删除该角色下的所有资源关系 } public AdminRole getRoleById(Long roleId) { diff --git a/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminUserServiceImpl.java b/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminUserServiceImpl.java index f6e5ac3..12072ad 100644 --- a/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminUserServiceImpl.java +++ b/xproject-service/src/main/java/com/certusnet/xproject/admin/service/impl/AdminUserServiceImpl.java @@ -86,7 +86,8 @@ public void deleteUserById(AdminUser user) { ValidationAssert.notNull(puser, "该用户已经不存在了!"); BusinessAssert.isTrue(!AdminUserTypeEnum.ADMIN_USER_TYPE_SYSTEM.getTypeCode().equals(puser.getUserType()), "系统级用户不能被删除!"); user.setUserName(puser.getUserName()); - userDAO.deleteUserById(user.getUserId()); + userDAO.deleteUserById(user.getUserId()); //删除用户信息 + userDAO.deleteUserAllRoles(user.getUserId()); //删除用户的所有角色关系 } @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) diff --git a/xproject-service/src/main/resources/mybatis/mapper/AdminUserMapper.xml b/xproject-service/src/main/resources/mybatis/mapper/AdminUserMapper.xml index 7355ac1..ac428d7 100644 --- a/xproject-service/src/main/resources/mybatis/mapper/AdminUserMapper.xml +++ b/xproject-service/src/main/resources/mybatis/mapper/AdminUserMapper.xml @@ -215,6 +215,11 @@ + + DELETE a FROM admin_user_role a + WHERE a.user_id = #{userId, jdbcType=BIGINT} + + DELETE a FROM admin_user_role a WHERE a.user_id = #{userId, jdbcType=BIGINT}