1.生成编号时排序生成
2.推送oa待阅改为每次推送300条
This commit is contained in:
parent
b093205609
commit
bba471fc4e
@ -120,9 +120,9 @@ public class ProcesNumberUtil {
|
||||
System.out.println("生成编号并写入数据库===============");
|
||||
|
||||
// 查询出所有的发布流程
|
||||
List<BO> dataList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindId).list();
|
||||
List<BO> dataList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindId).orderByCreated().asc().list();
|
||||
// 查询出所有的变更流程
|
||||
List<BO> changList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindId).list();
|
||||
List<BO> changList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindId).orderByCreated().asc().list();
|
||||
if (changList.size() != 0) {
|
||||
for (BO changData : changList) {
|
||||
String change_numner = changData.getString("CHANGE_NUMBER");
|
||||
|
||||
@ -64,34 +64,35 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
private String isSendEHSQ = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "isSendEHSQ");
|
||||
private String isSendOA = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "isSendOA");
|
||||
private String isSendKMS = SDK.getAppAPI().getProperty("com.actionsoft.apps.coe.pal.publisher", "isSendKMS");
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "确认发布节点任务完成后推送OA/EHSQ/KMS";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "确认发布节点任务完成后推送OA/EHSQ/KMS";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ProcessExecutionContext ext) throws Exception {
|
||||
ExecutorService service = Executors.newFixedThreadPool(1);
|
||||
service.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ProcessData(ext);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
service.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ProcessData(ext);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void ProcessData(ProcessExecutionContext processExecutionContext) throws Exception {
|
||||
System.err.println(processExecutionContext.getTaskInstance().getTitle()+"_推送文件开始========>");
|
||||
System.err.println(processExecutionContext.getTaskInstance().getTitle() + "_推送文件开始========>");
|
||||
Connection open = DBSql.open();
|
||||
// http://localhost:8089/portal/r/or?cmd=com.hy_client_bpm_form_main_page_open&oauthName=oauthLogin&processInstId=3505e654-9217-41cd-a31d-4971846b3219
|
||||
/**
|
||||
@ -102,7 +103,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String wsId = "";
|
||||
JSONArray filed = new JSONArray(new LinkedList<>());
|
||||
String portalUrl = SDK.getPortalAPI().getPortalUrl();
|
||||
System.out.println("portal======>>>>" + portalUrl);
|
||||
//System.out.println("portal======>>>>" + portalUrl);
|
||||
/*
|
||||
* if (portalUrl.equals("http://10.114.11.135:8088/portal")){ portalUrl =
|
||||
* "http://bpm.yili.com:8088/portal/"; }
|
||||
@ -176,7 +177,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
/**
|
||||
* 推送到知识库
|
||||
*/
|
||||
if("true".equals(isSendKMS)) {
|
||||
if ("true".equals(isSendKMS)) {
|
||||
try {
|
||||
// 发布到知识库
|
||||
int m = 0;
|
||||
@ -185,29 +186,32 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
}
|
||||
// 更新知识库
|
||||
for (BO bo : bo_act_coe_publish_c) {
|
||||
CreateKmsByupdate(bo, wsId, filed, processExecutionContext, bo_act_coe_publish, crateUserId);
|
||||
CreateKmsByupdate(bo, wsId, filed, processExecutionContext, bo_act_coe_publish,
|
||||
crateUserId);
|
||||
}
|
||||
|
||||
|
||||
// 废止知识库文件
|
||||
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 + "'";
|
||||
String sql_s = "select * from APP_ACT_COE_PAL_REPOSITORY where id = '" + publishfileid_stop
|
||||
+ "'";
|
||||
RowMap map1 = DBSql.getMap(sql_s);
|
||||
if (StringUtils.isNotEmpty(map1.getString("EXT4"))) {
|
||||
CancelPublishKnwl(processExecutionContext,
|
||||
processExecutionContext.getUserContext().getSessionId(), map1.getString("EXT4"));
|
||||
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '" + publishfileid_stop
|
||||
+ "'");
|
||||
processExecutionContext.getUserContext().getSessionId(),
|
||||
map1.getString("EXT4"));
|
||||
|
||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT4 = '' WHERE ID = '"
|
||||
+ publishfileid_stop + "'");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新数据看板底表
|
||||
*/
|
||||
@ -216,58 +220,76 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送待阅文件到OA
|
||||
*/
|
||||
if("true".equals(isSendOA)) {
|
||||
if ("true".equals(isSendOA)) {
|
||||
ProcessInstance instanceById = processExecutionContext.getProcessInstance();
|
||||
if (bo_act_coe_publish1 != null && instanceById != null) {
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行开始====>");
|
||||
long startTime = System.currentTimeMillis();
|
||||
ArrayList<String> sendList = getSendList(instanceById, bo_act_coe_publish1, jsonObject);
|
||||
System.err.println(instanceById.getTitle() + "待发送人员数量====>" + sendList.size());
|
||||
for (String uid : sendList) {
|
||||
try {
|
||||
SendOARead(jsonObject, instanceById, uid);
|
||||
/*
|
||||
* ExecutorService service = Executors.newFixedThreadPool(5);
|
||||
* service.execute(new Runnable() {
|
||||
*
|
||||
* @Override public void run() { try { } catch (Exception e) { // TODO
|
||||
* Auto-generated catch block e.printStackTrace(); } } });
|
||||
*/
|
||||
|
||||
} catch (Exception e) {
|
||||
int toIndex = 300;
|
||||
int listSize = sendList.size();
|
||||
boolean shutdown = false;
|
||||
for (int i = 0; i < sendList.size(); i += 300) {
|
||||
if (i + 300 > listSize) {
|
||||
toIndex = listSize - i;
|
||||
}
|
||||
List<String> idList = sendList.subList(i, i + toIndex);
|
||||
SendOARead(jsonObject, instanceById, idList);
|
||||
/*
|
||||
* ExecutorService service = Executors.newFixedThreadPool(3);
|
||||
* service.execute(new Runnable() {
|
||||
*
|
||||
* @Override public void run() { try { } catch (Exception e) { // TODO
|
||||
* Auto-generated catch block e.printStackTrace(); } } });
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* for (String uid : sendList) { try { SendOARead(jsonObject, instanceById,
|
||||
* uid);
|
||||
*
|
||||
* ExecutorService service = Executors.newFixedThreadPool(5);
|
||||
* service.execute(new Runnable() {
|
||||
*
|
||||
* @Override public void run() { try { } catch (Exception e) { // TODO
|
||||
* Auto-generated catch block e.printStackTrace(); } } });
|
||||
*
|
||||
*
|
||||
* } catch (Exception e) { } }
|
||||
*/
|
||||
long endTimes = System.currentTimeMillis();
|
||||
//存入日志
|
||||
createReadLog(processExecutionContext, jsonObject, sendList, startTime,endTimes);
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:"+(endTimes-startTime)/1000/60+"分钟");
|
||||
// 存入日志
|
||||
createReadLog(processExecutionContext, jsonObject, sendList, startTime, endTimes);
|
||||
System.err.println(instanceById.getTitle() + "推送OA待阅执行完毕====>" + "用时:"
|
||||
+ (endTimes - startTime) / 1000 / 60 + "分钟");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 推送到EHSQ
|
||||
*/
|
||||
if("true".equals(isSendEHSQ)) {
|
||||
if ("true".equals(isSendEHSQ)) {
|
||||
try {
|
||||
//推送EHSQ
|
||||
// 推送EHSQ
|
||||
sendEHSQ(processExecutionContext, bo_act_coe_publish_n);
|
||||
//更新EHSQ
|
||||
// 更新EHSQ
|
||||
updateEHSQ(processExecutionContext, bo_act_coe_publish_c);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
|
||||
|
||||
open.close();
|
||||
}
|
||||
}
|
||||
@ -307,7 +329,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(rowMap.getString("TASKID"));
|
||||
if (model != null) {
|
||||
//System.out.println(",pdel============" + model);
|
||||
// System.out.println(",pdel============" + model);
|
||||
OutputAppProfile appProfile = OutputAppManager.getProfile(model.getProfileId());
|
||||
if (appProfile == null) {
|
||||
throw new AWSException("Not Find OutputAppProfile! profileId=" + model.getProfileId());
|
||||
@ -450,16 +472,16 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/PublishKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//要发布到的维度ID的JSON数组字符串,必填
|
||||
// 要发布到的维度ID的JSON数组字符串,必填
|
||||
params.put("dimensionIDArray", jsonArray.toString());
|
||||
//要发布的知识ID的JSON数组字符串,必填
|
||||
// 要发布的知识ID的JSON数组字符串,必填
|
||||
params.put("knwlIDArray", jsonArray_das.toString());
|
||||
//标签的JSON数组字符串,非必填
|
||||
// 标签的JSON数组字符串,非必填
|
||||
|
||||
//sid,必填
|
||||
// sid,必填
|
||||
params.put("sid", userContext.getSessionId());
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//发布知识
|
||||
// 发布知识
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
|
||||
System.out.println("知识发布============" + ro);
|
||||
@ -483,12 +505,12 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/CancelPublishKnwl";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//sid,如果为空,则需要传createUser参数,非必填
|
||||
// sid,如果为空,则需要传createUser参数,非必填
|
||||
params.put("sid", sid);
|
||||
//知识ID,必填
|
||||
// 知识ID,必填
|
||||
params.put("knwlId", knwlId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//取消发布知识(全部维度)
|
||||
// 取消发布知识(全部维度)
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("取消发布的ro=====>>>>" + ro);
|
||||
return ro.isOk();
|
||||
@ -510,7 +532,8 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
* @param fileid
|
||||
* @return
|
||||
*/
|
||||
public boolean execute(ProcessExecutionContext processExecutionContext, String fileCreateName, String fileName,String fileurl, String readingScope_org, String isFullCompany, String fileCreateDate,
|
||||
public boolean execute(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) {
|
||||
// 调用App
|
||||
String sourceAppId = processExecutionContext.getProcessInstance().getAppId();
|
||||
@ -518,28 +541,28 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String aslp = "aslp://com.awspaas.user.apps.docview/PushFileToXpage";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//发布人,不允许空值,必填
|
||||
// 发布人,不允许空值,必填
|
||||
params.put("fileCreateName", fileCreateName);
|
||||
//待阅文件标题名称,不允许空值,必填
|
||||
// 待阅文件标题名称,不允许空值,必填
|
||||
params.put("fileName", fileName);
|
||||
//阅读范围_组织,不允许空值,非必填
|
||||
// 阅读范围_组织,不允许空值,非必填
|
||||
params.put("readingScope_org", readingScope_org);
|
||||
//是否全公司可见,不允许空值,必填
|
||||
// 是否全公司可见,不允许空值,必填
|
||||
params.put("isFullCompany", isFullCompany);
|
||||
//待阅文件Url,不允许空值,必填
|
||||
// 待阅文件Url,不允许空值,必填
|
||||
params.put("fileurl", fileurl);
|
||||
//发布日期,不允许空值,必填
|
||||
// 发布日期,不允许空值,必填
|
||||
params.put("fileCreateDate", fileCreateDate);
|
||||
//发布流程ID,不允许空值,必填
|
||||
// 发布流程ID,不允许空值,必填
|
||||
params.put("relationProcessinstId", relationProcessinstId);
|
||||
//阅读范围_岗位,不允许空值,非必填
|
||||
// 阅读范围_岗位,不允许空值,非必填
|
||||
params.put("readingScope_post", readingScope_post);
|
||||
//阅读范围_职级,不允许空值,非必填
|
||||
// 阅读范围_职级,不允许空值,非必填
|
||||
params.put("readingScope_level", readingScope_level);
|
||||
//待阅文件ID,多个逗号隔开,不允许空值,必填
|
||||
// 待阅文件ID,多个逗号隔开,不允许空值,必填
|
||||
params.put("fileid", fileid);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//推送待阅文件到xpage门户
|
||||
// 推送待阅文件到xpage门户
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("ros++++++++=====待阅》》》》》》》》》》" + ro);
|
||||
return ro.isOk();
|
||||
@ -554,22 +577,23 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
* @param knwlId
|
||||
* @return
|
||||
*/
|
||||
public boolean AddKnwlAC(ProcessExecutionContext processExecutionContext, JSONArray jsonArray, String sid,String knwlId) {
|
||||
|
||||
public boolean AddKnwlAC(ProcessExecutionContext processExecutionContext, JSONArray jsonArray, String sid,
|
||||
String knwlId) {
|
||||
|
||||
// 调用App
|
||||
String sourceAppId = processExecutionContext.getProcessInstance().getAppId();
|
||||
// aslp服务地址
|
||||
String aslp = "aslp://com.actionsoft.apps.kms/AddKnwlAC";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//[{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填
|
||||
// [{"assignmentType":"department","assignmentId":"62196ff9-a26d-4be5-9480-3ef680886f63"},{"assignmentType":"user","assignmentId":"user1"}],必填
|
||||
params.put("acList", jsonArray);
|
||||
//sid,如果为空,则需要传createUser参数,非必填
|
||||
// sid,如果为空,则需要传createUser参数,非必填
|
||||
params.put("sid", sid);
|
||||
//知识ID,必填
|
||||
// 知识ID,必填
|
||||
params.put("knwlId", knwlId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//给知识授权
|
||||
// 给知识授权
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
return ro.isOk();
|
||||
}
|
||||
@ -590,12 +614,12 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String aslp = "aslp://com.awspaas.user.apps.yili.reportform/AttrSynAslp";
|
||||
// 参数定义列表
|
||||
Map params = new HashMap<String, Object>();
|
||||
//资产内容库id,必填
|
||||
// 资产内容库id,必填
|
||||
params.put("wsId", wsId);
|
||||
//文件id;json数组[id1,id2,id3],必填
|
||||
// 文件id;json数组[id1,id2,id3],必填
|
||||
params.put("fileId", fileId);
|
||||
AppAPI appAPI = SDK.getAppAPI();
|
||||
//增量同步数据
|
||||
// 增量同步数据
|
||||
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
|
||||
System.out.println("同步数据看板底表结果>>>>>>>>>>>>>" + ro);
|
||||
return ro.isOk();
|
||||
@ -609,44 +633,50 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
* @param results
|
||||
* @throws DocumentException
|
||||
*/
|
||||
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, String userId)
|
||||
public void SendOARead(JSONObject jsonObject, ProcessInstance processInstance, List<String> idList)
|
||||
throws DocumentException {
|
||||
//System.err.println(processInstance.getTitle() + "开始发送:" + userId);
|
||||
if ("".equals(userId) || UtilString.isEmpty(userId)) {
|
||||
// System.err.println(processInstance.getTitle() + "开始发送:" + userId);
|
||||
|
||||
/*
|
||||
* if ("".equals(userId) || UtilString.isEmpty(userId)) { return; }
|
||||
*/
|
||||
if (idList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
jsonObject.put("userList", userId);
|
||||
String userIds = StringUtils.join(idList, ",");
|
||||
jsonObject.put("userList", userIds);
|
||||
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.yili.weaver.com.cn\">\n"
|
||||
+ " <soapenv:Header/>" + " <soapenv:Body>" + " <web:service>" + " <web:in0>"
|
||||
+ "<![CDATA[" + jsonObject + "]]>" + " </web:in0>" + " </web:service>"
|
||||
+ " </soapenv:Body>" + "</soapenv:Envelope>";
|
||||
//System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
// System.out.println("xmlStr>>>>>>>>" + xmlStr);
|
||||
String readurl = SDK.getAppAPI().getProperty("com.awspaas.user.apps.yili.integration", "readurl");
|
||||
|
||||
String postSoap = UtilUrl.doPostSoap(readurl, xmlStr, "");
|
||||
Document document = DocumentHelper.parseText(postSoap);
|
||||
Element rootElement = document.getRootElement();
|
||||
//System.out.println("rootElement>>>>>>" + rootElement);
|
||||
// System.out.println("rootElement>>>>>>" + rootElement);
|
||||
Element result = rootElement.element("Body").element("serviceResponse").element("out");
|
||||
String resultString = result.getData().toString();
|
||||
JSONObject jsonObject1 = JSON.parseObject(resultString);
|
||||
String datas = jsonObject1.getString("data");
|
||||
String status = jsonObject1.getString("status");
|
||||
//System.out.println("推送》》》》》》》》》》》" + status);
|
||||
// System.out.println("推送》》》》》》》》》》》" + status);
|
||||
if ("false".equals(status)) {
|
||||
System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId);
|
||||
try {
|
||||
BO bo = new BO();
|
||||
bo.set("TITLE", processInstance.getTitle());
|
||||
bo.set("NAME", userId);
|
||||
bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId());
|
||||
SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
for (String userId : idList) {
|
||||
System.out.println(processInstance.getTitle() + "待阅推送失败:" + userId);
|
||||
try {
|
||||
BO bo = new BO();
|
||||
bo.set("TITLE", processInstance.getTitle());
|
||||
bo.set("NAME", userId);
|
||||
bo.set("DEPNAME", SDK.getORGAPI().getUser(userId).getDepartmentId());
|
||||
SDK.getBOAPI().create("BO_EU_READ_COUNT", bo, processInstance.getId(), processInstance.getCreateUser());
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//System.out.println(processInstance.getTitle() + "待阅推送成功:" + userId);
|
||||
JSONArray resultArray = JSONObject.parseArray(datas);
|
||||
System.out.println(processInstance.getTitle() + "待阅推送成功:" + idList);
|
||||
for (int j = 0; j < resultArray.size(); j++) {
|
||||
JSONObject jsonObject2 = resultArray.getJSONObject(j);
|
||||
String user = jsonObject2.get("user").toString();
|
||||
@ -745,19 +775,18 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
// 如果只有组织不为空
|
||||
if (UtilString.isNotEmpty(org) && UtilString.isEmpty(post) && UtilString.isEmpty(level)) {
|
||||
System.err.println("发送组织=====>" + instanceById.getTitle());
|
||||
userList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject,sendType);
|
||||
userList = sendOrg(org, userList, instanceById, bo_act_coe_publish1, jsonObject, sendType);
|
||||
}
|
||||
// 如果只有岗位不为空
|
||||
if (UtilString.isEmpty(org) && UtilString.isNotEmpty(post) && UtilString.isEmpty(level)) {
|
||||
System.err.println("发送岗位=====>" + instanceById.getTitle());
|
||||
userList = sendPost(post, userList, instanceById, bo_act_coe_publish1,jsonObject);
|
||||
userList = sendPost(post, userList, instanceById, bo_act_coe_publish1, jsonObject);
|
||||
}
|
||||
// 如果只有职级不为空
|
||||
if (UtilString.isEmpty(org) && UtilString.isEmpty(post) && UtilString.isNotEmpty(level)) {
|
||||
System.err.println("发送职级=====>" + instanceById.getTitle());
|
||||
userList = sendLevel2(level, userList, instanceById, bo_act_coe_publish1, jsonObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -838,7 +867,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
|
||||
return userList_level;
|
||||
}
|
||||
|
||||
|
||||
// 只发送职级
|
||||
public ArrayList<String> sendLevel2(String level, ArrayList<String> userList, ProcessInstance instanceById,
|
||||
BO bo_act_coe_publish1, JSONObject jsonObject) {
|
||||
@ -882,7 +911,9 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
for (DepartmentModel departmentModel : departmentsByCompanyId) {
|
||||
String id = departmentModel.getId();
|
||||
// 查询未注销的部门并且去掉系统部门
|
||||
if (!departmentModel.isClosed() && !"5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe".equals(id)&&!"e79281b1-2f81-4895-b30e-9f96e9ad0e2c".equals(id)&&!"65048aee-157f-49f2-a2dc-5903dd26f519".equals(id)) {
|
||||
if (!departmentModel.isClosed() && !"5bc3a2dc-3bd2-4376-bcc3-5612e28e55fe".equals(id)
|
||||
&& !"e79281b1-2f81-4895-b30e-9f96e9ad0e2c".equals(id)
|
||||
&& !"65048aee-157f-49f2-a2dc-5903dd26f519".equals(id)) {
|
||||
getUserList(jsonObject, arr_test, arr, id, processid);
|
||||
|
||||
}
|
||||
@ -911,8 +942,10 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
if (!userModel.isClosed()) {
|
||||
String uid = userModel.getUID();
|
||||
if (!arr.contains(uid)) {
|
||||
arr_test.add(uid);
|
||||
arr.add(userModel.getUID());
|
||||
if(!"10033643".equals(uid)) {
|
||||
//arr_test.add(uid);
|
||||
arr.add(uid);
|
||||
}
|
||||
/*
|
||||
* RowMap map = DBSql.getMap("SELECT ID FROM BO_ACT_DATAID WHERE PROCESSID = '"
|
||||
* + processid + "' AND USER_ID = '" + uid + "'"); if (map == null) {
|
||||
@ -942,23 +975,27 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
if (!userModel.isClosed()) {
|
||||
String uid = userModel.getUID();
|
||||
if (!arr.contains(uid)) {
|
||||
arr_test.add(uid);
|
||||
arr.add(uid);
|
||||
//System.err.println(SDK.getProcessAPI().getInstanceById(processid) + "_发送人员======>" + uid);
|
||||
|
||||
if (!"10033643".equals(uid)) {
|
||||
// arr_test.add(uid);
|
||||
arr.add(uid);
|
||||
}
|
||||
|
||||
// System.err.println(SDK.getProcessAPI().getInstanceById(processid) +
|
||||
// "_发送人员======>" + uid);
|
||||
|
||||
}
|
||||
}
|
||||
// 递归获取子部门下的子部门
|
||||
if (SDK.getORGAPI().isExistSubDepartment(id)) {
|
||||
getSubDepartments(jsonObject, arr_test, arr, SDK.getORGAPI().getDepartmentById(id), processid);
|
||||
}
|
||||
|
||||
}
|
||||
// 递归获取子部门下的子部门
|
||||
if (SDK.getORGAPI().isExistSubDepartment(id)) {
|
||||
getSubDepartments(jsonObject, arr_test, arr, SDK.getORGAPI().getDepartmentById(id), processid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建线程发送待阅
|
||||
*
|
||||
@ -997,8 +1034,8 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
* @param startTime
|
||||
*/
|
||||
|
||||
public void createReadLog(ProcessExecutionContext processExecutionContext, JSONObject jsonObject, ArrayList<String> arr,
|
||||
long startTime,long endTimes) {
|
||||
public void createReadLog(ProcessExecutionContext processExecutionContext, JSONObject jsonObject,
|
||||
ArrayList<String> arr, long startTime, long endTimes) {
|
||||
BO bo_Read_log = new BO();
|
||||
String processInstId = processExecutionContext.getProcessInstance().getId();
|
||||
bo_Read_log.set("USREID", processExecutionContext.getUserContext().getUID());
|
||||
@ -1007,11 +1044,10 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
bo_Read_log.set("TITLE", jsonObject.get("title"));
|
||||
bo_Read_log.set("PROCESSID", processInstId);
|
||||
bo_Read_log.set("SENDNUM", arr.size());
|
||||
String sqly ="SELECT * FROM BO_ACT_DATAID WHERE PROCESSID = '"+processInstId+"' AND SENDTYPE = '1'";
|
||||
String sqly = "SELECT * FROM BO_ACT_DATAID WHERE PROCESSID = '" + processInstId + "' AND SENDTYPE = '1'";
|
||||
List<RowMap> mapsy = DBSql.getMaps(sqly);
|
||||
bo_Read_log.set("SENDNUMSJ", mapsy.size());
|
||||
BO bo_act_coe_publishs = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true)
|
||||
.addQuery("BINDID=", processInstId)
|
||||
BO bo_act_coe_publishs = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId)
|
||||
.addQuery("OPTIONTYPE IS NOT NULL", null).detail();
|
||||
String send_scop = bo_act_coe_publishs.getString("SEND_SCOP");
|
||||
bo_Read_log.set("SEND_SCOP", send_scop);
|
||||
@ -1033,10 +1069,11 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
|
||||
bo_Read_log.set("STARTTIMES", startTime);
|
||||
bo_Read_log.set("ENDTIMES", endTimes);
|
||||
bo_Read_log.set("TIMECOUNT", (endTimes-startTime)/1000/60+"分钟");
|
||||
//文件发布成功回执流程
|
||||
ProcessInstance processInst = SDK.getProcessAPI().createProcessInstance("obj_b4700f89a7a144c086d047de0cfe9531", "admin", jsonObject.get("title")+"成功发布回执单");
|
||||
SDK.getBOAPI().create("BO_EU_PAL_PULBISH_SUCCESS", bo_Read_log, processInst,UserContext.fromUID("admin"));
|
||||
bo_Read_log.set("TIMECOUNT", (endTimes - startTime) / 1000 / 60 + "分钟");
|
||||
// 文件发布成功回执流程
|
||||
ProcessInstance processInst = SDK.getProcessAPI().createProcessInstance("obj_b4700f89a7a144c086d047de0cfe9531",
|
||||
"admin", jsonObject.get("title") + "成功发布回执单");
|
||||
SDK.getBOAPI().create("BO_EU_PAL_PULBISH_SUCCESS", bo_Read_log, processInst, UserContext.fromUID("admin"));
|
||||
TaskInstance taskInst = SDK.getProcessAPI().start(processInst).fetchActiveTasks().get(0);
|
||||
SDK.getTaskAPI().completeTask(taskInst.getId(), "admin");
|
||||
|
||||
@ -1223,7 +1260,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
ResponseObject ro_create = appAPI_create.callASLP(
|
||||
appAPI_create.getAppContext(processExecutionContext.getProcessInstance().getAppId()),
|
||||
aslps_create, params_create);
|
||||
System.out.println("ro_create================" + ro_create);
|
||||
//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")) {
|
||||
@ -1308,8 +1345,8 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
bo.set("BUNAME", UserContext.fromUID(uids).getUserModel().getExt2());
|
||||
SDK.getBOAPI().createDataBO("BO_EU_PAL_SEND_LOG", bo, UserContext.fromUID("admin"));
|
||||
}
|
||||
|
||||
public void sendEHSQ(ProcessExecutionContext processExecutionContext,List<BO> bo_act_coe_publish_n) {
|
||||
|
||||
public void sendEHSQ(ProcessExecutionContext processExecutionContext, List<BO> bo_act_coe_publish_n) {
|
||||
for (BO bo : bo_act_coe_publish_n) {
|
||||
DownloadUtil downloadUtil = new DownloadUtil();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
@ -1334,14 +1371,12 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
jsonObject_ehsq.put("authorname",
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getUserName());
|
||||
// jsonObject_ehsq.put("authorname","毛鹏程");
|
||||
jsonObject_ehsq.put("companycode",
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget())
|
||||
.getDepartmentModel().getNo());
|
||||
jsonObject_ehsq.put("companycode", UserContext
|
||||
.fromUID(processExecutionContext.getTaskInstance().getTarget()).getDepartmentModel().getNo());
|
||||
// jsonObject_ehsq.put("companycode","00000013");
|
||||
jsonObject_ehsq.put("authorcompany",
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget())
|
||||
.getDepartmentModel().getName()); // jsonObject_ehsq.put("authorcompany","总部质量管理部");
|
||||
// //
|
||||
jsonObject_ehsq.put("authorcompany", UserContext
|
||||
.fromUID(processExecutionContext.getTaskInstance().getTarget()).getDepartmentModel().getName()); // jsonObject_ehsq.put("authorcompany","总部质量管理部");
|
||||
// //
|
||||
jsonObject_ehsq.put("releasescope", "总部质量管理部");
|
||||
BO bo1 = SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE", true)
|
||||
.addQuery("PALNAME=", bo.getString("PUBLISHFILENAME")).detail();
|
||||
@ -1374,8 +1409,7 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
LoginConst.DEVICE_PC);
|
||||
|
||||
System.out.println("办理者的sessionid>>>>>>>>>>>" + sessionId);
|
||||
String downurl = downloadUtil.getzipURL(sessionId, bo.getString("TASKID"),
|
||||
bo.getString("PUBLISHFILENAME"));
|
||||
String downurl = downloadUtil.getzipURL(sessionId, bo.getString("TASKID"), bo.getString("PUBLISHFILENAME"));
|
||||
// jsonObject_ehsq.put("downloadurl","http://bpm.yili.com:8088/portal/r"+downurl.toString().substring(1));
|
||||
String recordfiles = "";
|
||||
String recordurls = "";
|
||||
@ -1418,8 +1452,8 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateEHSQ(ProcessExecutionContext processExecutionContext,List<BO> bo_act_coe_publish_c) {
|
||||
|
||||
public void updateEHSQ(ProcessExecutionContext processExecutionContext, List<BO> bo_act_coe_publish_c) {
|
||||
DownloadUtil downloadUtil = new DownloadUtil();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
for (BO bo : bo_act_coe_publish_c) {
|
||||
@ -1429,8 +1463,8 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
String wsId = model.getWsId();
|
||||
String publishfileid = bo.getString("CHANGEDFILEIDNEW");
|
||||
LinkedHashMap<String, String> downloadurl = downloadUtil.outputReportDownload(
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()),
|
||||
bo.getString("TASKID"), publishfileid);
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()), bo.getString("TASKID"),
|
||||
publishfileid);
|
||||
jsonObject_ehsq.put("fileid", bo.getString("TASKID"));
|
||||
jsonObject_ehsq.put("filename", bo.getString("CHANGEDFILENAMENEW"));
|
||||
// jsonObject_ehsq.put("filecode",bo.getString("CHANGE_NUMBER"));
|
||||
@ -1443,12 +1477,10 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
jsonObject_ehsq.put("authorcode", processExecutionContext.getTaskInstance().getTarget());
|
||||
jsonObject_ehsq.put("authorname",
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget()).getUserName());
|
||||
jsonObject_ehsq.put("companycode",
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget())
|
||||
.getDepartmentModel().getNo());
|
||||
jsonObject_ehsq.put("authorcompany",
|
||||
UserContext.fromUID(processExecutionContext.getTaskInstance().getTarget())
|
||||
.getDepartmentModel().getName());
|
||||
jsonObject_ehsq.put("companycode", UserContext
|
||||
.fromUID(processExecutionContext.getTaskInstance().getTarget()).getDepartmentModel().getNo());
|
||||
jsonObject_ehsq.put("authorcompany", UserContext
|
||||
.fromUID(processExecutionContext.getTaskInstance().getTarget()).getDepartmentModel().getName());
|
||||
BO bo1 = SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE", true)
|
||||
.addQuery("PALNAME=", bo.getString("PUBLISHFILENAME")).detail();
|
||||
if (bo1 != null) {
|
||||
@ -1523,5 +1555,4 @@ public class ProcessEndAfterEvent extends ExecuteListener implements ExecuteList
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user