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 9802c4e1..1baad086 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/pal/output/OutPutReportWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java index d9139299..bc4ece01 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java @@ -436,6 +436,7 @@ public class OutPutReportWeb extends ActionWeb { } public String PALFileJsonDataRootTreeDataByDepartment(String methodType, String wsid, String versionType, String teamId,String departId) { + JSONArray jsonArr = null; //if (teamId == null || "".equals(teamId)) { if (teamId == null) { diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java index a3f7fef5..b947a25f 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java @@ -16,6 +16,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import com.actionsoft.bpms.server.conf.portal.AWSPortalConf; import com.actionsoft.bpms.util.*; @@ -2180,7 +2181,7 @@ public class PALRepositoryQueryAPIManager { removeIds.append(model.getId()).append(","); } } - result.addAll(list2Json(context, newList, isUsed, isPublished, removeIds.toString(), type, true)); + result.addAll(list2DepartJson(context, newList, isUsed, isPublished, removeIds.toString(), type, true,departId)); return result; } @@ -2435,6 +2436,119 @@ public class PALRepositoryQueryAPIManager { return jsonArray; } + + + + /****************************************报告生成器下载流程模型筛选****************************************************************/ + + /** + * 通过流程model列表,获取流程树的json数组 + * + * @param context + * @param list + * @return + */ + public JSONArray list2DepartJson(UserContext context, List list, boolean isUsed, boolean isPublished) { + return list2DepartJson(context, list, isUsed, isPublished, null, null); + } + + /**************************************************** 流程树相关方法 *******************************************************/ + + private JSONArray list2DepartJson(UserContext context, List list, boolean isUsed, boolean isPublished, String removeIds, String param) { + JSONArray jsonArray = new JSONArray(); + for (PALRepositoryModel model : list) { + + JSONObject object = new JSONObject(); + object.put("id", model.getId().trim()); + object.put("pid", model.getNewParentId().trim()); + if (removeIds != null && removeIds.contains(model.getId().trim())) { + object.put("nocheck", true); + } else { + object.put("nocheck", false); + } + object.put("plNo", CoeProcessLevelUtil.getProcessLevelNoByUUId(model.getId(), model.getWsId()).trim()); + object.put("name", I18nRes.findValue(CoEConstant.APP_ID, context.getLanguage(), model.getName()).trim()); + object.put("wsId", model.getWsId()); + PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(model.getMethodId()); + if (methodModel == null || methodModel.isFolder()) {// 没有该建模方法或者是文件夹类 + object.put("title", object.get("name")); + } else { + object.put("title", object.get("name") + " " + VersionUtil.getVersionStrV(model.getVersion()).trim()); + } + //三员管理文件密级校验 + if (HighSecurityUtil.isON() && HighSecurityUtil.fileSecuritySwitch()) { + ResponseObject responseObject = new CoeProcessLevelWeb(DispatcherRequest.getUserContext()).checkFilePemission(model.getId()); + if (responseObject.isErr() && (methodModel != null && !methodModel.isFolder())) { + object.put("nocheck", true); + } + } + object.put("drop", false); + object.put("isSystemFile", model.isSystemFile()); + object.put("plMethodId", model.getMethodId().trim()); + if (methodModel == null || methodModel.isFolder()) {// 没有该建模方法或者是文件夹类 + object.put("iconFont", ""); + } else { + object.put("iconFont", ""); + } + List children = null; + if (isUsed) { + children = getUsedPalRepositoryModelsByPid(model.getWsId(), model.getId()); + if ("designer".equals(param) && children != null && children.size() > 0) {// 过滤掉发布版本 + List tempChildren = new ArrayList<>(); + for (PALRepositoryModel model2 : children) { + if (!model2.isPublish()) { + tempChildren.add(model2); + } + } + children = tempChildren; + } + } else if (isPublished) { + children = getPublishedPalRepositoryModelsByPid(model.getWsId(), model.getId()); + } + if (children == null || children.size() == 0) { + object.put("isParent", false); + //String icon = object.getString("icon"); + object.put("leaf", true);// 叶子节点 + // object.put("icon", icon.replace("16.png", "16.leaf.png")); + } else { + object.put("isParent", true); + object.put("open", false); + } + + object.put("plLevel", model.getLevel()); + object.put("plOrdexIndex", model.getOrderIndex()); + object.put("plDiagramUrl", model.getDiagramUrl()); + object.put("isDrops", model.isSystemFile()); + object.put("isPublish", model.isPublish()); + object.put("isStop", model.isStop()); + object.put("isApproval", model.isApproval()); + object.put("ext1", model.getExt1()); + object.put("ext2", model.getExt2()); + object.put("ext3", model.getExt3()); + object.put("ext4", model.getExt4()); + object.put("isUse", model.isUse()); + object.put("url", "./w?sid=" + context.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_portal_page&ruuid=" + model.getId() + "&type=1&wsid=" + model.getWsId()); + object.put("plCategory", model.getMethodCategory()); + object.put("versionId", model.getVersionId()); + object.put("orderIndex", model.getOrderIndex()); + object.put("isBottomLevel", model.isBottomLevel()); + String dutyDeptId = model.getDutyDept(); + object.put("dutyDeptId", dutyDeptId == null ? "" : dutyDeptId); + String plDutyDeptName = dutyDeptId; + if (!UtilString.isEmpty(dutyDeptId)) { + if (SDK.getORGAPI().getDepartmentById(dutyDeptId) != null) { + plDutyDeptName = SDK.getORGAPI().getDepartmentById(dutyDeptId).getName(); + } + } + object.put("dutyDeptName", UtilString.isEmpty(dutyDeptId) ? "" : plDutyDeptName); + String plDutyPerson = model.getDutyUser(); + object.put("dutyPersonId", model.getDutyUser() == null ? "" : model.getDutyUser()); + object.put("dutyPersionName", UtilString.isEmpty(plDutyPerson) ? "" : SDK.getORGAPI().getUserAliasNames(plDutyPerson)); + jsonArray.add(object); + } + return jsonArray; + } + private JSONArray list2Json(UserContext context, List list, boolean isUsed, boolean isPublished, String removeIds, String param, boolean statusSuffix) { JSONArray jsonArray = new JSONArray(); for (PALRepositoryModel model : list) { @@ -2530,6 +2644,350 @@ public class PALRepositoryQueryAPIManager { return jsonArray; } + + private JSONArray list2DepartJson(UserContext context, List list, boolean isUsed, boolean isPublished, String removeIds, String param, boolean statusSuffix,String departId) { + JSONArray jsonArray = new JSONArray(); + + /*DepartmentModel departmentById = SDK.getORGAPI().getDepartmentById(departId); + + + ArrayList dep=new ArrayList(); + + dep.add(departId); + + ArrayList subDepartmentsList = getChildDept(departId, new ArrayList<>()); + + + long startTime = System.currentTimeMillis();*/ + + + for(PALRepositoryModel o:list){ + System.out.println("过滤前======="+o.getName()); + } + // 先过滤掉空的架构与空的文件夹 + list = list.stream().filter(model -> { + boolean flag = true; + if (model.getMethodId().equals("process.framework")) { + flag = this.filterEmptyMoldel(model.getWsId(), model.getVersionId()); + } + return flag; + }).collect(Collectors.toList()); + + for(PALRepositoryModel o:list){ + System.out.println("过滤后======="+o.getName()); + } + + String[] spilt=departId.split(","); + JSONArray orgIdList=new JSONArray(); + + for(String ele:spilt){ + orgIdList.add(ele); + } + + + Set tempOrgList = new HashSet<>(); + if (orgIdList.size() > 0) { + orgIdList.stream().forEach(parentOrgId -> { + List 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 rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '" + model.getId() + "' and ATTRID='Issuing_department'"); + + for (RowMap oneRowMap : rlatRowMap) { + String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT"); + JSONObject js = JSONObject.parseObject(relationshapetext); + String deptId = js.getString("id"); + flag = tempOrgList.contains(deptId); + if (flag) + break; + + } + + /*List 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()); + } + + + + /*list = list.stream().filter(model -> { + boolean flag = true; + if (model.getMethodId().equals("process.framework")) { + flag = this.filterEmptyMoldel(model.getWsId(), model.getId()); + } + return flag; + }).collect(Collectors.toList());*/ + + + + /*list = list.stream().filter(model -> { + if ("org".equals(model.getMethodCategory()) || "itsystem.normal".equals(model.getMethodId())) { + return true; + } + boolean flag = false; + if ("process.framework".equals(model.getMethodId()) || "default".equals(model.getMethodId())) { + flag = this.filterIsMatchPropertyModel(model.getWsId(), model.getVersionId(), subDepartmentsList); + } else { + List 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 = subDepartmentsList.contains(deptId); + if (flag) + break; + } + } + } + return flag; + }).collect(Collectors.toList());*/ + + + + + for (PALRepositoryModel model : list) { + + JSONObject object = new JSONObject(); + object.put("id", model.getId().trim()); + object.put("pid", model.getNewParentId().trim()); + if (removeIds != null && removeIds.contains(model.getId().trim())) { + object.put("nocheck", true); + continue; + } else { + object.put("nocheck", false); + } + object.put("plNo", CoeProcessLevelUtil.getProcessLevelNoByUUId(model.getId(), model.getWsId()).trim()); + object.put("name", I18nRes.findValue(CoEConstant.APP_ID, context.getLanguage(), model.getName()).trim() + (statusSuffix && !"default".equals(model.getMethodId()) && !"process.framework".equals(model.getMethodId()) ? "(" + getStatusLabel(model) + ")" : "")); + object.put("wsId", model.getWsId()); + PALMethodModel methodModel = PALMethodCache.getPALMethodModelById(model.getMethodId()); + if (methodModel == null || methodModel.isFolder()) {// 没有该建模方法或者是文件夹类 + object.put("title", object.get("name")); + } else { + object.put("title", object.get("name") + " " + VersionUtil.getVersionStrV(model.getVersion()).trim()); + } + //三员管理文件密级校验 + if (HighSecurityUtil.isON() && HighSecurityUtil.fileSecuritySwitch()) { + ResponseObject responseObject = new CoeProcessLevelWeb(DispatcherRequest.getUserContext()).checkFilePemission(model.getId()); + if (responseObject.isErr() && (methodModel != null && !methodModel.isFolder())) { + object.put("nocheck", true); + } + } + object.put("drop", false); + object.put("isSystemFile", model.isSystemFile()); + object.put("plMethodId", model.getMethodId().trim()); + if (methodModel == null || methodModel.isFolder()) {// 没有该建模方法或者是文件夹类 + object.put("iconFont", ""); + } else { + object.put("iconFont", ""); + } + List children = null; + if (isUsed) { + children = getUsedPalRepositoryModelsByPid(model.getWsId(), model.getId()); + if ("designer".equals(param) && children != null && children.size() > 0) {// 过滤掉发布版本 + List tempChildren = new ArrayList<>(); + for (PALRepositoryModel model2 : children) { + if (!model2.isPublish()) { + tempChildren.add(model2); + } + } + children = tempChildren; + } + } else if (isPublished) { + children = getPublishedPalRepositoryModelsByPid(model.getWsId(), model.getId()); + } + if (children == null || children.size() == 0) { + object.put("isParent", false); + //String icon = object.getString("icon"); + object.put("leaf", true);// 叶子节点 + // object.put("icon", icon.replace("16.png", "16.leaf.png")); + + } else { + object.put("isParent", true); + object.put("open", false); + } + + object.put("plLevel", model.getLevel()); + object.put("plOrdexIndex", model.getOrderIndex()); + object.put("plDiagramUrl", model.getDiagramUrl()); + object.put("isDrops", model.isSystemFile()); + object.put("isPublish", model.isPublish()); + object.put("isStop", model.isStop()); + object.put("isApproval", model.isApproval()); + object.put("ext1", model.getExt1()); + object.put("ext2", model.getExt2()); + object.put("ext3", model.getExt3()); + object.put("ext4", model.getExt4()); + object.put("isUse", model.isUse()); + object.put("url", "./w?sid=" + context.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_portal_page&ruuid=" + model.getId() + "&type=1&wsid=" + model.getWsId()); + object.put("plCategory", model.getMethodCategory()); + object.put("versionId", model.getVersionId()); + object.put("orderIndex", model.getOrderIndex()); + object.put("isBottomLevel", model.isBottomLevel()); + String dutyDeptId = model.getDutyDept(); + object.put("dutyDeptId", dutyDeptId == null ? "" : dutyDeptId); + String plDutyDeptName = dutyDeptId; + if (!UtilString.isEmpty(dutyDeptId)) { + if (SDK.getORGAPI().getDepartmentById(dutyDeptId) != null) { + plDutyDeptName = SDK.getORGAPI().getDepartmentById(dutyDeptId).getName(); + } + } + object.put("dutyDeptName", UtilString.isEmpty(dutyDeptId) ? "" : plDutyDeptName); + String plDutyPerson = model.getDutyUser(); + object.put("dutyPersonId", model.getDutyUser() == null ? "" : model.getDutyUser()); + object.put("dutyPersionName", UtilString.isEmpty(plDutyPerson) ? "" : SDK.getORGAPI().getUserAliasNames(plDutyPerson)); + + jsonArray.add(object); + /*if(model.getMethodId().equals("process.framework")) { + + + }else{ + + List rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '" + model.getId() + "' and ATTRID='Issuing_department'"); + if (rlatRowMap.size() > 0) { + // 发布部门 + String dempId = ""; + for (RowMap oneRowMap : rlatRowMap) { + String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT"); + JSONObject js = JSONObject.parseObject(relationshapetext); + String getDepartId=js.getString("id"); + boolean contains = subDepartmentsList.contains(getDepartId); + if(contains){ + jsonArray.add(object); + } + } + } + + + + }*/ + } + + return jsonArray; + } + + + + /** + * 递归查找当前父部门下的所有子部门 + * + * @param parentOrgId + * @param orgIds + */ + private void findSubDepartmentIds(String parentOrgId, Set orgIds) { + List subDepartments = SDK.getORGAPI().getSubDepartments(parentOrgId); + if (subDepartments.size() == 0) { + return; + } + for (DepartmentModel department : subDepartments) { + orgIds.add(department.getId()); + this.findSubDepartmentIds(department.getId(), orgIds); + } + } + + + /** + * 判断当前架构或者文件夹下是否含有 + * 匹配的文件属性【发布部门】 + * + * @param wsId + * @param pid + * @param orgIdList + * @return + */ + private boolean filterIsMatchPropertyModel(String wsId, String pid, Set orgIdList) { + boolean flag = false; + Iterator iterator = PALRepositoryCache.getByPid(wsId, pid); + while (iterator.hasNext()) { + PALRepositoryModel currentModel = iterator.next(); + if ("process.framework".equals(currentModel.getMethodId()) || "default".equals(currentModel.getMethodId())) { + flag = this.filterIsMatchPropertyModel(wsId, currentModel.getVersionId(), orgIdList); + } else { + List relationModels = DesignerShapeRelationCache.getByFileId(currentModel.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 = orgIdList.contains(deptId); + if (flag) + break; + } + } + } + if (flag) + break; + } + return flag; + } + + + + private boolean filterEmptyMoldel(String wsId, String pid) { + boolean flag = false; + Iterator iterator = PALRepositoryCache.getByPid(wsId, pid); + while (iterator.hasNext()) { + PALRepositoryModel currentModel = iterator.next(); + if ("process.framework".equals(currentModel.getMethodId()) || "default".equals(currentModel.getMethodId())) { + flag = this.filterEmptyMoldel(wsId, currentModel.getVersionId()); + } else { + flag = true; + } + if (flag) + break; + } + return flag; + } + + + /** + * 获取该部门下面所有子部门 + * @param arr_test + * @param departmentById + * @return + */ + public static ArrayList getChildDept(String deptID,ArrayList deptIDList) { + deptIDList.add(deptID); + Object[] sqlParams = new Object[]{}; + sqlParams = new Object[]{deptID}; + List subDeptMaps = DBSql.getMaps("SELECT ID FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID=?",sqlParams); + if (null!=subDeptMaps && !subDeptMaps.isEmpty()) { + for (RowMap subDeptMap : subDeptMaps) { + deptID = subDeptMap.getString("ID"); + getChildDept(deptID,deptIDList); + } + } + return deptIDList; + } + + + + + + private String getStatusLabel(PALRepositoryModel repositoryModel){ String statusLabel = "设计中"; if (repositoryModel.isApproval()){ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/util/CoeProcessLevelUtil.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/util/CoeProcessLevelUtil.java index 2d714cc2..6497afc4 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/util/CoeProcessLevelUtil.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/util/CoeProcessLevelUtil.java @@ -1616,26 +1616,13 @@ public class CoeProcessLevelUtil { public static List getPermRepositoryListByDeptId(String wsId, String teamId, String userId, String category, String method, boolean isUse, boolean isPublish,String departId) { List result = new ArrayList<>(); Set versionIds = getPermRepositoryVersionIds(wsId, teamId, userId, category, method); + for (String versionId : versionIds) { List list = PALRepositoryCache.getByVersionId(versionId); if (list != null) { for (PALRepositoryModel model : list) { if ((isUse && model.isUse()) || (isPublish && model.isPublish())) { - - List rlatRowMap = DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '" + model.getId() + "' and ATTRID='Issuing_department'"); - if (rlatRowMap.size() > 0) { - // 发布部门 - String dempId = ""; - for (RowMap oneRowMap : rlatRowMap) { - String relationshapetext = oneRowMap.getString("RELATIONSHAPETEXT"); - JSONObject js = JSONObject.parseObject(relationshapetext); - String getDepartId=js.getString("id"); - if(getDepartId.equals(departId)){ - result.add(model); - } - } - } - + result.add(model); } } } @@ -1645,6 +1632,8 @@ public class CoeProcessLevelUtil { + + /** * 获取最近编辑的模型文件 * diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.outputreport.pal.file.tree.htm b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.outputreport.pal.file.tree.htm index 1c3eb512..322d6f38 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.outputreport.pal.file.tree.htm +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.outputreport.pal.file.tree.htm @@ -62,7 +62,9 @@ leafType: "dept",//叶子节点类型,user:用户;dept:部门 filterClass: ""//过滤事件 }, + }, + separator : ","//逗号 空格……分隔符 }; $("#address_dept").address(options);