相关文件提交

This commit is contained in:
Mr-wang 2022-10-13 19:18:09 +08:00
parent 4e70e6115d
commit 9dfaf0b4c2
22 changed files with 3881 additions and 291 deletions

View File

@ -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);
}
}

View File

@ -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<RowMap> 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<RowMap> mapsss = DBSql.getMaps(sqls3_1);
for (RowMap rowmaps : mapsss) {
String name2s = rowmaps.getString("PLNAME").substring(0, rowmaps.getString("PLNAME").indexOf(" "));
List<BO> bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PERFORMANCE_TYPE=", "L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%" + name2s + "'", null).list();
Map<Integer, String> 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<RowMap> mapsss = DBSql.getMaps(sqls3_1);
for (RowMap rowmaps : mapsss) {
String name2s = rowmaps.getString("PLNAME").substring(0, rowmaps.getString("PLNAME").indexOf(" "));
List<BO> bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB", true).addQuery("PERFORMANCE_TYPE=", "L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%" + name2s + "%'", null).list();
Map<Integer, String> map_name = new LinkedHashMap<>();
int p = 0;
List<BO> 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<RowMap> mapss = DBSql.getMaps(sqls3);
for (RowMap rowmaps : mapss) {
String name2s = rowmaps.getString("PLNAME").substring(0,rowmaps.getString("PLNAME").indexOf(" "));
List<BO> bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB",true).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '"+name2s+"%'",null).list();
List<BO> bo_list = SDK.getBOAPI().query("BO_EU_PER_IND_LIB",true).addQuery("PERFORMANCE_TYPE=","L1L3流程绩效").addQuery("SYNCHRONOUS_HOME like '%"+name2s+"%'",null).list();
Map<Integer,String> 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<RowMap> 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> 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<Integer, String> map_name = new LinkedHashMap<>();
int p = 0;
List<BO> 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;
}
}

View File

@ -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&amp;processInstId=3505e654-9217-41cd-a31d-4971846b3219&amp;taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&amp;oauthName=oauthLogin&amp;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;
}
}

View File

@ -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<RowMap> 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<RowMap> 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<RowMap> 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<String, Object>();
//[{"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();
}
}

View File

@ -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&amp;processInstId=3505e654-9217-41cd-a31d-4971846b3219&amp;taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&amp;oauthName=oauthLogin&amp;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&amp;oauthName=oauthLogin&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;casaccount="+taskInstance.getTarget()+"&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;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<String, Object>();
//流程实例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<array.size();i++){
JSONObject jsonObject = JSONObject.parseObject(array.get(i).toString());
String executor = jsonObject.get("executor").toString();
String userid2 = jsonObject.get("userid2").toString();
//String userid2 = jsonArray.getJSONObject(i).getString("userid2");
username+=executor+" ";
}
}
}
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setNooperator(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setWorkcode("");
xmlDatasUtil.setWorkflowname(processInstance.getTitle());
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setCreaterworkcode("");
HttpClientUtils httpClientUtil = new HttpClientUtils();
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
System.out.println("状态码============》》》》》》》》》》》"+s);
Document document = null;
try {
document = DocumentHelper.parseText(s);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
System.out.println("rootElement>>>>>>"+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&amp;processInstId=3505e654-9217-41cd-a31d-4971846b3219&amp;taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&amp;oauthName=oauthLogin&amp;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&amp;oauthName=oauthLogin&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;casaccount="+taskInstance.getTarget()+"&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;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<String, Object>();
//流程实例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<jsonArray.size();i++){
String filename = jsonArray.getJSONObject(i).getString("executor");
String userid2 = jsonArray.getJSONObject(i).getString("userid2");
username+=filename+" ";
userid+=userid2+" ";
}
}
}
xmlDatasUtil.setNooperator(username);
xmlDatasUtil.setWorkcode("");
if (processInstance.getTitle()!=null){
xmlDatasUtil.setWorkflowname(processInstance.getTitle());
}else {
xmlDatasUtil.setWorkflowname("流程发布");
}
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setCreaterworkcode("");
HttpClientUtils httpClientUtil = new HttpClientUtils();
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
System.out.println("已办查看是否修改");
UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget());
Document document = null;
try {
document = DocumentHelper.parseText(s);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
System.out.println("rootElement>>>>>>"+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&amp;processInstId=3505e654-9217-41cd-a31d-4971846b3219&amp;taskInstId=8a71d75e-3ee0-43a2-a226-ecb01419319c&amp;oauthName=oauthLogin&amp;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&amp;oauthName=oauthLogin&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
xmlDatasUtil.setMobileurl("https://bpm.yili.com:8088/portal"+"/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;casaccount="+taskInstance.getTarget()+"&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;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<String, Object>();
//流程实例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<jsonArray.size();i++){
String filename = jsonArray.getJSONObject(i).getString("executor");
String userid2 = jsonArray.getJSONObject(i).getString("userid2");
username+=filename+" ";
userid+=userid2+" ";
}
}
}
xmlDatasUtil.setNooperator(username);
xmlDatasUtil.setWorkcode("");
if (processInstance.getTitle()!=null){
xmlDatasUtil.setWorkflowname(processInstance.getTitle());
}else {
xmlDatasUtil.setWorkflowname("流程发布");
}
if (bo_eu_oa_reson!=null){
xmlDatasUtil.setCreaterhrcode(bo_eu_oa_reson.getString("LOGINID"));
}
xmlDatasUtil.setCreaterworkcode("");
HttpClientUtils httpClientUtil = new HttpClientUtils();
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
System.out.println("已办查看是否修改");
UserModel targetUserModel = UserCache.getModel(taskInstance.getTarget());
Document document = null;
try {
document = DocumentHelper.parseText(s);
} catch (DocumentException e) {
e.printStackTrace();
}
Element rootElement = document.getRootElement();
System.out.println("rootElement>>>>>>"+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;
}
}

View File

@ -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<RowMap> select_userid_from_orguser = DBSql.getMaps("select USERID from ORGUSER");
List<RowMap> 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<String[]> list = new LinkedList();
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();i++) {
JSONObject jsonObject2 = resultArray.getJSONObject(i);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",processExecutionContext.getProcessInstance().getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,processExecutionContext.getProcessInstance().getId(),processExecutionContext.getUserContext().getUID());
for (int i=0;i<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+300);
list.add(results);
flag = flag+300;
}
// 创建线程来实现为每300人为一个的线程跑待阅
ExecutorService service = Executors.newFixedThreadPool(4);
service.execute(new Runnable() {
@Override
public void run() {
for (String[] resrt:list
) {
try {
SendOARead(jsonObject,processExecutionContext,resrt);
} catch (DocumentException e) {
e.printStackTrace();
}
}
}
});
}else {
int size = users.length/length;
int flag = 0;
List<String[]> list = new LinkedList();
for (int i=0;i<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+300);
list.add(results);
flag = flag+300;
}
String[] redata;
redata = Arrays.copyOfRange(users, flag, flag+ys);
list.add(redata);
// 创建线程来实现为每300人为一个的线程跑待阅
ExecutorService service = Executors.newFixedThreadPool(4);
service.execute(new Runnable() {
@Override
public void run() {
for (String[] resrt:list
) {
try {
SendOARead(jsonObject,processExecutionContext,resrt);
} catch (DocumentException e) {
e.printStackTrace();
}
}
}
});
}
// System.out.println("subString==========================="+substring.substring(substring.lastIndexOf(";")+1,substring.length()));
// substring = substring.substring(substring.lastIndexOf(";")+1,substring.length());
@ -886,6 +920,8 @@ public class ProcessEndAfterEvent extends ExecuteListener {
")";
List<RowMap> 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 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();j++) {
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",processExecutionContext.getProcessInstance().getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,processExecutionContext.getProcessInstance().getId(),processExecutionContext.getUserContext().getUID());
}
}
}

View File

@ -0,0 +1,27 @@
package com.awspaas.user.apps.integration.event;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.TaskInstance;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.ProcessExecuteQuery;
public class TaskCreatedAfterEvent extends ExecuteListener {
public TaskCreatedAfterEvent() {
super.setDescription("自动审批");
super.setProvider("actionsoft");
super.setVersion("1.0");
}
@Override
public void execute(ProcessExecutionContext processExecutionContext) throws Exception {
TaskInstance taskInstance = processExecutionContext.getTaskInstance();
if (taskInstance.getState() != 2) {
String taskInstanceId = processExecutionContext.getTaskInstance().getId();
SDK.getTaskAPI().setComment(taskInstanceId, "同意", "同意");
String target = SDK.getTaskAPI().getTaskInstance(taskInstanceId).getTarget();
// String target = processExecutionContext.getTaskInstance().getTarget();
ProcessExecuteQuery processExecuteQuery = SDK.getTaskAPI().completeTask(taskInstanceId, null, target);
}
}
}

View File

@ -0,0 +1,572 @@
package com.awspaas.user.apps.integration.job;
import com.actionsoft.bpms.bo.engine.BO;
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.database.RowMap;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.integration.util.UtilUrl;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class SendReadBycontract implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
String taskid = jobParameter.split(",")[1];
String processid = jobParameter.split(",")[0];
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processid);
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskid);
String wsId = "";
JSONArray filed = new JSONArray(new LinkedList<>());
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<RowMap> 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<String> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<RowMap> 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<RowMap> 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<RowMap> 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<String> 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<String[]> list = new LinkedList();
for (int i=0;i<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+300);
list.add(results);
flag = flag+300;
}
// 创建线程来实现为每300人为一个的线程跑待阅
ExecutorService service = Executors.newFixedThreadPool(4);
service.execute(new Runnable() {
@Override
public void run() {
for (String[] resrt:list
) {
try {
SendOARead(jsonObject,instanceById,resrt);
} catch (DocumentException e) {
e.printStackTrace();
}
}
}
});
}else {
int size = users.length/length;
int flag = 0;
List<String[]> list = new LinkedList();
for (int i=0;i<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+300);
list.add(results);
flag = flag+300;
}
String[] redata;
redata = Arrays.copyOfRange(users, flag, flag+ys);
list.add(redata);
// 创建线程来实现为每300人为一个的线程跑待阅
ExecutorService service = Executors.newFixedThreadPool(4);
service.execute(new Runnable() {
@Override
public void run() {
for (String[] resrt:list
) {
try {
SendOARead(jsonObject,instanceById,resrt);
} catch (DocumentException e) {
e.printStackTrace();
}
}
}
});
}
}catch (Exception e){
e.printStackTrace();
}
}
public void SendOARead(JSONObject jsonObject,ProcessInstance instanceById,String[] results) throws DocumentException {
String userId = "";
userId = StringUtils.join(results, ",");
jsonObject.put("userList",userId);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();j++) {
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",instanceById.getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),instanceById.getCreateUser());
}
}
}

View File

@ -0,0 +1,633 @@
package com.awspaas.user.apps.integration.job;
import com.actionsoft.bpms.bo.engine.BO;
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.database.RowMap;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.integration.util.UtilUrl;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
public class TestSendOARead implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
String jobParameter = SDK.getJobAPI().getJobParameter(jobExecutionContext);
String taskid = jobParameter.split(",")[1];
String processid = jobParameter.split(",")[0];
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processid);
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskid);
String wsId = "";
JSONArray filed = new JSONArray(new LinkedList<>());
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<RowMap> 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<String> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<RowMap> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<UserModel> 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<RowMap> 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<RowMap> 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<RowMap> 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<String> 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<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+300);
flag = flag+300;
String userId = "";
userId = StringUtils.join(results, ",");
jsonObject.put("userList",userId);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();j++) {
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",instanceById.getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
}
}
}else {
int size = users.length/length;
int flag = 0;
for (int i=0;i<size;i++){
String[] results;
results = Arrays.copyOfRange(users, flag, flag+300);
flag = flag+300;
String userId = "";
userId = StringUtils.join(results, ",");
jsonObject.put("userList",userId);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();j++) {
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",instanceById.getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
}
}
users = Arrays.copyOfRange(users, flag, flag+ys);
String userId = "";
userId = StringUtils.join(users, ",");
jsonObject.put("userList",userId);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();j++) {
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",instanceById.getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
}
}*/
jsonObject.put("userList","00345531");
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n" +
" <soapenv:Header/>" +
" <soapenv:Body>" +
" <web:service>" +
" <web:in0>" +
"<![CDATA["+jsonObject+"]]>"+
" </web:in0>" +
" </web:service>" +
" </soapenv:Body>" +
"</soapenv:Envelope>";
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<resultArray.size();j++) {
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
BO bo = new BO();
bo.set("PROCESSID",instanceById.getId());
bo.set("USER_ID",user);
bo.set("DATAID",dataid);
SDK.getBOAPI().create("BO_ACT_DATAID",bo,instanceById.getId(),target);
}
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,22 @@
package com.awspaas.user.apps.integration.job;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class TestdeleteJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
DBSql.update("update APP_ACT_BPA_PROCESS set DATAPROFILE = 'local'");
DBSql.update("update APP_ACT_BPA_PROCESS set CATEGORYPID = '10f882f7-ae01-4430-b54d-e504246bf0e3' where CATEGORYPID = '0' and CATEGORY !='本地' ");
// DBSql.update("delete from APP_ACT_BPA_PROCESS where CATEGORY in ('task任务','obj_0889e9236deb827ea50aa13d2ac2fef3','obj_bc0f34c006a5d76e31f95bbbaec255dd')");
}
}

View File

@ -9,6 +9,7 @@ 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.DocumentException;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@ -67,7 +68,7 @@ public class UpdateOADAIBANJob implements IJob {
try {
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
System.out.println("更新成功数据》》》》》》"+s);
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View File

@ -19,5 +19,7 @@ public class updateKnowByExt4Empty implements IJob {
" '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c'," +
" '42c09260-c1d3-44b7-ac3d-f8280e04c294'))";
int update = DBSql.update(sql);
String sqls = "update APP_ACT_COE_PAL_REPOSITORY set EXT4 = '' ";
int updates = DBSql.update(sqls);
}
}

View File

@ -1,13 +1,17 @@
package com.awspaas.user.apps.integration.oa;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.ProcessAPIManager;
import com.actionsoft.bpms.bpmn.engine.model.run.TaskCommentModel;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.login.constant.LoginConst;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.SSOUtil;
@ -18,6 +22,11 @@ import com.alibaba.fastjson.JSONArray;
import com.awspaas.user.apps.integration.XmlDatasUtil;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.xpath.DefaultXPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -30,6 +39,10 @@ import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.NotificationAPI;
import com.alibaba.fastjson.JSONObject;
import com.awspaas.user.apps.integration.util.HttpClientUtils;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.soap.*;
/**
* @author lihyyu
@ -137,7 +150,12 @@ public class OaPendComponent {
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);
String openstate = "";
@ -239,21 +257,47 @@ public class OaPendComponent {
HttpClientUtils httpClientUtil = new HttpClientUtils();
String s = httpClientUtil.SendPend("http://10.105.1.59/services/yili", xmlDatasUtil);
System.out.println("状态码============》》》》》》》》》》》"+s);
if (s.equals("Success")){
logger.info("发送待办任务完成请去OA系统上查看是否传输完成");
}else if (s.equals("fail")){
logger.error("发送待办任务失败,请联系管理员查看是否出现错误");
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","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;
}
}

View File

@ -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<String, Object> 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;

View File

@ -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);

View File

@ -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 "";
}
}
}

View File

@ -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> 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 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\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<RowMap> 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++;

View File

@ -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<String, String> HeaderMap = new HashMap();
//HeaderMap.put("Content-Type", "application/x-www-form-urlencoded");

View File

@ -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;
}

View File

@ -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 {
"</soapenv:Envelope>";
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;
}

View File

@ -69,27 +69,33 @@ public class WorkFlowAPI {
for (int i=0;i<list.size();i++) {
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("processInstanceId",list.get(i).getString("REQUESTID"));
jsonObject2.put("processDefinitionId",list.get(i).getString("WORKFLOWID"));
jsonObject2.put("processDefinitionName",list.get(i).getString("WORKFLOWNAME"));
jsonObject2.put("startUserId",list.get(i).getString("OPERATORWORKCODE"));
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);
BO bo = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).addQuery("WORKFLOWID=",rowMapsw.getString("WORKFLOWID") ).detail();
if (bo.getString("VERSION")!=null||bo.getString("VERSION")!=""){
jsonObject2.put("processDefinitionVersion",bo.getString("VERSION"));
}else {
jsonObject2.put("processDefinitionVersion","1");
}
if (SDK.getORGAPI().getUser(list.get(i).getString("OPERATORWORKCODE"))!=null){
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("processInstanceId",list.get(i).getString("REQUESTID"));
jsonObject2.put("processDefinitionId",list.get(i).getString("WORKFLOWID"));
jsonObject2.put("processDefinitionName",list.get(i).getString("WORKFLOWNAME"));
jsonObject2.put("startUserId",list.get(i).getString("OPERATORWORKCODE"));
jsonObject2.put("startTime",list.get(i).getString("OPERATEDATE"));
jsonObject2.put("endTime",list.get(i).getString("RECEIVEDATE"));
System.out.println("renyuanzhanghu"+list.get(i).getString("OPERATORWORKCODE"));
if (SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE"))!=null){
jsonObject2.put("CREATEUSERORGID",SDK.getORGAPI().getCompanyByUser(list.get(i).getString("OPERATORWORKCODE")).getId());
}
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);
BO bo = SDK.getBOAPI().query("BO_EU_OA_PROCESS", true).addQuery("WORKFLOWID=",rowMapsw.getString("WORKFLOWID") ).detail();
if (bo.getString("VERSION")!=null||bo.getString("VERSION")!=""){
jsonObject2.put("processDefinitionVersion",bo.getString("VERSION"));
}else {
jsonObject2.put("processDefinitionVersion","1");
}
jsonArray_new.add(jsonObject2);
}
jsonArray_new.add(jsonObject2);
}
}
}
@ -166,36 +172,41 @@ public class WorkFlowAPI {
List<BO> 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");