diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java index 12d02183..d5c36106 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/ToPageService.java @@ -156,28 +156,45 @@ public class ToPageService extends ActionWeb { String fileType = params.get("fileType"); String departId =params.get("departId"); List list = new ArrayList<>(); - if (departId.contains(",")){ - String[] split = departId.split(","); - for (String departID: - split) { - ArrayList childDept = getChildDept(departID, new ArrayList<>()); - if (childDept.size()>0){ - for (String departid: - childDept) { - list.add(departid); + if (departId.contains(uc.getCompanyModel().getId())){ + List maps = DBSql.getMaps("select ID from orgdepartment where 1=1 AND closed = '0'"); + for (RowMap rowMap: + maps) { + String id = rowMap.getString("ID"); + list.add(id); + } + }else { + + if (UtilString.isNotEmpty(departId)){ + if (departId.contains(",")){ + String[] split = departId.split(","); + for (String departID: + split) { + ArrayList childDept = getChildDept(departID, new ArrayList<>()); + if (childDept.size()>0){ + for (String departid: + childDept) { + list.add(departid); + } + } + } + }else { + ArrayList childDept = getChildDept(departId, new ArrayList<>()); + if (childDept.size()>0){ + for (String departid: + childDept) { + list.add(departid); + } } } } } System.out.println("list>>>>>>>>>>"+list); - String sb ="("; - for (String departids: - list) { - sb+="'"+departids+"'"+","; - } - sb = sb.substring(0,sb.length()-1); - sb+=")"; - System.out.println("sb>>>>>>>"+sb); + ro.put("departId",list.toString()); + + String sb = getAppendOrAndInString(list); + ro.put("sb",sb); + ro.put("frameIDtoFrameView",frameIDtoFrameView); System.out.println("======frameIDtoFrameView======" + frameIDtoFrameView); if (null != frameIDtoFrameView && !frameIDtoFrameView.equals("")) { //SDK.getLogAPI().consoleInfo("当前架构ID1"+frameID); @@ -208,9 +225,8 @@ public class ToPageService extends ActionWeb { List fileRowMaps =null; //List fileRowMaps = DBSql.getMaps("SELECT FILEID,PLPARENTID,PLNAME,PLMETHODID,SUPPORTFILE,PUBDEPT,PUBDATETIME,PLORDERINDEX,PLLEVEL,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE PLPARENTID=? AND FILESTATE='1' AND (PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams); if (sb.contains("'")){ - fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND EXT6 IN"+sb+" AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams); + fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND "+sb+" AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams); } else { - fileRowMaps = DBSql.getMaps("SELECT ID AS FILEID,PLPARENTID,PLNAME,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID=? AND ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart') ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC", sqlParams); } System.out.println("fileRowMaps>>>>>>>>>>"+fileRowMaps); @@ -260,120 +276,154 @@ public class ToPageService extends ActionWeb { } } } - } } - fileRowMaps.addAll(fileHandleRowMaps); } - System.out.println("========fileRowMaps2========>" + fileRowMaps.size()); - if (null != fileType && !fileType.equals("")) { - fileHandleRowMaps = new ArrayList<>(); - if (null != fileRowMaps && !fileRowMaps.isEmpty()) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileType.equals("processFile")) { - if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { - fileHandleRowMaps.add(fileRowMap); - } - } - System.out.println("========fileHandleRowMaps3========>" + fileHandleRowMaps.size()); - if (fileType.equals("policyFile")) { - if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) { - fileHandleRowMaps.add(fileRowMap); - } - } - // && fileRowMap.getString("POLICYTYPE").equals("regulation") - if (fileType.equals("guideFile")) { - if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { - fileHandleRowMaps.add(fileRowMap); - } - } - if (fileType.equals("formFile")) { - if (fileRowMap.getString("PLMETHODID").equals("data.form")) { - fileHandleRowMaps.add(fileRowMap); - String PLPARENTID = fileRowMap.getString("PLPARENTID"); - PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(PLPARENTID); - String PLMETHODID = reFileModel.getMethodId(); - String PUBDEPT = fileRowMap.getString("PUBDEPT"); - Integer PLLEVEL = fileRowMap.getInt("PLLEVEL"); - if (!PLMETHODID.equals("process.framework")) { - reFileMap = new HashMap<>(); - reFileMap.put("FILEID", reFileModel.getId()); - reFileMap.put("PLNAME", reFileModel.getName()); - reFileMap.put("PLPARENTID", reFileModel.getParentId()); - reFileMap.put("PLMETHODID", PLMETHODID); - reFileMap.put("PUBDEPT", PUBDEPT); - reFileMap.put("PLLEVEL", (PLLEVEL - 1)); - reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); - reFileRowMap = new RowMap(reFileMap); - fileHandleRowMaps.add(reFileRowMap); - } - } - } - if (fileType.equals("totalFile")) { + fileRowMaps.addAll(fileHandleRowMaps); + } + System.out.println("========fileRowMaps2========>" + fileRowMaps.size()); + if (null != fileType && !fileType.equals("")) { + fileHandleRowMaps = new ArrayList<>(); + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileType.equals("processFile")) { + if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { fileHandleRowMaps.add(fileRowMap); } } - } - fileHandleRowMaps = fileHandleRowMaps.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getString("FILEID")))), - ArrayList::new)); - fileRowMaps = fileHandleRowMaps; - } - if (null != fileRowMaps && !fileRowMaps.isEmpty()) { - for (RowMap fileRowMap : fileRowMaps) { - fileMap = new HashMap(); - model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); - if (model != null) { - if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 - taskId = getLastPublishTaskIdByModelId(model.getId()); + System.out.println("========fileHandleRowMaps3========>" + fileHandleRowMaps.size()); + if (fileType.equals("policyFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) { + fileHandleRowMaps.add(fileRowMap); } } - path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&" + "taskId=" + taskId; - nodeType = "file"; - fileMap.put("ID", fileRowMap.getString("FILEID")); - fileMap.put("PARENTID", fileRowMap.getString("PLPARENTID")); - fileMap.put("name", fileRowMap.getString("PLNAME")); - fileMap.put("PLMETHODID", fileRowMap.getString("PLMETHODID")); - fileMap.put("PUBDATETIME", fileRowMap.getString("PUBDATETIME")); - fileMap.put("path", path); - fileMap.put("ORDERINDEX", fileRowMap.getString("PLORDERINDEX")); - fileMap.put("TLEVEL", fileRowMap.getString("PLLEVEL")); - fileMap.put("nodeType", nodeType); - if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { - fileMap.put("fileType", "processFile"); - } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) { - // && fileRowMap.getString("POLICYTYPE").equals("regulation") - fileMap.put("fileType", "policyFile"); - } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { - fileMap.put("fileType", "guideFile"); - } else if (fileRowMap.getString("PLMETHODID").equals("data.form")) { - fileMap.put("fileType", "formFile"); + // && fileRowMap.getString("POLICYTYPE").equals("regulation") + if (fileType.equals("guideFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + fileHandleRowMaps.add(fileRowMap); + } + } + if (fileType.equals("formFile")) { + if (fileRowMap.getString("PLMETHODID").equals("data.form")) { + fileHandleRowMaps.add(fileRowMap); + String PLPARENTID = fileRowMap.getString("PLPARENTID"); + PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(PLPARENTID); + String PLMETHODID = reFileModel.getMethodId(); + String PUBDEPT = fileRowMap.getString("PUBDEPT"); + Integer PLLEVEL = fileRowMap.getInt("PLLEVEL"); + if (!PLMETHODID.equals("process.framework")) { + reFileMap = new HashMap<>(); + reFileMap.put("FILEID", reFileModel.getId()); + reFileMap.put("PLNAME", reFileModel.getName()); + reFileMap.put("PLPARENTID", reFileModel.getParentId()); + reFileMap.put("PLMETHODID", PLMETHODID); + reFileMap.put("PUBDEPT", PUBDEPT); + reFileMap.put("PLLEVEL", (PLLEVEL - 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + if (fileType.equals("totalFile")) { + fileHandleRowMaps.add(fileRowMap); } - fileMaps.add(fileMap); } - System.out.println("fileMaps============"+fileMaps); - - - List fileTreeNodes = TreeUtil.buildTree("1", fileMaps, null, "frame", null, null); - ro.put("fileMaps", fileTreeNodes); - System.err.println("============fileMaps============" + fileMaps); - System.err.println("============fileTreeNodes==========" + fileTreeNodes); - return ro.toString(); - } else { - ro.ok("暂无文件"); - fileMaps = new ArrayList<>(); - ro.put("fileMaps", fileMaps); - return ro.toString(); } + fileHandleRowMaps = fileHandleRowMaps.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getString("FILEID")))), + ArrayList::new)); + fileRowMaps = fileHandleRowMaps; + } + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + for (RowMap fileRowMap : fileRowMaps) { + fileMap = new HashMap(); + model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); + if (model != null) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + nodeType = "file"; + fileMap.put("ID", fileRowMap.getString("FILEID")); + fileMap.put("PARENTID", fileRowMap.getString("PLPARENTID")); + fileMap.put("name", fileRowMap.getString("PLNAME")); + fileMap.put("PLMETHODID", fileRowMap.getString("PLMETHODID")); + fileMap.put("PUBDATETIME", fileRowMap.getString("PUBDATETIME")); + fileMap.put("path", path); + fileMap.put("ORDERINDEX", fileRowMap.getString("PLORDERINDEX")); + fileMap.put("TLEVEL", fileRowMap.getString("PLLEVEL")); + fileMap.put("nodeType", nodeType); + if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { + fileMap.put("fileType", "processFile"); + } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null == fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) { + // && fileRowMap.getString("POLICYTYPE").equals("regulation") + fileMap.put("fileType", "policyFile"); + } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + fileMap.put("fileType", "guideFile"); + } else if (fileRowMap.getString("PLMETHODID").equals("data.form")) { + fileMap.put("fileType", "formFile"); + } + fileMaps.add(fileMap); + } + System.out.println("fileMaps============"+fileMaps); + + + List fileTreeNodes = TreeUtil.buildTree("1", fileMaps, null, "frame", null, null); + ro.put("fileMaps", fileTreeNodes); + System.err.println("============fileMaps============" + fileMaps); + System.err.println("============fileTreeNodes==========" + fileTreeNodes); + return ro.toString(); } else { - ro.ok("无效架构"); + ro.ok("暂无文件"); fileMaps = new ArrayList<>(); ro.put("fileMaps", fileMaps); return ro.toString(); } } else { - ro.ok("未传入有效架构ID"); + ro.ok("无效架构"); + fileMaps = new ArrayList<>(); + ro.put("fileMaps", fileMaps); + return ro.toString(); } - - return ro.toString(); + } else { + ro.ok("未传入有效架构ID"); } + return ro.toString(); + } + + + private static String getAppendOrAndInString(List list){ + StringBuffer sb=new StringBuffer(); + String returnString=""; + sb.append("("); + for(int i=0;i=900&&i