|
@@ -325,25 +325,21 @@ public class AdminUserLogic {
|
|
|
public void resetPassword(String adminUserId, String password, HttpServletRequest request) throws RemoteServiceException {
|
|
|
//检查是否拥有重置的密码权限
|
|
|
String nickName = CommonUtils.getNickName(request);
|
|
|
- AdminUserCom adminUser1 = commonLogic.getAdminUser();
|
|
|
-
|
|
|
+ AdminUserCom curAdminUser = commonLogic.getAdminUser();
|
|
|
|
|
|
AdminUser resetAdminUser = adminUserService.getById(adminUserId);
|
|
|
|
|
|
- if (resetAdminUser.getType() == 0
|
|
|
- && StringUtils.isNotBlank(resetAdminUser.getMasterWebsitId())) {
|
|
|
-
|
|
|
- }
|
|
|
- if (adminUser1.getType() == 0) {
|
|
|
- throw new RemoteServiceException("只有超级管理员或商户账号才有重置密码的权限");
|
|
|
- }
|
|
|
-
|
|
|
- if (adminUser1.getAdminUserId().equals(adminUserId)) {
|
|
|
- throw new RemoteServiceException("不能操作冻结账号");
|
|
|
- }
|
|
|
-
|
|
|
- if (adminUser1.getType() == 1 && adminUser1.getIsMaster()) {
|
|
|
-
|
|
|
+ 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("“商户账号”,超级管理员或商户主账号才有重置密码的权限");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//开始重置
|
|
@@ -474,14 +470,28 @@ public class AdminUserLogic {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void update(HttpServletRequest request, AdminUserAddReqBean newUser) {
|
|
|
|
|
|
- AdminUserCom admin = commonLogic.getAdminUser(request);
|
|
|
+ AdminUserCom curAdminUser = commonLogic.getAdminUser(request);
|
|
|
AdminUser oldUser = adminUserService.getById(newUser.getAdminUserId());
|
|
|
//需要用户roleId
|
|
|
- AdminRole loginRole = adminRoleService.getById(admin.getRoleId());
|
|
|
+ AdminRole loginRole = adminRoleService.getById(curAdminUser.getRoleId());
|
|
|
AdminRole addUserRole = null;
|
|
|
if (StringUtils.isBlank(newUser.getRoleId()) || (addUserRole = adminRoleService.getById(newUser.getRoleId())) == null) {
|
|
|
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()
|
|
|
&& StringUtils.isBlank(newUser.getVenderId())) {
|
|
@@ -498,11 +508,11 @@ public class AdminUserLogic {
|
|
|
throw new RemoteServiceException("请选择部门");
|
|
|
}
|
|
|
|
|
|
- if (adminWebsit.getType().equals(AdminWebsitTypeEnum.A.getKey()) && admin.getType() != 2) {
|
|
|
+ if (adminWebsit.getType().equals(AdminWebsitTypeEnum.A.getKey()) && curAdminUser.getType() != 2) {
|
|
|
throw new RemoteServiceException("当前账号非“平台”类型不能创建平台账号");
|
|
|
}
|
|
|
|
|
|
- if (admin.getType() == 0 && !StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())) {
|
|
|
+ if (curAdminUser.getType() == 0 && !StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())) {
|
|
|
throw new RemoteServiceException("网点账号请选择普通网点");
|
|
|
}
|
|
|
|
|
@@ -519,7 +529,7 @@ public class AdminUserLogic {
|
|
|
|
|
|
AdminDept adminDept = adminDeptService.getById(newUser.getAdminDeptId().get(0));
|
|
|
|
|
|
- if (!admin.getType().equals("2") && newUser.getAdminDeptId().contains("1")) {
|
|
|
+ if (!curAdminUser.getType().equals("2") && newUser.getAdminDeptId().contains("1")) {
|
|
|
throw new RemoteServiceException("不可选高于商户得平台权限");
|
|
|
}
|
|
|
|