|
@@ -329,18 +329,18 @@ public class AdminUserLogic {
|
|
|
|
|
|
AdminUser resetAdminUser = adminUserService.getById(adminUserId);
|
|
|
|
|
|
- if (!resetAdminUser.getAdminUserId().equals(curAdminUser.getAdminUserId())) {
|
|
|
- if (resetAdminUser.getType() == 0 && StringUtils.isNotBlank(resetAdminUser.getMasterWebsitId())) {
|
|
|
- // 网点账号并且是有归属的账号,只有超级管理员或商户主账号或网点主账号才有重置密码
|
|
|
- if ((curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) || (curAdminUser.getType() == 0 && !curAdminUser.getIsMaster())) {
|
|
|
- throw new RemoteServiceException("账号有”归属网点“属性,超级管理员或商户主账号或网点主账号才有重置密码的权限");
|
|
|
- }
|
|
|
-// } else if (resetAdminUser.getType() == 0 && curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
-// throw new RemoteServiceException("“网点账号”,超级管理员或商户主账号才有重置密码的权限");
|
|
|
- } else if (resetAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
- throw new RemoteServiceException("“商户账号”,超级管理员或商户主账号才有重置密码的权限");
|
|
|
- }
|
|
|
- }
|
|
|
+// if (!resetAdminUser.getAdminUserId().equals(curAdminUser.getAdminUserId())) {
|
|
|
+// if (resetAdminUser.getType() == 0 && StringUtils.isNotBlank(resetAdminUser.getMasterWebsitId())) {
|
|
|
+// // 网点账号并且是有归属的账号,只有超级管理员或商户主账号或网点主账号才有重置密码
|
|
|
+// if ((curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) || (curAdminUser.getType() == 0 && !curAdminUser.getIsMaster())) {
|
|
|
+// throw new RemoteServiceException("账号有”归属网点“属性,超级管理员或商户主账号或网点主账号才有重置密码的权限");
|
|
|
+// }
|
|
|
+//// } else if (resetAdminUser.getType() == 0 && curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
+//// throw new RemoteServiceException("“网点账号”,超级管理员或商户主账号才有重置密码的权限");
|
|
|
+// } else if (resetAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
+// throw new RemoteServiceException("“商户账号”,超级管理员或商户主账号才有重置密码的权限");
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
//开始重置
|
|
|
resetAdminUser.setPassword(MD5Utils.md5(password));
|
|
@@ -482,18 +482,18 @@ public class AdminUserLogic {
|
|
|
throw new RemoteServiceException("请为用户选择角色");
|
|
|
}
|
|
|
|
|
|
- if (!oldUser.getAdminUserId().equals(curAdminUser.getAdminUserId())) {
|
|
|
- if (oldUser.getType() == 0 && StringUtils.isNotBlank(oldUser.getMasterWebsitId())) {
|
|
|
- // 网点账号并且是有归属的账号,只有超级管理员或商户主账号或网点主账号才有重置密码
|
|
|
- if ((curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) || (curAdminUser.getType() == 0 && !curAdminUser.getIsMaster())) {
|
|
|
- throw new RemoteServiceException("账号有”归属网点“属性,超级管理员或商户主账号或网点主账号才有修改的权限");
|
|
|
- }
|
|
|
- } else if (oldUser.getType() == 0 && curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
- throw new RemoteServiceException("“网点账号”,超级管理员或商户主账号才有修改的权限");
|
|
|
- } else if (oldUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
- throw new RemoteServiceException("“商户账号”,超级管理员或商户主账号才有修改的权限");
|
|
|
- }
|
|
|
- }
|
|
|
+// if (!oldUser.getAdminUserId().equals(curAdminUser.getAdminUserId())) {
|
|
|
+// if (oldUser.getType() == 0 && StringUtils.isNotBlank(oldUser.getMasterWebsitId())) {
|
|
|
+// // 网点账号并且是有归属的账号,只有超级管理员或商户主账号或网点主账号才有重置密码
|
|
|
+// if ((curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) || (curAdminUser.getType() == 0 && !curAdminUser.getIsMaster())) {
|
|
|
+// throw new RemoteServiceException("账号有”归属网点“属性,超级管理员或商户主账号或网点主账号才有修改的权限");
|
|
|
+// }
|
|
|
+// } else if (oldUser.getType() == 0 && curAdminUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
+// throw new RemoteServiceException("“网点账号”,超级管理员或商户主账号才有修改的权限");
|
|
|
+// } else if (oldUser.getType() == 1 && !curAdminUser.getIsMaster()) {
|
|
|
+// throw new RemoteServiceException("“商户账号”,超级管理员或商户主账号才有修改的权限");
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
if (Objects.nonNull(newUser.getIsVender())
|
|
|
&& newUser.getIsVender()
|
|
@@ -602,10 +602,6 @@ public class AdminUserLogic {
|
|
|
if (adminUser.getType() != 2) {
|
|
|
companyWechatId = adminUser.getAdminCompanyWechat().getCompanyWechatId();
|
|
|
}
|
|
|
- if (adminUser.getIsMaster() && adminUser.getType() == 0) {
|
|
|
- // 网点主账号能看到账号
|
|
|
- }
|
|
|
-
|
|
|
List<String> adminUserIds = new ArrayList<>();
|
|
|
if (!StringUtil.isEmpty(websitId)) {
|
|
|
List<String> adminUserIdList = adminUserWebsitRelaService.lambdaQuery().eq(AdminUserWebsitRela::getAdminWebsitId, websitId).select(AdminUserWebsitRela::getAdminUserId)
|
|
@@ -623,26 +619,38 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
|
|
|
// 网点获取用户id
|
|
|
- List<String> websitUserIds = new ArrayList<>();
|
|
|
+ Set<String> websitUserIds = new HashSet<>();
|
|
|
// 非主账号并且为商户账号类型时进入
|
|
|
if (adminUser.getType() == 1 && !adminUser.getIsMaster()) {
|
|
|
- final List<AdminUserWebsitRela> adminUserList = adminUserWebsitRelaService.lambdaQuery()
|
|
|
+ // 查询出当前账号分配的网点有关联账号
|
|
|
+ List<AdminUserWebsitRela> adminUserList = adminUserWebsitRelaService.lambdaQuery()
|
|
|
.select(AdminUserWebsitRela::getAdminUserId)
|
|
|
.eq(AdminUserWebsitRela::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
.in(AdminUserWebsitRela::getAdminWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .groupBy(AdminUserWebsitRela::getAdminUserId)
|
|
|
.list();
|
|
|
if (CollectionUtil.isNotEmpty(adminUserList)) {
|
|
|
- final List<AdminUser> userList = adminUserService.lambdaQuery()
|
|
|
+ websitUserIds = adminUserList.stream().map(AdminUserWebsitRela::getAdminUserId).collect(Collectors.toSet());
|
|
|
+ // 加入商户主账号以外的所有商户类型账号
|
|
|
+ List<AdminUser> userLevelTypeList = adminUserService.lambdaQuery()
|
|
|
+ .select(AdminUser::getAdminUserId)
|
|
|
+ .eq(AdminUser::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
+ .eq(AdminUser::getType, 1)
|
|
|
+ .eq(AdminUser::getIsMaster, false)
|
|
|
+ .list();
|
|
|
+
|
|
|
+ websitUserIds.addAll(userLevelTypeList.stream().map(AdminUser::getAdminUserId).collect(Collectors.toSet()));
|
|
|
+
|
|
|
+ // 过滤出商户主账号
|
|
|
+ List<AdminUser> userList = adminUserService.lambdaQuery()
|
|
|
.eq(AdminUser::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
.eq(AdminUser::getType, 1)
|
|
|
.eq(AdminUser::getIsMaster, true)
|
|
|
.list();
|
|
|
- final List<String> masterUserIds = userList.stream().map(AdminUser::getAdminUserId).collect(Collectors.toList());
|
|
|
- websitUserIds = adminUserList.stream()
|
|
|
- .map(AdminUserWebsitRela::getAdminUserId)
|
|
|
+ List<String> masterUserIds = userList.stream().map(AdminUser::getAdminUserId).collect(Collectors.toList());
|
|
|
+ websitUserIds = websitUserIds.stream()
|
|
|
.filter(adminUserId -> !masterUserIds.contains(adminUserId))
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
+ .collect(Collectors.toSet());
|
|
|
}
|
|
|
}
|
|
|
|