From f930e6b3daba14611838acfb86b21c894e203800 Mon Sep 17 00:00:00 2001 From: zhal <15900249928@163.com> Date: Fri, 14 Jun 2024 09:08:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=8F=91=E5=B8=83=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apps/coe/pal/publisher/Plugins.java | 3 ++ .../coe/pal/publisher/at/getConsultHour.java | 51 +++++++++++++++++++ .../apps/coe/pal/publisher/at/getRoleAt.java | 23 +++++++-- .../client/util/ProcesNumberUtil.java | 17 +++++-- .../pal/publisher/event/SubFormAfterSave.java | 2 +- .../pubEvent/ProcessEndAfterEvent_new.java | 37 +++++++------- 6 files changed, 107 insertions(+), 26 deletions(-) create mode 100644 com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getConsultHour.java diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java index 13ed77a4..0fff512c 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/Plugins.java @@ -158,6 +158,9 @@ public class Plugins implements PluginListener { list.add(new AtFormulaPluginProfile("根据当前部门获取一级部门", "@getFirstDepart(*fullDepartId)", getFirstDepartAt.class.getName(), "根据当前部门获取一级部门", "根据当前部门获取一级部门")); + list.add(new AtFormulaPluginProfile("依据任务接收时间与意见回复期限返回小时数", "@getConsultHour(*bindid,*taskId,*deadline)", getConsultHour.class.getName(), "依据任务接收时间与意见回复期限返回小时数", "依据任务接收时间与意见回复期限返回小时数")); + + return list; } diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getConsultHour.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getConsultHour.java new file mode 100644 index 00000000..d53374b7 --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getConsultHour.java @@ -0,0 +1,51 @@ +package com.actionsoft.apps.coe.pal.publisher.at; + +import com.actionsoft.bpms.commons.at.AbstExpression; +import com.actionsoft.bpms.commons.at.ExpressionContext; +import com.actionsoft.bpms.util.DBSql; +import com.actionsoft.exception.AWSExpressionException; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class getConsultHour extends AbstExpression { + public getConsultHour(ExpressionContext atContext, String expressionValue) { + super(atContext, expressionValue); + } + + @Override + public String execute(String s) throws AWSExpressionException { + + + String bindid = getParameter(s, 1); + String taskId = getParameter(s, 2); + String deadline = getParameter(s, 3); + //DEADLINE_REPLY + + + //计算时间差 + + //当前节点接收到的任务的时间和表单上选择的一个时间中间间隔了几个小时 + + String begintime=DBSql.getString("SELECT BEGINTIME FROM WFC_TASK WHERE ID='"+taskId+"'"); + + + long hours = 0; + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date startTime = null; + try { + startTime = format.parse(deadline); + Date endTime = format.parse(begintime); + // 计算时间差 + long timeDifference = endTime.getTime() - startTime.getTime(); + // 转换为小时数 + hours = timeDifference / (1000 * 60 * 60); + + } catch (ParseException e) { + e.printStackTrace(); + } + + return hours+""; + } +} diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getRoleAt.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getRoleAt.java index e0743166..7aebdf59 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getRoleAt.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/at/getRoleAt.java @@ -3,6 +3,8 @@ package com.actionsoft.apps.coe.pal.publisher.at; import com.actionsoft.bpms.bo.engine.BO; import com.actionsoft.bpms.commons.at.AbstExpression; import com.actionsoft.bpms.commons.at.ExpressionContext; +import com.actionsoft.bpms.commons.database.RowMap; +import com.actionsoft.bpms.util.DBSql; import com.actionsoft.sdk.local.SDK; public class getRoleAt extends AbstExpression { @@ -14,15 +16,28 @@ public class getRoleAt extends AbstExpression { public String execute(String expression) { String incentivecountersignature = null; + //获取发布人部门 - String orgdepart = getParameter(expression, 1); + String orgdepartId = getParameter(expression, 1); - BO act_processmanager= SDK.getBOAPI().query("BO_ACT_PROCESSMANAGER").addQuery("ORGDEPART=",orgdepart).detail(); + String allpath = SDK.getORGAPI().getDepartmentById(orgdepartId).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); - if(act_processmanager!=null){ - incentivecountersignature=act_processmanager.getString("INCENTIVECOUNTERSIGNATURE"); + // 可以为boData中的字段进行赋值 + RowMap data = DBSql.getMap("select INCENTIVECOUNTERSIGNATURE from BO_ACT_PROCESSMANAGER where ORGDEPART in (" + substring + + ")"); + + if(data!=null){ + incentivecountersignature=data.getString("INCENTIVECOUNTERSIGNATURE"); } return incentivecountersignature; + + } } 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 850de95b..8adbc74c 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 @@ -116,7 +116,6 @@ public class ProcesNumberUtil { String publish_number = DBSql.getString( "SELECT PUBLISH_NUMBER FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID ='" + Vsion1Id + "'"); - System.out.println("获取编号为=======================" + publish_number); if (UtilString.isNotEmpty(publish_number)) { // 设置模型ID String plver = "2.0"; @@ -234,14 +233,19 @@ public class ProcesNumberUtil { String plcategory = rowMap.getString("PLMETHODID"); String plvers = rowMap.getString("PLVER"); String number = getProcessNum(levelnum, orgCode, plcategory); - if (plcategory.contains("process")) { - + if (plcategory.contains("process") && !plcategory.equals("process.scheme")) { name = "/P" + number; } else if (plcategory.contains("control")) { name = "/R" + number; } else if (plcategory.contains("form")) { fileName = "form_number"; name = "/T" + number; + //方案图编码规则/F + } else if(plcategory.equals("process.scheme")){ + name = "/F" + number; + //工程技术标准编码规则/Q + }else if(plcategory.equals("engineering.standard")){ + name = "/Q" + number; } if (!"".equals(plvers)) { if (plvers.length() > 1) { @@ -362,13 +366,18 @@ public class ProcesNumberUtil { String plvers = rowMap.getString("PLVER"); String number = getProcessNum(levelnum, orgCode, plcategory); - if (plcategory.contains("process")) { + if (plcategory.contains("process") && !plcategory.equals("process.scheme")) { name = "/P" + number; } else if (plcategory.contains("control")) { name = "/R" + number; } else if (plcategory.contains("form")) { fileName = "form_number"; name = "/T" + number; + }else if(plcategory.equals("process.scheme")){ + name = "/F" + number; + //工程技术标准编码规则/Q + }else if(plcategory.equals("engineering.standard")){ + name = "/Q" + number; } if (!"".equals(plvers)) { if (plvers.length() > 1) { diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java index a4712c80..254d9872 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java @@ -133,7 +133,7 @@ public class SubFormAfterSave extends ExecuteListener { saveFileType(processInstId); - int level1auditcount = DBSql.update("UPDATE BO_ACT_COE_PUBLISH SET LEVEL_1_AUDIT_REQUIRED='" + formData.getString("LEVEL_1_AUDIT_REQUIRED") + "' ,SET SECONDARY_AUDIT_REQUIRED='"+formData.getString("SECONDARY_AUDIT_REQUIRED")+"', LEVEL_AUDIT_REQUIRED='"+formData.getString("LEVEL_AUDIT_REQUIRED")+"', FOURTH_AUDIT_REQUIRED='"+formData.getString("FOURTH_AUDIT_REQUIRED")+"' WHERE BINDID ='" + processInstId + "'"); + int level1auditcount = DBSql.update("UPDATE BO_ACT_COE_PUBLISH SET LEVEL_1_AUDIT_REQUIRED='" + formData.getString("LEVEL_1_AUDIT_REQUIRED") + "' ,SECONDARY_AUDIT_REQUIRED='"+formData.getString("SECONDARY_AUDIT_REQUIRED")+"', LEVEL_AUDIT_REQUIRED='"+formData.getString("LEVEL_AUDIT_REQUIRED")+"', FOURTH_AUDIT_REQUIRED='"+formData.getString("FOURTH_AUDIT_REQUIRED")+"' WHERE BINDID ='" + processInstId + "'"); /* diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java index 70777859..3128710a 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/pubEvent/ProcessEndAfterEvent_new.java @@ -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.system.util.StringUtil; import com.actionsoft.exception.AWSDataAccessException; import org.apache.commons.lang.StringUtils; import org.dom4j.Document; @@ -103,7 +104,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute @Override public void run() { try { - System.out.println("进入方法==============="); ProcessData(ext,open); } catch (Exception e) { // TODO Auto-generated catch block @@ -217,7 +217,6 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute System.out.println("processExecutionContext.getTaskInstance().getTarget()).getNo()==========="+SDK.getORGAPI() .getDepartmentByUser(processExecutionContext.getTaskInstance().getTarget()).getNo()); String target = processExecutionContext.getTaskInstance().getTarget(); - System.out.println("target============"+target); target = processExecutionContext.getTaskInstance().getTarget(); jsonObject.put("user", target); @@ -640,13 +639,10 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute } - - - /** * 推送到EHSQ */ - boolean sendEhqs = true; + boolean sendEhqs = false; String depId = processExecutionContext.getUserContext().getDepartmentModel().getId(); //获取EHSQ配置表判断是否发送 String sql = "SELECT * FROM BO_ACT_ACT_ESQ_SEND"; @@ -657,17 +653,21 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute DepartmentModel departmentById = SDK.getORGAPI().getDepartmentById(dempet); if(departmentById!=null) { String departemenId = departmentById.getId(); + String pathIdOfCache=departmentById.getPathIdOfCache(); + System.out.println("depId========"+depId); if(departemenId.equals(depId)&&"是".equals(issend)) { sendEhqs = true; - } /* - * else { List subDepartments = - * SDK.getORGAPI().getSubDepartments(departmentById.getId()); for - * (DepartmentModel departmentModel : subDepartments) { String subDeartmentId = - * departmentModel.getId(); if(subDeartmentId.equals(depId)&&"是".equals(issend)) - * { sendEhqs = true; } } - * - * } - */ + } else { + List subDepartments = SDK.getORGAPI().getSubDepartments(departmentById.getId()); + for (DepartmentModel departmentModel : subDepartments) { + String subDeartmentId = departmentModel.getId(); + if (subDeartmentId.equals(depId) && "是".equals(issend)) { + sendEhqs = true; + } + } + + } + } } if(!sendEhqs) { @@ -677,6 +677,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute try { // 推送EHSQ if(bo_act_coe_publish_n.size()>0) { + System.out.println("发送EHSQ===================="); sendEHSQ(processExecutionContext, bo_act_coe_publish_n); } // 更新EHSQ @@ -1280,7 +1281,9 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute bo.set("TITLE", processInstance.getTitle()); bo.set("PROCESSID", processInstance.getId()); bo.set("USER_ID", user); - //bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId()); + if(UtilString.isNotEmpty(SDK.getORGAPI().getUser(user).getDepartmentId())){ + bo.set("USERDEP", SDK.getORGAPI().getUser(user).getDepartmentId()); + } bo.set("DATAID", dataid); bo.set("RESULT", status); bo.set("SENDTYPE", "1"); @@ -2411,7 +2414,7 @@ public class ProcessEndAfterEvent_new extends ExecuteListener implements Execute BO bo1 = SDK.getBOAPI().query("BO_ACT_PUBLISH_PERM_SCOPE", true) .addQuery("PALNAME=", bo.getString("CHANGEDFILENAMENEW")).detail(); if (bo1 != null) { - if (bo1.getString("SEND_SCOP").equals("1")) { + if (bo1.getString("PERMTYPE").equals("1")) { jsonObject_ehsq.put("releasescope", "内蒙古伊利实业集团股份有限公司"); } else {