|
@@ -330,6 +330,10 @@ public class AdminUserLogic {
|
|
|
throw new RemoteServiceException("只有超级管理员或商户账号才有重置密码的权限");
|
|
|
}
|
|
|
|
|
|
+ if (adminUser1.getAdminUserId().equals(adminUserId)) {
|
|
|
+ throw new RemoteServiceException("不能操作冻结账号");
|
|
|
+ }
|
|
|
+
|
|
|
//开始重置
|
|
|
AdminUser adminUser = adminUserService.getById(adminUserId);
|
|
|
adminUser.setPassword(MD5Utils.md5(password));
|
|
@@ -592,7 +596,20 @@ public class AdminUserLogic {
|
|
|
|
|
|
if (CollectionUtils.isEmpty(adminUserIdList))
|
|
|
return new Page<>();
|
|
|
+ }
|
|
|
|
|
|
+ // 角色获取用户id
|
|
|
+ List<String> roleUserIds = new ArrayList<>();
|
|
|
+ // 非商户主账号或者为网点账号时进入
|
|
|
+ if ((adminUser.getType() == 1 && !adminUser.getIsMaster()) || adminUser.getType() == 0) {
|
|
|
+ final List<AdminUser> adminUserList = adminUserService.lambdaQuery()
|
|
|
+ .select(AdminUser::getAdminUserId)
|
|
|
+ .eq(AdminUser::getRoleId, adminUser.getRoleId())
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isNotEmpty(adminUserList)) {
|
|
|
+ roleUserIds.addAll(adminUserList.stream().map(AdminUser::getAdminUserId).collect(Collectors.toList()));
|
|
|
+ this.queryUserIdByParentRoleId(roleUserIds, adminUser.getRoleId());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
IPage<AdminUser> page = adminUserService.lambdaQuery()
|
|
@@ -608,6 +625,7 @@ public class AdminUserLogic {
|
|
|
.and(CollectionUtils.isNotEmpty(adminUserIds),item -> item.in( AdminUser::getAdminUserId, adminUserIds)
|
|
|
.ne(AdminUser::getUserName,"admin")
|
|
|
)
|
|
|
+ .in(CollectionUtil.isNotEmpty(roleUserIds), AdminUser::getAdminUserId, roleUserIds)
|
|
|
.and(adminUser.getIsMaster() && adminUser.getType() == 0, v -> v.eq(AdminUser::getAdminUserId, adminUser.getAdminUserId())
|
|
|
.or()
|
|
|
.in(AdminUser::getMasterWebsitId, adminUser.getAdminWebsitIds()))
|
|
@@ -649,6 +667,30 @@ public class AdminUserLogic {
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据父角色查询子角色关联的用户id
|
|
|
+ * @param roleUserIds
|
|
|
+ * @param parentRoleId
|
|
|
+ */
|
|
|
+ private void queryUserIdByParentRoleId(List<String> roleUserIds, String parentRoleId) {
|
|
|
+ final List<AdminRole> subRoleList = adminRoleService.lambdaQuery()
|
|
|
+ .eq(AdminRole::getParentRoleId, parentRoleId)
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isNotEmpty(subRoleList)) {
|
|
|
+ final List<AdminUser> adminUserList = adminUserService.lambdaQuery()
|
|
|
+ .select(AdminUser::getAdminUserId)
|
|
|
+ .in(AdminUser::getRoleId, subRoleList.stream().map(AdminRole::getAdminRoleId).collect(Collectors.toList()))
|
|
|
+ .list();
|
|
|
+ if (CollectionUtil.isNotEmpty(adminUserList)) {
|
|
|
+ roleUserIds.addAll(adminUserList.stream().map(AdminUser::getAdminUserId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (AdminRole adminRole : subRoleList) {
|
|
|
+ this.queryUserIdByParentRoleId(roleUserIds, adminRole.getAdminRoleId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 账号列表
|