增加发送OAalsp|发送kmsalap|发送EHSQalsp

This commit is contained in:
zhaol 2025-01-23 01:26:16 +08:00
parent 237b7a691c
commit 7a62322c29
7 changed files with 532 additions and 452 deletions

View File

@ -5,6 +5,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.actionsoft.apps.coe.pal.publisher.alsp.SendEHSQAlsp;
import com.actionsoft.apps.coe.pal.publisher.alsp.SendKMSAlsp;
import com.actionsoft.apps.coe.pal.publisher.alsp.SendOAAlsp;
import com.actionsoft.apps.coe.pal.publisher.at.*;
import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishClientWeb;
import com.actionsoft.apps.coe.pal.publisher.client.web.ProcessPublishWeb;
@ -163,6 +166,13 @@ public class Plugins implements PluginListener {
list.add(new AtFormulaPluginProfile("依据任务接收时间与意见回复期限返回小时数", "@getConsultHour(*bindid,*taskId,*deadline)", getConsultHour.class.getName(), "依据任务接收时间与意见回复期限返回小时数", "依据任务接收时间与意见回复期限返回小时数"));
list.add(new ASLPPluginProfile("SendOAAlsp", SendOAAlsp.class.getName(), "OA系统请求调用请求调用", new HttpASLP(HttpASLP.AUTH_AWS_SID)));
list.add(new ASLPPluginProfile("SendKMSAlsp", SendKMSAlsp.class.getName(), "KMS调用", new HttpASLP(HttpASLP.AUTH_AWS_SID)));
list.add(new ASLPPluginProfile("SendEHSQAlsp", SendEHSQAlsp.class.getName(), "EHSQ调用", new HttpASLP(HttpASLP.AUTH_AWS_SID)));
return list;
}

View File

@ -0,0 +1,100 @@
package com.actionsoft.apps.coe.pal.publisher.alsp;
import com.actionsoft.apps.coe.pal.publisher.pubEvent.ProcessEndAfterEvent_new;
import com.actionsoft.apps.resource.interop.aslp.ASLP;
import com.actionsoft.apps.resource.interop.aslp.Meta;
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.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import java.sql.Connection;
import java.util.List;
import java.util.Map;
public class SendEHSQAlsp implements ASLP {
@Override
@Meta(parameter = {"name:'processId',required:true,desc:'流程ID'",
"name:'taskId',required:true,desc:'任务ID'",
"name:'sid',required:true,desc:'sid'",
"name:'isSendEHSQ',required:true,desc:'isSendEHSQ'",
})
public ResponseObject call(Map<String, Object> map) {
String processId = String.valueOf(map.get("processId"));
String taskId = String.valueOf(map.get("taskId"));
String sid = String.valueOf(map.get("sid"));
String isSendEHSQ = String.valueOf(map.get("isSendEHSQ"));
Connection open = DBSql.open();
// 流程发布的新增发布
List<BO> bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).connection(open)
.addQuery("BINDID=", processId).list();
// 流程发布的变更发布
List<BO> bo_act_coe_publish_c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).connection(open)
.addQuery("BINDID=",processId).list();
// 流程发布的废止变更
List<BO> bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).connection(open)
.addQuery("BINDID=", processId).list();
ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(processId);
TaskInstance taskInstance=SDK.getTaskAPI().getInstanceById(taskId);
ProcessEndAfterEvent_new processEndAfterEventNew=new ProcessEndAfterEvent_new();
boolean sendEhqs = false;
String depId = UserContext.fromSessionId(sid).getDepartmentModel().getId();
//获取EHSQ配置表判断是否发送
String sql = "SELECT * FROM BO_ACT_ACT_ESQ_SEND";
List<RowMap> maps = DBSql.getMaps(open,sql);
for (RowMap rowMap : maps) {
String dempet = rowMap.getString("DEMPET");
String issend = rowMap.getString("ISSEND");
DepartmentModel departmentById = SDK.getORGAPI().getDepartmentById(dempet);
if(departmentById!=null) {
String departemenId = departmentById.getId();
String pathIdOfCache=departmentById.getPathIdOfCache();
if(departemenId.equals(depId)&&"".equals(issend)) {
sendEhqs = true;
} else {
List<DepartmentModel> subDepartments = SDK.getORGAPI().getSubDepartments(departmentById.getId());
for (DepartmentModel departmentModel : subDepartments) {
String subDeartmentId = departmentModel.getId();
if (subDeartmentId.equals(depId) && "".equals(issend)) {
sendEhqs = true;
}
}
}
}
}
if(!sendEhqs) {
System.err.println("本次发文不推送EHSQ====>"+processInstance.getTitle());
}
if ("true".equals(isSendEHSQ)&&sendEhqs) {
try {
// 推送EHSQ
if(bo_act_coe_publish_n.size()>0) {
processEndAfterEventNew.sendEHSQ(processInstance, bo_act_coe_publish_n,taskInstance,sid);
}
// 更新EHSQ
if(bo_act_coe_publish_c.size()>0) {
processEndAfterEventNew.updateEHSQ(processInstance, bo_act_coe_publish_c,taskInstance,sid);
}
} catch (Exception e) {
// TODO: handle exception
}
}
return null;
}
}

View File

@ -0,0 +1,174 @@
package com.actionsoft.apps.coe.pal.publisher.alsp;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.publisher.pubEvent.DownloadUtil;
import com.actionsoft.apps.coe.pal.publisher.pubEvent.ProcessEndAfterEvent_new;
import com.actionsoft.apps.coe.pal.publisher.utils.DeleteGptFilesUtils;
import com.actionsoft.apps.resource.interop.aslp.ASLP;
import com.actionsoft.apps.resource.interop.aslp.Meta;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.constant.ProcessRuntimeConst;
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.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import java.sql.Connection;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
public class SendKMSAlsp implements ASLP {
@Override
@Meta(parameter = {"name:'processId',required:true,desc:'流程实例ID'",
"name:'sid',required:true,desc:'sid'"})
public ResponseObject call(Map<String, Object> map) {
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
try {
String processId = String.valueOf(map.get("processId"));
Connection open = DBSql.open();
String sid = String.valueOf(map.get("sid"));
//查询发布表数据
BO bo_act_coe_publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
.addQuery("BINDID=", processId)
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
// 流程发布的新增发布
List<BO> bo_act_coe_publish_n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N", true).connection(open)
.addQuery("BINDID=", processId).list();
// 流程发布的变更发布
List<BO> bo_act_coe_publish_c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C", true).connection(open)
.addQuery("BINDID=", processId).list();
// 流程发布的废止变更
List<BO> bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S", true).connection(open)
.addQuery("BINDID=", processId).list();
JSONArray filed = new JSONArray(new LinkedList<>());
String wsId = "";
ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(processId);
ProcessEndAfterEvent_new processEndAfterEvent_new = new ProcessEndAfterEvent_new();
JSONObject jsonObject = new JSONObject();
String new_uid = "";
ArrayList<String> sendList = new ArrayList<String>();
// 发送全集团
if ("1".equals(bo_act_coe_publish.getString("SEND_SCOP"))) {
// 系统人员
ArrayList<String> userList1 = new ArrayList<String>();
try {
userList1 = processEndAfterEvent_new.getUser(jsonObject, "5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe", "0",
processId);
} catch (Exception e) {
// TODO: handle exception
}
//System.err.println("系统人员=====>" + userList1);
// 项目开发人员
ArrayList<String> userList2 = new ArrayList<String>();
try {
userList2 = processEndAfterEvent_new.getUser(jsonObject, "e79281b1-2f81-4895-b30e-9f96e9ad0e2c", "0",
processId);
} catch (Exception e) {
// TODO: handle exception
}
//System.err.println("项目开发人员=====>" + userList2);
// 离退人员
ArrayList<String> userList3 = new ArrayList<String>();
try {
userList3 = processEndAfterEvent_new.getUser(jsonObject, "65048aee-157f-49f2-a2dc-5903dd26f519", "0",
processId);
} catch (Exception e) {
// TODO: handle exception
}
//System.err.println("离退人员=====>" + userList3);
List<RowMap> mapsl = DBSql.getMaps(open, "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 = processEndAfterEvent_new.getSendList(processInstance, bo_act_coe_publish, jsonObject);
}
new_uid = new_uid.join(",", sendList);
try {
// 发布到知识库
int m = 0;
for (BO bo : bo_act_coe_publish_n) {
processEndAfterEvent_new.createKmsByNew(bo, wsId, filed, processInstance, bo_act_coe_publish, new_uid, sid);
}
// 更新知识库
for (BO bo : bo_act_coe_publish_c) {
processEndAfterEvent_new.CreateKmsByupdate(bo, wsId, filed, processInstance, bo_act_coe_publish,
new_uid, sid);
}
// 废止知识库文件
for (BO bo : bo_act_coe_publish_s) {
// 将旧的知识取消发布或者移动到废止发布中
String publishfileid_stop = bo.getString("STOPFILEID");
filed.add(publishfileid_stop);
String sql_s = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + publishfileid_stop
+ "'";
RowMap map1 = DBSql.getMap(open, sql_s);
if (StringUtils.isNotEmpty(map1.getString("EXT4"))) {
processEndAfterEvent_new.CancelPublishKnwl(processInstance,
sid,
map1.getString("EXT4"));
DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"
+ publishfileid_stop + "'");
}
}
} catch (Exception e) {
System.out.println("KMS知识库创建异常====" + bo_act_coe_publish_n);
// TODO: handle exception
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
ro = ResponseObject.newErrResponse(e.getMessage());
}
return ro;
}
}

View File

@ -0,0 +1,68 @@
package com.actionsoft.apps.coe.pal.publisher.alsp;
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
import com.actionsoft.apps.coe.pal.publisher.pubEvent.DownloadUtil;
import com.actionsoft.apps.coe.pal.publisher.pubEvent.ProcessEndAfterEvent_new;
import com.actionsoft.apps.coe.pal.publisher.utils.DeleteGptFilesUtils;
import com.actionsoft.apps.resource.interop.aslp.ASLP;
import com.actionsoft.apps.resource.interop.aslp.Meta;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.constant.ProcessRuntimeConst;
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.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.org.model.DepartmentModel;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang.StringUtils;
import java.sql.Connection;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
public class SendOAAlsp implements ASLP {
@Override
@Meta(parameter = {"name:'processId',required:true,desc:'流程ID'",
"name:'taskId',required:true,desc:'任务ID'"})
public ResponseObject call(Map<String, Object> map) {
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
try {
String processId = String.valueOf(map.get("processId"));
String taskId = String.valueOf(map.get("taskId"));
String sid = String.valueOf(map.get("sid"));
Connection open = DBSql.open();
ProcessEndAfterEvent_new processEndAfterEventNew = new ProcessEndAfterEvent_new();
ProcessInstance processInstance = SDK.getProcessAPI().getInstanceById(processId);
TaskInstance taskInstance = SDK.getTaskAPI().getInstanceById(taskId);
if (processInstance != null && processInstance.getControlState().equals(ProcessRuntimeConst.INST_STATE_END) && taskInstance != null) {
processEndAfterEventNew.ProcessData(processInstance, taskInstance, open, sid);
}
} catch (Exception e) {
e.printStackTrace();
ro = ResponseObject.newErrResponse(e.getMessage());
}
return ro;
}
}

View File

@ -38,6 +38,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyMod
import com.actionsoft.apps.coe.pal.pal.repository.web.CoeProcessLevelWeb;
import com.actionsoft.apps.coe.pal.publisher.client.util.ProcessStatusAPIManager;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.apps.coe.pal.publisher.utils.DeleteGptFilesUtils;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
@ -244,7 +245,7 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
//更新部门视图
updateDeptView(bolistN, bolistC, bolistS);
updateDeptView(bolistN, bolistC, bolistS,param);
}
@ -254,11 +255,15 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
* @param bolistC
* @param bolistS
*/
public void updateDeptView(List<BO> bolistN, List<BO> bolistC, List<BO> bolistS){
public void updateDeptView(List<BO> bolistN, List<BO> bolistC, List<BO> bolistS, ProcessExecutionContext param){
if (bolistN != null) {
for (BO boN : bolistN) {
String fileId = boN.getString("PUBLISHFILEID");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='" + fileId + "'");
int countEXT5=DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='" + fileId + "'");
if(countEXT5==0){
System.out.println("发布新增表模型id为="+fileId);
}
/**
* 更新部门视图EXT6字段
*/
@ -292,7 +297,6 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+changefileId+"'");
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='"+changefileIdNew+"'");
/**
* 更新部门视图EXT6字段
*/
@ -322,6 +326,39 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
String fileId = boS.get("STOPFILEID").toString();
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+fileId+"'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
DesignerShapeRelationModel designerShapeRelationModel=new DesignerShapeRelationModel();
designerShapeRelationModel.setId(UUIDGener.getUUID());
designerShapeRelationModel.setFileId(fileId);
designerShapeRelationModel.setAttrId("nullifier");
designerShapeRelationModel.setRelationFileId("00000000-0000-0000-0000-000000000000");
designerShapeRelationModel.setRelationShapeId("00000000-0000-0000-0000-000000000000");
JSONObject js=new JSONObject();
js.put("name", param.getUserContext().getUserName());
js.put("id",param.getUserContext().getUID());
js.put("type", "user");
designerShapeRelationModel.setRelationShapeText(js.toString());
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
dao.insert(designerShapeRelationModel);
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
//作废时间
Date date=new Date();
SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd");
propertyDao.updatePropertyByPropertyId(fileId, "obsolescence_time", sdfs.format(date));
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}
}