小组管理 用户权限 优化数据加载慢的问题

This commit is contained in:
qinoy 2023-08-03 17:23:29 +08:00
parent e4bf4617f3
commit f1e1bc366c
2 changed files with 9 additions and 8 deletions

View File

@ -111,12 +111,13 @@ public class CooperationQueryAPIManager {
// 获取符合权限的子流程
List<PALRepositoryModel> childrenList = getUsedPalRepositoryModelsByPidNew(wsId, teamId, pid);
CooperationUtil.sortByLevelAndOrderIndex(childrenList);
Map<String, Integer> grandChildrenCountMap = new HashMap<>();
for (PALRepositoryModel chlidModel : childrenList) {
List<PALRepositoryModel> grandChildrenList = getUsedPalRepositoryModelsByPidNew(wsId, teamId, chlidModel.getId());
grandChildrenCountMap.put(chlidModel.getId(), grandChildrenList.size());
}
JSONArray result = list2JsonNew(childrenList, grandChildrenCountMap);
// Map<String, Integer> grandChildrenCountMap = new HashMap<>();
// for (PALRepositoryModel chlidModel : childrenList) {
// List<PALRepositoryModel> grandChildrenList = getUsedPalRepositoryModelsByPidNew(wsId, teamId, chlidModel.getId());
// grandChildrenCountMap.put(chlidModel.getId(), grandChildrenList.size());
// }
JSONArray result = list2JsonNew(childrenList);
return result;
}
@ -188,7 +189,7 @@ public class CooperationQueryAPIManager {
* @param childrenCountMap list中的model是否具有子节点map记录
* @return
*/
private JSONArray list2JsonNew(List<PALRepositoryModel> list, Map<String, Integer> childrenCountMap) {
private JSONArray list2JsonNew(List<PALRepositoryModel> list) {
JSONArray jsonArray = new JSONArray();
for (PALRepositoryModel model : list) {
JSONObject object = new JSONObject();
@ -216,7 +217,7 @@ public class CooperationQueryAPIManager {
}
object.put("icon", icon);
List<PALRepositoryModel> children = null;
if (childrenCountMap.containsKey(model.getId()) && childrenCountMap.get(model.getId()) > 0) {
if (PALRepositoryCache.getByPid(model.getWsId(), model.getId()).hasNext()) {
object.put("leaf", false);// 非叶子节点
} else {
object.put("leaf", true);// 叶子节点