小组权限数据变更,小组下角色权限数据遗留变更前脏数据问题

设计器形状属性关联弹窗数据树小组下未过滤问题
This commit is contained in:
qinoy 2023-02-23 15:40:20 +08:00
parent 5a22c7584a
commit 97a27211fd
12 changed files with 166 additions and 25 deletions

View File

@ -378,6 +378,9 @@ public class CooperationWeb extends ActionWeb {
msg = "更新小组管理员信息";
if (isOk) {
api.removeCooperationTeamPerms(teamId);
// 小组权限数据变更 小组下角色的权限数据也应该随着变更 用户应该在小组管理为除设计成员浏览成员之外的角色重新配置数据
api.removeCooperationRolePerms(teamId);
if (repositoryVerIds.size() > 0) {
// 创建权限信息
List<CoeCooperationTeamPermModel> perms = new ArrayList<>();

View File

@ -1516,23 +1516,23 @@ public class CoEPALController {
// 形状关联
// @Mapping("COE_PAL_PL_RESPOSITORY_DESIGNER_SHAPES_TREE")
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_shapes_tree")
public String COEPALPLRespositoryDesignerRelevanceShapesTree(UserContext me, String wsId, String modelId, String ref, String shapeId, String attrId, String relationShapeIds, String relationFileIds, String ruuid) {
public String COEPALPLRespositoryDesignerRelevanceShapesTree(UserContext me, String wsId, String modelId, String ref, String shapeId, String attrId, String relationShapeIds, String relationFileIds, String teamId, String ruuid) {
DesignerRelationShapeWeb relationShapeWeb = new DesignerRelationShapeWeb(me);
return relationShapeWeb.designerRelevanceShapes(wsId, modelId, ref, shapeId, attrId, relationShapeIds, relationFileIds, ruuid);
return relationShapeWeb.designerRelevanceShapes(wsId, modelId, ref, shapeId, attrId, relationShapeIds, relationFileIds, teamId, ruuid);
}
// @Mapping("COE_PAL_PL_RESPOSITORY_DESIGNER_SHAPES_TREE_NODE")
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_shapes_tree_node")
public String COEPALRepositoryDesignerRelevanceShapesTreeDate(UserContext me, String wsId, String pid,String attrId,String ruuid) {
public String COEPALRepositoryDesignerRelevanceShapesTreeDate(UserContext me, String wsId, String pid,String attrId,String ruuid,String teamId) {
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
return web.getTreeJson(wsId, pid,attrId,ruuid);
return web.getTreeJson(wsId, pid,attrId,ruuid,teamId);
}
// @Mapping("COE_PAL_PL_RESPOSITORY_DESIGNER_PROCESS_MODELS_TREE_NODE")
@Mapping("com.actionsoft.apps.coe.pal_pl_repository_designer_process_models_tree_node")
public String COEPALRepositoryDesignerRelevanceProcessModelsTreeDate(UserContext me, String wsId, String pid, String methodScope,String attrId,String ruuid) {
public String COEPALRepositoryDesignerRelevanceProcessModelsTreeDate(UserContext me, String wsId, String pid, String methodScope,String attrId,String ruuid,String teamId) {
DesignerRelationShapeWeb web = new DesignerRelationShapeWeb(me);
return web.getProcessModelsTreeJson(wsId, pid, methodScope,attrId,ruuid);
return web.getProcessModelsTreeJson(wsId, pid, methodScope,attrId,ruuid,teamId);
}
/**

View File

@ -700,6 +700,14 @@ public class CoeCooperationAPIManager {
new CoeCooperationRolePermDao().removeByRole(teamId, roleId);
}
/**
* 删除当前小组下所关联的角色权限数据
* @param teamId
*/
public void removeCooperationRolePerms(String teamId){
new CoeCooperationRolePermDao().removeByTeam(teamId);
}
/**
* 获取小组成员的操作权限

View File

@ -9,6 +9,9 @@ import java.nio.charset.StandardCharsets;
import java.util.*;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
import com.actionsoft.apps.coe.pal.cooperation.cache.model.TeamInfo;
import com.actionsoft.apps.coe.pal.cooperation.cache.model.UserInfo;
import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI;
import com.actionsoft.apps.coe.pal.log.CoEOpLogConst;
import com.actionsoft.apps.coe.pal.pal.method.PALMethodManager;
@ -1427,6 +1430,42 @@ public class PALRepositoryQueryAPIManager {
return result;
}
/**
* 根据pid获取使用中的流程树
* @param context
* @param wsId
* @param pid
* @param teamId
* @return
*/
public JSONArray getUsedPalRepositoryTreeDataByPid(UserContext context, String wsId, String pid,String teamId) {
List<PALRepositoryModel> list = getUsedPalRepositoryModelsByPid(wsId, pid); // 根据父节点Id获取使用中的子节点
Set<String> versionIds = new HashSet<>();
if (UtilString.isNotEmpty(teamId)){
UserInfo userInfo = CooperationCache.getUserInfo(teamId, context.getUID());
if (userInfo != null){
if (userInfo.getIsAllDataPermission()) {
TeamInfo teamInfo = CooperationCache.getTeamInfo(teamId);
versionIds = teamInfo.getVersionIds();
}else {
versionIds = userInfo.getDataPermission().keySet();
}
}
}
if (versionIds.size() > 0){
List<PALRepositoryModel> modelList = new ArrayList<>();
for (PALRepositoryModel model : list) {
if (versionIds.contains(model.getId())){
modelList.add(model);
}
}
list = modelList;
}
Collections.sort(list, new Comparator1()); // 按级别排序
JSONArray result = list2Json(context, list, true, false);
return result;
}
/**
* 根据pid获取使用中的流程树(角色模型)
*
@ -1440,6 +1479,43 @@ public class PALRepositoryQueryAPIManager {
JSONArray result = list2JsonRole(context, list, true, false,ruuid);
return result;
}
/**
* 根据pid获取使用中的流程树(角色模型)
* @param context
* @param wsId
* @param pid
* @param ruuid
* @param teamId
* @return
*/
public JSONArray getUsedPalRepositoryTreeDataByPidRole(UserContext context, String wsId, String pid,String ruuid,String teamId) {
List<PALRepositoryModel> list = getUsedPalRepositoryModelsByPidRole(wsId, pid,ruuid); // 根据父节点Id获取使用中的子节点
Set<String> versionIds = new HashSet<>();
if (UtilString.isNotEmpty(teamId)){
UserInfo userInfo = CooperationCache.getUserInfo(teamId, context.getUID());
if (userInfo != null){
if (userInfo.getIsAllDataPermission()) {
TeamInfo teamInfo = CooperationCache.getTeamInfo(teamId);
versionIds = teamInfo.getVersionIds();
}else {
versionIds = userInfo.getDataPermission().keySet();
}
}
}
if (versionIds.size() > 0){
List<PALRepositoryModel> modelList = new ArrayList<>();
for (PALRepositoryModel model : list) {
if (versionIds.contains(model.getId())){
modelList.add(model);
}
}
list = modelList;
}
//Collections.sort(list, new Comparator1()); // 按级别排序
JSONArray result = list2JsonRole(context, list, true, false,ruuid);
return result;
}
/**
*
* @param context
@ -1448,8 +1524,29 @@ public class PALRepositoryQueryAPIManager {
* @param uuid
* @return
*/
public JSONArray getUsedPalRepositoryTreeDataByPidAnduuid(UserContext context, String wsId, String pid,String attrId,String uuid) {
public JSONArray getUsedPalRepositoryTreeDataByPidAnduuid(UserContext context, String wsId, String pid,String attrId,String uuid,String teamId) {
Set<String> versionIds = new HashSet<>();
if (UtilString.isNotEmpty(teamId)){
UserInfo userInfo = CooperationCache.getUserInfo(teamId, context.getUID());
if (userInfo != null){
if (userInfo.getIsAllDataPermission()) {
TeamInfo teamInfo = CooperationCache.getTeamInfo(teamId);
versionIds = teamInfo.getVersionIds();
}else {
versionIds = userInfo.getDataPermission().keySet();
}
}
}
List<PALRepositoryModel> list = getUsedPalRepositoryModelsByPid(wsId, pid); // 根据父节点Id获取使用中的子节点
if (versionIds.size() > 0){
List<PALRepositoryModel> modelList = new ArrayList<>();
for (PALRepositoryModel model : list) {
if (versionIds.contains(model.getId())){
modelList.add(model);
}
}
list = modelList;
}
Collections.sort(list, new Comparator1()); // 按级别排序
JSONArray result = list2JsonByuuid(context, list, true, false,attrId,uuid);
return result;

View File

@ -3,10 +3,14 @@ package com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.*;
import java.util.stream.Collectors;
import com.actionsoft.apps.AppsConst;
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
import com.actionsoft.apps.coe.pal.cooperation.cache.model.TeamInfo;
import com.actionsoft.apps.coe.pal.cooperation.cache.model.UserInfo;
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.manager.DesignerShapeCopyCache;
@ -736,7 +740,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
* @param ruuid 模型id
* @return
*/
public String designerRelevanceShapes(String wsId, String modelId, String ref, String shapeId, String attrId, String relationShapeIds, String relationFileIds, String ruuid) {
public String designerRelevanceShapes(String wsId, String modelId, String ref, String shapeId, String attrId, String relationShapeIds, String relationFileIds,String teamId, String ruuid) {
Map<String, Object> macroLibraries = new HashMap<String, Object>();
JSONObject refObj = JSONObject.parseObject(ref);
String method = refObj.getString("method");// 建模大类或建模方法
@ -748,7 +752,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
// macroLibraries.put("treeData", getTreeJson(wsId, "", category, type, method));
// by bzp
String treeJson=getTreeJson(wsId, "", category, type, method, ruuid, attrId);
String treeJson=getTreeJson(wsId, "", category, type, method, ruuid, attrId,teamId);
boolean showflag = true;
//JSONObject jsonObject = JSONObject.parseObject(json);
@ -944,6 +948,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
macroLibraries.put("refObj", refObj);
macroLibraries.put("category", category);
macroLibraries.put("modelId", modelId == null ? "" : modelId);
macroLibraries.put("teamId",teamId);
//查询已关联图形
@ -1015,15 +1020,15 @@ public class DesignerRelationShapeWeb extends ActionWeb {
public String getTreeJson(String wsId, String pid, String category, String type, String method, String ruuid,String attrId) {
public String getTreeJson(String wsId, String pid, String category, String type, String method, String ruuid,String attrId,String teamId) {
StringBuffer treeJson = new StringBuffer();
if (pid.equals("")) {
return getRootJson(wsId, category, type, method,ruuid,attrId); // 加载根
return getRootJson(wsId, category, type, method,ruuid,attrId,teamId); // 加载根
}
// 加载二级
// treeJson.append(getTwoNodeJson(pid, wsId));
// by bzp
treeJson.append(getTwoNodeJson(pid, wsId, method, ruuid));
treeJson.append(getTwoNodeJson(pid, wsId, method, ruuid, teamId));
return treeJson.toString();
}
@ -1038,8 +1043,30 @@ public class DesignerRelationShapeWeb extends ActionWeb {
* @param pid
* @return
*/
public String getTwoNodeJson(String pid, String wsId, String method, String ruuid) {
public String getTwoNodeJson(String pid, String wsId, String method, String ruuid, String teamId) {
Set<String> versionIds = new HashSet<>();
if (UtilString.isNotEmpty(teamId)){
// 小组下 当前人员角色的权限数据
UserInfo userInfo = CooperationCache.getUserInfo(teamId, _uc.getUID());
if (userInfo != null){
if (userInfo.getIsAllDataPermission()) {
TeamInfo teamInfo = CooperationCache.getTeamInfo(teamId);
versionIds = teamInfo.getVersionIds();
}else {
versionIds = userInfo.getDataPermission().keySet();
}
}
}
List<PALRepositoryModel> coeProcessLevelModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getCoeProcessLevelByPid(pid, wsId);
if (versionIds.size() > 0){
List<PALRepositoryModel> modelList = new ArrayList<>();
for (PALRepositoryModel model : coeProcessLevelModels) {
if (versionIds.contains(model.getId())){
modelList.add(model);
}
}
coeProcessLevelModels = modelList;
}
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < coeProcessLevelModels.size(); i++) {
PALRepositoryModel coeProcessLevelModel = coeProcessLevelModels.get(i);
@ -1051,7 +1078,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
return jsonArray.toString();
}
protected String getRootJson(String wsuuid, String category, String type, String methodScope,String ruuid,String attrId) {
protected String getRootJson(String wsuuid, String category, String type, String methodScope,String ruuid,String attrId,String teamId) {
JSONArray jsonArray = new JSONArray();
if ("file".equals(type)) {// 关联的文件模型
PALMethodJsonModel processpmjm = new PALMethodJsonModel();
@ -1062,7 +1089,7 @@ public class DesignerRelationShapeWeb extends ActionWeb {
processpmjm.setMenu(false);
processpmjm.setOpen(true);
jsonArray.add(processpmjm);
JSONArray nodes = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsuuid, processpmjm.getId());
JSONArray nodes = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsuuid, processpmjm.getId(),teamId);
for (int i = 0; i < nodes.size(); i++) {
JSONObject node = nodes.getJSONObject(i);
node.put("url", "./jd?sid=" + _uc.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_process_models_info&ruuid=" + node.getString("id") + "&uuid=" + node.getString("id") + "&wsId=" + wsuuid);
@ -1121,9 +1148,9 @@ public class DesignerRelationShapeWeb extends ActionWeb {
}*/
JSONArray nodes = null;
if(attrId.equals("role")){
nodes=PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPidRole(_uc, wsuuid, controlpmjm.getId(),ruuid);
nodes=PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPidRole(_uc, wsuuid, controlpmjm.getId(),ruuid,teamId);
}else{
nodes = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsuuid, controlpmjm.getId());
nodes = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsuuid, controlpmjm.getId(),teamId);
}
for (int i = 0; i < nodes.size(); i++) {
@ -1257,12 +1284,12 @@ public class DesignerRelationShapeWeb extends ActionWeb {
* @param pid
* @return
*/
public String getTreeJson(String wsId, String pid,String attrId,String uuid) {
public String getTreeJson(String wsId, String pid,String attrId,String uuid,String teamId) {
JSONArray list;
if(attrId.equals("Process_performance_metrics") || attrId.equals("role") || attrId.equals("R_relevant_flies") || attrId.equals("L1L3_Performance") || attrId.equals("post")){
list= PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPidAnduuid(_uc, wsId,pid,attrId,uuid);
list= PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPidAnduuid(_uc, wsId,pid,attrId,uuid,teamId);
}else{
list= PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsId, pid);
list= PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsId, pid,teamId);
}
JSONArray result = new JSONArray();
@ -1281,8 +1308,8 @@ public class DesignerRelationShapeWeb extends ActionWeb {
* @param methodScope
* @return
*/
public String getProcessModelsTreeJson(String wsId, String pid, String methodScope,String attrId,String ruuid) {
JSONArray list = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsId, pid);
public String getProcessModelsTreeJson(String wsId, String pid, String methodScope,String attrId,String ruuid,String teamId) {
JSONArray list = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsId, pid,teamId);
JSONArray result = new JSONArray();
for (int i = 0; i < list.size(); i++) {
JSONObject node = list.getJSONObject(i);

View File

@ -241,6 +241,7 @@
var attrDefineObj = <#attrDefineObj>;
var pid = "<#parentChartId>";
var teamId = "<#teamId>";
</script>
<!--工具js-->
<script type='text/javascript' charset='UTF-8' src='../apps/com.actionsoft.apps.coe.pal/lib/designer/extend/js/util/map.js'></script>

View File

@ -89,6 +89,7 @@
<script type='text/javascript' charset='UTF-8' type="text/javascript">
var attrId = "<#attrId>";
var teamId = "<#teamId>";
var modelId = "<#modelId>"; //模型Id
var data =<#treeData>;
var relationShapeList = <#relationShapeList>;

View File

@ -883,6 +883,7 @@
<param name="attrId" />
<param name="relationShapeIds" />
<param name="relationFileIds"/>
<param name="teamId"/>
<param name="ruuid"/>
</cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.pal_pl_repository_designer_shapes_tree_node">
@ -890,6 +891,7 @@
<param name="pid" />
<param name="attrId" />
<param name="ruuid" />
<param name="teamId" />
</cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.pal_pl_repository_designer_shapes_tree_query">
<param name="autoContent"/>
@ -902,6 +904,7 @@
<param name="methodScope"/>
<param name="attrId"/>
<param name = "ruuid"/>
<param name = "teamId"/>
</cmd-bean>
<cmd-bean name="com.actionsoft.apps.coe.pal_pl_repository_designer_shapes_info">
<param name="uuid" />

View File

@ -251,7 +251,7 @@ function loadData(treeNode) {
var dataModel = {
url : "./w?sid=" + $("#sid").val()
+ "&cmd=" + url + "&pid=" + treeNode.id + "&methodScope=" + method
+ "&wsId=" + $("#wsid").val()+"&attrId="+attrId
+ "&wsId=" + $("#wsid").val()+"&attrId="+attrId+"&teamId="+teamId
+"&ruuid="+parent.ruuid,
method : "POST",
dataType : "json"

View File

@ -3495,6 +3495,7 @@ function openRelationDig(obj,value) {
+ "&attrId=" + $(obj).attr("objid")
+ "&relationShapeIds=" + relationShapeIds
+ "&relationFileIds=" + relationFileIds
+ "&teamId=" + teamId
+ "&ruuid=" + ruuid);
if(methodId=="org.role"){
//根据角色
@ -3788,7 +3789,7 @@ function saveRelevanceShapesTODB(shapesObj, shapeId, shapeName, fileName,
if(objId == 'role'){
//判断岗位
var tmp = $("input[objid='post']").val();
if(tmp.length > 0){
if(tmp != undefined && tmp.length > 0){
$.simpleAlert("不能同时选择岗位和角色");
return;
}
@ -3796,7 +3797,7 @@ function saveRelevanceShapesTODB(shapesObj, shapeId, shapeName, fileName,
if(objId == 'post'){
//判断角色
var tmp = $("input[objid='role']").val();
if(tmp.length > 0){
if(tmp != undefined && tmp.length > 0){
$.simpleAlert("不能同时选择岗位和角色");
return;
}