diff --git a/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar b/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar index abac4cb7..ef211089 100644 Binary files a/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar and b/com.actionsoft.apps.coe.pal.cooperation/lib/com.actionsoft.apps.coe.pal.cooperation.jar differ diff --git a/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java b/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java index a333b3f9..bdfacdc6 100644 --- a/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java +++ b/com.actionsoft.apps.coe.pal.cooperation/src/com/actionsoft/apps/coe/pal/cooperation/web/CooperationWeb.java @@ -373,7 +373,7 @@ public class CooperationWeb extends ActionWeb { if (isOk) { api.removeCooperationTeamPerms(teamId); // 小组权限数据变更 小组下角色的权限数据也应该随着变更 用户应该在小组管理为除设计成员、浏览成员之外的角色重新配置数据 - api.removeCooperationRolePerms(teamId); + // api.removeCooperationRolePerms(teamId); if (repositoryVerIds.size() > 0) { // 创建权限信息 @@ -384,6 +384,9 @@ public class CooperationWeb extends ActionWeb { } isOk = api.createCooperationTeamPerms(perms); msg = "更新小组数据权限信息"; + + // 小组权限数据变更 小组下角色权限数据 如果不存在新的小组权限数据中 则删除 + api.handleTeamRolePermData(repositoryVerIds, teamId); } } diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index 0499f48d..7a3ffb76 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java index 39b140e2..7e6e6680 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/CoeCooperationAPIManager.java @@ -1051,4 +1051,32 @@ public class CoeCooperationAPIManager { return map; } + /** + * 小组权限数据变更 小组下角色权限数据 + * 如果不存在新的小组权限数据中 则删除 + * @param teamPermData + * @param teamId + */ + public void handleTeamRolePermData(JSONArray teamPermData, String teamId){ + // 根据小组查询所有角色 + List allRoleList = new CoeCooperationRoleDao().getCooperationAllRoleByTeam(teamId); + CoeCooperationRolePermDao rolePermDao = new CoeCooperationRolePermDao(); + for (CoeCooperationRoleModel roleModel : allRoleList) { + // 查询角色下权限数据 + List rolePermDataList = rolePermDao.getRolePermListByRole(teamId, roleModel.getId()); + if (rolePermDataList != null && rolePermDataList.size() > 0){ + Set deleteIds = new HashSet<>(); + for (String id : rolePermDataList) { + if (!teamPermData.contains(id)){ + deleteIds.add(id); + } + } + if (deleteIds.size() > 0){ + // 删除不在小组权限范围内的数据 + rolePermDao.removeDataByTeamAndPalVersionIds(teamId, roleModel.getId(), deleteIds); + } + } + } + } + } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRoleDao.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRoleDao.java index 2174d25f..4648a7e9 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRoleDao.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRoleDao.java @@ -188,6 +188,16 @@ public class CoeCooperationRoleDao extends DaoObject { return DBSql.query(sql, rowMapper(), new Object[]{teamId}); } + /** + * 根据小组查询所有角色 + * @param teamId + * @return + */ + public List getCooperationAllRoleByTeam(String teamId) { + String sql = "SELECT * FROM " + entityName() + " WHERE " + CoeCooperationRoleModel.TEAMID + " =? "; + return DBSql.query(sql, rowMapper(), new Object[]{teamId}); + } + /** * 查询用户在某小组的角色 * @param teamId diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRolePermDao.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRolePermDao.java index 17457c02..6aa0093a 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRolePermDao.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationRolePermDao.java @@ -10,10 +10,7 @@ import com.actionsoft.bpms.util.UtilString; import com.actionsoft.exception.AWSDataAccessException; import java.sql.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @Description TODO @@ -124,6 +121,25 @@ public class CoeCooperationRolePermDao extends DaoObject palVerIds) throws AWSDataAccessException { + StringBuffer ids = new StringBuffer(); + for (String verId : palVerIds) { + ids.append(",").append("'").append(verId).append("'"); + } + String verIds = ids.substring(1, ids.length()); + String sql = "delete from " + entityName() + + " where " + CoeCooperationRolePermModel.TEAMID + " = '" + teamId + + "' and " + CoeCooperationRolePermModel.ROLEID + " = '" + roleId + "' and " + CoeCooperationRolePermModel.PALVERSIONID + " in (" + verIds + ")"; + DBSql.update(sql); + } + /** * 批量插入 * @param list