AC授权修改

This commit is contained in:
Mr-wang 2023-10-18 15:08:23 +08:00
parent 3dd48103b9
commit 51f6400ca5

View File

@ -563,29 +563,30 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
/** /**
* 创建索引 * 创建索引
* @param processExecutionContext 流程实例 * @param processExecutionContext 流程实例
* @param contents 索引内容 * @param index 索引名称 (随便填写,aslp那边已经有固定的)
* @return * @param type 类型(随便填写,aslp中也是有固定的)
* @param documentPath dc全路径
* @param fileNames 文件名称
*/ */
public void createIndexByFile(ProcessExecutionContext processExecutionContext,String index,String type,String documentPath,JSONObject fileNames) {
public boolean createIndexesByContent(ProcessExecutionContext processExecutionContext,JSONArray contents) {
// 调用App // 调用App
String sourceAppId =processExecutionContext.getProcessInstance().getAppId() ; String sourceAppId = processExecutionContext.getProcessInstance().getAppId();
// aslp服务地址 // aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexesByContent"; String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexByFile";
// 参数定义列表 // 参数定义列表
Map params = new HashMap<String, Object>(); Map params = new HashMap<String, Object>();
//索引内容(JSONArray格式, JSONArray中包含JSONObject, JSONObject的内容同创建单个索引),必填
params.put("contents", contents);
//索引名称(文档在哪存放),必填 //索引名称(文档在哪存放),必填
params.put("index", "com.actionsoft.apps.kms_kmsdoc_card"); params.put("index", index);
//类型(索引中对数据进行逻辑分区不同 type的文档可能有不同的字段但最好能够非常相似,比如存储所有产品到索引products中但是你有许多不同的产品类别这些产品共享一种相同的或非常相似的模式他们有一个标题描述产品代码和价格他们只是正好属于产品下的一些子类用type表示不同的类别),必填 //类型(索引中对数据进行逻辑分区不同 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(); AppAPI appAPI = SDK.getAppAPI();
//入库操作创建内容索引(多个) //入库操作从文件创建内容索引
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
System.out.println("ro===================="+ro);
System.out.println("ro==================="+ro);
return ro.isOk();
} }
/** /**
@ -670,6 +671,15 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
//发送消息通知
List<BO> 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) { } catch (Exception e) {
System.out.println("等待中断异常"); System.out.println("等待中断异常");
@ -762,16 +772,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
//创建文件 //创建文件
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params); ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
System.out.println("流程手册的存入=================" + ro); System.out.println("流程手册的存入=================" + ro);
createIndexByFile(processExecutionContext, dcContext.getFileName(),"process",dcContext.getFilePath(),new JSONObject());
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);
} }
} }
@ -810,16 +811,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
paramss.put("dc", dcContexts); paramss.put("dc", dcContexts);
AppAPI appAPIs = SDK.getAppAPI(); AppAPI appAPIs = SDK.getAppAPI();
ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss); ResponseObject ros = appAPIs.callASLP(appAPIs.getAppContext(sourceAppId), aslp, paramss);
//createIndexByFile(processExecutionContext, dcContexts.getFileName(),"process",dcContexts.getFilePath(),new JSONObject());
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);
} }
} }
} }
@ -1859,7 +1851,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
aslps_create, params_create); aslps_create, params_create);
String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString();
JSONArray jsonArray1 = new JSONArray(); 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(); JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company"); jsonObjecta.put("assignmentType", "company");
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee"); 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); // System.out.println("ro_create================" + ro_create);
String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString(); String cardId = ((LinkedHashMap) ro_create.getData()).get("cardId").toString();
JSONArray jsonArray1 = new JSONArray(); 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(); JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company"); jsonObjecta.put("assignmentType", "company");
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee"); jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
@ -2109,7 +2103,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
jsonObject_ehsq.put("releasescope", "内蒙古伊利实业集团股份有限公司"); jsonObject_ehsq.put("releasescope", "内蒙古伊利实业集团股份有限公司");
} else { } else {
/*String departname = ""; String departname = "";
String orgperm = bo1.getString("ORGPERM"); String orgperm = bo1.getString("ORGPERM");
String dleass = ""; String dleass = "";
String[] deptSplit = orgperm.split(","); String[] deptSplit = orgperm.split(",");
@ -2126,10 +2120,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
if(UtilString.isNotEmpty(departname)&&departname.length()>500) { if(UtilString.isNotEmpty(departname)&&departname.length()>500) {
String substring = departname.substring(0, 500); String substring = departname.substring(0, 500);
departname = substring.substring(0,substring.lastIndexOf(";")); 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"));
} }
} }