报告生成器修复筛选数据有误问题
This commit is contained in:
parent
4b9318ae59
commit
fe8900e52b
@ -6,22 +6,14 @@ import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.PALFrameworkFilterUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.PALFrameworkFilterUtil2;
|
||||
import com.actionsoft.bpms.server.conf.portal.AWSPortalConf;
|
||||
import com.actionsoft.bpms.util.*;
|
||||
import com.actionsoft.bpms.util.Base64;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections4.IteratorUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -1271,10 +1263,7 @@ public class PALRepositoryQueryAPIManager {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<PALRepositoryModel> getPalRepositoryModelsByTeamIdByDeptId(String wsId, String userId, String teamId, boolean isUsed, boolean isPublished) {
|
||||
List<PALRepositoryModel> list = CoeProcessLevelUtil.getPermRepositoryListByDeptId(wsId, teamId, userId, null, null, isUsed, isPublished);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1498,6 +1487,49 @@ public class PALRepositoryQueryAPIManager {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取某个流程的发布的子流程,筛选发布部门、模型方法、是否发布条件
|
||||
*
|
||||
* @param wsId
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
public List<PALRepositoryModel> getPublishedPalRepositoryModelsByPidDep(String wsId, String pid,String methods,Set<String> tempOrgList) {
|
||||
List<PALRepositoryModel> list = getPalRepositoryModelsByPid(wsId, pid);
|
||||
|
||||
if (list != null) {
|
||||
List<PALRepositoryModel> removeList = new ArrayList<PALRepositoryModel>();
|
||||
|
||||
for (PALRepositoryModel model : list) {
|
||||
boolean depflag=false;
|
||||
|
||||
List<DesignerShapeRelationModel> relationModels = DesignerShapeRelationCache.getByFileId(model.getId(), "Issuing_department");
|
||||
|
||||
// 是否有发布部门的文件属性【可能会有多个值】
|
||||
if (relationModels != null && relationModels.size() > 0) {
|
||||
for (DesignerShapeRelationModel relationModel : relationModels) {
|
||||
JSONObject relationObj = JSONObject.parseObject(relationModel.getRelationShapeText());
|
||||
String deptId = relationObj.getString("id");
|
||||
depflag = tempOrgList.contains(deptId);
|
||||
}
|
||||
}
|
||||
|
||||
if(!methods.contains(model.getMethodId()) || !model.isPublish() || depflag==false){
|
||||
removeList.add(model);
|
||||
}
|
||||
}
|
||||
list.removeAll(removeList);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取某个流程的所有发布的子流程
|
||||
*
|
||||
@ -1513,9 +1545,32 @@ public class PALRepositoryQueryAPIManager {
|
||||
List<PALRepositoryModel> children = Cache.iteratorToList(PALRepositoryCache.getByPid(wsId, pid));
|
||||
for (PALRepositoryModel model : children) {
|
||||
getAllPublishedPalRepositoryModelsByPid(wsId, model.getId(), list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取某个流程的所有发布的子流程
|
||||
*
|
||||
* @param wsId
|
||||
* @param pid
|
||||
* @param list
|
||||
*/
|
||||
public void getAllPublishedPalRepositoryModelsByPidDep(String wsId, String pid, List<PALRepositoryModel> list,String methods,String deptId,Set<String> tempOrgList) {
|
||||
List<PALRepositoryModel> publishedChildren = getPublishedPalRepositoryModelsByPidDep(wsId, pid,methods,tempOrgList);
|
||||
if (publishedChildren != null && publishedChildren.size() > 0) {
|
||||
list.addAll(publishedChildren);
|
||||
}
|
||||
List<PALRepositoryModel> children = Cache.iteratorToList(PALRepositoryCache.getByPid(wsId, pid));
|
||||
for (PALRepositoryModel model : children) {
|
||||
getAllPublishedPalRepositoryModelsByPidDep(wsId, model.getId(), list,methods,deptId,tempOrgList);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取完整流程树
|
||||
*
|
||||
@ -2155,6 +2210,17 @@ public class PALRepositoryQueryAPIManager {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 报告生成器部门筛选方法
|
||||
* @param context
|
||||
* @param wsId
|
||||
* @param teamId
|
||||
* @param type
|
||||
* @param methods
|
||||
* @param departId
|
||||
* @param onlyPublish
|
||||
* @return
|
||||
*/
|
||||
public JSONArray getPermPalRepositoryTreeDataByMethodsByDeptId(UserContext context, String wsId, String teamId, String type, String methods,String departId,boolean onlyPublish) {
|
||||
JSONArray result = new JSONArray();
|
||||
|
||||
@ -2183,17 +2249,35 @@ public class PALRepositoryQueryAPIManager {
|
||||
list = tempList;
|
||||
}
|
||||
|
||||
String[] spilt=departId.split(",");
|
||||
|
||||
JSONArray orgIdList=new JSONArray();
|
||||
for(String ele:spilt){
|
||||
orgIdList.add(ele);
|
||||
}
|
||||
|
||||
//根据选择部门查找子部门
|
||||
Set<String> tempOrgList = new HashSet<>();
|
||||
orgIdList.stream().forEach(parentOrgId -> {
|
||||
List<DepartmentModel> subDepartments = SDK.getORGAPI().getSubDepartments((String) parentOrgId);
|
||||
tempOrgList.add((String) parentOrgId);
|
||||
if (subDepartments.size() > 0) {
|
||||
this.findSubDepartmentIds((String) parentOrgId, tempOrgList);
|
||||
}
|
||||
});
|
||||
|
||||
if (onlyPublish){
|
||||
List<PALRepositoryModel> modelList2 = new ArrayList<PALRepositoryModel>();
|
||||
for (PALRepositoryModel repositoryModel : list) {
|
||||
if ("process.framework".equals(repositoryModel.getMethodId()) || "default".equals(repositoryModel.getMethodId())){
|
||||
// 判断文件夹及所有子级下是否存在已发布模型
|
||||
List<PALRepositoryModel> children = new ArrayList<>();
|
||||
getAllPublishedPalRepositoryModelsByPid(wsId, repositoryModel.getId(), children);
|
||||
getAllPublishedPalRepositoryModelsByPidDep(wsId, repositoryModel.getId(), children,methods,departId,tempOrgList);
|
||||
if (children.size() > 0){
|
||||
modelList2.add(repositoryModel);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
if (repositoryModel.isPublish()){
|
||||
modelList2.add(repositoryModel);
|
||||
@ -2201,7 +2285,6 @@ public class PALRepositoryQueryAPIManager {
|
||||
}
|
||||
list = modelList2;
|
||||
}
|
||||
|
||||
Collections.sort(list, new Comparator1()); // 按级别排序
|
||||
List<PALRepositoryModel> newList = setNewPid(list);
|
||||
|
||||
@ -2248,13 +2331,61 @@ public class PALRepositoryQueryAPIManager {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<PALRepositoryModel> getPalRepositoryModelsByTeamIdByDeptId(String wsId, String userId, String teamId, boolean isUsed, boolean isPublished) {
|
||||
List<PALRepositoryModel> list = CoeProcessLevelUtil.getPermRepositoryListByDeptId(wsId, teamId, userId, null, null, isUsed, isPublished);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有有权限的模型文件的versionId
|
||||
*
|
||||
* @param wsId 资产库Id
|
||||
* @param teamId 小组Id
|
||||
* @param userId 用户Id
|
||||
* @param category 建模方法大类,可为null
|
||||
* @param method 模型分类,可为null
|
||||
* @return
|
||||
*/
|
||||
public static Set<String> getPermRepositoryVersionIds(String wsId, String teamId, String userId, String category, String method) {
|
||||
Set<String> result = new HashSet<>();
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
while (iterator.hasNext()) {
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (!result.contains(model.getVersionId())) {
|
||||
if (UtilString.isNotEmpty(method)) {// 先判断建模分类(小)是否符合
|
||||
if (model.getMethodId().equals(method)) {
|
||||
result.add(model.getVersionId());
|
||||
}
|
||||
} else if (UtilString.isNotEmpty(category)) {// 再判断建模分类(大)是否符合
|
||||
if (model.getMethodCategory().equals(category)) {
|
||||
result.add(model.getVersionId());
|
||||
}
|
||||
} else {
|
||||
result.add(model.getVersionId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 小组数据权限范围+该角色(当前用户所属角色)下的数据权限交集
|
||||
if (!UtilString.isEmpty(teamId)) {
|
||||
//获取能够使用的文件versionids权限数据
|
||||
// List<String> permVerList = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, userId);
|
||||
Set<String> permVerList = CoeCooperationAPIManager.getInstance().getUserDataPermission(teamId, userId, false);
|
||||
Set<String> versionIds = new HashSet<>();
|
||||
if (result.size() > 0) {
|
||||
for (String verId : result) {
|
||||
if (permVerList.contains(verId)) {
|
||||
versionIds.add(verId);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = versionIds;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2723,86 +2854,7 @@ public class PALRepositoryQueryAPIManager {
|
||||
methodIdList.add(ele);
|
||||
}
|
||||
|
||||
// 先过滤掉空的架构与空的文件夹
|
||||
/*list = list.stream().filter(model -> {
|
||||
boolean flag = true;
|
||||
|
||||
if ("process.framework".equals(model.getMethodId()) || "default".equals(model.getMethodId())) {
|
||||
flag = this.filterEmptyMoldel(model.getWsId(), model.getVersionId());
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
|
||||
Set<String> tempOrgList = new HashSet<>();
|
||||
if (orgIdList.size() > 0) {
|
||||
orgIdList.stream().forEach(parentOrgId -> {
|
||||
List<DepartmentModel> subDepartments = SDK.getORGAPI().getSubDepartments((String) parentOrgId);
|
||||
tempOrgList.add((String) parentOrgId);
|
||||
if (subDepartments.size() > 0) {
|
||||
this.findSubDepartmentIds((String) parentOrgId, tempOrgList);
|
||||
}
|
||||
});
|
||||
list = list.stream().filter(model -> {
|
||||
boolean flag = false;
|
||||
if ("org".equals(model.getMethodCategory()) || "itsystem.normal".equals(model.getMethodId())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("process.framework".equals(model.getMethodId()) || "default".equals(model.getMethodId())) {
|
||||
flag = this.filterIsMatchPropertyModel(model.getWsId(), model.getVersionId(), tempOrgList);
|
||||
} else {
|
||||
List<DesignerShapeRelationModel> relationModels = DesignerShapeRelationCache.getByFileId(model.getId(), "Issuing_department");
|
||||
|
||||
// 是否有发布部门的文件属性【可能会有多个值】
|
||||
if (relationModels != null && relationModels.size() > 0) {
|
||||
for (DesignerShapeRelationModel relationModel : relationModels) {
|
||||
JSONObject relationObj = JSONObject.parseObject(relationModel.getRelationShapeText());
|
||||
String deptId = relationObj.getString("id");
|
||||
flag = tempOrgList.contains(deptId);
|
||||
if (flag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (methodIdList.size() > 0) {
|
||||
list = list.stream().filter(model -> {
|
||||
boolean flag = false;
|
||||
if ("org".equals(model.getMethodCategory()) || "itsystem.normal".equals(model.getMethodId())) {
|
||||
return true;
|
||||
}
|
||||
// 代表【架构】伊利专属需求
|
||||
if ("process.framework".equals(model.getMethodId()) || "default".equals(model.getMethodId())) {
|
||||
// 递归判断当前架构下是否有符合的文件类型
|
||||
flag = this.filterChildLevelModelByPid(model.getWsId(), model.getVersionId(), methodIdList);
|
||||
} else {
|
||||
flag = methodIdList.contains(model.getMethodId());
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 先过滤掉空的架构与空的文件夹
|
||||
list = list.stream().filter(model -> {
|
||||
boolean flag = true;
|
||||
|
||||
if ("process.framework".equals(model.getMethodId()) || "default".equals(model.getMethodId())) {
|
||||
flag = this.filterEmptyMoldel(model.getWsId(), model.getVersionId());
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());*/
|
||||
|
||||
// 架构过滤
|
||||
if (orgIdList.size() > 0 || methodIdList.size() > 0) {
|
||||
|
||||
@ -1616,18 +1616,20 @@ public class CoeProcessLevelUtil {
|
||||
public static List<PALRepositoryModel> getPermRepositoryListByDeptId(String wsId, String teamId, String userId, String category, String method, boolean isUse, boolean isPublish) {
|
||||
List<PALRepositoryModel> result = new ArrayList<>();
|
||||
Set<String> versionIds = getPermRepositoryVersionIds(wsId, teamId, userId, category, method);
|
||||
|
||||
for (String versionId : versionIds) {
|
||||
List<PALRepositoryModel> list = PALRepositoryCache.getByVersionId(versionId);
|
||||
if (list != null) {
|
||||
for (PALRepositoryModel model : list) {
|
||||
if ((isUse && model.isUse()) || (isPublish && model.isPublish())) {
|
||||
result.add(model);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user