Browse Source

no message

FengChaoYu 1 year ago
parent
commit
e2ebd377cd

+ 1 - 1
mall-server-api/src/main/java/com/gree/mall/manager/controller/admin/AdminUserController.java

@@ -106,7 +106,7 @@ public class AdminUserController {
     public ResponseHelper add(
             @ApiParam(value = "帐号",required = true) @RequestBody AdminUserAddReqBean adminUserBean
     ) throws RemoteServiceException {
-        adminUserLogic.add(adminUserBean,false);
+        adminUserLogic.add(adminUserBean,false, false);
         return ResponseHelper.success();
     }
 

+ 1 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminCompanyWechatLogic.java

@@ -168,7 +168,7 @@ public class AdminCompanyWechatLogic {
         List<String> websitIds = new ArrayList<>();
         websitIds.add(adminWebsit.getWebsitId());
         adminUserAddReqBean.setAdminWebsitId(websitIds);
-        adminUserLogic.add(adminUserAddReqBean,true);
+        adminUserLogic.add(adminUserAddReqBean,true, false);
         //初始化模板
         adminCompanyWechatTemplateLogic.initCompanyWechatTemplate(adminCompanyWechat.getCompanyWechatId(), adminCompanyWechat.getCompanyName());
         //初始化其他配置

+ 5 - 4
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminRoleLogic.java

@@ -46,17 +46,18 @@ public class AdminRoleLogic {
 
         Integer type = adminUser.getType();
 
-        Integer level = null;
-        if (adminUser.getType() == 0 && adminUser.getIsMaster()) {
+        List<Integer> levelList = new ArrayList<>();
+        if (adminUser.getType() == 0) {
             final AdminRole adminRole = adminRoleService.getById(adminUser.getRoleId());
-            level = adminRole.getLevel();
+            levelList.add(adminRole.getLevel());
+            levelList.add(100);
         }
 
         Page<AdminRole> rolePage = adminRoleService.lambdaQuery()
                 .like(StringUtils.isNotBlank(companyWechatName), AdminRole::getCompanyName, companyWechatName)
                 .le(AdminRole::getType, type)
                 .in(CollectionUtils.isNotEmpty(companyWechatIds), AdminRole::getCompanyWechatId, companyWechatIds)
-                .eq(Objects.nonNull(level), AdminRole::getLevel, level)
+                .in(CollectionUtils.isNotEmpty(levelList), AdminRole::getLevel, levelList)
                 .orderByDesc(AdminRole::getType)
                 .page(new Page<>(pageNo, pageSize));
 

+ 13 - 11
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminUserLogic.java

@@ -342,7 +342,7 @@ public class AdminUserLogic {
      * 新增帐号
      */
     @Transactional
-    public void add(AdminUserAddReqBean adminUser, Boolean addMch) throws RemoteServiceException {
+    public void add(AdminUserAddReqBean adminUser, Boolean addMch, Boolean addWebsit) throws RemoteServiceException {
         AdminUserCom curAdminUser = commonLogic.getAdminUser();
         if (StringUtils.isBlank(adminUser.getUserName()) || StringUtils.isBlank(adminUser.getPassword())) {
             throw new RemoteServiceException("参数错误");
@@ -384,20 +384,22 @@ public class AdminUserLogic {
             if (addMch) {
                 adminUser.setType(1);
             } 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())) {
-                    adminUser.setType(0);
-                } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.B.getKey())) {
-                    adminUser.setType(1);
-                } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
-                    adminUser.setType(2);
+                if (!addWebsit) {
+                    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())) {
+                        adminUser.setType(0);
+                    } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.B.getKey())) {
+                        adminUser.setType(1);
+                    } else if (StringUtils.equals(adminWebsit.getType(), AdminWebsitTypeEnum.A.getKey())) {
+                        adminUser.setType(2);
+                    }
                 }
             }
 
         }
-        if (!CollectionUtils.isEmpty(adminUser.getAdminDeptId())) {
+        if (!addWebsit && !CollectionUtils.isEmpty(adminUser.getAdminDeptId())) {
             AdminDept adminDept = adminDeptService.getById(adminUser.getAdminDeptId().get(0));
 
             if (!curAdminUser.getType().equals("2") && adminDept.getAdminDeptId().equals("1")) {

+ 2 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminWebsitLogic.java

@@ -292,9 +292,10 @@ public class AdminWebsitLogic {
                 .setPassword(adminWebsit.getLegalMobile())
                 .setPubNotice(true)
                 .setIsVender(false)
+                .setType(0)
                 .setLinkPhone(adminWebsit.getLinkMobile());
         adminUser.setAdminWebsitId(Collections.singletonList(adminWebsit.getWebsitId()));
-        adminUserLogic.add(adminUser, false);
+        adminUserLogic.add(adminUser, false, true);
     }
 
     private void initMaterialStorage(AdminUserCom adminUser, AdminWebsit adminWebsit) {