From 008d75bf43ac9d701e14289cd41676d81d3dc6b5 Mon Sep 17 00:00:00 2001 From: lihongyu <504404568@qq.com> Date: Wed, 22 Mar 2023 14:17:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=8F=91=E5=B8=83=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/web/ProcessPublishWeb.java | 221 +++++++++++++++++- .../pubEvent/ProcessEndAfterEvent.java | 202 ++++++++-------- 2 files changed, 313 insertions(+), 110 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java index 734ee815..954875e3 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java @@ -4,7 +4,15 @@ import java.io.File; import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadFactory; @@ -12,7 +20,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import com.alipay.remoting.config.switches.Switch; import org.apache.commons.lang.StringUtils; import com.actionsoft.apps.coe.pal.constant.CoEConstant; @@ -81,6 +88,7 @@ import com.actionsoft.bpms.util.UtilDate; import com.actionsoft.bpms.util.UtilFile; import com.actionsoft.bpms.util.UtilString; import com.actionsoft.exception.AWSException; +import com.actionsoft.exception.AWSQuotaException; import com.actionsoft.i18n.I18nRes; import com.actionsoft.sdk.local.SDK; import com.actionsoft.sdk.local.api.AppAPI; @@ -93,8 +101,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import io.etcd.jetcd.shaded.com.google.gson.Gson; - /** * 流程发布App */ @@ -1691,6 +1697,15 @@ public class ProcessPublishWeb extends ActionWeb { } return JSON.toJSONString(list); } + + public static boolean isNumeric(String str) { + for (int i = str.length(); --i >= 0;) { + int chr = str.charAt(i); + if (chr < 48 || chr > 57) + return false; + } + return true; + } /** * 获取字表数据 @@ -1739,12 +1754,40 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray js = new JSONArray(); UpFileDao upFileDao = new UpFileDao(); StringBuilder sqlWhere = new StringBuilder(); + ArrayList isNumberAscArray = new ArrayList(); sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'").append(" ORDER BY FILENAME ASC"); List fileList = upFileDao.search(sqlWhere.toString()); if (fileList != null && fileList.size() > 0) for (UpfileModel upfileModel : fileList) if ("f".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); + + //按照附件编号排序 + String fileNamel= upfileModel.getFileName(); + if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) { + if(fileNamel.indexOf("附件")==0) { + int indexOf2 = 3; + if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + }else if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + } + String numberStr = fileNamel.substring(2,indexOf2); + if(isNumeric(numberStr)&&!"".equals(numberStr)) { + isNumberAscArray.add("true"); + int fileNumber = Integer.parseInt(numberStr); + jb.put("file_number", fileNumber); + }else { + isNumberAscArray.add("false"); + } + }else { + isNumberAscArray.add("false"); + } + + }else { + isNumberAscArray.add("false"); + } + String upfileId = upfileModel.getUuid(); String upFileName = upfileModel.getFileName(); jb.put("upfileId", upfileId); @@ -1760,6 +1803,16 @@ public class ProcessPublishWeb extends ActionWeb { jb.put("openUrl",openUrl); js.add(jb.toJSONString()); } + + boolean contains = isNumberAscArray.contains("false"); + if(!contains) { + try { + //js.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("file_number"))); + } catch (Exception e) { + throw new AWSQuotaException("附件格式请以:《附件1:XXXXXX》格式命名"); + } + } + newObj.put("upfileId", js); } else { @@ -1816,6 +1869,7 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray js = new JSONArray(); UpFileDao upFileDao = new UpFileDao(); StringBuilder sqlWhere = new StringBuilder(); + ArrayList isNumberAscArray = new ArrayList(); sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'").append(" ORDER BY FILENAME ASC");; List fileList = upFileDao.search(sqlWhere.toString()); if (fileList != null && fileList.size() > 0) @@ -1931,6 +1985,7 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray js = new JSONArray(); UpFileDao upFileDao = new UpFileDao(); StringBuilder sqlWhere = new StringBuilder(); + ArrayList isNumberAscArray = new ArrayList(); sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'").append(" ORDER BY FILENAME ASC");; List fileList = upFileDao.search(sqlWhere.toString()); if (fileList != null && fileList.size() > 0) @@ -1938,6 +1993,33 @@ public class ProcessPublishWeb extends ActionWeb { if ("f".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); + + //按照附件编号排序 + String fileNamel= upfileModel.getFileName(); + if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) { + if(fileNamel.indexOf("附件")==0) { + int indexOf2 = 3; + if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + }else if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + } + String numberStr = fileNamel.substring(2,indexOf2); + if(isNumeric(numberStr)&&!"".equals(numberStr)) { + isNumberAscArray.add("true"); + int fileNumber = Integer.parseInt(numberStr); + jb.put("file_number", fileNumber); + }else { + isNumberAscArray.add("false"); + } + }else { + isNumberAscArray.add("false"); + } + + }else { + isNumberAscArray.add("false"); + } + String upfileId = upfileModel.getUuid(); String upFileName = upfileModel.getFileName(); jb.put("upfileId", upfileId); @@ -1953,8 +2035,15 @@ public class ProcessPublishWeb extends ActionWeb { jb.put("openUrl",openUrl); js.add(jb.toJSONString()); } + boolean contains = isNumberAscArray.contains("false"); + if(!contains) { + try { + js.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("file_number"))); + } catch (Exception e) { + throw new AWSQuotaException("附件格式请以:《附件1:XXXXXX》格式命名"); + } + } newObj.put("upfileId", js); - } else { newObj.put("fileVersion", "1.0"); newObj.put("methodId", "1"); @@ -2962,6 +3051,7 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray js = new JSONArray(); UpFileDao upFileDao = new UpFileDao(); StringBuilder sqlWhere = new StringBuilder(); + ArrayList isNumberAscArray = new ArrayList(); sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'").append(" ORDER BY FILENAME ASC"); List fileList = upFileDao.search(sqlWhere.toString()); if (fileList != null && fileList.size() > 0) @@ -2969,6 +3059,32 @@ public class ProcessPublishWeb extends ActionWeb { if (methodId.contains("data")) { if ("s".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); + //按照附件编号排序 + String fileNamel= upfileModel.getFileName(); + if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) { + if(fileNamel.indexOf("附件")==0) { + int indexOf2 = 3; + if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + }else if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + } + String numberStr = fileNamel.substring(2,indexOf2); + if(isNumeric(numberStr)&&!"".equals(numberStr)) { + isNumberAscArray.add("true"); + int fileNumber = Integer.parseInt(numberStr); + jb.put("file_number", fileNumber); + }else { + isNumberAscArray.add("false"); + } + }else { + isNumberAscArray.add("false"); + } + + }else { + isNumberAscArray.add("false"); + } + String upfileId = upfileModel.getUuid(); String shape_uuid = upfileModel.getShape_uuid(); String upFileName = upfileModel.getFileName(); @@ -2988,6 +3104,32 @@ public class ProcessPublishWeb extends ActionWeb { } else { if ("f".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); + //按照附件编号排序 + String fileNamel= upfileModel.getFileName(); + if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) { + if(fileNamel.indexOf("附件")==0) { + int indexOf2 = 3; + if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + }else if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + } + String numberStr = fileNamel.substring(2,indexOf2); + if(isNumeric(numberStr)&&!"".equals(numberStr)) { + isNumberAscArray.add("true"); + int fileNumber = Integer.parseInt(numberStr); + jb.put("file_number", fileNumber); + }else { + isNumberAscArray.add("false"); + } + }else { + isNumberAscArray.add("false"); + } + + }else { + isNumberAscArray.add("false"); + } + String upfileId = upfileModel.getUuid(); String upFileName = upfileModel.getFileName(); jb.put("upfileId", upfileId); @@ -3004,6 +3146,14 @@ public class ProcessPublishWeb extends ActionWeb { js.add(jb.toJSONString()); } } + boolean contains = isNumberAscArray.contains("false"); + if(!contains) { + try { + js.sort(Comparator.comparing(objs -> (JSON.parseObject(objs.toString())).getInteger("file_number"))); + } catch (Exception e) { + throw new AWSQuotaException("附件格式请以:《附件1:XXXXXX》格式命名"); + } + } obj.put("upfileId", js); } else { obj.put("fileVersion", "1.0"); @@ -3067,6 +3217,7 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray js = new JSONArray(); UpFileDao upFileDao = new UpFileDao(); StringBuilder sqlWhere = new StringBuilder(); + ArrayList isNumberAscArray = new ArrayList(); sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'").append(" ORDER BY FILENAME ASC"); List fileList = upFileDao.search(sqlWhere.toString()); if (fileList != null && fileList.size() > 0) @@ -3074,6 +3225,31 @@ public class ProcessPublishWeb extends ActionWeb { if (methodId.contains("data")) { if ("s".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); + //按照附件编号排序 + String fileNamel= upfileModel.getFileName(); + if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) { + if(fileNamel.indexOf("附件")==0) { + int indexOf2 = 3; + if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + }else if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + } + String numberStr = fileNamel.substring(2,indexOf2); + if(isNumeric(numberStr)&&!"".equals(numberStr)) { + isNumberAscArray.add("true"); + int fileNumber = Integer.parseInt(numberStr); + jb.put("file_number", fileNumber); + }else { + isNumberAscArray.add("false"); + } + }else { + isNumberAscArray.add("false"); + } + + }else { + isNumberAscArray.add("false"); + } String upfileId = upfileModel.getUuid(); String upFileName = upfileModel.getFileName(); jb.put("upfileId", upfileId); @@ -3095,6 +3271,31 @@ public class ProcessPublishWeb extends ActionWeb { if ("f".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); + //按照附件编号排序 + String fileNamel= upfileModel.getFileName(); + if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) { + if(fileNamel.indexOf("附件")==0) { + int indexOf2 = 3; + if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + }else if(fileNamel.contains(":")) { + indexOf2 = fileNamel.indexOf(":"); + } + String numberStr = fileNamel.substring(2,indexOf2); + if(isNumeric(numberStr)&&!"".equals(numberStr)) { + isNumberAscArray.add("true"); + int fileNumber = Integer.parseInt(numberStr); + jb.put("file_number", fileNumber); + }else { + isNumberAscArray.add("false"); + } + }else { + isNumberAscArray.add("false"); + } + + }else { + isNumberAscArray.add("false"); + } String upfileId = upfileModel.getUuid(); String upFileName = upfileModel.getFileName(); jb.put("upfileId", upfileId); @@ -3114,6 +3315,15 @@ public class ProcessPublishWeb extends ActionWeb { } } + + boolean contains = isNumberAscArray.contains("false"); + if(!contains) { + try { + js.sort(Comparator.comparing(objs -> (JSON.parseObject(objs.toString())).getInteger("file_number"))); + } catch (Exception e) { + throw new AWSQuotaException("附件格式请以:《附件1:XXXXXX》格式命名"); + } + } obj.put("upfileId", js); } @@ -3135,6 +3345,7 @@ public class ProcessPublishWeb extends ActionWeb { obj.put("targetMethodId", "1"); obj.put("targetCategory", "1"); } + changeArr.add(obj); } } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java index 385e5904..21db4488 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent.java @@ -245,94 +245,6 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList } } } - - /** - * 推送待阅文件到OA - */ - if ("true".equals(isSendOA)) { - ProcessInstance instanceById = processExecutionContext.getProcessInstance(); - if (bo_act_coe_publish1 != null && instanceById != null) { - System.err.println(instanceById.getTitle() + "推送OA待阅执行开始====>"); - long startTime = System.currentTimeMillis(); - ArrayList sendList = new ArrayList(); - // 发送全集团 - if ("1".equals(bo_act_coe_publish1.getString("SEND_SCOP"))) { - // 系统人员 - ArrayList userList1 = new ArrayList(); - try { - userList1 = getUser(jsonObject, "5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe", "0", - instanceById.getId()); - } catch (Exception e) { - // TODO: handle exception - } - //System.err.println("系统人员=====>" + userList1); - // 项目开发人员 - ArrayList userList2 = new ArrayList(); - try { - userList2 = getUser(jsonObject, "e79281b1-2f81-4895-b30e-9f96e9ad0e2c", "0", - instanceById.getId()); - } catch (Exception e) { - // TODO: handle exception - } - //System.err.println("项目开发人员=====>" + userList2); - // 离退人员 - ArrayList userList3 = new ArrayList(); - try { - userList3 = getUser(jsonObject, "65048aee-157f-49f2-a2dc-5903dd26f519", "0", - instanceById.getId()); - } catch (Exception e) { - // TODO: handle exception - } - //System.err.println("离退人员=====>" + userList3); - List maps = DBSql.getMaps("SELECT * FROM ORGUSER WHERE CLOSED = '0'"); - for (RowMap rowMap : maps) { - String userId = rowMap.getString("USERID"); - // RowMap map = DBSql.getMap("SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" - // + instanceById.getId() + "' AND USER_ID = '" + userId + "'"); - if (!"10033643".equals(userId) && !userList1.contains(userId) - && !userList2.contains(userId) && !userList3.contains(userId)) { - sendList.add(userId); - } - } - } else { - // 发送组织岗位职级 - sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject); - - } - long countTime = System.currentTimeMillis(); - System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>" - + (countTime - startTime) + "毫秒"); - for (String user : sendList) { - try { - SendOARead(jsonObject, instanceById, user, "批量推送"); - } catch (Exception e) { // TODO: handle exception - - } - } - // 二次推送 - List List = DBSql.getMaps("SELECT NAME FROM BO_EU_READ_COUNT WHERE PROCESSID = '" - + instanceById.getId() + "' AND RESULT = '待处理'"); - if (List.size() != 0) { - System.err.println(instanceById.getTitle() + "批量推送失败后执行二次推送=======>" + List.size()); - for (RowMap rowMap : List) { - try { - ArrayList userList3 = new ArrayList(); - String userIds = rowMap.getString("NAME"); - System.err.println(instanceById.getTitle() + "二次推送账号=======>" + userIds); - SendOARead(jsonObject, instanceById, userIds, "单个账号推送"); - } catch (Exception e) { // TODO: handle exception - } - } - } - - long endTimes = System.currentTimeMillis(); - // 存入日志 - createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes); - System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:" - + (endTimes - startTime) / 1000 / 60 + "分钟"); - } - - } /** * 推送到EHSQ */ @@ -384,6 +296,95 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList AttrSynAslp(processExecutionContext, wsId, filed); } catch (Exception e) { } + + /** + * 推送待阅文件到OA + */ + if ("true".equals(isSendOA)) { + ProcessInstance instanceById = processExecutionContext.getProcessInstance(); + if (bo_act_coe_publish1 != null && instanceById != null) { + System.err.println(instanceById.getTitle() + "推送OA待阅执行开始====>"); + long startTime = System.currentTimeMillis(); + ArrayList sendList = new ArrayList(); + // 发送全集团 + if ("1".equals(bo_act_coe_publish1.getString("SEND_SCOP"))) { + // 系统人员 + ArrayList userList1 = new ArrayList(); + try { + userList1 = getUser(jsonObject, "5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe", "0", + instanceById.getId()); + } catch (Exception e) { + // TODO: handle exception + } + //System.err.println("系统人员=====>" + userList1); + // 项目开发人员 + ArrayList userList2 = new ArrayList(); + try { + userList2 = getUser(jsonObject, "e79281b1-2f81-4895-b30e-9f96e9ad0e2c", "0", + instanceById.getId()); + } catch (Exception e) { + // TODO: handle exception + } + //System.err.println("项目开发人员=====>" + userList2); + // 离退人员 + ArrayList userList3 = new ArrayList(); + try { + userList3 = getUser(jsonObject, "65048aee-157f-49f2-a2dc-5903dd26f519", "0", + instanceById.getId()); + } catch (Exception e) { + // TODO: handle exception + } + //System.err.println("离退人员=====>" + userList3); + List mapsl = DBSql.getMaps("SELECT * FROM ORGUSER WHERE CLOSED = '0'"); + for (RowMap rowMap : mapsl) { + String userId = rowMap.getString("USERID"); + // RowMap map = DBSql.getMap("SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '" + // + instanceById.getId() + "' AND USER_ID = '" + userId + "'"); + if (!"10033643".equals(userId) && !userList1.contains(userId) + && !userList2.contains(userId) && !userList3.contains(userId)) { + sendList.add(userId); + } + } + } else { + // 发送组织岗位职级 + sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject); + + } + long countTime = System.currentTimeMillis(); + System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>" + + (countTime - startTime) + "毫秒"); + for (String user : sendList) { + try { + SendOARead(jsonObject, instanceById, user, "批量推送"); + } catch (Exception e) { // TODO: handle exception + + } + } + // 二次推送 + List List = DBSql.getMaps("SELECT NAME FROM BO_EU_READ_COUNT WHERE PROCESSID = '" + + instanceById.getId() + "' AND RESULT = '待处理'"); + if (List.size() != 0) { + System.err.println(instanceById.getTitle() + "批量推送失败后执行二次推送=======>" + List.size()); + for (RowMap rowMap : List) { + try { + ArrayList userList3 = new ArrayList(); + String userIds = rowMap.getString("NAME"); + System.err.println(instanceById.getTitle() + "二次推送账号=======>" + userIds); + SendOARead(jsonObject, instanceById, userIds, "单个账号推送"); + } catch (Exception e) { // TODO: handle exception + } + } + } + + long endTimes = System.currentTimeMillis(); + // 存入日志 + createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes); + System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:" + + (endTimes - startTime) / 1000 / 60 + "分钟"); + } + + } + @@ -1333,9 +1334,8 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList String level = ""; if (map != null) { String pver = map.getString("PLVER"); - if(UtilString.isNotEmpty(pver)) { + if (UtilString.isNotEmpty(pver)) { if (pver.contains(".00")) { - System.out.println("PLver>>>>>>>>>>" + pver); String levels = pver; String[] plvers = levels.split("\\."); plvers[1] = plvers[1].replaceAll("0", ""); @@ -1366,10 +1366,15 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList ResponseObject ro_create = appAPI_create.callASLP( appAPI_create.getAppContext(processExecutionContext.getProcessInstance().getAppId()), aslps_create, params_create); - //System.out.println("ro_create================" + ro_create); + // System.out.println("ro_create================" + ro_create); String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); JSONArray jsonArray1 = new JSONArray(); - if (bo_act_coe_publish.getString("SEND_SCOP").equals("0")) { + if (bo_act_coe_publish.getString("SEND_SCOP").equals("1")) { + JSONObject jsonObjecta = new JSONObject(); + jsonObjecta.put("assignmentType", "company"); + jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee"); + jsonArray1.add(jsonObjecta); + } else { String departId = bo_act_coe_publish.getString("SEND_SCOPE_ORG"); if (StringUtils.isNotEmpty(departId) && StringUtils.isEmpty(bo_act_coe_publish.getString("SEND_SCOPE_LEVEL")) @@ -1398,19 +1403,6 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList } } - } else { - List departmentsByCompanyId = SDK.getORGAPI().getDepartmentsByCompanyId(1, - "8911e732-b42a-4556-853f-ad32761bcbee"); - for (DepartmentModel departmentModel : departmentsByCompanyId) { - String depId = departmentModel.getId(); - // 查询未注销的部门并且去掉系统部门 - if (!departmentModel.isClosed()&& !"e79281b1-2f81-4895-b30e-9f96e9ad0e2c".equals(depId)&& !"65048aee-157f-49f2-a2dc-5903dd26f519".equals(depId)) { - JSONObject jsonObjecta = new JSONObject(); - jsonObjecta.put("assignmentType","department"); - jsonObjecta.put("assignmentId",depId); - jsonArray1.add(jsonObjecta); - } - } } AddKnwlAC(processExecutionContext, jsonArray1, processExecutionContext.getUserContext().getSessionId(), cardId);