From c59d79830cfc0116b6d59f7f7c9ea3dd80ca375f Mon Sep 17 00:00:00 2001 From: lihongyu <504404568@qq.com> Date: Thu, 29 Dec 2022 10:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=AE=A1=E7=90=86=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E4=BC=8A=E5=88=A9=E9=9B=86=E6=88=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.classpath | 15 + .../.project | 17 + .../controller/GetmeritsController.java | 65 +- .../apps/integration/oa/OaPendComponent.java | 229 ++- .../integration/oauth/TaskController.java | 1009 ++++++------ .../user/apps/integration/util/UtilUrls.java | 52 + .../.classpath | 8 + .../.project | 17 + .../controller/AttrSynController.java | 2 +- .../controller/DataViewController.java | 16 +- .../apps/yili/reportform/job/SyncData.java | 1 + .../apps/yili/reportform/job/SyncData2.java | 676 ++++++++ .../yili/reportform/job/SyncData_job.java | 246 +++ .../yili/reportform/job/SyncData_job2.java | 312 ++++ .../reportform/service/DataViewService.java | 1244 ++++++++------- .../reportform/service/DataViewService3.java | 1396 +++++++++++++++++ .../service/FileManagementService.java | 273 ++-- .../service/FileManagementService2.java | 1173 ++++++++++++++ .../apps/yili/reportform/util/JwtUtils.java | 213 +++ 19 files changed, 5728 insertions(+), 1236 deletions(-) create mode 100644 com.awspaas.user.apps.yili.integration/.classpath create mode 100644 com.awspaas.user.apps.yili.integration/.project create mode 100644 com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/util/UtilUrls.java create mode 100644 com.awspaas.user.apps.yili.reportform/.classpath create mode 100644 com.awspaas.user.apps.yili.reportform/.project create mode 100644 com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData2.java create mode 100644 com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job.java create mode 100644 com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job2.java create mode 100644 com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService3.java create mode 100644 com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService2.java create mode 100644 com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/JwtUtils.java diff --git a/com.awspaas.user.apps.yili.integration/.classpath b/com.awspaas.user.apps.yili.integration/.classpath new file mode 100644 index 00000000..d80a4e2f --- /dev/null +++ b/com.awspaas.user.apps.yili.integration/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/com.awspaas.user.apps.yili.integration/.project b/com.awspaas.user.apps.yili.integration/.project new file mode 100644 index 00000000..99b9f5b6 --- /dev/null +++ b/com.awspaas.user.apps.yili.integration/.project @@ -0,0 +1,17 @@ + + + com.awspaas.user.apps.yili.integration + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java index b6775cc6..3e43777d 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java @@ -1398,9 +1398,7 @@ public class GetmeritsController { deoa= "'"+ds[0]+"'"; } deoa ="'"+ StringUtils.join(ds, "','")+"'"; - System.out.println( - "deoa》》》》》》》》》》"+deoa - ); + //System.out.println("deoa》》》》》》》》》》"+deoa); }else { deoa = "'" +synchronous_home+"'"; } @@ -1425,10 +1423,7 @@ public class GetmeritsController { dleass = "'"+deptSplit[0]+"'"; } dleass ="'"+ StringUtils.join(deptSplit, "','")+"'"; - System.out.println( - "dleass》》》》》》》》》》"+dleass - ); - + //System.out.println("dleass》》》》》》》》》》"+dleass); String[] plid = dleass.split(","); int y=0; @@ -1452,9 +1447,7 @@ public class GetmeritsController { deoa = "'" + ds[0] + "'"; } deoa = "'" + StringUtils.join(ds, "','") + "'"; - System.out.println( - "deoa》》》》》》》》》》" + deoa - ); + //System.out.println("deoa》》》》》》》》》》" + deoa); } else { deoa = "'" + data + "'"; } @@ -1472,7 +1465,7 @@ public class GetmeritsController { } } - System.out.println("mmap>>>>>>>>>>>>>>>>>>>"+map_name); + //System.out.println("mmap>>>>>>>>>>>>>>>>>>>"+map_name); list_pq_2.add(y, map_name); y++; } @@ -1482,7 +1475,7 @@ public class GetmeritsController { jsonObject_child_2_father.put("child",jsonArray_child_2); // jsonObject_child_2_1_father.put("child",jsonArray_child_2_1); jsonArray_levels_2.add(jsonObject_child_2_father); - System.out.println("maxs.>>>>>>>>>>>+"+maxs); + //System.out.println("maxs.>>>>>>>>>>>+"+maxs); for (int i=0;i()); @@ -1500,7 +1493,7 @@ public class GetmeritsController { * 这是L3流程绩效名称中的流程架构 */ JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); - System.out.println("h>>>>>>>>>>>>>>>" + h); + //System.out.println("h>>>>>>>>>>>>>>>" + h); jsonObject_child_content_3_name_last.put("name", list_pq_2.get(h).get(i)); if(StringUtils.isNotEmpty(list_pq_2.get(h).get(i))){ @@ -1676,17 +1669,8 @@ public class GetmeritsController { dpliea = "'"+deptSplits[0]+"'"; } dpliea ="'"+ StringUtils.join(deptSplits, "','")+"'"; - System.out.println( - "dpliea》》》》》》》》》》"+dpliea - ); - + //System.out.println("dpliea》》》》》》》》》》"+dpliea); String[] plids = dpliea.split(","); - - - - - - for (int i=0;i()); @@ -1704,7 +1688,7 @@ public class GetmeritsController { * 这是L3流程绩效名称中的流程架构 */ JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); - System.out.println("h>>>>>>>>>>>>>>>"+h); + //System.out.println("h>>>>>>>>>>>>>>>"+h); jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i)); if (StringUtils.isNotEmpty(list_pq.get(h).get(i))){ @@ -1719,7 +1703,7 @@ public class GetmeritsController { if(mapss.size()==0){ JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i)); - System.out.println("h>>>>>>>>>>>>>>>"+h); + //System.out.println("h>>>>>>>>>>>>>>>"+h); if (StringUtils.isNotEmpty(list_pq.get(h).get(i))){ jsonObject_child_content_3_name_last.put("num","1"); @@ -1847,9 +1831,7 @@ public class GetmeritsController { dleass = "'"+deptSplit[0]+"'"; } dleass ="'"+ StringUtils.join(deptSplit, "','")+"'"; - System.out.println( - "dleass》》》》》》》》》》"+dleass - ); + //System.out.println("dleass》》》》》》》》》》"+dleass); String[] plid = dleass.split(","); @@ -1873,9 +1855,7 @@ public class GetmeritsController { deoa= "'"+ds[0]+"'"; } deoa ="'"+ StringUtils.join(ds, "','")+"'"; - System.out.println( - "deoa》》》》》》》》》》"+deoa - ); + //System.out.println("deoa》》》》》》》》》》"+deoa); }else { deoa = "'"+data+"'"; } @@ -1902,7 +1882,7 @@ public class GetmeritsController { jsonObject_child_2_father.put("child",jsonArray_child_2); // jsonObject_child_2_1_father.put("child",jsonArray_child_2_1); jsonArray_levels_2.add(jsonObject_child_2_father); - System.out.println("maxs.>>>>>>>>>>>+"+maxs); + //System.out.println("maxs.>>>>>>>>>>>+"+maxs); for (int i=0;i()); @@ -1920,7 +1900,7 @@ public class GetmeritsController { * 这是L3流程绩效名称中的流程架构 */ JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); - System.out.println("h>>>>>>>>>>>>>>>" + h); + //System.out.println("h>>>>>>>>>>>>>>>" + h); jsonObject_child_content_3_name_last.put("name", list_pq_2.get(h).get(i)); if (StringUtils.isNotEmpty(list_pq_2.get(h).get(i))){ jsonObject_child_content_3_name_last.put("num", "1"); @@ -2086,17 +2066,8 @@ public class GetmeritsController { dpliea = "'"+deptSplits[0]+"'"; } dpliea ="'"+ StringUtils.join(deptSplits, "','")+"'"; - System.out.println( - "dpliea》》》》》》》》》》"+dpliea - ); - + //System.out.println("dpliea》》》》》》》》》》"+dpliea); String[] plids = dpliea.split(","); - - - - - - for (int i=0;i()); @@ -2114,7 +2085,7 @@ public class GetmeritsController { * 这是L3流程绩效名称中的流程架构 */ JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); - System.out.println("h>>>>>>>>>>>>>>>"+h); + //System.out.println("h>>>>>>>>>>>>>>>"+h); jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i)); if (StringUtils.isNotEmpty(list_pq.get(h).get(i))) { jsonObject_child_content_3_name_last.put("num","1"); @@ -2126,7 +2097,7 @@ public class GetmeritsController { } if (mapss.size()==0){ JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); - System.out.println("h>>>>>>>>>>>>>>>"+h); + //System.out.println("h>>>>>>>>>>>>>>>"+h); jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i)); if (StringUtils.isNotEmpty(list_pq.get(h).get(i))) { jsonObject_child_content_3_name_last.put("num","1"); @@ -2139,14 +2110,14 @@ public class GetmeritsController { jsonObject_child_content_3_last.put("content",jsonArray_child_content_3_last); - System.out.println("jsonObject_child_content_3_last>>>>>>>>>>>>>>"+jsonObject_child_content_3_last); + //System.out.println("jsonObject_child_content_3_last>>>>>>>>>>>>>>"+jsonObject_child_content_3_last); jsonArray_child_3_last.add(jsonObject_child_content_3_last); } jsonObject_child_3_last.put("child",jsonArray_child_3_last); jsonArray_levels_3.add(jsonObject_child_3_last); } jsonObject_L3.put("levels_3",jsonArray_levels_3); - System.out.println("jsonArray>>>>>>>>>>"+jsonArray_levels_3); + //System.out.println("jsonArray>>>>>>>>>>"+jsonArray_levels_3); JSONObject jsonObject_4 = new JSONObject(new LinkedHashMap<>()); jsonObject_4.put("levels_name","关键流程清单"); jsonObject_4.put("levels_4",new JSONArray(new LinkedList<>())); diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java index ff3652b7..15f770aa 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java @@ -12,6 +12,7 @@ import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager; import com.actionsoft.bpms.bpmn.engine.core.context.TaskBehaviorContextImpl; import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.HistoryTaskInstance; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; import com.actionsoft.bpms.commons.login.constant.LoginConst; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; @@ -419,13 +420,29 @@ public class OaPendComponent { }else { der= df.format(taskInstance.getReadTime()); } - xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); if (taskInstance!=null){ String actionName = getActionName(taskInstance); if (actionName.equals("确认发布")||equalsAction(GO_BACK, actionName)){ xmlDatasUtil.setCurrentnodetype("1"); + //流程结束时,归档所有任务 + try { + String processInstId = pec.getProcessInstance().getId(); + List list = SDK.getHistoryTaskQueryAPI().processInstId(processInstId).list(); + System.err.println(pec.getProcessInstance().getTitle()+"_当前流程的历史任务========>"+list); + for (HistoryTaskInstance historyTaskInstance : list) { + try { + //updatePending2(historyTaskInstance, pec); + } catch (Exception e) { + // TODO: handle exception + } + } + } catch (Exception e) { + // TODO: handle exception + } + + }else{ xmlDatasUtil.setCurrentnodetype("0"); } @@ -553,6 +570,216 @@ public class OaPendComponent { } } + + + public void updatePending2(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException, SOAPException, DocumentException { + if("admin".equals(taskInstance.getTarget())) { + return; + } + XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); + xmlDatasUtil.setExternal_system_ID("LCZD"); + + xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + //System.out.println("pec.getProcessInstance()>>>>>>>>"+pec.getProcessInstance()); + if(pec.getProcessInstance()!=null){ + String actionName = getActionName(taskInstance); + if (actionName.equals("传阅")){ + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条传阅流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + } + }else { + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + } + } + }else { + xmlDatasUtil.setProcess_title(" 您有一条发布流程被作废,点击进行处理"); + } + + //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + if (portalUrl.equals("http://10.114.11.135:8088/portal")){ + portalUrl = "https://bpm.yili.com:8088/portal/"; + } + if (pec.getProcessInstance()!=null){ + xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + }else { + xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&oauthName=oauthLogin&processInstId="+taskInstance.getProcessInstId()+"&sourceApp=prm"); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=CLIENT_BPM_FORM_TRACK_OPEN&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+taskInstance.getProcessInstId()+"&sourceApp=prm"); + } + + String target = taskInstance.getTarget(); + + //System.out.println("当前账户======》》》》"+target); + BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail(); + //System.out.println("bo>>>>>>>>>>>>>>"+bo_eu_oa_reson); + if (bo_eu_oa_reson!=null){ + xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID")); + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒 + if (taskInstance.getBeginTime()!=null){ + String str = df.format(taskInstance.getBeginTime()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length())); + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" "))); + }else { + String str = df.format(new Date()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(df.format(new Date()).substring(df.format(new Date()).indexOf(" "), df.format(new Date()).length())); + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(df.format(new Date()).substring(0, df.format(new Date()).indexOf(" "))); + } + + + //0待办,1已办 + xmlDatasUtil.setTo_do_status("1"); + //0:未读 -2:已读 + xmlDatasUtil.setViewtype("-2"); + //0:未归档 1:已归档 + xmlDatasUtil.setCurrentnodetype("1"); + + + xmlDatasUtil.setTo_do_official_type("0"); + String der = ""; + if (taskInstance.getReadTime()==null){ + der= df.format(new Date()); + }else { + der= df.format(taskInstance.getReadTime()); + } + + xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); + xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); + xmlDatasUtil.setCurrentnodetype("1"); + if (pec.getProcessInstance()!=null) { + xmlDatasUtil.setRequestcode(pec.getProcessInstance().getId()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(pec.getProcessInstance().getProcessDefId(),taskInstance.getActivityDefId()).getName()); + // 调用App + String sourceAppId = pec.getProcessInstance().getAppId(); + // aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; + // 参数定义列表 + Map params = new HashMap(); + //流程实例id,必填 + params.put("processInstId", pec.getProcessInstance().getId()); + //,必填 + if (pec.getUserContext()!=null){ + params.put("sid", pec.getUserContext().getSessionId()); + }else { + String sessionId = new SSOUtil().registerClientSessionNoPassword(pec.getTaskInstance().getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC); + params.put("sid", sessionId); + } + + AppAPI appAPI = SDK.getAppAPI(); + //流程节点数据 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + String username = ""; + String userid = ""; + if (ro.isOk()){ + String data = ro.getData().toString(); + JSONObject jsonObject = JSONObject.parseObject(data); + JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList")); + if (!jsonArray.isEmpty()){ + for(int i=0;i>>>>>>>>>>>"+s); + BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA").addQuery("TASK_ID=", taskInstance.getId()).detail(); + if (bo_eu_faid_data==null){ + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", "admin" + "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","2"); + bo_faid.set("TASK_ID",taskInstance.getId()); + if (pec.getProcessInstance()!=null){ + bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); + } + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); + } + } + + } + public void readOa(String taskId) throws Exception { HttpClientUtils httpClientUtil = new HttpClientUtils(); diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oauth/TaskController.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oauth/TaskController.java index c92c75d1..376eea4a 100644 --- a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oauth/TaskController.java +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/oauth/TaskController.java @@ -340,24 +340,89 @@ public class TaskController { } } - //停用 - if (list_stop.size()>0) { - //System.out.println("这个是作废的架构数据"); - for (BO bo : list_stop) { - //System.out.println("开始时间》》》》》》》" + System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID ='" + bo.get("STOPFILEID") + "'"; - RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql); - String id = bo.getString("TASKID"); - jsonObject.put("title", bo.get("STOPFILENAME")); - jsonObject.put("link", SDK.getPortalAPI().getPortalUrl() + "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid=" + Row_maps_is_not_publish.getString("id") + "&sid=" + sid); - jsonObject.put("size", ""); - jsonObject.put("id", bo.getString("STOPFILEID")); - jsonObject.put("taskId", id); - jsonArray.add(jsonObject); - num++; + /** + * 当发布和变更为空时,显示作废的文件 + */ + if(list.size()==0&&lists.size()==0) { + if (list_stop.size()>0) { + //System.out.println("这个是作废的架构数据"); + for (BO bo : list_stop) { + //System.out.println("开始时间》》》》》》》" + System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID ='" + bo.get("STOPFILEID") + "'"; + RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql); + String id = bo.getString("TASKID"); + jsonObject.put("title", bo.get("STOPFILENAME")); + jsonObject.put("link", SDK.getPortalAPI().getPortalUrl() + "/r/w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid=" + Row_maps_is_not_publish.getString("id") + "&sid=" + sid); + jsonObject.put("size", ""); + jsonObject.put("id", bo.getString("STOPFILEID")); + jsonObject.put("taskId", id); + jsonArray.add(jsonObject); + + String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'"); + if(UtilString.isNotEmpty(methodId)) { + if(methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f'"; + List maps = DBSql.getMaps(conn,sql_upfile); + UserContext userContext = UserContext.fromSessionId(sid); + UpfileWeb upfileWeb = new UpfileWeb(userContext); - } + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + Map params_previews = new HashMap(); + //文档是否允许下载,必填 + params_previews.put("isDownload", true); + //显示文件名,必填 + params_previews.put("fileNameOriginal", row.getString("FILENAME")); + //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 + params_previews.put("isPDFCovertPNG", 0); + //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 + params_previews.put("extParams", ""); + //文档是否允许打印,必填 + params_previews.put("isPrint", true); + //是否显示顶部工具栏的返回按钮,默认显示,非必填 + params_previews.put("isShowBackbtn", ""); + //原文件DC,必填 + params_previews.put("sourceDc", dcContexts); + //是否显示默认预览工具栏,必填 + params_previews.put("isShowDefaultToolbar", true); + //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 + params_previews.put("isCopy", true); + //sessionid,必填 + params_previews.put("sid", sid); + //文档是否加密,必填 + params_previews.put("isEncrypt", false); + AppAPI appAPIs = SDK.getAppAPI(); + //文档预览 + ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); + String sourceAppId = instanceById.getAppId(); + String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview"; + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("title",row.getString("FILENAME")); + String base_url = "https://bpm.yili.com:8088/portal/r"; + if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){ + jsonObject1.put("link",ros.get("url").toString().substring(0)); + }else { + jsonObject1.put("link",base_url+ros.get("url").toString().substring(1)); + } + // jsonObject1.put("size","12k"); + jsonArray.add(jsonObject1); + } + num++; + + } + } + } //变更 if(lists.size()>0) { @@ -529,526 +594,580 @@ public class TaskController { } - @Mapping("com.yili_process_page_phone") - public String processPhone(UserContext me, RequestParams params) throws SQLException { + @Mapping("com.yili_process_page_phone") + public String processPhone(UserContext me, RequestParams params) throws SQLException { - //System.out.println("params>>>>>>>>>>>>"+params.get("userid")); - //System.out.println("UserContext>>>>>>>>>>>>"+me.getUID()); - String userMobile = me.getDeviceType(); - Connection conn = DBSql.open(); - JSONArray jsonArray = new JSONArray(); - - String html = "index_phone.html"; - Map map = new LinkedHashMap(); - try{ - //UserContext uc = UserContext.fromSessionId(sid); - String sid = me.getSessionId(); - String processInstId = params.get("processInstId"); - String taskInstId = params.get("taskInstId"); - - try { - //用户打开阅览界面日志 - setUserLog(processInstId,me.getUID(),"3"); - - } catch (Exception e) { - } - String usercode = "admin"; - if(UtilString.isNotEmpty(me.getUID())){ - usercode = me.getUID(); - } - StringBuffer sb = new StringBuffer(); - ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); - String sourceAppId = instanceById.getAppId(); + // System.out.println("params>>>>>>>>>>>>"+params.get("userid")); + // System.out.println("UserContext>>>>>>>>>>>>"+me.getUID()); + String userMobile = me.getDeviceType(); + Connection conn = DBSql.open(); + JSONArray jsonArray = new JSONArray(); + + String html = "index_phone.html"; + Map map = new LinkedHashMap(); + try { + // UserContext uc = UserContext.fromSessionId(sid); + String sid = me.getSessionId(); + String processInstId = params.get("processInstId"); + String taskInstId = params.get("taskInstId"); + + try { + // 用户打开阅览界面日志 + setUserLog(processInstId, me.getUID(), "3"); + + } catch (Exception e) { + } + String usercode = "admin"; + if (UtilString.isNotEmpty(me.getUID())) { + usercode = me.getUID(); + } + StringBuffer sb = new StringBuffer(); + ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); + String sourceAppId = instanceById.getAppId(); // aslp服务地址 - String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview"; - String substring = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).addQuery("OPTIONTYPE IS NOT NULL",null).detail().getString("RELEASE_INSTRUCTIONS"); - BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).addQuery("OPTIONTYPE IS NOT NULL",null).detail(); + String aslp = "aslp://com.actionsoft.apps.addons.onlinedoc/filePreview"; + String substring = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId) + .addQuery("OPTIONTYPE IS NOT NULL", null).detail().getString("RELEASE_INSTRUCTIONS"); + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId) + .addQuery("OPTIONTYPE IS NOT NULL", null).detail(); - List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); - List lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); - List list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId).orderByCreated().asc().list(); - int num = 1; - - for (BO bo:list) { - - if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){ - OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); - //System.out.println(",odel>>>>>>>>"+bo.getString("TASKID")); - OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); - if (appProfile==null){ - throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1"); - } - DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT); - if (dcProfile == null) - throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); - String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+bo.getString("PUBLISHFILEID")+"'"; - String lever = DBSql.getString(conn, sql_lever); - //System.out.println("lever====>>>>>"+lever); - if (lever.length()!=5){ - lever = lever+".0"; - } - String name = bo.getString("PUBLISHFILENAME").replaceAll("/",""); - DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),name+"_"+lever+".doc"); + List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processInstId) + .orderByCreated().asc().list(); + List lists = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processInstId) + .orderByCreated().asc().list(); + List list_stop = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processInstId) + .orderByCreated().asc().list(); + int num = 1; + if (list.size() > 0) { + for (BO bo : list) { + if (StringUtils.isNotEmpty(bo.getString("TASKID")) + && !bo.getString("TASKID").equals("submit_create")) { + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + // System.out.println(",odel>>>>>>>>"+bo.getString("TASKID")); + OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); + if (appProfile == null) { + throw new AWSException( + "Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1"); + } + DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), + OutputConst.EXT_APP_DC_OUTPUT); + if (dcProfile == null) + throw new AWSException( + "Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); + String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + + bo.getString("PUBLISHFILEID") + "'"; + String lever = DBSql.getString(conn, sql_lever); + // System.out.println("lever====>>>>>"+lever); + if (lever.length() != 5) { + lever = lever + ".0"; + } + String name = bo.getString("PUBLISHFILENAME").replaceAll("/", ""); + DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), + model.getWsId(), bo.getString("TASKID"), name + "_" + lever + ".doc"); // 调用App // 参数定义列表 - Map params_preview = new HashMap(); + Map params_preview = new HashMap(); //文档是否允许下载,必填 - params_preview.put("isDownload", true); + params_preview.put("isDownload", true); //显示文件名,必填 - params_preview.put("fileNameOriginal", name+"_"+lever+".doc"); + params_preview.put("fileNameOriginal", name + "_" + lever + ".doc"); //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 - params_preview.put("isPDFCovertPNG", 0); + params_preview.put("isPDFCovertPNG", 0); //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 - params_preview.put("extParams", ""); + params_preview.put("extParams", ""); //文档是否允许打印,必填 - params_preview.put("isPrint", true); + params_preview.put("isPrint", true); //是否显示顶部工具栏的返回按钮,默认显示,非必填 - params_preview.put("isShowBackbtn", false); + params_preview.put("isShowBackbtn", false); //原文件DC,必填 - params_preview.put("sourceDc", dcContext); + params_preview.put("sourceDc", dcContext); //是否显示默认预览工具栏,必填 - params_preview.put("isShowDefaultToolbar", true); + params_preview.put("isShowDefaultToolbar", true); //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 - params_preview.put("isCopy", true); + params_preview.put("isCopy", true); //sessionid,必填 - params_preview.put("sid", sid); + params_preview.put("sid", sid); //文档是否加密,必填 - params_preview.put("isEncrypt", false); - AppAPI appAPI = SDK.getAppAPI(); + params_preview.put("isEncrypt", false); + AppAPI appAPI = SDK.getAppAPI(); //文档预览 - ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview); + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview); - //System.out.println("ro>>>>>>>>>>>>>>>>"+ro); - String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='"+bo.get("PUBLISHFILEID")+"'"; - List Row_maps_is_not_publish = DBSql.getMaps(conn, is_not_publish_sql); + // System.out.println("ro>>>>>>>>>>>>>>>>"+ro); + String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='" + + bo.get("PUBLISHFILEID") + "'"; + List Row_maps_is_not_publish = DBSql.getMaps(conn, is_not_publish_sql); - /*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId); - if(havingStartProcessPermission) {*/ - BigDecimal big=new BigDecimal(Row_maps_is_not_publish.get(0).getString("PLVER")); + /* + * boolean havingStartProcessPermission + * =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId); + * if(havingStartProcessPermission) { + */ + BigDecimal big = new BigDecimal(Row_maps_is_not_publish.get(0).getString("PLVER")); - JSONObject jsonObjects = new JSONObject(); - jsonObjects.put("title",bo.get("PUBLISHFILENAME")); - jsonObjects.put("link","https://bpm.yili.com:8088/portal/r"+ro.get("url").toString().substring(1)); - // jsonObjects.put("size","12k"); - jsonArray.add(jsonObjects); - } + JSONObject jsonObjects = new JSONObject(); + jsonObjects.put("title", bo.get("PUBLISHFILENAME")); + jsonObjects.put("link", + "https://bpm.yili.com:8088/portal/r" + ro.get("url").toString().substring(1)); + // jsonObjects.put("size","12k"); + jsonArray.add(jsonObjects); + } + String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("PUBLISHFILEID") + "'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("PUBLISHFILEID") + "'"); + if (UtilString.isNotEmpty(methodId)) { + if (methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("PUBLISHFILEID") + "') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + // String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where + // palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= + // '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f'"; + List maps = DBSql.getMaps(conn, sql_upfile); + UserContext userContext = UserContext.fromSessionId(sid); + UpfileWeb upfileWeb = new UpfileWeb(userContext); - - - String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" + ") ORDER BY CREATETIME ASC"; - String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'"); - if(UtilString.isNotEmpty(methodId)) { - if(methodId.equals("control.policy")) { - sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; - } - } - //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"') AND FILETYPE = 'f'"; - List maps = DBSql.getMaps(conn,sql_upfile); - UserContext userContext = UserContext.fromSessionId(sid); - UpfileWeb upfileWeb = new UpfileWeb(userContext); - - for (RowMap row : maps) { - UpfileModel upfileModel = new UpfileModel(); - upfileModel.setType(row.getString("FILETYPE")); - upfileModel.setFileName(row.getString("FILENAME")); - upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); - upfileModel.setShape_uuid(row.getString("SHAPEID")); - DCContext dcContexts = upfileWeb.getDCContext(upfileModel); - Map params_previews = new HashMap(); + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + Map params_previews = new HashMap(); //文档是否允许下载,必填 - params_previews.put("isDownload", true); + params_previews.put("isDownload", true); //显示文件名,必填 - params_previews.put("fileNameOriginal", row.getString("FILENAME")); + params_previews.put("fileNameOriginal", row.getString("FILENAME")); //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 - params_previews.put("isPDFCovertPNG", 0); + params_previews.put("isPDFCovertPNG", 0); //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 - params_previews.put("extParams", ""); + params_previews.put("extParams", ""); //文档是否允许打印,必填 - params_previews.put("isPrint", true); + params_previews.put("isPrint", true); //是否显示顶部工具栏的返回按钮,默认显示,非必填 - params_previews.put("isShowBackbtn", ""); + params_previews.put("isShowBackbtn", ""); //原文件DC,必填 - params_previews.put("sourceDc", dcContexts); + params_previews.put("sourceDc", dcContexts); //是否显示默认预览工具栏,必填 - params_previews.put("isShowDefaultToolbar", true); + params_previews.put("isShowDefaultToolbar", true); //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 - params_previews.put("isCopy", true); + params_previews.put("isCopy", true); //sessionid,必填 - params_previews.put("sid", sid); + params_previews.put("sid", sid); //文档是否加密,必填 - params_previews.put("isEncrypt", false); - AppAPI appAPIs = SDK.getAppAPI(); + params_previews.put("isEncrypt", false); + AppAPI appAPIs = SDK.getAppAPI(); //文档预览 - ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews); + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, + params_previews); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("title",row.getString("FILENAME")); - String base_url = "https://bpm.yili.com:8088/portal/r"; - if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){ - jsonObject1.put("link",ros.get("url").toString().substring(0)); - }else { - jsonObject1.put("link",base_url+ros.get("url").toString().substring(1)); - } + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("title", row.getString("FILENAME")); + String base_url = "https://bpm.yili.com:8088/portal/r"; + if (row.getString("FILENAME").toString().contains(".xls") + || row.getString("FILENAME").toString().contains(".xlsx")) { + jsonObject1.put("link", ros.get("url").toString().substring(0)); + } else { + jsonObject1.put("link", base_url + ros.get("url").toString().substring(1)); + } - // jsonObject1.put("size","12k"); - jsonArray.add(jsonObject1); - num++; - } - num++; - } + // jsonObject1.put("size","12k"); + jsonArray.add(jsonObject1); + num++; + } + num++; + } + } -/** - * 这个是作废的显示的文件 - */ - for (BO bo:list_stop) { + /** + * 当发布和变更为空时,显示作废的文件 + */ + if (list.size() == 0 && lists.size() == 0) { + if (list_stop.size() > 0) { + for (BO bo : list_stop) { - if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){ - OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); - //System.out.println(",odel>>>>>>>>"+bo.getString("TASKID")); - OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); - if (appProfile==null){ - throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1"); - } - DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT); - if (dcProfile == null) - throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); - String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+bo.getString("STOPFILEID")+"'"; - String lever = DBSql.getString(conn, sql_lever); - //System.out.println("lever====>>>>>"+lever); - if (lever.length()!=5){ - lever = lever+".0"; - } - String name = bo.getString("STOPFILENAME").replaceAll("/",""); - DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),name+"_"+lever+".doc"); + if (StringUtils.isNotEmpty(bo.getString("TASKID")) + && !bo.getString("TASKID").equals("submit_create")) { + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + // System.out.println(",odel>>>>>>>>"+bo.getString("TASKID")); + OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); + if (appProfile == null) { + throw new AWSException( + "Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1"); + } + DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), + OutputConst.EXT_APP_DC_OUTPUT); + if (dcProfile == null) + throw new AWSException( + "Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); + String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + + bo.getString("STOPFILEID") + "'"; + String lever = DBSql.getString(conn, sql_lever); + // System.out.println("lever====>>>>>"+lever); + if (lever.length() != 5) { + lever = lever + ".0"; + } + String name = bo.getString("STOPFILENAME").replaceAll("/", ""); + DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), + model.getWsId(), bo.getString("TASKID"), name + "_" + lever + ".doc"); + // 调用App + // 参数定义列表 + Map params_preview = new HashMap(); + // 文档是否允许下载,必填 + params_preview.put("isDownload", true); + // 显示文件名,必填 + params_preview.put("fileNameOriginal", name + "_" + lever + ".doc"); + // PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 + params_preview.put("isPDFCovertPNG", 0); + // groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 + params_preview.put("extParams", ""); + // 文档是否允许打印,必填 + params_preview.put("isPrint", true); + // 是否显示顶部工具栏的返回按钮,默认显示,非必填 + params_preview.put("isShowBackbtn", false); + // 原文件DC,必填 + params_preview.put("sourceDc", dcContext); + // 是否显示默认预览工具栏,必填 + params_preview.put("isShowDefaultToolbar", true); + // 文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 + params_preview.put("isCopy", true); + // sessionid,必填 + params_preview.put("sid", sid); + // 文档是否加密,必填 + params_preview.put("isEncrypt", false); + AppAPI appAPI = SDK.getAppAPI(); + // 文档预览 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, + params_preview); + + // System.out.println("ro>>>>>>>>>>>>>>>>"+ro); + String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='" + + bo.get("STOPFILEID") + "'"; + List Row_maps_is_not_publish = DBSql.getMaps(conn, is_not_publish_sql); + + /* + * boolean havingStartProcessPermission + * =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId); + * if(havingStartProcessPermission) { + */ + BigDecimal big = new BigDecimal(Row_maps_is_not_publish.get(0).getString("PLVER")); + + JSONObject jsonObjects = new JSONObject(); + jsonObjects.put("title", bo.get("STOPFILENAME")); + jsonObjects.put("link", + "https://bpm.yili.com:8088/portal/r" + ro.get("url").toString().substring(1)); + // jsonObjects.put("size","12k"); + jsonArray.add(jsonObjects); + } + + /* + * String sql_upfile = + * "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + * +bo.getString("STOPFILEID")+"'" + ")"; + */ + String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("STOPFILEID") + "'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql + .getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("STOPFILEID") + "'"); + if (UtilString.isNotEmpty(methodId)) { + if (methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("STOPFILEID") + "') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + // String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where + // palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= + // '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f'"; + List maps = DBSql.getMaps(conn, sql_upfile); + UserContext userContext = UserContext.fromSessionId(sid); + UpfileWeb upfileWeb = new UpfileWeb(userContext); + + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + Map params_previews = new HashMap(); + // 文档是否允许下载,必填 + params_previews.put("isDownload", true); + // 显示文件名,必填 + params_previews.put("fileNameOriginal", row.getString("FILENAME")); + // PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 + params_previews.put("isPDFCovertPNG", 0); + // groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 + params_previews.put("extParams", ""); + // 文档是否允许打印,必填 + params_previews.put("isPrint", true); + // 是否显示顶部工具栏的返回按钮,默认显示,非必填 + params_previews.put("isShowBackbtn", ""); + // 原文件DC,必填 + params_previews.put("sourceDc", dcContexts); + // 是否显示默认预览工具栏,必填 + params_previews.put("isShowDefaultToolbar", true); + // 文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 + params_previews.put("isCopy", true); + // sessionid,必填 + params_previews.put("sid", sid); + // 文档是否加密,必填 + params_previews.put("isEncrypt", false); + AppAPI appAPIs = SDK.getAppAPI(); + // 文档预览 + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, + params_previews); + + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("title", row.getString("FILENAME")); + String base_url = "https://bpm.yili.com:8088/portal/r"; + if (row.getString("FILENAME").toString().contains(".xls") + || row.getString("FILENAME").toString().contains(".xlsx")) { + jsonObject1.put("link", ros.get("url").toString().substring(0)); + } else { + jsonObject1.put("link", base_url + ros.get("url").toString().substring(1)); + } + + // jsonObject1.put("size","12k"); + jsonArray.add(jsonObject1); + num++; + } + num++; + } + } + + } + + if (lists.size() > 0) { + for (BO bo : lists) { + + if (StringUtils.isNotEmpty(bo.getString("TASKID")) + && !bo.getString("TASKID").equals("submit_create")) { + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + // System.out.println(",odel>>>>>>>>"+bo.getString("TASKID")); + OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); + if (appProfile == null) { + throw new AWSException( + "Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1"); + } + DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), + OutputConst.EXT_APP_DC_OUTPUT); + if (dcProfile == null) + throw new AWSException( + "Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); + String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + + bo.getString("CHANGEDFILEIDNEW") + "'"; + String lever = DBSql.getString(conn, sql_lever); + // System.out.println("lever====>>>>>"+lever); + if (lever.length() != 5) { + lever = lever + ".0"; + } + String name = bo.getString("CHANGEDFILENAMENEW").replaceAll("/", ""); + DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), + model.getWsId(), bo.getString("TASKID"), name + "_" + lever + ".doc"); // 调用App // 参数定义列表 - Map params_preview = new HashMap(); + Map params_preview = new HashMap(); //文档是否允许下载,必填 - params_preview.put("isDownload", true); + params_preview.put("isDownload", true); //显示文件名,必填 - params_preview.put("fileNameOriginal", name+"_"+lever+".doc"); + params_preview.put("fileNameOriginal", name + "_" + lever + ".doc"); //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 - params_preview.put("isPDFCovertPNG", 0); + params_preview.put("isPDFCovertPNG", 0); //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 - params_preview.put("extParams", ""); + params_preview.put("extParams", ""); //文档是否允许打印,必填 - params_preview.put("isPrint", true); + params_preview.put("isPrint", true); //是否显示顶部工具栏的返回按钮,默认显示,非必填 - params_preview.put("isShowBackbtn", false); + params_preview.put("isShowBackbtn", false); //原文件DC,必填 - params_preview.put("sourceDc", dcContext); + params_preview.put("sourceDc", dcContext); //是否显示默认预览工具栏,必填 - params_preview.put("isShowDefaultToolbar", true); + params_preview.put("isShowDefaultToolbar", true); //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 - params_preview.put("isCopy", true); + params_preview.put("isCopy", true); //sessionid,必填 - params_preview.put("sid", sid); + params_preview.put("sid", sid); //文档是否加密,必填 - params_preview.put("isEncrypt", false); - AppAPI appAPI = SDK.getAppAPI(); + params_preview.put("isEncrypt", false); + AppAPI appAPI = SDK.getAppAPI(); //文档预览 - ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview); + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview); - //System.out.println("ro>>>>>>>>>>>>>>>>"+ro); - String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='"+bo.get("STOPFILEID")+"'"; - List Row_maps_is_not_publish = DBSql.getMaps(conn, is_not_publish_sql); + // System.out.println("ro>>>>>>>>>>>>>>>>"+ro); + String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='" + + bo.get("CHANGEDFILEIDNEW") + "'"; + RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql); - /*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId); - if(havingStartProcessPermission) {*/ - BigDecimal big=new BigDecimal(Row_maps_is_not_publish.get(0).getString("PLVER")); + /* + * boolean havingStartProcessPermission + * =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId); + * if(havingStartProcessPermission) { + */ + BigDecimal big = new BigDecimal(Row_maps_is_not_publish.getString("PLVER")); - JSONObject jsonObjects = new JSONObject(); - jsonObjects.put("title",bo.get("STOPFILENAME")); - jsonObjects.put("link","https://bpm.yili.com:8088/portal/r"+ro.get("url").toString().substring(1)); - // jsonObjects.put("size","12k"); - jsonArray.add(jsonObjects); - } + JSONObject jsonObjects = new JSONObject(); + jsonObjects.put("title", bo.get("CHANGEDFILENAMENEW")); + jsonObjects.put("link", + "https://bpm.yili.com:8088/portal/r" + ro.get("url").toString().substring(1)); + // jsonObjects.put("size","12k"); + jsonArray.add(jsonObjects); + } + String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("CHANGEDFILEIDNEW") + "'" + ") ORDER BY CREATETIME ASC"; + String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("CHANGEDFILEIDNEW") + "'"); + if (UtilString.isNotEmpty(methodId)) { + if (methodId.equals("control.policy")) { + sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" + + bo.getString("CHANGEDFILEIDNEW") + + "') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; + } + } + List maps = DBSql.getMaps(conn, sql_upfile); + UserContext userContext = UserContext.fromSessionId(sid); + UpfileWeb upfileWeb = new UpfileWeb(userContext); - - - /* - * String sql_upfile = - * "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '" - * +bo.getString("STOPFILEID")+"'" + ")"; - */ - String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'" + ") ORDER BY CREATETIME ASC"; - String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"'"); - if(UtilString.isNotEmpty(methodId)) { - if(methodId.equals("control.policy")) { - sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; - } - } - //String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("STOPFILEID")+"') AND FILETYPE = 'f'"; - List maps = DBSql.getMaps(conn,sql_upfile); - UserContext userContext = UserContext.fromSessionId(sid); - UpfileWeb upfileWeb = new UpfileWeb(userContext); - - for (RowMap row : maps) { - UpfileModel upfileModel = new UpfileModel(); - upfileModel.setType(row.getString("FILETYPE")); - upfileModel.setFileName(row.getString("FILENAME")); - upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); - upfileModel.setShape_uuid(row.getString("SHAPEID")); - DCContext dcContexts = upfileWeb.getDCContext(upfileModel); - Map params_previews = new HashMap(); + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + Map params_previews = new HashMap(); //文档是否允许下载,必填 - params_previews.put("isDownload", true); + params_previews.put("isDownload", true); //显示文件名,必填 - params_previews.put("fileNameOriginal", row.getString("FILENAME")); + params_previews.put("fileNameOriginal", row.getString("FILENAME")); //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 - params_previews.put("isPDFCovertPNG", 0); + params_previews.put("isPDFCovertPNG", 0); //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 - params_previews.put("extParams", ""); + params_previews.put("extParams", ""); //文档是否允许打印,必填 - params_previews.put("isPrint", true); + params_previews.put("isPrint", true); //是否显示顶部工具栏的返回按钮,默认显示,非必填 - params_previews.put("isShowBackbtn", ""); + params_previews.put("isShowBackbtn", ""); //原文件DC,必填 - params_previews.put("sourceDc", dcContexts); + params_previews.put("sourceDc", dcContexts); //是否显示默认预览工具栏,必填 - params_previews.put("isShowDefaultToolbar", true); + params_previews.put("isShowDefaultToolbar", true); //文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 - params_previews.put("isCopy", true); + params_previews.put("isCopy", true); //sessionid,必填 - params_previews.put("sid", sid); + params_previews.put("sid", sid); //文档是否加密,必填 - params_previews.put("isEncrypt", false); - AppAPI appAPIs = SDK.getAppAPI(); + params_previews.put("isEncrypt", false); + AppAPI appAPIs = SDK.getAppAPI(); //文档预览 - ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews); + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, + params_previews); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("title",row.getString("FILENAME")); - String base_url = "https://bpm.yili.com:8088/portal/r"; - if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){ - jsonObject1.put("link",ros.get("url").toString().substring(0)); - }else { - jsonObject1.put("link",base_url+ros.get("url").toString().substring(1)); - } + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("title", row.getString("FILENAME")); + if (row.getString("FILENAME").contains(".xlsx") || row.getString("FILENAME").contains(".xls")) { + jsonObject1.put("link", ros.get("url").toString().substring(0)); + } else { + jsonObject1.put("link", + "https://bpm.yili.com:8088/portal/r" + ros.get("url").toString().substring(1)); + } - // jsonObject1.put("size","12k"); - jsonArray.add(jsonObject1); - num++; - } - num++; - } + // jsonObject1.put("size","12k"); + jsonArray.add(jsonObject1); + num++; + } + num++; + } + } - for (BO bo:lists) { + // } + // System.out.println("substring>>>>>>>>>>"+substring); + map.put("subString", substring); + map.put("ProcessTile", bo_act_coe_publish.getString("PROCESS_TITLE")); + map.put("processInstId", processInstId); + map.put("sid", sid); + // System.out.println("jsonArray=====>>>>>>>>>"+jsonArray); + map.put("jsonlist", jsonArray); + // DBSql.close(conn); - if(StringUtils.isNotEmpty(bo.getString("TASKID"))&& !bo.getString("TASKID").equals("submit_create")){ - OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); - //System.out.println(",odel>>>>>>>>"+bo.getString("TASKID")); - OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); - if (appProfile==null){ - throw new AWSException("Not Find OutputAppProfile! profileId=" + "_900fde3255248317266cad1c72f157b1"); - } - DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT); - if (dcProfile == null) - throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); - String sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '"+bo.getString("CHANGEDFILEIDNEW")+"'"; - String lever = DBSql.getString(conn, sql_lever); - //System.out.println("lever====>>>>>"+lever); - if (lever.length()!=5){ - lever = lever+".0"; - } - String name = bo.getString("CHANGEDFILENAMENEW").replaceAll("/",""); - DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),name+"_"+lever+".doc"); + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + String url = portalUrl + "/r/or?cmd=com.yili_process_page&processInstId=" + processInstId + "&taskInstId=" + + taskInstId; + String mobileurl = portalUrl + "/r/or?cmd=com.yili_process_page_phone&processInstId=" + processInstId + + "&taskInstId=" + taskInstId; + JSONObject jsonObject = new JSONObject(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String sql = "SELECT * FROM WFC_PROCESS WHERE ID ='" + processInstId + "'"; + List rowMaps = DBSql.getMaps(conn, sql); + if (rowMaps.size() == 1) { + jsonObject.put("action", "read"); + // jsonObject.put("dept",me.getDepartmentModel().getNo()); + // jsonObject.put("user",me.getUID()); + // jsonObject.put("remark",""); + jsonObject.put("status", "1"); + // jsonObject.put("pcurl",url); + // jsonObject.put("mobileurl",mobileurl); + try { + BO bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId) + .addQuery("USER_ID=", usercode).detail(); + if (bo_act_dataid != null) { + jsonObject.put("dataid", bo_act_dataid.getString("DATAID")); + } + } catch (Exception e) { + } -// 调用App + // jsonObject.put("userList","00345531"); + HttpClientUtils httpClientUtil = new HttpClientUtils(); + // String s = + // httpClientUtil.SendPreview("http://10.119.22.207:80/services/service_lcglpt?wsdl", + // jsonObject); -// 参数定义列表 - Map params_preview = new HashMap(); -//文档是否允许下载,必填 - params_preview.put("isDownload", true); -//显示文件名,必填 - params_preview.put("fileNameOriginal", name+"_"+lever+".doc"); -//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 - params_preview.put("isPDFCovertPNG", 0); -//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 - params_preview.put("extParams", ""); -//文档是否允许打印,必填 - params_preview.put("isPrint", true); -//是否显示顶部工具栏的返回按钮,默认显示,非必填 - params_preview.put("isShowBackbtn", false); -//原文件DC,必填 - params_preview.put("sourceDc", dcContext); -//是否显示默认预览工具栏,必填 - params_preview.put("isShowDefaultToolbar", true); -//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 - params_preview.put("isCopy", true); -//sessionid,必填 - params_preview.put("sid", sid); -//文档是否加密,必填 - params_preview.put("isEncrypt", false); - AppAPI appAPI = SDK.getAppAPI(); -//文档预览 - ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params_preview); + String xmlStr = "\n" + + " " + " " + " " + " " + + "" + " " + " " + + " " + ""; + // HttpClientUtil httpClientUtil = new HttpClientUtil(); + String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl"); - //System.out.println("ro>>>>>>>>>>>>>>>>"+ro); - String is_not_publish_sql = "SELECT id,PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE id ='"+bo.get("CHANGEDFILEIDNEW")+"'"; - RowMap Row_maps_is_not_publish = DBSql.getMap(conn, is_not_publish_sql); + String s = UtilUrl.doPostSoap(readurl, xmlStr, ""); + // System.out.println("s==============>>>>>>>>>>>"+s); - /*boolean havingStartProcessPermission =SDK.getPermAPI().havingStartProcessPermission(uc.getUID(), processDefId); - if(havingStartProcessPermission) {*/ - BigDecimal big=new BigDecimal(Row_maps_is_not_publish.getString("PLVER")); + } + String nums = DBSql + .getString("select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'"); + if (UtilString.isNotEmpty(nums)) { - JSONObject jsonObjects = new JSONObject(); - jsonObjects.put("title",bo.get("CHANGEDFILENAMENEW")); - jsonObjects.put("link","https://bpm.yili.com:8088/portal/r"+ro.get("url").toString().substring(1)); - // jsonObjects.put("size","12k"); - jsonArray.add(jsonObjects); - } + Integer read_num = Integer.valueOf(nums); + read_num += 1; + DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num + "' where PROCESSID = '" + + processInstId + "'"); + } - - - String sql_upfile ="select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'" + ") ORDER BY CREATETIME ASC"; - String methodId = DBSql.getString("select PLMETHODID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'"); - if(UtilString.isNotEmpty(methodId)) { - if(methodId.equals("control.policy")) { - sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"') AND FILETYPE = 'f' ORDER BY CREATETIME ASC"; - } - } - - List maps = DBSql.getMaps(conn,sql_upfile); - UserContext userContext = UserContext.fromSessionId(sid); - UpfileWeb upfileWeb = new UpfileWeb(userContext); - - for (RowMap row : maps) { - UpfileModel upfileModel = new UpfileModel(); - upfileModel.setType(row.getString("FILETYPE")); - upfileModel.setFileName(row.getString("FILENAME")); - upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); - upfileModel.setShape_uuid(row.getString("SHAPEID")); - DCContext dcContexts = upfileWeb.getDCContext(upfileModel); - Map params_previews = new HashMap(); -//文档是否允许下载,必填 - params_previews.put("isDownload", true); -//显示文件名,必填 - params_previews.put("fileNameOriginal", row.getString("FILENAME")); -//PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 - params_previews.put("isPDFCovertPNG", 0); -//groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 - params_previews.put("extParams", ""); -//文档是否允许打印,必填 - params_previews.put("isPrint", true); -//是否显示顶部工具栏的返回按钮,默认显示,非必填 - params_previews.put("isShowBackbtn", ""); -//原文件DC,必填 - params_previews.put("sourceDc", dcContexts); -//是否显示默认预览工具栏,必填 - params_previews.put("isShowDefaultToolbar", true); -//文档是否允许复制。true为允许复制,转换结果为PDF格式文件;false为不可复制,转换结果为PNG格式文件(注意参数值为false时转换时间稍长),必填 - params_previews.put("isCopy", true); -//sessionid,必填 - params_previews.put("sid", sid); -//文档是否加密,必填 - params_previews.put("isEncrypt", false); - AppAPI appAPIs = SDK.getAppAPI(); -//文档预览 - ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, params_previews); - - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("title",row.getString("FILENAME")); - if (row.getString("FILENAME").contains(".xlsx")||row.getString("FILENAME").contains(".xls")){ - jsonObject1.put("link",ros.get("url").toString().substring(0)); - }else { - jsonObject1.put("link","https://bpm.yili.com:8088/portal/r"+ros.get("url").toString().substring(1)); - } - - // jsonObject1.put("size","12k"); - jsonArray.add(jsonObject1); - num++; - } - num++; - } - - - //} - //System.out.println("substring>>>>>>>>>>"+substring); - map.put("subString",substring); - map.put("ProcessTile",bo_act_coe_publish.getString("PROCESS_TITLE")); - map.put("processInstId",processInstId); - map.put("sid",sid); - //System.out.println("jsonArray=====>>>>>>>>>"+jsonArray); - map.put("jsonlist",jsonArray); - //DBSql.close(conn); - - String portalUrl = SDK.getPortalAPI().getPortalUrl(); - String url = portalUrl+"/r/or?cmd=com.yili_process_page&processInstId="+processInstId+"&taskInstId="+taskInstId; - String mobileurl = portalUrl+"/r/or?cmd=com.yili_process_page_phone&processInstId="+processInstId+"&taskInstId="+taskInstId; - JSONObject jsonObject = new JSONObject(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String sql = "SELECT * FROM WFC_PROCESS WHERE ID ='"+processInstId+"'"; - List rowMaps = DBSql.getMaps(conn,sql); - if (rowMaps.size()==1){ - - jsonObject.put("action","read"); - //jsonObject.put("dept",me.getDepartmentModel().getNo()); - // jsonObject.put("user",me.getUID()); - // jsonObject.put("remark",""); - jsonObject.put("status","1"); - //jsonObject.put("pcurl",url); - // jsonObject.put("mobileurl",mobileurl); - try { - BO bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=", usercode).detail(); - if (bo_act_dataid!=null){ - jsonObject.put("dataid",bo_act_dataid.getString("DATAID")); - } - }catch (Exception e){ - - } - - //jsonObject.put("userList","00345531"); - HttpClientUtils httpClientUtil = new HttpClientUtils(); - // String s = httpClientUtil.SendPreview("http://10.119.22.207:80/services/service_lcglpt?wsdl", jsonObject); - - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - ""+ - " " + - " " + - " " + - ""; - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl"); - - String s = UtilUrl.doPostSoap(readurl, xmlStr, ""); - //System.out.println("s==============>>>>>>>>>>>"+s); - - } - String nums = DBSql.getString("select READNUM from BO_EU_PAL_READ_LOG where PROCESSID = '" + processInstId + "'"); - if (UtilString.isNotEmpty(nums)){ - - Integer read_num = Integer.valueOf(nums); - read_num+=1; - DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '"+read_num+"' where PROCESSID = '"+processInstId+"'"); - } - - }catch (Exception e){ - e.printStackTrace(); - }finally { - conn.close(); - } - return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration",html, map); - } + } catch (Exception e) { + e.printStackTrace(); + } finally { + conn.close(); + } + return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration", html, map); + } /** diff --git a/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/util/UtilUrls.java b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/util/UtilUrls.java new file mode 100644 index 00000000..b0fce0b5 --- /dev/null +++ b/com.awspaas.user.apps.yili.integration/src/com/awspaas/user/apps/integration/util/UtilUrls.java @@ -0,0 +1,52 @@ +package com.awspaas.user.apps.integration.util; + +import org.apache.http.HttpEntity; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; + +import java.nio.charset.Charset; + +/** + * @PackageName: com.awspaas.user.apps.yili.integration.util + * @ClassName: UtilUrl + * @author: yujh + * @date: 2022/5/18 21:41 + */ +public class UtilUrls { + + //使用SOAP1.1发送消息 + public static String doPostSoap(String postUrl, String soapXml, String soapAction) { + String retStr = ""; + // 创建HttpClientBuilder + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.build(); + HttpPost httpPost = new HttpPost(postUrl); + // 设置请求和传输超时时间 + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(999999999) + .setConnectTimeout(999999999).build(); + httpPost.setConfig(requestConfig); + try { + httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8"); + httpPost.setHeader("SOAPAction", soapAction); + StringEntity data = new StringEntity(soapXml, Charset.forName("UTF-8")); + httpPost.setEntity(data); + CloseableHttpResponse response = closeableHttpClient.execute(httpPost); + HttpEntity httpEntity = response.getEntity(); + if (httpEntity != null) { + // 打印响应内容 + retStr = EntityUtils.toString(httpEntity, "UTF-8"); + } + // 释放资源 + closeableHttpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return retStr; + } +} diff --git a/com.awspaas.user.apps.yili.reportform/.classpath b/com.awspaas.user.apps.yili.reportform/.classpath new file mode 100644 index 00000000..52da4050 --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/com.awspaas.user.apps.yili.reportform/.project b/com.awspaas.user.apps.yili.reportform/.project new file mode 100644 index 00000000..6de2be43 --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/.project @@ -0,0 +1,17 @@ + + + com.awspaas.user.apps.yili.reportform + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java index 4165feb6..14628613 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/AttrSynController.java @@ -48,7 +48,7 @@ public class AttrSynController { System.err.println("=====fromSessionId======="+fromSessionId); JSONObject result = new JSONObject(); Map claims = new HashMap<> (); - claims.put("userName","10036614"); + claims.put("userName",fromSessionId.getUID()); //生成token String jwt_token = JwtUtils.getAccessToken ("userId",claims); System.out.println ("jwt_token="+jwt_token); diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java index a1409abf..2771866c 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/controller/DataViewController.java @@ -4,13 +4,8 @@ import com.actionsoft.bpms.server.RequestParams; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; -import com.actionsoft.bpms.util.DBSql; import com.actionsoft.sdk.local.SDK; import com.awspaas.user.apps.yili.reportform.service.DataViewService; -import com.awspaas.user.apps.yili.reportform.service.DataViewService2; -import com.awspaas.user.apps.yili.reportform.service.ToPageService; - -import java.sql.Connection; /** * @author:Lizj @@ -45,14 +40,11 @@ public class DataViewController { @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.DataViewService_personalView", desc = "个人视图") public String personalView(UserContext uc, RequestParams params) { - String personalViewVal = null; - try { - personalViewVal = new DataViewService(uc).personalView(uc, params); - } catch (Exception e) { - SDK.getLogAPI().consoleErr("personalView异常"); - } - return personalViewVal; + return new DataViewService(uc).personalView(uc, params); } + + + @Mapping(value = "com.awspaas.user.apps.yili.reportform.service.DataViewService_queryTermsDept", desc = "筛选条件:当前用户部门、部门") public String queryTermsDept(UserContext uc, RequestParams params) { diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java index 72e8accd..7d8c94ea 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData.java @@ -436,6 +436,7 @@ public class SyncData implements IJob { SDK.getLogAPI().consoleInfo("获取节点属性过程中,"+"文件ID:"+FILEID+"获取节点形状属性异常"); } } + //同步角色岗位 if (null != nodeElements && !nodeElements.isEmpty()) { for (Map nodeElement : nodeElements) { String NODETYPE = String.valueOf(nodeElement.get("type")); diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData2.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData2.java new file mode 100644 index 00000000..4a3fa79e --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData2.java @@ -0,0 +1,676 @@ +package com.awspaas.user.apps.yili.reportform.job; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.bpms.api.Utils; +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.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.yili.reportform.util.CheckUtil; +import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil; +import com.awspaas.user.apps.yili.reportform.util.RepositoryAttribute; + +/** + * @author:Lizj + * @create: 2022-07-05 15:58 + * @Description: 定时同步数据 + */ +@DisallowConcurrentExecution +public class SyncData2 implements IJob { + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + + SDK.getLogAPI().consoleInfo("全量定时同步文件信息开始执行"); + long startTime = System.currentTimeMillis(); + Date nowDateJ = new Date(System.currentTimeMillis()); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String format = sdf2.format(nowDateJ); + SDK.getLogAPI().consoleInfo("开始时间" + format); + + String wsId = SDK.getJobAPI().getJobParameter(jobExecutionContext); + + //总文件集合 + String process = "process"; + String org = "org"; + String data = "data"; + String itsystem = "itsystem"; + String control = "control"; + List palProcessList = new ArrayList<>(); + Set palProcessIds = new HashSet<>(); + List palOrgList = new ArrayList<>(); + Set palOrgIds = new HashSet<>(); + List palDataList = new ArrayList<>(); + Set palDataIds = new HashSet<>(); + List palItsystemList = new ArrayList<>(); + Set palItsystemIds = new HashSet<>(); + List palControlList = new ArrayList<>(); + Set palControlIds = new HashSet<>(); + PALRepositoryCache.getAllChildrenModelsByPid(wsId, process, palProcessList, palProcessIds); + PALRepositoryCache.getAllChildrenModelsByPid(wsId, org, palOrgList, palOrgIds); + PALRepositoryCache.getAllChildrenModelsByPid(wsId, data, palDataList, palDataIds); + PALRepositoryCache.getAllChildrenModelsByPid(wsId, itsystem, palItsystemList, palItsystemIds); + PALRepositoryCache.getAllChildrenModelsByPid(wsId, control, palControlList, palControlIds); + //合并为文件总量list + List palTotalList = new ArrayList<>(); + palTotalList.addAll(palProcessList); + palTotalList.addAll(palOrgList); + palTotalList.addAll(palDataList); + palTotalList.addAll(palItsystemList); + palTotalList.addAll(palControlList); + SDK.getLogAPI().consoleInfo("process下文件数量:" + palProcessList.size()); + SDK.getLogAPI().consoleInfo("org下文件数量:" + palOrgList.size()); + SDK.getLogAPI().consoleInfo("data下文件数量:" + palDataList.size()); + SDK.getLogAPI().consoleInfo("itsystem下文件数量:" + palItsystemList.size()); + SDK.getLogAPI().consoleInfo("control下文件数量:" + palControlList.size()); + SDK.getLogAPI().consoleInfo("文件总数量:" + palTotalList.size()); + //过滤出角色文件 +/* List palRoleFileList = palOrgList.stream().filter(x -> x.getMethodId().equals("org.role")).collect(Collectors.toList()); + SDK.getLogAPI().consoleInfo("角色文件数量:" + palRoleFileList.size());*/ + + //初始化架构、文件、节点 old/new/del/fromDataID/dis list + ArrayList> oldFrameDataMaps = new ArrayList<>(); + ArrayList> newFrameDataMaps = new ArrayList<>(); + ArrayList> delFrameDataMaps = new ArrayList<>(); + ArrayList fromFrameDataIDMaps = new ArrayList<>(); + ArrayList> oldFileDataMaps = new ArrayList<>(); + ArrayList> newFileDataMaps = new ArrayList<>(); + ArrayList> delFileDataMaps = new ArrayList<>(); + ArrayList fromFileDataIDMaps = new ArrayList<>(); + ArrayList> oldNodeDataMaps = new ArrayList<>(); + ArrayList> newNodeDataMaps = new ArrayList<>(); + ArrayList> delNodeDataMaps = new ArrayList<>(); + ArrayList fromNodeDataIDMaps = new ArrayList<>(); + HashMap dataMap = new HashMap<>(); + Object[] sqlParams = new Object[]{}; + //获取底表数据 + List frameIdList = DBSql.getList("SELECT FRAMEID FROM BO_EU_PAL_FRAME", String.class); + SDK.getLogAPI().consoleInfo("架构底表长度:" + frameIdList.size()); + List fileIdList = DBSql.getList("SELECT FILEID FROM BO_EU_PAL_FILE1", String.class); + SDK.getLogAPI().consoleInfo("文件底表长度:" + fileIdList.size()); + List nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE5", String.class); + SDK.getLogAPI().consoleInfo("节点底表长度:" + nodeIdList.size()); + //系统字段 + String uuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); + //遍历总文件集合 + for (PALRepositoryModel fileModel : palTotalList) { + List> nodeElements = new ArrayList<>(); + String PLMETHODID = fileModel.getMethodId(); + String FILEID = fileModel.getId(); + String PLNAME = fileModel.getName(); + String plRid = fileModel.getPlRid(); + String sql = "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '"+plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; + String palId = DBSql.getString(sql); + if(UtilString.isNotEmpty(palId)) { + if(!FILEID.equals(palId)) { + SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id:"+FILEID); + String dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'"; + DBSql.update(dsql); + continue; + } + } + Timestamp MODIFYDATETIME = fileModel.getModifyDate(); + if (PLMETHODID.equals("process.framework")) { + //更新/新增架构 + Integer FRAMELEVEL = fileModel.getLevel(); + String FRAMETYPE = null; + String FRAMEPARENTID = fileModel.getParentId(); + Integer FRAMEORDERINDEX = fileModel.getOrderIndex(); + Map frameAttrs = new HashMap<>(); + try { + frameAttrs = new RepositoryAttribute().queryRepositoryAttributeById(FILEID); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("更新架构时文件ID" + FILEID + "数据异常"); + } + if (null != frameAttrs && !frameAttrs.isEmpty()) { + JSONObject Frame_type = frameAttrs.get("Frame_type"); + FRAMETYPE = Frame_type.getString("text"); + } + + fromFrameDataIDMaps.add(FILEID); + + if (frameIdList.contains(FILEID)) { + dataMap = new HashMap<>(); + nowDateJ = new Date(System.currentTimeMillis()); + Timestamp nowDateTime = new Timestamp(nowDateJ.getTime()); + dataMap.put("FRAMEID", FILEID); + dataMap.put("UPDATEDATE", nowDateTime); + dataMap.put("FRAMENAME", PLNAME); + dataMap.put("FRAMELEVEL", FRAMELEVEL); + dataMap.put("FRAMETYPE", FRAMETYPE); + dataMap.put("FRAMEPARENTID", FRAMEPARENTID); + dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + oldFrameDataMaps.add(dataMap); + } else { + dataMap = new HashMap<>(); + uuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + dataMap.put("uuId", uuId); + dataMap.put("FRAMEID", FILEID); + dataMap.put("FRAMENAME", PLNAME); + dataMap.put("FRAMELEVEL", FRAMELEVEL); + dataMap.put("FRAMETYPE", FRAMETYPE); + dataMap.put("FRAMEPARENTID", FRAMEPARENTID); + dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + newFrameDataMaps.add(dataMap); + } + } else { + //更新/新增文件 + Integer PLLEVEL = fileModel.getLevel(); + String PLPARENTID = fileModel.getParentId(); + Integer PLORDERINDEX = fileModel.getOrderIndex(); + String PLCATEGORY = fileModel.getMethodCategory(); + String CREATEPER = fileModel.getCreateUser(); + String MODIFYPER = fileModel.getModifyUser(); + Timestamp CREATEDATETIME = fileModel.getCreateDate(); + double FILEVERSION = fileModel.getVersion(); + String PUBDEPT = ""; + String PUBDATETIME = ""; + String FILESTATE = ""; + String FILEUSESTATE = ""; + Long VIEWCOUNT = fileModel.getViewCount(); + String L1ID = ""; + String L2ID = ""; + String L3ID = ""; + String LEADPROCESS = ""; + String REARPROCESS = ""; + String PROCESSKPI = ""; + String RELEVANTFILE = ""; + String SUPPORTFILE = ""; + String POLICYTYPE = ""; + List parentMaps = new ArrayList<>(); + if (null != PLPARENTID && !PLPARENTID.equals("")) { + parentMaps = GetNodesUtil.getParentFrame(PLPARENTID, parentMaps); + } + if (null != parentMaps && !parentMaps.isEmpty()) { + for (RowMap parentMap : parentMaps) { + Integer parentLevel = parentMap.getInt("FRAMELEVEL"); + String parentID = parentMap.getString("FRAMEID"); + if (parentLevel.equals(3)) { + L3ID = parentID; + } + if (parentLevel.equals(2)) { + L2ID = parentID; + } + if (parentLevel.equals(1)) { + L1ID = parentID; + } + } + } + //文件状态 + FILESTATE = "0"; + if (fileModel.isPublish() == true) { + FILESTATE = "1"; + } + if (fileModel.isApproval() == true) { + FILESTATE = "2"; + } + if (fileModel.isStop() == true) { + FILESTATE = "3"; + } + + //文件生效状态 + if (fileModel.isUse() == true) { + FILEUSESTATE = "1"; + } else { + FILEUSESTATE = "0"; + } + + + Map fileAttrJsonMap = new HashMap<>(); + try { + fileAttrJsonMap = new RepositoryAttribute().queryRepositoryAttributeById(FILEID); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("更新文件时文件ID" + FILEID + "数据异常"); + } + if (null != fileAttrJsonMap && !fileAttrJsonMap.isEmpty()) { + //发布部门 + JSONObject Issuing_department = fileAttrJsonMap.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)); + PUBDEPT = PUBDEPT + " " + PUBDEPTJO.getString("id"); + } + PUBDEPT = PUBDEPT.substring(1); + } + } + //发布时间 + PUBDATETIME = ""; + JSONObject effective_date = fileAttrJsonMap.get("Drafted_and_revised_date"); + if (null != effective_date && !effective_date.equals("")) { + String pubDateString = effective_date.getString("text"); + if (null != pubDateString && !pubDateString.equals("")) { + if (CheckUtil.isDate(pubDateString)) { + Date parse = null; + try { + parse = sdf1.parse(pubDateString); + } catch (ParseException e) { + e.printStackTrace(); + } + PUBDATETIME = sdf1.format(parse); + } + } + } + //前置流程 + if (PLMETHODID.equals("process.epc")) { + JSONObject lead_process = fileAttrJsonMap.get("lead_process"); + if (null != lead_process && !lead_process.equals("")) { + JSONArray lpValue = lead_process.getJSONArray("value"); + if (null != lpValue && !lpValue.isEmpty()) { + LEADPROCESS = "1"; + } else { + LEADPROCESS = "0"; + } + } else { + LEADPROCESS = "0"; + } + //后置流程 + JSONObject rear_process = fileAttrJsonMap.get("rear_process"); + if (null != rear_process && !rear_process.equals("")) { + JSONArray rpValue = rear_process.getJSONArray("value"); + if (null != rpValue && !rpValue.isEmpty()) { + REARPROCESS = "1"; + } else { + REARPROCESS = "0"; + } + } else { + REARPROCESS = "0"; + } + } + //流程绩效 + JSONObject performance = fileAttrJsonMap.get("Process_performance_metrics"); + if (null != performance && !performance.equals("")) { + JSONArray performanceJA = performance.getJSONArray("value"); + if (null != performanceJA && !performanceJA.isEmpty()) { + for (Object performanceO : performanceJA) { + JSONObject performanceJO = JSONObject.parseObject(String.valueOf(performanceO)); + PROCESSKPI = PROCESSKPI + " " + performanceJO.getString("fileId"); + } + PROCESSKPI = PROCESSKPI.substring(1); + } + } + //相关文件 + JSONObject R_relevant_flies = fileAttrJsonMap.get("R_relevant_flies"); + if (null != R_relevant_flies && !R_relevant_flies.equals("")) { + JSONArray RELEVANTFILEJA = R_relevant_flies.getJSONArray("value"); + if (null != RELEVANTFILEJA && !RELEVANTFILEJA.isEmpty()) { + for (Object RELEVANTFILEO : RELEVANTFILEJA) { + JSONObject RELEVANTFILEJO = JSONObject.parseObject(String.valueOf(RELEVANTFILEO)); + RELEVANTFILE = RELEVANTFILE + " " + RELEVANTFILEJO.getString("fileId"); + } + RELEVANTFILE = RELEVANTFILE.substring(1); + } + } + //支持文件 + JSONObject support_files = fileAttrJsonMap.get("support_files"); + if (null != support_files && !support_files.equals("")) { + JSONArray SUPPORTFILEJA = support_files.getJSONArray("value"); + if (null != SUPPORTFILEJA && !SUPPORTFILEJA.isEmpty()) { + for (Object SUPPORTFILEO : SUPPORTFILEJA) { + JSONObject SUPPORTFILEJO = JSONObject.parseObject(String.valueOf(SUPPORTFILEO)); + SUPPORTFILE = SUPPORTFILE + " " + SUPPORTFILEJO.getString("fileId"); + } + SUPPORTFILE = SUPPORTFILE.substring(1); + } + } + } + //制度类型 + nodeElements = new ArrayList<>(); + if (PLMETHODID.equals("control.policy")) { + try { + nodeElements = CoeDesignerUtil.getShapeMessageJson4(FILEID); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取制度类型过程中," + "文件ID:" + FILEID + "获取节点形状属性异常"); + } + } + if (null != nodeElements && !nodeElements.isEmpty()) { + for (Map nodeElement : nodeElements) { + String NODETYPE = String.valueOf(nodeElement.get("type")); + if (NODETYPE.equals("regulation")) { + POLICYTYPE = "regulation"; + } else if (NODETYPE.equals("I/O_L4")) { + POLICYTYPE = "I/O_L4"; + } + } + } + + + fromFileDataIDMaps.add(FILEID); + + if (fileIdList.contains(FILEID)) { + dataMap = new HashMap<>(); + nowDateJ = new Date(System.currentTimeMillis()); + Timestamp nowDateTime = new Timestamp(nowDateJ.getTime()); + dataMap.put("FILEID", FILEID); + dataMap.put("UPDATEDATE", nowDateTime); + dataMap.put("PLNAME", PLNAME); + dataMap.put("PLLEVEL", PLLEVEL); + dataMap.put("PLPARENTID", PLPARENTID); + dataMap.put("PLORDERINDEX", PLORDERINDEX); + dataMap.put("PLCATEGORY", PLCATEGORY); + dataMap.put("PLMETHODID", PLMETHODID); + dataMap.put("FILEVERSION", FILEVERSION); + dataMap.put("CREATEPER", CREATEPER); + dataMap.put("MODIFYPER", MODIFYPER); + dataMap.put("CREATEDATETIME", CREATEDATETIME); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + dataMap.put("PUBDEPT", PUBDEPT); + dataMap.put("PUBDATETIME", PUBDATETIME); + dataMap.put("FILESTATE", FILESTATE); + dataMap.put("FILEUSESTATE", FILEUSESTATE); + dataMap.put("VIEWCOUNT", VIEWCOUNT); + dataMap.put("L1ID", L1ID); + dataMap.put("L2ID", L2ID); + dataMap.put("L3ID", L3ID); + dataMap.put("LEADPROCESS", LEADPROCESS); + dataMap.put("REARPROCESS", REARPROCESS); + dataMap.put("PROCESSKPI", PROCESSKPI); + dataMap.put("RELEVANTFILE", RELEVANTFILE); + dataMap.put("SUPPORTFILE", SUPPORTFILE); + dataMap.put("POLICYTYPE", POLICYTYPE); + oldFileDataMaps.add(dataMap); + } else { + dataMap = new HashMap<>(); + uuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + dataMap.put("uuId", uuId); + dataMap.put("FILEID", FILEID); + dataMap.put("PLNAME", PLNAME); + dataMap.put("PLLEVEL", PLLEVEL); + dataMap.put("PLPARENTID", PLPARENTID); + dataMap.put("PLORDERINDEX", PLORDERINDEX); + dataMap.put("PLCATEGORY", PLCATEGORY); + dataMap.put("PLMETHODID", PLMETHODID); + dataMap.put("FILEVERSION", FILEVERSION); + dataMap.put("CREATEPER", CREATEPER); + dataMap.put("MODIFYPER", MODIFYPER); + dataMap.put("CREATEDATETIME", CREATEDATETIME); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + dataMap.put("PUBDEPT", PUBDEPT); + dataMap.put("PUBDATETIME", PUBDATETIME); + dataMap.put("FILESTATE", FILESTATE); + dataMap.put("FILEUSESTATE", FILEUSESTATE); + dataMap.put("VIEWCOUNT", VIEWCOUNT); + dataMap.put("L1ID", L1ID); + dataMap.put("L2ID", L2ID); + dataMap.put("L3ID", L3ID); + dataMap.put("LEADPROCESS", LEADPROCESS); + dataMap.put("REARPROCESS", REARPROCESS); + dataMap.put("PROCESSKPI", PROCESSKPI); + dataMap.put("RELEVANTFILE", RELEVANTFILE); + dataMap.put("SUPPORTFILE", SUPPORTFILE); + dataMap.put("POLICYTYPE", POLICYTYPE); + newFileDataMaps.add(dataMap); + } + + //更新/新增节点 + nodeElements = new ArrayList<>(); + if(PLMETHODID.equals("process.epc")) { + try { + nodeElements = CoeDesignerUtil.getShapeMessageJson4(FILEID); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取节点属性过程中,"+"文件ID:"+FILEID+"获取节点形状属性异常"); + } + } + if (null != nodeElements && !nodeElements.isEmpty()) { + for (Map nodeElement : nodeElements) { + String NODETYPE = String.valueOf(nodeElement.get("type")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + //节点信息 + String NODEID = String.valueOf(nodeElement.get("id")); + String NODENAME = String.valueOf(nodeElement.get("name")); + //形状属性数组 + JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes"))); + //形状属性:信息系统、活动序号、活动描述、角色、岗位 + String ITSYSVAL = ""; + String ACTIVITYNUMBER = ""; + String ACTIVITYDESC = ""; + String ROLE = ""; + String ROLENAME = ""; + String POST = ""; + String POSTNAME = ""; + if (null != attributesArray && !attributesArray.isEmpty()) { + for (Object attribute : attributesArray) { + JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute)); + String SHAPEATTRKEY = attributeJO.getString("key"); + if (SHAPEATTRKEY.equals("information_systems")) { + ITSYSVAL = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("activity_number")) { + ACTIVITYNUMBER = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("activity_description")) { + ACTIVITYDESC = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("role")) { + String nodeRoleText = attributeJO.getString("value"); + ROLE = nodeRoleText; + if (null!=ROLE && !ROLE.equals("")) { + sqlParams = new Object[]{FILEID}; + List roleFileRowMaps = new ArrayList<>(); + try { + roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID=? AND ATTRID='role'", sqlParams); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件ID:"+FILEID+"节点ID:"+NODEID+"异常"); + } + if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) { + for (RowMap roleFileRowMap : roleFileRowMaps) { + String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID"); + //角色文件属性 + List> roleShapes = new ArrayList<>(); + try { + roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID); + } catch (Exception e) { + + //SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常"); + } + if (null != roleShapes && !roleShapes.isEmpty()) { + for (Map roleShape : roleShapes) { + String roleFileNodeName = String.valueOf(roleShape.get("name")); + if (nodeRoleText.contains(roleFileNodeName)) { + //角色节点形状属性 + JSONArray roleShapeJA = null; + try { + roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes"))); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID:"+RELATIONFILEID+"异常"); + } + if (null != roleShapeJA && !roleShapeJA.isEmpty()) { + for (Object roleShapeO : roleShapeJA) { + JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO)); + String roleShapeKey = roleShapeJO.getString("key"); + if (roleShapeKey.equals("post")) { + //SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value")); + POST = roleShapeJO.getString("value"); + } + if (roleShapeKey.equals("post_text")) { + //SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO); + ROLENAME = roleShapeJO.getString("value"); + POSTNAME = roleShapeJO.getString("value"); + } + } + } + } + } + } + } + } + } else { + for (Object attribute1 : attributesArray) { + JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1)); + String SHAPEATTRKEY1 = attributeJO1.getString("key"); + if (SHAPEATTRKEY1.equals("post")) { + POST = attributeJO1.getString("value"); + } + if (SHAPEATTRKEY1.equals("post_text")) { + POSTNAME = attributeJO1.getString("value"); + } + } + } + } + } + } + + fromNodeDataIDMaps.add(NODEID); + + if (nodeIdList.contains(NODEID)) { + dataMap = new HashMap<>(); + nowDateJ = new Date(System.currentTimeMillis()); + Timestamp nowDateTime = new Timestamp(nowDateJ.getTime()); + dataMap.put("UPDATEDATE", nowDateTime); + dataMap.put("NODENAME", NODENAME); + dataMap.put("NODETYPE", NODETYPE); + dataMap.put("PLNAME", PLNAME); + dataMap.put("NODECATEGORY", PLMETHODID); + dataMap.put("ITSYSVAL", ITSYSVAL); + dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER); + dataMap.put("ACTIVITYDESC", ACTIVITYDESC); + dataMap.put("ROLE", ROLE); + dataMap.put("ROLENAME", ROLENAME); + dataMap.put("POST", POST); + dataMap.put("POSTNAME", POSTNAME); + dataMap.put("PLID", FILEID); + dataMap.put("NODEID", NODEID); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + oldNodeDataMaps.add(dataMap); + } else { + dataMap = new HashMap<>(); + uuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + dataMap.put("uuId", uuId); + dataMap.put("NODEID", NODEID); + dataMap.put("NODENAME", NODENAME); + dataMap.put("NODETYPE", NODETYPE); + dataMap.put("PLID", FILEID); + dataMap.put("PLNAME", PLNAME); + dataMap.put("NODECATEGORY", PLMETHODID); + dataMap.put("ITSYSVAL", ITSYSVAL); + dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER); + dataMap.put("ACTIVITYDESC", ACTIVITYDESC); + dataMap.put("ROLE", ROLE); + dataMap.put("POST", POST); + dataMap.put("ROLENAME", ROLENAME); + dataMap.put("POSTNAME", POSTNAME); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + newNodeDataMaps.add(dataMap); + } + } + } + } + } + } + + //执行批量新增、修改、删除 + if (null != frameIdList && !frameIdList.isEmpty()) { + for (String frameIdOfList : frameIdList) { + if (!fromFrameDataIDMaps.contains(frameIdOfList)) { + dataMap = new HashMap<>(); + dataMap.put("FRAMEID", frameIdOfList); + delFrameDataMaps.add(dataMap); + } + } + } + if (null != oldFrameDataMaps && !oldFrameDataMaps.isEmpty()) { + DBSql.batchUpdate("UPDATE BO_EU_PAL_FRAME SET" + + " FRAMENAME=:FRAMENAME, FRAMELEVEL=:FRAMELEVEL, FRAMETYPE=:FRAMETYPE, FRAMEPARENTID=:FRAMEPARENTID, FRAMEORDERINDEX=:FRAMEORDERINDEX, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE WHERE FRAMEID=:FRAMEID", oldFrameDataMaps); + } + if (null != newFrameDataMaps && !newFrameDataMaps.isEmpty()) { + DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FRAME(ID,FRAMEID,FRAMENAME,FRAMELEVEL,FRAMETYPE,FRAMEPARENTID,FRAMEORDERINDEX,MODIFYDATETIME) " + + " VALUES(:uuId, :FRAMEID, :FRAMENAME, :FRAMELEVEL, :FRAMETYPE, :FRAMEPARENTID, :FRAMEORDERINDEX, :MODIFYDATETIME)", newFrameDataMaps); + } + if (null != delFrameDataMaps && !delFrameDataMaps.isEmpty()) { + DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FRAME WHERE FRAMEID=:FRAMEID", delFrameDataMaps); + } + SDK.getLogAPI().consoleInfo("新增架构" + newFrameDataMaps.size()); + SDK.getLogAPI().consoleInfo("修改架构" + oldFrameDataMaps.size()); + SDK.getLogAPI().consoleInfo("删除架构" + delFrameDataMaps.size()); + + if (null != fileIdList && !fileIdList.isEmpty()) { + for (String fileIdOfList : fileIdList) { + if (!fromFileDataIDMaps.contains(fileIdOfList)) { + dataMap = new HashMap<>(); + dataMap.put("FILEID", fileIdOfList); + delFileDataMaps.add(dataMap); + } + } + } + if (null != oldFileDataMaps && !oldFileDataMaps.isEmpty()) { + DBSql.batchUpdate("UPDATE BO_EU_PAL_FILE1 SET" + + " PLNAME=:PLNAME, PLLEVEL=:PLLEVEL, PLPARENTID=:PLPARENTID, PLORDERINDEX=:PLORDERINDEX, PLCATEGORY=:PLCATEGORY, " + + " PLMETHODID=:PLMETHODID, FILEVERSION=:FILEVERSION, CREATEPER=:CREATEPER, MODIFYPER=:MODIFYPER, " + + " PUBDEPT=:PUBDEPT, PUBDATETIME=:PUBDATETIME, FILESTATE=:FILESTATE, VIEWCOUNT=:VIEWCOUNT, L1ID=:L1ID, " + + " L2ID=:L2ID, L3ID=:L3ID, LEADPROCESS=:LEADPROCESS, REARPROCESS=:REARPROCESS, PROCESSKPI=:PROCESSKPI, " + + " RELEVANTFILE=:RELEVANTFILE, SUPPORTFILE=:SUPPORTFILE, POLICYTYPE=:POLICYTYPE, " + + " CREATEDATETIME=:CREATEDATETIME, MODIFYDATETIME=:MODIFYDATETIME, FILEUSESTATE=:FILEUSESTATE, UPDATEDATE=:UPDATEDATE " + + " WHERE FILEID=:FILEID", oldFileDataMaps); + } + if (null != newFileDataMaps && !newFileDataMaps.isEmpty()) { + DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILE1" + + " (ID, FILEID, PLNAME, PLLEVEL, PLPARENTID, PLORDERINDEX, PLCATEGORY, PLMETHODID, FILEVERSION, CREATEPER, MODIFYPER, PUBDEPT, PUBDATETIME, " + + " FILESTATE, VIEWCOUNT, L1ID, L2ID, L3ID, LEADPROCESS, REARPROCESS, PROCESSKPI, RELEVANTFILE, SUPPORTFILE, POLICYTYPE, FILEUSESTATE, CREATEDATETIME, MODIFYDATETIME ) " + + " VALUES(:uuId, :FILEID, :PLNAME, :PLLEVEL, :PLPARENTID, :PLORDERINDEX, :PLCATEGORY, :PLMETHODID, " + + " :FILEVERSION, :CREATEPER, :MODIFYPER, :PUBDEPT, :PUBDATETIME, :FILESTATE, :VIEWCOUNT, :L1ID, :L2ID, " + + " :L3ID, :LEADPROCESS, :REARPROCESS, :PROCESSKPI, :RELEVANTFILE, :SUPPORTFILE, :POLICYTYPE, :FILEUSESTATE, :CREATEDATETIME, :MODIFYDATETIME)", newFileDataMaps); + } + if (null != delFileDataMaps && !delFileDataMaps.isEmpty()) { + DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID=:FILEID", delFileDataMaps); + } + SDK.getLogAPI().consoleInfo("新增文件" + newFileDataMaps.size()); + SDK.getLogAPI().consoleInfo("修改文件" + oldFileDataMaps.size()); + SDK.getLogAPI().consoleInfo("删除文件" + delFileDataMaps.size()); + + if (null != nodeIdList && !nodeIdList.isEmpty()) { + for (String nodeIdOfList : nodeIdList) { + if (!fromNodeDataIDMaps.contains(nodeIdOfList)) { + dataMap = new HashMap<>(); + dataMap.put("NODEID", nodeIdOfList); + delNodeDataMaps.add(dataMap); + } + } + } + if (null != oldNodeDataMaps && !oldNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("UPDATE BO_EU_PAL_FILENODE5 SET" + + " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, " + + " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE " + + " WHERE PLID=:PLID AND NODEID=:NODEID", oldNodeDataMaps); + } + if (null != newNodeDataMaps && !newNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILENODE5" + + " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) " + + " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", newNodeDataMaps); + } + if (null != delNodeDataMaps && !delNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILENODE5 WHERE NODEID=:NODEID", delNodeDataMaps); + } + SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size()); + SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size()); + SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size()); + + long endTime = System.currentTimeMillis(); + SDK.getLogAPI().consoleInfo("结束时间" + endTime); + SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime)); + } +} diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job.java new file mode 100644 index 00000000..27d85887 --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job.java @@ -0,0 +1,246 @@ +package com.awspaas.user.apps.yili.reportform.job; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil; +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.sdk.local.SDK; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +/** + * @author:lihongyu + * @create: 2022-11-03 11:32 + * @Description: 全量同步文件 + */ +@DisallowConcurrentExecution +public class SyncData_job implements IJob { + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + syncNodeData(); + + } + //同步节点数据到 BO_EU_PAL_FILENODE6 + public void syncNodeData() { + HashMap dataMap = new HashMap<>(); + ArrayList fromNodeDataIDMaps = new ArrayList<>(); + List palTotalList = new ArrayList<>(); + ArrayList> oldNodeDataMaps = new ArrayList<>(); + ArrayList> newNodeDataMaps = new ArrayList<>(); + ArrayList> delNodeDataMaps = new ArrayList<>(); + long startTime = System.currentTimeMillis(); + List nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE6", String.class); + for (PALRepositoryModel fileModel : palTotalList) { + List> nodeElements = new ArrayList<>(); + String PLMETHODID = fileModel.getMethodId(); + String FILEID = fileModel.getId(); + String PLNAME = fileModel.getName(); + String plRid = fileModel.getPlRid(); + /* + * String sql = + * "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '" + * +plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; String + * palId = DBSql.getString(sql); if(UtilString.isNotEmpty(palId)) { + * if(!FILEID.equals(palId)) { + * SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id:"+FILEID); String + * dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'"; + * DBSql.update(dsql); continue; } } + */ + Timestamp MODIFYDATETIME = fileModel.getModifyDate(); + //同步角色岗位 + if (null != nodeElements && !nodeElements.isEmpty()) { + for (Map nodeElement : nodeElements) { + String NODETYPE = String.valueOf(nodeElement.get("type")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + //节点信息 + String NODEID = String.valueOf(nodeElement.get("id")); + String NODENAME = String.valueOf(nodeElement.get("name")); + //形状属性数组 + JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes"))); + //形状属性:信息系统、活动序号、活动描述、角色、岗位 + String ITSYSVAL = ""; + String ACTIVITYNUMBER = ""; + String ACTIVITYDESC = ""; + String ROLE = ""; + String ROLENAME = ""; + String POST = ""; + String POSTNAME = ""; + if (null != attributesArray && !attributesArray.isEmpty()) { + for (Object attribute : attributesArray) { + JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute)); + String SHAPEATTRKEY = attributeJO.getString("key"); + if (SHAPEATTRKEY.equals("information_systems")) { + ITSYSVAL = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("activity_number")) { + ACTIVITYNUMBER = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("activity_description")) { + ACTIVITYDESC = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("role")) { + String nodeRoleText = attributeJO.getString("value"); + ROLE = nodeRoleText; + if (null!=ROLE && !ROLE.equals("")) { + Object sqlParams = new Object[]{FILEID}; + List roleFileRowMaps = new ArrayList<>(); + try { + roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID=? AND ATTRID='role'", sqlParams); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件ID:"+FILEID+"节点ID:"+NODEID+"异常"); + } + if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) { + for (RowMap roleFileRowMap : roleFileRowMaps) { + String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID"); + //角色文件属性 + List> roleShapes = new ArrayList<>(); + try { + roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID); + } catch (Exception e) { + + //SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常"); + } + if (null != roleShapes && !roleShapes.isEmpty()) { + for (Map roleShape : roleShapes) { + String roleFileNodeName = String.valueOf(roleShape.get("name")); + if (nodeRoleText.contains(roleFileNodeName)) { + //角色节点形状属性 + JSONArray roleShapeJA = null; + try { + roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes"))); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID:"+RELATIONFILEID+"异常"); + } + if (null != roleShapeJA && !roleShapeJA.isEmpty()) { + for (Object roleShapeO : roleShapeJA) { + JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO)); + String roleShapeKey = roleShapeJO.getString("key"); + if (roleShapeKey.equals("post")) { + //SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value")); + POST = roleShapeJO.getString("value"); + } + if (roleShapeKey.equals("post_text")) { + //SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO); + ROLENAME = roleShapeJO.getString("value"); + POSTNAME = roleShapeJO.getString("value"); + } + } + } + } + } + } + } + } + } else { + for (Object attribute1 : attributesArray) { + JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1)); + String SHAPEATTRKEY1 = attributeJO1.getString("key"); + if (SHAPEATTRKEY1.equals("post")) { + POST = attributeJO1.getString("value"); + } + if (SHAPEATTRKEY1.equals("post_text")) { + POSTNAME = attributeJO1.getString("value"); + } + } + } + } + } + } + + fromNodeDataIDMaps.add(NODEID); + + if (nodeIdList.contains(NODEID)) { + dataMap = new HashMap<>(); + Date nowDateJ = new Date(System.currentTimeMillis()); + Timestamp nowDateTime = new Timestamp(nowDateJ.getTime()); + dataMap.put("UPDATEDATE", nowDateTime); + dataMap.put("NODENAME", NODENAME); + dataMap.put("NODETYPE", NODETYPE); + dataMap.put("PLNAME", PLNAME); + dataMap.put("NODECATEGORY", PLMETHODID); + dataMap.put("ITSYSVAL", ITSYSVAL); + dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER); + dataMap.put("ACTIVITYDESC", ACTIVITYDESC); + dataMap.put("ROLE", ROLE); + dataMap.put("ROLENAME", ROLENAME); + dataMap.put("POST", POST); + dataMap.put("POSTNAME", POSTNAME); + dataMap.put("PLID", FILEID); + dataMap.put("NODEID", NODEID); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + System.err.println("更新节点信息===========>"+dataMap); + oldNodeDataMaps.add(dataMap); + } else { + dataMap = new HashMap<>(); + String uuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + dataMap.put("uuId", uuId); + dataMap.put("NODEID", NODEID); + dataMap.put("NODENAME", NODENAME); + dataMap.put("NODETYPE", NODETYPE); + dataMap.put("PLID", FILEID); + dataMap.put("PLNAME", PLNAME); + dataMap.put("NODECATEGORY", PLMETHODID); + dataMap.put("ITSYSVAL", ITSYSVAL); + dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER); + dataMap.put("ACTIVITYDESC", ACTIVITYDESC); + dataMap.put("ROLE", ROLE); + dataMap.put("POST", POST); + dataMap.put("ROLENAME", ROLENAME); + dataMap.put("POSTNAME", POSTNAME); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + System.err.println("同步节点信息===========>"+dataMap); + newNodeDataMaps.add(dataMap); + } + } + } + } + + } + + if (null != nodeIdList && !nodeIdList.isEmpty()) { + for (String nodeIdOfList : nodeIdList) { + if (!fromNodeDataIDMaps.contains(nodeIdOfList)) { + dataMap = new HashMap<>(); + dataMap.put("NODEID", nodeIdOfList); + delNodeDataMaps.add(dataMap); + } + } + } + if (null != oldNodeDataMaps && !oldNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("UPDATE BO_EU_PAL_FILENODE6 SET" + + " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, " + + " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE " + + " WHERE PLID=:PLID AND NODEID=:NODEID", oldNodeDataMaps); + } + if (null != newNodeDataMaps && !newNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILENODE6" + + " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) " + + " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", newNodeDataMaps); + } + if (null != delNodeDataMaps && !delNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILENODE6 WHERE NODEID=:NODEID", delNodeDataMaps); + } + SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size()); + SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size()); + SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size()); + + long endTime = System.currentTimeMillis(); + SDK.getLogAPI().consoleInfo("结束时间" + endTime); + SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime)); + } + +} diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job2.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job2.java new file mode 100644 index 00000000..9be8808e --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/job/SyncData_job2.java @@ -0,0 +1,312 @@ +package com.awspaas.user.apps.yili.reportform.job; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil; +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.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +/** + * @author:lihongyu + * @create: 2022-11-03 11:32 + * @Description: 全量同步文件 + */ +@DisallowConcurrentExecution +public class SyncData_job2 implements IJob { + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + + } + //同步节点数据到 BO_EU_PAL_FILENODE6 + public void syncNodeData() { + HashMap dataMap = new HashMap<>(); + ArrayList fromNodeDataIDMaps = new ArrayList<>(); + List palTotalList = new ArrayList<>(); + ArrayList> oldNodeDataMaps = new ArrayList<>(); + ArrayList> newNodeDataMaps = new ArrayList<>(); + ArrayList> delNodeDataMaps = new ArrayList<>(); + long startTime = System.currentTimeMillis(); + List nodeIdList = DBSql.getList("SELECT NODEID FROM BO_EU_PAL_FILENODE6", String.class); + for (PALRepositoryModel fileModel : palTotalList) { + List> nodeElements = new ArrayList<>(); + String PLMETHODID = fileModel.getMethodId(); + String FILEID = fileModel.getId(); + String PLNAME = fileModel.getName(); + String plRid = fileModel.getPlRid(); + String sql = "SELECT ID FROM (SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLRID = '"+plRid+"' AND ISPUBLISH ='1' ORDER BY PLVER DESC ) WHERE ROWNUM<2"; + String palId = DBSql.getString(sql); + if(UtilString.isNotEmpty(palId)) { + if(!FILEID.equals(palId)) { + SDK.getLogAPI().consoleInfo("同步数据发现旧版本文件名称:"+PLNAME+"——文件id:"+FILEID); + String dsql = "DELETE FROM BO_EU_PAL_FILE1 WHERE FILEID = '"+FILEID+"'"; + DBSql.update(dsql); + continue; + } + } + Timestamp MODIFYDATETIME = fileModel.getModifyDate(); + //同步角色岗位 + if (null != nodeElements && !nodeElements.isEmpty()) { + for (Map nodeElement : nodeElements) { + String NODETYPE = String.valueOf(nodeElement.get("type")); + if (NODETYPE.equals("method_approval_node") || NODETYPE.equals("method_service_node") || NODETYPE.equals("method_approval_node3") || NODETYPE.equals("method_service_node4")) { + //节点信息 + String NODEID = String.valueOf(nodeElement.get("id")); + String NODENAME = String.valueOf(nodeElement.get("name")); + //形状属性数组 + JSONArray attributesArray = JSON.parseArray(String.valueOf(nodeElement.get("attributes"))); + //形状属性:信息系统、活动序号、活动描述、角色、岗位 + String ITSYSVAL = ""; + String ACTIVITYNUMBER = ""; + String ACTIVITYDESC = ""; + String ROLE = ""; + String ROLENAME = ""; + String POST = ""; + String POSTNAME = ""; + if (null != attributesArray && !attributesArray.isEmpty()) { + for (Object attribute : attributesArray) { + JSONObject attributeJO = JSON.parseObject(String.valueOf(attribute)); + String SHAPEATTRKEY = attributeJO.getString("key"); + if (SHAPEATTRKEY.equals("information_systems")) { + ITSYSVAL = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("activity_number")) { + ACTIVITYNUMBER = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("activity_description")) { + ACTIVITYDESC = attributeJO.getString("value"); + } + if (SHAPEATTRKEY.equals("role")) { + String nodeRoleText = attributeJO.getString("value"); + ROLE = nodeRoleText; + if (null!=ROLE && !ROLE.equals("")) { + Object sqlParams = new Object[]{FILEID}; + List roleFileRowMaps = new ArrayList<>(); + try { + roleFileRowMaps = DBSql.getMaps("SELECT RELATIONFILEID FROM APP_ACT_COE_PAL_SHAPE_RLAT WHERE FILEID=? AND ATTRID='role'", sqlParams); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取流程节点角色属性关联文件时"+"文件ID:"+FILEID+"节点ID:"+NODEID+"异常"); + } + if (null!=roleFileRowMaps && !roleFileRowMaps.isEmpty()) { + for (RowMap roleFileRowMap : roleFileRowMaps) { + String RELATIONFILEID = roleFileRowMap.getString("RELATIONFILEID"); + //角色文件属性 + List> roleShapes = new ArrayList<>(); + try { + roleShapes = CoeDesignerUtil.getShapeMessageJson4(RELATIONFILEID); + } catch (Exception e) { + + //SDK.getLogAPI().consoleInfo("获取关联角色文件属性"+"文件ID:"+RELATIONFILEID+"异常"); + } + if (null != roleShapes && !roleShapes.isEmpty()) { + for (Map roleShape : roleShapes) { + String roleFileNodeName = String.valueOf(roleShape.get("name")); + if (nodeRoleText.contains(roleFileNodeName)) { + //角色节点形状属性 + JSONArray roleShapeJA = null; + try { + roleShapeJA = JSONArray.parseArray(String.valueOf(roleShape.get("attributes"))); + } catch (Exception e) { + SDK.getLogAPI().consoleInfo("获取角色节点形状属性jsonArray"+"文件ID:"+RELATIONFILEID+"异常"); + } + if (null != roleShapeJA && !roleShapeJA.isEmpty()) { + for (Object roleShapeO : roleShapeJA) { + JSONObject roleShapeJO = JSON.parseObject(String.valueOf(roleShapeO)); + String roleShapeKey = roleShapeJO.getString("key"); + if (roleShapeKey.equals("post")) { + //SDK.getLogAPI().consoleInfo("角色岗位"+roleShapeJO.getString("value")); + POST = roleShapeJO.getString("value"); + } + if (roleShapeKey.equals("post_text")) { + //SDK.getLogAPI().consoleInfo("角色岗位文本"+roleShapeJO); + ROLENAME = roleShapeJO.getString("value"); + POSTNAME = roleShapeJO.getString("value"); + } + } + } + } + } + } + } + } + } else { + for (Object attribute1 : attributesArray) { + JSONObject attributeJO1 = JSON.parseObject(String.valueOf(attribute1)); + String SHAPEATTRKEY1 = attributeJO1.getString("key"); + if (SHAPEATTRKEY1.equals("post")) { + POST = attributeJO1.getString("value"); + } + if (SHAPEATTRKEY1.equals("post_text")) { + POSTNAME = attributeJO1.getString("value"); + } + } + } + } + } + } + + fromNodeDataIDMaps.add(NODEID); + + if (nodeIdList.contains(NODEID)) { + dataMap = new HashMap<>(); + Date nowDateJ = new Date(System.currentTimeMillis()); + Timestamp nowDateTime = new Timestamp(nowDateJ.getTime()); + dataMap.put("UPDATEDATE", nowDateTime); + dataMap.put("NODENAME", NODENAME); + dataMap.put("NODETYPE", NODETYPE); + dataMap.put("PLNAME", PLNAME); + dataMap.put("NODECATEGORY", PLMETHODID); + dataMap.put("ITSYSVAL", ITSYSVAL); + dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER); + dataMap.put("ACTIVITYDESC", ACTIVITYDESC); + dataMap.put("ROLE", ROLE); + dataMap.put("ROLENAME", ROLENAME); + dataMap.put("POST", POST); + dataMap.put("POSTNAME", POSTNAME); + dataMap.put("PLID", FILEID); + dataMap.put("NODEID", NODEID); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + oldNodeDataMaps.add(dataMap); + } else { + dataMap = new HashMap<>(); + String uuId = SDK.getRuleAPI().executeAtScript("@uuid()"); + dataMap.put("uuId", uuId); + dataMap.put("NODEID", NODEID); + dataMap.put("NODENAME", NODENAME); + dataMap.put("NODETYPE", NODETYPE); + dataMap.put("PLID", FILEID); + dataMap.put("PLNAME", PLNAME); + dataMap.put("NODECATEGORY", PLMETHODID); + dataMap.put("ITSYSVAL", ITSYSVAL); + dataMap.put("ACTIVITYNUMBER", ACTIVITYNUMBER); + dataMap.put("ACTIVITYDESC", ACTIVITYDESC); + dataMap.put("ROLE", ROLE); + dataMap.put("POST", POST); + dataMap.put("ROLENAME", ROLENAME); + dataMap.put("POSTNAME", POSTNAME); + dataMap.put("MODIFYDATETIME", MODIFYDATETIME); + newNodeDataMaps.add(dataMap); + } + } + } + } + + } + + if (null != nodeIdList && !nodeIdList.isEmpty()) { + for (String nodeIdOfList : nodeIdList) { + if (!fromNodeDataIDMaps.contains(nodeIdOfList)) { + dataMap = new HashMap<>(); + dataMap.put("NODEID", nodeIdOfList); + delNodeDataMaps.add(dataMap); + } + } + } + if (null != oldNodeDataMaps && !oldNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("UPDATE BO_EU_PAL_FILENODE6 SET" + + " NODENAME=:NODENAME, NODETYPE=:NODETYPE, PLNAME=:PLNAME, NODECATEGORY=:NODECATEGORY, ITSYSVAL=:ITSYSVAL, " + + " ACTIVITYNUMBER=:ACTIVITYNUMBER, ACTIVITYDESC=:ACTIVITYDESC, ROLE=:ROLE, POST=:POST, ROLENAME=:ROLENAME, POSTNAME=:POSTNAME, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE " + + " WHERE PLID=:PLID AND NODEID=:NODEID", oldNodeDataMaps); + } + if (null != newNodeDataMaps && !newNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FILENODE6" + + " (ID, NODEID, NODENAME, NODETYPE, PLID, PLNAME, NODECATEGORY, ITSYSVAL, ACTIVITYNUMBER, ACTIVITYDESC, ROLE, POST, ROLENAME, POSTNAME, MODIFYDATETIME) " + + " VALUES(:uuId, :NODEID, :NODENAME, :NODETYPE, :PLID, :PLNAME, :NODECATEGORY, :ITSYSVAL, :ACTIVITYNUMBER, :ACTIVITYDESC, :ROLE, :POST, :ROLENAME, :POSTNAME, :MODIFYDATETIME)", newNodeDataMaps); + } + if (null != delNodeDataMaps && !delNodeDataMaps.isEmpty()) { + DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FILENODE6 WHERE NODEID=:NODEID", delNodeDataMaps); + } + SDK.getLogAPI().consoleInfo("新增节点" + newNodeDataMaps.size()); + SDK.getLogAPI().consoleInfo("修改节点" + oldNodeDataMaps.size()); + SDK.getLogAPI().consoleInfo("删除节点" + delNodeDataMaps.size()); + + long endTime = System.currentTimeMillis(); + SDK.getLogAPI().consoleInfo("结束时间" + endTime); + SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime)); + } + + + + //同步文件数据到 BO_EU_PAL_FILE1 + public void syncFileData() { + String sql = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISUSE =1 AND ISSTOP =0 AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + ArrayList fileHandleRowMaps = new ArrayList<>(); + for (RowMap rowMap : fileHandleRowMaps) { + String plId = rowMap.getString("ID"); + String plname = rowMap.getString("PLNAME"); + String plLevel = rowMap.getString("PLLEVEL"); + String plParentId = rowMap.getString("PLPARENTID"); + String plOrderIndex = rowMap.getString("PLORDERINDEX"); + //文件类型(建模方法) + String plCategory = rowMap.getString("PLCATEGORY"); + //制度文件类型 + String policytype = rowMap.getString("EXT3"); + //文件版本 + String string = rowMap.getString("PLVER"); + //创建人 + String CREATEUSER = rowMap.getString("CREATEUSER"); + //最后修改人 + String MODIFYUSER = rowMap.getString("MODIFYUSER"); + //创建时间 + String CREATEDATE = rowMap.getString("CREATEDATE"); + //最后修改时间 + String MODIFYDATE = rowMap.getString("MODIFYDATE"); + + //发布单位 + String PUBDEPT = getArrtValue(plId, "Issuing_department","json"); + //发布时间 + String PUBDATETIME = getArrtValue(plId, "effective_date","json"); + //文件状态 + String FILESTATE = rowMap.getString("ISPUBLISH"); + //文件生效状态 + String FILEUSESTATE = rowMap.getString("ISPUBLISH"); + //查阅次数 + String VIEWCOUNT = rowMap.getString("VIEWCOUNT"); + + } + + } + //获取属性 + public String getArrtValue(String plId,String ArrtKey,String type) { + String arrtValue = ""; + try { + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+plId+"' and PROPERTYID = '"+ArrtKey+"'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + arrtValue = fileNames; + } + + } + } catch (Exception e) { + // TODO: handle exception + } + return arrtValue; + + } + + //同步架构数据到 BO_EU_PAL_FRAME + public void syncFrameworkData() { + + } + +} 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 d43691eb..68b729f7 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 @@ -141,7 +141,7 @@ public class DataViewService extends ActionWeb { } } nodeType = "position"; - List deptTreeNodes = TreeUtil.buildTree("0",deptNodes, null, "dept", null, nodeType); + List deptTreeNodes = TreeUtil.buildTree("0", deptNodes, null, "dept", null, nodeType); ro.put("positionTree", deptTreeNodes); return ro.toString(); } @@ -195,8 +195,11 @@ public class DataViewService extends ActionWeb { 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 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 PLLEVEL ASC, PLORDERINDEX ASC"); + // 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()) { @@ -220,14 +223,12 @@ public class DataViewService extends ActionWeb { POSITION_NAME = POSITIONMap.getString("POSITION_NAME"); positionNameList.add(POSITION_NAME); } - } - if (null != fileRowMaps && !fileRowMaps.isEmpty()) { - for (RowMap fileRowMap : fileRowMaps) { - String FILEID = fileRowMap.getString("FILEID"); + } long start = System.currentTimeMillis(); if (null != nodeRowMaps && !nodeRowMaps.isEmpty()) { for (RowMap nodeRowMap : nodeRowMaps) { String PLID = nodeRowMap.getString("PLID"); - if (FILEID.equals(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)) { @@ -279,254 +280,14 @@ public class DataViewService extends ActionWeb { } } } - } - } + 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(); - 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 { + if (nodeMaps.size() == 0) { ro.put("rootId", ""); UoPProcessMaps = new ArrayList(); ro.put("nodes", UoPProcessMaps); @@ -534,32 +295,293 @@ public class DataViewService extends ActionWeb { 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); + } 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("您所查询的岗位暂无需执行的流程"); + + } } - 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); + 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(); @@ -569,21 +591,16 @@ public class DataViewService extends ActionWeb { 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_FILENODE5"); - String positionID = UserContext.fromUID(uid).getUserModel().getPositionNo(); - String POSITION_NAME = null; - if (null != positionID && !positionID.equals("")) { - sqlParams = new Object[] { positionID }; - RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO=?", sqlParams); - if (null != POSITIONMap && !POSITIONMap.isEmpty()) { - POSITION_NAME = POSITIONMap.getString("POSITION_NAME"); - if (null != fileRowMaps && !fileRowMaps.isEmpty()) { - for (RowMap fileRowMap : fileRowMaps) { - String FILEID = fileRowMap.getString("FILEID"); + String POSITION_NAME = UserContext.fromUID(uid).getUserModel().getPositionName(); + if (UtilString.isNotEmpty(POSITION_NAME)) { for (RowMap nodeRowMap : nodeRowMaps) { String PLID = nodeRowMap.getString("PLID"); - if (FILEID.equals(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)) { @@ -607,10 +624,10 @@ public class DataViewService extends ActionWeb { 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")); + model = PALRepositoryCache.getCache().get(PLID); if (null != model) { if (model.isPublish() || model.isStop()) {// 停用或已发布状态查询最新流程手册 taskId = getLastPublishTaskIdByModelId(model.getId()); @@ -618,9 +635,9 @@ public class DataViewService extends ActionWeb { } path = "./w" + "?" + "cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open" + "&" - + "uuid=" + fileRowMap.getString("FILEID") + "&" + "sid=" + sid + "&" + + "uuid=" + PLID + "&" + "sid=" + sid + "&" + "taskId=" + taskId; - UoPProcessMap.put("id", fileRowMap.getString("FILEID")); + UoPProcessMap.put("id", PLID); UoPProcessMap.put("text", fileRowMap.getString("PLNAME")); UoPProcessMap.put("path", path); UoPProcessMap.put("RELEVANTFILE", fileRowMap.getString("RELEVANTFILE")); @@ -630,292 +647,313 @@ public class DataViewService extends ActionWeb { UoPProcessMap.put("PARENTID", rootuuId); UoPProcessMaps.add(UoPProcessMap); } + } + } - } - } - } - } else { + + + }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(); - 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 { + + if (nodeMaps.size() == 0) { 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); + 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("您的岗位暂无需执行的流程"); + } } - 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); + 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(); } @@ -971,7 +1009,7 @@ public class DataViewService extends ActionWeb { deptNode.put("nodeType", nodeType); deptNodes.add(deptNode); } - List deptTreeNodes = TreeUtil.buildTree("0",deptNodes, "0", "dept", "3", null); + List deptTreeNodes = TreeUtil.buildTree("0", deptNodes, "0", "dept", "3", null); ro.put("deptTree", deptTreeNodes); // 文件类型查询 HashMap fileType = new HashMap<>(); @@ -1018,7 +1056,7 @@ public class DataViewService extends ActionWeb { 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 (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + 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); @@ -1040,27 +1078,30 @@ public class DataViewService extends ActionWeb { deptString = deptIDList.toString(); } } - System.err.println("=====查询部门视图======"+fileListMap.size()); + 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(sql); if(maps.size()>1) { - * String sqlu = + * 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; } } } + * + 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) { + if (model != null) { try { Integer PLLEVEL = model.getLevel(); String methodId = model.getMethodId(); - - Map queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(model.getId()); + + Map queryRepositoryAttributeById = new RepositoryAttribute() + .queryRepositoryAttributeById(model.getId()); if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) { // 发布部门 JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department"); @@ -1073,7 +1114,8 @@ public class DataViewService extends ActionWeb { if (deptString.contains(dempId)) { // 默认添加所在部门的所有文件 fileHandleRowMaps.add(rowMap); - if ("process.epc".equals(methodId) || "process.flowchart".equals(methodId)) { + if ("process.epc".equals(methodId) + || "process.flowchart".equals(methodId)) { // 支持文件 getArrt("support_files", model, dempId, PLLEVEL, reFileRowMap, fileHandleRowMaps); @@ -1089,18 +1131,18 @@ public class DataViewService extends ActionWeb { fileHandleRowMaps); } } - + } } } - + } } catch (Exception e) { - - System.err.println("==有问题的模型===>"+model.getName()); + + System.err.println("==有问题的模型===>" + model.getName()); // TODO: handle exception } - + } } @@ -1109,12 +1151,12 @@ public class DataViewService extends ActionWeb { // 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); + // 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); + // System.err.println("=====fileRowMaps2========"+fileRowMaps); if (null != fileRowMaps && !fileRowMaps.isEmpty()) { for (RowMap fileRowMap : fileRowMaps) { if (fileType.equals("processFile")) { @@ -1166,12 +1208,12 @@ public class DataViewService extends ActionWeb { } } } else { - //System.err.println("====执行2====" + fileHandleRowMaps); + // System.err.println("====执行2====" + fileHandleRowMaps); // getind(dempId, fileType, fileRowMaps, fileHandleRowMaps, reFileMap, // reFileRowMap); } fileRowMaps = fileHandleRowMaps; - //System.err.println("=======fileRowMaps========="+fileRowMaps); + // System.err.println("=======fileRowMaps========="+fileRowMaps); // 遍历选择的结果 List fileMaps = new ArrayList<>(); List frameRowMaps = new ArrayList<>(); @@ -1210,7 +1252,7 @@ public class DataViewService extends ActionWeb { toCollection( () -> new TreeSet<>(Comparator.comparing(o -> o.getString("FRAMEID")))), ArrayList::new)); - + for (RowMap frameRowMap : frameRowMaps) { frameMap = new HashMap(); nodeType = "frame"; @@ -1222,7 +1264,7 @@ public class DataViewService extends ActionWeb { frameMap.put("nodeType", nodeType); fileMaps.add(frameMap); } - //System.err.println("=====fileRowMaps1=====>" + fileRowMaps); + // System.err.println("=====fileRowMaps1=====>" + fileRowMaps); for (RowMap fileRowMap : fileRowMaps) { fileMap = new HashMap(); @@ -1260,14 +1302,15 @@ public class DataViewService extends ActionWeb { 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); + 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); + // 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); @@ -1297,8 +1340,10 @@ public class DataViewService extends ActionWeb { return ro.toString(); } - //查询所有文件 - public void getind(String dempId,String fileType,List fileRowMaps,ArrayList fileHandleRowMaps,Map reFileMap,RowMap reFileRowMap) { + + // 查询所有文件 + 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) { @@ -1324,7 +1369,7 @@ public class DataViewService extends ActionWeb { fileHandleRowMaps.add(fileRowMap); } } - + } } catch (Exception e) { // TODO: handle exception @@ -1349,7 +1394,7 @@ public class DataViewService extends ActionWeb { fileHandleRowMaps.add(fileRowMap); } } - + } } catch (Exception e) { // TODO: handle exception @@ -1387,18 +1432,19 @@ public class DataViewService extends ActionWeb { } } } - - public void getArrt(String name,PALRepositoryModel model,String dempId,Integer PLLEVEL,RowMap reFileRowMap,ArrayList fileHandleRowMaps) { + + public void getArrt(String name, PALRepositoryModel model, String dempId, Integer PLLEVEL, RowMap reFileRowMap, + ArrayList fileHandleRowMaps) { // 支持相关文件 - List support_filesList = DesignerShapeRelationCache - .getListByAttrId(model.getId(), "",name); + 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<>(); + HashMap reFileMap = new HashMap<>(); reFileMap.put("FILEID", supportFileId); reFileMap.put("PLNAME", reFileModel.getName()); reFileMap.put("PLPARENTID", model.getId()); @@ -1412,5 +1458,5 @@ public class DataViewService extends ActionWeb { } } } - + } diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService3.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService3.java new file mode 100644 index 00000000..2368bf9a --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/DataViewService3.java @@ -0,0 +1,1396 @@ +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 DataViewService3 extends ActionWeb { + + UserContext _uc; + + public DataViewService3(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 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 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_FILENODE5"); + 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); + } + } + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + for (RowMap fileRowMap : fileRowMaps) { + String FILEID = fileRowMap.getString("FILEID"); + if (null != nodeRowMaps && !nodeRowMaps.isEmpty()) { + for (RowMap nodeRowMap : nodeRowMaps) { + String PLID = nodeRowMap.getString("PLID"); + if (FILEID.equals(PLID)) { + 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); + } + } + } + } + } + } + } + UoPProcessMaps = UoPProcessMaps.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), + ArrayList::new)); + tempMaps = new ArrayList(); + 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 { + 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_FILENODE5"); + String positionID = UserContext.fromUID(uid).getUserModel().getPositionNo(); + String POSITION_NAME = null; + if (null != positionID && !positionID.equals("")) { + sqlParams = new Object[] { positionID }; + RowMap POSITIONMap = DBSql.getMap("SELECT POSITION_NAME FROM ORGUSER WHERE POSITION_NO=?", sqlParams); + if (null != POSITIONMap && !POSITIONMap.isEmpty()) { + POSITION_NAME = POSITIONMap.getString("POSITION_NAME"); + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + for (RowMap fileRowMap : fileRowMaps) { + String FILEID = fileRowMap.getString("FILEID"); + for (RowMap nodeRowMap : nodeRowMaps) { + String PLID = nodeRowMap.getString("PLID"); + if (FILEID.equals(PLID)) { + 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(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); + } + } + } + } + } + } + } else { + ro.info("当前用户未设置岗位"); + } + UoPProcessMaps = UoPProcessMaps.stream() + .collect(collectingAndThen( + toCollection(() -> new TreeSet<>(Comparator.comparing(o -> String.valueOf(o.get("id"))))), + ArrayList::new)); + tempMaps = new ArrayList(); + 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 (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(); + } + } + for (RowMap rowMap : fileListMap) { + String id = rowMap.getString("FILEID"); + /* + * String plVersionId = rowMap.getString("PLVERSIONID"); String sqlu = + * "SELECT ID FROM (SELECT * 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); + 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); + } + } + + } + } + } + + } + } + + fileRowMaps = fileHandleRowMaps; + long endTime = System.currentTimeMillis(); + // System.err.println("------测试1---------" + fileHandleRowMaps); + // System.err.println("------测试2---------" + fileRowMaps); + // System.out.println("代码段执行时间:" + (endTime - startTime) + "ms"); + if (null != fileRowMaps && fileRowMaps.size() > 0) { + if (null != fileType && !fileType.equals("")) { + fileHandleRowMaps = new ArrayList<>(); + if (null != fileRowMaps && !fileRowMaps.isEmpty()) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileType.equals("processFile")) { + if (fileRowMap.getString("PLMETHODID").equals("process.epc") + || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { + fileHandleRowMaps.add(fileRowMap); + } + } + 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; + // 遍历选择的结果 + 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")); + fileMap.put("TLEVEL", fileRowMap.getString("PLLEVEL")); + fileMap.put("nodeType", nodeType); + fileMaps.add(fileMap); + } + // System.err.println("=====fileMaps=====>" + fileMaps); + // System.err.println("=====返回参数4======>" + ro.toString()); + 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/FileManagementService.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java index 1a0f0491..f2230a55 100644 --- a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService.java @@ -530,141 +530,152 @@ public class FileManagementService extends ActionWeb { return ro.toString(); } - /** - * @methodName: - * @param: - * @return: - * @description:部门文件年度更新情况 - * @auther: Lizj - * @date: 2022/6/28 22:53 - */ - public String deptFileYearRenewSituation(UserContext uc, RequestParams params) { - /* 1)新增数=某单位年度新增文件 - 2)修订数=某单位年度修订文件 - 3)废止数=某单位年度废止文件 */ - ResponseObject ro = ResponseObject.newOkResponse(); - HashMap renewCountMap = new HashMap<>(); - ArrayList BDRenewCountMaps = new ArrayList<>(); - ArrayList FDRenewCountMaps = new ArrayList<>(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Integer createCount = 0; - Integer updateCount = 0; - Integer abolishCount = 0; - ArrayList deptIDList = new ArrayList<>(); - //获取当前年 - LocalDateTime nowDate = LocalDateTime.now(); - int nowYear = nowDate.getYear(); - //事业部和职能部门ID,名称 list - List fileRowMaps = DBSql.getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME,FILESTATE FROM BO_EU_PAL_FILE1"); - List BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); - List FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); - if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { - for (RowMap bdInfoMap : BDInfoMaps) { - renewCountMap = new HashMap(); - createCount = 0; - updateCount = 0; - abolishCount = 0; - String bdDeptID = bdInfoMap.getString("DEPTID"); - deptIDList = new ArrayList(); - try { - - deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - String FILESTATE = fileRowMap.getString("FILESTATE"); - String FILEVERSION = fileRowMap.getString("FILEVERSION"); - String publishDate = fileRowMap.getString("PUBDATETIME"); - if (UtilString.isNotEmpty(publishDate)) { - if (publishDate.contains("2022")) { + /** + * @methodName: + * @param: + * @return: + * @description:部门文件年度更新情况 + * @auther: Lizj + * @date: 2022/6/28 22:53 + */ + public String deptFileYearRenewSituation(UserContext uc, RequestParams params) { + /* + * 1)新增数=某单位年度新增文件 一个版本是新增 + * 2)修订数=某单位年度修订文件 大于一个版本是修订 + * 3)废止数=某单位年度废止文件 停用 + */ + ResponseObject ro = ResponseObject.newOkResponse(); + HashMap renewCountMap = new HashMap<>(); + ArrayList BDRenewCountMaps = new ArrayList<>(); + ArrayList FDRenewCountMaps = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Integer createCount = 0; + Integer updateCount = 0; + Integer abolishCount = 0; + ArrayList deptIDList = new ArrayList<>(); + // 获取当前年 + LocalDateTime nowDate = LocalDateTime.now(); + int nowYear = nowDate.getYear(); + // 事业部和职能部门ID,名称 list + List fileRowMaps = DBSql + .getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME,FILESTATE FROM BO_EU_PAL_FILE1"); + List BDInfoMaps = DBSql.getMaps( + "SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); + List FDInfoMaps = DBSql.getMaps( + "SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); + if (null != BDInfoMaps && !BDInfoMaps.isEmpty()) { + for (RowMap bdInfoMap : BDInfoMaps) { + renewCountMap = new HashMap(); + createCount = 0; + updateCount = 0; + abolishCount = 0; + String bdDeptID = bdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + try { + + deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); + if (null != deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + String FILESTATE = fileRowMap.getString("FILESTATE"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + String publishDate = fileRowMap.getString("PUBDATETIME"); + if (UtilString.isNotEmpty(publishDate)) { + if (publishDate.contains("2022")) { + if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } + } + + Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); + String pubdatetimeString = sdf.format(PUBDATETIME); + LocalDate pubDate = LocalDate.parse(pubdatetimeString, + DateTimeFormatter.ofPattern("yyyy-MM-dd")); + + if (pubDate.getYear() == nowYear) { if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { - createCount += 1; - } - if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { - updateCount += 1; - } - if (FILESTATE.equals("3")) { - abolishCount += 1; - } + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } + + } + } + } + } + } catch (Exception e) { + // TODO: handle exception + } + renewCountMap.put("deptID", bdDeptID); + renewCountMap.put("deptName", bdInfoMap.getString("ABBREVIATION")); + renewCountMap.put("createCount", createCount); + renewCountMap.put("updateCount", updateCount); + renewCountMap.put("abolishCount", abolishCount); + BDRenewCountMaps.add(renewCountMap); + } + } + if (null != FDInfoMaps && !FDInfoMaps.isEmpty()) { + for (RowMap fdInfoMap : FDInfoMaps) { + renewCountMap = new HashMap(); + createCount = 0; + updateCount = 0; + abolishCount = 0; + String fdDeptID = fdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + try { + deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); + if (null != deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + String FILESTATE = fileRowMap.getString("FILESTATE"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + String publishDate = fileRowMap.getString("PUBDATETIME"); + if (UtilString.isNotEmpty(publishDate)) { + if (publishDate.contains("2022")) { + if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } } } - - /* - * Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); String - * pubdatetimeString= sdf.format(PUBDATETIME); LocalDate pubDate = - * LocalDate.parse(pubdatetimeString, - * DateTimeFormatter.ofPattern("yyyy-MM-dd")); - * - * if (pubDate.getYear()==nowYear) { if (FILESTATE.equals("1") && - * FILEVERSION.equals("1.0")) { createCount += 1; } if (FILESTATE.equals("1") && - * !FILEVERSION.equals("1.0")) { updateCount += 1; } if (FILESTATE.equals("3")) - * { abolishCount += 1; } } - */ - } - } - } - } - } catch (Exception e) { - // TODO: handle exception + } + } + } + } catch (Exception e) { + // TODO: handle exception + } + renewCountMap.put("deptID", fdDeptID); + renewCountMap.put("deptName", fdInfoMap.getString("ABBREVIATION")); + renewCountMap.put("createCount", createCount); + renewCountMap.put("updateCount", updateCount); + renewCountMap.put("abolishCount", abolishCount); + FDRenewCountMaps.add(renewCountMap); } - renewCountMap.put("deptID",bdDeptID); - renewCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); - renewCountMap.put("createCount",createCount); - renewCountMap.put("updateCount",updateCount); - renewCountMap.put("abolishCount",abolishCount); - BDRenewCountMaps.add(renewCountMap); - } - } - if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { - for (RowMap fdInfoMap : FDInfoMaps) { - renewCountMap = new HashMap(); - createCount = 0; - updateCount = 0; - abolishCount = 0; - String fdDeptID = fdInfoMap.getString("DEPTID"); - deptIDList = new ArrayList(); - try { - deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); - if (null!=deptIDList && !deptIDList.isEmpty()) { - for (String deptID : deptIDList) { - for (RowMap fileRowMap : fileRowMaps) { - if (fileRowMap.getString("PUBDEPT").contains(deptID)) { - String FILESTATE = fileRowMap.getString("FILESTATE"); - String FILEVERSION = fileRowMap.getString("FILEVERSION"); - String publishDate = fileRowMap.getString("PUBDATETIME"); - if (UtilString.isNotEmpty(publishDate)) { - if (publishDate.contains("2022")) { - if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { - createCount += 1; - } - if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { - updateCount += 1; - } - if (FILESTATE.equals("3")) { - abolishCount += 1; - } - } - } - } - } - } - } - } catch (Exception e) { - // TODO: handle exception - } - renewCountMap.put("deptID",fdDeptID); - renewCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); - renewCountMap.put("createCount",createCount); - renewCountMap.put("updateCount",updateCount); - renewCountMap.put("abolishCount",abolishCount); - FDRenewCountMaps.add(renewCountMap); - } - } - ro.put("BDRenewCount",BDRenewCountMaps); - ro.put("FDRenewCount",FDRenewCountMaps); - return ro.toString(); - } + } + ro.put("BDRenewCount", BDRenewCountMaps); + ro.put("FDRenewCount", FDRenewCountMaps); + return ro.toString(); + } /** * @methodName: diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService2.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService2.java new file mode 100644 index 00000000..6fd403c9 --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/service/FileManagementService2.java @@ -0,0 +1,1173 @@ +package com.awspaas.user.apps.yili.reportform.service; + +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.JSONObject; +import com.awspaas.user.apps.yili.reportform.util.GetNodesUtil; +import com.awspaas.user.apps.yili.reportform.util.TreeUtil; + +import java.sql.Connection; +import java.sql.Timestamp; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.Period; +import java.time.format.DateTimeFormatter; +import java.util.*; + +/** + * @author:Lizj + * @create: 2022-06-27 09:41 + * @Description: 文件管理看板 + */ +public class FileManagementService2 extends ActionWeb { + + UserContext _uc; + + public FileManagementService2(UserContext uc) { + super(uc); + _uc = uc; + } + + /** + * @methodName: + * @param: + * @return: + * @description:流程制度类文件总数 + * @auther: Lizj + * @date: 2022/6/27 9:48 + */ + public String fileTotal(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + Integer fileTotal = 0; + Integer processFile = 0; + Integer policyFile = 0; + Integer guideFile = 0; + Integer formFile = 0; + HashMap fileSortMap = new HashMap<>(); + //List fileRowMaps = DBSql.getMaps( "SELECT FILEID,PLMETHODID,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); + List fileRowMaps = DBSql.getMaps( "SELECT FILEID,PLMETHODID,POLICYTYPE FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); + if (null!=fileRowMaps && !fileRowMaps.isEmpty()) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { + fileTotal += 1; + processFile += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null==fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) { + fileTotal += 1; + policyFile += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + fileTotal += 1; + guideFile += 1; + } else if (fileRowMap.getString("PLMETHODID").equals("data.form")) { + fileTotal += 1; + formFile += 1; + } + } + } + ro.put("fileTotal",fileTotal); + fileSortMap.put("processFile",processFile); + fileSortMap.put("policyFile",policyFile); + fileSortMap.put("guideFile",guideFile); + fileSortMap.put("formFile",formFile); + ro.put("fileSort",fileSortMap); + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:制度管理看板筛选条件 文件类型、发布单位、所属领域 + * @auther: Lizj + * @date: 2022/6/27 16:07 + */ + public String queryTerms5(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + /*“文件类型”筛选框:流程(包括过程链图和泳道图),制度(包括制度模型中的制度),操作指导(包括制度模型中的操作指导),表单/模板(包括表单模型)*/ + //文件类型 + HashMap fileType = new HashMap<>(); + ArrayList fileTypes = new ArrayList<>(); + 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); + //发布单位 + List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + //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("1",deptNodes,"0","dept","3",null); + //所属领域 + ArrayList frameList = new ArrayList<>(); + ArrayList fieldMaps = new ArrayList<>(); + List L1Maps = DBSql.getMaps("SELECT FRAMEID,FRAMENAME,FRAMETYPE,FRAMEORDERINDEX FROM BO_EU_PAL_FRAME WHERE FRAMELEVEL=1 AND FRAMETYPE IS NOT NULL "); + String hasRoot = "Y"; + if (null != L1Maps && !L1Maps.isEmpty()) { + for (RowMap l1Map : L1Maps) { + String L1ID = l1Map.getString("FRAMEID"); + frameList = new ArrayList<>(); + frameList = GetNodesUtil.getChildFrame(L1ID, hasRoot, frameList); + fieldMaps.addAll(frameList); + } + } + ArrayList fieldNodes = new ArrayList<>(); + for (Map fieldMap : fieldMaps) { + HashMap fieldNode = new HashMap<>(); + fieldNode.put("ID", String.valueOf(fieldMap.get("FRAMEID"))); + fieldNode.put("PARENTID", String.valueOf(fieldMap.get("FRAMEPARENTID"))); + fieldNode.put("name", String.valueOf(fieldMap.get("FRAMENAME"))); + fieldNode.put("ORDERINDEX", Integer.valueOf(String.valueOf(fieldMap.get("FRAMEORDERINDEX")))); + fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); + fieldNodes.add(fieldNode); + } + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); + ro.put("deptTreeNodes",deptTreeNodes); + ro.put("fieldTreeNodes",fieldTreeNodes); + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:制度管理看板 + * @auther: Lizj + * @date: 2022/6/27 16:52 + */ + public String fileStatistics(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + String fileType = params.get("fileType"); + String unit = params.get("unit"); + String field = params.get("field"); + ArrayList deptIDList = new ArrayList<>(); + ArrayList fieldList = new ArrayList<>(); + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT,PLMETHODID,POLICYTYPE,FILESTATE,VIEWCOUNT FROM BO_EU_PAL_FILE1 WHERE PLMETHODID='process.epc' OR PLMETHODID='process.flowchart' OR PLMETHODID='control.policy' OR PLMETHODID='data.form'"); + ArrayList fileHandleMaps = new ArrayList<>(); + if (null!=fileType && !fileType.equals("")) { + fileHandleMaps = new ArrayList<>(); + if (fileType.equals("processFile")) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLMETHODID").equals("process.epc") || fileRowMap.getString("PLMETHODID").equals("process.flowchart")) { + fileHandleMaps.add(fileRowMap); + } + } + } + if (fileType.equals("policyFile")) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy") && (fileRowMap.getString("POLICYTYPE").equals("regulation") || null==fileRowMap.getString("POLICYTYPE") || fileRowMap.getString("POLICYTYPE").equals(""))) { + fileHandleMaps.add(fileRowMap); + } + } + } + if (fileType.equals("guideFile")) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLMETHODID").equals("control.policy") && fileRowMap.getString("POLICYTYPE").equals("I/O_L4")) { + fileHandleMaps.add(fileRowMap); + } + } + } + if (fileType.equals("formFile")) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLMETHODID").equals("data.form")) { + fileHandleMaps.add(fileRowMap); + } + } + } + fileRowMaps = fileHandleMaps; + } + if (null!=unit && !unit.equals("")) { + fileHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + fileHandleMaps.add(fileRowMap); + } + } + } + fileRowMaps = fileHandleMaps; + } + if (null!=field && !field.equals("")) { + fileHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PLPARENTID").equals(fieldID)) { + fileHandleMaps.add(fileRowMap); + } + } + } + fileRowMaps = fileHandleMaps; + } + //文件状态:已发布、审批中、已失效 查阅总数 + Integer publishedCount = 0; + Integer inApprovalCount = 0; + Integer expiredCount = 0; + Integer consultCount = 0; + if (null!=fileRowMaps && fileRowMaps.isEmpty()==false) { + for (RowMap fileRowMap : fileRowMaps) { + String fileState = fileRowMap.getString("FILESTATE"); + Integer VIEWCOUNT = fileRowMap.getInt("VIEWCOUNT"); + if (fileState.equals("1")) { + publishedCount += 1; + } + if (fileState.equals("2")) { + inApprovalCount += 1; + } + if (fileState.equals("3")) { + expiredCount += 1; + } + consultCount += VIEWCOUNT; + } + ro.put("publishedCount",publishedCount); + ro.put("inApprovalCount",inApprovalCount); + ro.put("expiredCount",expiredCount); + ro.put("consultCount",consultCount); + } else { + ro.ok("暂无文件"); + publishedCount = 0; + inApprovalCount = 0; + expiredCount = 0; + consultCount = 0; + ro.put("publishedCount",publishedCount); + ro.put("inApprovalCount",inApprovalCount); + ro.put("expiredCount",expiredCount); + ro.put("consultCount",consultCount); + } + return ro.toString(); + } + + + + //获取属性 + public String getArrtValue(String plId,String ArrtKey,String type) { + String arrtValue = ""; + try { + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+plId+"' and PROPERTYID = '"+ArrtKey+"'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + arrtValue = fileNames; + } + + } + } catch (Exception e) { + // TODO: handle exception + } + return arrtValue; + + } + + /** + * @methodName: + * @param: + * @return: + * @description:部门文件数量 + * @auther: Lizj + * @date: 2022/6/28 22:43 + */ + public String deptFileCount(UserContext uc, RequestParams params) { + /* 文件数量=当日生效文档总数 */ + ResponseObject ro = ResponseObject.newOkResponse(); + HashMap deptFileCountMap = new HashMap<>(); + ArrayList deptIDList = new ArrayList<>(); + ArrayList BDFileCountMaps = new ArrayList<>(); + ArrayList FDFileCountMaps = new ArrayList<>(); + // 事业部和职能部门ID,名称 list + //List fileRowMaps = DBSql.getMaps("SELECT FILEID,PUBDEPT FROM BO_EU_PAL_FILE1 WHERE FILEUSESTATE='1' AND (PLMETHODID='data.form' OR PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"); + List BDInfoMaps = DBSql.getMaps( + "SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); + List FDInfoMaps = DBSql.getMaps( + "SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); + String sql = "SELECT ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE ISPUBLISH = 1 AND ISUSE =1 AND ISSTOP =0 AND (PLMETHODID='process.epc' OR PLMETHODID='control.policy' OR PLMETHODID='process.flowchart')"; + List fileListMap = DBSql.getMaps(sql); + System.err.println("获取到的文件总数=====>"+fileListMap.size()); + if (null != BDInfoMaps && !BDInfoMaps.isEmpty()) { + Integer fileCount = 0; + for (RowMap bdInfoMap : BDInfoMaps) { + String bdDeptID = bdInfoMap.getString("DEPTID"); + for (RowMap rowMap : fileListMap) { + String plId = rowMap.getString("ID"); + System.err.println("获取到的文件ID=====>"+plId); + String depId = getArrtValue(plId, "Issuing_department", "json"); + System.err.println("获取到部门Id=====>"+depId); + if (UtilString.isNotEmpty(depId)) { + String pathIdOfCache = SDK.getORGAPI().getDepartmentById(depId).getPathIdOfCache(); + System.err.println("部门全路径为=======》" + pathIdOfCache); + if (pathIdOfCache.contains(bdDeptID)) { + fileCount += 1; + } + + } + } + deptFileCountMap.put("deptID",bdDeptID); + deptFileCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); + deptFileCountMap.put("fileCount",fileCount); + BDFileCountMaps.add(deptFileCountMap); + } + } + + if (null != FDInfoMaps && !FDInfoMaps.isEmpty()) { + Integer fileCount = 0; + for (RowMap fdInfoMap : FDInfoMaps) { + String fdDeptID = fdInfoMap.getString("DEPTID"); + for (RowMap rowMap : fileListMap) { + String plId = rowMap.getString("ID"); + String depId = getArrtValue(plId, "Issuing_department", "json"); + if (UtilString.isNotEmpty(depId)) { + String pathIdOfCache = SDK.getORGAPI().getDepartmentById(depId).getPathIdOfCache(); + System.err.println("部门全路径为=======》" + pathIdOfCache); + if (pathIdOfCache.contains(fdDeptID)) { + fileCount += 1; + } + + } + } + deptFileCountMap.put("deptID", fdDeptID); + deptFileCountMap.put("deptName", fdInfoMap.getString("ABBREVIATION")); + deptFileCountMap.put("fileCount", fileCount); + FDFileCountMaps.add(deptFileCountMap); + } + + } + + /* + * if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { for (RowMap bdInfoMap : + * BDInfoMaps) { deptFileCountMap = new HashMap(); fileCount = + * 0; String bdDeptID = bdInfoMap.getString("DEPTID"); deptIDList = new + * ArrayList(); deptIDList = GetNodesUtil.getChildDept(bdDeptID, + * deptIDList); if (null!=deptIDList && !deptIDList.isEmpty()) { for (String + * deptID : deptIDList) { for (RowMap fileRowMap : fileRowMaps) { if + * (fileRowMap.getString("PUBDEPT").contains(deptID)) { // fileCount += 1; } } } + * } deptFileCountMap.put("deptID",bdDeptID); + * deptFileCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); + * deptFileCountMap.put("fileCount",fileCount); + * BDFileCountMaps.add(deptFileCountMap); } } + */ + /* + * if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { for (RowMap fdInfoMap : + * FDInfoMaps) { deptFileCountMap = new HashMap(); fileCount = + * 0; String fdDeptID = fdInfoMap.getString("DEPTID"); deptIDList = new + * ArrayList(); deptIDList = GetNodesUtil.getChildDept(fdDeptID, + * deptIDList); if (null!=deptIDList && !deptIDList.isEmpty()) { for (String + * deptID : deptIDList) { for (RowMap fileRowMap : fileRowMaps) { if + * (fileRowMap.getString("PUBDEPT").contains(deptID)) { fileCount += 1; } } } } + * deptFileCountMap.put("deptID",fdDeptID); + * deptFileCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); + * deptFileCountMap.put("fileCount",fileCount); + * FDFileCountMaps.add(deptFileCountMap); } } + */ + ro.put("BDFileCount", BDFileCountMaps); + ro.put("FDFileCount", FDFileCountMaps); + return ro.toString(); + } + /** + * @methodName: + * @param: + * @return: + * @description:部门文件年度更新率 + * @auther: Lizj + * @date: 2022/6/28 22:49 + */ + public String deptFileYearRenewRate(UserContext uc, RequestParams params) { + /*年度更新率=(某单位年度新增文件+年度修订文件)/某单位当前文件总数*/ + ResponseObject ro = ResponseObject.newOkResponse(); + HashMap renewRateMap = new HashMap<>(); + ArrayList BDRenewRateMaps = new ArrayList<>(); + ArrayList FDRenewRateMaps = new ArrayList<>(); + ArrayList deptIDList = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Integer deptFileNum = 0; + Integer newFileNum = 0; + String renewRate = null; + //获取当前年 + LocalDateTime nowDate = LocalDateTime.now(); + int nowYear = nowDate.getYear(); + NumberFormat numberformat = NumberFormat.getInstance(); + numberformat.setMaximumFractionDigits(2); + //事业部和职能部门ID,名称 list + List fileRowMaps = DBSql.getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); + List BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); + List FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); + if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { + for (RowMap bdInfoMap : BDInfoMaps) { + renewRateMap = new HashMap(); + deptFileNum = 0; + newFileNum = 0; + renewRate = null; + String bdDeptID = bdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + deptFileNum += 1; + Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + String pubdatetimeString= sdf.format(PUBDATETIME); + LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + if (pubDate.getYear()==nowYear) { + newFileNum += 1; + } + } + } + } + } + if (deptFileNum!=0) { + renewRate = numberformat.format((float) newFileNum / (float) deptFileNum * 100); + } else { + renewRate = "0"; + } + renewRateMap.put("deptID",bdDeptID); + renewRateMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); + renewRateMap.put("renewRate",renewRate); + BDRenewRateMaps.add(renewRateMap); + } + } + if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { + for (RowMap fdInfoMap : FDInfoMaps) { + renewRateMap = new HashMap(); + deptFileNum = 0; + newFileNum = 0; + renewRate = null; + String fdDeptID = fdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + deptFileNum += 1; + Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + String pubdatetimeString= sdf.format(PUBDATETIME); + LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + if (pubDate.getYear()==nowYear) { + newFileNum += 1; + } + } + } + } + } + if (deptFileNum!=0) { + renewRate = numberformat.format((float) newFileNum / (float) deptFileNum * 100); + } else { + renewRate = "0"; + } + renewRateMap.put("deptID",fdDeptID); + renewRateMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); + renewRateMap.put("renewRate",renewRate); + FDRenewRateMaps.add(renewRateMap); + } + } + ro.put("BDRenewRate",BDRenewRateMaps); + ro.put("FDRenewRate",FDRenewRateMaps); + return ro.toString(); + } + /** + * @methodName: + * @param: + * @return: + * @description:部门文件年度更新情况 + * @auther: Lizj + * @date: 2022/6/28 22:53 + */ + public String deptFileYearRenewSituation(UserContext uc, RequestParams params) { + /* 1)新增数=某单位年度新增文件 + 2)修订数=某单位年度修订文件 + 3)废止数=某单位年度废止文件 */ + ResponseObject ro = ResponseObject.newOkResponse(); + HashMap renewCountMap = new HashMap<>(); + ArrayList BDRenewCountMaps = new ArrayList<>(); + ArrayList FDRenewCountMaps = new ArrayList<>(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Integer createCount = 0; + Integer updateCount = 0; + Integer abolishCount = 0; + ArrayList deptIDList = new ArrayList<>(); + //获取当前年 + LocalDateTime nowDate = LocalDateTime.now(); + int nowYear = nowDate.getYear(); + //事业部和职能部门ID,名称 list + List fileRowMaps = DBSql.getMaps("SELECT FILEID,FILEVERSION,PUBDEPT,PUBDATETIME,FILESTATE FROM BO_EU_PAL_FILE1"); + List BDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='BD'"); + List FDInfoMaps = DBSql.getMaps("SELECT DEPTID,DEPTNAME,ABBREVIATION,DEPTTYPE FROM BO_EU_DEPT_ABBREVIATION WHERE DEPTTYPE='FD'"); + if (null!=BDInfoMaps && !BDInfoMaps.isEmpty()) { + for (RowMap bdInfoMap : BDInfoMaps) { + renewCountMap = new HashMap(); + createCount = 0; + updateCount = 0; + abolishCount = 0; + String bdDeptID = bdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(bdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); + String pubdatetimeString= sdf.format(PUBDATETIME); + LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + String FILESTATE = fileRowMap.getString("FILESTATE"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + if (pubDate.getYear()==nowYear) { + if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } + } + } + } + } + renewCountMap.put("deptID",bdDeptID); + renewCountMap.put("deptName",bdInfoMap.getString("ABBREVIATION")); + renewCountMap.put("createCount",createCount); + renewCountMap.put("updateCount",updateCount); + renewCountMap.put("abolishCount",abolishCount); + BDRenewCountMaps.add(renewCountMap); + } + } + if (null!=FDInfoMaps && !FDInfoMaps.isEmpty()) { + for (RowMap fdInfoMap : FDInfoMaps) { + renewCountMap = new HashMap(); + createCount = 0; + updateCount = 0; + abolishCount = 0; + String fdDeptID = fdInfoMap.getString("DEPTID"); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(fdDeptID, deptIDList); + if (null!=deptIDList && !deptIDList.isEmpty()) { + for (String deptID : deptIDList) { + for (RowMap fileRowMap : fileRowMaps) { + if (fileRowMap.getString("PUBDEPT").contains(deptID)) { + Timestamp PUBDATETIME = fileRowMap.getTimestamp("PUBDATETIME"); + String pubdatetimeString= sdf.format(PUBDATETIME); + LocalDate pubDate = LocalDate.parse(pubdatetimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd")); + String FILESTATE = fileRowMap.getString("FILESTATE"); + String FILEVERSION = fileRowMap.getString("FILEVERSION"); + if (pubDate.getYear()==nowYear) { + if (FILESTATE.equals("1") && FILEVERSION.equals("1.0")) { + createCount += 1; + } + if (FILESTATE.equals("1") && !FILEVERSION.equals("1.0")) { + updateCount += 1; + } + if (FILESTATE.equals("3")) { + abolishCount += 1; + } + } + } + } + } + } + renewCountMap.put("deptID",fdDeptID); + renewCountMap.put("deptName",fdInfoMap.getString("ABBREVIATION")); + renewCountMap.put("createCount",createCount); + renewCountMap.put("updateCount",updateCount); + renewCountMap.put("abolishCount",abolishCount); + FDRenewCountMaps.add(renewCountMap); + } + } + ro.put("BDRenewCount",BDRenewCountMaps); + ro.put("FDRenewCount",FDRenewCountMaps); + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:文件发布时间分布筛选条件:发布单位、所属领域 + * @auther: Lizj + * @date: 2022/6/28 22:54 + */ + public String queryTerms6(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + //发布单位 + List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + //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("1",deptNodes,"0","dept","3",null); + //所属领域 + ArrayList frameList = new ArrayList<>(); + ArrayList fieldMaps = new ArrayList<>(); + List L1Maps = DBSql.getMaps("SELECT FRAMEID,FRAMENAME,FRAMETYPE,FRAMEORDERINDEX FROM BO_EU_PAL_FRAME WHERE FRAMELEVEL=1 AND FRAMETYPE IS NOT NULL "); + String hasRoot = "Y"; + if (null != L1Maps && !L1Maps.isEmpty()) { + for (RowMap l1Map : L1Maps) { + String L1ID = l1Map.getString("FRAMEID"); + frameList = new ArrayList<>(); + frameList = GetNodesUtil.getChildFrame(L1ID, hasRoot, frameList); + fieldMaps.addAll(frameList); + } + } + ArrayList fieldNodes = new ArrayList<>(); + for (Map fieldMap : fieldMaps) { + HashMap fieldNode = new HashMap<>(); + fieldNode.put("ID", String.valueOf(fieldMap.get("FRAMEID"))); + fieldNode.put("PARENTID", String.valueOf(fieldMap.get("FRAMEPARENTID"))); + fieldNode.put("name", String.valueOf(fieldMap.get("FRAMENAME"))); + fieldNode.put("ORDERINDEX", Integer.valueOf(String.valueOf(fieldMap.get("FRAMEORDERINDEX")))); + fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); + fieldNodes.add(fieldNode); + } + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); + ro.put("deptTreeNodes",deptTreeNodes); + ro.put("fieldTreeNodes",fieldTreeNodes); + return ro.toString(); + } + /** + * @methodName: + * @param: + * @return: + * @description:文件发布时间分布 + * @auther: Lizj + * @date: 2022/6/28 22:57 + */ + public String filePubTimeDistribution(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + String unit = params.get("unit"); + String field = params.get("field"); + ArrayList deptIDList = new ArrayList<>(); + ArrayList fieldList = new ArrayList<>(); + List fileMaps = DBSql.getMaps("SELECT FILEID,PLMETHODID,POLICYTYPE,PUBDATETIME,PUBDEPT,PLPARENTID FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1' AND PUBDATETIME IS NOT NULL"); + ArrayList fileHandleMaps = new ArrayList<>(); + + if (null!=unit && !unit.equals("")) { + fileHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileMap : fileMaps) { + if (fileMap.getString("PUBDEPT").contains(deptID)) { + fileHandleMaps.add(fileMap); + } + } + } + fileMaps = fileHandleMaps; + } + if (null!=field && !field.equals("")) { + fileHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap fileMap : fileMaps) { + if (fileMap.getString("PLPARENTID").equals(fieldID)) { + fileHandleMaps.add(fileMap); + } + } + } + fileMaps = fileHandleMaps; + } + LocalDate nowDate = LocalDate.now(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + //6个月内fileMaps + ArrayList month6InFileMaps = new ArrayList<>(); + //6个月~1年fileMaps + ArrayList year1InFileMaps = new ArrayList<>(); + //1年~2年fileMaps + ArrayList year2InFileMaps = new ArrayList<>(); + //2年~3年fileMaps + ArrayList year3InFileMaps = new ArrayList<>(); + //3年以上+fileMaps + ArrayList year3OutFileMaps = new ArrayList<>(); + + ArrayList fileCountMaps = new ArrayList<>(); + if (null!=fileMaps && fileMaps.isEmpty()==false) { + for (RowMap fileMap : fileMaps) { + LocalDate PUBDATETIME = LocalDate.parse(fileMap.getString("PUBDATETIME"), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Period betweenDate = Period.between(PUBDATETIME, nowDate); + if (betweenDate.getMonths()<6) { + month6InFileMaps.add(fileMap); + } + if (betweenDate.getMonths()>=6 && betweenDate.getYears()<1) { + year1InFileMaps.add(fileMap); + } + if(betweenDate.getYears()>=1 && betweenDate.getYears()<2) { + year2InFileMaps.add(fileMap); + } + if(betweenDate.getYears()>=2 && betweenDate.getYears()<3) { + year3InFileMaps.add(fileMap); + } + if(betweenDate.getYears()>=3) { + year3OutFileMaps.add(fileMap); + } + } + } else { + ro.ok("暂无文件"); + } + + Integer processFileCount = 0; + Integer policyFileCount = 0; + Integer guideFileCount = 0; + Integer formFileCount = 0; + Map fileCountMap = new LinkedHashMap<>(); + if (null!=month6InFileMaps && !month6InFileMaps.isEmpty()) { + for (RowMap month6InFileMap : month6InFileMaps) { + if (month6InFileMap.getString("PLMETHODID").equals("process.epc") || month6InFileMap.getString("PLMETHODID").equals("process.flowchart")) { + processFileCount += 1; + } else if (month6InFileMap.getString("PLMETHODID").equals("control.policy") && (month6InFileMap.getString("POLICYTYPE").equals("regulation") || null==month6InFileMap.getString("POLICYTYPE") || month6InFileMap.getString("POLICYTYPE").equals(""))) { + policyFileCount += 1; + } else if (month6InFileMap.getString("PLMETHODID").equals("control.policy") && month6InFileMap.getString("POLICYTYPE").equals("I/O_L4")) { + guideFileCount += 1; + } else if (month6InFileMap.getString("PLMETHODID").equals("data.form")) { + formFileCount += 1; + } + } + } + fileCountMap.put("timeSlot","【6个月内】"); + fileCountMap.put("processFileCount",processFileCount); + fileCountMap.put("policyFileCount",policyFileCount); + fileCountMap.put("guideFileCount",guideFileCount); + fileCountMap.put("formFileCount",formFileCount); + fileCountMaps.add(fileCountMap); + + processFileCount = 0; + policyFileCount = 0; + guideFileCount = 0; + formFileCount = 0; + if (null!=year1InFileMaps && !year1InFileMaps.isEmpty()) { + for (RowMap year1InFileMap : year1InFileMaps) { + if (year1InFileMap.getString("PLMETHODID").equals("process.epc") || year1InFileMap.getString("PLMETHODID").equals("process.flowchart")) { + processFileCount += 1; + } else if (year1InFileMap.getString("PLMETHODID").equals("control.policy") && (year1InFileMap.getString("POLICYTYPE").equals("regulation") || null==year1InFileMap.getString("POLICYTYPE") || year1InFileMap.getString("POLICYTYPE").equals(""))) { + policyFileCount += 1; + } else if (year1InFileMap.getString("PLMETHODID").equals("control.policy") && year1InFileMap.getString("POLICYTYPE").equals("I/O_L4")) { + guideFileCount += 1; + } else if (year1InFileMap.getString("PLMETHODID").equals("data.form")) { + formFileCount += 1; + } + } + } + fileCountMap = new LinkedHashMap(); + fileCountMap.put("timeSlot","【6个月~1年】"); + fileCountMap.put("processFileCount",processFileCount); + fileCountMap.put("policyFileCount",policyFileCount); + fileCountMap.put("guideFileCount",guideFileCount); + fileCountMap.put("formFileCount",formFileCount); + fileCountMaps.add(fileCountMap); + + processFileCount = 0; + policyFileCount = 0; + guideFileCount = 0; + formFileCount = 0; + if (null!=year2InFileMaps && !year2InFileMaps.isEmpty()) { + for (RowMap year2InFileMap : year2InFileMaps) { + if (year2InFileMap.getString("PLMETHODID").equals("process.epc") || year2InFileMap.getString("PLMETHODID").equals("process.flowchart")) { + processFileCount += 1; + } else if (year2InFileMap.getString("PLMETHODID").equals("control.policy") && (year2InFileMap.getString("POLICYTYPE").equals("regulation") || null==year2InFileMap.getString("POLICYTYPE") || year2InFileMap.getString("POLICYTYPE").equals(""))) { + policyFileCount += 1; + } else if (year2InFileMap.getString("PLMETHODID").equals("control.policy") && year2InFileMap.getString("POLICYTYPE").equals("I/O_L4")) { + guideFileCount += 1; + } else if (year2InFileMap.getString("PLMETHODID").equals("data.form")) { + formFileCount += 1; + } + } + } + fileCountMap = new LinkedHashMap(); + fileCountMap.put("timeSlot","【1年~2年】"); + fileCountMap.put("processFileCount",processFileCount); + fileCountMap.put("policyFileCount",policyFileCount); + fileCountMap.put("guideFileCount",guideFileCount); + fileCountMap.put("formFileCount",formFileCount); + fileCountMaps.add(fileCountMap); + + processFileCount = 0; + policyFileCount = 0; + guideFileCount = 0; + formFileCount = 0; + if (null!=year3InFileMaps && !year3InFileMaps.isEmpty()) { + for (RowMap year3InFileMap : year3InFileMaps) { + if (year3InFileMap.getString("PLMETHODID").equals("process.epc") || year3InFileMap.getString("PLMETHODID").equals("process.flowchart")) { + processFileCount += 1; + } else if (year3InFileMap.getString("PLMETHODID").equals("control.policy") && (year3InFileMap.getString("POLICYTYPE").equals("regulation") || null==year3InFileMap.getString("POLICYTYPE") || year3InFileMap.getString("POLICYTYPE").equals(""))) { + policyFileCount += 1; + } else if (year3InFileMap.getString("PLMETHODID").equals("control.policy") && year3InFileMap.getString("POLICYTYPE").equals("I/O_L4")) { + guideFileCount += 1; + } else if (year3InFileMap.getString("PLMETHODID").equals("data.form")) { + formFileCount += 1; + } + } + } + fileCountMap = new LinkedHashMap(); + fileCountMap.put("timeSlot","【2年~3年】"); + fileCountMap.put("processFileCount",processFileCount); + fileCountMap.put("policyFileCount",policyFileCount); + fileCountMap.put("guideFileCount",guideFileCount); + fileCountMap.put("formFileCount",formFileCount); + fileCountMaps.add(fileCountMap); + + processFileCount = 0; + policyFileCount = 0; + guideFileCount = 0; + formFileCount = 0; + if (null!=year3OutFileMaps && !year3OutFileMaps.isEmpty()) { + for (RowMap year3OutFileMap : year3OutFileMaps) { + if (year3OutFileMap.getString("PLMETHODID").equals("process.epc") || year3OutFileMap.getString("PLMETHODID").equals("process.flowchart")) { + processFileCount += 1; + } else if (year3OutFileMap.getString("PLMETHODID").equals("control.policy") && (year3OutFileMap.getString("POLICYTYPE").equals("regulation") || null==year3OutFileMap.getString("POLICYTYPE") || year3OutFileMap.getString("POLICYTYPE").equals(""))) { + policyFileCount += 1; + } else if (year3OutFileMap.getString("PLMETHODID").equals("control.policy") && year3OutFileMap.getString("POLICYTYPE").equals("I/O_L4")) { + guideFileCount += 1; + } else if (year3OutFileMap.getString("PLMETHODID").equals("data.form")) { + formFileCount += 1; + } + } + } + fileCountMap = new LinkedHashMap(); + fileCountMap.put("timeSlot","【3年以上】"); + fileCountMap.put("processFileCount",processFileCount); + fileCountMap.put("policyFileCount",policyFileCount); + fileCountMap.put("guideFileCount",guideFileCount); + fileCountMap.put("formFileCount",formFileCount); + fileCountMaps.add(fileCountMap); + + ro.put("fileCount",fileCountMaps); + + return ro.toString(); + } + + /** + * @methodName: + * @param: + * @return: + * @description:引用情况分析筛选条件:发布单位、所属领域、文件类型 + * @auther: Lizj + * @date: 2022/6/28 23:00 + */ + public String queryTerms7(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + //发布单位 + List deptMaps = DBSql.getMaps("SELECT ID,PARENTDEPARTMENTID,DEPARTMENTNAME,LAYER,ORDERINDEX FROM ORGDEPARTMENT" + + " WHERE COMPANYID='8911e732-b42a-4556-853f-ad32761bcbee' AND CLOSED='0'"); + //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("1",deptNodes,"0","dept","3",null); + //所属领域 + ArrayList frameList = new ArrayList<>(); + ArrayList fieldMaps = new ArrayList<>(); + List L1Maps = DBSql.getMaps("SELECT FRAMEID,FRAMENAME,FRAMETYPE,FRAMEORDERINDEX FROM BO_EU_PAL_FRAME WHERE FRAMELEVEL=1 AND FRAMETYPE IS NOT NULL "); + String hasRoot = "Y"; + if (null != L1Maps && !L1Maps.isEmpty()) { + for (RowMap l1Map : L1Maps) { + String L1ID = l1Map.getString("FRAMEID"); + frameList = new ArrayList<>(); + frameList = GetNodesUtil.getChildFrame(L1ID, hasRoot, frameList); + fieldMaps.addAll(frameList); + } + } + ArrayList fieldNodes = new ArrayList<>(); + for (Map fieldMap : fieldMaps) { + HashMap fieldNode = new HashMap<>(); + fieldNode.put("ID", String.valueOf(fieldMap.get("FRAMEID"))); + fieldNode.put("PARENTID", String.valueOf(fieldMap.get("FRAMEPARENTID"))); + fieldNode.put("name", String.valueOf(fieldMap.get("FRAMENAME"))); + fieldNode.put("ORDERINDEX", Integer.valueOf(String.valueOf(fieldMap.get("FRAMEORDERINDEX")))); + fieldNode.put("TLEVEL", Integer.valueOf(String.valueOf(fieldMap.get("FRAMELEVEL")))); + fieldNodes.add(fieldNode); + } + List fieldTreeNodes = TreeUtil.buildTree("1",fieldNodes, "process", null, null, null); + ro.put("deptTreeNodes",deptTreeNodes); + ro.put("fieldTreeNodes",fieldTreeNodes); + //文件类型 + HashMap fileType = new HashMap<>(); + ArrayList fileTypes = new ArrayList<>(); + 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/6/28 23:03 + */ + public String citationAnalysis(UserContext uc, RequestParams params) { + ResponseObject ro = ResponseObject.newOkResponse(); + String unit = params.get("unit"); + String field = params.get("field"); + String fileType = params.get("fileType"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ArrayList deptIDList = new ArrayList<>(); + ArrayList fieldList = new ArrayList<>(); + List fileRowMaps = DBSql.getMaps("SELECT FILEID,PLMETHODID,POLICYTYPE,PLPARENTID,PUBDEPT,MODIFYDATETIME,RELEVANTFILE,SUPPORTFILE FROM BO_EU_PAL_FILE1 WHERE FILESTATE='1'"); + List fileRowMaps1 = fileRowMaps; + ArrayList fileHandleMaps = new ArrayList<>(); + if (null!=fileType && !fileType.equals("")) { + fileHandleMaps = new ArrayList<>(); + if (fileType.equals("processFile")) { + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PLMETHODID").equals("process.epc") || fileRowMap1.getString("PLMETHODID").equals("process.flowchart")) { + fileHandleMaps.add(fileRowMap1); + } + } + } + if (fileType.equals("policyFile")) { + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PLMETHODID").equals("control.policy") && (fileRowMap1.getString("POLICYTYPE").equals("regulation") || null==fileRowMap1.getString("POLICYTYPE") || fileRowMap1.getString("POLICYTYPE").equals(""))) { + fileHandleMaps.add(fileRowMap1); + } + } + } + if (fileType.equals("guideFile")) { + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PLMETHODID").equals("control.policy") && fileRowMap1.getString("POLICYTYPE").equals("I/O_L4")) { + fileHandleMaps.add(fileRowMap1); + } + } + } + if (fileType.equals("formFile")) { + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PLMETHODID").equals("data.form")) { + fileHandleMaps.add(fileRowMap1); + } + } + } + fileRowMaps1 = fileHandleMaps; + } + if (null!=unit && !unit.equals("")) { + fileHandleMaps = new ArrayList<>(); + deptIDList = new ArrayList(); + deptIDList = GetNodesUtil.getChildDept(unit, deptIDList); + for (String deptID : deptIDList) { + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PUBDEPT").contains(deptID)) { + fileHandleMaps.add(fileRowMap1); + } + } + } + fileRowMaps1 = fileHandleMaps; + } + if (null!=field && !field.equals("")) { + fileHandleMaps = new ArrayList<>(); + fieldList = new ArrayList(); + fieldList = GetNodesUtil.getChildFrame(field,"", fieldList); + for (Map fieldMap : fieldList) { + String fieldID = String.valueOf(fieldMap.get("FRAMEID")); + for (RowMap fileRowMap1 : fileRowMaps1) { + if (fileRowMap1.getString("PLPARENTID").equals(fieldID)) { + fileHandleMaps.add(fileRowMap1); + } + } + } + fileRowMaps1 = fileHandleMaps; + } + + /*1)文件引用率=某范围中文件出现在其他文件的“相关文件”“支持文件”字段的次数总和/所有文件总数 + 2)平均被引用次数=某范围中文件出现在其他文件的“相关文件”“支持文件”字段的次数总和/对应范围的文件总数 + 3)本月新增引用次数=本月某范围中文件出现在其他文件的“相关文件”“支持文件”字段的次数总和 减去 上月某范围中文件出现在其他文件的“相关文件”“支持文件”字段的次数总和*/ + NumberFormat numberformat = NumberFormat.getInstance(); + numberformat.setMaximumFractionDigits(2); + Integer appearNum = 0; + Integer fileTotalNum = fileRowMaps.size(); + Integer fileRageNum = fileRowMaps1.size(); + Integer lastNum = 0; + Integer nowNum = 0; + LinkedHashMap quoteDetail = new LinkedHashMap<>(); + String quoteRate = "0"; + String quoteAvg = "0"; + Integer quoteAdded = 0; + String quoteAddedString = "0"; + //本月、上月 + LocalDate nowDate = LocalDate.now(); + int nowMonth = nowDate.getMonthValue(); + int lastMonth = nowDate.minusMonths(1).getMonthValue(); + if ((null==fileType || fileType.equals("")) && (null==unit || unit.equals("")) && (null==field || field.equals(""))) { + appearNum = DBSql.getInt("SELECT COUNTOFGROUP AS appearNum FROM BO_EU_PAL_FILE_GROUPCOUNT WHERE GROUPIDMAIN='appearNum' AND GROUPIDEXT1='total'", "appearNum"); + lastNum = DBSql.getInt("SELECT COUNTOFGROUP AS lastNum FROM BO_EU_PAL_FILE_GROUPCOUNT WHERE GROUPIDMAIN='lastNum' AND GROUPIDEXT1='total'", "lastNum"); + nowNum = DBSql.getInt("SELECT COUNTOFGROUP AS nowNum FROM BO_EU_PAL_FILE_GROUPCOUNT WHERE GROUPIDMAIN='nowNum' AND GROUPIDEXT1='total'", "nowNum"); + if (fileTotalNum!=0) { + quoteRate = numberformat.format((float) appearNum / (float) fileTotalNum * 100); + } else { + quoteRate = "0"; + } + if (fileRageNum!=0) { + quoteAvg = numberformat.format((float) appearNum / (float) fileRageNum); + } else { + quoteAvg ="0"; + } + quoteAdded = nowNum - lastNum; + + if (quoteAdded>=100) { + quoteAddedString = numberformat.format((float) quoteAdded / 10); + } else if (quoteAdded>=1000) { + quoteAddedString = numberformat.format((float) quoteAdded / 100); + } else if (quoteAdded>=10000) { + quoteAddedString = numberformat.format((float) quoteAdded / 1000); + } + quoteDetail = new LinkedHashMap<>(); + quoteDetail.put("quoteAvg",quoteAvg); + quoteDetail.put("quoteAdded",quoteAddedString); + ro.put("quoteRate", quoteRate); + ro.put("quoteDetail", quoteDetail); + return ro.toString(); + } + if (null!=fileRowMaps1 && fileRowMaps1.isEmpty()==false) { + for (RowMap fileRowMap1 : fileRowMaps1) { + String FILEID = fileRowMap1.getString("FILEID"); + for (RowMap fileRowMap : fileRowMaps) { + String RELEVANTFILE = fileRowMap.getString("RELEVANTFILE"); + String SUPPORTFILE = fileRowMap.getString("SUPPORTFILE"); + if (null!=RELEVANTFILE && !RELEVANTFILE.equals("")) { + if (RELEVANTFILE.contains(FILEID)) { + appearNum += 1; + } + } + if (null!=SUPPORTFILE && !SUPPORTFILE.equals("")) { + if (SUPPORTFILE.contains(FILEID)) { + appearNum += 1; + } + } + Timestamp MODIFYDATETIME = fileRowMap.getTimestamp("MODIFYDATETIME"); + String modifyTimeString= sdf.format(MODIFYDATETIME); + LocalDateTime modifyDatetime = LocalDateTime.parse(modifyTimeString, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + if (modifyDatetime.getMonthValue()<=nowMonth) { + if (null!=RELEVANTFILE && !RELEVANTFILE.equals("")) { + if (RELEVANTFILE.contains(FILEID)) { + nowNum += 1; + } + } + if (null!=SUPPORTFILE && !SUPPORTFILE.equals("")) { + if (SUPPORTFILE.contains(FILEID)) { + nowNum += 1; + } + } + } + if (modifyDatetime.getMonthValue()<=lastMonth) { + if (null!=RELEVANTFILE && !RELEVANTFILE.equals("")) { + if (RELEVANTFILE.contains(FILEID)) { + lastNum += 1; + } + } + if (null!=SUPPORTFILE && !SUPPORTFILE.equals("")) { + if (SUPPORTFILE.contains(FILEID)) { + lastNum += 1; + } + } + } + } + } + quoteRate = numberformat.format((float) appearNum / (float) fileTotalNum * 100); + quoteAvg = numberformat.format((float) appearNum / (float) fileRageNum); + quoteAdded = nowNum - lastNum; + quoteDetail = new LinkedHashMap<>(); + quoteDetail.put("quoteAvg",quoteAvg); + quoteDetail.put("quoteAdded",quoteAdded); + ro.put("quoteRate", quoteRate); + ro.put("quoteDetail", quoteDetail); + return ro.toString(); + } else { + ro.ok("暂无文件"); + quoteDetail = new LinkedHashMap<>(); + quoteDetail.put("quoteAvg","0"); + quoteDetail.put("quoteAdded",0); + ro.put("quoteRate", "0"); + ro.put("quoteDetail", quoteDetail); + return ro.toString(); + } + } + +} diff --git a/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/JwtUtils.java b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/JwtUtils.java new file mode 100644 index 00000000..a792f442 --- /dev/null +++ b/com.awspaas.user.apps.yili.reportform/src/com/awspaas/user/apps/yili/reportform/util/JwtUtils.java @@ -0,0 +1,213 @@ +package com.awspaas.user.apps.yili.reportform.util; + +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.DatatypeConverter; + +import cn.jpush.api.utils.StringUtils; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +/** + * @author neil + * @date 2022/10/08 + */ +public class JwtUtils { + // JWT 密钥 + private static String secretKey="8944878877848fg)"; + //刷新token的过期时间 + private static Duration accessTokenExpireTime=Duration.parse("PT24H"); + //private static Duration accessTokenExpireTime=Duration.parse("PT60S"); + //刷新tokenPC端是8小时 + private static Duration refreshTokenExpireTime=Duration.parse("PT8H") ; + //刷新tokenAPP端是一个月 + private static Duration refreshTokenExpireAppTime=Duration.parse("P30D") ; + //签发人 + private static String issuer="ws"; + + /** + * 生成 access_token + */ + public static String getAccessToken(String subject, Map claims){ + return generateToken(issuer,subject,claims,accessTokenExpireTime.toMillis(),secretKey); + } + + /** + * 签发token + */ + public static String generateToken(String issuer, String subject, Map claims, long ttlMillis, String secret) { + + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; + + long nowMillis = System.currentTimeMillis(); + Date now = new Date(nowMillis); + + byte[] signingKey = DatatypeConverter.parseBase64Binary(secret); + + JwtBuilder builder = Jwts.builder(); + if(null!=claims){ + builder.setClaims(claims); + } + if (!StringUtils.isEmpty(subject)) { + builder.setSubject(subject); + } + if (!StringUtils.isEmpty(issuer)) { + builder.setIssuer(issuer); + } + builder.setIssuedAt(now); + if (ttlMillis >= 0) { + long expMillis = nowMillis + ttlMillis; + Date exp = new Date(expMillis); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String format = simpleDateFormat.format(exp); + System.out.println(format); + builder.setExpiration(exp); + } + builder.signWith(signatureAlgorithm, signingKey); + return builder.compact(); + } + + /** + * TODO 上面我们已经有生成 access_token 的方法,下面加入生成 refresh_token 的方法(PC 端过期时间短一些) + */ + + /** + * 生成 PC 刷新token + */ + public static String getRefreshToken(String subject,Map claims){ + return generateToken(issuer,subject,claims,refreshTokenExpireTime.toMillis(),secretKey); + } + + /** + * 生成 App端 刷新token + */ + public static String getRefreshAppToken(String subject,Map claims){ + return generateToken(issuer,subject,claims,refreshTokenExpireAppTime.toMillis(),secretKey); + } + + /** + * 从令牌中获取数据声明 + */ + public static Claims getClaimsFromToken(String token) { + Claims claims; + try { + claims = Jwts.parser().setSigningKey(DatatypeConverter.parseBase64Binary(secretKey)).parseClaimsJws(token).getBody(); + } catch (Exception e) { + claims = null; + //FineLoggerFactory.getLogger().error ("jwt从令牌中获取数据声明={}",e); + } + return claims; + } + + /** + * 获取用户id + */ + public static String getUserId(String token){ + String userId=null; + try { + Claims claims = getClaimsFromToken(token); + userId = claims.getSubject(); + } catch (Exception e) { + //FineLoggerFactory.getLogger().error ("jwt获取用户id抛出的异常={}",e); + } + return userId; + } + + /** + * 获取用户名 + */ + public static String getUserName(String token){ + String username = null; + try { + Claims claims = getClaimsFromToken(token); + username = (String) claims .get("userName"); + } catch (Exception e) { + //FineLoggerFactory.getLogger().error ("jwt获取获取用户名抛出的异常={}",e); + } + return username; + } + + /** + * 验证token 是否过期 + */ + public static Boolean isTokenExpired(String token) { + try { + //使用密钥解析 + Claims claims = getClaimsFromToken(token); + //拿到过期时间 + Date expiration = claims.getExpiration(); + //与当前时间进行比较 + return expiration.before(new Date()); + } catch (Exception e) { + System.out.println("验证token是否过期时候抛出的异常"+e); + return true; + } + } + + /** + * 校验令牌 + */ + public static Boolean validateToken(String token) { + //通过getClaimsFromToken解析传入的token + Claims claimsFromToken = getClaimsFromToken(token); + //校验是否为空,判断是否过期 + return (claimsFromToken!=null && !isTokenExpired(token)); + } + + /** + * 刷新token + */ + public static String refreshToken(String refreshToken,Map claims) { + String refreshedToken; + try { + //通过getClaimsFromToken解析传入的token + Claims parserclaims = getClaimsFromToken(refreshToken); + /** + * 刷新token的时候如果为空说明原先的 用户信息不变 所以就引用上个token里的内容 + */ + if(null==claims){ + claims=parserclaims; + } + refreshedToken = generateToken(parserclaims.getIssuer(),parserclaims.getSubject(),claims,accessTokenExpireTime.toMillis(),secretKey); + } catch (Exception e) { + refreshedToken = null; + System.out.println("刷新token时候抛出异常="+e); + } + return refreshedToken; + } + + /** + * 获取token的剩余过期时间 + */ + public static long getRemainingTime(String token){ + long result=0; + try { + long nowMillis = System.currentTimeMillis(); + result= getClaimsFromToken(token).getExpiration().getTime()-nowMillis; + } catch (Exception e) { + System.out.println("获取token的剩余过期时间时候抛出异常="+e); + } + return result; + } + + /** + * 模拟生产jwt_token + * @param args +*/ + public static void main(String[] args) { + Map claims = new HashMap<> (); + claims.put("userName","10036614"); + //生成token + String jwt_token = JwtUtils.getAccessToken ("userId",claims); + System.out.println ("jwt_token="+jwt_token); + String username = JwtUtils.getUserName (jwt_token); + System.out.println ("userName="+username); + } + +}