|
@@ -307,13 +307,34 @@ public class AdminUserLogic {
|
|
// throw new RemoteServiceException("无法为用户赋予与自身级别相当的角色");
|
|
// throw new RemoteServiceException("无法为用户赋予与自身级别相当的角色");
|
|
// }
|
|
// }
|
|
//当前用户选择的部门
|
|
//当前用户选择的部门
|
|
- AdminWebsit adminWebsit = adminWebsitService.getById(newUser.getAdminWebsitId());
|
|
|
|
- if(adminWebsit == null){
|
|
|
|
- throw new RemoteServiceException("请选择部门");
|
|
|
|
- }
|
|
|
|
|
|
+ if (!StringUtil.isEmpty(newUser.getAdminWebsitId())) {
|
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(newUser.getAdminWebsitId());
|
|
|
|
+ if (adminWebsit == null) {
|
|
|
|
+ throw new RemoteServiceException("请选择部门");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (admin.getType() == 0 && !StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())) {
|
|
|
|
+ throw new RemoteServiceException("网点账号请选择普通网点");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!oldUser.getType().equals(AdminWebsitTypeEnum.A.getKey()) && StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
|
+ throw new RemoteServiceException("暂无权限创建当前网点的账号");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())){
|
|
|
|
+ newUser.setType(0);
|
|
|
|
+ }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.B.getKey())){
|
|
|
|
+ newUser.setType(1);
|
|
|
|
+ }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.A.getKey())){
|
|
|
|
+ newUser.setType(2);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ AdminDept adminDept = adminDeptService.getById(newUser.getAdminDeptId());
|
|
|
|
|
|
- if(admin.getType() == 0 && !StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.C.getKey())){
|
|
|
|
- throw new RemoteServiceException("网点账号请选择普通网点");
|
|
|
|
|
|
+ newUser.setCompanyWechatId(adminDept.getCompanyWechatId());
|
|
|
|
+ newUser.setCompanyName(adminDept.getCompanyWechatName());
|
|
|
|
+
|
|
|
|
+ newUser.setType(0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -323,17 +344,6 @@ public class AdminUserLogic {
|
|
newUser.setCompanyWechatId(oldUser.getCompanyWechatId());
|
|
newUser.setCompanyWechatId(oldUser.getCompanyWechatId());
|
|
newUser.updateById();
|
|
newUser.updateById();
|
|
|
|
|
|
- if(!oldUser.getType().equals(AdminWebsitTypeEnum.A.getKey()) && StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
|
- throw new RemoteServiceException("暂无权限创建当前网点的账号");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())){
|
|
|
|
- newUser.setType(0);
|
|
|
|
- }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.B.getKey())){
|
|
|
|
- newUser.setType(1);
|
|
|
|
- }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.A.getKey())){
|
|
|
|
- newUser.setType(2);
|
|
|
|
- }
|
|
|
|
|
|
|
|
//部门账号(商户账号在生成商户的时候已经处理了部门)
|
|
//部门账号(商户账号在生成商户的时候已经处理了部门)
|
|
if (newUser.getType() != 2) {
|
|
if (newUser.getType() != 2) {
|
|
@@ -341,6 +351,9 @@ public class AdminUserLogic {
|
|
this.addAdminUserWebsit(newUser);
|
|
this.addAdminUserWebsit(newUser);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //添加部门
|
|
|
|
+ this.addAdminUserDept(newUser);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|