diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SynFileStateJob.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SynFileStateJob.java new file mode 100644 index 00000000..5f6a7d4b --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SynFileStateJob.java @@ -0,0 +1,83 @@ +package com.awspaas.user.apps.yili.reportform.job; + +import java.util.List; +import java.util.Map; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.schedule.IJob; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UtilString; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute; +/** + * 定时刷新APP_ACT_COE_PAL_REPOSITORY表最新版本的标识EXT3,用于部门视图展示最新版本 + * @author Administrator + * + */ +public class SynFileStateJob implements IJob { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + int count = 0; + int count2 = 0; + long start = System.currentTimeMillis(); + System.err.println("刷新版本标识ID开始==========>"); + List palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel() + .getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083"); + for (PALRepositoryModel palRepositoryModel : palRepositoryModels) { + String id = palRepositoryModel.getId(); + // 同步发布部门到APP_ACT_COE_PAL_REPOSITORY + try { + Map queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(id); + if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { + // 发布部门 + JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); + if (null != Issuing_department && !Issuing_department.equals("")) { + JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value"); + if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) { + for (Object PUBDEPTO : PUBDEPTJA) { + JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO)); + String dempId = PUBDEPTJO.getString("id"); + count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = '"+dempId+"' WHERE ID = '"+id+"'"); + + } + } + } + } + } catch (Exception e) { + // TODO: handle exception + } + + + // String methodId = palRepositoryModel.getMethodId(); + String plVersionId = palRepositoryModel.getVersionId(); + String sqly = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + plVersionId + "'"; + List maps = DBSql.getMaps(sqly); + if (maps.size() > 1) { + + String sqlu = "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + + plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; + String palId = DBSql.getString(sqlu); + if (UtilString.isNotEmpty(palId)) { + if (!id.equals(palId)) { + count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '0' WHERE ID = '"+id+"'"); + // continue; + } else { + count += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5 = '1' WHERE ID = '"+id+"'"); + } + + } + } + + } + long end = System.currentTimeMillis(); + System.err.println("刷新版本标识ID结束==========>本次处理数据:" + count+"条,用时:"+(end-start)/1000+"秒"); + System.err.println("同步发布部门结束==========>本次处理数据:" + count2+"条,用时:"+(end-start)/1000+"秒"); + } + +} diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java index 68b729f7..bee38dd6 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService.java @@ -199,9 +199,13 @@ public class DataViewService extends ActionWeb { // FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI // FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER // BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); - //List fileRowMaps1 = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY PLLEVEL ASC, PLORDERINDEX ASC"); + // List fileRowMaps1 = DBSql.getMaps("SELECT + // FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI + // FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER + // BY PLLEVEL ASC, PLORDERINDEX ASC"); // AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) // ASC + if (null != positionIDs && !positionIDs.isEmpty()) { UoPProcessMaps = new ArrayList(); nodeMaps = new ArrayList(); @@ -212,8 +216,7 @@ public class DataViewService extends ActionWeb { UoPProcessMap.put("text", "岗位流程"); UoPProcessMap.put("fileType", "UoPProcess"); UoPProcessMaps.add(UoPProcessMap); - List nodeRowMaps = DBSql.getMaps( - "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE5"); + long start = System.currentTimeMillis(); ArrayList positionNameList = new ArrayList<>(); for (String positionID : positionIDs) { sqlParams = new Object[] { positionID }; @@ -223,65 +226,70 @@ public class DataViewService extends ActionWeb { POSITION_NAME = POSITIONMap.getString("POSITION_NAME"); positionNameList.add(POSITION_NAME); } - } long start = System.currentTimeMillis(); - if (null != nodeRowMaps && !nodeRowMaps.isEmpty()) { - for (RowMap nodeRowMap : nodeRowMaps) { - String PLID = nodeRowMap.getString("PLID"); - RowMap fileRowMap = DBSql.getMap("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+PLID+"'"); - if(fileRowMap!=null) { - for (String positionName : positionNameList) { - // if (nodeRowMap.getString("ROLE").equals(positionID) || - // nodeRowMap.getString("POST").equals(positionID)) { - if (nodeRowMap.getString("POST").contains(positionName)) { - nodeMap = new HashMap(); - model = PALRepositoryCache.getCache().get(nodeRowMap.getString("PLID")); - if (null != model) { - if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 - taskId = getLastPublishTaskIdByModelId(model.getId()); - } - } - path = "./w" + "?" - + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" - + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" - + "taskId=" + taskId; - nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); - nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); - nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); - nodeMap.put("path", path); - nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); - nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); - nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); - nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); - nodeMaps.add(nodeMap); + } - UoPProcessMap = new HashMap(); - fileType = "process"; - model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); - if (null != model) { - 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; - UoPProcessMap.put("id", fileRowMap.getString("FILEID")); - UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); - UoPProcessMap.put("path", path); - UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); - UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); - UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); - UoPProcessMap.put("fileType", fileType); - UoPProcessMap.put("PARENTID", rootuuId); - UoPProcessMaps.add(UoPProcessMap); - } - } + for (String positionName : positionNameList) { + // if (nodeRowMap.getString("ROLE").equals(positionID) || + // nodeRowMap.getString("POST").equals(positionID)) { + List nodeRowMaps = DBSql.getMaps( + "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE POST LIKE '%" + + positionName + "%'"); + for (RowMap nodeRowMap : nodeRowMaps) { + String plId = nodeRowMap.getString("PLID"); + RowMap fileRowMap = DBSql.getMap( + "SELECT FILESTATE,FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '" + + plId + "'"); + if (fileRowMap != null) { + if ("0".equals(fileRowMap.getString("FILESTATE"))) { + continue; + } + nodeMap = new HashMap(); + model = PALRepositoryCache.getCache().get(plId); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); } } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); + nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); + nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); + nodeMap.put("path", path); + nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); + nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); + nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); + nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); + nodeMaps.add(nodeMap); + + UoPProcessMap = new HashMap(); + fileType = "process"; + model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); + if (null != model) { + 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; + UoPProcessMap.put("id", fileRowMap.getString("FILEID")); + UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); + UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); + UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", rootuuId); + UoPProcessMaps.add(UoPProcessMap); } + + } + } + long end = System.currentTimeMillis(); - System.err.println("个人视图(岗位流程)查询用时=========>"+(end-start)/1000+"秒"); + System.err.println("个人视图(岗位流程)查询用时=========>" + (end - start) / 1000 + "秒"); UoPProcessMaps = UoPProcessMaps.stream() .collect(collectingAndThen( toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), @@ -553,31 +561,30 @@ public class DataViewService extends ActionWeb { } } - nodeAMaps = new ArrayList<>(); - nodeBMaps = new ArrayList<>(); - if (null != nodeMaps && !nodeMaps.isEmpty()) { - for (Map nodeReturnMap : nodeMaps) { - nodeTempMap = new HashMap(); - String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); - if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { - nodeTempMap = nodeReturnMap; - nodeAMaps.add(nodeTempMap); - } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { - nodeTempMap = nodeReturnMap; - nodeBMaps.add(nodeTempMap); - } + nodeAMaps = new ArrayList<>(); + nodeBMaps = new ArrayList<>(); + if (null != nodeMaps && !nodeMaps.isEmpty()) { + for (Map nodeReturnMap : nodeMaps) { + nodeTempMap = new HashMap(); + String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { + nodeTempMap = nodeReturnMap; + nodeAMaps.add(nodeTempMap); + } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + nodeTempMap = nodeReturnMap; + nodeBMaps.add(nodeTempMap); } } - totalNum = nodeMaps.size(); - aNum = nodeAMaps.size(); - bNum = nodeBMaps.size(); - ro.put("totalNodeNum", totalNum); - ro.put("totalNode", nodeMaps); - ro.put("typeANum", aNum); - ro.put("typeA", nodeAMaps); - ro.put("typeBNum", bNum); - ro.put("typeB", nodeBMaps); - + } + totalNum = nodeMaps.size(); + aNum = nodeAMaps.size(); + bNum = nodeBMaps.size(); + ro.put("totalNodeNum", totalNum); + ro.put("totalNode", nodeMaps); + ro.put("typeANum", aNum); + ro.put("typeA", nodeAMaps); + ro.put("typeBNum", bNum); + ro.put("typeB", nodeBMaps); // 岗位流程/我的流程 } else { @@ -592,72 +599,72 @@ public class DataViewService extends ActionWeb { UoPProcessMap.put("fileType", "UoPProcess"); UoPProcessMaps.add(UoPProcessMap); long start = System.currentTimeMillis(); - List nodeRowMaps = DBSql.getMaps( - "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE5"); String POSITION_NAME = UserContext.fromUID(uid).getUserModel().getPositionName(); - if (UtilString.isNotEmpty(POSITION_NAME)) { - for (RowMap nodeRowMap : nodeRowMaps) { - String PLID = nodeRowMap.getString("PLID"); - RowMap fileRowMap = DBSql.getMap("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+PLID+"'"); - count++; - if(fileRowMap!=null) { - if (nodeRowMap.getString("POST").contains(POSITION_NAME)) { - // if (nodeRowMap.getString("ROLE").equals(positionID) || - // nodeRowMap.getString("POST").equals(positionID)) { - nodeMap = new HashMap(); - model = PALRepositoryCache.getCache().get(nodeRowMap.getString("PLID")); - if (null != model) { - if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 - taskId = getLastPublishTaskIdByModelId(model.getId()); - } - } - path = "./w" + "?" - + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" - + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" - + "taskId=" + taskId; - nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); - nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); - nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); - nodeMap.put("path", path); - nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); - nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); - nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); - nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); - nodeMaps.add(nodeMap); - - UoPProcessMap = new HashMap(); - fileType = "process"; - model = PALRepositoryCache.getCache().get(PLID); - if (null != model) { - if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 - taskId = getLastPublishTaskIdByModelId(model.getId()); - } - } - path = "./w" + "?" - + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" - + "uuid=" + PLID + "&" + "sid=" + sid + "&" - + "taskId=" + taskId; - UoPProcessMap.put("id", PLID); - UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); - UoPProcessMap.put("path", path); - UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); - UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); - UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); - UoPProcessMap.put("fileType", fileType); - UoPProcessMap.put("PARENTID", rootuuId); - UoPProcessMaps.add(UoPProcessMap); - } - - } - + if (UtilString.isNotEmpty(POSITION_NAME)) { + List nodeRowMaps = DBSql.getMaps( + "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE POST LIKE '%" + + POSITION_NAME + "%'"); + for (RowMap nodeRowMap : nodeRowMaps) { + String PLID = nodeRowMap.getString("PLID"); + RowMap fileRowMap = DBSql.getMap( + "SELECT FILESTATE,FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '" + + PLID + "'"); + count++; + if (fileRowMap != null) { + if ("0".equals(fileRowMap.getString("FILESTATE"))) { + continue; + } + // if (nodeRowMap.getString("ROLE").equals(positionID) || + // nodeRowMap.getString("POST").equals(positionID)) { + nodeMap = new HashMap(); + model = PALRepositoryCache.getCache().get(nodeRowMap.getString("PLID")); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); } - - - }else { + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); + nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); + nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); + nodeMap.put("path", path); + nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); + nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); + nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); + nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); + nodeMaps.add(nodeMap); + + UoPProcessMap = new HashMap(); + fileType = "process"; + model = PALRepositoryCache.getCache().get(PLID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + PLID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", PLID); + UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); + UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); + UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", rootuuId); + UoPProcessMaps.add(UoPProcessMap); + + } + + } + + } else { ro.info("当前用户未设置岗位"); } long end = System.currentTimeMillis(); - System.err.println("个人视图(我的流程)查询用时=========>"+(end-start)/1000+"秒"); + System.err.println("个人视图(我的流程)查询用时=========>" + (end - start) / 1000 + "秒"); UoPProcessMaps = UoPProcessMaps.stream() .collect(collectingAndThen( toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), @@ -929,31 +936,31 @@ public class DataViewService extends ActionWeb { ro.info("您的岗位暂无需执行的流程"); } } - nodeAMaps = new ArrayList<>(); - nodeBMaps = new ArrayList<>(); - if (null != nodeMaps && !nodeMaps.isEmpty()) { - for (Map nodeReturnMap : nodeMaps) { - nodeTempMap = new HashMap(); - String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); - if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { - nodeTempMap.putAll(nodeReturnMap); - nodeAMaps.add(nodeTempMap); - } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { - nodeTempMap.putAll(nodeReturnMap); - nodeBMaps.add(nodeTempMap); - } + nodeAMaps = new ArrayList<>(); + nodeBMaps = new ArrayList<>(); + if (null != nodeMaps && !nodeMaps.isEmpty()) { + for (Map nodeReturnMap : nodeMaps) { + nodeTempMap = new HashMap(); + String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { + nodeTempMap.putAll(nodeReturnMap); + nodeAMaps.add(nodeTempMap); + } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + nodeTempMap.putAll(nodeReturnMap); + nodeBMaps.add(nodeTempMap); } } - totalNum = nodeMaps.size(); - aNum = nodeAMaps.size(); - bNum = nodeBMaps.size(); - ro.put("totalNodeNum", totalNum); - ro.put("totalNode", nodeMaps); - ro.put("typeANum", aNum); - ro.put("typeA", nodeAMaps); - ro.put("typeBNum", bNum); - ro.put("typeB", nodeBMaps); - + } + totalNum = nodeMaps.size(); + aNum = nodeAMaps.size(); + bNum = nodeBMaps.size(); + ro.put("totalNodeNum", totalNum); + ro.put("totalNode", nodeMaps); + ro.put("typeANum", aNum); + ro.put("typeA", nodeAMaps); + ro.put("typeBNum", bNum); + ro.put("typeB", nodeBMaps); + } return ro.toString(); } @@ -1056,6 +1063,7 @@ public class DataViewService extends ActionWeb { String deptString = params.get("dept"); String fileType = params.get("fileType"); ArrayList deptIDList = new ArrayList<>(); + ArrayList deptIDList2 = new ArrayList<>(); String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; ArrayList fileHandleRowMaps = new ArrayList<>(); Map reFileMap = new HashMap<>(); @@ -1075,88 +1083,83 @@ public class DataViewService extends ActionWeb { deptIDList = new ArrayList(); deptIDList = GetNodesUtil.getChildDept(ucDeptID, deptIDList); if (deptIDList != null) { + deptIDList2 = deptIDList; deptString = deptIDList.toString(); } } - System.err.println("查询部门视图===>" + fileListMap.size()); - for (RowMap rowMap : fileListMap) { + String sqlParm = deptString; + if (UtilString.isNotEmpty(deptString)) { + if (deptString.contains(",")) { + StringBuffer sbu = new StringBuffer(); + net.sf.json.JSONArray jsonArry = net.sf.json.JSONArray.fromObject(deptString); + for (int i = 0; i < jsonArry.size(); i++) { + if (jsonArry.size() == 1) { + sbu.append("'").append(jsonArry.getString(i)).append("'"); + } else { + if (i == jsonArry.size() - 1) { + sbu.append("'").append(jsonArry.getString(i)).append("'"); + } else { + sbu.append("'").append(jsonArry.getString(i)).append("'").append(","); - String id = rowMap.getString("FILEID"); - - /* - * String plVersionId = rowMap.getString("PLVERSIONID"); String sqly = - * "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + - * plVersionId + "'"; List maps = DBSql.getMaps(sqly); if (maps.size() > - * 1) { String sqlu = - * "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" - * + plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; - * String palId = DBSql.getString(sqlu); if (UtilString.isNotEmpty(palId)) { if - * (!id.equals(palId)) { continue; } } } - */ - - PALRepositoryModel model = PALRepositoryCache.getCache().get(id); - if (model != null) { - try { - Integer PLLEVEL = model.getLevel(); - String methodId = model.getMethodId(); - - Map queryRepositoryAttributeById = new RepositoryAttribute() - .queryRepositoryAttributeById(model.getId()); - if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { - // 发布部门 - JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); - if (null != Issuing_department && !Issuing_department.equals("")) { - JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value"); - if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) { - for (Object PUBDEPTO : PUBDEPTJA) { - JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO)); - dempId = PUBDEPTJO.getString("id"); - if (deptString.contains(dempId)) { - // 默认添加所在部门的所有文件 - fileHandleRowMaps.add(rowMap); - if ("process.epc".equals(methodId) - || "process.flowchart".equals(methodId)) { - // 支持文件 - getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - // 相关文件 - getArrt("R_relevant_flies", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - } else if ("control.policy".equals(methodId)) { - // 支持文件 - getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - // 相关文件 - getArrt("related_files", model, dempId, PLLEVEL, reFileRowMap, - fileHandleRowMaps); - } - } - - } - } } - } - } catch (Exception e) { - System.err.println("==有问题的模型===>" + model.getName()); - // TODO: handle exception } - + sqlParm = sbu.toString(); + } else { + sqlParm = "'" + deptString.replace("[", "").replace("]", "") + "'"; } } + System.err.println("=========sqlParm=========" + sqlParm); + try { + String sqltt = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND EXT6 IN (" + sqlParm + ") AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + List maps = DBSql.getMaps(sqltt); + System.err.println("=========maps=======" + maps.size()); + for (RowMap rowMap : maps) { + String id = rowMap.getString("FILEID"); + PALRepositoryModel model = PALRepositoryCache.getCache().get(id); + if (model != null) { + try { + Integer PLLEVEL = model.getLevel(); + String methodId = model.getMethodId(); + // 默认添加所在部门的所有文件 + fileHandleRowMaps.add(rowMap); + if ("process.epc".equals(methodId) || "process.flowchart".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, fileHandleRowMaps); + // 相关文件 + getArrt("R_relevant_flies", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } else if ("control.policy".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, fileHandleRowMaps); + // 相关文件 + getArrt("related_files", model, dempId, PLLEVEL, reFileRowMap, fileHandleRowMaps); + } + + } catch (Exception e) { + + System.err.println("==有问题的模型===>" + model.getName()); + // TODO: handle exception + } + + } + + + + } + + } catch (Exception e) { + // TODO: handle exception + } + + System.err.println("查询部门视图===>" + fileListMap.size()); fileRowMaps = fileHandleRowMaps; long endTime = System.currentTimeMillis(); - // System.err.println("------测试1---------" + fileHandleRowMaps); - // System.err.println("------测试2---------" + fileRowMaps); - // System.out.println("代码段执行时间:" + (endTime - startTime) + "ms"); - // System.err.println("=========fileRowMaps1========>"+fileRowMaps); - // System.err.println("=========fileType========>"+fileType); if (null != fileRowMaps && fileRowMaps.size() > 0) { if (null != fileType && !fileType.equals("")) { fileHandleRowMaps = new ArrayList<>(); - // System.err.println("=====fileRowMaps2========"+fileRowMaps); if (null != fileRowMaps && !fileRowMaps.isEmpty()) { for (RowMap fileRowMap : fileRowMaps) { if (fileType.equals("processFile")) { diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService4.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService4.java new file mode 100644 index 00000000..a99ef02c --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService4.java @@ -0,0 +1,1463 @@ +package com.awspaas.user.apps.yili.reportform.service; + +import static com.awspaas.user.apps.yili.reportform.util.TaskUtil.getLastPublishTaskIdByModelId; +import static java.util.stream.Collectors.collectingAndThen; +import static java.util.stream.Collectors.toCollection; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; +import java.util.stream.Collectors; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager; +import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel; +import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache; +import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.mvc.view.ActionWeb; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.RequestParams; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UtilString; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil; +import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute; +import com.awspaas.user.apps.yili.reportform.util.TreeUtil; + +/** + * @author:Lizj + * @create: 2022-07-11 14:04 + * @Description: 个人/部门视图 + */ +@SuppressWarnings("all") +public class DataViewService4 extends ActionWeb { + + UserContext _uc; + + public DataViewService4(UserContext uc) { + super(uc); + _uc = uc; + } + + /** + * @methodName: + * @param: + * @return: + * @description:个人视图筛选条件 + * @auther: Lizj + * @date: 2022/7/11 14:11 + */ + public String queryTermsPerson(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + // 基本信息 + // 当前登录信息 + ArrayList currentLoginMaps = new ArrayList<>(); + LinkedHashMap currentLoginMap = new LinkedHashMap<>(); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "账号"); + currentLoginMap.put("text", uc.getUserModel().getUID()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "姓名"); + currentLoginMap.put("text", uc.getUserModel().getUserName()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "部门"); + currentLoginMap.put("text", uc.getDepartmentModel().getName()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "岗位"); + currentLoginMap.put("text", uc.getUserModel().getPositionName()); + currentLoginMaps.add(currentLoginMap); + ro.put("personInfos", currentLoginMaps); + return ro.toString(); + } + + public String queryTermsPosition(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + // 岗位查询 + Object[] sqlParams = new Object[] {}; + String departmentById = uc.getDepartmentModel().getId(); + sqlParams = new Object[] { departmentById }; + List positionRowMapsOrg = DBSql.getMaps( + "SELECT ID, POSITION_NO, POSITION_NAME, DEPARTMENTID, ORDERINDEX FROM ORGUSER WHERE POSITION_NO IS NOT NULL AND DEPARTMENTID=?", + sqlParams); + List positionRowMaps = positionRowMapsOrg.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getString("POSITION_NO")))), + ArrayList::new)); + List deptMaps = DBSql.getMaps( + "SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + " WHERE ID=?", + sqlParams); + // demo3 + // 3e74f14d-852f-4f6f-a809-08a56697f103 + // 本地 + // d7087d5b-ab29-4514-a7e7-79379f6842a2 + // 正式 + // 8911e732-b42a-4556-853f-ad32761bcbee + String nodeType = null; + ArrayList deptNodes = new ArrayList<>(); + if (null != deptMaps && !deptMaps.isEmpty()) { + for (RowMap deptMap : deptMaps) { + if (null != positionRowMaps && !positionRowMaps.isEmpty()) { + for (RowMap positionRowMap : positionRowMaps) { + // String userID = positionRowMap.getString("ID"); + String ID = positionRowMap.getString("POSITION_NO"); + String PARENTID = positionRowMap.getString("DEPARTMENTID"); + String name = positionRowMap.getString("POSITION_NAME"); + String ORDERINDEX = positionRowMap.getString("ORDERINDEX"); + String TLEVEL = String.valueOf(Integer.valueOf(deptMap.getString("LAYER")) + 1); + HashMap deptNode = new HashMap<>(); + nodeType = "position"; + // deptNode.put("userID",userID); + deptNode.put("ID", ID); + deptNode.put("PARENTID", PARENTID); + deptNode.put("name", name); + deptNode.put("ORDERINDEX", ORDERINDEX); + deptNode.put("TLEVEL", TLEVEL); + deptNode.put("nodeType", nodeType); + deptNodes.add(deptNode); + } + } + HashMap deptNode = new HashMap<>(); + nodeType = "dept"; + deptNode.put("ID", deptMap.getString("ID")); + deptNode.put("PARENTID", deptMap.getString("PARENTDEPARTMENTID")); + deptNode.put("name", deptMap.getString("DEPARTMENTNAME")); + deptNode.put("ORDERINDEX", deptMap.getString("ORDERINDEX")); + deptNode.put("TLEVEL", deptMap.getString("LAYER")); + deptNode.put("nodeType", nodeType); + deptNodes.add(deptNode); + } + } + nodeType = "position"; + List deptTreeNodes = TreeUtil.buildTree("0", deptNodes, null, "dept", null, nodeType); + ro.put("positionTree", deptTreeNodes); + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:个人视图 + * @auther: Lizj + * @date: 2022/7/11 14:14 + */ + public String personalView(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + String positionKeys = null; + String positionVals = null; + ArrayList positionIDs = new ArrayList<>(); + Integer i = -1; + while (true) { + i++; + positionKeys = "position" + "[" + i + "]"; + positionVals = params.get(positionKeys); + if (null != positionVals && !positionVals.equals("")) { + positionIDs.add(positionVals); + } else { + break; + } + } + String uid = params.get("uid"); + String sid = _uc.getSessionId(); + // 定义用户/岗位流程list,用户/岗位流程map + ArrayList UoPProcessMaps = new ArrayList<>(); + HashMap UoPProcessMap = new HashMap<>(); + ArrayList nodeMaps = new ArrayList<>(); + ArrayList nodeAMaps = new ArrayList<>(); + ArrayList nodeBMaps = new ArrayList<>(); + HashMap nodeMap = new HashMap<>(); + Map nodeTempMap = new HashMap<>(); + ArrayList reRegulationMaps = new ArrayList<>(); + ArrayList reFormMaps = new ArrayList<>(); + ArrayList reIO_L4Maps = new ArrayList<>(); + ArrayList reYSMaps = new ArrayList<>(); + ArrayList tempMaps = new ArrayList<>(); + LinkedList linksMaps = new LinkedList<>(); + HashMap linksMap = new HashMap<>(); + String path = ""; + PALRepositoryModel model = null; + String taskId = ""; + String fileType = ""; + Integer totalNum = 0; + Integer aNum = 0; + Integer bNum = 0; + Object[] sqlParams = new Object[] {}; + // List fileRowMaps = DBSql.getMaps("SELECT + // FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI + // FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER + // BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); + //List fileRowMaps1 = DBSql.getMaps("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER BY PLLEVEL ASC, PLORDERINDEX ASC"); + // AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) + // ASC + if (null != positionIDs && !positionIDs.isEmpty()) { + UoPProcessMaps = new ArrayList(); + nodeMaps = new ArrayList(); + linksMaps = new LinkedList(); + UoPProcessMap = new HashMap(); + String rootuuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + UoPProcessMap.put("id", rootuuId); + UoPProcessMap.put("text", "岗位流程"); + UoPProcessMap.put("fileType", "UoPProcess"); + UoPProcessMaps.add(UoPProcessMap); + List nodeRowMaps = DBSql.getMaps( + "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6"); + + ArrayList positionNameList = new ArrayList<>(); + for (String positionID : positionIDs) { + sqlParams = new Object[] { positionID }; + RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO=?", sqlParams); + String POSITION_NAME = null; + if (null != POSITIONMap && !POSITIONMap.isEmpty()) { + POSITION_NAME = POSITIONMap.getString("POSITION_NAME"); + positionNameList.add(POSITION_NAME); + } + } long start = System.currentTimeMillis(); + if (null != nodeRowMaps && !nodeRowMaps.isEmpty()) { + for (RowMap nodeRowMap : nodeRowMaps) { + String PLID = nodeRowMap.getString("PLID"); + RowMap fileRowMap = DBSql.getMap("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+PLID+"'"); + if(fileRowMap!=null) { + for (String positionName : positionNameList) { + // if (nodeRowMap.getString("ROLE").equals(positionID) || + // nodeRowMap.getString("POST").equals(positionID)) { + if (nodeRowMap.getString("POST").contains(positionName)) { + nodeMap = new HashMap(); + model = PALRepositoryCache.getCache().get(nodeRowMap.getString("PLID")); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" + + "taskId=" + taskId; + nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); + nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); + nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); + nodeMap.put("path", path); + nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); + nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); + nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); + nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); + nodeMaps.add(nodeMap); + + UoPProcessMap = new HashMap(); + fileType = "process"; + model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); + if (null != model) { + 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; + UoPProcessMap.put("id", fileRowMap.getString("FILEID")); + UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); + UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); + UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", rootuuId); + UoPProcessMaps.add(UoPProcessMap); + } + } + } + } + } + long end = System.currentTimeMillis(); + System.err.println("个人视图(岗位流程)查询用时=========>"+(end-start)/1000+"秒"); + UoPProcessMaps = UoPProcessMaps.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), + ArrayList::new)); + tempMaps = new ArrayList(); + if (nodeMaps.size() == 0) { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您所查询的岗位暂无需执行的流程"); + + } else { + for (Map uoPProcessMap : UoPProcessMaps) { + reRegulationMaps = new ArrayList<>(); + reFormMaps = new ArrayList<>(); + reIO_L4Maps = new ArrayList<>(); + reYSMaps = new ArrayList<>(); + String FILEID = String.valueOf(uoPProcessMap.get("id")); + fileType = String.valueOf(uoPProcessMap.get("fileType")); + if (fileType.equals("process")) { + String RELEVANTFILE = String.valueOf(uoPProcessMap.get("RELEVANTFILE")); + String SUPPORTFILE = String.valueOf(uoPProcessMap.get("SUPPORTFILE")); + String PROCESSKPI = String.valueOf(uoPProcessMap.get("PROCESSKPI")); + if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) { + String[] reFileIDs = RELEVANTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + 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=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) { + String[] reFileIDs = SUPPORTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != PROCESSKPI && !PROCESSKPI.equals("")) { + String[] PROCESSKPIIDS = PROCESSKPI.split(" "); + for (String PROCESSKPIID : PROCESSKPIIDS) { + sqlParams = new Object[] { PROCESSKPIID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + UoPProcessMap = new HashMap(); + fileType = "processKPIFile"; + model = PALRepositoryCache.getCache().get(PROCESSKPIID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + + "&" + "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reProcessKPI"); + reYSMaps.add(UoPProcessMap); + } + } + } + if (null != reRegulationMaps && !reRegulationMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reRegulation"); + UoPProcessMap.put("text", "相关制度"); + UoPProcessMap.put("fileType", "reRegulation"); + UoPProcessMap.put("PARENTID", FILEID); + reRegulationMaps.add(UoPProcessMap); + } + if (null != reFormMaps && !reFormMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reForm"); + UoPProcessMap.put("text", "相关表单"); + UoPProcessMap.put("fileType", "reForm"); + UoPProcessMap.put("PARENTID", FILEID); + reFormMaps.add(UoPProcessMap); + } + if (null != reIO_L4Maps && !reIO_L4Maps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reI/O_L4"); + UoPProcessMap.put("text", "相关操作指导"); + UoPProcessMap.put("fileType", "reI/O_L4"); + UoPProcessMap.put("PARENTID", FILEID); + reIO_L4Maps.add(UoPProcessMap); + } + if (null != reYSMaps && !reYSMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reYS"); + UoPProcessMap.put("text", "相关要素"); + UoPProcessMap.put("fileType", "reYS"); + UoPProcessMap.put("PARENTID", FILEID); + reYSMaps.add(UoPProcessMap); + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reProcessKPI"); + UoPProcessMap.put("text", "绩效"); + UoPProcessMap.put("fileType", "reProcessKPI"); + UoPProcessMap.put("PARENTID", FILEID + "reYS"); + reYSMaps.add(UoPProcessMap); + } + tempMaps.addAll(reRegulationMaps); + tempMaps.addAll(reFormMaps); + tempMaps.addAll(reIO_L4Maps); + tempMaps.addAll(reYSMaps); + } + } + UoPProcessMaps.addAll(tempMaps); + if (UoPProcessMaps.size() > 1) { + for (Map uoPProcessMap : UoPProcessMaps) { + if (String.valueOf(uoPProcessMap.get("fileType")).equals("UoPProcess")) { + ro.put("rootId", String.valueOf(uoPProcessMap.get("id"))); + } + } + ro.put("nodes", UoPProcessMaps); + for (Map uoPProcessMap : UoPProcessMaps) { + String id = String.valueOf(uoPProcessMap.get("id")); + for (Map pProcessMap : UoPProcessMaps) { + String PARENTID = String.valueOf(pProcessMap.get("PARENTID")); + if (id.equals(PARENTID)) { + String childID = String.valueOf(pProcessMap.get("id")); + linksMap = new LinkedHashMap(); + linksMap.put("from", id); + linksMap.put("to", childID); + linksMaps.add(linksMap); + } + } + } + ro.put("links", linksMaps); + } else { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您所查询的岗位暂无需执行的流程"); + + } + } + nodeAMaps = new ArrayList<>(); + nodeBMaps = new ArrayList<>(); + if (null != nodeMaps && !nodeMaps.isEmpty()) { + for (Map nodeReturnMap : nodeMaps) { + nodeTempMap = new HashMap(); + String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { + nodeTempMap = nodeReturnMap; + nodeAMaps.add(nodeTempMap); + } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + nodeTempMap = nodeReturnMap; + nodeBMaps.add(nodeTempMap); + } + } + } + totalNum = nodeMaps.size(); + aNum = nodeAMaps.size(); + bNum = nodeBMaps.size(); + ro.put("totalNodeNum", totalNum); + ro.put("totalNode", nodeMaps); + ro.put("typeANum", aNum); + ro.put("typeA", nodeAMaps); + ro.put("typeBNum", bNum); + ro.put("typeB", nodeBMaps); + + + // 岗位流程/我的流程 + } else { + int count = 0; + UoPProcessMaps = new ArrayList(); + nodeMaps = new ArrayList(); + linksMaps = new LinkedList(); + UoPProcessMap = new HashMap(); + String rootuuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + UoPProcessMap.put("id", rootuuId); + UoPProcessMap.put("text", "我的流程"); + UoPProcessMap.put("fileType", "UoPProcess"); + UoPProcessMaps.add(UoPProcessMap); + long start = System.currentTimeMillis(); + List nodeRowMaps = DBSql.getMaps( + "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6"); + String POSITION_NAME = UserContext.fromUID(uid).getUserModel().getPositionName(); + if (UtilString.isNotEmpty(POSITION_NAME)) { + for (RowMap nodeRowMap : nodeRowMaps) { + String PLID = nodeRowMap.getString("PLID"); + RowMap fileRowMap = DBSql.getMap("SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+PLID+"'"); + count++; + if(fileRowMap!=null) { + if (nodeRowMap.getString("POST").contains(POSITION_NAME)) { + // if (nodeRowMap.getString("ROLE").equals(positionID) || + // nodeRowMap.getString("POST").equals(positionID)) { + nodeMap = new HashMap(); + model = PALRepositoryCache.getCache().get(nodeRowMap.getString("PLID")); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" + + "taskId=" + taskId; + nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); + nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); + nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); + nodeMap.put("path", path); + nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); + nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); + nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); + nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); + nodeMaps.add(nodeMap); + + UoPProcessMap = new HashMap(); + fileType = "process"; + model = PALRepositoryCache.getCache().get(PLID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + PLID + "&" + "sid=" + sid + "&" + + "taskId=" + taskId; + UoPProcessMap.put("id", PLID); + UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); + UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); + UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", rootuuId); + UoPProcessMaps.add(UoPProcessMap); + } + + } + + } + + + }else { + ro.info("当前用户未设置岗位"); + } + long end = System.currentTimeMillis(); + System.err.println("个人视图(我的流程)查询用时=========>"+(end-start)/1000+"秒"); + UoPProcessMaps = UoPProcessMaps.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), + ArrayList::new)); + tempMaps = new ArrayList(); + + if (nodeMaps.size() == 0) { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您的岗位暂无需执行的流程"); + } else { + for (Map uoPProcessMap : UoPProcessMaps) { + reRegulationMaps = new ArrayList<>(); + reFormMaps = new ArrayList<>(); + reIO_L4Maps = new ArrayList<>(); + reYSMaps = new ArrayList<>(); + String FILEID = String.valueOf(uoPProcessMap.get("id")); + fileType = String.valueOf(uoPProcessMap.get("fileType")); + if (fileType.equals("process")) { + String RELEVANTFILE = String.valueOf(uoPProcessMap.get("RELEVANTFILE")); + String SUPPORTFILE = String.valueOf(uoPProcessMap.get("SUPPORTFILE")); + String PROCESSKPI = String.valueOf(uoPProcessMap.get("PROCESSKPI")); + if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) { + String[] reFileIDs = RELEVANTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) { + String[] reFileIDs = SUPPORTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != PROCESSKPI && !PROCESSKPI.equals("")) { + String[] PROCESSKPIIDS = PROCESSKPI.split(" "); + for (String PROCESSKPIID : PROCESSKPIIDS) { + sqlParams = new Object[] { PROCESSKPIID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + UoPProcessMap = new HashMap(); + fileType = "processKPIFile"; + model = PALRepositoryCache.getCache().get(PROCESSKPIID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + + "&" + "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reProcessKPI"); + reYSMaps.add(UoPProcessMap); + } + } + } + if (null != reRegulationMaps && !reRegulationMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reRegulation"); + UoPProcessMap.put("text", "相关制度"); + UoPProcessMap.put("fileType", "reRegulation"); + UoPProcessMap.put("PARENTID", FILEID); + reRegulationMaps.add(UoPProcessMap); + } + if (null != reFormMaps && !reFormMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reForm"); + UoPProcessMap.put("text", "相关表单"); + UoPProcessMap.put("fileType", "reForm"); + UoPProcessMap.put("PARENTID", FILEID); + reFormMaps.add(UoPProcessMap); + } + if (null != reIO_L4Maps && !reIO_L4Maps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reI/O_L4"); + UoPProcessMap.put("text", "相关操作指导"); + UoPProcessMap.put("fileType", "reI/O_L4"); + UoPProcessMap.put("PARENTID", FILEID); + reIO_L4Maps.add(UoPProcessMap); + } + if (null != reYSMaps && !reYSMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reYS"); + UoPProcessMap.put("text", "相关要素"); + UoPProcessMap.put("fileType", "reYS"); + UoPProcessMap.put("PARENTID", FILEID); + reYSMaps.add(UoPProcessMap); + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reProcessKPI"); + UoPProcessMap.put("text", "绩效"); + UoPProcessMap.put("fileType", "reProcessKPI"); + UoPProcessMap.put("PARENTID", FILEID + "reYS"); + reYSMaps.add(UoPProcessMap); + } + tempMaps.addAll(reRegulationMaps); + tempMaps.addAll(reFormMaps); + tempMaps.addAll(reIO_L4Maps); + tempMaps.addAll(reYSMaps); + } + } + // 所有数据 + UoPProcessMaps.addAll(tempMaps); + if (UoPProcessMaps.size() > 1) { + for (Map uoPProcessMap : UoPProcessMaps) { + if (String.valueOf(uoPProcessMap.get("fileType")).equals("UoPProcess")) { + ro.put("rootId", String.valueOf(uoPProcessMap.get("id"))); + } + } + ro.put("nodes", UoPProcessMaps); + for (Map uoPProcessMap : UoPProcessMaps) { + String id = String.valueOf(uoPProcessMap.get("id")); + for (Map pProcessMap : UoPProcessMaps) { + String PARENTID = String.valueOf(pProcessMap.get("PARENTID")); + if (id.equals(PARENTID)) { + String childID = String.valueOf(pProcessMap.get("id")); + linksMap = new LinkedHashMap(); + linksMap.put("from", id); + linksMap.put("to", childID); + linksMaps.add(linksMap); + } + } + } + ro.put("links", linksMaps); + } else { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您的岗位暂无需执行的流程"); + } + } + nodeAMaps = new ArrayList<>(); + nodeBMaps = new ArrayList<>(); + if (null != nodeMaps && !nodeMaps.isEmpty()) { + for (Map nodeReturnMap : nodeMaps) { + nodeTempMap = new HashMap(); + String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { + nodeTempMap.putAll(nodeReturnMap); + nodeAMaps.add(nodeTempMap); + } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + nodeTempMap.putAll(nodeReturnMap); + nodeBMaps.add(nodeTempMap); + } + } + } + totalNum = nodeMaps.size(); + aNum = nodeAMaps.size(); + bNum = nodeBMaps.size(); + ro.put("totalNodeNum", totalNum); + ro.put("totalNode", nodeMaps); + ro.put("typeANum", aNum); + ro.put("typeA", nodeAMaps); + ro.put("typeBNum", bNum); + ro.put("typeB", nodeBMaps); + + } + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门视图筛选条件:部门 + * @auther: Lizj + * @date: 2022/7/11 14:14 + */ + public String queryTermsDept(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + + // 当前登录信息 + ArrayList currentLoginMaps = new ArrayList<>(); + LinkedHashMap currentLoginMap = new LinkedHashMap<>(); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "账号"); + currentLoginMap.put("text", uc.getUserModel().getUID()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "姓名"); + currentLoginMap.put("text", uc.getUserModel().getUserName()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "部门"); + currentLoginMap.put("text", uc.getDepartmentModel().getPathNameOfCache()); + currentLoginMaps.add(currentLoginMap); + ro.put("personInfos", currentLoginMaps); + + // 部门查询 + List deptMaps = DBSql + .getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND DEPARTMENTNAME NOT IN ('澳优','系统管理','项目开发人员部门','奶酪事业部','离退人员部门','集团领导')"); + // demo3 + // 3e74f14d-852f-4f6f-a809-08a56697f103 + // 本地 + // d7087d5b-ab29-4514-a7e7-79379f6842a2 + // 正式 + // 8911e732-b42a-4556-853f-ad32761bcbee + String nodeType = null; + ArrayList deptNodes = new ArrayList<>(); + for (RowMap deptMap : deptMaps) { + HashMap deptNode = new HashMap<>(); + nodeType = "dept"; + deptNode.put("ID", deptMap.getString("ID")); + deptNode.put("PARENTID", deptMap.getString("PARENTDEPARTMENTID")); + deptNode.put("name", deptMap.getString("DEPARTMENTNAME")); + deptNode.put("ORDERINDEX", deptMap.getString("ORDERINDEX")); + deptNode.put("TLEVEL", deptMap.getString("LAYER")); + deptNode.put("nodeType", nodeType); + deptNodes.add(deptNode); + } + List deptTreeNodes = TreeUtil.buildTree("0", deptNodes, "0", "dept", "3", null); + ro.put("deptTree", deptTreeNodes); + // 文件类型查询 + HashMap fileType = new HashMap<>(); + ArrayList fileTypes = new ArrayList<>(); + fileType = new HashMap(); + fileType.put("termsKey", "totalFile"); + fileType.put("termsVal", "全部"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "processFile"); + fileType.put("termsVal", "流程"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "policyFile"); + fileType.put("termsVal", "制度"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "guideFile"); + fileType.put("termsVal", "操作指导"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "formFile"); + fileType.put("termsVal", "表单/模板"); + fileTypes.add(fileType); + ro.put("fileTypes", fileTypes); + + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门视图 + * @auther: Lizj + * @date: 2022/7/11 14:14 + */ + + public String deptView(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + try { + List fileRowMaps = null; + String sid = _uc.getSessionId(); + String deptString = params.get("dept"); + String fileType = params.get("fileType"); + ArrayList deptIDList = new ArrayList<>(); + String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + ArrayList fileHandleRowMaps = new ArrayList<>(); + Map reFileMap = new HashMap<>(); + RowMap reFileRowMap = new RowMap(reFileMap); + long startTime = System.currentTimeMillis(); + List fileListMap = DBSql.getMaps(sql); + + String dempId = ""; + if (null == deptString || "".equals(deptString)) { + String ucDeptID = _uc.getUserModel().getDepartmentId(); + String pathIdOfCache = _uc.getDepartmentModel().getPathIdOfCache(); + + // 正式环境 伊利集团总部id 5c8e2d14-25a8-4baf-aa3a-344064007ef3 + if (pathIdOfCache.contains("5c8e2d14-25a8-4baf-aa3a-344064007ef3")) { + ucDeptID = GetNodesUtil.getParentDept(ucDeptID, 2); + } + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(ucDeptID, deptIDList); + if (deptIDList != null) { + deptString = deptIDList.toString(); + } + } + System.err.println("查询部门视图===>" + fileListMap.size()); + for (RowMap rowMap : fileListMap) { + + String id = rowMap.getString("FILEID"); + + /* + * String plVersionId = rowMap.getString("PLVERSIONID"); String sqly = + * "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + + * plVersionId + "'"; List maps = DBSql.getMaps(sqly); if (maps.size() > + * 1) { String sqlu = + * "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + * + plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; + * String palId = DBSql.getString(sqlu); if (UtilString.isNotEmpty(palId)) { if + * (!id.equals(palId)) { continue; } } } + */ + + PALRepositoryModel model = PALRepositoryCache.getCache().get(id); + if (model != null) { + try { + Integer PLLEVEL = model.getLevel(); + String methodId = model.getMethodId(); + + Map queryRepositoryAttributeById = new RepositoryAttribute() + .queryRepositoryAttributeById(model.getId()); + if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { + // 发布部门 + JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); + if (null != Issuing_department && !Issuing_department.equals("")) { + JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value"); + if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) { + for (Object PUBDEPTO : PUBDEPTJA) { + JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO)); + dempId = PUBDEPTJO.getString("id"); + if (deptString.contains(dempId)) { + // 默认添加所在部门的所有文件 + fileHandleRowMaps.add(rowMap); + if ("process.epc".equals(methodId) + || "process.flowchart".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + // 相关文件 + getArrt("R_relevant_flies", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } else if ("control.policy".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + // 相关文件 + getArrt("related_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } + } + + } + } + } + + } + } catch (Exception e) { + + System.err.println("==有问题的模型===>" + model.getName()); + // TODO: handle exception + } + + } + } + + fileRowMaps = fileHandleRowMaps; + long endTime = System.currentTimeMillis(); + // System.err.println("------测试1---------" + fileHandleRowMaps); + // System.err.println("------测试2---------" + fileRowMaps); + // System.out.println("代码段执行时间:" + (endTime - startTime) + "ms"); + // System.err.println("=========fileRowMaps1========>"+fileRowMaps); + // System.err.println("=========fileType========>"+fileType); + if (null != fileRowMaps && fileRowMaps.size() > 0) { + if (null != fileType && !fileType.equals("")) { + fileHandleRowMaps = new ArrayList<>(); + // System.err.println("=====fileRowMaps2========"+fileRowMaps); + 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); + } + } + if (fileType.equals("policyFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + fileHandleRowMaps.add(fileRowMap); + } + } + // && fileRowMap.getString("POLICYTYPE").equals("regulation") + if (fileType.equals("guideFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + 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); + if (null != reFileModel) { + 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", dempId); + reFileMap.put("PLLEVEL", (PLLEVEL - 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + } + + if (fileType.equals("totalFile")) { + fileHandleRowMaps.add(fileRowMap); + } + + } + } + } else { + // System.err.println("====执行2====" + fileHandleRowMaps); + // getind(dempId, fileType, fileRowMaps, fileHandleRowMaps, reFileMap, + // reFileRowMap); + } + fileRowMaps = fileHandleRowMaps; + // System.err.println("=======fileRowMaps========="+fileRowMaps); + // 遍历选择的结果 + List fileMaps = new ArrayList<>(); + List frameRowMaps = new ArrayList<>(); + HashMap fileMap = new HashMap<>(); + HashMap frameMap = new HashMap<>(); + String nodeType = null; + LinkedHashMap filesCount = new LinkedHashMap<>(); + Integer processFileNum = 0; + Integer policyFileNum = 0; + Integer guideFileNum = 0; + Integer formFileNum = 0; + String path = ""; + PALRepositoryModel model = null; + String taskId = ""; + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + List frameIDs = new ArrayList<>(); + for (RowMap fileRowMap : fileRowMaps) { + String PLPARENTID = fileRowMap.getString("PLPARENTID"); + PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(PLPARENTID); + if (null != reFileModel) { + String PLMETHODID = reFileModel.getMethodId(); + if (PLMETHODID.equals("process.framework")) { + frameIDs.add(PLPARENTID); + } else { + String rePPLPARENTID = reFileModel.getParentId(); + frameIDs.add(rePPLPARENTID); + } + } + } + frameIDs = frameIDs.stream().distinct().collect(Collectors.toList()); + for (String frameID : frameIDs) { + frameRowMaps = GetNodesUtil.getParentFrame(frameID, frameRowMaps); + } + frameRowMaps = frameRowMaps.stream() + .collect(collectingAndThen( + toCollection( + () -> new TreeSet<>(Comparator.comparing(o -> o.getString("FRAMEID")))), + ArrayList::new)); + + for (RowMap frameRowMap : frameRowMaps) { + frameMap = new HashMap(); + nodeType = "frame"; + frameMap.put("ID", frameRowMap.getString("FRAMEID")); + frameMap.put("PARENTID", frameRowMap.getString("FRAMEPARENTID")); + frameMap.put("name", frameRowMap.getString("FRAMENAME")); + frameMap.put("ORDERINDEX", frameRowMap.getString("FRAMEORDERINDEX")); + frameMap.put("TLEVEL", frameRowMap.getString("FRAMELEVEL")); + frameMap.put("nodeType", nodeType); + fileMaps.add(frameMap); + } + // System.err.println("=====fileRowMaps1=====>" + fileRowMaps); + + for (RowMap fileRowMap : fileRowMaps) { + fileMap = new HashMap(); + if (fileRowMap.getString("PLMETHODID").equals("process.epc") + || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { + fileMap.put("fileType", "processFile"); + processFileNum += 1; + } 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"); + policyFileNum += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") + && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + fileMap.put("fileType", "guideFile"); + guideFileNum += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("data.form")) { + fileMap.put("fileType", "formFile"); + formFileNum += 1; + } + model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); + if (null != model) { + 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")); + String sqlsss = "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY_1124 WHERE ID = '" + + fileRowMap.getString("FILEID") + "'"; + String leve = DBSql.getString(sqlsss); + fileMap.put("TLEVEL", leve); + fileMap.put("nodeType", nodeType); + fileMaps.add(fileMap); + } + // System.err.println("=====fileMaps=====>" + fileMaps); + List fileTreeNodes = TreeUtil.buildTree("0", fileMaps, "process", "frame", null, null); + filesCount = new LinkedHashMap<>(); + filesCount.put("processFileNum", processFileNum); + filesCount.put("policyFileNum", policyFileNum); + filesCount.put("guideFileNum", guideFileNum); + filesCount.put("formFileNum", formFileNum); + ro.put("fileMaps", fileTreeNodes); + ro.put("filesCount", filesCount); + return ro.toString(); + } else { + filesCount = new LinkedHashMap<>(); + filesCount.put("processFileNum", processFileNum); + filesCount.put("policyFileNum", policyFileNum); + filesCount.put("guideFileNum", guideFileNum); + filesCount.put("formFileNum", formFileNum); + ro.ok("暂无文件"); + ro.put("fileMaps", fileMaps); + ro.put("filesCount", filesCount); + return ro.toString(); + } + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + // System.err.println("====执行完毕====>"); + } + return ro.toString(); + + } + + // 查询所有文件 + public void getind(String dempId, String fileType, List fileRowMaps, ArrayList fileHandleRowMaps, + Map reFileMap, RowMap reFileRowMap) { + 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); + } + } + if (fileType.equals("policyFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + try { + BaseModel defineModel = CoeDesignerAPIManager.getInstance() + .getDefinition(fileRowMap.getString("FILEID"), 0); + if (defineModel != null) { + String define = defineModel.getDefinition(); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + for (String key : elements.keySet()) { + JSONObject shape1 = elements.getJSONObject(key); + if ("regulation".equals(shape1.getString("name"))) { + fileRowMap.put("POLICYTYPE", "regulation"); + fileHandleRowMaps.add(fileRowMap); + } + } + + } + } catch (Exception e) { + // TODO: handle exception + } + + } + } + // && fileRowMap.getString("POLICYTYPE").equals("regulation") + if (fileType.equals("guideFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + try { + BaseModel defineModel = CoeDesignerAPIManager.getInstance() + .getDefinition(fileRowMap.getString("FILEID"), 0); + if (defineModel != null) { + String define = defineModel.getDefinition(); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + for (String key : elements.keySet()) { + JSONObject shape1 = elements.getJSONObject(key); + if ("I/O_L4".equals(shape1.getString("name"))) { + fileRowMap.put("POLICYTYPE", "I/O_L4"); + fileHandleRowMaps.add(fileRowMap); + } + } + + } + } catch (Exception e) { + // TODO: handle exception + } + + } + } + 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); + if (null != reFileModel) { + 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", dempId); + reFileMap.put("PLLEVEL", (PLLEVEL - 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + } + /* + * if (fileType.equals("totalFile")) { fileHandleRowMaps.add(fileRowMap); } + */ + } + } + } + + public void getArrt(String name, PALRepositoryModel model, String dempId, Integer PLLEVEL, RowMap reFileRowMap, + ArrayList fileHandleRowMaps) { + // 支持相关文件 + List support_filesList = DesignerShapeRelationCache.getListByAttrId(model.getId(), + "", name); + for (DesignerShapeRelationModel support : support_filesList) { + String supportFileId = support.getRelationFileId();// 支持或相关文件的ID + PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(supportFileId); + if (reFileModel != null) { + String PLMETHODID = reFileModel.getMethodId(); + if (PLMETHODID.equals("data.form")) { + HashMap reFileMap = new HashMap<>(); + reFileMap.put("FILEID", supportFileId); + reFileMap.put("PLNAME", reFileModel.getName()); + reFileMap.put("PLPARENTID", model.getId()); + reFileMap.put("PLMETHODID", PLMETHODID); + reFileMap.put("PUBDEPT", dempId); + reFileMap.put("PLLEVEL", (PLLEVEL + 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + } + +} diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService5.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService5.java new file mode 100644 index 00000000..aab19047 --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService5.java @@ -0,0 +1,1469 @@ +package com.awspaas.user.apps.yili.reportform.service; + +import static com.awspaas.user.apps.yili.reportform.util.TaskUtil.getLastPublishTaskIdByModelId; +import static java.util.stream.Collectors.collectingAndThen; +import static java.util.stream.Collectors.toCollection; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; +import java.util.stream.Collectors; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager; +import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel; +import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache; +import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.commons.mvc.view.ActionWeb; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.RequestParams; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.bpms.util.UtilString; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil; +import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute; +import com.awspaas.user.apps.yili.reportform.util.TreeUtil; + +/** + * @author:Lizj + * @create: 2022-07-11 14:04 + * @Description: 个人/部门视图 + */ +@SuppressWarnings("all") +public class DataViewService5 extends ActionWeb { + + UserContext _uc; + + public DataViewService5(UserContext uc) { + super(uc); + _uc = uc; + } + + /** + * @methodName: + * @param: + * @return: + * @description:个人视图筛选条件 + * @auther: Lizj + * @date: 2022/7/11 14:11 + */ + public String queryTermsPerson(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + // 基本信息 + // 当前登录信息 + ArrayList currentLoginMaps = new ArrayList<>(); + LinkedHashMap currentLoginMap = new LinkedHashMap<>(); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "账号"); + currentLoginMap.put("text", uc.getUserModel().getUID()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "姓名"); + currentLoginMap.put("text", uc.getUserModel().getUserName()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "部门"); + currentLoginMap.put("text", uc.getDepartmentModel().getName()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "岗位"); + currentLoginMap.put("text", uc.getUserModel().getPositionName()); + currentLoginMaps.add(currentLoginMap); + ro.put("personInfos", currentLoginMaps); + return ro.toString(); + } + + public String queryTermsPosition(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + // 岗位查询 + Object[] sqlParams = new Object[] {}; + String departmentById = uc.getDepartmentModel().getId(); + sqlParams = new Object[] { departmentById }; + List positionRowMapsOrg = DBSql.getMaps( + "SELECT ID, POSITION_NO, POSITION_NAME, DEPARTMENTID, ORDERINDEX FROM ORGUSER WHERE POSITION_NO IS NOT NULL AND DEPARTMENTID=?", + sqlParams); + List positionRowMaps = positionRowMapsOrg.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getString("POSITION_NO")))), + ArrayList::new)); + List deptMaps = DBSql.getMaps( + "SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + " WHERE ID=?", + sqlParams); + // demo3 + // 3e74f14d-852f-4f6f-a809-08a56697f103 + // 本地 + // d7087d5b-ab29-4514-a7e7-79379f6842a2 + // 正式 + // 8911e732-b42a-4556-853f-ad32761bcbee + String nodeType = null; + ArrayList deptNodes = new ArrayList<>(); + if (null != deptMaps && !deptMaps.isEmpty()) { + for (RowMap deptMap : deptMaps) { + if (null != positionRowMaps && !positionRowMaps.isEmpty()) { + for (RowMap positionRowMap : positionRowMaps) { + // String userID = positionRowMap.getString("ID"); + String ID = positionRowMap.getString("POSITION_NO"); + String PARENTID = positionRowMap.getString("DEPARTMENTID"); + String name = positionRowMap.getString("POSITION_NAME"); + String ORDERINDEX = positionRowMap.getString("ORDERINDEX"); + String TLEVEL = String.valueOf(Integer.valueOf(deptMap.getString("LAYER")) + 1); + HashMap deptNode = new HashMap<>(); + nodeType = "position"; + // deptNode.put("userID",userID); + deptNode.put("ID", ID); + deptNode.put("PARENTID", PARENTID); + deptNode.put("name", name); + deptNode.put("ORDERINDEX", ORDERINDEX); + deptNode.put("TLEVEL", TLEVEL); + deptNode.put("nodeType", nodeType); + deptNodes.add(deptNode); + } + } + HashMap deptNode = new HashMap<>(); + nodeType = "dept"; + deptNode.put("ID", deptMap.getString("ID")); + deptNode.put("PARENTID", deptMap.getString("PARENTDEPARTMENTID")); + deptNode.put("name", deptMap.getString("DEPARTMENTNAME")); + deptNode.put("ORDERINDEX", deptMap.getString("ORDERINDEX")); + deptNode.put("TLEVEL", deptMap.getString("LAYER")); + deptNode.put("nodeType", nodeType); + deptNodes.add(deptNode); + } + } + nodeType = "position"; + List deptTreeNodes = TreeUtil.buildTree("0", deptNodes, null, "dept", null, nodeType); + ro.put("positionTree", deptTreeNodes); + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:个人视图 + * @auther: Lizj + * @date: 2022/7/11 14:14 + */ + public String personalView(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + String positionKeys = null; + String positionVals = null; + ArrayList positionIDs = new ArrayList<>(); + Integer i = -1; + while (true) { + i++; + positionKeys = "position" + "[" + i + "]"; + positionVals = params.get(positionKeys); + if (null != positionVals && !positionVals.equals("")) { + positionIDs.add(positionVals); + } else { + break; + } + } + String uid = params.get("uid"); + String sid = _uc.getSessionId(); + // 定义用户/岗位流程list,用户/岗位流程map + ArrayList UoPProcessMaps = new ArrayList<>(); + HashMap UoPProcessMap = new HashMap<>(); + ArrayList nodeMaps = new ArrayList<>(); + ArrayList nodeAMaps = new ArrayList<>(); + ArrayList nodeBMaps = new ArrayList<>(); + HashMap nodeMap = new HashMap<>(); + Map nodeTempMap = new HashMap<>(); + ArrayList reRegulationMaps = new ArrayList<>(); + ArrayList reFormMaps = new ArrayList<>(); + ArrayList reIO_L4Maps = new ArrayList<>(); + ArrayList reYSMaps = new ArrayList<>(); + ArrayList tempMaps = new ArrayList<>(); + LinkedList linksMaps = new LinkedList<>(); + HashMap linksMap = new HashMap<>(); + String path = ""; + PALRepositoryModel model = null; + String taskId = ""; + String fileType = ""; + Integer totalNum = 0; + Integer aNum = 0; + Integer bNum = 0; + Object[] sqlParams = new Object[] {}; + // List fileRowMaps = DBSql.getMaps("SELECT + // FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI + // FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER + // BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) ASC"); + // List fileRowMaps1 = DBSql.getMaps("SELECT + // FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI + // FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' AND FILESTATE='1' ORDER + // BY PLLEVEL ASC, PLORDERINDEX ASC"); + // AND FILESTATE='1' ORDER BY TO_NUMBER(PLLEVEL) ASC, TO_NUMBER(PLORDERINDEX) + // ASC + + if (null != positionIDs && !positionIDs.isEmpty()) { + UoPProcessMaps = new ArrayList(); + nodeMaps = new ArrayList(); + linksMaps = new LinkedList(); + UoPProcessMap = new HashMap(); + String rootuuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + UoPProcessMap.put("id", rootuuId); + UoPProcessMap.put("text", "岗位流程"); + UoPProcessMap.put("fileType", "UoPProcess"); + UoPProcessMaps.add(UoPProcessMap); + long start = System.currentTimeMillis(); + ArrayList positionNameList = new ArrayList<>(); + for (String positionID : positionIDs) { + sqlParams = new Object[] { positionID }; + RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO=?", sqlParams); + String POSITION_NAME = null; + if (null != POSITIONMap && !POSITIONMap.isEmpty()) { + POSITION_NAME = POSITIONMap.getString("POSITION_NAME"); + positionNameList.add(POSITION_NAME); + } + } + + for (String positionName : positionNameList) { + // if (nodeRowMap.getString("ROLE").equals(positionID) || + // nodeRowMap.getString("POST").equals(positionID)) { + List nodeRowMaps = DBSql.getMaps( + "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE POST LIKE '%" + + positionName + "%'"); + for (RowMap nodeRowMap : nodeRowMaps) { + String plId = nodeRowMap.getString("PLID"); + RowMap fileRowMap = DBSql.getMap( + "SELECT FILESTATE,FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '" + + plId + "'"); + if (fileRowMap != null) { + if ("0".equals(fileRowMap.getString("FILESTATE"))) { + continue; + } + nodeMap = new HashMap(); + model = PALRepositoryCache.getCache().get(plId); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); + nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); + nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); + nodeMap.put("path", path); + nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); + nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); + nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); + nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); + nodeMaps.add(nodeMap); + + UoPProcessMap = new HashMap(); + fileType = "process"; + model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); + if (null != model) { + 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; + UoPProcessMap.put("id", fileRowMap.getString("FILEID")); + UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); + UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); + UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", rootuuId); + UoPProcessMaps.add(UoPProcessMap); + } + + } + } + + long end = System.currentTimeMillis(); + System.err.println("个人视图(岗位流程)查询用时=========>" + (end - start) / 1000 + "秒"); + UoPProcessMaps = UoPProcessMaps.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), + ArrayList::new)); + tempMaps = new ArrayList(); + if (nodeMaps.size() == 0) { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您所查询的岗位暂无需执行的流程"); + + } else { + for (Map uoPProcessMap : UoPProcessMaps) { + reRegulationMaps = new ArrayList<>(); + reFormMaps = new ArrayList<>(); + reIO_L4Maps = new ArrayList<>(); + reYSMaps = new ArrayList<>(); + String FILEID = String.valueOf(uoPProcessMap.get("id")); + fileType = String.valueOf(uoPProcessMap.get("fileType")); + if (fileType.equals("process")) { + String RELEVANTFILE = String.valueOf(uoPProcessMap.get("RELEVANTFILE")); + String SUPPORTFILE = String.valueOf(uoPProcessMap.get("SUPPORTFILE")); + String PROCESSKPI = String.valueOf(uoPProcessMap.get("PROCESSKPI")); + if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) { + String[] reFileIDs = RELEVANTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + 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=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) { + String[] reFileIDs = SUPPORTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != PROCESSKPI && !PROCESSKPI.equals("")) { + String[] PROCESSKPIIDS = PROCESSKPI.split(" "); + for (String PROCESSKPIID : PROCESSKPIIDS) { + sqlParams = new Object[] { PROCESSKPIID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + UoPProcessMap = new HashMap(); + fileType = "processKPIFile"; + model = PALRepositoryCache.getCache().get(PROCESSKPIID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + + "&" + "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reProcessKPI"); + reYSMaps.add(UoPProcessMap); + } + } + } + if (null != reRegulationMaps && !reRegulationMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reRegulation"); + UoPProcessMap.put("text", "相关制度"); + UoPProcessMap.put("fileType", "reRegulation"); + UoPProcessMap.put("PARENTID", FILEID); + reRegulationMaps.add(UoPProcessMap); + } + if (null != reFormMaps && !reFormMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reForm"); + UoPProcessMap.put("text", "相关表单"); + UoPProcessMap.put("fileType", "reForm"); + UoPProcessMap.put("PARENTID", FILEID); + reFormMaps.add(UoPProcessMap); + } + if (null != reIO_L4Maps && !reIO_L4Maps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reI/O_L4"); + UoPProcessMap.put("text", "相关操作指导"); + UoPProcessMap.put("fileType", "reI/O_L4"); + UoPProcessMap.put("PARENTID", FILEID); + reIO_L4Maps.add(UoPProcessMap); + } + if (null != reYSMaps && !reYSMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reYS"); + UoPProcessMap.put("text", "相关要素"); + UoPProcessMap.put("fileType", "reYS"); + UoPProcessMap.put("PARENTID", FILEID); + reYSMaps.add(UoPProcessMap); + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reProcessKPI"); + UoPProcessMap.put("text", "绩效"); + UoPProcessMap.put("fileType", "reProcessKPI"); + UoPProcessMap.put("PARENTID", FILEID + "reYS"); + reYSMaps.add(UoPProcessMap); + } + tempMaps.addAll(reRegulationMaps); + tempMaps.addAll(reFormMaps); + tempMaps.addAll(reIO_L4Maps); + tempMaps.addAll(reYSMaps); + } + } + UoPProcessMaps.addAll(tempMaps); + if (UoPProcessMaps.size() > 1) { + for (Map uoPProcessMap : UoPProcessMaps) { + if (String.valueOf(uoPProcessMap.get("fileType")).equals("UoPProcess")) { + ro.put("rootId", String.valueOf(uoPProcessMap.get("id"))); + } + } + ro.put("nodes", UoPProcessMaps); + for (Map uoPProcessMap : UoPProcessMaps) { + String id = String.valueOf(uoPProcessMap.get("id")); + for (Map pProcessMap : UoPProcessMaps) { + String PARENTID = String.valueOf(pProcessMap.get("PARENTID")); + if (id.equals(PARENTID)) { + String childID = String.valueOf(pProcessMap.get("id")); + linksMap = new LinkedHashMap(); + linksMap.put("from", id); + linksMap.put("to", childID); + linksMaps.add(linksMap); + } + } + } + ro.put("links", linksMaps); + } else { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您所查询的岗位暂无需执行的流程"); + + } + } + nodeAMaps = new ArrayList<>(); + nodeBMaps = new ArrayList<>(); + if (null != nodeMaps && !nodeMaps.isEmpty()) { + for (Map nodeReturnMap : nodeMaps) { + nodeTempMap = new HashMap(); + String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { + nodeTempMap = nodeReturnMap; + nodeAMaps.add(nodeTempMap); + } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + nodeTempMap = nodeReturnMap; + nodeBMaps.add(nodeTempMap); + } + } + } + totalNum = nodeMaps.size(); + aNum = nodeAMaps.size(); + bNum = nodeBMaps.size(); + ro.put("totalNodeNum", totalNum); + ro.put("totalNode", nodeMaps); + ro.put("typeANum", aNum); + ro.put("typeA", nodeAMaps); + ro.put("typeBNum", bNum); + ro.put("typeB", nodeBMaps); + + // 岗位流程/我的流程 + } else { + int count = 0; + UoPProcessMaps = new ArrayList(); + nodeMaps = new ArrayList(); + linksMaps = new LinkedList(); + UoPProcessMap = new HashMap(); + String rootuuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + UoPProcessMap.put("id", rootuuId); + UoPProcessMap.put("text", "我的流程"); + UoPProcessMap.put("fileType", "UoPProcess"); + UoPProcessMaps.add(UoPProcessMap); + long start = System.currentTimeMillis(); + String POSITION_NAME = UserContext.fromUID(uid).getUserModel().getPositionName(); + if (UtilString.isNotEmpty(POSITION_NAME)) { + List nodeRowMaps = DBSql.getMaps( + "SELECT NODEID,NODENAME,NODETYPE,PLID,PLNAME,ACTIVITYNUMBER,ACTIVITYDESC,ROLE,ROLENAME,POST,POSTNAME FROM BO_EU_PAL_FILENODE6 WHERE POST LIKE '%"+POSITION_NAME+"%'"); + for (RowMap nodeRowMap : nodeRowMaps) { + String PLID = nodeRowMap.getString("PLID"); + RowMap fileRowMap = DBSql.getMap( + "SELECT FILESTATE,FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,RELEVANTFILE,SUPPORTFILE,PROCESSKPI FROM BO_EU_PAL_FILE1 WHERE FILEID = '" + + PLID + "'"); + count++; + if (fileRowMap != null) { + if ("0".equals(fileRowMap.getString("FILESTATE"))) { + continue; + } + // if (nodeRowMap.getString("ROLE").equals(positionID) || + // nodeRowMap.getString("POST").equals(positionID)) { + nodeMap = new HashMap(); + model = PALRepositoryCache.getCache().get(nodeRowMap.getString("PLID")); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + nodeRowMap.getString("PLID") + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + nodeMap.put("NODENAME", nodeRowMap.getString("NODENAME")); + nodeMap.put("PLNAME", nodeRowMap.getString("PLNAME")); + nodeMap.put("NODETYPE", nodeRowMap.getString("NODETYPE")); + nodeMap.put("path", path); + nodeMap.put("ACTIVITYNUMBER", nodeRowMap.getString("ACTIVITYNUMBER")); + nodeMap.put("ACTIVITYDESC", nodeRowMap.getString("ACTIVITYDESC")); + nodeMap.put("ROLENAME", nodeRowMap.getString("ROLE")); + nodeMap.put("POSTNAME", nodeRowMap.getString("POST")); + nodeMaps.add(nodeMap); + + UoPProcessMap = new HashMap(); + fileType = "process"; + model = PALRepositoryCache.getCache().get(PLID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + PLID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", PLID); + UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); + UoPProcessMap.put("SUPPORTFILE", fileRowMap.getString("SUPPORTFILE")); + UoPProcessMap.put("PROCESSKPI", fileRowMap.getString("PROCESSKPI")); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", rootuuId); + UoPProcessMaps.add(UoPProcessMap); + + + } + + } + + } else { + ro.info("当前用户未设置岗位"); + } + long end = System.currentTimeMillis(); + System.err.println("个人视图(我的流程)查询用时=========>" + (end - start) / 1000 + "秒"); + UoPProcessMaps = UoPProcessMaps.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), + ArrayList::new)); + tempMaps = new ArrayList(); + + if (nodeMaps.size() == 0) { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您的岗位暂无需执行的流程"); + } else { + for (Map uoPProcessMap : UoPProcessMaps) { + reRegulationMaps = new ArrayList<>(); + reFormMaps = new ArrayList<>(); + reIO_L4Maps = new ArrayList<>(); + reYSMaps = new ArrayList<>(); + String FILEID = String.valueOf(uoPProcessMap.get("id")); + fileType = String.valueOf(uoPProcessMap.get("fileType")); + if (fileType.equals("process")) { + String RELEVANTFILE = String.valueOf(uoPProcessMap.get("RELEVANTFILE")); + String SUPPORTFILE = String.valueOf(uoPProcessMap.get("SUPPORTFILE")); + String PROCESSKPI = String.valueOf(uoPProcessMap.get("PROCESSKPI")); + if (null != RELEVANTFILE && !RELEVANTFILE.equals("")) { + String[] reFileIDs = RELEVANTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != SUPPORTFILE && !SUPPORTFILE.equals("")) { + String[] reFileIDs = SUPPORTFILE.split(" "); + for (String reFileID : reFileIDs) { + sqlParams = new Object[] { reFileID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && (refileRowMap.getString("POLICYTYPE").equals("regulation") + || null == refileRowMap.getString("POLICYTYPE") + || refileRowMap.getString("POLICYTYPE").equals(""))) { + // && refileRowMap.getString("POLICYTYPE").equals("regulation") + UoPProcessMap = new HashMap(); + fileType = "reRegulationFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reRegulation"); + reRegulationMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("data.form")) { + UoPProcessMap = new HashMap(); + fileType = "reFormFile"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reForm"); + reFormMaps.add(UoPProcessMap); + } else if (refileRowMap.getString("PLMETHODID").equals("control.policy") + && refileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + UoPProcessMap = new HashMap(); + fileType = "reI/O_L4File"; + model = PALRepositoryCache.getCache().get(reFileID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" + + "uuid=" + reFileID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reI/O_L4"); + reIO_L4Maps.add(UoPProcessMap); + } + } + } + } + if (null != PROCESSKPI && !PROCESSKPI.equals("")) { + String[] PROCESSKPIIDS = PROCESSKPI.split(" "); + for (String PROCESSKPIID : PROCESSKPIIDS) { + sqlParams = new Object[] { PROCESSKPIID }; + RowMap refileRowMap = DBSql.getMap( + "SELECT FILEID,PLNAME,PLMETHODID,PLLEVEL,PLORDERINDEX,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILEID=?", + sqlParams); + if (null != refileRowMap && !refileRowMap.isEmpty()) { + UoPProcessMap = new HashMap(); + fileType = "processKPIFile"; + model = PALRepositoryCache.getCache().get(PROCESSKPIID); + if (null != model) { + if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 + taskId = getLastPublishTaskIdByModelId(model.getId()); + } + } + path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + + "&" + "uuid=" + PROCESSKPIID + "&" + "sid=" + sid + "&" + "taskId=" + + taskId; + UoPProcessMap.put("id", FILEID + refileRowMap.getString("FILEID")); + UoPProcessMap.put("text", refileRowMap.getString("PLNAME")); + UoPProcessMap.put("path", path); + UoPProcessMap.put("fileType", fileType); + UoPProcessMap.put("PARENTID", FILEID + "reProcessKPI"); + reYSMaps.add(UoPProcessMap); + } + } + } + if (null != reRegulationMaps && !reRegulationMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reRegulation"); + UoPProcessMap.put("text", "相关制度"); + UoPProcessMap.put("fileType", "reRegulation"); + UoPProcessMap.put("PARENTID", FILEID); + reRegulationMaps.add(UoPProcessMap); + } + if (null != reFormMaps && !reFormMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reForm"); + UoPProcessMap.put("text", "相关表单"); + UoPProcessMap.put("fileType", "reForm"); + UoPProcessMap.put("PARENTID", FILEID); + reFormMaps.add(UoPProcessMap); + } + if (null != reIO_L4Maps && !reIO_L4Maps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reI/O_L4"); + UoPProcessMap.put("text", "相关操作指导"); + UoPProcessMap.put("fileType", "reI/O_L4"); + UoPProcessMap.put("PARENTID", FILEID); + reIO_L4Maps.add(UoPProcessMap); + } + if (null != reYSMaps && !reYSMaps.isEmpty()) { + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reYS"); + UoPProcessMap.put("text", "相关要素"); + UoPProcessMap.put("fileType", "reYS"); + UoPProcessMap.put("PARENTID", FILEID); + reYSMaps.add(UoPProcessMap); + UoPProcessMap = new HashMap(); + UoPProcessMap.put("id", FILEID + "reProcessKPI"); + UoPProcessMap.put("text", "绩效"); + UoPProcessMap.put("fileType", "reProcessKPI"); + UoPProcessMap.put("PARENTID", FILEID + "reYS"); + reYSMaps.add(UoPProcessMap); + } + tempMaps.addAll(reRegulationMaps); + tempMaps.addAll(reFormMaps); + tempMaps.addAll(reIO_L4Maps); + tempMaps.addAll(reYSMaps); + } + } + // 所有数据 + UoPProcessMaps.addAll(tempMaps); + if (UoPProcessMaps.size() > 1) { + for (Map uoPProcessMap : UoPProcessMaps) { + if (String.valueOf(uoPProcessMap.get("fileType")).equals("UoPProcess")) { + ro.put("rootId", String.valueOf(uoPProcessMap.get("id"))); + } + } + ro.put("nodes", UoPProcessMaps); + for (Map uoPProcessMap : UoPProcessMaps) { + String id = String.valueOf(uoPProcessMap.get("id")); + for (Map pProcessMap : UoPProcessMaps) { + String PARENTID = String.valueOf(pProcessMap.get("PARENTID")); + if (id.equals(PARENTID)) { + String childID = String.valueOf(pProcessMap.get("id")); + linksMap = new LinkedHashMap(); + linksMap.put("from", id); + linksMap.put("to", childID); + linksMaps.add(linksMap); + } + } + } + ro.put("links", linksMaps); + } else { + ro.put("rootId", ""); + UoPProcessMaps = new ArrayList(); + ro.put("nodes", UoPProcessMaps); + linksMaps = new LinkedList(); + ro.put("links", linksMaps); + ro.info("您的岗位暂无需执行的流程"); + } + } + nodeAMaps = new ArrayList<>(); + nodeBMaps = new ArrayList<>(); + if (null != nodeMaps && !nodeMaps.isEmpty()) { + for (Map nodeReturnMap : nodeMaps) { + nodeTempMap = new HashMap(); + String NODETYPE = String.valueOf(nodeReturnMap.get("NODETYPE")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node")) { + nodeTempMap.putAll(nodeReturnMap); + nodeAMaps.add(nodeTempMap); + } else if (NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + nodeTempMap.putAll(nodeReturnMap); + nodeBMaps.add(nodeTempMap); + } + } + } + totalNum = nodeMaps.size(); + aNum = nodeAMaps.size(); + bNum = nodeBMaps.size(); + ro.put("totalNodeNum", totalNum); + ro.put("totalNode", nodeMaps); + ro.put("typeANum", aNum); + ro.put("typeA", nodeAMaps); + ro.put("typeBNum", bNum); + ro.put("typeB", nodeBMaps); + + } + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门视图筛选条件:部门 + * @auther: Lizj + * @date: 2022/7/11 14:14 + */ + public String queryTermsDept(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + + // 当前登录信息 + ArrayList currentLoginMaps = new ArrayList<>(); + LinkedHashMap currentLoginMap = new LinkedHashMap<>(); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "账号"); + currentLoginMap.put("text", uc.getUserModel().getUID()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "姓名"); + currentLoginMap.put("text", uc.getUserModel().getUserName()); + currentLoginMaps.add(currentLoginMap); + currentLoginMap = new LinkedHashMap<>(); + currentLoginMap.put("title", "部门"); + currentLoginMap.put("text", uc.getDepartmentModel().getPathNameOfCache()); + currentLoginMaps.add(currentLoginMap); + ro.put("personInfos", currentLoginMaps); + + // 部门查询 + List deptMaps = DBSql + .getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0' AND DEPARTMENTNAME NOT IN ('澳优','系统管理','项目开发人员部门','奶酪事业部','离退人员部门','集团领导')"); + // demo3 + // 3e74f14d-852f-4f6f-a809-08a56697f103 + // 本地 + // d7087d5b-ab29-4514-a7e7-79379f6842a2 + // 正式 + // 8911e732-b42a-4556-853f-ad32761bcbee + String nodeType = null; + ArrayList deptNodes = new ArrayList<>(); + for (RowMap deptMap : deptMaps) { + HashMap deptNode = new HashMap<>(); + nodeType = "dept"; + deptNode.put("ID", deptMap.getString("ID")); + deptNode.put("PARENTID", deptMap.getString("PARENTDEPARTMENTID")); + deptNode.put("name", deptMap.getString("DEPARTMENTNAME")); + deptNode.put("ORDERINDEX", deptMap.getString("ORDERINDEX")); + deptNode.put("TLEVEL", deptMap.getString("LAYER")); + deptNode.put("nodeType", nodeType); + deptNodes.add(deptNode); + } + List deptTreeNodes = TreeUtil.buildTree("0", deptNodes, "0", "dept", "3", null); + ro.put("deptTree", deptTreeNodes); + // 文件类型查询 + HashMap fileType = new HashMap<>(); + ArrayList fileTypes = new ArrayList<>(); + fileType = new HashMap(); + fileType.put("termsKey", "totalFile"); + fileType.put("termsVal", "全部"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "processFile"); + fileType.put("termsVal", "流程"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "policyFile"); + fileType.put("termsVal", "制度"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "guideFile"); + fileType.put("termsVal", "操作指导"); + fileTypes.add(fileType); + fileType = new HashMap(); + fileType.put("termsKey", "formFile"); + fileType.put("termsVal", "表单/模板"); + fileTypes.add(fileType); + ro.put("fileTypes", fileTypes); + + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门视图 + * @auther: Lizj + * @date: 2022/7/11 14:14 + */ + + public String deptView(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + try { + List fileRowMaps = null; + String sid = _uc.getSessionId(); + String deptString = params.get("dept"); + String fileType = params.get("fileType"); + ArrayList deptIDList = new ArrayList<>(); + String sql = "SELECT ID AS FILEID,PLNAME,PLPARENTID,PLMETHODID,PLLEVEL,PLVERSIONID,PLORDERINDEX,EXT3 as POLICYTYPE FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISSTOP =0 AND EXT5 = '1' AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + ArrayList fileHandleRowMaps = new ArrayList<>(); + Map reFileMap = new HashMap<>(); + RowMap reFileRowMap = new RowMap(reFileMap); + long startTime = System.currentTimeMillis(); + List fileListMap = DBSql.getMaps(sql); + + String dempId = ""; + if (null == deptString || "".equals(deptString)) { + String ucDeptID = _uc.getUserModel().getDepartmentId(); + String pathIdOfCache = _uc.getDepartmentModel().getPathIdOfCache(); + + // 正式环境 伊利集团总部id 5c8e2d14-25a8-4baf-aa3a-344064007ef3 + if (pathIdOfCache.contains("5c8e2d14-25a8-4baf-aa3a-344064007ef3")) { + ucDeptID = GetNodesUtil.getParentDept(ucDeptID, 2); + } + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(ucDeptID, deptIDList); + if (deptIDList != null) { + deptString = deptIDList.toString(); + } + } + System.err.println("查询部门视图===>" + fileListMap.size()); + for (RowMap rowMap : fileListMap) { + + String id = rowMap.getString("FILEID"); + + /* + * String plVersionId = rowMap.getString("PLVERSIONID"); String sqly = + * "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + + * plVersionId + "'"; List maps = DBSql.getMaps(sqly); if (maps.size() > + * 1) { String sqlu = + * "SELECT ID FROM (SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLVERSIONID = '" + * + plVersionId + "' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; + * String palId = DBSql.getString(sqlu); if (UtilString.isNotEmpty(palId)) { if + * (!id.equals(palId)) { continue; } } } + */ + + PALRepositoryModel model = PALRepositoryCache.getCache().get(id); + if (model != null) { + try { + Integer PLLEVEL = model.getLevel(); + String methodId = model.getMethodId(); + + Map queryRepositoryAttributeById = new RepositoryAttribute() + .queryRepositoryAttributeById(model.getId()); + if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { + // 发布部门 + JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); + if (null != Issuing_department && !Issuing_department.equals("")) { + JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value"); + if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) { + for (Object PUBDEPTO : PUBDEPTJA) { + JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO)); + dempId = PUBDEPTJO.getString("id"); + if (deptString.contains(dempId)) { + // 默认添加所在部门的所有文件 + fileHandleRowMaps.add(rowMap); + if ("process.epc".equals(methodId) + || "process.flowchart".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + // 相关文件 + getArrt("R_relevant_flies", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } else if ("control.policy".equals(methodId)) { + // 支持文件 + getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + // 相关文件 + getArrt("related_files", model, dempId, PLLEVEL, reFileRowMap, + fileHandleRowMaps); + } + } + + } + } + } + + } + } catch (Exception e) { + + System.err.println("==有问题的模型===>" + model.getName()); + // TODO: handle exception + } + + } + } + + fileRowMaps = fileHandleRowMaps; + long endTime = System.currentTimeMillis(); + // System.err.println("------测试1---------" + fileHandleRowMaps); + // System.err.println("------测试2---------" + fileRowMaps); + // System.out.println("代码段执行时间:" + (endTime - startTime) + "ms"); + // System.err.println("=========fileRowMaps1========>"+fileRowMaps); + // System.err.println("=========fileType========>"+fileType); + if (null != fileRowMaps && fileRowMaps.size() > 0) { + if (null != fileType && !fileType.equals("")) { + fileHandleRowMaps = new ArrayList<>(); + // System.err.println("=====fileRowMaps2========"+fileRowMaps); + 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); + } + } + if (fileType.equals("policyFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + fileHandleRowMaps.add(fileRowMap); + } + } + // && fileRowMap.getString("POLICYTYPE").equals("regulation") + if (fileType.equals("guideFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + 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); + if (null != reFileModel) { + 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", dempId); + reFileMap.put("PLLEVEL", (PLLEVEL - 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + } + + if (fileType.equals("totalFile")) { + fileHandleRowMaps.add(fileRowMap); + } + + } + } + } else { + // System.err.println("====执行2====" + fileHandleRowMaps); + // getind(dempId, fileType, fileRowMaps, fileHandleRowMaps, reFileMap, + // reFileRowMap); + } + fileRowMaps = fileHandleRowMaps; + // System.err.println("=======fileRowMaps========="+fileRowMaps); + // 遍历选择的结果 + List fileMaps = new ArrayList<>(); + List frameRowMaps = new ArrayList<>(); + HashMap fileMap = new HashMap<>(); + HashMap frameMap = new HashMap<>(); + String nodeType = null; + LinkedHashMap filesCount = new LinkedHashMap<>(); + Integer processFileNum = 0; + Integer policyFileNum = 0; + Integer guideFileNum = 0; + Integer formFileNum = 0; + String path = ""; + PALRepositoryModel model = null; + String taskId = ""; + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + List frameIDs = new ArrayList<>(); + for (RowMap fileRowMap : fileRowMaps) { + String PLPARENTID = fileRowMap.getString("PLPARENTID"); + PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(PLPARENTID); + if (null != reFileModel) { + String PLMETHODID = reFileModel.getMethodId(); + if (PLMETHODID.equals("process.framework")) { + frameIDs.add(PLPARENTID); + } else { + String rePPLPARENTID = reFileModel.getParentId(); + frameIDs.add(rePPLPARENTID); + } + } + } + frameIDs = frameIDs.stream().distinct().collect(Collectors.toList()); + for (String frameID : frameIDs) { + frameRowMaps = GetNodesUtil.getParentFrame(frameID, frameRowMaps); + } + frameRowMaps = frameRowMaps.stream() + .collect(collectingAndThen( + toCollection( + () -> new TreeSet<>(Comparator.comparing(o -> o.getString("FRAMEID")))), + ArrayList::new)); + + for (RowMap frameRowMap : frameRowMaps) { + frameMap = new HashMap(); + nodeType = "frame"; + frameMap.put("ID", frameRowMap.getString("FRAMEID")); + frameMap.put("PARENTID", frameRowMap.getString("FRAMEPARENTID")); + frameMap.put("name", frameRowMap.getString("FRAMENAME")); + frameMap.put("ORDERINDEX", frameRowMap.getString("FRAMEORDERINDEX")); + frameMap.put("TLEVEL", frameRowMap.getString("FRAMELEVEL")); + frameMap.put("nodeType", nodeType); + fileMaps.add(frameMap); + } + // System.err.println("=====fileRowMaps1=====>" + fileRowMaps); + + for (RowMap fileRowMap : fileRowMaps) { + fileMap = new HashMap(); + if (fileRowMap.getString("PLMETHODID").equals("process.epc") + || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { + fileMap.put("fileType", "processFile"); + processFileNum += 1; + } 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"); + policyFileNum += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") + && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + fileMap.put("fileType", "guideFile"); + guideFileNum += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("data.form")) { + fileMap.put("fileType", "formFile"); + formFileNum += 1; + } + model = PALRepositoryCache.getCache().get(fileRowMap.getString("FILEID")); + if (null != model) { + 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")); + String sqlsss = "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY_1124 WHERE ID = '" + + fileRowMap.getString("FILEID") + "'"; + String leve = DBSql.getString(sqlsss); + fileMap.put("TLEVEL", leve); + fileMap.put("nodeType", nodeType); + fileMaps.add(fileMap); + } + // System.err.println("=====fileMaps=====>" + fileMaps); + List fileTreeNodes = TreeUtil.buildTree("0", fileMaps, "process", "frame", null, null); + filesCount = new LinkedHashMap<>(); + filesCount.put("processFileNum", processFileNum); + filesCount.put("policyFileNum", policyFileNum); + filesCount.put("guideFileNum", guideFileNum); + filesCount.put("formFileNum", formFileNum); + ro.put("fileMaps", fileTreeNodes); + ro.put("filesCount", filesCount); + return ro.toString(); + } else { + filesCount = new LinkedHashMap<>(); + filesCount.put("processFileNum", processFileNum); + filesCount.put("policyFileNum", policyFileNum); + filesCount.put("guideFileNum", guideFileNum); + filesCount.put("formFileNum", formFileNum); + ro.ok("暂无文件"); + ro.put("fileMaps", fileMaps); + ro.put("filesCount", filesCount); + return ro.toString(); + } + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + // System.err.println("====执行完毕====>"); + } + return ro.toString(); + + } + + // 查询所有文件 + public void getind(String dempId, String fileType, List fileRowMaps, ArrayList fileHandleRowMaps, + Map reFileMap, RowMap reFileRowMap) { + 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); + } + } + if (fileType.equals("policyFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + try { + BaseModel defineModel = CoeDesignerAPIManager.getInstance() + .getDefinition(fileRowMap.getString("FILEID"), 0); + if (defineModel != null) { + String define = defineModel.getDefinition(); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + for (String key : elements.keySet()) { + JSONObject shape1 = elements.getJSONObject(key); + if ("regulation".equals(shape1.getString("name"))) { + fileRowMap.put("POLICYTYPE", "regulation"); + fileHandleRowMaps.add(fileRowMap); + } + } + + } + } catch (Exception e) { + // TODO: handle exception + } + + } + } + // && fileRowMap.getString("POLICYTYPE").equals("regulation") + if (fileType.equals("guideFile")) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy")) { + try { + BaseModel defineModel = CoeDesignerAPIManager.getInstance() + .getDefinition(fileRowMap.getString("FILEID"), 0); + if (defineModel != null) { + String define = defineModel.getDefinition(); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + for (String key : elements.keySet()) { + JSONObject shape1 = elements.getJSONObject(key); + if ("I/O_L4".equals(shape1.getString("name"))) { + fileRowMap.put("POLICYTYPE", "I/O_L4"); + fileHandleRowMaps.add(fileRowMap); + } + } + + } + } catch (Exception e) { + // TODO: handle exception + } + + } + } + 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); + if (null != reFileModel) { + 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", dempId); + reFileMap.put("PLLEVEL", (PLLEVEL - 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + } + /* + * if (fileType.equals("totalFile")) { fileHandleRowMaps.add(fileRowMap); } + */ + } + } + } + + public void getArrt(String name, PALRepositoryModel model, String dempId, Integer PLLEVEL, RowMap reFileRowMap, + ArrayList fileHandleRowMaps) { + // 支持相关文件 + List support_filesList = DesignerShapeRelationCache.getListByAttrId(model.getId(), + "", name); + for (DesignerShapeRelationModel support : support_filesList) { + String supportFileId = support.getRelationFileId();// 支持或相关文件的ID + PALRepositoryModel reFileModel = PALRepositoryCache.getCache().get(supportFileId); + if (reFileModel != null) { + String PLMETHODID = reFileModel.getMethodId(); + if (PLMETHODID.equals("data.form")) { + HashMap reFileMap = new HashMap<>(); + reFileMap.put("FILEID", supportFileId); + reFileMap.put("PLNAME", reFileModel.getName()); + reFileMap.put("PLPARENTID", model.getId()); + reFileMap.put("PLMETHODID", PLMETHODID); + reFileMap.put("PUBDEPT", dempId); + reFileMap.put("PLLEVEL", (PLLEVEL + 1)); + reFileMap.put("PLORDERINDEX", reFileModel.getOrderIndex()); + reFileRowMap = new RowMap(reFileMap); + fileHandleRowMaps.add(reFileRowMap); + } + } + } + } + +}