|
@@ -113,17 +113,17 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
//如果是admin操作非admin账号登陆不需要判断密码是否正确
|
|
|
AdminUserCom adminUser1 = commonLogic.getAdminUser();
|
|
|
- if(adminUser1 == null || !(adminUser1.getUserName().equals("admin")) && !StringUtils.equals(userName,"admin")) {
|
|
|
+ if (adminUser1 == null || !(adminUser1.getUserName().equals("admin")) && !StringUtils.equals(userName, "admin")) {
|
|
|
|
|
|
String value = (String) redisUtil.get(RedisPrefixEnum.TOKEN_VERIFICATION + code);
|
|
|
- if(StringUtils.isBlank(value)){
|
|
|
+ if (StringUtils.isBlank(value)) {
|
|
|
throw new RemoteServiceException("验证码过期,请刷新验证码重试");
|
|
|
}
|
|
|
if (!value.equals(codeValue)) {
|
|
|
throw new RemoteServiceException("验证码错误");
|
|
|
}
|
|
|
|
|
|
- if(adminUser.getLoginErrNum() >= 3){
|
|
|
+ if (adminUser.getLoginErrNum() >= 3) {
|
|
|
throw new RemoteServiceException("登陆失败,您已连续输入错误3次密码,请联系管理人员重置密码");
|
|
|
}
|
|
|
|
|
@@ -144,7 +144,7 @@ public class AdminUserLogic {
|
|
|
adminUser.updateById();
|
|
|
|
|
|
String token = JwtUtils.createJWT(adminUser.getAdminUserId(), adminUser.getNickName(), adminUser.getUserName(), 20 * 60 * 60 * 1000);
|
|
|
- AdminUserCom adminUserCom = commonLogic.getAdminUser(adminUser.getAdminUserId(),token);
|
|
|
+ AdminUserCom adminUserCom = commonLogic.getAdminUser(adminUser.getAdminUserId(), token);
|
|
|
adminUserCom.setToken(token);
|
|
|
//存放到redis
|
|
|
redisUtil.set(RedisPrefixEnum.TOKEN_MGR.toString() + adminUserCom.getToken(), adminUserCom, 20 * 60 * 60 * 1000);
|
|
@@ -199,7 +199,7 @@ public class AdminUserLogic {
|
|
|
* 新增帐号
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void add(AdminUserAddReqBean adminUser,Boolean addMch) throws RemoteServiceException {
|
|
|
+ public void add(AdminUserAddReqBean adminUser, Boolean addMch) throws RemoteServiceException {
|
|
|
AdminUserCom curAdminUser = commonLogic.getAdminUser();
|
|
|
if (StringUtils.isBlank(adminUser.getUserName()) || StringUtils.isBlank(adminUser.getPassword())) {
|
|
|
throw new RemoteServiceException("参数错误");
|
|
@@ -228,26 +228,26 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
|
|
|
//是否为入驻商户
|
|
|
- if(addMch){
|
|
|
+ if (addMch) {
|
|
|
adminUser.setType(1);
|
|
|
- }else{
|
|
|
- if(!curAdminUser.getType().equals(AdminWebsitTypeEnum.A.getKey()) && StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
+ } else {
|
|
|
+ if (!curAdminUser.getType().equals(AdminWebsitTypeEnum.A.getKey()) && StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
throw new RemoteServiceException("暂无权限创建当前网点的账号");
|
|
|
}
|
|
|
- if(StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())){
|
|
|
+ if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())) {
|
|
|
adminUser.setType(0);
|
|
|
- }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.B.getKey())){
|
|
|
+ } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.B.getKey())) {
|
|
|
adminUser.setType(1);
|
|
|
- }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.A.getKey())){
|
|
|
+ } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
adminUser.setType(2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if (!CollectionUtils.isEmpty(adminUser.getAdminDeptId())){
|
|
|
+ if (!CollectionUtils.isEmpty(adminUser.getAdminDeptId())) {
|
|
|
AdminDept adminDept = adminDeptService.getById(adminUser.getAdminDeptId().get(0));
|
|
|
|
|
|
- if (!curAdminUser.getType().equals("2") && adminDept.getAdminDeptId().equals("1")){
|
|
|
+ if (!curAdminUser.getType().equals("2") && adminDept.getAdminDeptId().equals("1")) {
|
|
|
throw new RemoteServiceException("不可选高于商户得平台权限");
|
|
|
}
|
|
|
|
|
@@ -322,8 +322,8 @@ public class AdminUserLogic {
|
|
|
// throw new RemoteServiceException("无法为用户赋予与自身级别相当的角色");
|
|
|
// }
|
|
|
//当前用户选择的部门
|
|
|
-/* if (!CollectionUtils.isEmpty(newUser.getAdminWebsitId())) {
|
|
|
- AdminWebsit adminWebsit = adminWebsitService.getById(newUser.getAdminWebsitId());
|
|
|
+ if (!CollectionUtils.isEmpty(newUser.getAdminWebsitId())) {
|
|
|
+ AdminWebsit adminWebsit = adminWebsitService.getById(newUser.getAdminWebsitId().get(0));
|
|
|
if (adminWebsit == null) {
|
|
|
throw new RemoteServiceException("请选择部门");
|
|
|
}
|
|
@@ -336,34 +336,36 @@ public class AdminUserLogic {
|
|
|
throw new RemoteServiceException("网点账号请选择普通网点");
|
|
|
}
|
|
|
|
|
|
- if(!oldUser.getType().equals(AdminWebsitTypeEnum.A.getKey()) && StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
+ 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())){
|
|
|
+ if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.C.getKey())) {
|
|
|
newUser.setType(0);
|
|
|
- }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.B.getKey())){
|
|
|
+ } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.B.getKey())) {
|
|
|
newUser.setType(1);
|
|
|
- }else if(StringUtils.equals(adminWebsit.getType(),AdminWebsitTypeEnum.A.getKey())){
|
|
|
+ } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
|
|
|
newUser.setType(2);
|
|
|
}
|
|
|
- }else {
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CollectionUtils.isEmpty(newUser.getAdminDeptId())) {
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(newUser.getAdminDeptId())) {
|
|
|
|
|
|
+ AdminDept adminDept = adminDeptService.getById(newUser.getAdminDeptId().get(0));
|
|
|
|
|
|
- if (!StringUtil.isEmpty(newUser.getAdminDeptId())){
|
|
|
- if (!admin.getType().equals("2") && newUser.getAdminDeptId().equals("1")){
|
|
|
+ if (!admin.getType().equals("2") && newUser.getAdminDeptId().contains("1")) {
|
|
|
throw new RemoteServiceException("不可选高于商户得平台权限");
|
|
|
}
|
|
|
|
|
|
- AdminDept adminDept = adminDeptService.getById(newUser.getAdminDeptId());
|
|
|
|
|
|
- newUser.setCompanyWechatId(adminDept.getCompanyWechatId());
|
|
|
- newUser.setCompanyName(adminDept.getCompanyWechatName());
|
|
|
+ newUser.setCompanyWechatId(adminDept.getCompanyWechatId());
|
|
|
+ newUser.setCompanyName(adminDept.getCompanyWechatName());
|
|
|
|
|
|
- newUser.setType(0);
|
|
|
+ newUser.setType(0);
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
|
|
|
newUser.setRoleName(addUserRole.getName());
|
|
@@ -373,8 +375,8 @@ public class AdminUserLogic {
|
|
|
newUser.updateById();
|
|
|
|
|
|
|
|
|
- adminUserWebsitRelaService.lambdaUpdate().eq(AdminUserWebsitRela::getAdminUserId,newUser.getAdminUserId()).remove();
|
|
|
- adminUserDeptRelaService.lambdaUpdate().eq(AdminUserDeptRela::getAdminUserId,newUser.getAdminUserId()).remove();
|
|
|
+ adminUserWebsitRelaService.lambdaUpdate().eq(AdminUserWebsitRela::getAdminUserId, newUser.getAdminUserId()).remove();
|
|
|
+ adminUserDeptRelaService.lambdaUpdate().eq(AdminUserDeptRela::getAdminUserId, newUser.getAdminUserId()).remove();
|
|
|
|
|
|
//部门账号(商户账号在生成商户的时候已经处理了部门)
|
|
|
if (newUser.getType() != 2) {
|
|
@@ -440,25 +442,22 @@ public class AdminUserLogic {
|
|
|
AdminUserDeptRela adminUserDeptRela = adminUserDeptRelaService.lambdaQuery().eq(AdminUserDeptRela::getAdminUserId, record.getAdminUserId()).last("limit 1").one();
|
|
|
|
|
|
|
|
|
-
|
|
|
- if (adminUserDeptRela != null){
|
|
|
+ if (adminUserDeptRela != null) {
|
|
|
|
|
|
AdminDept adminDept = adminDeptService.getById(adminUserDeptRela.getAdminDeptId());
|
|
|
|
|
|
record.setDeptWebsitName(adminDept.getDeptName());
|
|
|
|
|
|
- }else if (adminUserWebsitRela != null){
|
|
|
+ } else if (adminUserWebsitRela != null) {
|
|
|
|
|
|
AdminWebsit adminWebsit = adminWebsitService.getById(adminUserWebsitRela.getAdminWebsitId());
|
|
|
record.setDeptWebsitName(adminWebsit.getName());
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -466,9 +465,9 @@ public class AdminUserLogic {
|
|
|
/**
|
|
|
* 账号列表
|
|
|
*/
|
|
|
- public IPage<AdminUser> list(String companyWechatId,String userName, String nickName, String linkPhone, String email, Boolean status, Integer pageNum, Integer pageSize) {
|
|
|
+ public IPage<AdminUser> list(String companyWechatId, String userName, String nickName, String linkPhone, String email, Boolean status, Integer pageNum, Integer pageSize) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
- IPage<AdminUser> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize), userName, nickName, linkPhone, email, status,companyWechatId,adminUser.getCompanyWechatIds());
|
|
|
+ IPage<AdminUser> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize), userName, nickName, linkPhone, email, status, companyWechatId, adminUser.getCompanyWechatIds());
|
|
|
return adminUserIPage;
|
|
|
}
|
|
|
|
|
@@ -562,7 +561,7 @@ public class AdminUserLogic {
|
|
|
adminUserBean.setAdminDeptId(deptIds);
|
|
|
|
|
|
List<AdminDeptWebsit> adminDeptWebsitList = adminDeptWebsitService.lambdaQuery()
|
|
|
- .in(AdminDeptWebsit::getAdminDeptId,deptIds).list();
|
|
|
+ .in(AdminDeptWebsit::getAdminDeptId, deptIds).list();
|
|
|
|
|
|
List<String> collect = adminDeptWebsitList.stream().map(AdminDeptWebsit::getWebsitId).collect(Collectors.toList());
|
|
|
if (!CollectionUtils.isEmpty(adminUserBean.getAdminWebsitId()))
|
|
@@ -645,7 +644,7 @@ public class AdminUserLogic {
|
|
|
return list.stream().map(AdminModule::getModuleId).collect(Collectors.toList());
|
|
|
}
|
|
|
List<AdminUserModuleRela> list = adminUserModuleRelaService.lambdaQuery()
|
|
|
- .eq(AdminUserModuleRela::getFlag,1)
|
|
|
+ .eq(AdminUserModuleRela::getFlag, 1)
|
|
|
.eq(AdminUserModuleRela::getAdminRoleId, adminRoleId).list();
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
return new ArrayList<>();
|
|
@@ -728,5 +727,4 @@ public class AdminUserLogic {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|