From 1ac9f3203b670bfde80993185acd9707884988f4 Mon Sep 17 00:00:00 2001 From: Mr-wang Date: Wed, 21 Sep 2022 14:04:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=8A=E5=88=A9=E6=8E=A5=E5=8F=A3=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GetSomeIndexController.java | 19 + .../controller/GetmeritsController.java | 716 +++++++++++ .../event/ProcessEndAfterEvent.java | 1135 +++++++++-------- .../job/CreateWorkflowServiceJob.java | 521 ++++++-- .../job/CreategetFlowListALLByWfidJob.java | 79 ++ .../job/CreategetFlowListByWfidJob.java | 102 ++ .../user/apps/integration/job/UpdateOA.java | 54 + .../integration/job/UpdateOADAIBANJob.java | 75 ++ .../apps/integration/job/deleteTestBO.java | 5 +- .../user/apps/integration/job/getAllOA.java | 16 + .../apps/integration/oa/OaPendComponent.java | 30 +- .../apps/integration/oa/TaskListener.java | 2 +- .../apps/integration/oauth/OauthLogin.java | 11 + .../integration/oauth/TaskController.java | 80 +- .../integration/util/ChineseIntoLetters.java | 222 ++++ .../user/apps/integration/util/JDBCUtil.java | 34 + .../apps/integration/webapi/Sayhello.java | 291 +++++ .../apps/integration/webapi/WorkFlowAPI.java | 125 ++ 18 files changed, 2797 insertions(+), 720 deletions(-) create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetSomeIndexController.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreategetFlowListByWfidJob.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOA.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/getAllOA.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/ChineseIntoLetters.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/JDBCUtil.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/Sayhello.java create mode 100644 com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/WorkFlowAPI.java diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetSomeIndexController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetSomeIndexController.java new file mode 100644 index 00000000..8e81e4e2 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetSomeIndexController.java @@ -0,0 +1,19 @@ +package com.awspaas.user.apps.integration.controller; + +import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; +import com.actionsoft.bpms.server.bind.annotation.Controller; +import com.actionsoft.bpms.server.bind.annotation.Mapping; + +import java.util.LinkedHashMap; + +@Controller +public class GetSomeIndexController { + @Mapping(value = "com.awspaas.user.apps.integration.controller.GetSomeIndexController.toIndex",session = false, + noSessionEvaluate = "无安全隐患", + noSessionReason = "模拟登陆获取sid") +public String toIndex(){ + return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration","domainprocess.html",new LinkedHashMap<>()); +} + + + } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java new file mode 100644 index 00000000..1b7c085a --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/GetmeritsController.java @@ -0,0 +1,716 @@ +package com.awspaas.user.apps.integration.controller; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.commons.database.RowMap; +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.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang.StringUtils; + +import java.util.*; + +@Controller +public class GetmeritsController { + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getMetritsFirst") + public JSONObject getMetritsFirst(String sid,String departname){ + JSONObject result = new JSONObject(new LinkedHashMap<>()); + List list = new ArrayList(new LinkedList()); + list.add(0,""); + list.add(1,"L1流程架构"); + list.add(2,"绩效指标"); + result.put("headtop",list); + if (StringUtils.isEmpty(departname)){ + + + /** + * 战略流程 + */ + JSONArray jsonArray1 =new JSONArray(new LinkedList<>()); + JSONObject json_first = new JSONObject(new LinkedHashMap<>()); + json_first.put("leftname","战略流程"); + JSONArray secondcont = new JSONArray(); + JSONArray num1 = new JSONArray(); + List list1 = SDK.getBOAPI().query("BO_EU_LCJG", true).addQuery("JG_NAME=", "战略流程").orderByCreated().asc().list(); + for (BO bo:list1 + ) { + JSONObject jsonObject_se = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + String name = bo.getString("LC_NAME").substring(bo.getString("LC_NAME").indexOf(" ")+1,bo.getString("LC_NAME").length()); + jsonObject_se.put("name",bo.getString("LC_NAME")); + + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+bo.getString("LC_NAME")+"' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + RowMap maps = DBSql.getMap(sql); + jsonObject_se.put("id",maps.getString("ID")); + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where like '%" +name + "%'"); + jsonObject_name.put("name",string); + num1.add(jsonObject_name); + secondcont.add(jsonObject_se); + } + + json_first.put("secondcont",secondcont); + json_first.put("num1",num1); + + /** + * 运营流程 + */ + JSONObject json_second = new JSONObject(new LinkedHashMap<>()); + json_second.put("leftname","运营流程"); + JSONArray secondcont_second = new JSONArray(); + JSONArray num1_second = new JSONArray(); + List list1_second = SDK.getBOAPI().query("BO_EU_LCJG", true).addQuery("JG_NAME=", "运营流程").orderByCreated().asc().list(); + for (BO bo:list1_second + ) { + JSONObject jsonObject_se = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + jsonObject_se.put("name",bo.getString("LC_NAME")); + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+bo.getString("LC_NAME")+"' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + RowMap maps = DBSql.getMap(sql); + jsonObject_se.put("id",maps.getString("ID")); + String name = bo.getString("LC_NAME").substring(bo.getString("LC_NAME").indexOf(" ")+1,bo.getString("LC_NAME").length()); + + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%" +name + "%'"); + jsonObject_name.put("name",string); + num1_second.add(jsonObject_name); + secondcont_second.add(jsonObject_se); + } + + json_second.put("secondcont",secondcont_second); + json_second.put("num1",num1_second); + +/** + * 支持流程 + */ + +/** + * 运营流程 + */ + JSONObject json_thrid = new JSONObject(new LinkedHashMap<>()); + json_thrid.put("leftname","支持流程"); + JSONArray secondcont_thrid = new JSONArray(); + JSONArray num1_thrid = new JSONArray(); + List list1_thrid = SDK.getBOAPI().query("BO_EU_LCJG", true).addQuery("JG_NAME=", "支持流程").orderByCreated().asc().list(); + for (BO bo:list1_thrid + ) { + JSONObject jsonObject_se = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + jsonObject_se.put("name",bo.getString("LC_NAME")); + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+bo.getString("LC_NAME")+"' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + RowMap maps = DBSql.getMap(sql); + jsonObject_se.put("id",maps.getString("ID")); + String name = bo.getString("LC_NAME").substring(bo.getString("LC_NAME").indexOf(" ")+1,bo.getString("LC_NAME").length()); + + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%" +name+ "%'"); + jsonObject_name.put("name",string); + num1_thrid.add(jsonObject_name); + secondcont_thrid.add(jsonObject_se); + } + + json_thrid.put("secondcont",secondcont_thrid); + json_thrid.put("num1",num1_thrid); + jsonArray1.add(json_first); + jsonArray1.add(json_second); + jsonArray1.add(json_thrid); + result.put("content",jsonArray1); + return result; + }else{ + /** + * 战略流程 + */ + JSONArray jsonArray1 =new JSONArray(new LinkedList<>()); + JSONObject json_first = new JSONObject(new LinkedHashMap<>()); + json_first.put("leftname","战略流程"); + JSONArray secondcont = new JSONArray(); + JSONArray num1 = new JSONArray(); + List list1 = SDK.getBOAPI().query("BO_EU_LCJG", true).addQuery("JG_NAME=", "战略流程").orderByCreated().asc().list(); + for (BO bo:list1 + ) { + JSONObject jsonObject_se = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + String name = bo.getString("LC_NAME").substring(bo.getString("LC_NAME").indexOf(" ")+1,bo.getString("LC_NAME").length()); + jsonObject_se.put("name",bo.getString("LC_NAME")); + + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+bo.getString("LC_NAME")+"' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + RowMap maps = DBSql.getMap(sql); + jsonObject_se.put("id",maps.getString("ID")); + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%" +name + "%'"); + jsonObject_name.put("name",string); + num1.add(jsonObject_name); + secondcont.add(jsonObject_se); + } + + json_first.put("secondcont",secondcont); + json_first.put("num1",num1); + + /** + * 运营流程 + */ + JSONObject json_second = new JSONObject(new LinkedHashMap<>()); + json_second.put("leftname","运营流程"); + JSONArray secondcont_second = new JSONArray(); + JSONArray num1_second = new JSONArray(); + List list1_second = SDK.getBOAPI().query("BO_EU_LCJG", true).addQuery("JG_NAME=", "运营流程").orderByCreated().asc().list(); + for (BO bo:list1_second + ) { + JSONObject jsonObject_se = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + jsonObject_se.put("name",bo.getString("LC_NAME")); + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+bo.getString("LC_NAME")+"' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + RowMap maps = DBSql.getMap(sql); + jsonObject_se.put("id",maps.getString("ID")); + String name = bo.getString("LC_NAME").substring(bo.getString("LC_NAME").indexOf(" ")+1,bo.getString("LC_NAME").length()); + + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%" +name + "%'"); + jsonObject_name.put("name",string); + num1_second.add(jsonObject_name); + secondcont_second.add(jsonObject_se); + } + + json_second.put("secondcont",secondcont_second); + json_second.put("num1",num1_second); + +/** + * 支持流程 + */ + +/** + * 运营流程 + */ + JSONObject json_thrid = new JSONObject(new LinkedHashMap<>()); + json_thrid.put("leftname","支持流程"); + JSONArray secondcont_thrid = new JSONArray(); + JSONArray num1_thrid = new JSONArray(); + List list1_thrid = SDK.getBOAPI().query("BO_EU_LCJG", true).addQuery("JG_NAME=", "支持流程").orderByCreated().asc().list(); + for (BO bo:list1_thrid + ) { + JSONObject jsonObject_se = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + jsonObject_se.put("name",bo.getString("LC_NAME")); + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '"+bo.getString("LC_NAME")+"' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + RowMap maps = DBSql.getMap(sql); + jsonObject_se.put("id",maps.getString("ID")); + String name = bo.getString("LC_NAME").substring(bo.getString("LC_NAME").indexOf(" ")+1,bo.getString("LC_NAME").length()); + + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%" +name+ "%'"); + jsonObject_name.put("name",string); + num1_thrid.add(jsonObject_name); + secondcont_thrid.add(jsonObject_se); + } + + json_thrid.put("secondcont",secondcont_thrid); + json_thrid.put("num1",num1_thrid); + jsonArray1.add(json_first); + jsonArray1.add(json_second); + jsonArray1.add(json_thrid); + result.put("content",jsonArray1); + return result; + } + } + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getDepartname") + public JSONObject getDepartname(String sid){ + JSONObject result = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + List bo_eu_depat_name = SDK.getBOAPI().query("BO_EU_DEPAT_NAME", true).list(); + int i=0; + for (BO bo:bo_eu_depat_name + ) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("termsKey",i); + jsonObject.put("termsVal",bo.getString("DEPART_NAME")); + jsonArray.add(jsonObject); + i++; + } + result.put("result","ok"); + result.put("fileTypes",jsonArray); + return result; + } + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getFirst") + public JSONArray getFirst(String sid,String plid,String name){ + JSONArray jsonArray = new JSONArray(new LinkedList<>()); + String sql_parent = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+plid+"' order by PLORDERINDEX asc"; + List maps1 = DBSql.getMaps(sql_parent); + for (RowMap rowMap: maps1) { + JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); + jsonObject.put("text",rowMap.getString("PLNAME")); + jsonObject.put("href","#"); + String PLname = rowMap.getString("PLNAME").substring(rowMap.getString("PLNAME").indexOf(" ")+1,rowMap.getString("PLNAME").length()); + String names = name.substring(name.indexOf(" ")+1,name.length()); + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%"+names+"%' AND PROCESS_ARCHITECTURE_L2 like '%" + PLname + "%'"); + jsonObject.put("num",string); + JSONArray jsonArray1 = new JSONArray(new LinkedList<>()); + String sql_parent11 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+rowMap.getString("ID")+"' order by PLORDERINDEX asc"; + List maps111 = DBSql.getMaps(sql_parent11); + for (RowMap rowmap: maps111) { + JSONObject jsonObject1 = new JSONObject(new LinkedHashMap<>()); + jsonObject1.put("text",rowmap.getString("PLNAME")); + jsonObject1.put("href","#"); + String PLname1 = rowmap.getString("PLNAME").substring(rowmap.getString("PLNAME").indexOf(" ")+1,rowmap.getString("PLNAME").length()); + String names1 = rowMap.getString("PLNAME").substring(rowMap.getString("PLNAME").indexOf(" ")+1,rowMap.getString("PLNAME").length()); + String strings = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%"+names+"%' AND PROCESS_ARCHITECTURE_L3 like '%"+PLname1+"%' AND PROCESS_ARCHITECTURE_L2 like '%" + names1 + "%'"); + jsonObject1.put("num",strings); + jsonArray1.add(jsonObject1); + String sql_parent111 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = '"+rowmap.getString("ID")+"' order by PLORDERINDEX asc"; + List maps1111 = DBSql.getMaps(sql_parent111); + JSONArray jsonArray2 = new JSONArray(new LinkedList<>()); + for (RowMap map:maps1111 + ) { + JSONObject jsonObject2 = new JSONObject(new LinkedHashMap<>()); + jsonObject2.put("text",map.getString("PLNAME")); + jsonObject2.put("href","#"); + String PLname2 = map.getString("PLNAME").substring(map.getString("PLNAME").indexOf(" ")+1,map.getString("PLNAME").length()); + String names2 = rowmap.getString("PLNAME").substring(rowmap.getString("PLNAME").indexOf(" ")+1,rowmap.getString("PLNAME").length()); + String stringss = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PROCESS_ARCHITECTURE_L1 like '%"+PLname+"%' AND PROCESS_ARCHITECTURE_L3 like '%" + names2 + "%' AND PROCESS_ARCHITECTURE_L2 like '%"+PLname2+"%'"); + jsonObject2.put("num",stringss); + jsonArray2.add(jsonObject2); + } + //jsonObject1.put("nodes",jsonArray2); + } + jsonObject.put("nodes",jsonArray1); + jsonArray.add(jsonObject); + } + + + + return jsonArray; + } + + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getsecondDepartname") + public JSONArray getsecondDepartname(String sid){ + JSONArray result = new JSONArray(); + List bo_eu_depat_name = SDK.getBOAPI().query("BO_EU_DEPAT_NAME", true).list(); + int i=0; + for (BO bo:bo_eu_depat_name + ) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name",bo.getString("DEPART_NAME")); + result.add(jsonObject); + i++; + } + return result; + } + + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getL1Process") + public JSONObject getL1Process(String sid){ + JSONObject result = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + List maps = DBSql.getMaps(sql); int i=0; + for (RowMap rowMap:maps + ) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("termsKey",rowMap.getString("ID")); + jsonObject.put("termsVal",rowMap.getString("PLNAME")); + jsonArray.add(jsonObject); + i++; + } + result.put("result","ok"); + result.put("fileTypes",jsonArray); + return result; + } + + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getTable2Data") + public JSONObject getTable2Data(String sid,String plname,String departname) { + JSONObject result = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_content = new JSONArray(new LinkedList<>()); + + String id = DBSql.getString("select ID from APP_ACT_COE_PAL_REPOSITORY where PLNAME = '" + plname + "' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"); + + /** + * 这是L1的流程绩效数据汇总 + */ + JSONObject jsonObject1 = new JSONObject(new LinkedHashMap<>()); + String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + id + "' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLPARENTID = 'process' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + + RowMap map = DBSql.getMap(sql); + jsonObject1.put("leftname", "L1流程绩效指标"); + JSONArray jsonArray1 = new JSONArray(); + JSONObject jsonObject_secondcont = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_name = new JSONArray(new LinkedList<>()); + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + jsonObject_name.put("title", map.getString("PLNAME")); + jsonObject_name.put("id", map.getString("ID")); + jsonObject_name.put("incident", true); + String name = map.getString("PLNAME").substring(map.getString("PLNAME").indexOf(" ")+1); + List list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PROCESS_ARCHITECTURE_L1 like '%"+name+"%' ",null).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("PROCESS_ARCHITECTURE_L2 = ''", null).addQuery("PROCESS_ARCHITECTURE_L3 = ''", null).list(); + List list_child = new LinkedList(); + List linked_Waring = new LinkedList(); + int i = 0; + for (BO bo : list + ) { + list_child.add(i, bo.getString("PERFORMANCE_INDICATOR_NAME")); + linked_Waring.add(i, 10); + i++; + } + jsonObject_name.put("child", list_child); + jsonObject_name.put("Warning", linked_Waring); + jsonArray_name.add(jsonObject_name); + jsonObject_secondcont.put("name", jsonArray_name); + jsonObject_secondcont.put("list1", new LinkedList<>()); + jsonObject_secondcont.put("list2", new LinkedList<>()); + jsonObject_secondcont.put("list3", new LinkedList<>()); + jsonArray1.add(jsonObject_secondcont); + jsonObject1.put("secondcont", jsonArray1); + + /** + * L2流程数据汇总 + */ + String sqls = "select * from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID = '" + id + "' AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + + List maps = DBSql.getMaps(sqls); + + String ids = ""; + + JSONObject jsonObject2 = new JSONObject(new LinkedHashMap<>()); + + jsonObject2.put("leftname", "L2流程绩效指标"); + JSONArray jsonArray2 = new JSONArray(); + JSONObject jsonObject_secondcont2 = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_name2 = new JSONArray(new LinkedList<>()); + for (RowMap rowmap : maps + ) { + ids+=rowmap.getString("ID")+","; + + JSONObject jsonObject_name2 = new JSONObject(new LinkedHashMap<>()); + jsonObject_name2.put("title", rowmap.getString("PLNAME")); + jsonObject_name2.put("id", rowmap.getString("ID")); + jsonObject_name2.put("incident", true); + String name2 = rowmap.getString("PLNAME").substring(rowmap.getString("PLNAME").indexOf(" ")+1);; + List lists = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PROCESS_ARCHITECTURE_L1 like '%"+name+"%' ",null).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("PROCESS_ARCHITECTURE_L2 like '%"+name2+"%' ", null).addQuery("PROCESS_ARCHITECTURE_L3 = ''", null).list(); + List list_childs = new LinkedList(); + int j = 0; + for (BO bo : lists + ) { + list_childs.add(j, bo.getString("PERFORMANCE_INDICATOR_NAME")); + j++; + } + jsonObject_name2.put("child", list_childs); + jsonArray_name2.add(jsonObject_name2); + + } + jsonObject_secondcont2.put("name", jsonArray_name2); + jsonObject_secondcont2.put("list1", new LinkedList<>()); + jsonObject_secondcont2.put("list2", new LinkedList<>()); + jsonObject_secondcont2.put("list3", new LinkedList<>()); + jsonArray2.add(jsonObject_secondcont2); + jsonObject2.put("secondcont",jsonArray2); + String dleass = ""; + String[] deptSplit = ids.split(","); + if(deptSplit.length==1){ + dleass = "'"+deptSplit[0]+"'"; + } + dleass ="'"+ StringUtils.join(deptSplit, "','")+"'"; + System.out.println( + "dleass》》》》》》》》》》"+dleass + ); + +/** + * 关联流程清单 + */ + JSONObject jsonObject4 = new JSONObject(new LinkedHashMap<>()); + jsonObject4.put("leftname", "关联流程清单"); + JSONArray jsonArray4_secondcont = new JSONArray(new LinkedList<>()); + JSONObject jsonObject4_secondcont = new JSONObject(new LinkedHashMap<>()); + jsonObject4_secondcont.put("name",new LinkedList<>()); + jsonObject4_secondcont.put("list1",new LinkedList<>()); + jsonObject4_secondcont.put("list2",new LinkedList<>()); + jsonObject4_secondcont.put("list3",new LinkedList<>()); + jsonArray4_secondcont.add(jsonObject4_secondcont); + jsonObject4.put("secondcont",jsonArray4_secondcont); + /** + * L3流程数据汇总 + */ + + + + + JSONObject jsonObject3 = new JSONObject(new LinkedHashMap<>()); + + jsonObject3.put("leftname", "L3流程绩效指标"); + JSONArray jsonArray3 = new JSONArray(); + + List list_num = new LinkedList(); + int q=0; + String[] plid = dleass.split(","); + for (String ikds:plid + ) { + String sqls3 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID = "+ikds+" AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + + List mapss = DBSql.getMaps(sqls3); + for (RowMap rowmaps : mapss) { + String name2 = rowmaps.getString("PLNAME").substring(rowmaps.getString("PLNAME").indexOf(" ") + 1); + ; + + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PERFORMANCE_TYPE = 'L1L3流程绩效' and PROCESS_ARCHITECTURE_L3 like '%" + name2 + "%'"); + list_num.add(q, Integer.valueOf(string)); + q++; + } + } + + Integer max = Collections.max(list_num); + if (max==0){ + max=3; + } + + Map> map_list = new HashMap>(); + for(int h = 0;h()); + } + JSONObject jsonObject_secondcont3 = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_name3 = new JSONArray(new LinkedList<>()); + + for (String ikds:plid + ) { + String sqls3 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID = "+ikds+" AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + + List mapss = DBSql.getMaps(sqls3); + + for (RowMap rowmaps : mapss + ) { + + + JSONObject jsonObject_name3 = new JSONObject(new LinkedHashMap<>()); + jsonObject_name3.put("title", rowmaps.getString("PLNAME")); + jsonObject_name3.put("id", rowmaps.getString("ID")); + jsonObject_name3.put("incident", true); + String name2 = rowmaps.getString("PLNAME").substring(rowmaps.getString("PLNAME").indexOf(" ")+1);; + List lists = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("PROCESS_ARCHITECTURE_L3 like '%"+name2+"%'", null).list(); + List list_childs = new LinkedList(); + jsonObject_name3.put("child", list_childs); + jsonArray_name3.add(jsonObject_name3); + + } + } + jsonObject_secondcont3.put("name", jsonArray_name3); + + int r=0; + + String sqls3 = "select * from APP_ACT_COE_PAL_REPOSITORY where PLPARENTID in (" + dleass + ") AND PLCATEGORY = 'process'and PLMETHODID ='process.framework' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试' ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试') and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e', 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09', '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5', '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093', '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c', '42c09260-c1d3-44b7-ac3d-f8280e04c294') order by PLORDERINDEX asc"; + + List mapss = DBSql.getMaps(sqls3); + for (RowMap rowmaps : mapss) { + String name2 = rowmaps.getString("PLNAME").substring(rowmaps.getString("PLNAME").indexOf(" ") + 1); + ; + List lists = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PERFORMANCE_TYPE=", "L1L3流程绩效").addQuery("PROCESS_ARCHITECTURE_L3 like '%" + name2 + "%'", null).list(); + + for (int w = 0; w < lists.size(); w++) { + map_list.get(String.valueOf(w)).add(r, lists.get(w).getString("PERFORMANCE_INDICATOR_NAME")); + } + if (lists.size() < map_list.size()) { + for (int u = lists.size(); u < map_list.size(); u++) { + map_list.get(String.valueOf(u)).add(r, ""); + } + + } + r++; + + } + for (int t=0;t(); + lisr.add(1); + lisr.add(2); + lisr.add(4); + result.put("yunxing",lisr); + + return result; + } + + @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.tabledrag") + public JSONObject tabledrag(String sid,String id){ + JSONObject result = new JSONObject(new LinkedHashMap<>()); + List list = new LinkedList(); + list.add("流程绩效指标"); + list.add("衡量单位"); + list.add("跟踪频率"); + list.add("计算公式"); + list.add("数据来源"); + result.put("headtop",list); + JSONArray jsonArray = new JSONArray(new LinkedList<>()); + JSONObject jsonObject_contant = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_secondcont = new JSONArray(new LinkedList<>()); + JSONArray jsonArray_num1 = new JSONArray(new LinkedList<>()); + JSONArray jsonArray_num2 = new JSONArray(new LinkedList<>()); + JSONArray jsonArray_num3 = new JSONArray(new LinkedList<>()); + JSONArray jsonArray_num4 = new JSONArray(new LinkedList<>()); + RowMap rowMap = DBSql.getMap("select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + id + "'"); + + + if (rowMap.getString("PLPARENTID").equals("process")){ + String Planme = rowMap.getString("PLNAME").substring(rowMap.getString("PLNAME").indexOf(" ") + 1); + List bo_eu_per_ind_lib = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PROCESS_ARCHITECTURE_L1 like '%" + Planme + "%'", null).addQuery("PROCESS_ARCHITECTURE_L2 = ''", null).addQuery("PROCESS_ARCHITECTURE_L3 = ''", null).addQuery("PERFORMANCE_TYPE=","末级流程绩效") .list(); + + for (BO bo: + bo_eu_per_ind_lib) { + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num1 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num2 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num3 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num4 = new JSONObject(new LinkedHashMap<>()); + if (StringUtils.isNotEmpty(bo.getString("PERFORMANCE_INDICATOR_NAME"))){ + jsonObject_name.put("name",bo.getString("PERFORMANCE_INDICATOR_NAME")); + }else { + jsonObject_name.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("UNIT_MEASUREMENT"))){ + jsonObject_num1.put("name",bo.getString("UNIT_MEASUREMENT")); + }else { + jsonObject_num1.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("STATISTICAL_PERIOD"))){ + jsonObject_num2.put("name",bo.getString("STATISTICAL_PERIOD")); + }else { + jsonObject_num2.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("COMPUTATIONAL_FORMULA"))){ + jsonObject_num3.put("name",bo.getString("COMPUTATIONAL_FORMULA")); + }else { + jsonObject_num3.put("name","/"); + } + if (StringUtils.isNotEmpty(bo.getString("DATA_SOURCES"))){ + jsonObject_num4.put("name",bo.getString("DATA_SOURCES")); + }else { + jsonObject_num4.put("name","/"); + } + jsonArray_secondcont.add(jsonObject_name); + jsonArray_num1.add(jsonObject_num1); + jsonArray_num2.add(jsonObject_num2); + jsonArray_num3.add(jsonObject_num3); + jsonArray_num4.add(jsonObject_num4); + } + jsonObject_contant.put("secondcont",jsonArray_secondcont); + jsonObject_contant.put("num1",jsonArray_num1); + jsonObject_contant.put("num2",jsonArray_num2); + jsonObject_contant.put("num3",jsonArray_num3); + jsonObject_contant.put("num4",jsonArray_num4); + jsonArray.add(jsonObject_contant); + result.put("content",jsonArray); + }else { + RowMap rowMap1 = DBSql.getMap("select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + rowMap.getString("PLPARENTID") + "'"); + if (rowMap1.getString("PLPARENTID").equals("process")){ + String Planme = rowMap1.getString("PLNAME").substring(rowMap1.getString("PLNAME").indexOf(" ") + 1); + List bo_eu_per_ind_lib = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PROCESS_ARCHITECTURE_L2 like '%" + Planme + "%'", null).addQuery("PROCESS_ARCHITECTURE_L3 = ''", null).addQuery("PERFORMANCE_TYPE=","末级流程绩效").list(); + for (BO bo: + bo_eu_per_ind_lib) { + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num1 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num2 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num3 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num4 = new JSONObject(new LinkedHashMap<>()); + if (StringUtils.isNotEmpty(bo.getString("PERFORMANCE_INDICATOR_NAME"))){ + jsonObject_name.put("name",bo.getString("PERFORMANCE_INDICATOR_NAME")); + }else { + jsonObject_name.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("UNIT_MEASUREMENT"))){ + jsonObject_num1.put("name",bo.getString("UNIT_MEASUREMENT")); + }else { + jsonObject_num1.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("STATISTICAL_PERIOD"))){ + jsonObject_num2.put("name",bo.getString("STATISTICAL_PERIOD")); + }else { + jsonObject_num2.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("COMPUTATIONAL_FORMULA"))){ + jsonObject_num3.put("name",bo.getString("COMPUTATIONAL_FORMULA")); + }else { + jsonObject_num3.put("name","/"); + } + if (StringUtils.isNotEmpty(bo.getString("DATA_SOURCES"))){ + jsonObject_num4.put("name",bo.getString("DATA_SOURCES")); + }else { + jsonObject_num4.put("name","/"); + } + jsonArray_secondcont.add(jsonObject_name); + jsonArray_num1.add(jsonObject_num1); + jsonArray_num2.add(jsonObject_num2); + jsonArray_num3.add(jsonObject_num3); + jsonArray_num4.add(jsonObject_num4); + } + jsonObject_contant.put("secondcont",jsonArray_secondcont); + jsonObject_contant.put("num1",jsonArray_num1); + jsonObject_contant.put("num2",jsonArray_num2); + jsonObject_contant.put("num3",jsonArray_num3); + jsonObject_contant.put("num4",jsonArray_num4); + jsonArray.add(jsonObject_contant); + result.put("content",jsonArray); + }else{ + String Planme = rowMap.getString("PLNAME").substring(rowMap.getString("PLNAME").indexOf(" ") + 1); + List bo_eu_per_ind_lib = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PROCESS_ARCHITECTURE_L3 like '%" + Planme + "%'", null).addQuery("PERFORMANCE_TYPE=","末级流程绩效").list(); + for (BO bo: + bo_eu_per_ind_lib) { + JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num1 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num2 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num3 = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_num4 = new JSONObject(new LinkedHashMap<>()); + if (StringUtils.isNotEmpty(bo.getString("PERFORMANCE_INDICATOR_NAME"))){ + jsonObject_name.put("name",bo.getString("PERFORMANCE_INDICATOR_NAME")); + }else { + jsonObject_name.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("UNIT_MEASUREMENT"))){ + jsonObject_num1.put("name",bo.getString("UNIT_MEASUREMENT")); + }else { + jsonObject_num1.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("STATISTICAL_PERIOD"))){ + jsonObject_num2.put("name",bo.getString("STATISTICAL_PERIOD")); + }else { + jsonObject_num2.put("name","/"); + } + + if (StringUtils.isNotEmpty(bo.getString("COMPUTATIONAL_FORMULA"))){ + jsonObject_num3.put("name",bo.getString("COMPUTATIONAL_FORMULA")); + }else { + jsonObject_num3.put("name","/"); + } + if (StringUtils.isNotEmpty(bo.getString("DATA_SOURCES"))){ + jsonObject_num4.put("name",bo.getString("DATA_SOURCES")); + }else { + jsonObject_num4.put("name","/"); + } + + jsonArray_secondcont.add(jsonObject_name); + jsonArray_num1.add(jsonObject_num1); + jsonArray_num2.add(jsonObject_num2); + jsonArray_num3.add(jsonObject_num3); + jsonArray_num4.add(jsonObject_num4); + } + jsonObject_contant.put("secondcont",jsonArray_secondcont); + jsonObject_contant.put("num1",jsonArray_num1); + jsonObject_contant.put("num2",jsonArray_num2); + jsonObject_contant.put("num3",jsonArray_num3); + jsonObject_contant.put("num4",jsonArray_num4); + jsonArray.add(jsonObject_contant); + result.put("content",jsonArray); + } + } + result.put("content",jsonArray); + System.out.println("jsonArray》》》》》》》》》》》"+jsonArray); + return result; + } + + + +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java index 2d4e32db..a085246a 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessEndAfterEvent.java @@ -70,716 +70,717 @@ public class ProcessEndAfterEvent extends ExecuteListener { Connection open = DBSql.open(); //http://localhost:8089/portal/r/or?cmd=com.hy_client_bpm_form_main_page_open&oauthName=oauthLogin&processInstId=3505e654-9217-41cd-a31d-4971846b3219 - String portalUrl = SDK.getPortalAPI().getPortalUrl(); - System.out.println("portal======>>>>"+portalUrl); + + if (!"terminate".equals(processExecutionContext.getProcessInstance().getControlState())) { + + + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + System.out.println("portal======>>>>"+portalUrl); /*if (portalUrl.equals("http://10.114.11.135:8088/portal")){ portalUrl = "http://bpm.yili.com:8088/portal/"; }*/ - try { + try { - String url = portalUrl+"/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); - String mobileurl = "https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_process_page_phone&oauthName=oauthLogin&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); + String url = portalUrl+"/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); + String mobileurl = "https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Timestamp endTime = processExecutionContext.getProcessInstance().getStartTime(); - BO boActCoePublish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Timestamp endTime = processExecutionContext.getProcessInstance().getStartTime(); + BO boActCoePublish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); //ProcessExecutionContext processExecutionContext,String fileCreateName,String fileName,String fileurl,String readingScope_org,String isFullCompany,String fileCreateDate,String relationProcessinstId,String readingScope_post,String readingScope_level,String fileid - String not_url = "/w?cmd=com.yili_process_page&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); - execute(processExecutionContext,boActCoePublish.getString("APPLYUSERNAME"),boActCoePublish.getString("PROCESS_TITLE"),not_url,boActCoePublish.getString("SEND_SCOPE_ORG"),boActCoePublish.getString("SEND_SCOP"),boActCoePublish.getString("APPLYDATE"),processExecutionContext.getProcessInstance().getId(),boActCoePublish.getString("SEND_SCOPE_POST"),boActCoePublish.getString("SEND_SCOPE_LEVEL"),"1"); + String not_url = "/w?cmd=com.yili_process_page&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); + execute(processExecutionContext,boActCoePublish.getString("APPLYUSERNAME"),boActCoePublish.getString("PROCESS_TITLE"),not_url,boActCoePublish.getString("SEND_SCOPE_ORG"),boActCoePublish.getString("SEND_SCOP"),boActCoePublish.getString("APPLYDATE"),processExecutionContext.getProcessInstance().getId(),boActCoePublish.getString("SEND_SCOPE_POST"),boActCoePublish.getString("SEND_SCOPE_LEVEL"),"1"); - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - jsonObject.put("action","read"); - jsonObject.put("title"," " + - ""+boActCoePublish.getString("PROCESS_TITLE")+""); - System.out.println("部门庄户》》》》》》》"+SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo()); - jsonObject.put("dept",SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo());//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - String target = processExecutionContext.getTaskInstance().getTarget(); - if (processExecutionContext.getTaskInstance().getTarget().length()==8&&"00".equals(processExecutionContext.getTaskInstance().getTarget().substring(0,2))){ - target = processExecutionContext.getTaskInstance().getTarget().substring(2); - } - 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){ - jsonObject.put("user",bo_eu_oa_reson.getString("LOGINID")); - } - // jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("date",sdf.format(endTime)); - jsonObject.put("remark",boActCoePublish.getString("PROCESS_TITLE")); - jsonObject.put("status","0"); - jsonObject.put("dataid",processExecutionContext.getProcessInstance().getId()); - jsonObject.put("pcurl",url); - jsonObject.put("mobileurl",mobileurl); - //list.add(1,"00352394"); - //list.add(2,"00352394"); - BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); - String uid = ""; - String new_uid = ""; - if(bo_act_coe_publish1!=null) { - String da = bo_act_coe_publish1.getString("SEND_SCOP"); + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("action","read"); + jsonObject.put("title"," " + + ""+boActCoePublish.getString("PROCESS_TITLE")+""); + System.out.println("部门庄户》》》》》》》"+SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo()); + jsonObject.put("dept",SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo());//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + String target = processExecutionContext.getTaskInstance().getTarget(); + target = processExecutionContext.getTaskInstance().getTarget(); - if (da.equals("1")) { - List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER"); - for (RowMap row : select_userid_from_orguser - ) { - uid += row.getString("USERID") + ","; - } - } else { - List posts_list = new ArrayList(); - List org_list = new ArrayList(); - if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))){ - String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(","); - org_list= Arrays.asList(strs); - } + System.out.println("当前账户======》》》》"+target); - if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) { - String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); - posts_list = Arrays.asList(posts); - } - List ranks_list = new ArrayList(); - if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) { - String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); - ranks_list = Arrays.asList(ranks); - } + jsonObject.put("user",target); - System.out.println("部门id》》》》》》》》》》》》》"+org_list ); - System.out.println("posts_list》》》》》》》》》》》》》"+posts_list); - System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list); - if (org_list.size()!=0 && org_list!=null) { - for (String depaartid : org_list + // jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser() + jsonObject.put("date",sdf.format(endTime)); + jsonObject.put("remark",boActCoePublish.getString("PROCESS_TITLE")); + jsonObject.put("status","0"); + jsonObject.put("dataid",processExecutionContext.getProcessInstance().getId()); + jsonObject.put("pcurl",url); + jsonObject.put("mobileurl",mobileurl); + //list.add(1,"00352394"); + //list.add(2,"00352394"); + BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); + String uid = ""; + String new_uid = ""; + if(bo_act_coe_publish1!=null) { + String da = bo_act_coe_publish1.getString("SEND_SCOP"); + + if (da.equals("1")) { + List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER"); + for (RowMap row : select_userid_from_orguser ) { - System.out.println("departid>>>>>>>>>>>>>" + depaartid); - DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid); - boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache(); - System.out.println("是否含有下级?????????????" + existSubModelOfCache); - //判断选中的是否有下级部门 - if (existSubModelOfCache) { - List maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'"); - for (RowMap row : maps - ) { - String id = row.getString("ID"); - DepartmentModel model = SDK.getORGAPI().getDepartmentById(id); + uid += row.getString("USERID") + ","; + } + } else { + List posts_list = new ArrayList(); + List org_list = new ArrayList(); + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_ORG"))){ + String strs[] = bo_act_coe_publish1.getString("SEND_SCOPE_ORG").split(","); + org_list= Arrays.asList(strs); + } - if (model.isExistSubModelOfCache()) { - //有下级部门的选中有下级部门 - List rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'"); - for (RowMap wo : - rowMapList) { - String ids = wo.getString("ID"); - DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids); - if (model1.isExistSubModelOfCache()) { - List rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'"); - for (RowMap wsa : - rowMapLists) { - String wsaString = wsa.getString("ID"); - DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString); - if (model2.isExistSubModelOfCache()) { - List rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'"); - for (RowMap rows : - rowMapList1) { - String rowsString = rows.getString("ID"); - DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString); - if (model3.isExistSubModelOfCache()) { - List rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'"); - for (RowMap ormap : - rowMapList2) { - String rowsString1 = ormap.getString("ID"); - DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1); - if (model4.isExistSubModelOfCache()) { - List rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'"); - for (RowMap owmapr : - rowMaps) { - String row_id = owmapr.getString("ID"); - DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id); - if (model5.isExistSubModelOfCache()) { - List rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'"); - for (RowMap owzmap : - rowMapList3) { - String idsa = owzmap.getString("ID"); - DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa); - if (model6.isExistSubModelOfCache()) { + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_POST"))) { + String posts[] = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + posts_list = Arrays.asList(posts); + } + List ranks_list = new ArrayList(); + if (StringUtils.isNotEmpty(bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL"))) { + String ranks[] = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + ranks_list = Arrays.asList(ranks); + } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + System.out.println("部门id》》》》》》》》》》》》》"+org_list ); + System.out.println("posts_list》》》》》》》》》》》》》"+posts_list); + System.out.println("ranks_list》》》》》》》》》》》》》"+ranks_list); + if (org_list.size()!=0 && org_list!=null) { + for (String depaartid : org_list + ) { + System.out.println("departid>>>>>>>>>>>>>" + depaartid); + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentById(depaartid); + boolean existSubModelOfCache = departmentModel.isExistSubModelOfCache(); + System.out.println("是否含有下级?????????????" + existSubModelOfCache); + //判断选中的是否有下级部门 + if (existSubModelOfCache) { + List maps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + depaartid + "'"); + for (RowMap row : maps + ) { + String id = row.getString("ID"); + DepartmentModel model = SDK.getORGAPI().getDepartmentById(id); + if (model.isExistSubModelOfCache()) { + //有下级部门的选中有下级部门 + List rowMapList = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + id + "'"); + for (RowMap wo : + rowMapList) { + String ids = wo.getString("ID"); + DepartmentModel model1 = SDK.getORGAPI().getDepartmentById(ids); + if (model1.isExistSubModelOfCache()) { + List rowMapLists = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + ids + "'"); + for (RowMap wsa : + rowMapLists) { + String wsaString = wsa.getString("ID"); + DepartmentModel model2 = SDK.getORGAPI().getDepartmentById(wsaString); + if (model2.isExistSubModelOfCache()) { + List rowMapList1 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + wsaString + "'"); + for (RowMap rows : + rowMapList1) { + String rowsString = rows.getString("ID"); + DepartmentModel model3 = SDK.getORGAPI().getDepartmentById(rowsString); + if (model3.isExistSubModelOfCache()) { + List rowMapList2 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString + "'"); + for (RowMap ormap : + rowMapList2) { + String rowsString1 = ormap.getString("ID"); + DepartmentModel model4 = SDK.getORGAPI().getDepartmentById(rowsString1); + if (model4.isExistSubModelOfCache()) { + List rowMaps = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + rowsString1 + "'"); + for (RowMap owmapr : + rowMaps) { + String row_id = owmapr.getString("ID"); + DepartmentModel model5 = SDK.getORGAPI().getDepartmentById(row_id); + if (model5.isExistSubModelOfCache()) { + List rowMapList3 = DBSql.getMaps("SELECT * FROM ORGDEPARTMENT WHERE PARENTDEPARTMENTID = '" + row_id + "'"); + for (RowMap owzmap : + rowMapList3) { + String idsa = owzmap.getString("ID"); + DepartmentModel model6 = SDK.getORGAPI().getDepartmentById(idsa); + if (model6.isExistSubModelOfCache()) { + + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(idsa); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(row_id); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString1); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(rowsString); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(wsaString); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(ids); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id); - for (UserModel user : allUsersByDepartments - ) { - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + List allUsersByDepartments = SDK.getORGAPI().getAllUsersByDepartment(id); + for (UserModel user : allUsersByDepartments + ) { + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } } - } - } else { - //选中的没有下级部门 - List allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid); - for (UserModel user : allUsersByDepartment - ) { - System.out.println("user.getExt2())???????????" + user.getExt2()); - System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0)); - System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0)); - if (posts_list.size() != 0 && ranks_list.size() != 0) { - if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + } else { + //选中的没有下级部门 + List allUsersByDepartment = SDK.getORGAPI().getAllUsersByDepartment(depaartid); + for (UserModel user : allUsersByDepartment + ) { + System.out.println("user.getExt2())???????????" + user.getExt2()); + System.out.println("posts_list》》》》》》》》》das" + (posts_list.size() != 0)); + System.out.println("123123》》》》》》》》》》" + (ranks_list.size() != 0)); + if (posts_list.size() != 0 && ranks_list.size() != 0) { + if (posts_list.contains(user.getPositionNo()) && ranks_list.contains(user.getExt2())) { + uid += user.getUID() + ","; + } + } else if (posts_list.size() != 0 && ranks_list.size() == 0) { + if (posts_list.contains(user.getPositionNo())) { + + uid += user.getUID() + ","; + } + } else if (posts_list.size() == 0 && ranks_list.size() != 0) { + if (ranks_list.contains(user.getExt2())) { + + uid += user.getUID() + ","; + } + } else { uid += user.getUID() + ","; } - } else if (posts_list.size() != 0 && ranks_list.size() == 0) { - if (posts_list.contains(user.getPositionNo())) { - - uid += user.getUID() + ","; - } - } else if (posts_list.size() == 0 && ranks_list.size() != 0) { - if (ranks_list.contains(user.getExt2())) { - - uid += user.getUID() + ","; - } - } else { - uid += user.getUID() + ","; } } + + } + } + if (org_list.size()==0||org_list==null){ + String posts=""; + String levels = ""; + if (posts_list.size() !=0 &&ranks_list.size()!=0){ + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + if (level.length==1){ + levels = "'"+level[0]+"'"; + }else { + levels = "'"+ StringUtils.join(level, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + } else if (posts_list.size() !=0 &&ranks_list.size()==0) { + String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); + if (post.length==1){ + // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); + posts = "'"+post[0]+"'"; + }else { + posts = "'"+ StringUtils.join(post, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } + }else if (posts_list.size() ==0 &&ranks_list.size()!=0){ + String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + + if (level.length==1){ + levels = "'"+level[0]+"'"; + }else { + levels = "'"+ StringUtils.join(level, "','")+"'"; + } + List maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")"); + for (RowMap map:maps + ) { + uid+=map.getString("USERID")+","; + } } } } - if (org_list.size()==0||org_list==null){ - String posts=""; - String levels = ""; - if (posts_list.size() !=0 &&ranks_list.size()!=0){ - String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); - String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); - if (post.length==1){ - // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); - posts = "'"+post[0]+"'"; - }else { - posts = "'"+ StringUtils.join(post, "','")+"'"; - } - if (level.length==1){ - levels = "'"+level[0]+"'"; - }else { - levels = "'"+ StringUtils.join(level, "','")+"'"; - } - List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ") and EXT2 in (" + levels + ")"); - for (RowMap map:maps - ) { - uid+=map.getString("USERID")+","; - } - } else if (posts_list.size() !=0 &&ranks_list.size()==0) { - String[] post = bo_act_coe_publish1.getString("SEND_SCOPE_POST").split(","); - if (post.length==1){ - // DBSql.getMap("select USERID from ORGUSER WHERE POSITION_NO IN "); - posts = "'"+post[0]+"'"; - }else { - posts = "'"+ StringUtils.join(post, "','")+"'"; - } - List maps = DBSql.getMaps("select USERID from ORGUSER where POSITION_NO in(" + posts + ")"); - for (RowMap map:maps - ) { - uid+=map.getString("USERID")+","; - } - }else if (posts_list.size() ==0 &&ranks_list.size()!=0){ - String[] level = bo_act_coe_publish1.getString("SEND_SCOPE_LEVEL").split(","); + System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid); + if (StringUtils.isNotEmpty(uid + )) { + uid = uid.substring(0, uid.length() - 1); + String[] split = uid.split(","); - if (level.length==1){ - levels = "'"+level[0]+"'"; - }else { - levels = "'"+ StringUtils.join(level, "','")+"'"; - } - List maps = DBSql.getMaps("select USERID from ORGUSER where EXT2 in (" + levels + ")"); - for (RowMap map:maps - ) { - uid+=map.getString("USERID")+","; - } - } + List list = new ArrayList(Arrays.asList(split)); - } - } - System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid); - if (StringUtils.isNotEmpty(uid - )) { - uid = uid.substring(0, uid.length() - 1); - String[] split = uid.split(","); + HashSet h = new HashSet(list); + list.clear(); + list.addAll(h); + for (String userid:list + ) { - List list = new ArrayList(Arrays.asList(split)); - - HashSet h = new HashSet(list); - list.clear(); - list.addAll(h); - for (String userid:list - ) { - - System.out.println("当前账户======》》》》"+userid); - // BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail(); - // if (boEuOaReson!=null){ + System.out.println("当前账户======》》》》"+userid); + // BO boEuOaReson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", userid).detail(); + // if (boEuOaReson!=null){ new_uid+=userid+","; - // } + // } + } } } - } - if (StringUtils.isNotEmpty(new_uid - )) { - new_uid = new_uid.substring(0, new_uid.length() - 1); - } - System.out.println("new_userid ==========>>>>>>>>>"+new_uid); - jsonObject.put("userList",new_uid); + if (StringUtils.isNotEmpty(new_uid + )) { + new_uid = new_uid.substring(0, new_uid.length() - 1); + } + System.out.println("new_userid ==========>>>>>>>>>"+new_uid); + jsonObject.put("userList",new_uid); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - ""+ - " " + - " " + - " " + - ""; - System.out.println("xmlStr>>>>>>>>"+xmlStr); - String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, ""); - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - System.out.println("rootElement>>>>>>"+rootElement); - Element result = rootElement.element("Body").element("serviceResponse").element("out"); - String resultString = result.getData().toString(); - JSONObject jsonObject1 = JSON.parseObject(resultString); - String datas = jsonObject1.getString("data"); - String status = jsonObject1.getString("status"); - System.out.println("状态是什么》》》》》》》》》》》"+status); - JSONArray resultArray = JSONObject.parseArray(datas); - for (int i=0;i\n" + + " " + + " " + + " " + + " " + + ""+ + " " + + " " + + " " + + ""; + System.out.println("xmlStr>>>>>>>>"+xmlStr); + String postSoap = UtilUrl.doPostSoap("http://10.105.1.59:80/services/service_lcglpt", xmlStr, ""); + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>"+rootElement); + Element result = rootElement.element("Body").element("serviceResponse").element("out"); + String resultString = result.getData().toString(); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("data"); + String status = jsonObject1.getString("status"); + System.out.println("状态是什么》》》》》》》》》》》"+status); + JSONArray resultArray = JSONObject.parseArray(datas); + for (int i=0;i bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list(); + List bo_act_coe_publish_c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list(); + List bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).list(); + String wsId = ""; + JSONArray jsonArray = new JSONArray(); - int m = 0; - for (BO bo:bo_act_coe_publish_n - ) { - OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); - wsId = model.getWsId(); - String publishfileid = bo.getString("PUBLISHFILEID"); - String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid+"'"; - RowMap map = DBSql.getMap(sql_n); - if (StringUtils.isEmpty(map.getString("EXT4"))){ - // aslp服务地址 - String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl"; + int m = 0; + for (BO bo:bo_act_coe_publish_n + ) { + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + wsId = model.getWsId(); + String publishfileid = bo.getString("PUBLISHFILEID"); + String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid+"'"; + RowMap map = DBSql.getMap(sql_n); + if (StringUtils.isEmpty(map.getString("EXT4"))){ + // aslp服务地址 + String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl"; // 参数定义列表 - Map params_create = new HashMap(); + Map params_create = new HashMap(); //保密级别, 0: 普通 1:秘密 2:机密,必填 - params_create.put("securityLevel", 0); + params_create.put("securityLevel", 0); //知识名称,必填 - params_create.put("knwlName", map.getString("PLNAME")+map.getString("PLVER")); + params_create.put("knwlName", map.getString("PLNAME")+map.getString("PLVER")); //是否可以评论,必填 - params_create.put("isComment", true); + params_create.put("isComment", true); //是否可以评分,必填 - params_create.put("isRate", true); + params_create.put("isRate", true); //有效期:yyyy-MM-dd,非必填 - params_create.put("validDate", "2099-12-31"); + params_create.put("validDate", "2099-12-31"); //只读控制,1:在线阅读和下载 0:在线阅读,必填 - params_create.put("onlineLevel", 1); + params_create.put("onlineLevel", 1); //知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填 - params_create.put("createUser", "admin"); + params_create.put("createUser", "admin"); //知识内容,非必填 - params_create.put("cardContext", ""); + params_create.put("cardContext", ""); //sid,必填 - params_create.put("sid", processExecutionContext.getUserContext().getSessionId()); - AppAPI appAPI_create = SDK.getAppAPI(); + params_create.put("sid", processExecutionContext.getUserContext().getSessionId()); + AppAPI appAPI_create = SDK.getAppAPI(); //创建知识 - ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(processExecutionContext.getProcessInstance().getAppId()), aslps_create, params_create); - System.out.println("ro_create================"+ro_create); - String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); - JSONArray jsonArray1 = new JSONArray(); - if (bo_act_coe_publish.getString("SEND_SCOP").equals("0")){ - String departId = bo_act_coe_publish.getString("SEND_SCOPE_ORG"); - if (StringUtils.isNotEmpty(departId)&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_LEVEL"))&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_POST"))) { - String strs[] = departId.split(","); - for (String departmentid : strs - ) { - JSONObject jsonObjecta = new JSONObject(); - jsonObjecta.put("assignmentType", "department"); - jsonObjecta.put("assignmentId", departmentid); - jsonArray1.add(jsonObjecta); + ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(processExecutionContext.getProcessInstance().getAppId()), aslps_create, params_create); + System.out.println("ro_create================"+ro_create); + String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); + JSONArray jsonArray1 = new JSONArray(); + if (bo_act_coe_publish.getString("SEND_SCOP").equals("0")){ + String departId = bo_act_coe_publish.getString("SEND_SCOPE_ORG"); + if (StringUtils.isNotEmpty(departId)&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_LEVEL"))&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_POST"))) { + String strs[] = departId.split(","); + for (String departmentid : strs + ) { + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType", "department"); + jsonObjecta.put("assignmentId", departmentid); + jsonArray1.add(jsonObjecta); + } + }else{ + + String[] split = uid.split(","); + + List list = new ArrayList(Arrays.asList(split)); + + HashSet h = new HashSet(list); + list.clear(); + list.addAll(h); + + for (String user_id:list + ) { + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType","user"); + jsonObjecta.put("assignmentId",user_id); + jsonArray1.add(jsonObjecta); + } } }else{ - - String[] split = uid.split(","); - - List list = new ArrayList(Arrays.asList(split)); - - HashSet h = new HashSet(list); - list.clear(); - list.addAll(h); - - for (String user_id:list - ) { - JSONObject jsonObjecta = new JSONObject(); - jsonObjecta.put("assignmentType","user"); - jsonObjecta.put("assignmentId",user_id); + List select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT"); + for (RowMap depaid: + select_id_from_orgdepartment) { + String id = depaid.getString("ID"); + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType","department"); + jsonObjecta.put("assignmentId",id); jsonArray1.add(jsonObjecta); } } - }else{ - List select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT"); - for (RowMap depaid: - select_id_from_orgdepartment) { - String id = depaid.getString("ID"); - JSONObject jsonObjecta = new JSONObject(); - jsonObjecta.put("assignmentType","department"); - jsonObjecta.put("assignmentId",id); - jsonArray1.add(jsonObjecta); - } + + + AddKnwlAC(processExecutionContext,jsonArray1,processExecutionContext.getUserContext().getSessionId(),cardId); + + String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '"+cardId+"' WHERE " + + " PLCATEGORY = 'process'and PLMETHODID !='process.framework' " + + " and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" + + " ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" + + " and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," + + " 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," + + " '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," + + " '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," + + " '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," + + " '42c09260-c1d3-44b7-ac3d-f8280e04c294') and ID = '"+publishfileid+"'"; + int update = DBSql.update(update_sql); + System.out.println("更新id为:"+publishfileid+"版本为:的知识对应的资产库的EXT4的影响行数为"+update); + creadteFile(processExecutionContext,"BO_ACT_COE_PUBLISH_N", processExecutionContext.getUserContext(),cardId,"PUBLISHFILEID = "); } - - - AddKnwlAC(processExecutionContext,jsonArray1,processExecutionContext.getUserContext().getSessionId(),cardId); - - String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '"+cardId+"' WHERE " + - " PLCATEGORY = 'process'and PLMETHODID !='process.framework' " + - " and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" + - " ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" + - " and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," + - " 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," + - " '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," + - " '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," + - " '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," + - " '42c09260-c1d3-44b7-ac3d-f8280e04c294') and ID = '"+publishfileid+"'"; - int update = DBSql.update(update_sql); - System.out.println("更新id为:"+publishfileid+"版本为:的知识对应的资产库的EXT4的影响行数为"+update); - creadteFile(processExecutionContext,"BO_ACT_COE_PUBLISH_N", processExecutionContext.getUserContext(),cardId,"PUBLISHFILEID = "); } - } - for (BO bo:bo_act_coe_publish_c - ) { - OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); - wsId = model.getWsId(); - String publishfileid = bo.getString("CHANGEDFILEIDNEW"); - DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' where id = '"+publishfileid+"'"); - String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid+"'"; - RowMap map = DBSql.getMap(sql_n); - if (StringUtils.isEmpty(map.getString("EXT4"))){ - // aslp服务地址 - String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl"; + for (BO bo:bo_act_coe_publish_c + ) { + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + wsId = model.getWsId(); + String publishfileid = bo.getString("CHANGEDFILEIDNEW"); + DBSql.update("update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' where id = '"+publishfileid+"'"); + String sql_n = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid+"'"; + RowMap map = DBSql.getMap(sql_n); + if (StringUtils.isEmpty(map.getString("EXT4"))){ + // aslp服务地址 + String aslps_create = "aslp://com.actionsoft.apps.kms/CreateKnwl"; // 参数定义列表 - Map params_create = new HashMap(); + Map params_create = new HashMap(); //保密级别, 0: 普通 1:秘密 2:机密,必填 - params_create.put("securityLevel", 0); + params_create.put("securityLevel", 0); //知识名称,必填 - params_create.put("knwlName", map.getString("PLNAME")+map.getString("PLVER")); + params_create.put("knwlName", map.getString("PLNAME")+map.getString("PLVER")); //是否可以评论,必填 - params_create.put("isComment", true); + params_create.put("isComment", true); //是否可以评分,必填 - params_create.put("isRate", true); + params_create.put("isRate", true); //有效期:yyyy-MM-dd,非必填 - params_create.put("validDate", "2099-12-31"); + params_create.put("validDate", "2099-12-31"); //只读控制,1:在线阅读和下载 0:在线阅读,必填 - params_create.put("onlineLevel", 1); + params_create.put("onlineLevel", 1); //知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填 - params_create.put("createUser", "admin"); + params_create.put("createUser", "admin"); //知识内容,非必填 - params_create.put("cardContext", ""); + params_create.put("cardContext", ""); //sid,必填 - params_create.put("sid", processExecutionContext.getUserContext().getSessionId()); - AppAPI appAPI_create = SDK.getAppAPI(); + params_create.put("sid", processExecutionContext.getUserContext().getSessionId()); + AppAPI appAPI_create = SDK.getAppAPI(); //创建知识 - ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(processExecutionContext.getProcessInstance().getAppId()), aslps_create, params_create); - System.out.println("ro_create================"+ro_create); - String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); - JSONArray jsonArray1 = new JSONArray(); - if (bo_act_coe_publish.getString("SEND_SCOP").equals("0")){ - String departId = bo_act_coe_publish.getString("SEND_SCOPE_ORG"); - if (StringUtils.isNotEmpty(departId)&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_LEVEL"))&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_POST"))){ - String strs[] = departId.split(","); - for (String departmentid:strs - ) { + ResponseObject ro_create = appAPI_create.callASLP(appAPI_create.getAppContext(processExecutionContext.getProcessInstance().getAppId()), aslps_create, params_create); + System.out.println("ro_create================"+ro_create); + String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); + JSONArray jsonArray1 = new JSONArray(); + if (bo_act_coe_publish.getString("SEND_SCOP").equals("0")){ + String departId = bo_act_coe_publish.getString("SEND_SCOPE_ORG"); + if (StringUtils.isNotEmpty(departId)&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_LEVEL"))&&StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_POST"))){ + String strs[] = departId.split(","); + for (String departmentid:strs + ) { + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType","department"); + jsonObjecta.put("assignmentId",departmentid); + jsonArray1.add(jsonObjecta); + } + }else{ + String[] split = uid.split(","); + + List list = new ArrayList(Arrays.asList(split)); + + HashSet h = new HashSet(list); + list.clear(); + list.addAll(h); + + for (String user_id:list + ) { + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType","user"); + jsonObjecta.put("assignmentId",user_id); + jsonArray1.add(jsonObjecta); + } + } + + }else{ + List select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT"); + for (RowMap depaid: + select_id_from_orgdepartment) { + String id = depaid.getString("ID"); JSONObject jsonObjecta = new JSONObject(); jsonObjecta.put("assignmentType","department"); - jsonObjecta.put("assignmentId",departmentid); - jsonArray1.add(jsonObjecta); - } - }else{ - String[] split = uid.split(","); - - List list = new ArrayList(Arrays.asList(split)); - - HashSet h = new HashSet(list); - list.clear(); - list.addAll(h); - - for (String user_id:list - ) { - JSONObject jsonObjecta = new JSONObject(); - jsonObjecta.put("assignmentType","user"); - jsonObjecta.put("assignmentId",user_id); + jsonObjecta.put("assignmentId",id); jsonArray1.add(jsonObjecta); } } + AddKnwlAC(processExecutionContext,jsonArray1,processExecutionContext.getUserContext().getSessionId(),cardId); - }else{ - List select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT"); - for (RowMap depaid: - select_id_from_orgdepartment) { - String id = depaid.getString("ID"); - JSONObject jsonObjecta = new JSONObject(); - jsonObjecta.put("assignmentType","department"); - jsonObjecta.put("assignmentId",id); - jsonArray1.add(jsonObjecta); - } + String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '"+cardId+"' WHERE " + + " PLCATEGORY = 'process'and PLMETHODID !='process.framework' " + + " and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" + + " ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" + + " and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," + + " 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," + + " '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," + + " '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," + + " '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," + + " '42c09260-c1d3-44b7-ac3d-f8280e04c294') and ID = '"+publishfileid+"'"; + int update = DBSql.update(update_sql); + System.out.println("更新id为:"+publishfileid+"版本为:的知识对应的资产库的EXT4的影响行数为"+update); + creadteFile(processExecutionContext,"BO_ACT_COE_PUBLISH_C", processExecutionContext.getUserContext(),cardId," CHANGEDFILEIDNEW="); + } + //将旧的知识取消发布或者移动到废止发布中 + String publishfileid_old = bo.getString("CHANGEFILEID"); + String sql_c = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid_old+"'"; + RowMap map1 = DBSql.getMap(sql_c); + if (StringUtils.isNotEmpty(map1.getString("EXT4"))){ + CancelPublishKnwl(processExecutionContext,processExecutionContext.getUserContext().getSessionId(),map1.getString("EXT4")); + DBSql.update( + "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"+publishfileid_old+"'" + ); } - AddKnwlAC(processExecutionContext,jsonArray1,processExecutionContext.getUserContext().getSessionId(),cardId); - - String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '"+cardId+"' WHERE " + - " PLCATEGORY = 'process'and PLMETHODID !='process.framework' " + - " and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" + - " ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')" + - " and PLPARENTID not in ('63ff93c6-2f27-4851-a396-6830c428db2e'," + - " 'c84f497a-4de3-4404-86e8-cd5af71c3b47','94dabf55-b032-4316-a4c3-00b83763da09'," + - " '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5'," + - " '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093'," + - " '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," + - " '42c09260-c1d3-44b7-ac3d-f8280e04c294') and ID = '"+publishfileid+"'"; - int update = DBSql.update(update_sql); - System.out.println("更新id为:"+publishfileid+"版本为:的知识对应的资产库的EXT4的影响行数为"+update); - creadteFile(processExecutionContext,"BO_ACT_COE_PUBLISH_C", processExecutionContext.getUserContext(),cardId," CHANGEDFILEIDNEW="); } - //将旧的知识取消发布或者移动到废止发布中 - String publishfileid_old = bo.getString("CHANGEFILEID"); - String sql_c = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid_old+"'"; - RowMap map1 = DBSql.getMap(sql_c); - if (StringUtils.isNotEmpty(map1.getString("EXT4"))){ - CancelPublishKnwl(processExecutionContext,processExecutionContext.getUserContext().getSessionId(),map1.getString("EXT4")); - DBSql.update( - "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"+publishfileid_old+"'" - ); - } - } - for (BO bo:bo_act_coe_publish_s - ) { - //将旧的知识取消发布或者移动到废止发布中 - String publishfileid_stop = bo.getString("STOPFILEID"); - String sql_s = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid_stop+"'"; - RowMap map1 = DBSql.getMap(sql_s); - if (StringUtils.isNotEmpty(map1.getString("EXT4"))){ + for (BO bo:bo_act_coe_publish_s + ) { + //将旧的知识取消发布或者移动到废止发布中 + String publishfileid_stop = bo.getString("STOPFILEID"); + String sql_s = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '"+publishfileid_stop+"'"; + RowMap map1 = DBSql.getMap(sql_s); + if (StringUtils.isNotEmpty(map1.getString("EXT4"))){ /** * 废止发布 */ - CancelPublishKnwl(processExecutionContext,processExecutionContext.getUserContext().getSessionId(),map1.getString("EXT4")); + CancelPublishKnwl(processExecutionContext,processExecutionContext.getUserContext().getSessionId(),map1.getString("EXT4")); /*String sql_update = "UPDATE APP_ACT_KMS_CARD SET ISPUBLISHED = '0' WHERE ID = '"+map1.getString("EXT4")+"'"; int update = DBSql.update(sql_update); System.out.println(bo.getString("STOPFILENAME")+"废止文件发布的影响行数"+update);*/ - DBSql.update( - "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"+publishfileid_stop+"'" - ); + DBSql.update( + "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"+publishfileid_stop+"'" + ); + } } + + + }catch (Exception e){ + e.printStackTrace(); + }finally { + open.close(); } - - - }catch (Exception e){ - e.printStackTrace(); - }finally { - open.close(); } } - public void creadteFile(ProcessExecutionContext processExecutionContext,String bo_name,UserContext userContext, String cardId,String fileid){ /** * 这个主要是负责对流程手册进行相关的文件的生成 diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreateWorkflowServiceJob.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreateWorkflowServiceJob.java index 1bef1e95..23401f2b 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreateWorkflowServiceJob.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreateWorkflowServiceJob.java @@ -8,8 +8,15 @@ 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.integration.util.JDBCUtil; import com.awspaas.user.apps.integration.util.UtilUrl; import jodd.util.StringUtil; +import net.sourceforge.pinyin4j.PinyinHelper; +import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; +import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; +import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.RequestEntity; @@ -24,9 +31,10 @@ import java.sql.Connection; import java.sql.SQLException; import java.sql.Timestamp; import java.text.SimpleDateFormat; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + /** * 伊利OA系统与流程审批节点操作数据查询接口集成 @@ -35,51 +43,54 @@ public class CreateWorkflowServiceJob implements IJob { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { String portalUrl = SDK.getPortalAPI().getPortalUrl(); - System.out.println("portal======>>>>"+portalUrl); + System.out.println("portal======>>>>" + portalUrl); /*if (portalUrl.equals("http://10.114.11.135:8088/portal")){ portalUrl = "http://bpm.yili.com:8088/portal/"; }*/ + JDBCUtil jdbcUtil = new JDBCUtil(); Connection open = DBSql.open(); - - try { - - + List bos = SDK.getBOAPI().query("BO_EU_OA_WORKFLOW_DATA", true).list(); + for (BO bo : bos + ) { + try { + int tale = Integer.parseInt(bo.getString("WORKFLOWID")); + String workflowname = bo.getString("WORKFLOWNAME"); //ProcessExecutionContext processExecutionContext,String fileCreateName,String fileName,String fileurl,String readingScope_org,String isFullCompany,String fileCreateDate,String relationProcessinstId,String readingScope_post,String readingScope_level,String fileid - int tale = 561486; - JSONObject jsonObject = new JSONObject(new LinkedHashMap()); - jsonObject.put("workflowId",tale); - jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() - jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() - jsonObject.put("pageIndex",1); - jsonObject.put("pageSize",10); + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("workflowId", tale); + jsonObject.put("createDateStart", "2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + jsonObject.put("createDateEnd", "2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() + jsonObject.put("pageIndex", 1); + jsonObject.put("pageSize", 10); - String xmlStr = "\n" + - " " + - " " + - " " + - " " + - ""+jsonObject+""+ - " " + - " " + - " " + - ""; + String xmlStr = "\n" + + " " + + " " + + " " + + " " + + "" + jsonObject + "" + + " " + + " " + + " " + + ""; /* String xmls = "\n" + " "; */ - System.out.println("参数==============="+xmlStr); - //System.out.println("参数==============="+xmls); - //HttpClientUtil httpClientUtil = new HttpClientUtil(); - int timeout = 600000; - // HttpURLConnection 发送SOAP请求 - System.out.println("HttpURLConnection 发送SOAP请求"); + System.out.println("参数===============" + xmlStr); + //System.out.println("参数==============="+xmls); + //HttpClientUtil httpClientUtil = new HttpClientUtil(); + int timeout = 600000; + // HttpURLConnection 发送SOAP请求 + System.out.println("HttpURLConnection 发送SOAP请求"); - String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); /*// HttpClient发送SOAP请求 System.out.println("HttpClient 发送SOAP请求"); @@ -104,89 +115,304 @@ public class CreateWorkflowServiceJob implements IJob { System.out.println("result=========>>>>>>>"+responseBodyAsString);*/ - Document document = DocumentHelper.parseText(postSoap); - Element rootElement = document.getRootElement(); - System.out.println("rootElement>>>>>>"+rootElement); - Element result = rootElement.element("Body").element("getFormDataByWfIdResponse").element("out"); - String resultString = result.getData().toString(); - System.out.println("resultString=>>>>>>>>>>"+resultString); - JSONObject jsonObject1 = JSON.parseObject(resultString); - String datas = jsonObject1.getString("datas"); - JSONArray resultArray = JSONObject.parseArray(datas); - System.out.println("个数》》》》》》》》"+resultArray.size()); - StringBuffer allKey = getAllKey(resultArray.getJSONObject(0)); - System.out.println("所有的字段名称信息输出》》》》》》》》》》》》"+allKey - ); - String strs[] = allKey.toString().split(","); - String sql = "create table T"+tale+"("; - for (String field:strs - ) { - sql+=field+" "+"nvarchar2(2000),"; - } - sql = sql.substring(0,sql.length()-1)+")"; - System.out.println("sql>>>>>>>>>>>>>>"+sql); - RowMap map = DBSql.getMap("select * from user_tables t where table_name= upper('T"+tale+"')"); - System.out.println("rowMap>>>>>>>>"+map); - if (map==null){ - int update = DBSql.update(sql + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>" + rootElement); + Element result = rootElement.element("Body").element("getFormDataByWfIdResponse").element("out"); + String resultString = result.getData().toString(); + System.out.println("resultString=>>>>>>>>>>" + resultString); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("datas"); + JSONArray resultArray = JSONObject.parseArray(datas); + System.out.println("个数》》》》》》》》" + resultArray.size()); + StringBuffer allKey = getAllKey(resultArray.getJSONObject(0)); + System.out.println("所有的字段名称信息输出》》》》》》》》》》》》" + allKey ); - System.out.println("是否已经插入数据"+update); - } - - - // DBSql.update("create index AWS_IN_63A5A52E2FA2 on T"+tale+" (BINDID);"); - String substring = allKey.substring(0, allKey.length() - 1); - String insetr = "insert into T"+tale+"("+substring+") values("; - //for (int i =0;i2000){ - DBSql.update("alter table T"+tale+" add "+field+"_temp clob"); - DBSql.update("update T"+tale+" set "+field+"_temp = "+field+""); - DBSql.update("alter table T"+tale+" drop column "+field+""); - DBSql.update("alter table T"+tale+" rename column "+field+"_temp to "+field+""); - } - data +="'"+basic_data+"',"; - }else{ - if (jsonObject2.get(field).toString().length()>2000){ - DBSql.update("alter table T"+tale+" add "+field+"_temp clob"); - DBSql.update("update T"+tale+" set "+field+"_temp = "+field+""); - DBSql.update("alter table T"+tale+" drop column "+field+""); - DBSql.update("alter table T"+tale+" rename column "+field+"_temp to "+field+""); - } - data += "'"+jsonObject2.get(field).toString()+"',"; + String field = getPYIndexStr(name,true); + + if (field.contains("(")){ + field =field.replaceAll("[(]","L"); + } + if (field.contains(")")){ + field =field.replaceAll("[)]","R"); + } + if (isStartWithNumber(field)){ + field = "A"+field; } + + System.out.println("flename=>>>>>>>"+name+">>>>fileid》》》》》"+field); + + sql += field + " " + "nvarchar2(2000),"; + } + sql = sql.substring(0, sql.length() - 1) + ")"; + System.out.println("sql>>>>>>>>>>>>>>" + sql); + RowMap map = DBSql.getMap("select * from user_tables t where table_name= upper('T" + tale + "')"); + System.out.println("rowMap>>>>>>>>" + map); + if (map == null) { + int update = DBSql.update(sql + ); + + for (String name : strs + ) { + String field = getPYIndexStr(name,true); + //sql += field + " " + "nvarchar2(2000),"; + if (field.contains("(")){ + field =field.replaceAll("[(]","L"); + } + if (field.contains(")")){ + field =field.replaceAll("[)]","R"); + } + if (isStartWithNumber(field)){ + field = "A"+field; + } + System.out.println("flename=>>>>>>>"+name+">>>>fileid》》》》》"+field); + jdbcUtil.comment("T"+tale,field,name); + } + + System.out.println("是否已经插入数据" + update); + } + + + // DBSql.update("create index AWS_IN_63A5A52E2FA2 on T"+tale+" (BINDID);"); + String substring = allKey.substring(0, allKey.length() - 1); + String insetr = "insert into T" + tale + "(" + substring + ") values("; + //for (int i =0;i 2000) { + DBSql.update("alter table T" + tale + " add " + field + "_temp clob"); + DBSql.update("update T" + tale + " set " + field + "_temp = " + field + ""); + DBSql.update("alter table T" + tale + " drop column " + field + ""); + DBSql.update("alter table T" + tale + " rename column " + field + "_temp to " + field + ""); + } + data += "'" + basic_data + "',"; + } else { + if (jsonObject2.get(field).toString().length() > 2000) { + DBSql.update("alter table T" + tale + " add " + field + "_temp clob"); + DBSql.update("update T" + tale + " set " + field + "_temp = " + field + ""); + DBSql.update("alter table T" + tale + " drop column " + field + ""); + DBSql.update("alter table T" + tale + " rename column " + field + "_temp to " + field + ""); + } + data += "'" + jsonObject2.get(field).toString() + "',"; + } + + } + System.out.println("最后数据=====》》》》》" + data); + data = data.substring(0, data.length() - 1); + String sqsl = insetr + data + ")"; + System.out.println("sqsl>>>>>>>>>>>>" + sqsl); + int update = DBSql.update(sqsl); + System.out.println("插入数据影响行数》》》》》》》》》》》" + update); + } + + + // } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + open.close(); + } catch (SQLException throwables) { + throwables.printStackTrace(); } - System.out.println("最后数据=====》》》》》"+data); - data = data.substring(0,data.length()-1); - String sqsl = insetr+data+")"; - System.out.println("sqsl>>>>>>>>>>>>"+sqsl); - int update = DBSql.update(sqsl); - System.out.println("插入数据影响行数》》》》》》》》》》》"+update); - } - - - // } - - }catch (Exception e){ - e.printStackTrace(); - }finally { - try { - open.close(); - } catch (SQLException throwables) { - throwables.printStackTrace(); } + System.out.println("同步插入OA表单数据同步完成"); } - System.out.println("同步插入OA表单数据同步完成"); } + + public String getPYIndexStr(String strChinese, boolean bUpCase){ + + try{ + + StringBuffer buffer = new StringBuffer(); + String chinese = ""; + + byte b[] = strChinese.getBytes("GBK");//把中文转化成byte数组 + + for(int i = 0; i < b.length; i++){ + + if((b[i] & 255) > 128){ + + int char1 = b[i++] & 255; + + char1 <<= 8;//左移运算符用“<<”表示,是将运算符左边的对象,向左移动运算符右边指定的位数,并且在低位补零。其实,向左移n位,就相当于乘上2的n次方 + + int chart = char1 + (b[i] & 255); + + buffer.append(getPYIndexChar((char)chart, bUpCase)); + + continue; + + } + + char c = (char)b[i]; + + //确定指定字符是否是汉字、大写字母、数字 + if(!Character.isJavaIdentifierPart(c) || (c >= 'A' && c <= 'Z') || Character.isDigit(c)){ + + buffer.append(c); + + }if (c >= 'a' && c <= 'z'){ + + buffer.append((char) (c - 'a' + 'A')); + + } + + } + if (buffer.toString().contains("-")){ + chinese = buffer.toString().replaceAll("-","_"); + }else if (buffer.toString().contains(" ")){ + chinese = buffer.toString().replaceAll(" ","_"); + }else { + chinese = buffer.toString(); + } + + if (chinese.contains("\\(")){ + chinese = buffer.toString().replaceAll("\\(","L"); + } + + if (chinese.contains(")")){ + chinese = buffer.toString().replaceAll("[)]","R"); + } + + return chinese; + + }catch(Exception e){ + + e.printStackTrace(); + + } + + return null; + + } + + + private static char getPYIndexChar(char strChinese, boolean bUpCase){ + + int charGBK = strChinese; + + char result; + + if(charGBK >= 45217 && charGBK <= 45252){ + + result = 'A'; + + }else if(charGBK >= 45253 && charGBK <= 45760){ + + result = 'B'; + + }else if(charGBK >= 45761 && charGBK <= 46317){ + + result = 'C'; + + }else if(charGBK >= 46318 && charGBK <= 46825){ + + result = 'D'; + + } else if(charGBK >= 46826 && charGBK <= 47009){ + + result = 'E'; + + }else if(charGBK >= 47010 && charGBK <= 47296){ + + result = 'F'; + + }else if(charGBK >= 47297 && charGBK <= 47613){ + + result = 'G'; + + }else if(charGBK >= 47614 && charGBK <= 48118){ + + result = 'H'; + + }else if(charGBK >= 48119 && charGBK <= 49061){ + + result = 'J'; + + } else if(charGBK >= 49062 && charGBK <= 49323){ + + result = 'K'; + + }else if(charGBK >= 49324 && charGBK <= 49895){ + + result = 'L'; + + }else if(charGBK >= 49896 && charGBK <= 50370){ + + result = 'M'; + + }else if(charGBK >= 50371 && charGBK <= 50613){ + + result = 'N'; + + }else if(charGBK >= 50614 && charGBK <= 50621){ + + result = 'O'; + + }else if(charGBK >= 50622 && charGBK <= 50905){ + + result = 'P'; + + }else if(charGBK >= 50906 && charGBK <= 51386){ + + result = 'Q'; + + }else if(charGBK >= 51387 && charGBK <= 51445){ + + result = 'R'; + + }else if(charGBK >= 51446 && charGBK <= 52217){ + + result = 'S'; + + }else if(charGBK >= 52218 && charGBK <= 52697){ + + result = 'T'; + + }else if(charGBK >= 52698 && charGBK <= 52979){ + + result = 'W'; + + }else if(charGBK >= 52980 && charGBK <= 53688){ + + result = 'X'; + + }else if(charGBK >= 53689 && charGBK <= 54480){ + + result = 'Y'; + + }else if(charGBK >= 54481 && charGBK <= 55289){ + + result = 'Z'; + + }else{ + + result = (char)(65 + (new Random()).nextInt(25)); + + } + + if(!bUpCase){ + result = Character.toLowerCase(result); + } + + return result; + + } + //根据JSONArray获取所有的key public static StringBuffer getAllKey(JSONArray json1) { StringBuffer stringBuffer = new StringBuffer(); @@ -280,4 +506,85 @@ public class CreateWorkflowServiceJob implements IJob { } + + + // 将汉字转换为全拼 + public static String getPingYin(String src) { + + char[] t1 = null; + t1 = src.toCharArray(); + String[] t2 = new String[t1.length]; + HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat(); + t3.setCaseType(HanyuPinyinCaseType.LOWERCASE); + t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE); + t3.setVCharType(HanyuPinyinVCharType.WITH_V); + String t4 = ""; + int t0 = t1.length; + try { + for (int i = 0; i < t0; i++) { + // 判断是否为汉字字符 + if (java.lang.Character.toString(t1[i]).matches( + "[\\u4E00-\\u9FA5]+")) { + t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3); + t4 += t2[0]; + } else + t4 += java.lang.Character.toString(t1[i]); + } + // System.out.println(t4); + return t4; + } catch (BadHanyuPinyinOutputFormatCombination e1) { + e1.printStackTrace(); + } + return t4; + } + + + + // 返回中文的首字母 + public static String getPinYinHeadChar(String str) { + String temp = ""; + String demo = ""; + String convert = ""; + for (int j = 0; j < str.length(); j++) { + char word = str.charAt(j); + String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word); + if (pinyinArray != null) { + convert += pinyinArray[0].charAt(0); + } else { + convert += word; + } + } + for(int i=0;i='a' && convert.charAt(i)<='z'){ + temp=convert.substring(i,i+1).toUpperCase(); + demo += temp; + } + } + return demo; + } + + // 将字符串转移为ASCII码 + public static String getCnASCII(String cnStr) { + StringBuffer strBuf = new StringBuffer(); + byte[] bGBK = cnStr.getBytes(); + for (int i = 0; i < bGBK.length; i++) { + // System.out.println(Integer.toHexString(bGBK[i]&0xff)); + strBuf.append(Integer.toHexString(bGBK[i] & 0xff)); + } + return strBuf.toString(); + } + + + + //判断字符串是不是以数字开头 + public static boolean isStartWithNumber(String str) { + Pattern pattern = Pattern.compile("[0-9]*"); + Matcher isNum = pattern.matcher(str.charAt(0)+""); + if (!isNum.matches()) { + return false; + } + return true; + } + + } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java new file mode 100644 index 00000000..4e390377 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/CreategetFlowListALLByWfidJob.java @@ -0,0 +1,79 @@ +package com.awspaas.user.apps.integration.job; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.schedule.IJob; +import com.actionsoft.bpms.server.UserContext; +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; +import com.awspaas.user.apps.integration.util.UtilUrl; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import java.util.LinkedHashMap; + +/** + * 伊利oa审批数据获取 + */ +public class CreategetFlowListALLByWfidJob implements IJob { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + try { + + DBSql.update("delete from BO_EU_OA_PROCESS"); + //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() + String xmlStr = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; + + System.out.println("参数==============="+xmlStr); + UserContext userContext = UserContext.fromUID("admin"); + //System.out.println("参数==============="+xmls); + //HttpClientUtil httpClientUtil = new HttpClientUtil(); + int timeout = 600000; + // HttpURLConnection 发送SOAP请求 + System.out.println("HttpURLConnection 发送SOAP请求"); + + String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + + + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>"+rootElement); + Element result = rootElement.element("Body").element("getAllWfIdResponse").element("out"); + String resultString = result.getData().toString(); + System.out.println("resultString=>>>>>>>>>>"+resultString); + JSONArray jsonArray = JSON.parseArray(resultString); + + for (int i=0;i bo_eu_oa_process = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).list(); + // for (BO bo: + // bo_eu_oa_process) { + + + try{ + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("workflowId",tale); + // jsonObject.put("workflowId",bo.getString("WORKFLOWID")); + //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() + jsonObject.put("pageIndex",1); + jsonObject.put("pageSize",3000); + String xmlStr = "\n" + + " " + + " " + + " " + + " " + + ""+jsonObject+""+ + " " + + " " + + " " + + ""; + + System.out.println("参数==============="+xmlStr); + //System.out.println("参数==============="+xmls); + //HttpClientUtil httpClientUtil = new HttpClientUtil(); + int timeout = 600000; + // HttpURLConnection 发送SOAP请求 + System.out.println("HttpURLConnection 发送SOAP请求"); + + String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + + + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>"+rootElement); + Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out"); + String resultString = result.getData().toString(); + System.out.println("resultString=>>>>>>>>>>"+resultString); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("datas"); + JSONArray jsonArray = JSONArray.parseArray(datas); + + System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArray); + UserContext userContext = UserContext.fromUID("admin"); + for (int i=0;i" + + " " + + " " + + " " + + " " + + "" + + "" + + " " + + " LCZD" + + " 922fdd65-104c-4a17-8b52-5e07824b72d3" + + " 您有一条待办流程【关于发布《无菌/保温试验不合格处理流程》的通知】,点击进行处理" + + " https://bpm.yili.com:8088/portal/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId=6ae0dea1-f311-4311-b386-42ae1397e191&taskInstId=922fdd65-104c-4a17-8b52-5e07824b72d3" + + " https://bpm.yili.com:8088/portal/r/or?cmd=com.yili_form_page_open&oauthName=WechatOauthLogin&casaccount=00102699&processInstId=6ae0dea1-f311-4311-b386-42ae1397e191&taskInstId=922fdd65-104c-4a17-8b52-5e07824b72d3" + + " wly" + + " 18:32:33" + + " 18:32:33" + + " 1" + + " 0" + + " -2" + + " 2022-09-05" + + " 2022-09-05" + + " 2022-09-05" + + " 18:32:33" + + " 0" + + " 6ae0dea1-f311-4311-b386-42ae1397e191" + + " 内部审核" + + " wly" + + " " + + " 关于发布《无菌/保温试验不合格处理流程》的通知-李强-2022-09-05 10:40:40" + + " wly" + + " " + + " " + + "" + + "]]>" + + "" + + " " + + " " + + ""; + String postSoap = UtilUrl.doPostSoap("http://10.105.1.59/services/yili", xmlStr, ""); + System.out.println("是否更新为已办:::::::::"+postSoap); + + } +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java new file mode 100644 index 00000000..7f93768a --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/UpdateOADAIBANJob.java @@ -0,0 +1,75 @@ +package com.awspaas.user.apps.integration.job; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.schedule.IJob; +import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.AppAPI; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.integration.XmlDatasUtil; +import com.awspaas.user.apps.integration.util.HttpClientUtil; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class UpdateOADAIBANJob implements IJob { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + List bo_eu_oa_mobileurl = SDK.getBOAPI().query("BO_EU_OA_MOBILEURL", true).list(); + for (BO bo:bo_eu_oa_mobileurl + ) { + XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); + xmlDatasUtil.setExternal_system_ID("LCZD"); + + xmlDatasUtil.setOther_system_to_do_ID(bo.getString("TODOID")); + xmlDatasUtil.setProcess_title(bo.getString("CONTENT")); + //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 + + xmlDatasUtil.setPcurl(bo.getString("PCURL")); + xmlDatasUtil.setMobileurl(bo.getString("MOBILEURL")); + + xmlDatasUtil.setTo_do_login_account(bo.getString("HRCODE")); + xmlDatasUtil.setTo_do_creation_time(bo.getString("NEWCREATETIME")); + xmlDatasUtil.setTo_do_completion_time(bo.getString("NEWDONETIME")); + + xmlDatasUtil.setTo_do_status(bo.getString("STATUS")); + + xmlDatasUtil.setTo_do_official_type(bo.getString("WFTYPE")); + + xmlDatasUtil.setViewtype(bo.getString("VIEWTYPE")); + + xmlDatasUtil.setCreatedate(bo.getString("CREATEDATES")); + xmlDatasUtil.setDonedate(bo.getString("DONEDATE")); + + xmlDatasUtil.setReceivedate(bo.getString("RECEIVEDATE")); + xmlDatasUtil.setReceivetime(bo.getString("RECEIVETIME")); + xmlDatasUtil.setCurrentnodetype(bo.getString("CURRENTNODETYPE")); + + xmlDatasUtil.setRequestcode(bo.getString("REQUESTCODE")); + xmlDatasUtil.setCurrentnodename(bo.getString("CURRENTNODENAME")); + + + xmlDatasUtil.setNooperator(bo.getString("NOOPERATOR")); + xmlDatasUtil.setWorkcode(""); + xmlDatasUtil.setWorkflowname(bo.getString("WORKFLOWNAME")); + + xmlDatasUtil.setCreaterhrcode(bo.getString("CREATERHRCODE")); + + xmlDatasUtil.setCreaterworkcode(""); + HttpClientUtil httpClientUtil = new HttpClientUtil(); + try { + String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil); + System.out.println("更新成功数据》》》》》》"+s); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/deleteTestBO.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/deleteTestBO.java index a57a3fd6..492413a8 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/deleteTestBO.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/deleteTestBO.java @@ -8,8 +8,9 @@ import org.quartz.JobExecutionException; public class deleteTestBO implements IJob { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - DBSql.update( + /*DBSql.update( "drop table T561486" - ); + );*/ + DBSql.update("delete from SYS_NAV_DIRECTORY where DIRECTORYNAME in ('单表','看板','系统') "); } } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/getAllOA.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/getAllOA.java new file mode 100644 index 00000000..0b271210 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/job/getAllOA.java @@ -0,0 +1,16 @@ +package com.awspaas.user.apps.integration.job; + +import com.actionsoft.bpms.schedule.IJob; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +/** + * 存储OA流程数据 + */ +public class getAllOA implements IJob { + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + + + } +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java index 23476fb1..01064034 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/OaPendComponent.java @@ -8,7 +8,10 @@ import java.util.*; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager; import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel; +import com.actionsoft.bpms.commons.login.constant.LoginConst; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.SSOUtil; +import com.actionsoft.bpms.server.UserContext; import com.actionsoft.sdk.local.api.AppAPI; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -143,7 +146,7 @@ public class OaPendComponent { portalUrl = "https://bpm.yili.com:8088/portal/"; } xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); - xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=WechatOauthLogin&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); + xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); String target = taskInstance.getTarget(); if (target.length()==8&&"00".equals(target.substring(0,2))){ target = target.substring(2); @@ -302,7 +305,7 @@ public class OaPendComponent { portalUrl = "https://bpm.yili.com:8088/portal/"; } 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()); - xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=WechatOauthLogin&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+pec.getTaskInstance().getTarget()+"&processInstId="+pec.getProcessInstance().getId()+"&taskInstId="+taskInstance.getId()); String target = taskInstance.getTarget(); if (target.length()==8&&"00".equals(target.substring(0,2))){ @@ -328,7 +331,13 @@ public class OaPendComponent { xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" "))); - String der = df.format(taskInstance.getReadTime()); + 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())); String actionName = getActionName(taskInstance); @@ -350,7 +359,13 @@ public class OaPendComponent { //流程实例id,必填 params.put("processInstId", pec.getProcessInstance().getId()); //,必填 - params.put("sid", pec.getUserContext().getSessionId()); + 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); @@ -371,7 +386,12 @@ public class OaPendComponent { } xmlDatasUtil.setNooperator(username); xmlDatasUtil.setWorkcode(""); - xmlDatasUtil.setWorkflowname(pec.getProcessDef().getName()); + if (pec.getProcessDef()!=null){ + xmlDatasUtil.setWorkflowname(pec.getProcessDef().getName()); + }else { + xmlDatasUtil.setWorkflowname("流程发布"); + } + if (bo_eu_oa_reson!=null){ xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID")); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java index 2fd58f16..17b167b4 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oa/TaskListener.java @@ -97,7 +97,7 @@ public class TaskListener extends ProcessPubicListener { } } else if (PublicEventConst.TASK_DELETE.equals(eventName) || taskInstance.getControlState() == "delete") { - if (actionName == "") { + if (actionName == ""||actionName.equals("收回沟通任务")||(actionName.equals("传阅")&& PublicEventConst.TASK_READ.equals(eventName))) { logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); try { component.updatePending(taskInstance,pec); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/OauthLogin.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/OauthLogin.java index 3aebdab5..4dbaf492 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/OauthLogin.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/OauthLogin.java @@ -11,6 +11,7 @@ import com.actionsoft.bpms.util.DBSql; import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.api.LogAPI; import com.actionsoft.sdk.local.api.Logger; +import com.actionsoft.sdk.service.model.UserModel; import com.alibaba.fastjson.JSONObject; import com.yili.wsclient.ClientService; import org.apache.commons.codec.binary.Base64; @@ -138,6 +139,15 @@ public class OauthLogin extends AbstractOauth { return null; } + + + public long getCookieTime(UserModel user) { + System.out.println("session时间>>>>>>>>>>"+user.getSessionTime()); +//下面的值代表与 AWS PaaS 会话过期时间一致, +//因平台会话过期时间以分钟计,所以需要乘以 60 + return 0; + } + /** * 统一身份认证接口 * @param1 webserviceUrl 身份认证接口地址 @@ -155,6 +165,7 @@ public class OauthLogin extends AbstractOauth { } + public static String geAuthorization(String clientId, String clientSecret) { try { byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8"); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java index b4def502..3f484e5a 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/TaskController.java @@ -62,27 +62,48 @@ public class TaskController { /** * OA系统单点访问PAL系统 - * @param me * @param params * @return */ @Mapping("com.yili_pal_portal_open") - public String openPALConsole(UserContext me, RequestParams params) throws Exception { + public String openPALConsole(String code) throws Exception { ResponseObject ro = ResponseObject.newOkResponse(); - String sessionId = me.getSessionId(); + + + String userid = ""; + + App app = new App(); + String tokens = app.getTokens("http://10.114.11.135:8088/portal/yili.html", code); + if(StringUtils.isEmpty(tokens)){ + System.out.println("这个认证是失败的,code为空,请联系管理员");; + }else { + JSONObject jsonObjects = JSONObject.parseObject(tokens); + String access_token = jsonObjects.getString("access_token"); + String userInfo = app.getUserInfo(access_token); + + if (StringUtils.isNotEmpty(userInfo)){ + JSONObject json = JSONObject.parseObject(userInfo); + System.out.println("json-=====>>>>"+json); + if (StringUtils.isNotEmpty(json.getString("employeenumber"))){ + System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber")); + userid = json.getString("employeenumber"); + } + } + + } + + + String sessionId = UserContext.fromUID(userid).getSessionId(); String portalUrl = SDK.getPortalAPI().getPortalUrl(); - //http://localhost:8089/portal/r/w?cmd=com.actionsoft.apps.coe.pal_user_home_page&sid=0161dfa4-922f-4645-a45a-a68133c160a1#/repository - //打开控制台 - // String palConsoleUrl= portalUrl + "/r/w?cmd=com.actionsoft.apps.coe.pal_user_home_page&sid="+sessionId+"#/repository"; - //打开个人门户、 String url = portalUrl +"/r/w?sid="+sessionId+"&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1"; // String palPortalUrl= portalUrl + "/r/w?sid="+sessionId+"&cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1"; + String portal_url = "https://bpm.yili.com:8088"+"/portal/r/or?cmd=com.actionsoft.apps.skins.mportal3_home_page&id=5af46cd5-a1bc-4125-a144-86d1a199eec1&sid="+sessionId+"&oauthName=oauthLogin&code="+code; //ro.put("new_url",url); - return url; + return portal_url; } @@ -108,30 +129,7 @@ public class TaskController { public String openFormPage(UserContext me, RequestParams params) { System.out.println("进入表单了==========="); System.out.println("参数输出==========="+params.asMap()); - if (StringUtils.isNotEmpty(params.get("state"))){ - if (params.get("state").equals("STATE")){ - String code = params.get("code"); - WechatApp app = new WechatApp(); - String tokens = app.getTokens(code); - if(StringUtils.isEmpty(tokens)){ - //logger.error("获取token为空,请重新输入登录信息获取code"); - return null; - }else { - JSONObject jsonObjects = JSONObject.parseObject(tokens); - String access_token = jsonObjects.getString("UserId"); - System.out.println("UserId======>>>>>>>"+access_token); - //BO detail = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=", access_token).detail(); - // String workcode = detail.getString("WORKCODE"); - //if (workcode.length()!=8){ - // UserContext userContext = UserContext.fromUID(access_token); - //}else{ - UserContext userContext = UserContext.fromUID(access_token); - // } - - } - } - } String sessionId = me.getSessionId(); String portalUrl = SDK.getPortalAPI().getPortalUrl(); @@ -373,7 +371,7 @@ public class TaskController { String dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail().getString("DATAID"); jsonObject.put("dataid", dataid); } - + jsonObject.put("status","1"); String xmlStr = "\n" + " " + " " + @@ -457,8 +455,11 @@ public class TaskController { 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); - lever = lever+".0"; - DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),bo.getString("PUBLISHFILENAME")+"_"+lever+".doc"); + 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"); @@ -469,7 +470,7 @@ public class TaskController { //文档是否允许下载,必填 params_preview.put("isDownload", true); //显示文件名,必填 - params_preview.put("fileNameOriginal", bo.getString("PUBLISHFILENAME")+"_"+lever+".doc"); + params_preview.put("fileNameOriginal", name+"_"+lever+".doc"); //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 params_preview.put("isPDFCovertPNG", 0); //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 @@ -577,8 +578,11 @@ public class TaskController { 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); - lever = lever+".0"; - DCContext dcContext = new DCContext(me, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), bo.getString("TASKID"),bo.getString("CHANGEDFILENAMENEW")+"_"+lever+".doc"); + 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"); @@ -589,7 +593,7 @@ public class TaskController { //文档是否允许下载,必填 params_preview.put("isDownload", true); //显示文件名,必填 - params_preview.put("fileNameOriginal", bo.getString("CHANGEDFILENAMENEW")+"_"+lever+".doc"); + params_preview.put("fileNameOriginal", name+"_"+lever+".doc"); //PDF转图片处理选项。- 0代表只在需要时做转换;- 1代表打开即检查是否已转换成图片,如未处理,强制转换。默认0,非必填 params_preview.put("isPDFCovertPNG", 0); //groupJson参数,用于表单附件OfficeOnline服务预览回传文件流,非必填 diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/ChineseIntoLetters.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/ChineseIntoLetters.java new file mode 100644 index 00000000..ab31797a --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/ChineseIntoLetters.java @@ -0,0 +1,222 @@ +package com.awspaas.user.apps.integration.util; + +import java.util.Random; + +public class ChineseIntoLetters { + + /** + + * 返回首字母 + + * @param strChinese + + * @param bUpCase + + * @return + + */ + + public static String getPYIndexStr(String strChinese, boolean bUpCase){ + + try{ + + StringBuffer buffer = new StringBuffer(); + String chinese = ""; + + byte b[] = strChinese.getBytes("GBK");//把中文转化成byte数组 + + for(int i = 0; i < b.length; i++){ + + if((b[i] & 255) > 128){ + + int char1 = b[i++] & 255; + + char1 <<= 8;//左移运算符用“<<”表示,是将运算符左边的对象,向左移动运算符右边指定的位数,并且在低位补零。其实,向左移n位,就相当于乘上2的n次方 + + int chart = char1 + (b[i] & 255); + + buffer.append(getPYIndexChar((char)chart, bUpCase)); + + continue; + + } + + char c = (char)b[i]; + + //确定指定字符是否是汉字、大写字母、数字 + if(!Character.isJavaIdentifierPart(c) || (c >= 'A' && c <= 'Z') || Character.isDigit(c)){ + + buffer.append(c); + + }if (c >= 'a' && c <= 'z'){ + + buffer.append((char) (c - 'a' + 'A')); + + } + + } + if (buffer.toString().contains("-")){ + chinese = buffer.toString().replaceAll("-","_"); + }else if (buffer.toString().contains(" ")){ + chinese = buffer.toString().replaceAll(" ","_"); + }else { + chinese = buffer.toString(); + } + + if (chinese.contains("\\(")){ + chinese = buffer.toString().replaceAll("\\(","L"); + } + + if (chinese.contains(")")){ + chinese = buffer.toString().replaceAll("[)]","R"); + } + + return chinese; + + }catch(Exception e){ + + e.printStackTrace(); + + } + + return null; + + } + + /** + + * 得到首字母 + + * @param strChinese + + * @param bUpCase + + * @return + + */ + + private static char getPYIndexChar(char strChinese, boolean bUpCase){ + + int charGBK = strChinese; + + char result; + + if(charGBK >= 45217 && charGBK <= 45252){ + + result = 'A'; + + }else if(charGBK >= 45253 && charGBK <= 45760){ + + result = 'B'; + + }else if(charGBK >= 45761 && charGBK <= 46317){ + + result = 'C'; + + }else if(charGBK >= 46318 && charGBK <= 46825){ + + result = 'D'; + + } else if(charGBK >= 46826 && charGBK <= 47009){ + + result = 'E'; + + }else if(charGBK >= 47010 && charGBK <= 47296){ + + result = 'F'; + + }else if(charGBK >= 47297 && charGBK <= 47613){ + + result = 'G'; + + }else if(charGBK >= 47614 && charGBK <= 48118){ + + result = 'H'; + + }else if(charGBK >= 48119 && charGBK <= 49061){ + + result = 'J'; + + } else if(charGBK >= 49062 && charGBK <= 49323){ + + result = 'K'; + + }else if(charGBK >= 49324 && charGBK <= 49895){ + + result = 'L'; + + }else if(charGBK >= 49896 && charGBK <= 50370){ + + result = 'M'; + + }else if(charGBK >= 50371 && charGBK <= 50613){ + + result = 'N'; + + }else if(charGBK >= 50614 && charGBK <= 50621){ + + result = 'O'; + + }else if(charGBK >= 50622 && charGBK <= 50905){ + + result = 'P'; + + }else if(charGBK >= 50906 && charGBK <= 51386){ + + result = 'Q'; + + }else if(charGBK >= 51387 && charGBK <= 51445){ + + result = 'R'; + + }else if(charGBK >= 51446 && charGBK <= 52217){ + + result = 'S'; + + }else if(charGBK >= 52218 && charGBK <= 52697){ + + result = 'T'; + + }else if(charGBK >= 52698 && charGBK <= 52979){ + + result = 'W'; + + }else if(charGBK >= 52980 && charGBK <= 53688){ + + result = 'X'; + + }else if(charGBK >= 53689 && charGBK <= 54480){ + + result = 'Y'; + + }else if(charGBK >= 54481 && charGBK <= 55289){ + + result = 'Z'; + + }else{ + + result = (char)(65 + (new Random()).nextInt(25)); + + } + + if(!bUpCase){ + result = Character.toLowerCase(result); + } + + return result; + + } + + /** + * @param args + */ + + public static void main(String[] args) { + + String str=",.;'90中国cD///*-+"; + + System.out.println("中文首字母:" + getPYIndexStr(str,true)); + + } + +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/JDBCUtil.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/JDBCUtil.java new file mode 100644 index 00000000..743551a5 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/JDBCUtil.java @@ -0,0 +1,34 @@ +package com.awspaas.user.apps.integration.util; + +import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; +import oracle.jdbc.pool.OracleDataSource; + +import java.sql.*; + +public class JDBCUtil { + + + public void comment(String tablename,String flid,String flidname) throws SQLException { + + try { + //加载驱动 + Class.forName("oracle.jdbc.driver.OracleDriver"); + String url ="jdbc:oracle:thin:@10.119.71.12:1521/bpmprod" ; + Connection conn= DriverManager.getConnection(url,"bpmprod","456rty$%^RTY"); + Statement stmt = conn.createStatement(); + String sql = "COMMENT ON T"+tablename+"."+flid+" IS '"+flidname+"'"; + PreparedStatement pstmt = conn.prepareStatement(sql); + boolean execute = pstmt.execute(); + System.out.println("执行成功与否》》》》》》》》》》》》"+execute); + /*while (rs.next()) { + System.out.println(rs.getString("user_password")); + System.out.println(rs.getString("user_name")); + }*/ + pstmt.close(); + stmt.close(); + } catch (Exception e) { + // TODO 自动生成 catch 块 + e.printStackTrace(); + } + } +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/Sayhello.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/Sayhello.java new file mode 100644 index 00000000..78cf1028 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/Sayhello.java @@ -0,0 +1,291 @@ +package com.awspaas.user.apps.integration.webapi; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.org.model.UserModel; +import com.actionsoft.bpms.server.bind.annotation.Controller; +import com.actionsoft.bpms.server.bind.annotation.HandlerType; +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; +import com.awspaas.user.apps.integration.util.UtilUrl; +import com.google.common.reflect.TypeToken; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import org.apache.commons.lang.StringUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + + +@Controller(type = HandlerType.RESTFUL, apiName = "workfolwapi", desc = "这是workflow的相关接口文档") +@Path("/workfolw") +public class Sayhello { + + @GET + public String sayHello() { + return "hello,world! - get"; + } + + @POST + public String sayHelloPost() { + return "hello,world!- post "; + } + + + /** + * 获取activiti流程信息 + * @param processIdAndDateline Key:流程定义ID,value:流程上次抽取的时间点(第一次抽取value为null),即此流程本次抽取数据的开始时间 + * @param nowDateTime 此次抽取数据结束时间点 + * @return activiti流程信息 + * @throws DocumentException + * @throws ParseException + */ + @Path("/process") + @POST + public String sayHelloQueryParam(@QueryParam("processIdAndDateline") String processIdAndDateline, @QueryParam("nowDateTime") String nowDateTime) throws DocumentException, ParseException { + JSONObject result = new JSONObject(new LinkedHashMap<>()); + Map res = null; + try { + Gson gson = new Gson(); + res = gson.fromJson(processIdAndDateline, new TypeToken>() { + }.getType()); + } catch (JsonSyntaxException e) { + e.printStackTrace(); + } + + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("workflowId",747487); + //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() + jsonObject.put("pageIndex",1); + jsonObject.put("pageSize",3000); + String xmlStr = "\n" + + " " + + " " + + " " + + " " + + ""+jsonObject+""+ + " " + + " " + + " " + + ""; + + System.out.println("参数==============="+xmlStr); + //System.out.println("参数==============="+xmls); + //HttpClientUtil httpClientUtil = new HttpClientUtil(); + int timeout = 600000; + // HttpURLConnection 发送SOAP请求 + System.out.println("HttpURLConnection 发送SOAP请求"); + + String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + + + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>"+rootElement); + Element results = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out"); + String resultString = results.getData().toString(); + System.out.println("resultString=>>>>>>>>>>"+resultString); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("datas"); + JSONArray jsonArrays = JSONArray.parseArray(datas); + + System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArrays); + JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); + for (int i=0;i()); + + Map res = null; + try { + Gson gson = new Gson(); + res = gson.fromJson(processIdAndDateline, new TypeToken>() { + }.getType()); + } catch (JsonSyntaxException e) { + e.printStackTrace(); + } + + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("workflowId",747487); + //jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + //jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser() + jsonObject.put("pageIndex",1); + jsonObject.put("pageSize",3000); + String xmlStr = "\n" + + " " + + " " + + " " + + " " + + ""+jsonObject+""+ + " " + + " " + + " " + + ""; + + System.out.println("参数==============="+xmlStr); + //System.out.println("参数==============="+xmls); + //HttpClientUtil httpClientUtil = new HttpClientUtil(); + int timeout = 600000; + // HttpURLConnection 发送SOAP请求 + System.out.println("HttpURLConnection 发送SOAP请求"); + + String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + + + Document document = DocumentHelper.parseText(postSoap); + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>"+rootElement); + Element results = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out"); + String resultString = results.getData().toString(); + System.out.println("resultString=>>>>>>>>>>"+resultString); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("datas"); + JSONArray jsonArrays = JSONArray.parseArray(datas); + + System.out.println("jsonArrayData》》》》》》》》》》》》"+jsonArrays); + JSONArray jsonArray_new = new JSONArray(new LinkedList<>()); + for (int i=0;i>>>>>>"+user); + UserModel model = SDK.getORGAPI().getUser(user); + System.out.println("model>>>>>>>>>>"+model); + if (model!=null){ + jsonObject2.put("assigneeDeptId",model.getDepartmentId()); + jsonObject2.put("assigneeRoleId",model.getRoleId()); + }else { + jsonObject2.put("assigneeDeptId","a93a7f77-8b11-4261-8770-20b0cdfab315"); + jsonObject2.put("assigneeRoleId","d102c89d-55f3-4865-9d5c-c00b7f47b803"); + } + + + + jsonObject2.put("actionName",JSONObject.parseObject(jsonArrays.get(i).toString()).get("operateType")); + jsonObject2.put("startTime",JSONObject.parseObject(jsonArrays.get(i).toString()).get("operateDate")); + jsonObject2.put("endTime",JSONObject.parseObject(jsonArrays.get(i).toString()).get("receiveDate")); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date beginDate = sdf.parse(JSONObject.parseObject(jsonArrays.get(i).toString()).get("operateDate").toString()); + Date endDate = sdf.parse(JSONObject.parseObject(jsonArrays.get(i).toString()).get("receiveDate").toString()); + long dates = (endDate.getTime()-beginDate.getTime())/(1000 * 60); + jsonObject2.put("durationInMillis",dates); + jsonArray_new.add(jsonObject2); + } + + result.put("code","1"); + result.put("msg","success"); + result.put("body",jsonArray_new); + return result.toString(); + } + + @Path("/defid") + @POST + public String getTasksByProcessDefId(@QueryParam("processIdAndDateline") String processIdAndDateline, @QueryParam("nowDateTime") String nowDateTime) throws DocumentException { + JSONObject result = new JSONObject(new LinkedHashMap<>()); + JSONObject jsonObject_newe = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray = new JSONArray(new LinkedList<>()); + + List rowMap = DBSql.getMaps("SELECT DISTINCT WORKFLOWID FROM BO_EU_OA_PROCESS_TASK "); + JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); + for (RowMap rowMapsw: + rowMap) { + + + List list = SDK.getBOAPI().query("BO_EU_OA_PROCESS_TASK").addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).list(); + jsonObject.put("processName",list.get(0).getString("WORKFLOWNAME")); + jsonObject.put("category",list.get(0).getString("WORKFLOWTYPE_OA")); + BO bos = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).detail(); + if (bos.getString("VERSION")!=null||bos.getString("VERSION")!=""){ + jsonObject.put("version",bos.getString("VERSION")); + }else { + jsonObject.put("version","1"); + } + JSONArray jsonArray1 =new JSONArray(); + for (BO bo: + list) { + JSONObject jsonObject1 = new JSONObject(new LinkedHashMap<>()); + jsonObject1.put("taskNo",bo.getString("NODEID")); + jsonObject1.put("taskName",bo.getString("NODENAME")); + jsonArray1.add(jsonObject1); + } + jsonObject.put("taskNodesList",jsonArray1); + } + + + jsonObject_newe.put("dispatch",jsonObject); + result.put("code","1"); + result.put("msg","success"); + result.put("body",jsonObject_newe); + return result.toString(); + } + + + + +} diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/WorkFlowAPI.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/WorkFlowAPI.java new file mode 100644 index 00000000..32061a3b --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/webapi/WorkFlowAPI.java @@ -0,0 +1,125 @@ +package com.awspaas.user.apps.integration.webapi; + +import com.actionsoft.bpms.cc.api.PermRequire; +import com.actionsoft.bpms.cc.api.RequireType; +import com.actionsoft.bpms.server.bind.annotation.Controller; +import com.actionsoft.bpms.server.bind.annotation.HandlerType; +import com.actionsoft.bpms.server.bind.annotation.Mapping; +import com.actionsoft.bpms.server.bind.annotation.Param; +import com.actionsoft.sdk.service.response.StringResponse; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.integration.util.UtilUrl; +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.HttpClients; +import org.apache.http.util.EntityUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.simpleframework.xml.Path; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.LinkedHashMap; +import java.util.Map; + +@Controller(type= HandlerType.OPENAPI, apiName = "WorkFlowAPI", desc = "BPA流程接口") +@PermRequire({RequireType.APP, RequireType.CUSTOM, RequireType.ORG, RequireType.BO, RequireType.PROCESS, RequireType.ALL}) +@Path("/WorkFlow") +public class WorkFlowAPI { + + + @Mapping(value = "WorkFlow.getFlowList") + public StringResponse getFlowList( + @Param(value = "workflowId" , desc = "流程id" , required = true) int workflowId, + @Param(value = "createDateStart" , desc = "创建开始时间" , required = false) String createDateStart, + @Param(value = "createDateEnd" , desc = "创建结束时间" , required = false) String createDateEnd, + @Param(value = "pageIndex" , desc = "页数" , required = true) int pageIndex, + @Param(value = "pageSize" , desc = "每页个数" , required = true) int pageSize) throws Exception { + System.err.println(">>>>调用getFlowList成功!"); + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("workflowId",workflowId); + jsonObject.put("createDateStart",createDateStart); + jsonObject.put("createDateEnd",createDateEnd); + jsonObject.put("pageIndex",pageIndex); + jsonObject.put("pageSize",pageSize); + + String xmlStr = "\n" + + " " + + " " + + " " + + " " + + ""+jsonObject+""+ + " " + + " " + + " " + + ""; + + System.out.println("参数==============="+xmlStr); + String postSoap = UtilUrl.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, ""); + + + Document document = null; + try { + document = DocumentHelper.parseText(postSoap); + } catch (DocumentException e) { + e.printStackTrace(); + } + Element rootElement = document.getRootElement(); + System.out.println("rootElement>>>>>>"+rootElement); + Element result = rootElement.element("Body").element("getFlowListByWfIdResponse").element("out"); + String resultString = result.getData().toString(); + System.out.println("resultString=>>>>>>>>>>"+resultString); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("datas"); + + + + JSONObject jsonObject2 = new JSONObject(); + Map map = new LinkedHashMap(); + map.put("747487",null); + jsonObject2.put("processIdAndDateline",map); + jsonObject2.put("nowDateTime",System.currentTimeMillis()+86400); + return null; + } + + @Mapping("/process/history/getProcessByProcessDefId") + public String getProcessByProcessDefId(){ + + return "Say Hello"; + } + + + public static String httpPostJson(String url,String json) throws Exception{ + String data=""; + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + try { + httpClient = HttpClients.createDefault(); + HttpPost httppost = new HttpPost(url); + httppost.setHeader("Content-Type", "application/json;charset=UTF-8"); + StringEntity se = new StringEntity(json, Charset.forName("UTF-8")); + se.setContentType("text/json"); + se.setContentEncoding("UTF-8"); + httppost.setEntity(se); + response = httpClient.execute(httppost); + int code = response.getStatusLine().getStatusCode(); + System.out.println("接口响应码:"+code); + data = EntityUtils.toString(response.getEntity(), "utf-8"); + EntityUtils.consume(response.getEntity()); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if(response!=null){ try{response.close();}catch (IOException e){} } + if(httpClient!=null){ try{httpClient.close();}catch(IOException e){} } + } + return data; + } + + + +}