fix: 报告生成器,流程树只保留已发布状态的数据

This commit is contained in:
qinoy 2024-11-25 16:48:46 +08:00
parent 16b911a9d8
commit bea55677ce
5 changed files with 47 additions and 8 deletions

View File

@ -599,7 +599,7 @@ public class ProcessPublishClientWeb extends AbstPortalSkins implements PortalSk
wsTree.add(wsJson);
i++;
JSONArray jsonArray = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeData(_uc, wsId, "org", "isUsed");
JSONArray jsonArray = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeData(_uc, wsId, "org", "isUsed", false);
for (int j = 0; j < jsonArray.size(); j++) {
JSONObject object = jsonArray.getJSONObject(j);
if (object.getString("id").equals("org")) {

View File

@ -429,11 +429,10 @@ public class OutPutReportWeb extends ActionWeb {
public String PALFileJsonDataRootTreeData(String methodType, String wsid, String versionType, String teamId) {
JSONArray jsonArr = null;
//if (teamId == null || "".equals(teamId)) {
versionType = "isPublished";
if (teamId == null) {
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeData(_uc, wsid, methodType, versionType);
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeData(_uc, wsid, methodType, versionType, true);
} else {
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPermPalRepositoryTreeDataByMethods(_uc, wsid, teamId, versionType, methodType);
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPermPalRepositoryTreeDataByMethods(_uc, wsid, teamId, versionType, methodType, true);
}
return jsonArr.toString();
}
@ -638,9 +637,9 @@ public class OutPutReportWeb extends ActionWeb {
public String PALFileRelationJsonDataRoot(String methodType, String wsid, String versionType, String teamId) {
JSONArray jsonArr = null;
if (teamId == null || "".equals(teamId)) {
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeData(_uc, wsid, methodType, versionType);
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPalRepositoryTreeData(_uc, wsid, methodType, versionType, false);
} else {
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPermPalRepositoryTreeDataByMethods(_uc, wsid, teamId, versionType, methodType);
jsonArr = PALRepositoryQueryAPIManager.getInstance().getPermPalRepositoryTreeDataByMethods(_uc, wsid, teamId, versionType, methodType, false);
}
// jsonArr = PALRepositoryQueryAPIManager.getInstance().getLimitPALTree(new JSONArray(), methodType, wsid, versionType);
Map<String, Object> map = new HashMap<String, Object>();

View File

@ -20,6 +20,7 @@ import java.util.stream.Collectors;
import com.actionsoft.bpms.server.conf.portal.AWSPortalConf;
import com.actionsoft.bpms.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.lang.StringUtils;
@ -1522,7 +1523,7 @@ public class PALRepositoryQueryAPIManager {
* @param type isUsed/isPublished/designer 使用中/已发布/使用中但是未发布
* @return
*/
public JSONArray getPalRepositoryTreeData(UserContext context, String wsId, String methods, String type) {
public JSONArray getPalRepositoryTreeData(UserContext context, String wsId, String methods, String type, boolean onlyPublish) {
JSONArray result = new JSONArray();
String[] methodArray;
@ -1595,6 +1596,25 @@ public class PALRepositoryQueryAPIManager {
modelList = tempList;
}
if (onlyPublish){
List<PALRepositoryModel> modelList2 = new ArrayList<PALRepositoryModel>();
for (PALRepositoryModel repositoryModel : modelList) {
if ("process.framework".equals(repositoryModel.getMethodId()) || "default".equals(repositoryModel.getMethodId())){
// 判断文件夹及所有子级下是否存在已发布模型
List<PALRepositoryModel> children = new ArrayList<>();
getAllPublishedPalRepositoryModelsByPid(wsId, repositoryModel.getId(), children);
if (children.size() > 0){
modelList2.add(repositoryModel);
continue;
}
}
if (repositoryModel.isPublish()){
modelList2.add(repositoryModel);
}
}
modelList = modelList2;
}
List<PALRepositoryModel> newList = setNewPid(modelList);
Collections.sort(newList, new Comparator1());
@ -2039,7 +2059,7 @@ public class PALRepositoryQueryAPIManager {
* @param type
* @return
*/
public JSONArray getPermPalRepositoryTreeDataByMethods(UserContext context, String wsId, String teamId, String type, String methods) {
public JSONArray getPermPalRepositoryTreeDataByMethods(UserContext context, String wsId, String teamId, String type, String methods, boolean onlyPublish) {
JSONArray result = new JSONArray();
List<PALRepositoryModel> list = null;
@ -2066,6 +2086,26 @@ public class PALRepositoryQueryAPIManager {
}
list = tempList;
}
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);
if (children.size() > 0){
modelList2.add(repositoryModel);
continue;
}
}
if (repositoryModel.isPublish()){
modelList2.add(repositoryModel);
}
}
list = modelList2;
}
Collections.sort(list, new Comparator1()); // 按级别排序
List<PALRepositoryModel> newList = setNewPid(list);