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
This diff is collapsed.
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