将知识库授权修改判断条件并修改为发送全公司则授权公司id代码

This commit is contained in:
zhal 2023-10-18 15:18:58 +08:00
parent 51f6400ca5
commit 98544e49b7

View File

@ -563,30 +563,29 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
/**
* 创建索引
* @param processExecutionContext 流程实例
* @param index 索引名称 (随便填写,aslp那边已经有固定的)
* @param type 类型(随便填写,aslp中也是有固定的)
* @param documentPath dc全路径
* @param fileNames 文件名称
* @param contents 索引内容
* @return
*/
public void createIndexByFile(ProcessExecutionContext processExecutionContext,String index,String type,String documentPath,JSONObject fileNames) {
public boolean createIndexesByContent(ProcessExecutionContext processExecutionContext,JSONArray contents) {
// 调用App
String sourceAppId = processExecutionContext.getProcessInstance().getAppId();
String sourceAppId =processExecutionContext.getProcessInstance().getAppId() ;
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexByFile";
String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexesByContent";
// 参数定义列表
Map params = new HashMap<String, Object>();
//索引内容(JSONArray格式, JSONArray中包含JSONObject, JSONObject的内容同创建单个索引),必填
params.put("contents", contents);
//索引名称(文档在哪存放),必填
params.put("index", index);
params.put("index", "com.actionsoft.apps.kms_kmsdoc_card");
//类型(索引中对数据进行逻辑分区不同 type的文档可能有不同的字段但最好能够非常相似,比如存储所有产品到索引products中但是你有许多不同的产品类别这些产品共享一种相同的或非常相似的模式他们有一个标题描述产品代码和价格他们只是正好属于产品下的一些子类用type表示不同的类别),必填
params.put("type", type);
//要入库的文件全路径,必填
params.put("documentPath", documentPath);
//文件实际名称 jsonObject,非必填
params.put("fileNames", fileNames);
params.put("type", "kmsdoc_card");
AppAPI appAPI = SDK.getAppAPI();
//入库操作从文件创建内容索引
//入库操作创建内容索引(多个)
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
System.out.println("ro===================="+ro);
System.out.println("ro==================="+ro);
return ro.isOk();
}
/**
@ -671,15 +670,6 @@ 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) {
System.out.println("等待中断异常");
@ -772,7 +762,16 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
//创建文件
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
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);
}
}
@ -811,7 +810,16 @@ 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);
//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);
}
}
}
@ -1851,7 +1859,7 @@ 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();
//判断是否发送全公司,1为全公司0为部分人员,如果是全公司的授权公司id,如果是部门并且其他两个字段为空,授权部门,否则就授权人员
//根据表单字段判断是否发送全公司1为全公司0为部分人员发送全公司的则授权公司id只有部门则授权部门如果包含部门职级岗位则授权该范围的人员id
if (bo_act_coe_publish.getString("SEND_SCOP").equals("1")) {
JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company");
@ -1975,7 +1983,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();
//判断是否发送全公司,1为全公司0为部分人员,如果是全公司的授权公司id,如果是部门并且其他两个字段为空,授权部门,否则就授权人员
//根据表单字段判断是否发送全公司1为全公司0为部分人员发送全公司的则授权公司id只有部门则授权部门如果包含部门职级岗位则授权该范围的人员id
if (bo_act_coe_publish.getString("SEND_SCOP").equals("1")) {
JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company");
@ -2103,7 +2112,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(",");
@ -2120,9 +2129,10 @@ 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"));
}
}