From 21606d6a1d24bda52ab52a3eaeaaa21608a96ae7 Mon Sep 17 00:00:00 2001 From: lihongyu <504404568@qq.com> Date: Thu, 27 Oct 2022 02:30:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=8F=91=E5=B8=83=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=B5=81=E7=A8=8B=E7=BB=8F=E7=90=86=E8=B0=83=E6=95=B4?= =?UTF-8?q?=EF=BC=8C=E7=94=9F=E6=88=90=E7=BC=96=E5=8F=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/util/ProcesNumberUtil.java | 6 +- .../event/ApplyTasAfterkComplete.java | 8 ++ .../event/ApplyTaskAfterCreated.java | 85 +++++++++++++++++++ .../publisher/event/PublishLoadBefore.java | 21 +---- .../extend/CreateOutputReportJob2.java | 67 ++++++++++++++- 5 files changed, 165 insertions(+), 22 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java index 5939a6c4..9cc6cba2 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/ProcesNumberUtil.java @@ -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'"; diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTasAfterkComplete.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTasAfterkComplete.java index 88ac3b3a..df75ced7 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTasAfterkComplete.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTasAfterkComplete.java @@ -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 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); diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTaskAfterCreated.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTaskAfterCreated.java index dd8a5662..4f2d56c6 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTaskAfterCreated.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/ApplyTaskAfterCreated.java @@ -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", "

关于发布《XXXXXXXXXXXX》的通知

 

各事业部、分(子)公司、总部各部(室):

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,现下发《xxxxxxxxxxxxxxx》,请各单位遵照执行。

特此通知。

(xxxxxxxxx)单位名称

2022年7月27日

");//流程实例状态 + //如果需要展示在表单上,需要调用如下代码。注意:此操作不会更新数据库中的数据 + 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", "

关于发布《XXXXXXXXXXXX》的通知

 

各事业部、分(子)公司、总部各部(室):

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,现下发《xxxxxxxxxxxxxxx》,请各单位遵照执行。

特此通知。

(xxxxxxxxx)单位名称

2022年7月27日

");//流程实例状态 + SDK.getBOAPI().create(PublisherConstant.BOTABLENAME, bo, ctx.getProcessInstance(), userContext); + //如果需要展示在表单上,需要调用如下代码。注意:此操作不会更新数据库中的数据 + ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, bo); + } } } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishLoadBefore.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishLoadBefore.java index 1431e6fd..92ffbc4a 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishLoadBefore.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishLoadBefore.java @@ -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", "

关于发布《XXXXXXXXXXXX》的通知

 

各事业部、分(子)公司、总部各部(室):

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,现下发《xxxxxxxxxxxxxxx》,请各单位遵照执行。

特此通知。

(xxxxxxxxx)单位名称

2022年7月27日

");//流程实例状态 + //如果需要展示在表单上,需要调用如下代码。注意:此操作不会更新数据库中的数据 + ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, boData); } - // 如果需要展示在表单上,需要调用如下代码。注意:此操作不会更新数据库中的数据 - ctx.setParameter(ListenerConst.FORM_EVENT_PARAM_BODATA, boData); } } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java index 00d09886..ec7351dd 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/extend/CreateOutputReportJob2.java @@ -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 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); - }