From 51f6400ca5cd996a5c864855bba812907562db9c Mon Sep 17 00:00:00 2001 From: Mr-wang Date: Wed, 18 Oct 2023 15:08:23 +0800 Subject: [PATCH] =?UTF-8?q?AC=E6=8E=88=E6=9D=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pubEvent/ProcessEndAfterEvent_new.java | 73 +++++++++---------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java index 1cbb158e..07ec752a 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java @@ -563,29 +563,30 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute /** * 创建索引 * @param processExecutionContext 流程实例 - * @param contents 索引内容 - * @return + * @param index 索引名称 (随便填写,aslp那边已经有固定的) + * @param type 类型(随便填写,aslp中也是有固定的) + * @param documentPath dc全路径 + * @param fileNames 文件名称 */ - - public boolean createIndexesByContent(ProcessExecutionContext processExecutionContext,JSONArray contents) { + public void createIndexByFile(ProcessExecutionContext processExecutionContext,String index,String type,String documentPath,JSONObject fileNames) { // 调用App - String sourceAppId =processExecutionContext.getProcessInstance().getAppId() ; + String sourceAppId = processExecutionContext.getProcessInstance().getAppId(); // aslp服务地址 - String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexesByContent"; + String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexByFile"; // 参数定义列表 Map params = new HashMap(); -//索引内容(JSONArray格式, JSONArray中包含JSONObject, JSONObject的内容同创建单个索引),必填 - params.put("contents", contents); //索引名称(文档在哪存放),必填 - params.put("index", "com.actionsoft.apps.kms_kmsdoc_card"); + params.put("index", index); //类型(索引中对数据进行逻辑分区。不同 type的文档可能有不同的字段,但最好能够非常相似,比如:存储所有产品到索引products中,但是你有许多不同的产品类别,这些产品共享一种相同的(或非常相似)的模式:他们有一个标题、描述、产品代码和价格。他们只是正好属于“产品”下的一些子类。用type表示不同的类别),必填 - params.put("type", "kmsdoc_card"); + params.put("type", type); +//要入库的文件全路径,必填 + params.put("documentPath", documentPath); +//文件实际名称, jsonObject,非必填 + params.put("fileNames", fileNames); AppAPI appAPI = SDK.getAppAPI(); -//入库操作,创建内容索引(多个) +//入库操作,从文件创建内容索引 ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); - - System.out.println("ro==================="+ro); - return ro.isOk(); + System.out.println("ro===================="+ro); } /** @@ -670,6 +671,15 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute + //发送消息通知 + List readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",processExecutionContext.getProcessInstance().getId()).addQuery("RESULT=","待处理").list(); + if(readCountBO.size()>0){ + SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+processExecutionContext.getProcessInstance().getTitle()+"文件有失败记录,请及时处理!!!"); + } + + //更新任务状态 + int r1 = DBSql.update("UPDATE BO_ACT_EXECUTIVE_TASK SET ISTASKEND='2' WHERE TASKID ='" + processExecutionContext.getProcessInstance().getId() + "'"); + } catch (Exception e) { System.out.println("等待中断异常"); @@ -762,16 +772,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute //创建文件 ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); System.out.println("流程手册的存入=================" + ro); - - JSONArray coontest = new JSONArray(new LinkedList<>()); - JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); - jsonObject.put("documentId", cardId); - jsonObject.put("content", "");//信息附件 - jsonObject.put("abstract", dcContext);//信息摘要 - jsonObject.put("title", dcContext.getFileName().substring(0,dcContext.getFileName().indexOf(".")));//信息标题 - coontest.add(jsonObject); - //createIndexesByContent(processExecutionContext,coontest); - + createIndexByFile(processExecutionContext, dcContext.getFileName(),"process",dcContext.getFilePath(),new JSONObject()); } } @@ -810,16 +811,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute paramss.put("dc", dcContexts); AppAPI appAPIs = SDK.getAppAPI(); ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss); - - JSONArray coontest = new JSONArray(new LinkedList<>()); - JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); - jsonObject.put("documentId", cardId); - jsonObject.put("content", "");//信息附件 - jsonObject.put("abstract", dcContexts);//信息摘要 - jsonObject.put("title", dcContexts.getFileName().substring(0,dcContexts.getFileName().indexOf(".")));//信息标题 - coontest.add(jsonObject); - //createIndexesByContent(processExecutionContext,coontest); - + //createIndexByFile(processExecutionContext, dcContexts.getFileName(),"process",dcContexts.getFilePath(),new JSONObject()); } } } @@ -1859,7 +1851,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute aslps_create, params_create); String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); JSONArray jsonArray1 = new JSONArray(); - if (bo_act_coe_publish.getString("SEND_SCOP").equals("0")) { + //判断是否发送全公司,1为全公司0为部分人员,如果是全公司的授权公司id,如果是部门并且其他两个字段为空,授权部门,否则就授权人员 + 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"); @@ -1982,7 +1975,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute // 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")) { + //判断是否发送全公司,1为全公司0为部分人员,如果是全公司的授权公司id,如果是部门并且其他两个字段为空,授权部门,否则就授权人员 + 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"); @@ -2109,7 +2103,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute jsonObject_ehsq.put("releasescope", "内蒙古伊利实业集团股份有限公司"); } else { - /*String departname = ""; + String departname = ""; String orgperm = bo1.getString("ORGPERM"); String dleass = ""; String[] deptSplit = orgperm.split(","); @@ -2126,10 +2120,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute if(UtilString.isNotEmpty(departname)&&departname.length()>500) { String substring = departname.substring(0, 500); departname = substring.substring(0,substring.lastIndexOf(";")); - }*/ - //jsonObject_ehsq.put("releasescope", departname); + } + jsonObject_ehsq.put("releasescope", departname); - jsonObject_ehsq.put("releasescope", byProcess.getString("IS_THE_UNIT")); } }