dcs 3 months ago
parent
commit
734d8afd8c

+ 20 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUser.java

@@ -56,6 +56,10 @@ public class MgrUser implements BaseModel {
 	private String menus;
 	
 	private String resources;
+
+	private String workarkMenus;
+
+	private String workarkresources;
 	
 	private String roles;
 
@@ -259,6 +263,22 @@ public class MgrUser implements BaseModel {
 		this.resources = resources;
 	}
 
+	public String getWorkarkMenus() {
+		return workarkMenus;
+	}
+
+	public void setWorkarkMenus(String workarkMenus) {
+		this.workarkMenus = workarkMenus;
+	}
+
+	public String getWorkarkresources() {
+		return workarkresources;
+	}
+
+	public void setWorkarkresources(String workarkresources) {
+		this.workarkresources = workarkresources;
+	}
+
 	public String getRoles() {
 		return roles;
 	}

+ 12 - 7
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -418,13 +418,18 @@ public class MgrUserService {
         }
         if(workarkCurrentUserRole!= null && workarkCurrentOrganization!=null && workarkCurrentUserRole.isAdmin()) {
             MgrResource workarkDefaultResource = getWorkarkDefaultResource();
-			if (workarkCurrentOrganization.getFacilitator() == 0) {
-				workarkCurrentUserRole.setWorkarkResources(workarkDefaultResource.getEnterpriseData());
-				workarkCurrentUserRole.setWorkarkMenus(workarkDefaultResource.getEnterpriseComment());
-			}
-			if (workarkCurrentOrganization.getFacilitator() == 1) {
-				workarkCurrentUserRole.setWorkarkResources(workarkDefaultResource.getProviderData());
-				workarkCurrentUserRole.setWorkarkMenus(workarkDefaultResource.getProviderComment());
+            if(workarkCurrentUserRole.getOrganizationId() == -1){
+				workarkCurrentUserRole.setWorkarkResources(workarkDefaultResource.getData());
+				workarkCurrentUserRole.setWorkarkMenus(workarkDefaultResource.getComment());
+			}else {
+				if (workarkCurrentOrganization.getFacilitator() == 0) {
+					workarkCurrentUserRole.setWorkarkResources(workarkDefaultResource.getEnterpriseData());
+					workarkCurrentUserRole.setWorkarkMenus(workarkDefaultResource.getEnterpriseComment());
+				}
+				if (workarkCurrentOrganization.getFacilitator() == 1) {
+					workarkCurrentUserRole.setWorkarkResources(workarkDefaultResource.getProviderData());
+					workarkCurrentUserRole.setWorkarkMenus(workarkDefaultResource.getProviderComment());
+				}
 			}
         }
 

+ 6 - 1
virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java

@@ -90,6 +90,7 @@ public class UserService {
     public List<MgrUser> listUser(long organizationId, long roleId) {
         List<MgrUserRole> list = mgrUserRoleDao.getOrganizationId(organizationId);
         Map<Long, String> map = new HashMap<>();
+        Map<Long, String> wmap = new HashMap<>();
         List<Long> userIds = new ArrayList<>();
         for (MgrUserRole mur : list) {
             if (mur.getRoles() != null) {
@@ -97,12 +98,16 @@ public class UserService {
                 if (ll.contains(String.valueOf(roleId))) {
                     userIds.add(mur.getUserId());
                     map.put(mur.getUserId(), mur.getResources());
+                    wmap.put(mur.getUserId(), mur.getWorkarkResources());
                 }
             }
         }
         if (userIds.size() > 0) {
             List<MgrUser> userList = mgrUserDao.getIds(userIds);
-            userList.forEach(ls -> ls.setResources(map.get(ls.getId())));
+            userList.forEach(ls -> {
+                ls.setResources(map.get(ls.getId()));
+                ls.setWorkarkresources(wmap.get(ls.getId()));
+            });
             return userList;
         }
         return new ArrayList<>();