Commit d2a288e5 authored by Quxl's avatar Quxl

第一次提交

parents
/target/
/.settings/
/.classpath
/.project
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.egolm</groupId>
<artifactId>workflow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.egolm</groupId>
<artifactId>common</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.38</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.egolm.workflow;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.workflow.bean.TFlow;
import com.egolm.workflow.bean.TFlowLog;
import com.egolm.workflow.bean.TFlowTask;
import com.egolm.workflow.bean.TaskType;
import com.egolm.workflow.interfaces.WorkflowCallback;
import com.egolm.workflow.interfaces.WorkflowEngine;
import com.egolm.workflow.interfaces.WorkflowService;
public abstract class AbstractOpenApi implements WorkflowEngine, WorkflowService, WorkflowCallback {
@Override
public List<Map<String, Object>> queryHistoryWorkList(String sUserID, Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
TFlowLog log = new TFlowLog();
log.setsTaskType(TaskType.start);
if(StringUtil.isNotBlank(sUserID)) {
log.setsOwnerID(sUserID);
}
page.setLimitKey("dCommit desc");
List<String> args = new ArrayList<String>();
List<Object> objs = new ArrayList<Object>();
args.add("sTaskType = ?");
objs.add(TaskType.start);
if(StringUtil.isNotBlank(sUserID)) {
args.add("sOwnerID = ?");
objs.add(sUserID);
}
String sql = "select * from t_flow_log" + StringUtil.join(" and ", " where ", args);
return jdbcTemplate.limit(sql, page, objs);
}
@Override
public List<Map<String, Object>> queryWorkList(String sUserID, Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
List<Object> objs = new ArrayList<Object>();
List<String> strs = new ArrayList<String>();
strs.add("fl.sTaskType = ?");
objs.add(TaskType.start.name());
if(StringUtil.isNotBlank(sUserID)) {
strs.add("fl.sOwnerID = ?");
objs.add(sUserID);
}
String where = StringUtil.join(" and ", " where ", "", strs);
String sql = "select * from (select fl.*, ft.sTaskID sCurTaskID from t_flow_log fl left join t_flow_task ft on ft.sTaskID = fl.sTaskID" + where + ") where sCurTaskID is not null order by dCommit desc";
return jdbcTemplate.limit(sql, page, TaskType.start.name(), sUserID);
}
@Override
public List<Map<String, Object>> queryTaskList(String sUserID, Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
String sql = "select ft.* from t_flow_task ft, t_flow_user fu where (ft.sTaskID = fu.sTaskID and fu.sUserID = ?) or ft.sAcceptorID = ?";
sql = "select t.*, f.sFlowName from (" + sql + ") t left join t_flow f on f.sFlowID = t.sFlowID";
return jdbcTemplate.limit(sql, page, sUserID, sUserID);
}
@Override
@Transactional
public TFlowTask start(String sFlowName, String sUserID, Map<String, Object> vars) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
Date now = new Date();
TFlow flow = jdbcTemplate.queryForBean("select * from t_flow where nDelFlag = 0 and sFlowName = ? order by dCreate desc limit 1", TFlow.class, sFlowName);
String settings = flow.getsFlowSettings();
Map<?, ?> settongsMap = JSON.parseObject(settings);
Map<?, ?> nodesMap = (Map<?, ?>)settongsMap.get("nodes");
String sStartName = (String)settongsMap.get("start");
Map<?, ?> nodeMap = (Map<?, ?>)nodesMap.get(sStartName);
if(nodeMap != null) {
String type = (String)nodeMap.get("type");
TFlowTask task = new TFlowTask();
task.setsTaskID(StringUtil.getId("TK"));
task.setsWorkID(StringUtil.getId("WK"));
task.setsFlowID(flow.getsFlowID());
task.setsNodeID(sStartName);
task.setsTaskType(TaskType.valueOf(type));
task.setsOwnerID(sUserID);
task.setdCreate(now);
jdbcTemplate.save(task);
this.accept(task.getsTaskID(), sUserID);
Map<?, ?> transfers = (Map<?, ?>)nodeMap.get("transfers");
Set<?> transfer_ids = (Set<?>)transfers.keySet();
String sTransferName = null;
for(Object objId : transfer_ids) {
sTransferName = (String)objId;
}
return this.commit(task.getsTaskID(), sTransferName, "流程启动", sUserID, vars);
} else {
throw new XFlowException("找不到开始节点");
}
}
@Override
@Transactional
public void accept(String sTaskID, String sUserID) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
String sql = "update t_flow_task set sAcceptorID = ?, dAccept = ? where sTaskID = ? and sAcceptorID is null and dAccept is null";
String sql2 = "delete from t_flow_user where sTaskID = ?";
jdbcTemplate.executeUpdate(sql, sUserID, new Date(), sTaskID);
jdbcTemplate.executeUpdate(sql2, sTaskID);
}
@Override
@Transactional
public TFlowTask commit(String sTaskID, String sTransferName, String sRemark, String sUserID, Map<String, Object> vars) {
Date now = new Date();
if(StringUtil.isNotBlank(sUserID)) {
this.accept(sTaskID, sUserID);
}
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
TFlowTask task = jdbcTemplate.queryForBean("select * from t_flow_task where sTaskID = ?", TFlowTask.class, sTaskID);
TFlow flow = jdbcTemplate.queryForBean("select * from t_flow where sFlowID = ?", TFlow.class, task.getsFlowID());
Map<String, Object> mergedVars = new HashMap<String, Object>();
String vars_json = task.getsVars();
Map<?, ?> dbVars = JSON.parseObject(vars_json);
if(dbVars != null) {
for(Object objKey : dbVars.keySet()) {
vars.put((String)objKey, dbVars.get(objKey));
}
}
mergedVars.putAll(vars);
String merged_vars_json = StringUtil.toJson(mergedVars);
String settings = flow.getsFlowSettings();
Map<?, ?> settongsMap = JSON.parseObject(settings);
Map<?, ?> nodesMap = (Map<?, ?>)settongsMap.get("nodes");
Map<?, ?> nodeMap = (Map<?, ?>)nodesMap.get(task.getsNodeID());
Map<?, ?> transfersMap = (Map<?, ?>)nodeMap.get("transfers");
Map<?, ?> transferMap = (Map<?, ?>)transfersMap.get(sTransferName);
String sTransferTo = (String)transferMap.get("to");
String action = (String)transferMap.get("action");
TFlowLog taskLog = new TFlowLog();
taskLog.setsTaskID(task.getsTaskID());
taskLog.setsFlowID(task.getsFlowID());
taskLog.setsWorkID(task.getsWorkID());
taskLog.setsNodeID(task.getsNodeID());
taskLog.setdAccept(task.getdAccept());
taskLog.setsAcceptorID(task.getsAcceptorID());
taskLog.setsUserID(sUserID);
taskLog.setsOwnerID(task.getsOwnerID());
taskLog.setsTransferName(sTransferName);
taskLog.setsRemark(sRemark);
taskLog.setsTransferTo(sTransferTo);
taskLog.setdCommit(now);
taskLog.setsVars(merged_vars_json);
taskLog.setsFlowName(flow.getsFlowName());
taskLog.setsTaskType(task.getsTaskType());
jdbcTemplate.save(taskLog);
jdbcTemplate.delete(task);
if(StringUtil.isNotBlank(action)) {
this.runApi(action, mergedVars);
}
Map<?, ?> transferNodeMap = (Map<?, ?>)nodesMap.get(sTransferTo);
String type = (String)transferNodeMap.get("type");
TaskType taskType = TaskType.valueOf(type);
String transferNodeName = (String)transferNodeMap.get("name");
if(taskType == TaskType.end) {
TFlowLog endLog = new TFlowLog();
endLog.setsTaskID(StringUtil.getId("TK"));
endLog.setsFlowID(task.getsFlowID());
endLog.setsWorkID(task.getsWorkID());
endLog.setsNodeID(transferNodeName);
endLog.setsOwnerID(task.getsOwnerID());
endLog.setsUserID(sUserID);
endLog.setsRemark("流程结束");
endLog.setdCommit(now);
endLog.setdAccept(now);
endLog.setsAcceptorID(sUserID);
endLog.setsVars(merged_vars_json);
endLog.setsFlowName(flow.getsFlowName());
endLog.setsTaskType(TaskType.end);
jdbcTemplate.save(endLog);
return null;
} else {
TFlowTask next = new TFlowTask();
next.setsTaskID(StringUtil.getId("TK"));
next.setsFlowID(task.getsFlowID());
next.setsWorkID(task.getsWorkID());
next.setsNodeID(sTransferTo);
next.setsOwnerID(task.getsOwnerID());
next.setsTaskType(taskType);
next.setdCreate(now);
next.setsVars(merged_vars_json);
jdbcTemplate.save(next);
if(taskType == TaskType.auto) {
String target = (String)transferNodeMap.get("target");
Object targetObj = this.runApi(target, mergedVars);
String autoTransferName = null;
Map<String, Object> targetVars = new HashMap<String, Object>();
if(targetObj instanceof String) {
autoTransferName = (String)targetObj;
} else if(targetObj instanceof Map) {
Map<?, ?> targetMap = (Map<?, ?>)targetObj;
autoTransferName = (String)targetMap.get("to");
Map<?, ?> targetReturnVars = (Map<?, ?>)targetMap.get("vars");
if(targetReturnVars != null) {
for(Object objKey : targetReturnVars.keySet()) {
targetVars.put((String)objKey, targetReturnVars.get(objKey));
}
}
}
return this.commit(next.getsTaskID(), autoTransferName, "自动审批", null, targetVars);
} else {
List<Object[]> params = new ArrayList<Object[]>();
String user = (String)transferNodeMap.get("user");
String[] strs = user.split(",|;");
for(String str : strs) {
if(str.equalsIgnoreCase("owner")) {
params.add(new Object[]{next.getsTaskID(), next.getsOwnerID()});
} else if(this.isReferenceApi(str)) {
Object result = this.runApi(str, mergedVars);
if(result instanceof String) {
params.add(new Object[]{next.getsTaskID(), result});
} else if(result instanceof Collection) {
Collection<?> collection = (Collection<?>)result;
for(Object obj : collection) {
params.add(new Object[]{next.getsTaskID(), (String)obj});
}
} else if(result instanceof Object[]) {
Object[] array = (Object[]) result;
for(Object obj : array) {
params.add(new Object[]{next.getsTaskID(), (String)obj});
}
}
} else {
params.add(new Object[]{next.getsTaskID(), str});
}
}
String sql = "insert into t_flow_user (sTaskID, sUserID) values (?, ?)";
jdbcTemplate.batchUpdate(sql, params);
return next;
}
}
}
@Override
public List<Map<String, Object>> queryFlowList(Page page) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
return jdbcTemplate.limit("select * from t_flow where nDelFlag = ? order by dCreate desc", page, 0);
}
@Override
@Transactional
public void save(TFlow flow) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
flow.setsFlowID(StringUtil.getId("FW"));
flow.setnDelFlag(0);
flow.setdCreate(new Date());
jdbcTemplate.save(flow);
}
@Override
public Map<String, Object> queryFlowMapById(String sFlowID) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
return jdbcTemplate.queryForMap("select * from t_flow where sFlowID = ?", sFlowID);
}
@Override
@Transactional
public void updateFlow(TFlow flow) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
String sFlowSettings = this.parseFlowSettings(flow.getsVectorData());
flow.setsFlowSettings(sFlowSettings);
jdbcTemplate.merge(flow);
}
@Override
public void removeFlow(String sFlowID) {
JdbcTemplate jdbcTemplate = this.getFlowDBTemplate();
TFlow flow = new TFlow(sFlowID);
flow.setnDelFlag(1);
jdbcTemplate.merge(flow);
}
}
package com.egolm.workflow;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
@Service
public class TestApiImpl extends AbstractOpenApi {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public JdbcTemplate getFlowDBTemplate() {
return this.jdbcTemplate;
}
@Override
public Map<String, Object> runApi(String api, Map<String, Object> args) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isReferenceApi(String string) {
// TODO Auto-generated method stub
return false;
}
@Override
public String parseFlowSettings(String jsonData) {
// TODO Auto-generated method stub
return null;
}
}
package com.egolm.workflow;
import com.egolm.common.StringUtil;
public class XFlowException extends RuntimeException {
private static final long serialVersionUID = 1L;
public XFlowException() {
super();
}
public XFlowException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public XFlowException(String message, Throwable cause) {
super(message, cause);
}
public XFlowException(String message) {
super(message);
}
public XFlowException(Throwable cause) {
super(cause);
}
public static void assertNotBlank(String val, String message) {
if(StringUtil.isBlank(val)) {
throw new XFlowException(message);
}
}
}
package com.egolm.workflow.bean;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity(name = "t_flow")
public class TFlow implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private String sFlowID;
private String sFlowName;
private String sVectorData;
private String sFlowSettings;
private Integer nDelFlag;
private String sRemark;
private Date dCreate;
public TFlow(){}
public TFlow(String sFlowID) {
this.sFlowID = sFlowID;
}
public String getsFlowID() {
return sFlowID;
}
public void setsFlowID(String sFlowID) {
this.sFlowID = sFlowID;
}
public String getsFlowName() {
return sFlowName;
}
public void setsFlowName(String sFlowName) {
this.sFlowName = sFlowName;
}
public String getsFlowSettings() {
return sFlowSettings;
}
public void setsFlowSettings(String sFlowSettings) {
this.sFlowSettings = sFlowSettings;
}
public Date getdCreate() {
return dCreate;
}
public void setdCreate(Date dCreate) {
this.dCreate = dCreate;
}
public String getsRemark() {
return sRemark;
}
public void setsRemark(String sRemark) {
this.sRemark = sRemark;
}
public String getsVectorData() {
return sVectorData;
}
public void setsVectorData(String sVectorData) {
this.sVectorData = sVectorData;
}
public Integer getnDelFlag() {
return nDelFlag;
}
public void setnDelFlag(Integer nDelFlag) {
this.nDelFlag = nDelFlag;
}
}
package com.egolm.workflow.bean;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity(name = "t_flow_log")
public class TFlowLog implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private String sTaskID;
private String sFlowID;
private String sWorkID;
private String sUserID;
private String sOwnerID;
private String sNodeID;
private String sFlowName;
private TaskType sTaskType;
private String sTransferName;
private String sTransferTo;
private String sRemark;
private String sVars;
private Date dCommit;
private Date dAccept;
private String sAcceptorID;
public String getsFlowID() {
return sFlowID;
}
public void setsFlowID(String sFlowID) {
this.sFlowID = sFlowID;
}
public String getsWorkID() {
return sWorkID;
}
public void setsWorkID(String sWorkID) {
this.sWorkID = sWorkID;
}
public String getsUserID() {
return sUserID;
}
public void setsUserID(String sUserID) {
this.sUserID = sUserID;
}
public String getsTransferName() {
return sTransferName;
}
public void setsTransferName(String sTransferName) {
this.sTransferName = sTransferName;
}
public String getsTransferTo() {
return sTransferTo;
}
public void setsTransferTo(String sTransferTo) {
this.sTransferTo = sTransferTo;
}
public String getsRemark() {
return sRemark;
}
public void setsRemark(String sRemark) {
this.sRemark = sRemark;
}
public String getsVars() {
return sVars;
}
public void setsVars(String sVars) {
this.sVars = sVars;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getsNodeID() {
return sNodeID;
}
public void setsNodeID(String sNodeID) {
this.sNodeID = sNodeID;
}
public Date getdCommit() {
return dCommit;
}
public void setdCommit(Date dCommit) {
this.dCommit = dCommit;
}
public String getsOwnerID() {
return sOwnerID;
}
public void setsOwnerID(String sOwnerID) {
this.sOwnerID = sOwnerID;
}
public Date getdAccept() {
return dAccept;
}
public void setdAccept(Date dAccept) {
this.dAccept = dAccept;
}
public String getsAcceptorID() {
return sAcceptorID;
}
public void setsAcceptorID(String sAcceptorID) {
this.sAcceptorID = sAcceptorID;
}
public String getsFlowName() {
return sFlowName;
}
public void setsFlowName(String sFlowName) {
this.sFlowName = sFlowName;
}
public String getsTaskID() {
return sTaskID;
}
public void setsTaskID(String sTaskID) {
this.sTaskID = sTaskID;
}
public TaskType getsTaskType() {
return sTaskType;
}
public void setsTaskType(TaskType sTaskType) {
this.sTaskType = sTaskType;
}
}
package com.egolm.workflow.bean;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author
* @since 2016-12-21
* @version v-1.0
*/
@Entity(name="t_flow_task")
public class TFlowTask implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private String sTaskID;
private String sFlowID;
private String sWorkID;
private String sNodeID;
private TaskType sTaskType;
private String sOwnerID;
private String sAcceptorID;
private Date dCreate;
private Date dAccept;
private String sVars;
public TFlowTask() {}
public TFlowTask(String sTaskID) {
this.sTaskID = sTaskID;
}
public String getsTaskID() {
return sTaskID;
}
public void setsTaskID(String sTaskID) {
this.sTaskID = sTaskID;
}
public String getsFlowID() {
return sFlowID;
}
public void setsFlowID(String sFlowID) {
this.sFlowID = sFlowID;
}
public String getsWorkID() {
return sWorkID;
}
public void setsWorkID(String sWorkID) {
this.sWorkID = sWorkID;
}
public String getsNodeID() {
return sNodeID;
}
public void setsNodeID(String sNodeID) {
this.sNodeID = sNodeID;
}
public Date getdCreate() {
return dCreate;
}
public void setdCreate(Date dCreate) {
this.dCreate = dCreate;
}
public Date getdAccept() {
return dAccept;
}
public void setdAccept(Date dAccept) {
this.dAccept = dAccept;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getsOwnerID() {
return sOwnerID;
}
public void setsOwnerID(String sOwnerID) {
this.sOwnerID = sOwnerID;
}
public String getsVars() {
return sVars;
}
public void setsVars(String sVars) {
this.sVars = sVars;
}
public String getsAcceptorID() {
return sAcceptorID;
}
public void setsAcceptorID(String sAcceptorID) {
this.sAcceptorID = sAcceptorID;
}
public TaskType getsTaskType() {
return sTaskType;
}
public void setsTaskType(TaskType sTaskType) {
this.sTaskType = sTaskType;
}
}
package com.egolm.workflow.bean;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2016-12-19
* @version v-1.0
*/
@Entity(name="t_flow_user")
public class TFlowUser implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private String sTaskID;
@Id
private String sUserID;
public String getsTaskID() {
return sTaskID;
}
public void setsTaskID(String sTaskID) {
this.sTaskID = sTaskID;
}
public String getsUserID() {
return sUserID;
}
public void setsUserID(String sUserID) {
this.sUserID = sUserID;
}
}
package com.egolm.workflow.bean;
public enum TaskType {
start, end, auto, task
}
package com.egolm.workflow.interfaces;
import java.util.Map;
/**
* 流程引擎回调类
* @author Quxl
*
*/
public interface WorkflowCallback {
/**
* 回调业务处理逻辑
* @param api 回调地址
* @param args 回调参数
* @return
*/
Map<String, Object> runApi(String api, Map<String, Object> args);
/**
* 判断是否是指向业务处理逻辑的地址或指针
* @param string
* @return
*/
boolean isReferenceApi(String string);
/**
* 流程测试数据,转换好的流程数据 {"nodes":{"开始":{"transfers":{"转到提交请假单":{"name":"转到提交请假单","action":"","to":"提交请假单"}},"name":"开始","type":"start"},"提交请假单":{"form":"/leave.html","transfers":{"提交请假单":{"name":"提交请假单","action":null,"to":"自动审批"}},"name":"提交请假单","type":"task","user":"owner"},"自动审批":{"transfers":{"请假天数小于3天":{"name":"请假天数小于3天","action":null,"to":"经理审批"},"请假天数大于等于3天":{"name":"请假天数大于等于3天","action":null,"to":"老板审批"}},"name":"自动审批","type":"auto","target":"test.xjson"},"请假成功":{"name":"请假成功","type":"end"},"老板审批":{"form":"/boss.htnl","transfers":{"拒绝":{"name":"拒绝","action":null,"to":"请假失败"},"驳回":{"name":"驳回","action":null,"to":"提交请假单"},"同意":{"name":"同意","action":null,"to":"请假成功"}},"name":"老板审批","type":"task","user":"owner"},"经理审批":{"form":"manager.html","transfers":{"拒绝":{"name":"拒绝","action":null,"to":"请假失败"},"驳回":{"name":"驳回","action":null,"to":"提交请假单"},"同意":{"name":"同意","action":null,"to":"请假成功"}},"name":"经理审批","type":"task","user":"owner"},"请假失败":{"name":"请假失败","type":"end"}},"start":"开始","title":"测试4"}
* 流程流转文件转换,将原始的流程图数据转换为引擎能够识别的格式
* 参考testflow.json, testflow.png
* @param jsonData
* @return
*/
String parseFlowSettings(String jsonData);
}
package com.egolm.workflow.interfaces;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.workflow.bean.TFlowTask;
public interface WorkflowEngine {
JdbcTemplate getFlowDBTemplate();
/**
*
* @param sUserID
* @param page
* @return
*/
List<Map<String, Object>> queryHistoryWorkList(String sUserID, Page page);
List<Map<String, Object>> queryWorkList(String sUserID, Page page);
List<Map<String, Object>> queryTaskList(String sUserID, Page page);
TFlowTask start(String sFlowName, String sUserID, Map<String, Object> vars);
void accept(String sTaskID, String sUserID);
TFlowTask commit(String sTaskID, String sTransferName, String sRemark, String sUserID, Map<String, Object> vars);
}
package com.egolm.workflow.interfaces;
import java.util.List;
import java.util.Map;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.workflow.bean.TFlow;
public interface WorkflowService {
JdbcTemplate getFlowDBTemplate();
/**
* 新增流程定义
* @param flow
*/
void save(TFlow flow);
/**
* 查询流程定义
* @param page
* @return
*/
List<Map<String, Object>> queryFlowList(Page page);
/**
* 查询流程定义详情
* @param sFlowID
* @return
*/
Map<String, Object> queryFlowMapById(String sFlowID);
/**
* 修改流程定义
* @param flow
*/
void updateFlow(TFlow flow);
/**
* 删除流程定义
* @param sFlowID
*/
void removeFlow(String sFlowID);
}
{
"title": "测试流程",
"start": "开始",
"nodes": {
"开始": {
"name": "开始", "type": "start",
"transfers": {"转到提交请假单": {"name": "转到提交请假单", "action": null, "to": "提交请假单"}}
},
"提交请假单": {
"form": "/leave.html", "name": "提交请假单", "type": "task", "user": "owner",
"transfers": {
"提交请假单": { "name": "提交请假单", "action": null, "to": "自动审批" }
}
},
"自动审批": {
"name": "自动审批", "type": "auto", "target": "test.xjson",
"transfers": {
"请假天数小于3天": { "name": "请假天数小于3天", "action": null, "to": "经理审批" },
"请假天数大于等于3天": { "name": "请假天数大于等于3天", "action": null, "to": "老板审批" }
}
},
"老板审批": {
"form": "/boss.htnl", "name": "老板审批", "type": "task", "user": "owner",
"transfers": {
"拒绝": { "name": "拒绝", "action": null, "to": "请假失败" },
"驳回": { "name": "驳回", "action": null, "to": "提交请假单" },
"同意": { "name": "同意", "action": null, "to": "请假成功" }
}
},
"经理审批": {
"form": "manager.html", "name": "经理审批", "type": "task", "user": "owner",
"transfers": {
"拒绝": { "name": "拒绝", "action": null, "to": "请假失败" },
"驳回": { "name": "驳回", "action": null, "to": "提交请假单" },
"同意": { "name": "同意", "action": null, "to": "请假成功" }
}
},
"请假成功": { "name": "请假成功", "type": "end" },
"请假失败": { "name": "请假失败", "type": "end" }
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment