流程发布获取流程经理调整,生成编号调整

This commit is contained in:
lihongyu 2022-10-27 02:30:10 +08:00
parent f63f607023
commit 21606d6a1d
5 changed files with 165 additions and 22 deletions

View File

@ -35,7 +35,7 @@ public class ProcesNumberUtil {
String sql = "insert into BO_ACT_PROCESSNUMBER (ID,LEVELNUM,REGIONCODE,PROCESS_NUMBERS,SYSTEM_NUMBERS,FORM_NUMBERS) values ('%s', '%s', '%s', %s, %s, %s)";
String id = UUIDGener.getUUID();
int update = DBSql.update(String.format(sql, id, levelCode, regionCode, nowNum + 1, 1, 1));
return "01";
return "001";
}
nowNum = result.getInt("PROCESS_NUMBERS");
String updateSql = "update BO_ACT_PROCESSNUMBER set PROCESS_NUMBERS=%s where ID='%s'";
@ -55,7 +55,7 @@ public class ProcesNumberUtil {
String sql = "insert into BO_ACT_PROCESSNUMBER (ID,LEVELNUM,REGIONCODE,PROCESS_NUMBERS,SYSTEM_NUMBERS,FORM_NUMBERS) values ('%s', '%s', '%s', %s, %s, %s)";
String id = UUIDGener.getUUID();
DBSql.update(String.format(sql, id, levelCode, regionCode, 1, 1, 1));
return "01";
return "001";
}
nowNum = result.getInt("SYSTEM_NUMBERS");
String updateSql = "update BO_ACT_PROCESSNUMBER set SYSTEM_NUMBERS=%s where ID='%s'";
@ -75,7 +75,7 @@ public class ProcesNumberUtil {
String sql = "insert into BO_ACT_PROCESSNUMBER (ID,LEVELNUM,REGIONCODE,PROCESS_NUMBERS,SYSTEM_NUMBERS,FORM_NUMBERS) values ('%s', '%s', '%s', %s, %s, %s)";
String id = UUIDGener.getUUID();
DBSql.update(String.format(sql, id, levelCode, regionCode, 1, 1, 1));
return "01";
return "001";
}
nowNum = result.getInt("FORM_NUMBERS");
String updateSql = "update BO_ACT_PROCESSNUMBER set FORM_NUMBERS=%s where ID='%s'";

View File

@ -10,6 +10,8 @@ import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.sdk.local.SDK;
@ -27,6 +29,12 @@ public class ApplyTasAfterkComplete extends ExecuteListener implements ExecuteLi
System.err.println("---------生成编号------------");
String processInstId = ctx.getProcessInstance().getId();
//by bzp 文件编号生成
/*
* String sql =
* "SELECT * FROM BO_ACT_COE_PUBLISH_N WHERE BINDID = '"+processInstId+"'";
* List<RowMap> maps = DBSql.getMaps(sql); for (RowMap rowMap : maps) { String
* number = rowMap.getString("PUBLISH_NUMBER"); }
*/
new ProcesNumberUtil().getNumber(processInstId);
SDK.getLogAPI().consoleInfo("[任务事件]任务结束,涉及流程状态变为审批中-->" + ctx.getTaskInstance().getTitle());
ProcessStatusAPIManager.getInstance().batchUpdateApprovalStatus(ctx.getTaskInstance().getProcessInstId(), true);

View File

@ -1,9 +1,22 @@
package com.actionsoft.apps.coe.pal.publisher.event;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.actionsoft.apps.coe.pal.publisher.client.util.ProcessStatusAPIManager;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface;
import com.actionsoft.bpms.bpmn.engine.listener.ListenerConst;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.bpms.util.UUIDGener;
import com.actionsoft.exception.AWSException;
import com.actionsoft.sdk.local.SDK;
public class ApplyTaskAfterCreated extends ExecuteListener implements ExecuteListenerInterface {
@ -19,5 +32,77 @@ public class ApplyTaskAfterCreated extends ExecuteListener implements ExecuteLis
SDK.getLogAPI().consoleInfo("[任务创建]任务创建,涉及流程状态取消审批中状态,退回原有状态" + ctx.getTaskInstance().getTitle());
ProcessStatusAPIManager.getInstance().batchUpdateApprovalStatus(ctx.getTaskInstance().getProcessInstId(), false);
}
if("00000000-0000-0000-0000-000000000000".equals(ctx.getTaskInstance().getParentTaskInstId())) {
saveData(ctx);
}
}
public void saveData(ProcessExecutionContext ctx) {
UserContext userContext = ctx.getUserContext();
Date date=new Date();//此时date为当前的时间
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置当前时间的格式为年--
String titled ="流程发布-"+ userContext.getUserName()+"-"+dateFormat.format(date);
String boId = ctx.getParameterOfString(ListenerConst.FORM_EVENT_PARAM_BOID);
//BO表记录注意该记录的数据如果被修改将会体现到表单上修改后不会直接持久化到数据库中
BO boData = (BO) ctx.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
BO byProcess = SDK.getBOAPI().getByProcess(PublisherConstant.BOTABLENAME, ctx.getProcessInstance().getId());
BO bo = new BO();
if(null==boData) {
bo.set("TEAMID", "");
bo.set("TEAMNAME", "");
bo.set("PUBLISHID", UUIDGener.getUUID());
bo.set("APPLYUSERID", userContext.getUID());
bo.set("APPLYUSERNAME", userContext.getUID());
String deptId = userContext.getUserModel().getDepartmentId();
bo.set("APPLYDEPTID", deptId);
bo.set("APPLYDEPTNAME", SDK.getORGAPI().getDepartmentById(deptId).getName());
bo.set("APPLYDATE", new Date());
bo.set("SAVESTATUS", 1);//流程实例状态
}else {
//如果有值就不再去计算了
if(boData.getString("DEPARTMENT_PROOFREADER") != null && !boData.getString("DEPARTMENT_PROOFREADER").isEmpty()){
return;
}
}
//根据部门名称 和单位 计算出 内部校对人 和流程经理
UserContext me = ctx.getUserContext();
String departmentId = me.getUserModel().getDepartmentId();
String allpath = SDK.getORGAPI().getDepartmentById(departmentId).getPathNameOfCache();
String[] patharr = allpath.split("/");
StringBuffer sb = new StringBuffer();
for (String str : patharr) {
sb.append("'").append(str).append("'").append(",");
}
String substring = sb.substring(0, sb.length()-1);
// 可以为boData中的字段进行赋值
Connection open = DBSql.open();
RowMap data = DBSql.getMap(open,"select DEAPRTMNUM,PROCESSMNUMBER from BO_ACT_PROCESSMANAGER where ORGDEPART in ("+substring+")");
if(null==data) {
throw new AWSException("请联系管理员,配置流程经理和流程校对人!");
}
try {
open.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// RowMap data = DBSql.getMap(String.format("select DEAPRTMNUM,PROCESSMNUMBER from BO_ACT_PROCESSMANAGER where ORGNAME like'%s' and ORGDEPART like'%s'", allpath, allpath));
if(data != null&&null!=boData){
boData.set("DEPARTMENT_PROOFREADER", data.getString("DEAPRTMNUM"));
boData.set("PROCESS_MANAGER", data.getString("PROCESSMNUMBER"));
boData.set("RELEASE_INSTRUCTIONS", "<p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:center\"><strong><span style=\";font-family:宋体;font-size:24px\">关于发布《XXXXXXXXXXXX》的通知</span></strong><br></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:center\"><strong><span style=\";font-family:宋体;font-size:14px\">&nbsp;</span></strong></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">各事业部、分(子)公司、总部各部(室):</span></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-indent:43px;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">为</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">,现下发《</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">》,请各单位遵照执行。</span></p><p style=\"margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;text-indent:43px;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">特此通知。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right;\"><span style=\"text-indent: 299px; font-family: 仿宋_GB2312; font-size: 21px;\">xxxxxxxxx单位名称</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right;\"><span style=\"font-family: 仿宋_GB2312; font-size: 21px;\">2022年7月27日</span></p>");//流程实例状态
//如果需要展示在表单上需要调用如下代码注意此操作不会更新数据库中的数据
ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, boData);
}else {
bo.set("DEPARTMENT_PROOFREADER", data.getString("DEAPRTMNUM"));
bo.set("PROCESS_MANAGER", data.getString("PROCESSMNUMBER"));
bo.set("WSID", "7d3ca852-a0bd-42e6-80b1-3dcea6f55083");
bo.set("RELEASE_INSTRUCTIONS", "<p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:center\"><strong><span style=\";font-family:宋体;font-size:24px\">关于发布《XXXXXXXXXXXX》的通知</span></strong><br></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:center\"><strong><span style=\";font-family:宋体;font-size:14px\">&nbsp;</span></strong></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">各事业部、分(子)公司、总部各部(室):</span></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-indent:43px;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">为</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">,现下发《</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">》,请各单位遵照执行。</span></p><p style=\"margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;text-indent:43px;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">特此通知。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right;\"><span style=\"text-indent: 299px; font-family: 仿宋_GB2312; font-size: 21px;\">xxxxxxxxx单位名称</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right;\"><span style=\"font-family: 仿宋_GB2312; font-size: 21px;\">2022年7月27日</span></p>");//流程实例状态
SDK.getBOAPI().create(PublisherConstant.BOTABLENAME, bo, ctx.getProcessInstance(), userContext);
//如果需要展示在表单上需要调用如下代码注意此操作不会更新数据库中的数据
ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, bo);
}
}
}

View File

@ -35,19 +35,7 @@ public class PublishLoadBefore extends ExecuteListener {
String boId = ctx.getParameterOfString(ListenerConst.FORM_EVENT_PARAM_BOID);
//BO表记录注意该记录的数据如果被修改将会体现到表单上修改后不会直接持久化到数据库中
BO boData = (BO) ctx.getParameter(ListenerConst.FORM_EVENT_PARAM_BODATA);
BO bo = new BO();
if(null==boData) {
bo.set("TEAMID", "");
bo.set("TEAMNAME", "");
bo.set("WSID", "");
bo.set("PUBLISHID", UUIDGener.getUUID());
bo.set("APPLYUSERID", userContext.getUID());
bo.set("APPLYUSERNAME", userContext.getUserName());
String deptId = userContext.getUserModel().getDepartmentId();
bo.set("APPLYDEPTID", deptId);
bo.set("APPLYDEPTNAME", SDK.getORGAPI().getDepartmentById(deptId).getName());
bo.set("APPLYDATE", new Date());
bo.set("SAVESTATUS", 1);//流程实例状态
}else {
//如果有值就不再去计算了
if(boData.getString("DEPARTMENT_PROOFREADER") != null && !boData.getString("DEPARTMENT_PROOFREADER").isEmpty()){
@ -76,12 +64,9 @@ public class PublishLoadBefore extends ExecuteListener {
if(data != null&&null!=boData){
boData.set("DEPARTMENT_PROOFREADER", data.getString("DEAPRTMNUM"));
boData.set("PROCESS_MANAGER", data.getString("PROCESSMNUMBER"));
}else {
bo.set("DEPARTMENT_PROOFREADER", data.getString("DEAPRTMNUM"));
bo.set("PROCESS_MANAGER", data.getString("PROCESSMNUMBER"));
SDK.getBOAPI().create(PublisherConstant.BOTABLENAME, bo, ctx.getProcessInstance(), userContext);
boData.set("RELEASE_INSTRUCTIONS", "<p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:center\"><strong><span style=\";font-family:宋体;font-size:24px\">关于发布《XXXXXXXXXXXX》的通知</span></strong><br></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:center\"><strong><span style=\";font-family:宋体;font-size:14px\">&nbsp;</span></strong></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">各事业部、分(子)公司、总部各部(室):</span></p><p style=\"margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;text-indent:43px;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">为</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">,现下发《</span><span style=\";font-family:宋体;font-size:21px\">xxxxxxxxxxxxxxx</span><span style=\";font-family:仿宋_GB2312;font-size:21px\">》,请各单位遵照执行。</span></p><p style=\"margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;text-indent:43px;text-align:justify;text-justify:inter-ideograph\"><span style=\";font-family:仿宋_GB2312;font-size:21px\">特此通知。</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right;\"><span style=\"text-indent: 299px; font-family: 仿宋_GB2312; font-size: 21px;\">xxxxxxxxx单位名称</span></p><p style=\"margin: 5px 0px; text-indent: 43px; text-align: right;\"><span style=\"font-family: 仿宋_GB2312; font-size: 21px;\">2022年7月27日</span></p>");//流程实例状态
//如果需要展示在表单上需要调用如下代码注意此操作不会更新数据库中的数据
ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, boData);
}
// 如果需要展示在表单上需要调用如下代码注意此操作不会更新数据库中的数据
ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, boData);
}
}

View File

@ -44,6 +44,72 @@ public class CreateOutputReportJob2 implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
count2();
}
public void count2() {
int count = 0;
String sqls = "DELETE FROM BO_EU__PAL_NULL_L";
DBSql.update(sqls);
String sql = "select ID from App_Act_Coe_Pal_Repository ";
// String sql = "select ID from App_Act_Coe_Pal_Repository where PLNAME =
// '测试文件测'";
List<RowMap> maps = DBSql.getMaps(sql);
for (RowMap rowMap : maps) {
BO bo = new BO();
String id = rowMap.getString("ID");
PALRepositoryModel model = PALRepositoryCache.getCache().get(id);
if (model != null) {
bo.set("PLNAME", model.getName());
PALRepositoryModel prmodel = PALRepositoryCache.getCache().get(model.getParentId());
if (prmodel != null) {
bo.set("FRAMEWORK", prmodel.getName());
}
bo.set("VERSION", model.getVersion());
if(model.isPublish()) {
bo.set("ISPUBLISH","已发布");
}else {
bo.set("ISPUBLISH","未发布");
}
String methodId = model.getMethodId();
if (methodId.contains("data")) {
bo.set("TYPE", "表单");
}else if (methodId.contains("control.policy")) {
bo.set("TYPE", "制度");
}else if (methodId.contains("process")) {
bo.set("TYPE", "流程");
}
CoeDesignerAPIManager instance = CoeDesignerAPIManager.getInstance();
if (instance != null) {
BaseModel defineModel = null;
try {
defineModel = instance.getDefinition(id, 0);
} catch (Exception e) {
bo.set("ERRORTYPE", "1");
count += SDK.getBOAPI().createDataBO("BO_EU_PAL_ERROR_FILE", bo, UserContext.fromUID("admin"));
}
if (null == defineModel) {
bo.set("ERRORTYPE", "2");
count += SDK.getBOAPI().createDataBO("BO_EU_PAL_ERROR_FILE", bo, UserContext.fromUID("admin"));
} else {
try {
String define = defineModel.getDefinition();
JSONObject definition = JSONObject.parseObject(define);
} catch (Exception e) {
bo.set("ERRORTYPE", "错误文件");
count += SDK.getBOAPI().createDataBO("BO_EU_PAL_ERROR_FILE", bo, UserContext.fromUID("admin"));
}
}
}
}
}
}
public void count1() {
int updateNum = 0;
int createNum = 0;
String sqls = "DELETE FROM BO_EU__PAL_NULL_L";
@ -180,7 +246,6 @@ public class CreateOutputReportJob2 implements IJob {
System.err.println("更新文件表数量:" + updateNum);
System.err.println("本次共查询到的模型:" + createNum);
}