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 index 3678f392..c93d62b3 100644 --- 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 @@ -1,8 +1,15 @@ package com.awspaas.user.apps.integration.controller; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; +import com.actionsoft.bpms.server.RequestParams; +import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; +import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.FormAPI; +import com.actionsoft.sdk.local.api.ProcessExecuteQuery; import java.util.LinkedHashMap; @@ -13,5 +20,16 @@ public String toIndex(){ return HtmlPageTemplate.merge("com.awspaas.user.apps.yili.integration","domainprocess.html",new LinkedHashMap<>()); } +@Mapping(value = "com.awspaas.user.apps.integration.controller.GetSomeIndexController.getProcessCenter") + public String getProcessCenter(UserContext me, RequestParams params){ + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_fb1c7a54b98b412187388c8bab407362", me.getUID(), me.getUserName() + "发起流程发布流程"); + //ProcessExecuteQuery start = SDK.getProcessAPI().start(processInstance); + //String startTaskInstId = processInstance.getStartTaskInstId(); + TaskInstance taskInstance = (TaskInstance) SDK.getProcessAPI().start(processInstance).fetchActiveTasks().get(0); + String url = SDK.getPortalAPI().getPortalUrl() + "/r/w?sid=" + me.getSessionId() + + "&cmd=CLIENT_BPM_FORM_MAIN_PAGE_OPEN&processInstId=" + processInstance.getId() + "&taskInstId=" + + taskInstance.getId() + "&openState=1&reloadedFile=1"; + return SDK.getFormAPI().getFormPage(me,processInstance.getId(),taskInstance.getId(),taskInstance.getState(),1,"","","",true); +} } 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 index 20ddd799..4e3d5b8f 100644 --- 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 @@ -29,9 +29,7 @@ public class GetmeritsController { list.add(1,"L1流程架构"); list.add(2,"绩效指标"); result.put("headtop",list); - if (StringUtils.isEmpty(departname)){ - - + if (departname.equals("全部")){ /** * 战略流程 */ @@ -391,7 +389,7 @@ public class GetmeritsController { JSONObject result = new JSONObject(new LinkedHashMap<>()); JSONArray jsonArray_content = new JSONArray(new LinkedList<>()); - if (StringUtils.isEmpty(departname)){ + if (departname.equals("全部")){ @@ -840,7 +838,7 @@ public class GetmeritsController { @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.tabledrag") public JSONObject tabledrag(String sid,String id,String departname){ JSONObject result = new JSONObject(new LinkedHashMap<>()); - if (StringUtils.isEmpty(departname)){ + if (departname.equals("全部")){ List list = new LinkedList(); list.add("流程绩效指标"); list.add("衡量单位"); @@ -876,8 +874,10 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》"+deoa ); + }else { + deoa = "'"+data+"'"; } - if (deoa.indexOf(Plname_num)>=0){ + if (deoa.indexOf("'"+Plname_num+"'")>=0){ JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); JSONObject jsonObject_num1 = new JSONObject(new LinkedHashMap<>()); @@ -919,12 +919,12 @@ public class GetmeritsController { 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); + 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 { @@ -947,6 +947,8 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》" + deoa ); + }else { + deoa = "'"+data+"'"; } if (deoa.indexOf("'" + Planme_num + "'") >= 0) { JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); @@ -989,12 +991,12 @@ public class GetmeritsController { 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); + 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{ @@ -1015,6 +1017,8 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》" + deoa ); + }else { + deoa = "'"+data+"'"; } if (deoa.indexOf("'" + Planme_num + "'") >= 0) { JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); @@ -1058,12 +1062,12 @@ public class GetmeritsController { 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); + 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); } @@ -1109,6 +1113,8 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》" + deoa ); + }else { + deoa = "'"+data+"'"; } if (deoa.indexOf("'"+Plname_num+"'") >= 0) { JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); @@ -1151,12 +1157,12 @@ public class GetmeritsController { 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); + 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 { @@ -1179,6 +1185,8 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》" + deoa ); + }else { + deoa = "'"+data+"'"; } if (deoa.indexOf("'" + Planme_num + "'") >= 0) { @@ -1222,12 +1230,12 @@ public class GetmeritsController { 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); + 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{ @@ -1248,6 +1256,8 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》" + deoa ); + }else { + deoa = "'"+data+"'"; } if (deoa.indexOf("'" + Planme_num + "'") >= 0) { JSONObject jsonObject_name = new JSONObject(new LinkedHashMap<>()); @@ -1291,12 +1301,12 @@ public class GetmeritsController { 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); + 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); } @@ -1310,7 +1320,8 @@ public class GetmeritsController { @Mapping("com.awspaas.user.apps.integration.controller.GetmeritsController.getnewTable") public JSONArray getnewTable(String sid, String plname, String departname){ JSONArray result = new JSONArray(new LinkedList<>()); - if (StringUtils.isEmpty(departname)){ + if (departname.equals("全部")){ + /** * 这个是L1流程绩效指标数据汇总 */ @@ -1360,14 +1371,41 @@ public class GetmeritsController { maps) { ids+=rowMap.getString("ID")+","; JSONObject jsonObject_child_2 = new JSONObject(new LinkedHashMap<>()); - jsonObject_child_2.put("content",rowMap.getString("PLNAME")); + JSONObject jsonObject_child_2_content = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_child_2_content = new JSONArray(new LinkedList<>()); + jsonObject_child_2.put("name",rowMap.getString("PLNAME")); jsonObject_child_2.put("id",rowMap.getString("ID")); - jsonArray_child_2.add(jsonObject_child_2); + jsonArray_child_2_content.add(jsonObject_child_2); + jsonObject_child_2_content.put("content",jsonArray_child_2_content); + jsonArray_child_2.add(jsonObject_child_2_content); String names2 = rowMap.getString("PLNAME").substring(0,rowMap.getString("PLNAME").indexOf(" ")); + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PERFORMANCE_TYPE = 'L1L3流程绩效' and SYNCHRONOUS_HOME like '%" + names2 + "%'"); + int counts = Integer.valueOf(string); + List maps1 = DBSql.getMaps("select * from BO_EU_PER_IND_LIB where PERFORMANCE_TYPE = 'L1L3流程绩效' and SYNCHRONOUS_HOME like '%" + names2 + "%'"); + for (RowMap rw: + maps1) { + String synchronous_home = rw.getString("SYNCHRONOUS_HOME"); + String deoa = ""; + if (synchronous_home.contains(",")){ + String[] ds = synchronous_home.split(","); + if(ds.length==1){ + deoa= "'"+ds[0]+"'"; + } + deoa ="'"+ StringUtils.join(ds, "','")+"'"; + System.out.println( + "deoa》》》》》》》》》》"+deoa + ); + }else { + deoa = "'" +synchronous_home+"'"; + } + String names_num = "'"+names2+"'"; + if (deoa.indexOf(names_num) == -1){ + counts-=1; + } + } - String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PERFORMANCE_TYPE = 'L1L3流程绩效' and SYNCHRONOUS_HOME like '" + names2 + "%'"); - list_num_2.add(t, Integer.valueOf(string)); + list_num_2.add(t, counts); t++; } @@ -1389,48 +1427,51 @@ public class GetmeritsController { String[] plid = dleass.split(","); int y=0; - - String sqls3_1 = "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 mapsss = DBSql.getMaps(sqls3_1); - for (RowMap rowmaps : mapsss) { - String name2s = rowmaps.getString("PLNAME").substring(0, rowmaps.getString("PLNAME").indexOf(" ")); - List bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PERFORMANCE_TYPE=", "L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%" + name2s + "'", null).list(); - Map map_name = new LinkedHashMap<>(); - int p = 0; - for (BO bo : - bo_list) { - String data = bo.getString("SYNCHRONOUS_HOME"); - String deoa = ""; - if (data.contains(",")){ - String[] ds = data.split(","); - if(ds.length==1){ - deoa= "'"+ds[0]+"'"; + for (String ikds:plid + ) { + String sqls3_1 = "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 mapsss = DBSql.getMaps(sqls3_1); + for (RowMap rowmaps : mapsss) { + String name2s = rowmaps.getString("PLNAME").substring(0, rowmaps.getString("PLNAME").indexOf(" ")); + List bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PERFORMANCE_TYPE=", "L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%" + name2s + "%'", null).list(); + Map map_name = new LinkedHashMap<>(); + int p = 0; + List bo_lists = new LinkedList<>(); + for (BO bo : + bo_list) { + String data = bo.getString("SYNCHRONOUS_HOME"); + String deoa = ""; + if (data.contains(",")) { + String[] ds = data.split(","); + if (ds.length == 1) { + deoa = "'" + ds[0] + "'"; + } + deoa = "'" + StringUtils.join(ds, "','") + "'"; + System.out.println( + "deoa》》》》》》》》》》" + deoa + ); + } else { + deoa = "'" + data + "'"; + } + if (deoa.indexOf("'" + name2s + "'") >= 0) { + String indicatorName = bo.getString("PERFORMANCE_INDICATOR_NAME"); + map_name.put(Integer.valueOf(p), indicatorName); + bo_lists.add(bo); + p++; } - deoa ="'"+ StringUtils.join(ds, "','")+"'"; - System.out.println( - "deoa》》》》》》》》》》"+deoa - ); - } - if (deoa.indexOf("'"+name2s+"'")>= 0){ - String indicatorName = bo.getString("PERFORMANCE_INDICATOR_NAME"); - map_name.put(Integer.valueOf(p), indicatorName); - p++; - }else { - map_name.put(Integer.valueOf(p), ""); - p++; - } - } - if (Integer.valueOf(bo_list.size()) < maxs) { - for (int i = bo_list.size(); i < maxs; i++) { - map_name.put(Integer.valueOf(p), ""); - p++; } + if (Integer.valueOf(bo_lists.size()) < maxs) { + for (int i = bo_lists.size(); i < maxs; i++) { + map_name.put(Integer.valueOf(p), ""); + p++; + } + } + System.out.println("mmap>>>>>>>>>>>>>>>>>>>"+map_name); + list_pq_2.add(y, map_name); + y++; } - list_pq_2.add(y, map_name); - y++; } - JSONObject jsonObject_child_2_father = new JSONObject(new LinkedHashMap<>()); jsonObject_child_2_father.put("child",jsonArray_child_2); @@ -1456,6 +1497,12 @@ public class GetmeritsController { JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); System.out.println("h>>>>>>>>>>>>>>>" + h); jsonObject_child_content_3_name_last.put("name", list_pq_2.get(h).get(i)); + if(StringUtils.isNotEmpty(list_pq_2.get(h).get(i))){ + + jsonObject_child_content_3_name_last.put("num", "1"); + }else { + jsonObject_child_content_3_name_last.put("num", "0"); + } jsonArray_child_content_3_last.add(jsonObject_child_content_3_name_last); h++; } @@ -1467,10 +1514,16 @@ public class GetmeritsController { jsonObject_child_3_last.put("child",jsonArray_child_3_last); } + + if (StringUtils.isNotEmpty(jsonObject_child_3_last.get("child").toString())){ + int child = countStr(jsonObject_child_3_last.get("child").toString(), "{\"name\":\"\","); + if (plid.length==child){ + continue; + } + } jsonArray_levels_2.add(jsonObject_child_3_last); } - //jsonArray_levels_2.add(jsonObject_child_2_1_father); jsonObject_L2.put("levels_2",jsonArray_levels_2); @@ -1524,7 +1577,7 @@ public class GetmeritsController { List mapss = DBSql.getMaps(sqls3); for (RowMap rowmaps : mapss) { String name2s = rowmaps.getString("PLNAME").substring(0,rowmaps.getString("PLNAME").indexOf(" ")); - List bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB",true).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '"+name2s+"%'",null).list(); + List bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB",true).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%"+name2s+"%'",null).list(); Map map_name = new LinkedHashMap<>(); int p = 0; for (BO bo: @@ -1619,6 +1672,12 @@ public class GetmeritsController { JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); System.out.println("h>>>>>>>>>>>>>>>"+h); jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i)); + if (StringUtils.isNotEmpty(list_pq.get(h).get(i))){ + + jsonObject_child_content_3_name_last.put("num","1"); + }else { + jsonObject_child_content_3_name_last.put("num","0"); + } jsonArray_child_content_3_last.add(jsonObject_child_content_3_name_last); h++; } @@ -1693,14 +1752,41 @@ public class GetmeritsController { maps) { ids+=rowMap.getString("ID")+","; JSONObject jsonObject_child_2 = new JSONObject(new LinkedHashMap<>()); - jsonObject_child_2.put("content",rowMap.getString("PLNAME")); + JSONObject jsonObject_child_2_content = new JSONObject(new LinkedHashMap<>()); + JSONArray jsonArray_child_2_content = new JSONArray(new LinkedList<>()); + jsonObject_child_2.put("name",rowMap.getString("PLNAME")); jsonObject_child_2.put("id",rowMap.getString("ID")); - jsonArray_child_2.add(jsonObject_child_2); + jsonArray_child_2_content.add(jsonObject_child_2); + jsonObject_child_2_content.put("content",jsonArray_child_2_content); + jsonArray_child_2.add(jsonObject_child_2_content); String names2 = rowMap.getString("PLNAME").substring(0,rowMap.getString("PLNAME").indexOf(" ")); + String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where PERFORMANCE_TYPE = 'L1L3流程绩效' and NDICATOR_USER_DEFINED_LABEL ='"+departname+"' and SYNCHRONOUS_HOME like '%" + names2 + "%'"); + int counts = Integer.valueOf(string); + List maps1 = DBSql.getMaps("select * from BO_EU_PER_IND_LIB where PERFORMANCE_TYPE = 'L1L3流程绩效' and NDICATOR_USER_DEFINED_LABEL ='"+departname+"' and SYNCHRONOUS_HOME like '%" + names2 + "%'"); + for (RowMap rw: + maps1) { + String synchronous_home = rw.getString("SYNCHRONOUS_HOME"); + String deoa = ""; + if (synchronous_home.contains(",")){ + String[] ds = synchronous_home.split(","); + if(ds.length==1){ + deoa= "'"+ds[0]+"'"; + } + deoa ="'"+ StringUtils.join(ds, "','")+"'"; + System.out.println( + "deoa》》》》》》》》》》"+deoa + ); + }else { + deoa = "'" +synchronous_home+"'"; + } + String names_num = "'"+names2+"'"; + if (deoa.indexOf(names_num) == -1){ + counts-=1; + } + } - String string = DBSql.getString("select count(*) from BO_EU_PER_IND_LIB where NDICATOR_USER_DEFINED_LABEL = '"+departname+"' and PERFORMANCE_TYPE = 'L1L3流程绩效' and SYNCHRONOUS_HOME like '" + names2 + "%'"); - list_num_2.add(t, Integer.valueOf(string)); + list_num_2.add(t, counts); t++; } @@ -1730,6 +1816,7 @@ public class GetmeritsController { List bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("NDICATOR_USER_DEFINED_LABEL=",departname).addQuery("PERFORMANCE_TYPE=", "L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%" + name2s + "%'", null).list(); Map map_name = new LinkedHashMap<>(); int p = 0; + List bo_lists = new LinkedList<>(); for (BO bo : bo_list) { String data = bo.getString("SYNCHRONOUS_HOME"); @@ -1743,19 +1830,18 @@ public class GetmeritsController { System.out.println( "deoa》》》》》》》》》》"+deoa ); + }else { + deoa = "'"+data+"'"; } if (deoa.indexOf("'"+name2s+"'")>= 0){ String indicatorName = bo.getString("PERFORMANCE_INDICATOR_NAME"); map_name.put(Integer.valueOf(p), indicatorName); - p++; - }else { - - map_name.put(Integer.valueOf(p), ""); + bo_lists.add(bo); p++; } } - if (Integer.valueOf(bo_list.size()) < maxs) { - for (int i = bo_list.size(); i < maxs; i++) { + if (Integer.valueOf(bo_lists.size()) < maxs) { + for (int i = bo_lists.size(); i < maxs; i++) { map_name.put(Integer.valueOf(p), ""); p++; } @@ -1790,6 +1876,12 @@ public class GetmeritsController { JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); System.out.println("h>>>>>>>>>>>>>>>" + h); jsonObject_child_content_3_name_last.put("name", list_pq_2.get(h).get(i)); + if (StringUtils.isNotEmpty(list_pq_2.get(h).get(i))){ + jsonObject_child_content_3_name_last.put("num", "1"); + }else { + jsonObject_child_content_3_name_last.put("num", "0"); + } + jsonArray_child_content_3_last.add(jsonObject_child_content_3_name_last); h++; } @@ -1801,6 +1893,13 @@ public class GetmeritsController { jsonObject_child_3_last.put("child",jsonArray_child_3_last); } + + if (StringUtils.isNotEmpty(jsonObject_child_3_last.get("child").toString())){ + int child = countStr(jsonObject_child_3_last.get("child").toString(), "{\"name\":\"\","); + if (plid.length==child){ + continue; + } + } jsonArray_levels_2.add(jsonObject_child_3_last); } @@ -1808,6 +1907,7 @@ public class GetmeritsController { //jsonArray_levels_2.add(jsonObject_child_2_1_father); jsonObject_L2.put("levels_2",jsonArray_levels_2); + /** * 这是L3流程绩效指标 */ @@ -1950,6 +2050,11 @@ public class GetmeritsController { JSONObject jsonObject_child_content_3_name_last = new JSONObject(new LinkedHashMap<>()); System.out.println("h>>>>>>>>>>>>>>>"+h); jsonObject_child_content_3_name_last.put("name",list_pq.get(h).get(i)); + if (StringUtils.isNotEmpty(list_pq.get(h).get(i))) { + jsonObject_child_content_3_name_last.put("num","1"); + }else { + jsonObject_child_content_3_name_last.put("num","0"); + } jsonArray_child_content_3_last.add(jsonObject_child_content_3_name_last); h++; } @@ -1977,5 +2082,17 @@ public class GetmeritsController { } } + public static int countStr(String one, String two){ + int counter=0; + if (one.indexOf(two) == -1) { + return 0; + } + while(one.indexOf(two)!=-1){ + counter++; + one=one.substring(one.indexOf(two)+two.length()); + } + return counter; + } + } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java index db558cc4..0287b14f 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/controller/SendOAProcessController.java @@ -5,22 +5,30 @@ import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.api.AppAPI; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.awspaas.user.apps.integration.XmlDatasUtil; import com.awspaas.user.apps.integration.util.HttpClientUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; import java.io.IOException; import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.Map; +import java.util.*; @Controller public class SendOAProcessController { @Mapping("com.awspaas.user.apps.integration.controller.SendOAProcessController.SendProcessByOA") - public void SendProcessByOA(String sid,String taskInstId,String processInstId,String PROCESS_TITLE) throws IOException { + public JSONObject SendProcessByOA(String sid,String taskInstId,String processInstId) throws IOException, DocumentException { + JSONObject result = new JSONObject(new LinkedHashMap<>()); ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processInstId); TaskInstance instanceById1 = SDK.getTaskAPI().getInstanceById(taskInstId); XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); @@ -28,10 +36,15 @@ public class SendOAProcessController { xmlDatasUtil.setOther_system_to_do_ID(instanceById1.getId()); BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId).detail(); if (bo_act_coe_publish!=null){ - //流程文件发布申请 xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); }else { - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+PROCESS_TITLE+"】,点击进行处理"); + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", instanceById.getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_TITLE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+instanceById.getTitle()+"】,点击进行处理"); + } + } //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 @@ -130,5 +143,49 @@ public class SendOAProcessController { HttpClientUtils httpClientUtil = new HttpClientUtils(); String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil); + + BO bo = new BO(); + bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID()); + bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID()); + bo.set("CONTENT",xmlDatasUtil.getProcess_title()); + bo.set("PCURL",xmlDatasUtil.getPcurl()); + bo.set("MOBILEURL",xmlDatasUtil.getMobileurl()); + bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account()); + bo.set("STATUS",xmlDatasUtil.getTo_do_status()); + bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type()); + bo.set("VIEWTYPE",xmlDatasUtil.getViewtype()); + bo.set("CREATEDATES",xmlDatasUtil.getCreatedate()); + bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time()); + bo.set("DONEDATE",xmlDatasUtil.getDonedate()); + bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status()); + bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate()); + bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime()); + bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype()); + bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode()); + bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename()); + bo.set("NOOPERATOR",xmlDatasUtil.getNooperator()); + bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode()); + bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname()); + bo.set("OA_RESULT",s); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bo.set("OA_DATE",sdf.format(new Date())); + SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(instanceById1.getTarget())); + + if (s.contains("success")){ + result.put("result","ok"); + }else { + result.put("result","error"); + System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); + TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskInstId); + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", taskInstance.getTarget()+ "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","1"); + bo_faid.set("TASK_ID",taskInstId); + bo_faid.set("PROCESS_ID",processInstId); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); + } + return result; } } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/CreateDataKnow.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/CreateDataKnow.java index 695e9841..ccb703ba 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/CreateDataKnow.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/CreateDataKnow.java @@ -9,6 +9,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel; import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb; import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.schedule.IJob; @@ -28,10 +29,8 @@ import org.quartz.JobExecutionException; import javax.swing.tree.RowMapper; import java.sql.Connection; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.text.SimpleDateFormat; +import java.util.*; /** * 创建已发布的知识 @@ -50,7 +49,9 @@ public class CreateDataKnow implements IJob { String portalUrl = SDK.getPortalAPI().getPortalUrl(); String sid = ssoUtil.registerClientSessionNoPassword(USERID, "cn", portalUrl, "pc"); UserContext userContext = UserContext.fromSessionId(sid); - System.out.println("创建维度准备开始==============="); + System.out.println("创建知识准备开始==============="); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + System.out.println("开始时间是>>>>>>>>>>"+sdf.format(new Date())); String sql = "select * from APP_ACT_COE_PAL_REPOSITORY " + "where PLCATEGORY = 'process'and PLMETHODID !='process.framework' " + "and ISPUBLISH = '1' and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'" + @@ -191,7 +192,7 @@ public class CreateDataKnow implements IJob { " 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'," + + " and ISPUBLISH = '1' 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'," + @@ -287,6 +288,11 @@ public class CreateDataKnow implements IJob { ")"; List maps = DBSql.getMaps(sql_upfile); for (RowMap row : maps) { + System.out.println("附件的名称>>>>>>>>>>"+row.getString("FILENAME")); + if (!row.getString("FILENAME").contains(".xml")){ + try { + + UpfileModel upfileModel = new UpfileModel(); upfileModel.setType(row.getString("FILETYPE")); upfileModel.setFileName(row.getString("FILENAME")); @@ -297,6 +303,11 @@ public class CreateDataKnow implements IJob { AppAPI appAPIs = SDK.getAppAPI(); ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss); System.out.println("流程模型附件的生成============="+ros); + }catch (Exception e){ + System.out.println("附件无法上传>>>>>>>>"+row.getString("FILENAME")); + } + } + } //DCContext对象,必填 @@ -356,11 +367,84 @@ public class CreateDataKnow implements IJob { System.out.println("知识发布============"+ro); - + String sql_ext4 = "select PERMTYPE,ORGPERM from BO_ACT_PUBLISH_PERM_SCOPE where PALVERSIONID = (select PLVERSIONID from APP_ACT_COE_PAL_REPOSITORY where ISPUBLISH = '1' AND EXT4 = '"+id.substring(0,id.length()-1)+"')"; + RowMap rowMap = DBSql.getMap(sql_ext4); + System.out.println("rowMap>>>>>>>>"+rowMap); + System.out.println("sqls>>>>>>>>"+sql_ext4); + JSONArray jsonArray1 = new JSONArray(new LinkedList<>()); + if (rowMap==null){ + List select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT"); + for (RowMap depaid: + select_id_from_orgdepartment) { + String id_depart = depaid.getString("ID"); + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType","department"); + jsonObjecta.put("assignmentId",id_depart); + jsonArray1.add(jsonObjecta); + } + }else { + String permtype = rowMap.getString("PERMTYPE"); + if (permtype.equals("1")) { + List select_id_from_orgdepartment = DBSql.getMaps("select ID from ORGDEPARTMENT"); + for (RowMap depaid : + select_id_from_orgdepartment) { + String depaid_id = depaid.getString("ID"); + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType", "department"); + jsonObjecta.put("assignmentId", depaid_id); + jsonArray1.add(jsonObjecta); + } + } else { + String org_depart = rowMap.getString("ORGPERM"); + String deoa = ""; + if (org_depart.contains(",")) { + String[] ds = org_depart.split(","); + for (String depaid : + ds) { + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType", "department"); + jsonObjecta.put("assignmentId", depaid); + jsonArray1.add(jsonObjecta); + } + } else { + deoa = org_depart; + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType", "department"); + jsonObjecta.put("assignmentId", deoa); + jsonArray1.add(jsonObjecta); + } + } + } + AddKnwlAC(jsonArray1,userContext.getSessionId(),id.substring(0,id.length()-1)); } + + public boolean AddKnwlAC(JSONArray jsonArray, String sid, String knwlId) { +// 调用App + String sourceAppId = APPID; +// aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.kms/AddKnwlAC"; +// 参数定义列表 + Map params = new HashMap(); +//[{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填 + params.put("acList", jsonArray); +//sid,如果为空,则需要传createUser参数,非必填 + params.put("sid", sid); +//知识ID,必填 + params.put("knwlId", knwlId); + AppAPI appAPI = SDK.getAppAPI(); +//给知识授权 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + System.out.println("授权>>>>>>>>>>>>"+ro); + return ro.isOk(); + } + + + + + } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java new file mode 100644 index 00000000..585c83fd --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/event/ProcessAfterData.java @@ -0,0 +1,549 @@ +package com.awspaas.user.apps.integration.event; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; +import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; +import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance; +import com.actionsoft.bpms.commons.login.constant.LoginConst; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.org.cache.UserCache; +import com.actionsoft.bpms.org.model.UserModel; +import com.actionsoft.bpms.server.SSOUtil; +import com.actionsoft.bpms.server.UserContext; +import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.AppAPI; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.awspaas.user.apps.integration.XmlDatasUtil; +import com.awspaas.user.apps.integration.oa.OaPendComponent; +import com.awspaas.user.apps.integration.util.HttpClientUtils; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.*; + +public class ProcessAfterData extends InterruptListener { + + @Override + public String getVersion() { + return "0.0.1"; + } + + @Override + public String getProvider() { + return "ActionSoft"; + } + + @Override + public String getDescription() { + return "OA审批数据失败之后需要做的操作"; + } + + @Override + public boolean execute(ProcessExecutionContext processExecutionContext) throws Exception { + OaPendComponent component = new OaPendComponent(); + BO bo_eu_faid_data = SDK.getBOAPI().query("BO_EU_FAID_DATA", true).addQuery("BINDID=", processExecutionContext.getProcessInstance().getId()).detail(); + if (bo_eu_faid_data!=null){ + String changed = bo_eu_faid_data.getString("CHANGED"); + if (changed.equals("1")){ + ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID")); + TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(bo_eu_faid_data.getString("TASK_ID")); + if (processed!=null&&taskInstance!=null){ + System.out.println("这是发送待办调用发送待办数据发送问题"); + boolean b = sendOAPRocess(bo_eu_faid_data, processExecutionContext, taskInstance, processed); + return b; + } + }else if (changed.equals("2")){ + ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID")); + TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(bo_eu_faid_data.getString("TASK_ID")); + if (processed!=null&&taskInstance!=null){ + System.out.println("这是更新调用发送待办数据发送问题"); + boolean b = updatePending(bo_eu_faid_data, processExecutionContext, taskInstance, processed); + return b; + } + }else if (changed.equals("3")){ + ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID")); + TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(processed.getStartTaskInstId()); + if (processed!=null&&instanceById!=null){ + System.out.println("这是删除调用发送待办数据发送问题"); + boolean b = updateendPending(bo_eu_faid_data, processExecutionContext, instanceById, processed); + return b; + } + }else if (changed.equals("4")){ + ProcessInstance processed = SDK.getProcessAPI().getInstanceById(bo_eu_faid_data.getString("PROCESS_ID")); + TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(bo_eu_faid_data.getString("TASK_ID")); + System.out.println("这是结束调用发送待办数据发送问题"); + boolean b = updateendPending(bo_eu_faid_data, processExecutionContext, taskInstance, processed); + return b; + } + } + return false; + } + + + public boolean sendOAPRocess(BO bo ,ProcessExecutionContext processExecutionContext,TaskInstance taskInstance, ProcessInstance processInstance) throws IOException, DocumentException { + boolean flag = false; + XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); + xmlDatasUtil.setExternal_system_ID("LCZD"); + xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", processInstance.getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_LMDOOGTE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理"); + } + } + + //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + if (portalUrl.equals("http://10.114.11.135:8088/portal")){ + portalUrl = "https://bpm.yili.com:8088/portal/"; + } + xmlDatasUtil.setPcurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + String target = taskInstance.getTarget(); + if (target.length()==8&&"00".equals(target.substring(0,2))){ + target = target.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){ + xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID")); + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒 + String str = df.format(taskInstance.getBeginTime()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(substring); + //if (taskInstance.getState()==1){ + xmlDatasUtil.setTo_do_status("0"); + //} + xmlDatasUtil.setTo_do_official_type("0"); +// if (taskInstance.getReadState()==0){ +// xmlDatasUtil.setViewtype("0"); +// }else if (taskInstance.getReadState()==1){ + xmlDatasUtil.setViewtype("0"); +// } + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(str.substring(0, str.indexOf(" "))); + /*String der =""; + if (taskInstance.getReadTime()!=null){ + der = df.format(taskInstance.getReadTime()); + xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); + xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); + }else { + der = df.format(taskInstance.getBeginTime()); + xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); + xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); + }*/ + xmlDatasUtil.setReceivedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setReceivetime(substring); + + xmlDatasUtil.setCurrentnodetype("0"); + xmlDatasUtil.setRequestcode(processInstance.getId()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName()); + + // 调用App + String sourceAppId = processInstance.getAppId(); + // aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; + // 参数定义列表 + Map params = new HashMap(); + //流程实例id,必填 + params.put("processInstId", processInstance.getId()); + //,必填 + params.put("sid", UserContext.fromUID(processInstance.getCreateUser()).getSessionId()); + AppAPI appAPI = SDK.getAppAPI(); + //流程节点数据 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + String username = ""; + String userid = ""; + if (ro.isOk()){ + List list = new ArrayList(); + Object processBudgetModelList = ro.get("processBudgetModelList"); + JSONArray array = JSON.parseArray(String.valueOf(processBudgetModelList)); + + if (!array.isEmpty()){ + for(int i=0;i>>>>>"+rootElement); + Element result = rootElement.element("Body").element("InsertTodoCominfoResponse ").element("out"); + String resultString = result.getData().toString(); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("result"); + String status = jsonObject1.getString("message"); + + if (datas.equals("success")){ + System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成"); + flag = true; + }else { + System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); + System.out.println("错误提示>>>>>>>>>>>>"+status); + flag = false; + } + bo.set("OA_RESULT",datas); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + bo.set("OA_DATE",simpleDateFormat.format(new Date())); + SDK.getBOAPI().update("BO_EU_FAID_DATA",bo); + return flag; + } + + + /** + * 更新待办状态 + * @param taskInstance + */ + public boolean updatePending(BO bo ,ProcessExecutionContext processExecutionContext,TaskInstance taskInstance, ProcessInstance processInstance) throws IOException, DocumentException { + boolean flag = false; + XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); + xmlDatasUtil.setExternal_system_ID("LCZD"); + + xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", processInstance.getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_LMDOOGTE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理"); + } + + } + + + + //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + if (portalUrl.equals("http://10.114.11.135:8088/portal")){ + portalUrl = "https://bpm.yili.com:8088/portal/"; + } + xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + + String target = taskInstance.getTarget(); + if (target.length()==8&&"00".equals(target.substring(0,2))){ + target = target.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){ + xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID")); + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒 + String str = df.format(taskInstance.getBeginTime()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length())); + + xmlDatasUtil.setTo_do_status("1"); + + xmlDatasUtil.setTo_do_official_type("0"); + + xmlDatasUtil.setViewtype("-2"); + + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" "))); + String der = ""; + if (taskInstance.getReadTime()==null){ + der= df.format(new Date()); + }else { + der= df.format(taskInstance.getReadTime()); + } + + xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); + xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); + + xmlDatasUtil.setCurrentnodetype("0"); + + + xmlDatasUtil.setRequestcode(processInstance.getId()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName()); + + // 调用App + String sourceAppId = processInstance.getAppId(); + // aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; + // 参数定义列表 + Map params = new HashMap(); + //流程实例id,必填 + params.put("processInstId", processInstance.getId()); + //,必填 + if (processInstance.getCreateUser()!=null){ + params.put("sid", UserContext.fromUID(processInstance.getCreateUser()).getSessionId()); + }else { + String sessionId = new SSOUtil().registerClientSessionNoPassword(taskInstance.getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC); + params.put("sid", sessionId); + } + + AppAPI appAPI = SDK.getAppAPI(); + //流程节点数据 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + String username = ""; + String userid = ""; + if (ro.isOk()){ + String data = ro.getData().toString(); + JSONObject jsonObject = JSONObject.parseObject(data); + JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList")); + if (!jsonArray.isEmpty()){ + for(int i=0;i>>>>>"+rootElement); + Element result = rootElement.element("Body").element("InsertTodoCominfoResponse ").element("out"); + String resultString = result.getData().toString(); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("result"); + String status = jsonObject1.getString("message"); + + if (datas.equals("success")){ + System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成"); + flag = true; + }else { + System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); + System.out.println("错误提示>>>>>>>>>>>>"+status); + flag = false; + } + bo.set("OA_RESULT",datas); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + bo.set("OA_DATE",simpleDateFormat.format(new Date())); + SDK.getBOAPI().update("BO_EU_FAID_DATA",bo); + return flag; + + } + + + /** + * 更新待办状态 + * @param taskInstance + */ + public boolean updateendPending(BO bo ,ProcessExecutionContext processExecutionContext,TaskInstance taskInstance, ProcessInstance processInstance) throws IOException, DocumentException { + boolean flag = false; + XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); + xmlDatasUtil.setExternal_system_ID("LCZD"); + + xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstance.getId()).detail(); + if (bo_act_coe_publish!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); + }else { + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", processInstance.getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_LMDOOGTE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+processInstance.getTitle()+"】,点击进行处理"); + } + + } + + + + //http://localhost:8089/portal/r/or?cmd=com.yili_form_page_open&processInstId=3505e654-9217-41cd-a31d-4971846b3219&taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&oauthName=oauthLogin&token=admin + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + if (portalUrl.equals("http://10.114.11.135:8088/portal")){ + portalUrl = "https://bpm.yili.com:8088/portal/"; + } + xmlDatasUtil.setPcurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&casaccount="+taskInstance.getTarget()+"&processInstId="+processInstance.getId()+"&taskInstId="+taskInstance.getId()+"&openState="+taskInstance.getState()); + + String target = taskInstance.getTarget(); + if (target.length()==8&&"00".equals(target.substring(0,2))){ + target = target.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){ + xmlDatasUtil.setTo_do_login_account(bo_eu_oa_reson.getString("LOGINID")); + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式,不显示毫秒 + String str = df.format(taskInstance.getBeginTime()); + String substring = str.substring(str.indexOf(" "), str.length()); + xmlDatasUtil.setTo_do_creation_time(substring); + xmlDatasUtil.setTo_do_completion_time(df.format(taskInstance.getBeginTime()).substring(df.format(taskInstance.getBeginTime()).indexOf(" "), df.format(taskInstance.getBeginTime()).length())); + + xmlDatasUtil.setTo_do_status("1"); + + xmlDatasUtil.setTo_do_official_type("0"); + + xmlDatasUtil.setViewtype("-2"); + + xmlDatasUtil.setCreatedate(str.substring(0, str.indexOf(" "))); + xmlDatasUtil.setDonedate(df.format(taskInstance.getBeginTime()).substring(0, df.format(taskInstance.getBeginTime()).indexOf(" "))); + String der = ""; + if (taskInstance.getReadTime()==null){ + der= df.format(new Date()); + }else { + der= df.format(taskInstance.getReadTime()); + } + + xmlDatasUtil.setReceivedate(der.substring(0, der.indexOf(" "))); + xmlDatasUtil.setReceivetime(der.substring(der.indexOf(" "),der.length())); + + xmlDatasUtil.setCurrentnodetype("1"); + + + xmlDatasUtil.setRequestcode(processInstance.getId()); + xmlDatasUtil.setCurrentnodename(SDK.getRepositoryAPI().getProcessNode(processInstance.getProcessDefId(),taskInstance.getActivityDefId()).getName()); + + // 调用App + String sourceAppId = processInstance.getAppId(); + // aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.processtrends/processNodeInfoASLP"; + // 参数定义列表 + Map params = new HashMap(); + //流程实例id,必填 + params.put("processInstId", processInstance.getId()); + //,必填 + if (processInstance.getCreateUser()!=null){ + params.put("sid", UserContext.fromUID(processInstance.getCreateUser()).getSessionId()); + }else { + String sessionId = new SSOUtil().registerClientSessionNoPassword(taskInstance.getTarget(), LoginConst.DEFAULT_LANG, "127.0.0.1", LoginConst.DEVICE_PC); + params.put("sid", sessionId); + } + + AppAPI appAPI = SDK.getAppAPI(); + //流程节点数据 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + String username = ""; + String userid = ""; + if (ro.isOk()){ + String data = ro.getData().toString(); + JSONObject jsonObject = JSONObject.parseObject(data); + JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("processBudgetModelList")); + if (!jsonArray.isEmpty()){ + for(int i=0;i>>>>>"+rootElement); + Element result = rootElement.element("Body").element("InsertTodoCominfoResponse ").element("out"); + String resultString = result.getData().toString(); + JSONObject jsonObject1 = JSON.parseObject(resultString); + String datas = jsonObject1.getString("result"); + String status = jsonObject1.getString("message"); + + if (datas.equals("success")){ + System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成"); + flag = true; + }else { + System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); + System.out.println("错误提示>>>>>>>>>>>>"+status); + flag = false; + } + bo.set("OA_RESULT",datas); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + bo.set("OA_DATE",simpleDateFormat.format(new Date())); + SDK.getBOAPI().update("BO_EU_FAID_DATA",bo); + return flag; + + } + +} 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 9f0041d8..9d687c57 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 @@ -38,6 +38,7 @@ import org.apache.commons.httpclient.methods.RequestEntity; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.lang.StringUtils; import org.dom4j.Document; +import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; @@ -46,6 +47,8 @@ import java.sql.Connection; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class ProcessEndAfterEvent extends ExecuteListener { private Logger logger = LogAPI.getLogger(TaskListener.class); @@ -128,10 +131,15 @@ public class ProcessEndAfterEvent extends ExecuteListener { String da = bo_act_coe_publish1.getString("SEND_SCOP"); if (da.equals("1")) { - List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER"); + List select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER WHERE CLOSED = '0'"); for (RowMap row : select_userid_from_orguser ) { - uid += row.getString("USERID") + ","; + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); + if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){ + + }else { + uid += row.getString("USERID") + ","; + } } } else { List posts_list = new ArrayList(); @@ -495,41 +503,67 @@ public class ProcessEndAfterEvent extends ExecuteListener { new_uid = new_uid.substring(0, new_uid.length() - 1); } System.out.println("new_userid ==========>>>>>>>>>"+new_uid); - jsonObject.put("userList",new_uid); + String[] users = new_uid.split(","); + int length = 300; + int ys = users.length%length; + if (ys==0) { + int size = users.length/length; + int flag = 0; + List list = new LinkedList(); - 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 list = new LinkedList(); + for (int i=0;i maps = DBSql.getMaps(sql_upfile); for (RowMap row : maps) { + System.out.println("附件名称>>>>>>"+row.getString("FILENAME")); + if (!row.getString("FILENAME").contains(".xml")){ UpfileModel upfileModel = new UpfileModel(); upfileModel.setType(row.getString("FILETYPE")); upfileModel.setFileName(row.getString("FILENAME")); @@ -896,6 +932,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { AppAPI appAPIs = SDK.getAppAPI(); ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss); System.out.println("流程模型附件的生成============="+ros); + } } //DCContext对象,必填 @@ -939,7 +976,7 @@ public class ProcessEndAfterEvent extends ExecuteListener { } //jsonObject.put(deptSplit_id); - if (jsonArray_das.isEmpty()||jsonArray.isEmpty()){ + if (!jsonArray_das.isEmpty()&&!jsonArray.isEmpty()){ // 调用App String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); @@ -1061,4 +1098,44 @@ public class ProcessEndAfterEvent extends ExecuteListener { return ro.isOk(); } + public void SendOARead(JSONObject jsonObject,ProcessExecutionContext processExecutionContext,String[] results) throws DocumentException { + String userId = ""; + userId = StringUtils.join(results, ","); + jsonObject.put("userList",userId); + + + 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 j=0;j()); + 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 { + + +//https://wechat.yili.com/connect/oauth2/authorize?appid=ww7464544804b1be21&redirect_uri=https%3A%2F%2Fbpm.yili.com%3A8088%2Fportal%2Fr%2Fov%3Fcmd%3DOAUTH_VALIDATE%26responseType%3DW%26code%3DhK008XYYP_QBkQmtxJJdG_pipTMOSnQk6fNzo_23jmQ%26corpid%3Dww7464544804b1be21%26oauthName%3Dwechat%26clientIp%3D10.114.1.254%26processInstId%3D64e73b1b-1a10-4ca5-a592-2519a6c9d8a3%26serverName%3D10.114.11.135%26cmd%3Dcom.yili_process_page_phone%26taskInstId%3D580343ef-fcaa-49ad-9abe-528b91fe173b%26state%3DSTATE%26appAgentId%3D1000064%26originalCmd%3Dcom.yili_process_page_phone&response_type=code&state=9d44ae2f-d2dc-4724-a936-41fc7b873cdb&scope=snsapi_base#wxwork_redirect + + String url = portalUrl+"/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId="+processExecutionContext.getProcessInstance().getId()+"&taskInstId="+processExecutionContext.getTaskInstance().getId(); + String mobileurl = "http://10.60.143.183:8088/portal"+"/r/or?cmd=com.yili_process_page_phone&corpid=ww7464544804b1be21&appAgentId=1000064&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(); + + +//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"); + + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("action","read"); + jsonObject.put("title","ceshi" + + ""+boActCoePublish.getString("PROCESS_TITLE")+""); + System.out.println("部门庄户》》》》》》》"+SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo()); + jsonObject.put("dept","00016082");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + String target = processExecutionContext.getTaskInstance().getTarget(); + target = processExecutionContext.getTaskInstance().getTarget(); + + System.out.println("当前账户======》》》》"+target); + + jsonObject.put("user","00345531"); + + // 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 WHERE CLOSED = '0'"); + for (RowMap row : select_userid_from_orguser + ) { + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); + if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){ + + }else { + 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 (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); + } + + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + //选中的没有下级部门 + 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() + ","; + } + } + } + + } + } + 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")+","; + } + } + + } + } + System.out.println("userid》》》》》》》》》》》》》》》》》》》"+uid); + if (StringUtils.isNotEmpty(uid + )) { + uid = uid.substring(0, uid.length() - 1); + String[] split = uid.split(","); + + 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){ + 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); + String[] users = new_uid.split(","); + int length = 300; + int ys = users.length%length; + if (ys==0) { + int size = users.length/length; + int flag = 0; + + List list = new LinkedList(); + + for (int i=0;i list = new LinkedList(); + for (int i=0;i(); +//保密级别, 0: 普通 1:秘密 2:机密,必填 + params_create.put("securityLevel", 0); +//知识名称,必填 + params_create.put("knwlName", map.getString("PLNAME")+map.getString("PLVER")); +//是否可以评论,必填 + params_create.put("isComment", true); +//是否可以评分,必填 + params_create.put("isRate", true); +//有效期:yyyy-MM-dd,非必填 + params_create.put("validDate", "2099-12-31"); +//只读控制,1:在线阅读和下载 0:在线阅读,必填 + params_create.put("onlineLevel", 1); +//知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填 + params_create.put("createUser", "admin"); +//知识内容,非必填 + params_create.put("cardContext", ""); +//sid,必填 + 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); + } + }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",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 = "); + } + } + + for (BO bo:bo_act_coe_publish_c + ) { + OutputTaskModel model = new OutputTask().getTaskReportById(bo.getString("TASKID")); + wsId = model.getWsId(); + String publishfileid = bo.getString("CHANGEDFILEIDNEW"); + filed.add(publishfileid); + 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(); +//保密级别, 0: 普通 1:秘密 2:机密,必填 + params_create.put("securityLevel", 0); +//知识名称,必填 + params_create.put("knwlName", map.getString("PLNAME")+map.getString("PLVER")); +//是否可以评论,必填 + params_create.put("isComment", true); +//是否可以评分,必填 + params_create.put("isRate", true); +//有效期:yyyy-MM-dd,非必填 + params_create.put("validDate", "2099-12-31"); +//只读控制,1:在线阅读和下载 0:在线阅读,必填 + params_create.put("onlineLevel", 1); +//知识创建人,某些特殊场景下,sid和createUser代表的用户并不一样,如果此参数为null,则使用sid代表的用户,非必填 + params_create.put("createUser", "admin"); +//知识内容,非必填 + params_create.put("cardContext", ""); +//sid,必填 + 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); + } + }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",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_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"); + filed.add(publishfileid_stop); + 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")); + *//*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+"'" + ); + + } + } +*/ + + + + }catch (Exception e){ + e.printStackTrace(); + }finally { + //AttrSynAslp(processExecutionContext,wsId,filed); + open.close(); + } + } + } + public void creadteFile(ProcessExecutionContext processExecutionContext,String bo_name,UserContext userContext, String cardId,String fileid){ + /** + * 这个主要是负责对流程手册进行相关的文件的生成 + */ + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); +// aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.kms/CreateFile"; + + if (StringUtils.isNotEmpty(cardId)){ + String sql_ext4 = "select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '"+cardId+"'"; + RowMap map = DBSql.getMap(sql_ext4); + System.out.println("maps======>>>>>>>"+map); + System.out.println("fileid==》》》》"+fileid); + System.out.println("id==》》》》"+map.getString("ID")); + RowMap rowMap = DBSql.getMap("SELECT * FROM " + bo_name + " where " + fileid + " '" + map.getString("ID") + "'"); + //BO bos = SDK.getBOAPI().query(bo_name,true).addQuery(fileid,"17e7d198-1656-4a2c-8912-a81850170be9").detail(); + if (rowMap!=null){ + + if (StringUtils.isNotEmpty(rowMap.getString("TASKID"))) { + + OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID")); + if (model != null) { + System.out.println(",pdel============" + model); + System.out.println("123313123123123==========" + model.getProfileId()); + OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId()); + System.out.println("dajadfas======" + appProfile); + if (appProfile == null) { + throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId()); + } + DCPluginProfile dcProfile = SDK.getDCAPI().getDCProfile(appProfile.getAppContext().getId(), OutputConst.EXT_APP_DC_OUTPUT); + if (dcProfile == null) + throw new AWSException("Not Find DCProfile! repositoryName=" + OutputConst.EXT_APP_DC_OUTPUT); + String sql_lever =""; + if (bo_name.equals("BO_ACT_COE_PUBLISH_N")){ + sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + rowMap.getString("PUBLISHFILEID") + "'"; + + }else if (bo_name.equals("BO_ACT_COE_PUBLISH_C")){ + sql_lever = "SELECT PLVER FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + rowMap.getString("CHANGEDFILEIDNEW") + "'"; + } + String lever = DBSql.getString( sql_lever); + System.out.println("版本号::::::::::::"+lever); + //lever = lever.substring(0,3); + if(lever.length()==5&&lever.substring(4).equals("0")){ + lever.substring(0,3); + }else if (lever.length()==1){ + lever=lever+".0"; + } + String filename = ""; + if (bo_name.equals("BO_ACT_COE_PUBLISH_N")){ + filename = rowMap.getString("PUBLISHFILENAME"); + }else if (bo_name.equals("BO_ACT_COE_PUBLISH_C")){ + filename = rowMap.getString("CHANGEDFILENAMENEW"); + } + DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(), model.getWsId(), rowMap.getString("TASKID"), filename+ "_" + lever+ ".doc"); + //UtilFile file = new UtilFile(dcContext.getPath()); + + + Map params = new HashMap(); +//知识ID,必填 + params.put("cardId", cardId); +//sid,必填 + params.put("sid", userContext.getSessionId()); + + params.put("dc", dcContext); + AppAPI appAPI = SDK.getAppAPI(); +//创建文件 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + System.out.println("流程手册的存入=================" + ro); + } + } + + } + String sql_A = "SELECT PLNAME FROM APP_ACT_COE_PAL_REPOSITORY where ID = '"+map.getString("ID")+"' AND PLMETHODID != 'process.framework' AND PLMETHODID IN (select distinct PLMETHODID from APP_ACT_COE_PAL_REPOSITORY)"; + List rows = DBSql.getMaps(sql_A); + + for (RowMap bo:rows + ) { + + /** + * 这个是模型中的附件获取的并插入的数据信息,需要做修改 + */ + // 调用App + +// 参数定义列表 + Map paramss = new HashMap(); +//知识ID,必填 + paramss.put("cardId", cardId); +//sid,必填 + paramss.put("sid", userContext.getSessionId()); + + UpfileWeb upfileWeb = new UpfileWeb(userContext); + + + + String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where PLMETHODID != 'process.framework' AND ID= '"+map.getString("ID")+"'" + + ")"; + List maps = DBSql.getMaps(sql_upfile); + for (RowMap row : maps) { + UpfileModel upfileModel = new UpfileModel(); + upfileModel.setType(row.getString("FILETYPE")); + upfileModel.setFileName(row.getString("FILENAME")); + upfileModel.setPl_uuid(row.getString("PALREPOSITORYID")); + upfileModel.setShape_uuid(row.getString("SHAPEID")); + DCContext dcContexts = upfileWeb.getDCContext(upfileModel); + paramss.put("dc", dcContexts); + AppAPI appAPIs = SDK.getAppAPI(); + ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss); + System.out.println("流程模型附件的生成============="+ros); + } + +//DCContext对象,必填 + +//创建文件 + } + try { + + PublishKnow(processExecutionContext,userContext,cardId); + }catch (Exception e){ + e.printStackTrace(); + } + } + } + + + + public void PublishKnow(ProcessExecutionContext processExecutionContext,UserContext userContext,String id){ + + String sql = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where id in (select PLPARENTID from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '"+id +"')"; + List maps = DBSql.getMaps(sql); + String ids = ""; + for (RowMap rowmap:maps + ) { + ids+=rowmap.getString("EXT4")+","; + } + String[] deptSplit_id = ids.split(","); + + JSONArray jsonArray = new JSONArray(); + for (String id_names:deptSplit_id + ) { + jsonArray.add(id_names); + } + //jsonObject.put(deptSplit_id); + id+=","; + String[] deptSplit_das = id.split(","); + JSONArray jsonArray_das = new JSONArray(); + for (String das:deptSplit_das + ) { + jsonArray_das.add(das); + } + //jsonObject.put(deptSplit_id); + + if (!jsonArray_das.isEmpty()&&!jsonArray.isEmpty()){ + + // 调用App + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); +// aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl"; +// 参数定义列表 + Map params = new HashMap(); +//要发布到的维度ID的JSON数组字符串,必填 + params.put("dimensionIDArray", jsonArray.toString()); +//要发布的知识ID的JSON数组字符串,必填 + params.put("knwlIDArray", jsonArray_das.toString()); +//标签的JSON数组字符串,非必填 + +//sid,必填 + params.put("sid", userContext.getSessionId()); + AppAPI appAPI = SDK.getAppAPI(); +//发布知识 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + + System.out.println("知识发布============"+ro); + + } + + } + + + public boolean CancelPublishKnwl(ProcessExecutionContext processExecutionContext,String sid,String knwlId) { +// 调用App + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); +// aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.kms/CancelPublishKnwl"; +// 参数定义列表 + Map params = new HashMap(); +//sid,如果为空,则需要传createUser参数,非必填 + params.put("sid", sid); +//知识ID,必填 + params.put("knwlId", knwlId); + AppAPI appAPI = SDK.getAppAPI(); +//取消发布知识(全部维度) + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + System.out.println("取消发布的ro=====>>>>"+ro); + return ro.isOk(); + } + + + public boolean execute(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) { +// 调用App + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); +// aslp服务地址 + String aslp = "aslp://com.awspaas.user.apps.docview/PushFileToXpage"; +// 参数定义列表 + Map params = new HashMap(); +//发布人,不允许空值,必填 + params.put("fileCreateName", fileCreateName); +//待阅文件标题名称,不允许空值,必填 + params.put("fileName", fileName); +//阅读范围_组织,不允许空值,非必填 + params.put("readingScope_org", readingScope_org); +//是否全公司可见,不允许空值,必填 + params.put("isFullCompany", isFullCompany); +//待阅文件Url,不允许空值,必填 + params.put("fileurl", fileurl); +//发布日期,不允许空值,必填 + params.put("fileCreateDate", fileCreateDate); +//发布流程ID,不允许空值,必填 + params.put("relationProcessinstId", relationProcessinstId); +//阅读范围_岗位,不允许空值,非必填 + params.put("readingScope_post", readingScope_post); +//阅读范围_职级,不允许空值,非必填 + params.put("readingScope_level", readingScope_level); +//待阅文件ID,多个逗号隔开,不允许空值,必填 + params.put("fileid", fileid); + AppAPI appAPI = SDK.getAppAPI(); +//推送待阅文件到xpage门户 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + System.out.println("ros++++++++=====待阅》》》》》》》》》》"+ro); + return ro.isOk(); + } + + + + public boolean AddKnwlAC(ProcessExecutionContext processExecutionContext,JSONArray jsonArray,String sid,String knwlId) { +// 调用App + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); +// aslp服务地址 + String aslp = "aslp://com.actionsoft.apps.kms/AddKnwlAC"; +// 参数定义列表 + Map params = new HashMap(); +//[{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填 + params.put("acList", jsonArray); +//sid,如果为空,则需要传createUser参数,非必填 + params.put("sid", sid); +//知识ID,必填 + params.put("knwlId", knwlId); + AppAPI appAPI = SDK.getAppAPI(); +//给知识授权 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + return ro.isOk(); + } + + + + public boolean AttrSynAslp(ProcessExecutionContext processExecutionContext,String wsId,JSONArray fileId){ + System.out.println(""); + // 调用App + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); +// aslp服务地址 + String aslp = "aslp://com.awspaas.user.apps.yili.reportform/AttrSynAslp"; +// 参数定义列表 + Map params = new HashMap(); +//资产内容库id,必填 + params.put("wsId", wsId); +//文件id;json数组[id1,id2,id3],必填 + params.put("fileId", fileId); + AppAPI appAPI = SDK.getAppAPI(); +//增量同步数据 + ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); + System.out.println("ro>>>>>>>>>>>>>"+ro); + return ro.isOk(); + } + + public void SendOARead(JSONObject jsonObject,ProcessExecutionContext processExecutionContext,String[] results) throws DocumentException { + String userId = ""; + userId = StringUtils.join(results, ","); + jsonObject.put("userList","00352394,00345531"); + + + String xmlStr = "\n" + + " " + + " " + + " " + + " " + + ""+ + " " + + " " + + " " + + ""; + System.out.println("xmlStr>>>>>>>>"+xmlStr); + String postSoap = UtilUrl.doPostSoap("http://10.119.1.188: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 j=0;j()); + 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 { + + + String url = portalUrl + "/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId(); + String mobileurl = "https://bpm.yili.com:8088/portal" + "/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Timestamp endTime = instanceById.getStartTime(); + BO boActCoePublish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", instanceById.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=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId(); + + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("action", "read"); + jsonObject.put("title", " " + + "" + boActCoePublish.getString("PROCESS_TITLE") + ""); + System.out.println("部门庄户》》》》》》》" + SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo()); + jsonObject.put("dept", SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo());//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + String target = taskInstance.getTarget(); + target = taskInstance.getTarget(); + + System.out.println("当前账户======》》》》" + target); + + jsonObject.put("user", target); + + // 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", instanceById.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=", instanceById.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 WHERE CLOSED = '0'"); + + for (RowMap row : select_userid_from_orguser + ) { + BO boList = SDK.getBOAPI().query("BO_ACT_DATAID",true).addQuery("PROCESSID=",processid).addQuery("USER_ID=",row.getString("USERID")).detail(); + if (boList==null){ + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); + if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){ + + }else { + 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 (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); + } + + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + //选中的没有下级部门 + 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() + ","; + } + } + } + + } + } + 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") + ","; + } + } + + } + } + System.out.println("userid》》》》》》》》》》》》》》》》》》》" + uid); + if (StringUtils.isNotEmpty(uid + )) { + uid = uid.substring(0, uid.length() - 1); + String[] split = uid.split(","); + + 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){ + 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); + String[] users = new_uid.split(","); + int length = 300; + int ys = users.length%length; + if (ys==0) { + int size = users.length/length; + int flag = 0; + + List list = new LinkedList(); + + for (int i=0;i list = new LinkedList(); + 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 j=0;j()); + 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 { + + + String url = portalUrl + "/r/or?cmd=com.yili_process_page&oauthName=oauthLogin&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId(); + String mobileurl = "https://bpm.yili.com:8088/portal" + "/r/or?cmd=com.yili_process_page_phone&corpid=wwb0ae23173b140618&appAgentId=1000014&oauthName=wechat&processInstId=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Timestamp endTime = instanceById.getStartTime(); + BO boActCoePublish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", instanceById.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=" + instanceById.getId() + "&taskInstId=" + taskInstance.getId(); + + + JSONObject jsonObject = new JSONObject(new LinkedHashMap()); + jsonObject.put("action", "read"); + jsonObject.put("title", " " + + "" + boActCoePublish.getString("PROCESS_TITLE") + ""); + System.out.println("部门庄户》》》》》》》" + SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo()); + jsonObject.put("dept", SDK.getORGAPI().getDepartmentByUser(taskInstance.getTarget()).getNo());//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo() + String target = taskInstance.getTarget(); + target = taskInstance.getTarget(); + + System.out.println("当前账户======》》》》" + target); + + jsonObject.put("user", target); + + // 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", instanceById.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=", instanceById.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 WHERE CLOSED = '0'"); + + for (RowMap row : select_userid_from_orguser + ) { + BO boList = SDK.getBOAPI().query("BO_ACT_DATAID",true).addQuery("PROCESSID=",processid).addQuery("USER_ID=",row.getString("USERID")).detail(); + if (boList==null){ + DepartmentModel departmentModel = SDK.getORGAPI().getDepartmentByUser(row.getString("USERID")); + if(departmentModel.getId().equals("e79281b1-2f81-4895-b30e-9f96e9ad0e2c")||departmentModel.getId().equals("5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")||departmentModel.getId().equals("a93a7f77-8b11-4261-8770-20b0cdfab315")){ + + }else { + 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 (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); + } + + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + //选中的没有下级部门 + 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() + ","; + } + } + } + + } + } + 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") + ","; + } + } + + } + } + System.out.println("userid》》》》》》》》》》》》》》》》》》》" + uid); + if (StringUtils.isNotEmpty(uid + )) { + uid = uid.substring(0, uid.length() - 1); + String[] split = uid.split(","); + + 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){ + 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); + String[] users = new_uid.split(","); + int length = 300; + int ys = users.length%length; + if (ys==0) { + int size = users.length/length; + int flag = 0; + 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 j=0;j\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 j=0;j\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 j=0;j\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 j=0;j>>>>>>>>>>>"+s); + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pec.getUserContext().getUserName() + "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","1"); + bo_faid.set("TASK_ID",pec.getTaskInstance().getId()); + bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); } -// pend.setTitle(taskInstance.getTitle()); - UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget()); -// if (null == targetUserModel || StringUtils.isBlank(targetUserModel.getExt5())) { -// String msg = "账号对应的OA账号为空!待办不能推送,请补充完善账号信息!BPM账号:" + taskInstance.getTarget(); -// logger.error(msg); -// -// // 给 admin 推消息 -// notificationAPI.sendSystemMessage("admin", msg, "error"); -// return; -// } } @@ -290,16 +334,23 @@ public class OaPendComponent { * @param taskInstance * @param pec */ - public void updatePending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException { + public void updatePending(TaskInstance taskInstance, ProcessExecutionContext pec) throws IOException, SOAPException, DocumentException { XmlDatasUtil xmlDatasUtil = new XmlDatasUtil(); xmlDatasUtil.setExternal_system_ID("LCZD"); xmlDatasUtil.setOther_system_to_do_ID(taskInstance.getId()); + System.out.println("pec.getProcessInstance()>>>>>>>>"+pec.getProcessInstance()); BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); if (bo_act_coe_publish!=null){ xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_act_coe_publish.getString("PROCESS_TITLE")+"】,点击进行处理"); }else { - xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessInstance().getTitle()+"】,点击进行处理"); + BO bo_eu_1664184390101 = SDK.getBOAPI().query("BO_EU_1664184390101", true).addQuery("BINDID=", pec.getProcessInstance().getId()).detail(); + if (bo_eu_1664184390101!=null){ + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+bo_eu_1664184390101.getString("F_TITLE")+"】,点击进行处理"); + }else { + xmlDatasUtil.setProcess_title(" 您有一条待办流程【"+pec.getProcessDef().name+"】,点击进行处理"); + } + } String gettaskname = gettaskname(taskInstance); @@ -409,21 +460,51 @@ public class OaPendComponent { xmlDatasUtil.setCreaterworkcode(""); HttpClientUtils httpClientUtil = new HttpClientUtils(); String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil); - if (s.equals("Success")){ - logger.info("发送已办任务更新完成,请去OA系统上查看是否传输完成"); - }else if (s.equals("fail")){ - logger.error("发送已办任务更新失败,请联系管理员查看是否出现错误"); - } + System.out.println("已办查看是否修改"); - UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget()); -// if (null == targetUserModel || StringUtils.isBlank(targetUserModel.getExt5())) { -// String msg = "账号对应的OA账号为空!待办不能推送,请补充完善账号信息!BPM账号:" + taskInstance.getTarget(); -// logger.error(msg); -// -// // 给 admin 推消息 -// notificationAPI.sendSystemMessage("admin", msg, "error"); -// return; -// } + + + + BO bo = new BO(); + bo.set("OUTSYSID",xmlDatasUtil.getExternal_system_ID()); + bo.set("TODOID",xmlDatasUtil.getOther_system_to_do_ID()); + bo.set("CONTENT",xmlDatasUtil.getProcess_title()); + bo.set("PCURL",xmlDatasUtil.getPcurl()); + bo.set("MOBILEURL",xmlDatasUtil.getMobileurl()); + bo.set("HRCODE",xmlDatasUtil.getTo_do_login_account()); + bo.set("STATUS",xmlDatasUtil.getTo_do_status()); + bo.set("WFTYPE",xmlDatasUtil.getTo_do_official_type()); + bo.set("VIEWTYPE",xmlDatasUtil.getViewtype()); + bo.set("CREATEDATES",xmlDatasUtil.getCreatedate()); + bo.set("NEWCREATETIME",xmlDatasUtil.getTo_do_creation_time()); + bo.set("DONEDATE",xmlDatasUtil.getDonedate()); + bo.set("NEWDONETIME",xmlDatasUtil.getTo_do_status()); + bo.set("RECEIVEDATE",xmlDatasUtil.getReceivedate()); + bo.set("RECEIVETIME",xmlDatasUtil.getReceivetime()); + bo.set("CURRENTNODETYPE",xmlDatasUtil.getCurrentnodetype()); + bo.set("REQUESTCODE",xmlDatasUtil.getRequestcode()); + bo.set("CURRENTNODENAME",xmlDatasUtil.getCurrentnodename()); + bo.set("NOOPERATOR",xmlDatasUtil.getNooperator()); + bo.set("CREATERHRCODE",xmlDatasUtil.getCreaterhrcode()); + bo.set("WORKFLOWNAME",xmlDatasUtil.getWorkflowname()); + bo.set("OA_RESULT",s); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + bo.set("OA_DATE",sdf.format(new Date())); + SDK.getBOAPI().createDataBO("BO_EU_OA_MOBILEURL",bo,UserContext.fromUID(taskInstance.getTarget())); + if (s.contains("success")){ + System.out.println("发送待办任务完成,请去OA系统上查看是否传输完成"); + }else { + System.out.println("发送待办任务失败,请联系管理员查看是否出现错误"); + System.out.println("错误提示>>>>>>>>>>>>"+s); + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_ef1918ca1f9c46948f56bd5f77f4e646", "admin", pec.getUserContext().getUserName() + "失败更新待办"); + BO bo_faid = new BO(); + bo_faid.set("CHANGED","2"); + bo_faid.set("TASK_ID",pec.getTaskInstance().getId()); + bo_faid.set("PROCESS_ID",pec.getProcessInstance().getId()); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().create("BO_EU_FAID_DATA",bo_faid,processInstance,userContext); + SDK.getProcessAPI().start(processInstance); + } } @@ -467,4 +548,8 @@ public class OaPendComponent { return actionName; } + + + + } 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 17b167b4..e718fc5d 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 @@ -64,10 +64,30 @@ public class TaskListener extends ProcessPubicListener { */ @Override public void call(String eventName, TaskInstance taskInstance, ProcessExecutionContext pec) { + + + /** + * 手动作废 增加 开始节点作废删除更新OA待办问题 + * 后台管理员删除流程 process_before_delete 时候删除 更新OA为已办 + */ //System.out.println("11111111111111"); if (close.equals(sendEnable)) { return; } + OaPendComponent component = new OaPendComponent(); + if (eventName.equals("PROCESS_BEFORE_DELETE")){ + try { + /** + * 这是发起人作废的时候,作废的流程实例,需要更新OA数据 + */ + String irt = pec.getProcessInstance().getStartTaskInstId(); + TaskInstance instanceById = SDK.getTaskAPI().getInstanceById(irt); + component.updatePending(instanceById,pec); + } catch (Exception e) { + e.printStackTrace(); + } + } + if (taskInstance == null) { return; @@ -77,7 +97,9 @@ public class TaskListener extends ProcessPubicListener { actionName = getActionName(taskInstance); } - OaPendComponent component = new OaPendComponent(); + + System.out.println("按钮名称是>>>>>>>>>>>"+actionName); + if (UtilString.isEmpty(taskInstance.getId()) && PublicEventConst.TASK_DELETE.equals(eventName)) { Map parameters2 = pec.getParameters(); @@ -88,7 +110,7 @@ public class TaskListener extends ProcessPubicListener { logger.info("调用OA删除任务接口:taskInstanceId:" + h.getId()); try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } //OaDeleteComponent(h.getId()); @@ -101,7 +123,7 @@ public class TaskListener extends ProcessPubicListener { logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } //OaDeleteComponent(taskInstance.getId()); @@ -122,7 +144,7 @@ public class TaskListener extends ProcessPubicListener { if (taskInstance.getState() == noticeState) { try { component.sendOaPending(taskInstance, pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } return; @@ -136,7 +158,7 @@ public class TaskListener extends ProcessPubicListener { try { component.sendOaPending(taskInstance, pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("创建OA待办,taskInstanceId:" + taskInstance.getId()); @@ -147,7 +169,7 @@ public class TaskListener extends ProcessPubicListener { logger.info("更新知会待办,taskInstanceId:" + taskInstance.getId()); try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -157,49 +179,49 @@ public class TaskListener extends ProcessPubicListener { if (equalsAction(AGREE, actionName)) { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:" + "同意"); } else if (equalsAction(GO_BACK, actionName)) { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:" + "回退"); } else if (equalsAction(DESI_BACK, actionName)) { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:" + "指定回退"); } else if (equalsAction(TE_SHI_TE_BAN, actionName)) { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:" + "特事特办"); } else if (equalsAction(TERMINATION, actionName)) { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:" + "终止"); } else if (equalsAction(TRANSFER, actionName)) { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:" + "转办"); } else { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } logger.info("更新OA待办:未定义的操作:" + actionName + ",按同意已办处理"); @@ -239,7 +261,7 @@ public class TaskListener extends ProcessPubicListener { logger.info("更新OA待办:取消,taskInstanceId:" + h.getId()); try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } @@ -263,7 +285,7 @@ public class TaskListener extends ProcessPubicListener { logger.info("调用OA删除任务接口:taskInstanceId:" + taskInstance.getId()); try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } return; @@ -274,7 +296,7 @@ public class TaskListener extends ProcessPubicListener { try { component.updatePending(taskInstance,pec); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); } return; 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 4dbaf492..5913c719 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 @@ -2,6 +2,8 @@ package com.awspaas.user.apps.integration.oauth; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.text.SimpleDateFormat; +import java.util.Date; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.commons.oauth.AbstractOauth; @@ -53,8 +55,9 @@ public class OauthLogin extends AbstractOauth { @Override public String validate(RequestParams params) throws IOException { BO bo = new BO(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long begintime = System.currentTimeMillis(); - bo.set("BEGIN_TIME",begintime); + bo.set("BEGIN_TIME",sdf.format(new Date())); String userid = ""; long login_end_time = 0L; if (StringUtils.isNotEmpty(params.get("casaccount"))){ @@ -62,7 +65,7 @@ public class OauthLogin extends AbstractOauth { String workcode = detail.getString("WORKCODE"); if (workcode.length()!=8){ login_end_time = System.currentTimeMillis(); - bo.set("END_TIME",login_end_time); + bo.set("END_TIME",sdf.format(new Date())); bo.set("USER_ID","00"+workcode); UserContext userContext = UserContext.fromUID("admin"); SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); @@ -80,7 +83,7 @@ public class OauthLogin extends AbstractOauth { if (StringUtils.isNotEmpty(params.get("usercode"))){ login_end_time = System.currentTimeMillis(); - bo.set("END_TIME",login_end_time); + bo.set("END_TIME",sdf.format(new Date())); bo.set("USER_ID",params.get("usercode")); UserContext userContext = UserContext.fromUID("admin"); SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); @@ -93,7 +96,7 @@ public class OauthLogin extends AbstractOauth { try { long loginbegintime = System.currentTimeMillis(); - bo.set("LOGIN_BEGIN_TIME",loginbegintime); + bo.set("LOGIN_BEGIN_TIME",sdf.format(new Date())); String redirect_uri = params.get("code"); if(StringUtils.isEmpty(redirect_uri)){ @@ -119,9 +122,9 @@ public class OauthLogin extends AbstractOauth { System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber")); userid = json.getString("employeenumber"); login_end_time = System.currentTimeMillis(); - bo.set("END_TIME",login_end_time); + bo.set("END_TIME",sdf.format(new Date())); bo.set("SCENDTIME",(login_end_time-loginbegintime)); - bo.set("LOGIN_END_TIME",login_end_time); + bo.set("LOGIN_END_TIME",sdf.format(new Date())); bo.set("USER_ID",userid); UserContext userContext = UserContext.fromUID("admin"); SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/ProcessOathLogin.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/ProcessOathLogin.java new file mode 100644 index 00000000..ee829037 --- /dev/null +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/ProcessOathLogin.java @@ -0,0 +1,181 @@ +package com.awspaas.user.apps.integration.oauth; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.commons.oauth.AbstractOauth; +import com.actionsoft.bpms.server.RequestParams; +import com.actionsoft.bpms.server.UserContext; +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; +import org.apache.commons.lang.StringUtils; + +/** + * OA系统 跳转登陆PAl + * + * @author lihy + */ + +public class ProcessOathLogin extends AbstractOauth { + private Logger logger = LogAPI.getLogger(OauthLogin.class); + + static String clientId = "testClient"; + static String clientSecret = "1234567890"; + /** + * 这个方法代表是否有登录授权页,返回的值取决于三方系统提供的 SSO 认证方式。一类认 证方式如 Oauth2.0 + * 认证,需要先跳转到三方系统的登录授权页面,授权成功后再跳转到调 用方指定的页面,这类认证方式下,hasOauthPage()方法需要返回 true。 + * 另外一类认证时不 需要跳转到登录授权页, 会直接传过来 ticket 或者 token 参数, hasOauthPage()方法需要返 回 false。 + * + * @return + */ + @Override + public boolean hasOauthPage() { + return false; + } + + /** + * 如果 hasOauthPage()方法返回的值是 false, 返回 null 即可。 如果 hasOauthPage()方法返回 的值是 + * true,则此处返回三方系统的登录授权页地址。 + * @param requestParams + * @return + */ + @Override + public String getOauthPage(RequestParams requestParams) { + return null; + } + @Override + public String validate(RequestParams params) throws IOException { + BO bo = new BO(); + long begintime = System.currentTimeMillis(); + bo.set("BEGIN_TIME",begintime); + String userid = ""; + long login_end_time = 0L; + if (StringUtils.isNotEmpty(params.get("casaccount"))){ + BO detail = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("LOGINID=", params.get("casaccount")).detail(); + String workcode = detail.getString("WORKCODE"); + if (workcode.length()!=8){ + login_end_time = System.currentTimeMillis(); + bo.set("END_TIME",login_end_time); + bo.set("USER_ID","00"+workcode); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); + return "00"+workcode; + }else{ + login_end_time = System.currentTimeMillis(); + bo.set("END_TIME",login_end_time); + bo.set("USER_ID",params.get("casaccount")); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); + return params.get("casaccount"); + } + } + + if (StringUtils.isNotEmpty(params.get("usercode"))){ + + login_end_time = System.currentTimeMillis(); + bo.set("END_TIME",login_end_time); + bo.set("USER_ID",params.get("usercode")); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); + + return params.get("usercode"); + } + + + logger.info("单点登录验证---------"+params); + try { + + long loginbegintime = System.currentTimeMillis(); + bo.set("LOGIN_BEGIN_TIME",loginbegintime); + String redirect_uri = params.get("code"); + + if(StringUtils.isEmpty(redirect_uri)){ + logger.error("跳转地址为空,请重新输入"); + return null; + } + + + App app = new App(); + String tokens = app.getTokens("http://10.114.11.135:8088/portal/process_center.html", redirect_uri); + if(StringUtils.isEmpty(tokens)){ + logger.error("获取token为空,请重新输入登录信息获取code"); + return null; + }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"); + login_end_time = System.currentTimeMillis(); + bo.set("END_TIME",login_end_time); + bo.set("SCENDTIME",(login_end_time-loginbegintime)); + bo.set("LOGIN_END_TIME",login_end_time); + bo.set("USER_ID",userid); + UserContext userContext = UserContext.fromUID("admin"); + SDK.getBOAPI().createDataBO("BO_EU_OA_LOGIN",bo,userContext); + return json.getString("employeenumber"); + } + } + + } + + + + } catch (Exception e) { + logger.error("统一身份认证失败!", e); + } + return null; + } + + + + public long getCookieTime(UserModel user) { + System.out.println("session时间>>>>>>>>>>"+user.getSessionTime()); +//下面的值代表与 AWS PaaS 会话过期时间一致, +//因平台会话过期时间以分钟计,所以需要乘以 60 + return 0; + } + + /** + * 统一身份认证接口 + * @param1 webserviceUrl 身份认证接口地址 + * @param2 casaccount 登录账号 OA账号 + * @param3 appaccount 应用系统登录账号 + * @param4 appid 应用系统id + * @param5 validcode 验证码 + * @return true/false + */ + public static String getToken(String casaccount,String appaccount,String appid,String validcode) { + //身份认证接口地址 + String webserviceUrl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "webserviceUrl"); + String checkLogin = ClientService.checkLogin(webserviceUrl,casaccount,appaccount,appid,validcode); + return checkLogin ; + } + + + + public static String geAuthorization(String clientId, String clientSecret) { + try { + byte[] key = (clientId + ":" + clientSecret).getBytes("utf-8"); + String cc = new String(Base64.encodeBase64(key), "utf-8"); + // String cc = new String(java.util.Base64.getEncoder().encode(key), "utf-8"); + return "Basic " + cc; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return ""; + } + } + +} 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 31c51889..c0fc216a 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 @@ -32,6 +32,7 @@ import com.actionsoft.bpms.client.form.UserTaskFormsWeb; import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.org.model.UserModel; import com.actionsoft.bpms.server.RequestParams; import com.actionsoft.bpms.server.SSOUtil; import com.actionsoft.bpms.server.UserContext; @@ -86,6 +87,19 @@ public class TaskController { if (StringUtils.isNotEmpty(json.getString("employeenumber"))){ System.out.println("userid》》》》》》》》》》"+json.getString("employeenumber")); userid = json.getString("employeenumber"); + try { + if(UtilString.isNotEmpty(userid)) { + BO bo = new BO(); + bo.set("LOGINUSERNAME",userid); + UserModel user = SDK.getORGAPI().getUser(userid); + if(user!=null) { + SDK.getBOAPI().createDataBO("BO_EU_USER_LOGIN_LOG", bo, UserContext.fromUID(userid)); + } + + } + + } catch (Exception e) { + } } } @@ -367,8 +381,13 @@ public class TaskController { List bo_act_dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).list(); if (bo_act_dataid != null) { - String dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail().getString("DATAID"); - jsonObject.put("dataid", dataid); + if (SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail()!=null){ + + String dataid = SDK.getBOAPI().query("BO_ACT_DATAID", true).addQuery("PROCESSID=", processInstId).addQuery("USER_ID=",usercode).detail().getString("DATAID"); + jsonObject.put("dataid", dataid); + }else { + jsonObject.put("dataid", ""); + } } jsonObject.put("status","1"); String xmlStr = "\n" + @@ -553,7 +572,13 @@ public class TaskController { JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("title",row.getString("FILENAME")); - jsonObject1.put("link","https://bpm.yili.com:8088/portal/r"+ros.get("url").toString().substring(1)); + String base_url = "https://bpm.yili.com:8088/portal/r"; + if (row.getString("FILENAME").toString().contains(".xls")||row.getString("FILENAME").toString().contains(".xlsx")){ + jsonObject1.put("link",ros.get("url").toString().substring(0)); + }else { + jsonObject1.put("link",base_url+ros.get("url").toString().substring(1)); + } + // jsonObject1.put("size","12k"); jsonArray.add(jsonObject1); num++; @@ -634,7 +659,7 @@ public class TaskController { - String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("PUBLISHFILEID")+"'" + + String sql_upfile = "select * from APP_ACT_COE_PAL_UPFILE where palrepositoryid in (select ID from APP_ACT_COE_PAL_REPOSITORY where ID= '"+bo.getString("CHANGEDFILEIDNEW")+"'" + ")"; List maps = DBSql.getMaps(conn,sql_upfile); UserContext userContext = UserContext.fromSessionId(sid); @@ -676,7 +701,12 @@ public class TaskController { JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("title",row.getString("FILENAME")); - jsonObject1.put("link","https://bpm.yili.com:8088/portal/r"+ros.get("url").toString().substring(1)); + if (row.getString("FILENAME").contains(".xlsx")||row.getString("FILENAME").contains(".xls")){ + jsonObject1.put("link",ros.get("url").toString().substring(0)); + }else { + jsonObject1.put("link","https://bpm.yili.com:8088/portal/r"+ros.get("url").toString().substring(1)); + } + // jsonObject1.put("size","12k"); jsonArray.add(jsonObject1); num++; diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/WechatApp.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/WechatApp.java index 25e0118b..01852550 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/WechatApp.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/oauth/WechatApp.java @@ -17,7 +17,7 @@ public class WechatApp { //String url = "https://wechat.yili.com/connect/oauth2/authorize?appid=prcmgr&redirect_uri=https://bpm.yili.com:8088/portal//r/or?cmd=com.yili_form_page_open&oauthName=oauthLogin&processInstId=274157ca-cd16-47bc-b055-f440d2ff718f&taskInstId=5ad2abeb-25ce-4388-a7b3-92572ed4b389&casaccount=10056870&validcode=8d62447812dbfd5ef4727fb8b8c05ecf&fromsys=OA&response_type=code&scope=SCOPE&agentid=AGENTID&state=STATE#wechat_redirect"; - String url = "https://wechat.yili.com/cgi-bin/gettoken?corpid="+clientId+"&corpsecret="+clientSecret; + String url = "https://wechat.eyili.com/cgi-bin/gettoken?corpid="+clientId+"&corpsecret="+clientSecret; HashMap HeaderMap = new HashMap(); //HeaderMap.put("Content-Type", "application/x-www-form-urlencoded"); diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java index 15aec1ec..47008488 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/plugins/Plugins.java @@ -11,6 +11,7 @@ import com.actionsoft.apps.resource.plugin.profile.ProcessPublicEventPluginProfi import com.awspaas.user.apps.integration.oa.TaskListener; import com.awspaas.user.apps.integration.oauth.OauthLogin; import com.awspaas.user.apps.integration.oauth.WechatOauthLogin; +import com.awspaas.user.apps.integration.oauth.ProcessOathLogin; /** * @author LHY @@ -25,6 +26,7 @@ public class Plugins implements PluginListener { list.add(new ProcessPublicEventPluginProfile(TaskListener.class.getName(), "待办推送监听器")); list.add(new OauthPluginProfile("oauthLogin", OauthLogin.class.getName(), "OA系统 跳转登陆PAl")); list.add(new OauthPluginProfile("WechatOauthLogin", WechatOauthLogin.class.getName(), "企业微信认证")); + list.add(new OauthPluginProfile("processOathLogin", ProcessOathLogin.class.getName(), "流程中心发布")); return list; } diff --git a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java index d02623f6..b2100f8c 100644 --- a/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java +++ b/com.awspaas.user.apps.integrates/src/com/awspaas/user/apps/integration/util/HttpClientUtils.java @@ -1,5 +1,7 @@ package com.awspaas.user.apps.integration.util; +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.sdk.local.SDK; import com.awspaas.user.apps.integration.XmlDatasUtil; import com.google.common.io.ByteStreams; import org.apache.commons.httpclient.*; @@ -55,45 +57,9 @@ public class HttpClientUtils { ""; System.out.println("xmlstr================"+xmlStr); + String postSoap = UtilUrl.doPostSoap(url, xmlStr, ""); - HttpClient client = new HttpClient(); - int timeout = 10000; - - PostMethod postMethod = new PostMethod(url); - // 设置连接超时 - client.getHttpConnectionManager().getParams().setConnectionTimeout(timeout); - // 设置读取时间超时 - client.getHttpConnectionManager().getParams().setSoTimeout(timeout); - // 然后把Soap请求数据添加到PostMethod中 - //RequestEntity requestEntity = new StringRequestEntity(xmlStr, "text/xml", "UTF-8"); - RequestEntity re = new StringRequestEntity(xmlStr, "text/xml", "utf-8"); - - // 设置请求体 - postMethod.setRequestHeader("SOAPAction", ""); - postMethod.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); - postMethod.setRequestEntity(re); - int status = client.executeMethod(postMethod); - // 打印请求状态码 - System.out.println("status:" + status); - // 获取响应体输入流 - InputStream iss = postMethod.getResponseBodyAsStream(); - - - - /*try { - int statusCode = httpClient.executeMethod(postMethod); - System.out.println("statusCode==================="+statusCode); - if (statusCode == 200) { - String soapResponseData = postMethod.getResponseBodyAsString(); - return soapResponseData.indexOf("Success") == -1 ? "fail" : result; - } else { - return "error:[" + statusCode + "]!"; - } - } catch (Exception var15) { - var15.printStackTrace(); - return "Exception:[" + var15 + "]!"; - */ - return new String(ByteStreams.toByteArray(iss)); + return postSoap; } 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 index 369715c1..9546c382 100644 --- 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 @@ -69,27 +69,33 @@ public class WorkFlowAPI { for (int i=0;i list = SDK. getBOAPI().query("BO_EU_OA_PROCESS_TASK").addQuery("WORKFLOWID=", rowMapsw.getString("WORKFLOWID")).list(); for (int i = 0; i < list.size(); i++) { - JSONObject jsonObject2 = new JSONObject(); - jsonObject2.put("id", list.get(i).getString("TASKID")); - // String node_key = JSONObject.parseObject(jsonArrays.get(i).toString()).get("nodeid").toString(); - jsonObject2.put("taskDefinitionKey", list.get(i).getString("NODEID")); - jsonObject2.put("processInstanceId", list.get(i).getString("REQUESTID")); - jsonObject2.put("processDefinitionId", list.get(i).getString("WORKFLOWID")); - jsonObject2.put("name", list.get(i).getString("NODENAME")); - jsonObject2.put("assignee", list.get(i).getString("OPERATORWORKCODE")); - //String user = JSONObject.parseObject(jsonArrays.get(i).toString()).get("operatorWorkCode").toString(); - System.out.println("user>>>>>>>" + list.get(i).getString("OPERATORWORKCODE")); - UserModel model = SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE")); - 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"); + if (SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE")) != null) { + JSONObject jsonObject2 = new JSONObject(); + jsonObject2.put("id", list.get(i).getString("TASKID")); + // String node_key = JSONObject.parseObject(jsonArrays.get(i).toString()).get("nodeid").toString(); + jsonObject2.put("taskDefinitionKey", list.get(i).getString("NODEID")); + jsonObject2.put("processInstanceId", list.get(i).getString("REQUESTID")); + jsonObject2.put("processDefinitionId", list.get(i).getString("WORKFLOWID")); + jsonObject2.put("name", list.get(i).getString("NODENAME")); + jsonObject2.put("assignee", list.get(i).getString("OPERATORWORKCODE")); + if (SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE")) != null) { + jsonObject2.put("TARGETCOMPANYID", SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE")).getId()); + } + //String user = JSONObject.parseObject(jsonArrays.get(i).toString()).get("operatorWorkCode").toString(); + System.out.println("user>>>>>>>" + list.get(i).getString("OPERATORWORKCODE")); + UserModel model = SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE")); + 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", list.get(i).getString("OPERATETYPE")); + jsonObject2.put("startTime", list.get(i).getString("OPERATEDATE")); + jsonObject2.put("endTime", list.get(i).getString("RECEIVEDATE")); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date beginDate = sdf.parse(list.get(i).getString("OPERATEDATE")); + Date endDate = sdf.parse(list.get(i).getString("RECEIVEDATE")); + long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60); + jsonObject2.put("durationInMillis", dates); + jsonArray_new.add(jsonObject2); } - - - jsonObject2.put("actionName", list.get(i).getString("OPERATETYPE")); - jsonObject2.put("startTime", list.get(i).getString("OPERATEDATE")); - jsonObject2.put("endTime", list.get(i).getString("RECEIVEDATE")); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date beginDate = sdf.parse(list.get(i).getString("OPERATEDATE")); - Date endDate = sdf.parse(list.get(i).getString("RECEIVEDATE")); - long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60); - jsonObject2.put("durationInMillis", dates); - jsonArray_new.add(jsonObject2); } } @@ -235,10 +246,10 @@ public class WorkFlowAPI { jsonArray1.add(jsonObject1); } jsonObject.put("taskNodesList",jsonArray1); + jsonObject_newe.put(rowMapsw.getString("WORKFLOWID"),jsonObject); } - jsonObject_newe.put("dispatch",jsonObject); /*JSONArray jsonArray_body = new JSONArray(); jsonArray_body.add(jsonObject_newe);*/ result.put("code","1");