发布流程重构代码提交

This commit is contained in:
zhaol 2025-02-20 17:47:36 +08:00
parent 696af37dca
commit 05ea496a36
7 changed files with 282 additions and 329 deletions

View File

@ -8,6 +8,7 @@ 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.alsp.SendOAReadAlsp;
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;
@ -166,12 +167,17 @@ 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)));
list.add(new ASLPPluginProfile("SendOAReadAlsp", SendOAReadAlsp.class.getName(), "OA待阅接口ALSP", new HttpASLP(HttpASLP.AUTH_AWS_SID)));
return list;
}

View File

@ -2,6 +2,7 @@ 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.PALRepository;
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;
@ -39,6 +40,7 @@ public class SendKMSAlsp implements ASLP {
@Meta(parameter = {"name:'processId',required:true,desc:'流程实例ID'",
"name:'sid',required:true,desc:'sid'"})
public ResponseObject call(Map<String, Object> map) {
System.out.println("开始进入KMS方法中");
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
try {
String processId = String.valueOf(map.get("processId"));
@ -95,10 +97,9 @@ public class SendKMSAlsp implements ASLP {
} catch (Exception e) {
// TODO: handle exception
}
List<RowMap> mapsl = DBSql.getMaps(open, "SELECT * FROM ORGUSER WHERE CLOSED = '0'");
List<RowMap> mapsl = DBSql.getMaps(open, "SELECT USERID FROM ORGUSER WHERE CLOSED = '0'");
for (RowMap rowMap : mapsl) {
String userId = rowMap.getString("USERID");
if (!"10033643".equals(userId) && !userList1.contains(userId)
&& !userList2.contains(userId) && !userList3.contains(userId)) {
sendList.add(userId);
@ -109,7 +110,6 @@ public class SendKMSAlsp implements ASLP {
sendList = processEndAfterEvent_new.getSendList(processInstance, bo_act_coe_publish, jsonObject);
}
new_uid = new_uid.join(",", sendList);
try {
@ -129,16 +129,22 @@ public class SendKMSAlsp implements ASLP {
// 将旧的知识取消发布或者移动到废止发布中
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"))) {
/*String sql_s = "select EXT4 from APP_ACT_COE_PAL_REPOSITORY where id='" + publishfileid_stop
+ "'";*/
PALRepositoryModel plmodel = PALRepositoryCache.getCache().get(publishfileid_stop);
String ext4=plmodel.getExt4();
/*RowMap map1 = DBSql.getMap(open, sql_s);*/
if (StringUtils.isNotEmpty(ext4)) {
processEndAfterEvent_new.CancelPublishKnwl(processInstance,
sid,
map1.getString("EXT4"));
ext4);
DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"
DBSql.update(open, "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4='' WHERE ID='"
+ publishfileid_stop + "'");
}
}
} catch (Exception e) {

View File

@ -37,7 +37,9 @@ public class SendOAAlsp implements ASLP {
@Override
@Meta(parameter = {"name:'processId',required:true,desc:'流程ID'",
"name:'taskId',required:true,desc:'任务ID'"})
"name:'taskId',required:true,desc:'任务ID'",
"name:'sid',required:true,desc:'用户会话ID'"
})
public ResponseObject call(Map<String, Object> map) {
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
try {
@ -50,9 +52,7 @@ public class SendOAAlsp implements ASLP {
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();

View File

@ -10,6 +10,7 @@ import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.exception.AWSDataAccessException;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@ -19,6 +20,7 @@ import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.sql.Connection;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
@ -32,12 +34,24 @@ public class SendOAReadAlsp implements ASLP {
@Override
@Meta(parameter = {"name:'processId',required:true,desc:'流程实例ID'",
"name:'userIds',required:true,desc:'userIds'"})
"name:'userIds',required:true,desc:'用户数据'",
"name:'type',required:true,desc:'类型'"
})
public ResponseObject call(Map<String, Object> map) {
System.out.println("即将开始进入方法体========================");
Connection conn =null;
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
try {
String processId = String.valueOf(map.get("processId"));
String userIds = String.valueOf(map.get("userIds"));
String type = String.valueOf(map.get("type"));
System.out.println("processId=========="+processId);
System.out.println("userIds=========="+userIds);
System.out.println("type=========="+type);
conn=DBSql.open();
ProcessInstance instanceById = SDK.getProcessAPI().getInstanceById(processId);
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
@ -71,7 +85,6 @@ public class SendOAReadAlsp implements ASLP {
String target = ta.getTarget();
jsonObjects.put("user", target);
// jsonObject.put("user",);//processExecutionContext.getProcessInstance().getCreateUser()
jsonObjects.put("date", sdf.format(endTime));
jsonObjects.put("remark", bo_act_coe_publish1.getString("PROCESS_TITLE"));
jsonObjects.put("status", "0");
@ -89,7 +102,6 @@ public class SendOAReadAlsp implements ASLP {
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
+ "<![CDATA[" + jsonObjects + "]]>" + " </web:in0>" + " </web:service>"
+ " </soapenv:Body>" + "</soapenv:Envelope>";
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
UtilUrl uc=new UtilUrl();
String postSoap =uc.doPostSoap(readurl, xmlStr, "");
@ -111,17 +123,18 @@ public class SendOAReadAlsp implements ASLP {
if ("true".equals(status)) {
System.out.println("发送接口方法");
JSONArray resultArray = JSONObject.parseArray(datas);
//System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList.size()+"");
//批量入库操作
//加入时间戳
long set_start_time = System.currentTimeMillis();
bo_OA_read.set("SET_TIME",set_start_time);
if(resultArray.size()>0){
System.out.println("resultArray============="+resultArray);
List<BO> recordLists = new ArrayList<BO>();
long startTime2 = System.currentTimeMillis();
for (int j = 0; j < resultArray.size(); j++) {
System.out.println("==============================");
JSONObject jsonObject2 = resultArray.getJSONObject(j);
String user = jsonObject2.get("user").toString();
String dataid = jsonObject2.get("dataid").toString();
@ -138,10 +151,8 @@ public class SendOAReadAlsp implements ASLP {
bo.set("READSTATE", "未读");
bo.set("TYPE", type);
recordLists.add(bo);
}
SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, instanceById, UserContext.fromUID(instanceById.getCreateUser()));
SDK.getBOAPI().create("BO_ACT_DATAID",recordLists, instanceById, UserContext.fromUID(instanceById.getCreateUser()),conn);
long endTime2 = System.currentTimeMillis();
System.err.println(instanceById.getTitle() + "批量插入OA待阅数据====>" + "用时:"
@ -167,14 +178,14 @@ public class SendOAReadAlsp implements ASLP {
realTimeBO.set("PROCESSID", instanceById.getId());
realTimeBO.set("SENDNUMSJ", 1);
realTimeBO.set("SENDNUM",sendTotal);
SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", realTimeBO, instanceById, UserContext.fromUID(instanceById.getCreateUser()));
SDK.getBOAPI().create("BO_ACT_OA_REAL_TIME", realTimeBO, instanceById, UserContext.fromUID(instanceById.getCreateUser()),conn);
}
}
long set_end_time = System.currentTimeMillis();
bo_OA_read.set("SET_END_TIME",set_end_time);
bo_OA_read.set("SET_SUM_TIME",(set_end_time-set_start_time));
bo_OA_read.set("PROCESS_ID",instanceById.getId());
SDK.getBOAPI().create("BO_EU_OA_READ_LOG", bo_OA_read, instanceById, UserContext.fromUID(instanceById.getCreateUser()));
SDK.getBOAPI().create("BO_EU_OA_READ_LOG", bo_OA_read, instanceById, UserContext.fromUID(instanceById.getCreateUser()),conn);
if("单个账号推送".equals(type)) {
DBSql.update("UPDATE BO_EU_READ_COUNT SET RESULT = '已重新推送' WHERE PROCESSID = '"+instanceById+"' AND NAME = '"+resrt+"'");
}
@ -192,8 +203,7 @@ public class SendOAReadAlsp implements ASLP {
bo.set("TYPE", type);
bo.set("RESULT", "待处理");
bo.set("PROCESSID", instanceById.getId());
bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId());
//SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser());
bo.set("DEPNAME", "");
recordFailLists.add(bo);
} catch (Exception e) {
bo= new BO();
@ -202,22 +212,21 @@ public class SendOAReadAlsp implements ASLP {
bo.set("TYPE", type);
bo.set("RESULT", "待处理");
bo.set("PROCESSID", instanceById.getId());
bo.set("DEPNAME", SDK.getORGAPI().getUser(userIds).getDepartmentId());
//SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser());
bo.set("DEPNAME", "");
recordFailLists.add(bo);
}
}
SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, instanceById, UserContext.fromUID(instanceById.getCreateUser()));
SDK.getBOAPI().create("BO_EU_READ_COUNT", recordFailLists, instanceById, UserContext.fromUID(instanceById.getCreateUser()),conn);
}
}
} catch (AWSDataAccessException e) {
e.printStackTrace();
ro = ResponseObject.newErrResponse(e.getMessage());
}finally {
DBSql.close(conn);
}
}
return null;
System.out.println("调用结束===============================");
return ro;
}
}

View File

@ -22,9 +22,6 @@ public class getConsultHour extends AbstExpression {
String taskId = getParameter(s, 2);
String deadline = getParameter(s, 3);
System.out.println("bindid=========="+bindid);
System.out.println("taskId=========="+taskId);
System.out.println("deadline=========="+deadline);
//计算时间差

View File

@ -259,10 +259,14 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
if (bolistN != null) {
for (BO boN : bolistN) {
String fileId = boN.getString("PUBLISHFILEID");
int countEXT5=DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='1' WHERE ID='" + fileId + "'");
PALRepository palRepository=new PALRepository();
palRepository.updateRepositoryExtAll(fileId,"","","","","1","");
/*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字段
@ -278,12 +282,14 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
/*int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID = '" + fileId + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);
if (plModel != null) {
PALRepositoryCache.getCache().put(fileId, plModel);
}
}*/
palRepository.updateRepositoryExtAll(fileId,"","","","","",dempId);
}
}
}
@ -294,8 +300,13 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
String changefileId = boC.getString("CHANGEFILEID");
String changefileIdNew = boC.getString("CHANGEDFILEIDNEW");
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+"'");
PALRepository palRepository=new PALRepository();
palRepository.updateRepositoryExtAll(changefileId,"","","","","0","");
palRepository.updateRepositoryExtAll(changefileIdNew,"","","","","1","");
/*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字段
@ -311,12 +322,12 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
}
dempId = dempId.substring(0, dempId.length() - 1);
int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID='" + changefileIdNew + "'");
/* int count = DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6=TO_CLOB('" + dempId + "') WHERE ID='" + changefileIdNew + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(changefileIdNew);
if (plModel != null) {
PALRepositoryCache.getCache().put(changefileIdNew, plModel);
}
}*/
palRepository.updateRepositoryExtAll(changefileIdNew,"","","","","",dempId);
}
}
@ -324,7 +335,10 @@ public class PublishExecuteListenerInterfaceImpl extends ExecuteListener impleme
if (bolistS != null) {
for (BO boS : bolistS) {
String fileId = boS.get("STOPFILEID").toString();
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+fileId+"'");
PALRepository palRepository=new PALRepository();
palRepository.updateRepositoryExtAll(fileId,"","","","","0","");
//DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT5='0' WHERE ID='"+fileId+"'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(fileId);

View File

@ -12,6 +12,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache;
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao;
@ -135,9 +136,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
// 给定必填参数
params.put("processId", ext.getProcessInstance().getId());
params.put("taskId", ext.getTaskInstance().getId());
params.put("sid", ext.getUserContext().getSessionId());
AppAPI appApi = SDK.getAppAPI();
//统一接口中心请求调用
//发送OA待阅接口
appApi.asynCallASLP(appApi.getAppContext(sourceAppId), aslp, params);
@ -151,7 +153,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
kmsparams.put("sid", ext.getUserContext().getSessionId());
AppAPI kmsappApi = SDK.getAppAPI();
//统一接口中心请求调用
//创建KMS知识
appApi.asynCallASLP(kmsappApi.getAppContext(sourceAppId), kmsaslp, params);
@ -163,10 +165,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
//发送消息通知
List<BO> readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",ext.getProcessInstance().getId()).addQuery("RESULT=","待处理").list();
/* List<BO> readCountBO=SDK.getBOAPI().query("BO_EU_READ_COUNT").addQuery("PROCESSID=",ext.getProcessInstance().getId()).addQuery("RESULT=","待处理").list();
if(readCountBO.size()>0){
SDK.getNotificationAPI().sendMessage("admin", "admin", "文件名称:"+ext.getProcessInstance().getTitle()+"文件有失败记录,请及时处理!!!");
}
}*/
//更新任务状态
@ -190,7 +192,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
//发送OA待办
TaskInstance taskInstance= SDK.getTaskAPI().getInstanceById(processInstance.getStartTaskInstId());
sendOaPending(taskInstance,processInstance,ext);
//sendOaPending(taskInstance,processInstance,ext);
String url="https://bpm.yili.com:8088/portal/r/w?sid="+ext.getUserContext().getSessionId()+"&cmd=CLIENT_BPM_FORM_MAIN_PAGE_OPEN&processInstId="+processInstance.getId()+"&openState=1&taskInstId="+processInstance.getStartTaskInstId()+"&displayToolbar=true";
@ -206,7 +208,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
public void ProcessData(ProcessInstance processInstance,TaskInstance taskInstance,Connection open,String sid) throws Exception {
// http://localhost:8089/portal/r/or?cmd=com.hy_client_bpm_form_main_page_open&oauthName=oauthLogin&processInstId=3505e654-9217-41cd-a31d-4971846b3219
/**
* 当流程不等于终止的时候往下走
*/
@ -215,11 +216,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String wsId = "";
JSONArray filed = new JSONArray(new LinkedList<>());
String portalUrl = SDK.getPortalAPI().getPortalUrl();
// System.out.println("portal======>>>>" + portalUrl);
/*
* if (portalUrl.equals("http://10.114.11.135:8088/portal")){ portalUrl =
* "http://bpm.yili.com:8088/portal/"; }
*/
try {
//构建PC地址
@ -241,10 +238,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
.addQuery("BINDID=", processInstance.getId())
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
// ProcessExecutionContext processExecutionContext,String fileCreateName,String
// fileName,String fileurl,String readingScope_org,String isFullCompany,String
// fileCreateDate,String relationProcessinstId,String readingScope_post,String
// readingScope_level,String fileid
String not_url = "/w?cmd=com.yili_process_page&processInstId="
+ processInstance.getId() + "&taskInstId="
+ taskInstance.getId();
@ -274,8 +267,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
jsonObject.put("dataid", processInstance.getId());
jsonObject.put("pcurl", url);
jsonObject.put("mobileurl", mobileurl);
// list.add(1,"00352394");
// list.add(2,"00352394");
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).connection(open)
.addQuery("BINDID=", processInstance.getId())
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
@ -318,7 +309,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
} catch (Exception e) {
// TODO: handle exception
}
//System.err.println("系统人员=====>" + userList1);
// 项目开发人员
ArrayList<String> userList2 = new ArrayList<String>();
try {
@ -327,7 +317,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
} catch (Exception e) {
// TODO: handle exception
}
//System.err.println("项目开发人员=====>" + userList2);
// 离退人员
ArrayList<String> userList3 = new ArrayList<String>();
try {
@ -336,12 +325,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
} 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);
@ -351,8 +337,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
// 发送组织岗位职级
sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject);
}
long countTime = System.currentTimeMillis();
System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size() + " 计算用时===>"
+ (countTime - sendUserstartTime) + "毫秒");
@ -401,7 +385,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
* 创建线程发送待阅数据
*/
course(list,startTime,jsonObject,processInstance,sendList,sid);
//System.out.println("发送人员数据>>>>>>>>>>>>>>"+list);
}else {
int size = users.length/length;
int flag = 0;
@ -420,16 +403,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
* 创建线程发送待阅数据
*/
course(list,startTime,jsonObject,processInstance,sendList,sid);
//System.out.println("发送人员数据>>>>>>>>>>>>>>"+list);
}
}
}
/**
* 更新数据看板底表
*/
@ -456,20 +432,20 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
*/
public boolean createIndexesByContent(ProcessInstance processInstance,JSONArray contents) {
// 调用App
// 调用App
String sourceAppId =processInstance.getAppId() ;
// aslp服务地址
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.addons.es/createIndexesByContent";
// 参数定义列表
// 参数定义列表
Map params = new HashMap<String, Object>();
//索引内容(JSONArray格式, JSONArray中包含JSONObject, JSONObject的内容同创建单个索引),必填
//索引内容(JSONArray格式, JSONArray中包含JSONObject, JSONObject的内容同创建单个索引),必填
params.put("contents", contents);
//索引名称(文档在哪存放),必填
//索引名称(文档在哪存放),必填
params.put("index", "com.actionsoft.apps.kms_kmsdoc_card");
//类型(索引中对数据进行逻辑分区不同 type的文档可能有不同的字段但最好能够非常相似,比如存储所有产品到索引products中但是你有许多不同的产品类别这些产品共享一种相同的或非常相似的模式他们有一个标题描述产品代码和价格他们只是正好属于产品下的一些子类用type表示不同的类别),必填
//类型(索引中对数据进行逻辑分区不同 type的文档可能有不同的字段但最好能够非常相似,比如存储所有产品到索引products中但是你有许多不同的产品类别这些产品共享一种相同的或非常相似的模式他们有一个标题描述产品代码和价格他们只是正好属于产品下的一些子类用type表示不同的类别),必填
params.put("type", "kmsdoc_card");
AppAPI appAPI = SDK.getAppAPI();
//入库操作创建内容索引(多个)
//入库操作创建内容索引(多个)
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
return ro.isOk();
@ -485,43 +461,25 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
public void course(List<String[]> list,long startTime,JSONObject jsonObject,ProcessInstance processInstance,ArrayList<String> sendList,String sid) throws InterruptedException {
// 创建线程来实现为每100人为一个的线程跑待阅
ProcessInstance instanceById = processInstance;
CountDownLatch countDownLatch = new CountDownLatch(list.size());
//CountDownLatch countDownLatch = new CountDownLatch(list.size());
//ExecutorService service = Executors.newFixedThreadPool(4);
int m = 0;
//200个循环
for (String[] resrt:list) {
/*int finalM = m;
service.execute(new Runnable() {
@Override
public void run() {
String userIds = "";
userIds = StringUtils.join(resrt, ",");
try {
SendOARead(processInstance, userIds,"批量推送");
countDownLatch.countDown();
} catch (DocumentException e) {
e.printStackTrace();
}
}
});
m++;*/
// 调用方
System.out.println("开始进入循环调用OA");
//每次循环
String sourceAppId = "com.actionsoft.apps.coe.pal.publisher";
// 服务地址
String aslp = "aslp://com.actionsoft.apps.coe.pal.publisher/SendOAReadAlsp";
Map<String, Object> params = new HashMap<String, Object>();
// 给定必填参数
params.put("processId", processInstance.getId());
String userIds = "";
userIds = StringUtils.join(resrt, ",");
params.put("processId", processInstance.getId());
params.put("userIds",userIds);
params.put("type","批量推送");
AppAPI appApi = SDK.getAppAPI();
//统一接口中心请求调用
appApi.asynCallASLP(appApi.getAppContext(sourceAppId), aslp, params);
}
System.out.println("执行结束");
/*countDownLatch.await();
if (countDownLatch.getCount()==0){
@ -592,16 +550,17 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
* 这个主要是负责对流程手册进行相关的文件的生成
*/
String sourceAppId =processInstance.getAppId();
// aslp服务地址
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.kms/CreateFile";
if (StringUtils.isNotEmpty(cardId)) {
String sql_ext4 = "select * from APP_ACT_COE_PAL_REPOSITORY where EXT4 = '" + cardId + "'";
RowMap map = DBSql.getMap(sql_ext4);
RowMap rowMap = DBSql
.getMap("SELECT * FROM " + bo_name + " where " + fileid + " '" + map.getString("ID") + "'");
// BO bos =
// SDK.getBOAPI().query(bo_name,true).addQuery(fileid,"17e7d198-1656-4a2c-8912-a81850170be9").detail();
if (rowMap != null) {
if (StringUtils.isNotEmpty(rowMap.getString("TASKID"))) {
@ -641,7 +600,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
DCContext dcContext = new DCContext(userContext, dcProfile, appProfile.getAppContext().getId(),
model.getWsId(), rowMap.getString("TASKID"), filename + "_" + lever + ".doc");
// UtilFile file = new UtilFile(dcContext.getPath());
Map params = new HashMap<String, Object>();
//知识ID,必填
@ -651,7 +609,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
params.put("dc", dcContext);
AppAPI appAPI = SDK.getAppAPI();
//创建文件
//创建文件
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
JSONArray coontest = new JSONArray(new LinkedList<>());
@ -745,17 +703,14 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
for (String id_names : deptSplit_id) {
jsonArray.add(id_names);
}
// jsonObject.put(deptSplit_id);
id += ",";
String[] deptSplit_das = id.split(",");
JSONArray jsonArray_das = new JSONArray();
for (String das : deptSplit_das) {
jsonArray_das.add(das);
}
// jsonObject.put(deptSplit_id);
if (!jsonArray_das.isEmpty() && !jsonArray.isEmpty()) {
// 调用App
String sourceAppId = processInstance.getAppId();
// aslp服务地址
@ -921,15 +876,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
public void SendOARead( ProcessInstance processInstance, String userIds,String type)
throws DocumentException {
String processInstId = processInstance.getId();
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
/*
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
*/
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
.addQuery("BINDID=", processInstance.getId())
@ -980,7 +927,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
+ "<![CDATA[" + jsonObjects + "]]>" + " </web:in0>" + " </web:service>"
+ " </soapenv:Body>" + "</soapenv:Envelope>";
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
UtilUrl uc=new UtilUrl();
String postSoap =uc.doPostSoap(readurl, xmlStr, "");
@ -1120,22 +1066,11 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String processInstId = processInstance.getId();
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
/*
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
*/
if (idList.size() == 0) {
return;
}
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
/*
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
*/
BO bo_act_coe_publish1 = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
.addQuery("BINDID=", processInstance.getId())
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
@ -1181,7 +1116,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
+ "<![CDATA[" + jsonObjects + "]]>" + " </web:in0>" + " </web:service>"
+ " </soapenv:Body>" + "</soapenv:Envelope>";
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
UtilUrl uc=new UtilUrl();
String postSoap = uc.doPostSoap(readurl, xmlStr, "");
@ -1490,11 +1424,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
}
}
// System.err.println(SDK.getProcessAPI().getInstanceById(processid) +
// "_得到的总人数为" + arr_test.size());
// System.err.println(SDK.getProcessAPI().getInstanceById(processid) +
// "_得到的过滤后的人数为" + arr.size());
return arr;
}
@ -1507,15 +1436,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String uid = userModel.getUID();
if (!arr.contains(uid)) {
if (!"10033643".equals(uid)) {
// System.err.println("发送人员======>" + uid); }
arr.add(uid);
}
/*
* RowMap map = DBSql.getMap("SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '"
* + processid + "' AND USER_ID = '" + uid + "'"); if (map == null) {
* //System.err.println("发送人员======>" + uid); }
*/
}
}
}
@ -1541,11 +1463,8 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
String uid = userModel.getUID();
if (!arr.contains(uid)) {
if (!"10033643".equals(uid)) {
// System.err.println("发送人员======>" + uid); }
arr.add(uid);
}
// System.err.println(SDK.getProcessAPI().getInstanceById(processid) +
// "_发送人员======>" + uid);
}
}
@ -1717,22 +1636,22 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
}
}
params_create.put("knwlName",plmodel.getName() + "V" + level);
//是否可以评论,必填
//是否可以评论,必填
params_create.put("isComment", true);
//是否可以评分,必填
//是否可以评分,必填
params_create.put("isRate", true);
//有效期:yyyy-MM-dd,非必填
//有效期:yyyy-MM-dd,非必填
params_create.put("validDate", "2099-12-31");
//只读控制1在线阅读和下载 0在线阅读,必填
//只读控制1在线阅读和下载 0在线阅读,必填
params_create.put("onlineLevel", 1);
//知识创建人某些特殊场景下sid和createUser代表的用户并不一样如果此参数为null则使用sid代表的用户,非必填
//知识创建人某些特殊场景下sid和createUser代表的用户并不一样如果此参数为null则使用sid代表的用户,非必填
params_create.put("createUser", "admin");
//知识内容,非必填
//知识内容,非必填
params_create.put("cardContext", "");
//sid,必填
//sid,必填
params_create.put("sid", sid);
AppAPI appAPI_create = SDK.getAppAPI();
//创建知识
//创建知识
ResponseObject ro_create = appAPI_create.callASLP(
appAPI_create.getAppContext(processInstance.getAppId()),
aslps_create, params_create);
@ -1778,7 +1697,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
AddKnwlAC(processInstance, jsonArray1, sid,
cardId);
String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '" + cardId + "' WHERE "
PALRepository palRepository=new PALRepository();
int count=palRepository.updateRepositoryExtAll(publishfileid,"","","",cardId,"","");
/* String update_sql = "UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4='" + cardId + "' WHERE "
+ " PLCATEGORY = 'process'and PLMETHODID !='process.framework' "
+ " and PLNAME not in ('流程架构图','测试用','GMY-截图用','sx批量测试'"
+ " ,'8.2培训使用','用户练习使用','YX测试分部','yx测试人员','yx测试部','流程架构测试')"
@ -1787,12 +1709,12 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
+ " '36ac7cdd-a361-4bd3-9511-c03c1b3627a4','84e534b4-e51a-4874-9ff1-8a0206d9e0c5',"
+ " '98bd5917-7563-4b29-b775-815e91d9864c','f07da63c-3423-4c1e-ae75-b323c6a69093',"
+ " '79cb4c35-d2f7-4c43-a7db-44038b557eac','7ad79a73-a497-417a-a5ec-d4c9fd45061c',"
+ " '42c09260-c1d3-44b7-ac3d-f8280e04c294') and ID = '" + publishfileid + "'";
int update = DBSql.update(update_sql);
+ " '42c09260-c1d3-44b7-ac3d-f8280e04c294') and ID='" + publishfileid + "'";
int update = DBSql.update(update_sql);*/
System.out.println("更新id为" + publishfileid + "版本为的知识对应的资产库的EXT4的影响行数为" + update);
System.out.println("更新id为" + publishfileid + "版本为的知识对应的资产库的EXT4的影响行数为" + count);
creadteFile(processInstance, "BO_ACT_COE_PUBLISH_N",UserContext.fromSessionId(sid),
cardId, "PUBLISHFILEID = ");
cardId, "PUBLISHFILEID=");
}
}
}
@ -2281,7 +2203,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute
xmlDatasUtil.setMobileurl(portalUrl+"/r/or?cmd=com.yili_form_page_open&amp;corpid=wwb0ae23173b140618&amp;appAgentId=1000014&amp;oauthName=wechat&amp;casaccount="+taskInstance.getTarget()+"&amp;processInstId="+processInstance.getId()+"&amp;taskInstId="+taskInstance.getId()+"&amp;openState="+taskInstance.getState());
String target = taskInstance.getTarget();
//System.out.println("当前账户======》》》》"+target);
BO bo_eu_oa_reson = SDK.getBOAPI().query("BO_EU_OA_RESON", true).addQuery("WORKCODE=" , target).detail();
//System.out.println("bo>>>>>>>>>>"+bo_eu_oa_reson);
if (bo_eu_oa_reson!=null){