同步发布应用代码

This commit is contained in:
zhal 2024-06-14 09:08:06 +08:00
parent e4a45795e4
commit f930e6b3da
6 changed files with 107 additions and 26 deletions

View File

@ -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;
}

View File

@ -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+"";
}
}

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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 + "'");
/*

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.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<DepartmentModel> subDepartments =
* SDK.getORGAPI().getSubDepartments(departmentById.getId()); for
* (DepartmentModel departmentModel : subDepartments) { String subDeartmentId =
* departmentModel.getId(); if(subDeartmentId.equals(depId)&&"".equals(issend))
* { sendEhqs = true; } }
*
* }
*/
} else {
List<DepartmentModel> 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 {