重构工作流引擎
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.workflow;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.workflow.WfNodeDefinition;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class WfNodeDefinitionDao extends CommDaoImpl<WfNodeDefinition> {
|
||||
public WfNodeDefinitionDao() {
|
||||
super();
|
||||
this.setMappernamespace("workflow.WfNodeDefinitionMapper");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.workflow;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.workflow.WfProcessDefinition;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class WfProcessDefinitionDao extends CommDaoImpl<WfProcessDefinition> {
|
||||
public WfProcessDefinitionDao() {
|
||||
super();
|
||||
this.setMappernamespace("workflow.WfProcessDefinitionMapper");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.workflow;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.workflow.WfProcessInstance;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class WfProcessInstanceDao extends CommDaoImpl<WfProcessInstance> {
|
||||
public WfProcessInstanceDao() {
|
||||
super();
|
||||
this.setMappernamespace("workflow.WfProcessInstanceMapper");
|
||||
}
|
||||
}
|
||||
13
src/main/java/com/sipai/dao/workflow/WfTaskDao.java
Normal file
13
src/main/java/com/sipai/dao/workflow/WfTaskDao.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.workflow;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.workflow.WfTask;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class WfTaskDao extends CommDaoImpl<WfTask> {
|
||||
public WfTaskDao() {
|
||||
super();
|
||||
this.setMappernamespace("workflow.WfTaskMapper");
|
||||
}
|
||||
}
|
||||
13
src/main/java/com/sipai/dao/workflow/WfTransitionDao.java
Normal file
13
src/main/java/com/sipai/dao/workflow/WfTransitionDao.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.workflow;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.workflow.WfTransition;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class WfTransitionDao extends CommDaoImpl<WfTransition> {
|
||||
public WfTransitionDao() {
|
||||
super();
|
||||
this.setMappernamespace("workflow.WfTransitionMapper");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.sipai.entity.workflow;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
public class WfNodeDefinition extends SQLAdapter {
|
||||
|
||||
private Long id;
|
||||
private Long processDefId;
|
||||
private String nodeKey;
|
||||
private String nodeName;
|
||||
private String nodeType;
|
||||
private Integer sortOrder;
|
||||
private String description;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getProcessDefId() {
|
||||
return processDefId;
|
||||
}
|
||||
|
||||
public void setProcessDefId(Long processDefId) {
|
||||
this.processDefId = processDefId;
|
||||
}
|
||||
|
||||
public String getNodeKey() {
|
||||
return nodeKey;
|
||||
}
|
||||
|
||||
public void setNodeKey(String nodeKey) {
|
||||
this.nodeKey = nodeKey;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getNodeType() {
|
||||
return nodeType;
|
||||
}
|
||||
|
||||
public void setNodeType(String nodeType) {
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
|
||||
public Integer getSortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(Integer sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.sipai.entity.workflow;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
public class WfProcessDefinition extends SQLAdapter {
|
||||
|
||||
private Long id;
|
||||
private String processKey;
|
||||
private String processName;
|
||||
private String description;
|
||||
private Integer version;
|
||||
private String status;
|
||||
private String createTime;
|
||||
private String updateTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getProcessKey() {
|
||||
return processKey;
|
||||
}
|
||||
|
||||
public void setProcessKey(String processKey) {
|
||||
this.processKey = processKey;
|
||||
}
|
||||
|
||||
public String getProcessName() {
|
||||
return processName;
|
||||
}
|
||||
|
||||
public void setProcessName(String processName) {
|
||||
this.processName = processName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.sipai.entity.workflow;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
public class WfProcessInstance extends SQLAdapter {
|
||||
|
||||
private Long id;
|
||||
private Long processDefId;
|
||||
private String processKey;
|
||||
private String businessKey;
|
||||
private String starter;
|
||||
private String status;
|
||||
private Long currentNodeId;
|
||||
private String createTime;
|
||||
private String endTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getProcessDefId() {
|
||||
return processDefId;
|
||||
}
|
||||
|
||||
public void setProcessDefId(Long processDefId) {
|
||||
this.processDefId = processDefId;
|
||||
}
|
||||
|
||||
public String getProcessKey() {
|
||||
return processKey;
|
||||
}
|
||||
|
||||
public void setProcessKey(String processKey) {
|
||||
this.processKey = processKey;
|
||||
}
|
||||
|
||||
public String getBusinessKey() {
|
||||
return businessKey;
|
||||
}
|
||||
|
||||
public void setBusinessKey(String businessKey) {
|
||||
this.businessKey = businessKey;
|
||||
}
|
||||
|
||||
public String getStarter() {
|
||||
return starter;
|
||||
}
|
||||
|
||||
public void setStarter(String starter) {
|
||||
this.starter = starter;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getCurrentNodeId() {
|
||||
return currentNodeId;
|
||||
}
|
||||
|
||||
public void setCurrentNodeId(Long currentNodeId) {
|
||||
this.currentNodeId = currentNodeId;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
}
|
||||
106
src/main/java/com/sipai/entity/workflow/WfTask.java
Normal file
106
src/main/java/com/sipai/entity/workflow/WfTask.java
Normal file
@ -0,0 +1,106 @@
|
||||
package com.sipai.entity.workflow;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
public class WfTask extends SQLAdapter {
|
||||
|
||||
private Long id;
|
||||
private Long processInstanceId;
|
||||
private Long nodeDefId;
|
||||
private String nodeName;
|
||||
private String assignee;
|
||||
private String candidateUsers;
|
||||
private String status;
|
||||
private String result;
|
||||
private String comment;
|
||||
private String createTime;
|
||||
private String completeTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getProcessInstanceId() {
|
||||
return processInstanceId;
|
||||
}
|
||||
|
||||
public void setProcessInstanceId(Long processInstanceId) {
|
||||
this.processInstanceId = processInstanceId;
|
||||
}
|
||||
|
||||
public Long getNodeDefId() {
|
||||
return nodeDefId;
|
||||
}
|
||||
|
||||
public void setNodeDefId(Long nodeDefId) {
|
||||
this.nodeDefId = nodeDefId;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getAssignee() {
|
||||
return assignee;
|
||||
}
|
||||
|
||||
public void setAssignee(String assignee) {
|
||||
this.assignee = assignee;
|
||||
}
|
||||
|
||||
public String getCandidateUsers() {
|
||||
return candidateUsers;
|
||||
}
|
||||
|
||||
public void setCandidateUsers(String candidateUsers) {
|
||||
this.candidateUsers = candidateUsers;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCompleteTime() {
|
||||
return completeTime;
|
||||
}
|
||||
|
||||
public void setCompleteTime(String completeTime) {
|
||||
this.completeTime = completeTime;
|
||||
}
|
||||
}
|
||||
70
src/main/java/com/sipai/entity/workflow/WfTransition.java
Normal file
70
src/main/java/com/sipai/entity/workflow/WfTransition.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.sipai.entity.workflow;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
public class WfTransition extends SQLAdapter {
|
||||
|
||||
private Long id;
|
||||
private Long processDefId;
|
||||
private Long sourceNodeId;
|
||||
private Long targetNodeId;
|
||||
private String conditionExpr;
|
||||
private String transitionName;
|
||||
private Integer sortOrder;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getProcessDefId() {
|
||||
return processDefId;
|
||||
}
|
||||
|
||||
public void setProcessDefId(Long processDefId) {
|
||||
this.processDefId = processDefId;
|
||||
}
|
||||
|
||||
public Long getSourceNodeId() {
|
||||
return sourceNodeId;
|
||||
}
|
||||
|
||||
public void setSourceNodeId(Long sourceNodeId) {
|
||||
this.sourceNodeId = sourceNodeId;
|
||||
}
|
||||
|
||||
public Long getTargetNodeId() {
|
||||
return targetNodeId;
|
||||
}
|
||||
|
||||
public void setTargetNodeId(Long targetNodeId) {
|
||||
this.targetNodeId = targetNodeId;
|
||||
}
|
||||
|
||||
public String getConditionExpr() {
|
||||
return conditionExpr;
|
||||
}
|
||||
|
||||
public void setConditionExpr(String conditionExpr) {
|
||||
this.conditionExpr = conditionExpr;
|
||||
}
|
||||
|
||||
public String getTransitionName() {
|
||||
return transitionName;
|
||||
}
|
||||
|
||||
public void setTransitionName(String transitionName) {
|
||||
this.transitionName = transitionName;
|
||||
}
|
||||
|
||||
public Integer getSortOrder() {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public void setSortOrder(Integer sortOrder) {
|
||||
this.sortOrder = sortOrder;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="workflow.WfNodeDefinitionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.workflow.WfNodeDefinition">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="process_def_id" jdbcType="BIGINT" property="processDefId" />
|
||||
<result column="node_key" jdbcType="VARCHAR" property="nodeKey" />
|
||||
<result column="node_name" jdbcType="NVARCHAR" property="nodeName" />
|
||||
<result column="node_type" jdbcType="VARCHAR" property="nodeType" />
|
||||
<result column="sort_order" jdbcType="INTEGER" property="sortOrder" />
|
||||
<result column="description" jdbcType="NVARCHAR" property="description" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, process_def_id, node_key, node_name, node_type, sort_order, description
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
from [OA_ELM].[dbo].wf_node_definition
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="selectListByWhere" parameterType="com.sipai.entity.workflow.WfNodeDefinition" resultMap="BaseResultMap">
|
||||
select * from [OA_ELM].[dbo].wf_node_definition ${where}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.workflow.WfNodeDefinition">
|
||||
insert into [OA_ELM].[dbo].wf_node_definition
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="processDefId != null">process_def_id,</if>
|
||||
<if test="nodeKey != null">node_key,</if>
|
||||
<if test="nodeName != null">node_name,</if>
|
||||
<if test="nodeType != null">node_type,</if>
|
||||
<if test="sortOrder != null">sort_order,</if>
|
||||
<if test="description != null">description,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="processDefId != null">#{processDefId,jdbcType=BIGINT},</if>
|
||||
<if test="nodeKey != null">#{nodeKey,jdbcType=VARCHAR},</if>
|
||||
<if test="nodeName != null">#{nodeName,jdbcType=NVARCHAR},</if>
|
||||
<if test="nodeType != null">#{nodeType,jdbcType=VARCHAR},</if>
|
||||
<if test="sortOrder != null">#{sortOrder,jdbcType=INTEGER},</if>
|
||||
<if test="description != null">#{description,jdbcType=NVARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.workflow.WfNodeDefinition">
|
||||
update [OA_ELM].[dbo].wf_node_definition
|
||||
<set>
|
||||
<if test="processDefId != null">process_def_id = #{processDefId,jdbcType=BIGINT},</if>
|
||||
<if test="nodeKey != null">node_key = #{nodeKey,jdbcType=VARCHAR},</if>
|
||||
<if test="nodeName != null">node_name = #{nodeName,jdbcType=NVARCHAR},</if>
|
||||
<if test="nodeType != null">node_type = #{nodeType,jdbcType=VARCHAR},</if>
|
||||
<if test="sortOrder != null">sort_order = #{sortOrder,jdbcType=INTEGER},</if>
|
||||
<if test="description != null">description = #{description,jdbcType=NVARCHAR},</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from [OA_ELM].[dbo].wf_node_definition where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByWhere" parameterType="com.sipai.entity.workflow.WfNodeDefinition">
|
||||
delete from [OA_ELM].[dbo].wf_node_definition ${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="workflow.WfProcessDefinitionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.workflow.WfProcessDefinition">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="process_key" jdbcType="VARCHAR" property="processKey" />
|
||||
<result column="process_name" jdbcType="NVARCHAR" property="processName" />
|
||||
<result column="description" jdbcType="NVARCHAR" property="description" />
|
||||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, process_key, process_name, description, version, status, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from [OA_ELM].[dbo].wf_process_definition
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="selectListByWhere" parameterType="com.sipai.entity.workflow.WfProcessDefinition" resultMap="BaseResultMap">
|
||||
select * from [OA_ELM].[dbo].wf_process_definition ${where}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.workflow.WfProcessDefinition">
|
||||
insert into [OA_ELM].[dbo].wf_process_definition
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="processKey != null">process_key,</if>
|
||||
<if test="processName != null">process_name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="status != null">status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="processKey != null">#{processKey,jdbcType=VARCHAR},</if>
|
||||
<if test="processName != null">#{processName,jdbcType=NVARCHAR},</if>
|
||||
<if test="description != null">#{description,jdbcType=NVARCHAR},</if>
|
||||
<if test="version != null">#{version,jdbcType=INTEGER},</if>
|
||||
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.workflow.WfProcessDefinition">
|
||||
update [OA_ELM].[dbo].wf_process_definition
|
||||
<set>
|
||||
<if test="processKey != null">process_key = #{processKey,jdbcType=VARCHAR},</if>
|
||||
<if test="processName != null">process_name = #{processName,jdbcType=NVARCHAR},</if>
|
||||
<if test="description != null">description = #{description,jdbcType=NVARCHAR},</if>
|
||||
<if test="version != null">version = #{version,jdbcType=INTEGER},</if>
|
||||
<if test="status != null">status = #{status,jdbcType=VARCHAR},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from [OA_ELM].[dbo].wf_process_definition where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByWhere" parameterType="com.sipai.entity.workflow.WfProcessDefinition">
|
||||
delete from [OA_ELM].[dbo].wf_process_definition ${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="workflow.WfProcessInstanceMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.workflow.WfProcessInstance">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="process_def_id" jdbcType="BIGINT" property="processDefId" />
|
||||
<result column="process_key" jdbcType="VARCHAR" property="processKey" />
|
||||
<result column="business_key" jdbcType="VARCHAR" property="businessKey" />
|
||||
<result column="starter" jdbcType="VARCHAR" property="starter" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="current_node_id" jdbcType="BIGINT" property="currentNodeId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, process_def_id, process_key, business_key, starter, status, current_node_id, create_time, end_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
from [OA_ELM].[dbo].wf_process_instance
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="selectListByWhere" parameterType="com.sipai.entity.workflow.WfProcessInstance" resultMap="BaseResultMap">
|
||||
select * from [OA_ELM].[dbo].wf_process_instance ${where}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.workflow.WfProcessInstance" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into [OA_ELM].[dbo].wf_process_instance
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="processDefId != null">process_def_id,</if>
|
||||
<if test="processKey != null">process_key,</if>
|
||||
<if test="businessKey != null">business_key,</if>
|
||||
<if test="starter != null">starter,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="currentNodeId != null">current_node_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="processDefId != null">#{processDefId,jdbcType=BIGINT},</if>
|
||||
<if test="processKey != null">#{processKey,jdbcType=VARCHAR},</if>
|
||||
<if test="businessKey != null">#{businessKey,jdbcType=VARCHAR},</if>
|
||||
<if test="starter != null">#{starter,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
|
||||
<if test="currentNodeId != null">#{currentNodeId,jdbcType=BIGINT},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.workflow.WfProcessInstance">
|
||||
update [OA_ELM].[dbo].wf_process_instance
|
||||
<set>
|
||||
<if test="processDefId != null">process_def_id = #{processDefId,jdbcType=BIGINT},</if>
|
||||
<if test="processKey != null">process_key = #{processKey,jdbcType=VARCHAR},</if>
|
||||
<if test="businessKey != null">business_key = #{businessKey,jdbcType=VARCHAR},</if>
|
||||
<if test="starter != null">starter = #{starter,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">status = #{status,jdbcType=VARCHAR},</if>
|
||||
<if test="currentNodeId != null">current_node_id = #{currentNodeId,jdbcType=BIGINT},</if>
|
||||
<if test="endTime != null">end_time = #{endTime,jdbcType=TIMESTAMP},</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from [OA_ELM].[dbo].wf_process_instance where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByWhere" parameterType="com.sipai.entity.workflow.WfProcessInstance">
|
||||
delete from [OA_ELM].[dbo].wf_process_instance ${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
72
src/main/java/com/sipai/mapper/workflow/WfTaskMapper.xml
Normal file
72
src/main/java/com/sipai/mapper/workflow/WfTaskMapper.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="workflow.WfTaskMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.workflow.WfTask">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="process_instance_id" jdbcType="BIGINT" property="processInstanceId" />
|
||||
<result column="node_def_id" jdbcType="BIGINT" property="nodeDefId" />
|
||||
<result column="node_name" jdbcType="NVARCHAR" property="nodeName" />
|
||||
<result column="assignee" jdbcType="VARCHAR" property="assignee" />
|
||||
<result column="candidate_users" jdbcType="VARCHAR" property="candidateUsers" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="result" jdbcType="VARCHAR" property="result" />
|
||||
<result column="comment" jdbcType="NVARCHAR" property="comment" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="complete_time" jdbcType="TIMESTAMP" property="completeTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, process_instance_id, node_def_id, node_name, assignee, candidate_users, status, result, comment, create_time, complete_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
from [OA_ELM].[dbo].wf_task
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="selectListByWhere" parameterType="com.sipai.entity.workflow.WfTask" resultMap="BaseResultMap">
|
||||
select * from [OA_ELM].[dbo].wf_task ${where}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.workflow.WfTask" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into [OA_ELM].[dbo].wf_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="processInstanceId != null">process_instance_id,</if>
|
||||
<if test="nodeDefId != null">node_def_id,</if>
|
||||
<if test="nodeName != null">node_name,</if>
|
||||
<if test="assignee != null">assignee,</if>
|
||||
<if test="candidateUsers != null">candidate_users,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="result != null">result,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="processInstanceId != null">#{processInstanceId,jdbcType=BIGINT},</if>
|
||||
<if test="nodeDefId != null">#{nodeDefId,jdbcType=BIGINT},</if>
|
||||
<if test="nodeName != null">#{nodeName,jdbcType=NVARCHAR},</if>
|
||||
<if test="assignee != null">#{assignee,jdbcType=VARCHAR},</if>
|
||||
<if test="candidateUsers != null">#{candidateUsers,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
|
||||
<if test="result != null">#{result,jdbcType=VARCHAR},</if>
|
||||
<if test="comment != null">#{comment,jdbcType=NVARCHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.workflow.WfTask">
|
||||
update [OA_ELM].[dbo].wf_task
|
||||
<set>
|
||||
<if test="processInstanceId != null">process_instance_id = #{processInstanceId,jdbcType=BIGINT},</if>
|
||||
<if test="nodeDefId != null">node_def_id = #{nodeDefId,jdbcType=BIGINT},</if>
|
||||
<if test="nodeName != null">node_name = #{nodeName,jdbcType=NVARCHAR},</if>
|
||||
<if test="assignee != null">assignee = #{assignee,jdbcType=VARCHAR},</if>
|
||||
<if test="candidateUsers != null">candidate_users = #{candidateUsers,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">status = #{status,jdbcType=VARCHAR},</if>
|
||||
<if test="result != null">result = #{result,jdbcType=VARCHAR},</if>
|
||||
<if test="comment != null">comment = #{comment,jdbcType=NVARCHAR},</if>
|
||||
<if test="completeTime != null">complete_time = #{completeTime,jdbcType=TIMESTAMP},</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from [OA_ELM].[dbo].wf_task where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByWhere" parameterType="com.sipai.entity.workflow.WfTask">
|
||||
delete from [OA_ELM].[dbo].wf_task ${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="workflow.WfTransitionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.workflow.WfTransition">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="process_def_id" jdbcType="BIGINT" property="processDefId" />
|
||||
<result column="source_node_id" jdbcType="BIGINT" property="sourceNodeId" />
|
||||
<result column="target_node_id" jdbcType="BIGINT" property="targetNodeId" />
|
||||
<result column="condition_expr" jdbcType="VARCHAR" property="conditionExpr" />
|
||||
<result column="transition_name" jdbcType="NVARCHAR" property="transitionName" />
|
||||
<result column="sort_order" jdbcType="INTEGER" property="sortOrder" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List" />
|
||||
from [OA_ELM].[dbo].wf_transition
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<select id="selectListByWhere" parameterType="com.sipai.entity.workflow.WfTransition" resultMap="BaseResultMap">
|
||||
select * from [OA_ELM].[dbo].wf_transition ${where}
|
||||
</select>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.workflow.WfTransition">
|
||||
insert into [OA_ELM].[dbo].wf_transition
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="processDefId != null">process_def_id,</if>
|
||||
<if test="sourceNodeId != null">source_node_id,</if>
|
||||
<if test="targetNodeId != null">target_node_id,</if>
|
||||
<if test="conditionExpr != null">condition_expr,</if>
|
||||
<if test="transitionName != null">transition_name,</if>
|
||||
<if test="sortOrder != null">sort_order,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="processDefId != null">#{processDefId,jdbcType=BIGINT},</if>
|
||||
<if test="sourceNodeId != null">#{sourceNodeId,jdbcType=BIGINT},</if>
|
||||
<if test="targetNodeId != null">#{targetNodeId,jdbcType=BIGINT},</if>
|
||||
<if test="conditionExpr != null">#{conditionExpr,jdbcType=VARCHAR},</if>
|
||||
<if test="transitionName != null">#{transitionName,jdbcType=NVARCHAR},</if>
|
||||
<if test="sortOrder != null">#{sortOrder,jdbcType=INTEGER},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.workflow.WfTransition">
|
||||
update [OA_ELM].[dbo].wf_transition
|
||||
<set>
|
||||
<if test="processDefId != null">process_def_id = #{processDefId,jdbcType=BIGINT},</if>
|
||||
<if test="sourceNodeId != null">source_node_id = #{sourceNodeId,jdbcType=BIGINT},</if>
|
||||
<if test="targetNodeId != null">target_node_id = #{targetNodeId,jdbcType=BIGINT},</if>
|
||||
<if test="conditionExpr != null">condition_expr = #{conditionExpr,jdbcType=VARCHAR},</if>
|
||||
<if test="transitionName != null">transition_name = #{transitionName,jdbcType=NVARCHAR},</if>
|
||||
<if test="sortOrder != null">sort_order = #{sortOrder,jdbcType=INTEGER},</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from [OA_ELM].[dbo].wf_transition where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByWhere" parameterType="com.sipai.entity.workflow.WfTransition">
|
||||
delete from [OA_ELM].[dbo].wf_transition ${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -60,6 +60,8 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.sipai.workflow.IWorkflowEngine;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -71,6 +73,8 @@ public class WorkflowService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WorkflowService.class);
|
||||
|
||||
@Resource
|
||||
private IWorkflowEngine workflowEngine;
|
||||
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@ -154,38 +158,51 @@ public class WorkflowService {
|
||||
@Resource
|
||||
private OverhaulService overhaulService;
|
||||
|
||||
//启动流程
|
||||
public ProcessInstance startWorkflow(String businessKey, String userId, String processDefKey, Map<String, Object> variables) {
|
||||
ProcessInstance processInstance = null;
|
||||
try {
|
||||
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionKey(processDefKey).orderByProcessDefinitionVersion().desc();
|
||||
// ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefID);
|
||||
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.list();
|
||||
if (processDefinitionList != null && processDefinitionList.size() > 0) {
|
||||
// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
|
||||
identityService.setAuthenticatedUserId(userId);
|
||||
processInstance = runtimeService.startProcessInstanceById(processDefinitionList.get(0).getId(), businessKey, variables);
|
||||
}
|
||||
/**
|
||||
* 获取工作流引擎实例(供外部需要直接访问引擎的场景使用)
|
||||
*/
|
||||
public IWorkflowEngine getWorkflowEngine() {
|
||||
return workflowEngine;
|
||||
}
|
||||
|
||||
} finally {
|
||||
identityService.setAuthenticatedUserId(null);
|
||||
//启动流程(委托给IWorkflowEngine)
|
||||
public ProcessInstance startWorkflow(String businessKey, String userId, String processDefKey, Map<String, Object> variables) {
|
||||
// 通过统一引擎接口启动流程
|
||||
String processInstanceId = workflowEngine.startProcess(businessKey, userId, processDefKey, variables);
|
||||
if (processInstanceId != null) {
|
||||
// activiti模式下通过runtimeService查询返回原始ProcessInstance对象
|
||||
// simple模式下runtimeService可能为null,返回null(Controller只需要getId(),可通过processInstanceId获取)
|
||||
try {
|
||||
if (runtimeService != null) {
|
||||
return runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId).singleResult();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("查询ProcessInstance失败,processInstanceId={}", processInstanceId);
|
||||
}
|
||||
}
|
||||
return processInstance;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运行中流程
|
||||
* 启动流程(返回流程实例ID,推荐新代码使用此方法)
|
||||
*/
|
||||
public String startWorkflowReturnId(String businessKey, String userId, String processDefKey, Map<String, Object> variables) {
|
||||
return workflowEngine.startProcess(businessKey, userId, processDefKey, variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运行中流程(委托给IWorkflowEngine)
|
||||
*/
|
||||
public void delProcessInstance(String processInstanceId) {
|
||||
runtimeService.deleteProcessInstance(processInstanceId, "");
|
||||
workflowEngine.deleteProcessInstance(processInstanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除历史流程
|
||||
* 删除历史流程(委托给IWorkflowEngine)
|
||||
*/
|
||||
public void delHistoryInstance(String processInstanceId) {
|
||||
historyService.deleteHistoricProcessInstance(processInstanceId);
|
||||
workflowEngine.deleteHistoricInstance(processInstanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
151
src/main/java/com/sipai/workflow/IWorkflowEngine.java
Normal file
151
src/main/java/com/sipai/workflow/IWorkflowEngine.java
Normal file
@ -0,0 +1,151 @@
|
||||
package com.sipai.workflow;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流引擎统一接口
|
||||
* 抽象核心流程操作,支持 Activiti 和自研引擎切换
|
||||
*/
|
||||
public interface IWorkflowEngine {
|
||||
|
||||
/**
|
||||
* 启动流程
|
||||
*
|
||||
* @param businessKey 业务数据主键
|
||||
* @param userId 发起人ID
|
||||
* @param processDefKey 流程定义key(对应ProcessType.id)
|
||||
* @param variables 流程变量
|
||||
* @return 流程实例ID
|
||||
*/
|
||||
String startProcess(String businessKey, String userId, String processDefKey, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 完成任务(审批通过/驳回/作废)
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param variables 流程变量(pass、route、userIds等)
|
||||
*/
|
||||
void completeTask(String taskId, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 删除运行中流程实例
|
||||
*
|
||||
* @param processInstanceId 流程实例ID
|
||||
*/
|
||||
void deleteProcessInstance(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 删除历史流程实例
|
||||
*
|
||||
* @param processInstanceId 流程实例ID
|
||||
*/
|
||||
void deleteHistoricInstance(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 查询上一个审批节点的历史任务信息
|
||||
*
|
||||
* @param taskId 当前任务ID
|
||||
* @return 上一节点信息 Map(包含 id、name、assignee、processInstanceId、taskDefinitionKey 等)
|
||||
*/
|
||||
Map<String, Object> queryUpOneNode(String taskId);
|
||||
|
||||
/**
|
||||
* 获取流程实例当前活跃的节点ID列表
|
||||
*
|
||||
* @param processInstanceId 流程实例ID
|
||||
* @return 活跃节点ID列表
|
||||
*/
|
||||
List<String> getActiveActivityIds(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 根据流程实例ID查询当前活跃任务信息
|
||||
*
|
||||
* @param processInstanceId 流程实例ID
|
||||
* @return 任务信息 Map(包含 id、name、assignee、candidateUsers、processInstanceId、createTime 等)
|
||||
*/
|
||||
Map<String, Object> getActiveTask(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 根据任务ID获取任务信息
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @return 任务信息 Map
|
||||
*/
|
||||
Map<String, Object> getTask(String taskId);
|
||||
|
||||
/**
|
||||
* 根据任务ID获取流程变量
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @return 流程变量
|
||||
*/
|
||||
Map<String, Object> getTaskVariables(String taskId);
|
||||
|
||||
/**
|
||||
* 根据用户ID和流程定义key查询待办任务列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param modelKey 流程定义key
|
||||
* @return 待办任务列表,每个元素包含任务信息Map
|
||||
*/
|
||||
List<Map<String, Object>> findTodoTasksByUser(String userId, String modelKey);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询待办任务列表(不限流程类型)
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 待办任务列表
|
||||
*/
|
||||
List<Map<String, Object>> findTodoTasksByUser(String userId);
|
||||
|
||||
/**
|
||||
* 查询用户已办任务列表
|
||||
*
|
||||
* @param assignee 用户ID
|
||||
* @param modelKey 流程定义key
|
||||
* @return 已办任务列表
|
||||
*/
|
||||
List<Map<String, Object>> findDoneTasks(String assignee, String modelKey);
|
||||
|
||||
/**
|
||||
* 查询已完成的流程实例
|
||||
*
|
||||
* @return 已完成流程实例列表
|
||||
*/
|
||||
List<Map<String, Object>> findFinishedProcessInstances();
|
||||
|
||||
/**
|
||||
* 查询运行中的流程实例
|
||||
*
|
||||
* @param processDefinitionKey 流程定义key(可为null查全部)
|
||||
* @param offset 分页偏移
|
||||
* @param limit 分页大小
|
||||
* @return 运行中流程实例列表
|
||||
*/
|
||||
List<Map<String, Object>> findRunningProcessInstances(String processDefinitionKey, int offset, int limit);
|
||||
|
||||
/**
|
||||
* 获取流程实例信息
|
||||
*
|
||||
* @param processInstanceId 流程实例ID
|
||||
* @return 流程实例信息 Map(包含 id、businessKey、processDefinitionId、processDefinitionKey、suspended 等)
|
||||
*/
|
||||
Map<String, Object> getProcessInstance(String processInstanceId);
|
||||
|
||||
/**
|
||||
* 获取流程定义信息
|
||||
*
|
||||
* @param processDefinitionId 流程定义ID
|
||||
* @return 流程定义信息 Map(包含 id、key、name、version、deploymentId 等)
|
||||
*/
|
||||
Map<String, Object> getProcessDefinition(String processDefinitionId);
|
||||
|
||||
/**
|
||||
* 签收任务
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param userId 签收人ID
|
||||
*/
|
||||
void claimTask(String taskId, String userId);
|
||||
}
|
||||
35
src/main/java/com/sipai/workflow/WorkflowEngineConfig.java
Normal file
35
src/main/java/com/sipai/workflow/WorkflowEngineConfig.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.sipai.workflow;
|
||||
|
||||
import com.sipai.workflow.activiti.ActivitiWorkflowEngine;
|
||||
import com.sipai.workflow.simple.SimpleWorkflowEngine;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 工作流引擎配置类
|
||||
* 根据 workflow.engine 配置值注入对应的 IWorkflowEngine 实现
|
||||
* activiti = 使用Activiti引擎(默认)
|
||||
* simple = 使用自研轻量级引擎
|
||||
*/
|
||||
@Configuration
|
||||
public class WorkflowEngineConfig {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WorkflowEngineConfig.class);
|
||||
|
||||
@Value("${workflow.engine:activiti}")
|
||||
private String engineType;
|
||||
|
||||
@Bean
|
||||
public IWorkflowEngine workflowEngine() {
|
||||
if ("simple".equalsIgnoreCase(engineType)) {
|
||||
logger.info("========== 工作流引擎: 自研SimpleWorkflowEngine ==========");
|
||||
return new SimpleWorkflowEngine();
|
||||
} else {
|
||||
logger.info("========== 工作流引擎: ActivitiWorkflowEngine ==========");
|
||||
return new ActivitiWorkflowEngine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,299 @@
|
||||
package com.sipai.workflow.activiti;
|
||||
|
||||
import com.sipai.workflow.IWorkflowEngine;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Activiti引擎适配器
|
||||
* 将现有Activiti调用逻辑包装为IWorkflowEngine接口实现
|
||||
*/
|
||||
public class ActivitiWorkflowEngine implements IWorkflowEngine {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ActivitiWorkflowEngine.class);
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
@Autowired
|
||||
private IdentityService identityService;
|
||||
|
||||
@Override
|
||||
public String startProcess(String businessKey, String userId, String processDefKey, Map<String, Object> variables) {
|
||||
try {
|
||||
List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionKey(processDefKey).orderByProcessDefinitionVersion().desc().list();
|
||||
if (processDefinitionList != null && processDefinitionList.size() > 0) {
|
||||
identityService.setAuthenticatedUserId(userId);
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(
|
||||
processDefinitionList.get(0).getId(), businessKey, variables);
|
||||
return processInstance.getId();
|
||||
}
|
||||
} finally {
|
||||
identityService.setAuthenticatedUserId(null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void completeTask(String taskId, Map<String, Object> variables) {
|
||||
taskService.complete(taskId, variables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProcessInstance(String processInstanceId) {
|
||||
runtimeService.deleteProcessInstance(processInstanceId, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHistoricInstance(String processInstanceId) {
|
||||
historyService.deleteHistoricProcessInstance(processInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryUpOneNode(String taskId) {
|
||||
List<HistoricTaskInstance> list = historyService
|
||||
.createHistoricTaskInstanceQuery()
|
||||
.taskId(taskId)
|
||||
.list();
|
||||
if (list != null && list.size() > 0) {
|
||||
HistoricTaskInstance hti = list.get(0);
|
||||
// 查询同一流程实例中,在当前任务之前完成的最近一个任务
|
||||
List<HistoricTaskInstance> upList = historyService
|
||||
.createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(hti.getProcessInstanceId())
|
||||
.finished()
|
||||
.orderByHistoricTaskInstanceEndTime().desc()
|
||||
.list();
|
||||
if (upList != null && upList.size() > 0) {
|
||||
HistoricTaskInstance upTask = upList.get(0);
|
||||
return historicTaskToMap(upTask);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActiveActivityIds(String processInstanceId) {
|
||||
return runtimeService.getActiveActivityIds(processInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getActiveTask(String processInstanceId) {
|
||||
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().singleResult();
|
||||
if (task == null) {
|
||||
return null;
|
||||
}
|
||||
return taskToMap(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTask(String taskId) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
if (task == null) {
|
||||
return null;
|
||||
}
|
||||
return taskToMap(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTaskVariables(String taskId) {
|
||||
return taskService.getVariables(taskId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findTodoTasksByUser(String userId, String modelKey) {
|
||||
List<Task> tasks = taskService.createTaskQuery()
|
||||
.taskCandidateOrAssigned(userId)
|
||||
.processDefinitionKey(modelKey)
|
||||
.list();
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Task task : tasks) {
|
||||
Map<String, Object> map = taskToMap(task);
|
||||
// 补充流程实例信息
|
||||
ProcessInstance pi = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId()).singleResult();
|
||||
if (pi != null) {
|
||||
map.put("businessKey", pi.getBusinessKey());
|
||||
map.put("processDefinitionKey", pi.getProcessDefinitionKey());
|
||||
map.put("suspended", pi.isSuspended());
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findTodoTasksByUser(String userId) {
|
||||
List<Task> tasks = taskService.createTaskQuery()
|
||||
.taskCandidateOrAssigned(userId)
|
||||
.list();
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Task task : tasks) {
|
||||
Map<String, Object> map = taskToMap(task);
|
||||
ProcessInstance pi = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId()).singleResult();
|
||||
if (pi != null) {
|
||||
map.put("businessKey", pi.getBusinessKey());
|
||||
map.put("processDefinitionKey", pi.getProcessDefinitionKey());
|
||||
map.put("suspended", pi.isSuspended());
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findDoneTasks(String assignee, String modelKey) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<HistoricTaskInstance> taskList = historyService.createHistoricTaskInstanceQuery()
|
||||
.taskAssignee(assignee)
|
||||
.finished().processDefinitionKey(modelKey)
|
||||
.list();
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (HistoricTaskInstance task : taskList) {
|
||||
Map<String, Object> map = historicTaskToMap(task);
|
||||
HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId()).singleResult();
|
||||
if (hpi != null) {
|
||||
map.put("businessKey", hpi.getBusinessKey());
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findFinishedProcessInstances() {
|
||||
List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery()
|
||||
.finished().orderByProcessInstanceEndTime().desc().list();
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
for (HistoricProcessInstance hpi : list) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", hpi.getId());
|
||||
map.put("businessKey", hpi.getBusinessKey());
|
||||
map.put("processDefinitionId", hpi.getProcessDefinitionId());
|
||||
map.put("processDefinitionKey", hpi.getProcessDefinitionKey());
|
||||
map.put("startTime", hpi.getStartTime() != null ? sdf.format(hpi.getStartTime()) : null);
|
||||
map.put("endTime", hpi.getEndTime() != null ? sdf.format(hpi.getEndTime()) : null);
|
||||
map.put("startActivityId", hpi.getStartActivityId());
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findRunningProcessInstances(String processDefinitionKey, int offset, int limit) {
|
||||
List<ProcessInstance> list;
|
||||
if (processDefinitionKey != null && !processDefinitionKey.isEmpty()) {
|
||||
list = runtimeService.createProcessInstanceQuery()
|
||||
.processDefinitionKey(processDefinitionKey)
|
||||
.orderByProcessInstanceId().desc()
|
||||
.listPage(offset, limit);
|
||||
} else {
|
||||
list = runtimeService.createProcessInstanceQuery()
|
||||
.orderByProcessInstanceId().desc()
|
||||
.listPage(offset, limit);
|
||||
}
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (ProcessInstance pi : list) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", pi.getId());
|
||||
map.put("businessKey", pi.getBusinessKey());
|
||||
map.put("processDefinitionId", pi.getProcessDefinitionId());
|
||||
map.put("processDefinitionKey", pi.getProcessDefinitionKey());
|
||||
map.put("suspended", pi.isSuspended());
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProcessInstance(String processInstanceId) {
|
||||
ProcessInstance pi = runtimeService.createProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId).singleResult();
|
||||
if (pi == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", pi.getId());
|
||||
map.put("businessKey", pi.getBusinessKey());
|
||||
map.put("processDefinitionId", pi.getProcessDefinitionId());
|
||||
map.put("processDefinitionKey", pi.getProcessDefinitionKey());
|
||||
map.put("suspended", pi.isSuspended());
|
||||
map.put("activityId", pi.getActivityId());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProcessDefinition(String processDefinitionId) {
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(processDefinitionId).singleResult();
|
||||
if (pd == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", pd.getId());
|
||||
map.put("key", pd.getKey());
|
||||
map.put("name", pd.getName());
|
||||
map.put("version", pd.getVersion());
|
||||
map.put("deploymentId", pd.getDeploymentId());
|
||||
map.put("description", pd.getDescription());
|
||||
map.put("resourceName", pd.getResourceName());
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void claimTask(String taskId, String userId) {
|
||||
taskService.claim(taskId, userId);
|
||||
}
|
||||
|
||||
// ========== 私有工具方法 ==========
|
||||
|
||||
private Map<String, Object> taskToMap(Task task) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", task.getId());
|
||||
map.put("name", task.getName());
|
||||
map.put("assignee", task.getAssignee());
|
||||
map.put("processInstanceId", task.getProcessInstanceId());
|
||||
map.put("processDefinitionId", task.getProcessDefinitionId());
|
||||
map.put("executionId", task.getExecutionId());
|
||||
map.put("taskDefinitionKey", task.getTaskDefinitionKey());
|
||||
map.put("createTime", task.getCreateTime() != null ? sdf.format(task.getCreateTime()) : null);
|
||||
map.put("description", task.getDescription());
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String, Object> historicTaskToMap(HistoricTaskInstance task) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", task.getId());
|
||||
map.put("name", task.getName());
|
||||
map.put("assignee", task.getAssignee());
|
||||
map.put("processInstanceId", task.getProcessInstanceId());
|
||||
map.put("processDefinitionId", task.getProcessDefinitionId());
|
||||
map.put("executionId", task.getExecutionId());
|
||||
map.put("taskDefinitionKey", task.getTaskDefinitionKey());
|
||||
map.put("startTime", task.getStartTime() != null ? sdf.format(task.getStartTime()) : null);
|
||||
map.put("endTime", task.getEndTime() != null ? sdf.format(task.getEndTime()) : null);
|
||||
map.put("description", task.getDescription());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,465 @@
|
||||
package com.sipai.workflow.simple;
|
||||
|
||||
import com.sipai.dao.workflow.*;
|
||||
import com.sipai.entity.workflow.*;
|
||||
import com.sipai.workflow.IWorkflowEngine;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 自研轻量级工作流引擎
|
||||
* 基于 wf_process_definition / wf_node_definition / wf_transition / wf_process_instance / wf_task 五张表实现
|
||||
*/
|
||||
public class SimpleWorkflowEngine implements IWorkflowEngine {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SimpleWorkflowEngine.class);
|
||||
|
||||
@Resource
|
||||
private WfProcessDefinitionDao wfProcessDefinitionDao;
|
||||
@Resource
|
||||
private WfNodeDefinitionDao wfNodeDefinitionDao;
|
||||
@Resource
|
||||
private WfTransitionDao wfTransitionDao;
|
||||
@Resource
|
||||
private WfProcessInstanceDao wfProcessInstanceDao;
|
||||
@Resource
|
||||
private WfTaskDao wfTaskDao;
|
||||
|
||||
@Override
|
||||
public String startProcess(String businessKey, String userId, String processDefKey, Map<String, Object> variables) {
|
||||
// 1. 查找流程定义(最新版本)
|
||||
WfProcessDefinition queryDef = new WfProcessDefinition();
|
||||
queryDef.setWhere("WHERE process_key = '" + processDefKey + "' AND status = 'ACTIVE' ORDER BY version DESC");
|
||||
List<WfProcessDefinition> defList = wfProcessDefinitionDao.selectListByWhere(queryDef);
|
||||
if (defList == null || defList.isEmpty()) {
|
||||
logger.error("未找到流程定义: {}", processDefKey);
|
||||
return null;
|
||||
}
|
||||
WfProcessDefinition processDef = defList.get(0);
|
||||
|
||||
// 2. 查找起始节点
|
||||
WfNodeDefinition queryNode = new WfNodeDefinition();
|
||||
queryNode.setWhere("WHERE process_def_id = " + processDef.getId() + " AND node_type = 'START'");
|
||||
List<WfNodeDefinition> startNodes = wfNodeDefinitionDao.selectListByWhere(queryNode);
|
||||
if (startNodes == null || startNodes.isEmpty()) {
|
||||
logger.error("流程定义 {} 未配置START节点", processDefKey);
|
||||
return null;
|
||||
}
|
||||
WfNodeDefinition startNode = startNodes.get(0);
|
||||
|
||||
// 3. 查找START节点的下一个节点(第一个UserTask)
|
||||
WfTransition queryTrans = new WfTransition();
|
||||
queryTrans.setWhere("WHERE source_node_id = " + startNode.getId());
|
||||
List<WfTransition> transitions = wfTransitionDao.selectListByWhere(queryTrans);
|
||||
if (transitions == null || transitions.isEmpty()) {
|
||||
logger.error("START节点 {} 无出口连线", startNode.getId());
|
||||
return null;
|
||||
}
|
||||
WfNodeDefinition firstTaskNode = wfNodeDefinitionDao.selectByPrimaryKey(transitions.get(0).getTargetNodeId());
|
||||
|
||||
// 4. 创建流程实例
|
||||
WfProcessInstance instance = new WfProcessInstance();
|
||||
instance.setProcessDefId(processDef.getId());
|
||||
instance.setProcessKey(processDefKey);
|
||||
instance.setBusinessKey(businessKey);
|
||||
instance.setStarter(userId);
|
||||
instance.setStatus("RUNNING");
|
||||
instance.setCurrentNodeId(firstTaskNode.getId());
|
||||
wfProcessInstanceDao.insertSelective(instance);
|
||||
|
||||
// 5. 创建第一个任务
|
||||
WfTask task = new WfTask();
|
||||
task.setProcessInstanceId(instance.getId());
|
||||
task.setNodeDefId(firstTaskNode.getId());
|
||||
task.setNodeName(firstTaskNode.getNodeName());
|
||||
task.setStatus("PENDING");
|
||||
// 从变量中获取候选人
|
||||
if (variables != null) {
|
||||
Object userIds = variables.get("userIds");
|
||||
if (userIds != null) {
|
||||
task.setCandidateUsers(userIds.toString());
|
||||
}
|
||||
Object assignee = variables.get("applicantId");
|
||||
if (assignee != null) {
|
||||
task.setAssignee(assignee.toString());
|
||||
}
|
||||
}
|
||||
wfTaskDao.insertSelective(task);
|
||||
|
||||
return String.valueOf(instance.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void completeTask(String taskId, Map<String, Object> variables) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 1. 获取当前任务
|
||||
WfTask currentTask = wfTaskDao.selectByPrimaryKey(Long.parseLong(taskId));
|
||||
if (currentTask == null) {
|
||||
logger.error("任务不存在: {}", taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 解析变量
|
||||
boolean pass = true;
|
||||
int route = 0;
|
||||
String candidateUsers = null;
|
||||
if (variables != null) {
|
||||
Object passObj = variables.get("pass");
|
||||
if (passObj != null) {
|
||||
pass = Boolean.parseBoolean(passObj.toString());
|
||||
}
|
||||
Object routeObj = variables.get("route");
|
||||
if (routeObj != null) {
|
||||
route = Integer.parseInt(routeObj.toString());
|
||||
}
|
||||
Object userIdsObj = variables.get("userIds");
|
||||
if (userIdsObj != null) {
|
||||
candidateUsers = userIdsObj.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 更新当前任务状态
|
||||
currentTask.setStatus(pass ? "COMPLETED" : "REJECTED");
|
||||
currentTask.setResult(pass ? "PASS" : "REJECT");
|
||||
currentTask.setCompleteTime(sdf.format(new Date()));
|
||||
wfTaskDao.updateByPrimaryKeySelective(currentTask);
|
||||
|
||||
// 4. 获取流程实例
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(currentTask.getProcessInstanceId());
|
||||
|
||||
// 5. 根据 pass/route 查找匹配的 transition
|
||||
WfTransition queryTrans = new WfTransition();
|
||||
queryTrans.setWhere("WHERE source_node_id = " + currentTask.getNodeDefId() + " ORDER BY sort_order");
|
||||
List<WfTransition> transitions = wfTransitionDao.selectListByWhere(queryTrans);
|
||||
|
||||
WfTransition matchedTransition = null;
|
||||
for (WfTransition t : transitions) {
|
||||
if (evaluateCondition(t.getConditionExpr(), pass, route)) {
|
||||
matchedTransition = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 如果没有匹配的条件,取无条件的默认连线
|
||||
if (matchedTransition == null) {
|
||||
for (WfTransition t : transitions) {
|
||||
if (t.getConditionExpr() == null || t.getConditionExpr().trim().isEmpty()) {
|
||||
matchedTransition = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matchedTransition == null) {
|
||||
logger.error("节点 {} 无匹配的出口连线, pass={}, route={}", currentTask.getNodeDefId(), pass, route);
|
||||
return;
|
||||
}
|
||||
|
||||
// 6. 获取目标节点
|
||||
WfNodeDefinition targetNode = wfNodeDefinitionDao.selectByPrimaryKey(matchedTransition.getTargetNodeId());
|
||||
|
||||
if ("END".equals(targetNode.getNodeType())) {
|
||||
// 流程结束
|
||||
instance.setStatus(pass ? "COMPLETED" : "CANCELLED");
|
||||
instance.setCurrentNodeId(targetNode.getId());
|
||||
instance.setEndTime(sdf.format(new Date()));
|
||||
wfProcessInstanceDao.updateByPrimaryKeySelective(instance);
|
||||
} else {
|
||||
// 创建下一个任务
|
||||
instance.setCurrentNodeId(targetNode.getId());
|
||||
wfProcessInstanceDao.updateByPrimaryKeySelective(instance);
|
||||
|
||||
WfTask nextTask = new WfTask();
|
||||
nextTask.setProcessInstanceId(instance.getId());
|
||||
nextTask.setNodeDefId(targetNode.getId());
|
||||
nextTask.setNodeName(targetNode.getNodeName());
|
||||
nextTask.setStatus("PENDING");
|
||||
if (candidateUsers != null) {
|
||||
nextTask.setCandidateUsers(candidateUsers);
|
||||
}
|
||||
Object assignee = variables != null ? variables.get("applicantId") : null;
|
||||
if (assignee != null) {
|
||||
nextTask.setAssignee(assignee.toString());
|
||||
}
|
||||
wfTaskDao.insertSelective(nextTask);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProcessInstance(String processInstanceId) {
|
||||
Long instId = Long.parseLong(processInstanceId);
|
||||
// 删除关联任务
|
||||
WfTask queryTask = new WfTask();
|
||||
queryTask.setWhere("WHERE process_instance_id = " + instId);
|
||||
wfTaskDao.deleteByWhere(queryTask);
|
||||
// 删除流程实例
|
||||
wfProcessInstanceDao.deleteByPrimaryKey(instId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHistoricInstance(String processInstanceId) {
|
||||
// 自研引擎中历史和运行时在同一张表,直接删除
|
||||
deleteProcessInstance(processInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryUpOneNode(String taskId) {
|
||||
WfTask currentTask = wfTaskDao.selectByPrimaryKey(Long.parseLong(taskId));
|
||||
if (currentTask == null) {
|
||||
return null;
|
||||
}
|
||||
// 查询同一流程实例中,在当前任务之前完成的最近一个任务
|
||||
WfTask queryTask = new WfTask();
|
||||
queryTask.setWhere("WHERE process_instance_id = " + currentTask.getProcessInstanceId()
|
||||
+ " AND status != 'PENDING' AND id < " + taskId + " ORDER BY complete_time DESC");
|
||||
List<WfTask> list = wfTaskDao.selectListByWhere(queryTask);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return wfTaskToMap(list.get(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActiveActivityIds(String processInstanceId) {
|
||||
Long instId = Long.parseLong(processInstanceId);
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(instId);
|
||||
if (instance == null || instance.getCurrentNodeId() == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
WfNodeDefinition node = wfNodeDefinitionDao.selectByPrimaryKey(instance.getCurrentNodeId());
|
||||
List<String> result = new ArrayList<>();
|
||||
if (node != null) {
|
||||
result.add(node.getNodeKey());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getActiveTask(String processInstanceId) {
|
||||
WfTask queryTask = new WfTask();
|
||||
queryTask.setWhere("WHERE process_instance_id = " + processInstanceId + " AND status = 'PENDING'");
|
||||
List<WfTask> list = wfTaskDao.selectListByWhere(queryTask);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return wfTaskToMap(list.get(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTask(String taskId) {
|
||||
WfTask task = wfTaskDao.selectByPrimaryKey(Long.parseLong(taskId));
|
||||
if (task == null) {
|
||||
return null;
|
||||
}
|
||||
return wfTaskToMap(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTaskVariables(String taskId) {
|
||||
// 自研引擎不持久化变量,返回基本信息
|
||||
WfTask task = wfTaskDao.selectByPrimaryKey(Long.parseLong(taskId));
|
||||
if (task == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
Map<String, Object> vars = new HashMap<>();
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(task.getProcessInstanceId());
|
||||
if (instance != null) {
|
||||
vars.put("businessKey", instance.getBusinessKey());
|
||||
}
|
||||
if (task.getCandidateUsers() != null) {
|
||||
vars.put("userIds", task.getCandidateUsers());
|
||||
}
|
||||
if (task.getAssignee() != null) {
|
||||
vars.put("applicantId", task.getAssignee());
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findTodoTasksByUser(String userId, String modelKey) {
|
||||
WfTask queryTask = new WfTask();
|
||||
queryTask.setWhere("WHERE status = 'PENDING' AND (assignee = '" + userId
|
||||
+ "' OR candidate_users LIKE '%" + userId + "%') AND process_instance_id IN "
|
||||
+ "(SELECT id FROM [OA_ELM].[dbo].wf_process_instance WHERE process_key = '" + modelKey + "' AND status = 'RUNNING')");
|
||||
List<WfTask> tasks = wfTaskDao.selectListByWhere(queryTask);
|
||||
return buildTodoTaskResult(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findTodoTasksByUser(String userId) {
|
||||
WfTask queryTask = new WfTask();
|
||||
queryTask.setWhere("WHERE status = 'PENDING' AND (assignee = '" + userId
|
||||
+ "' OR candidate_users LIKE '%" + userId + "%')");
|
||||
List<WfTask> tasks = wfTaskDao.selectListByWhere(queryTask);
|
||||
return buildTodoTaskResult(tasks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findDoneTasks(String assignee, String modelKey) {
|
||||
WfTask queryTask = new WfTask();
|
||||
queryTask.setWhere("WHERE status != 'PENDING' AND assignee = '" + assignee
|
||||
+ "' AND process_instance_id IN "
|
||||
+ "(SELECT id FROM [OA_ELM].[dbo].wf_process_instance WHERE process_key = '" + modelKey + "')");
|
||||
List<WfTask> tasks = wfTaskDao.selectListByWhere(queryTask);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (WfTask task : tasks) {
|
||||
Map<String, Object> map = wfTaskToMap(task);
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(task.getProcessInstanceId());
|
||||
if (instance != null) {
|
||||
map.put("businessKey", instance.getBusinessKey());
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findFinishedProcessInstances() {
|
||||
WfProcessInstance query = new WfProcessInstance();
|
||||
query.setWhere("WHERE status IN ('COMPLETED','CANCELLED') ORDER BY end_time DESC");
|
||||
List<WfProcessInstance> list = wfProcessInstanceDao.selectListByWhere(query);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (WfProcessInstance inst : list) {
|
||||
result.add(wfProcessInstanceToMap(inst));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findRunningProcessInstances(String processDefinitionKey, int offset, int limit) {
|
||||
WfProcessInstance query = new WfProcessInstance();
|
||||
String where = "WHERE status = 'RUNNING'";
|
||||
if (processDefinitionKey != null && !processDefinitionKey.isEmpty()) {
|
||||
where += " AND process_key = '" + processDefinitionKey + "'";
|
||||
}
|
||||
where += " ORDER BY id DESC OFFSET " + offset + " ROWS FETCH NEXT " + limit + " ROWS ONLY";
|
||||
query.setWhere(where);
|
||||
List<WfProcessInstance> list = wfProcessInstanceDao.selectListByWhere(query);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (WfProcessInstance inst : list) {
|
||||
result.add(wfProcessInstanceToMap(inst));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProcessInstance(String processInstanceId) {
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(Long.parseLong(processInstanceId));
|
||||
if (instance == null) {
|
||||
return null;
|
||||
}
|
||||
return wfProcessInstanceToMap(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProcessDefinition(String processDefinitionId) {
|
||||
WfProcessDefinition def = wfProcessDefinitionDao.selectByPrimaryKey(Long.parseLong(processDefinitionId));
|
||||
if (def == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(def.getId()));
|
||||
map.put("key", def.getProcessKey());
|
||||
map.put("name", def.getProcessName());
|
||||
map.put("version", def.getVersion());
|
||||
map.put("deploymentId", null);
|
||||
map.put("description", def.getDescription());
|
||||
map.put("resourceName", null);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void claimTask(String taskId, String userId) {
|
||||
WfTask task = wfTaskDao.selectByPrimaryKey(Long.parseLong(taskId));
|
||||
if (task != null) {
|
||||
task.setAssignee(userId);
|
||||
wfTaskDao.updateByPrimaryKeySelective(task);
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 私有工具方法 ==========
|
||||
|
||||
/**
|
||||
* 评估条件表达式
|
||||
* 支持格式:pass==true, pass==false, route==N
|
||||
*/
|
||||
private boolean evaluateCondition(String expr, boolean pass, int route) {
|
||||
if (expr == null || expr.trim().isEmpty()) {
|
||||
return true; // 无条件,默认匹配
|
||||
}
|
||||
expr = expr.trim();
|
||||
if ("pass==true".equals(expr)) {
|
||||
return pass;
|
||||
}
|
||||
if ("pass==false".equals(expr)) {
|
||||
return !pass;
|
||||
}
|
||||
if (expr.startsWith("route==")) {
|
||||
try {
|
||||
int expected = Integer.parseInt(expr.substring("route==".length()).trim());
|
||||
return route == expected;
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("无法解析route条件: {}", expr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
logger.warn("未识别的条件表达式: {}", expr);
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> buildTodoTaskResult(List<WfTask> tasks) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
if (tasks == null) return result;
|
||||
for (WfTask task : tasks) {
|
||||
Map<String, Object> map = wfTaskToMap(task);
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(task.getProcessInstanceId());
|
||||
if (instance != null) {
|
||||
map.put("businessKey", instance.getBusinessKey());
|
||||
map.put("processDefinitionKey", instance.getProcessKey());
|
||||
map.put("suspended", false);
|
||||
map.put("processDefinitionId", String.valueOf(instance.getProcessDefId()));
|
||||
}
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> wfTaskToMap(WfTask task) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(task.getId()));
|
||||
map.put("name", task.getNodeName());
|
||||
map.put("assignee", task.getAssignee());
|
||||
map.put("processInstanceId", String.valueOf(task.getProcessInstanceId()));
|
||||
map.put("executionId", String.valueOf(task.getProcessInstanceId()));
|
||||
map.put("taskDefinitionKey", task.getNodeDefId() != null ? String.valueOf(task.getNodeDefId()) : null);
|
||||
map.put("createTime", task.getCreateTime());
|
||||
map.put("description", task.getStatus());
|
||||
map.put("candidateUsers", task.getCandidateUsers());
|
||||
map.put("startTime", task.getCreateTime());
|
||||
map.put("endTime", task.getCompleteTime());
|
||||
// 补充processDefinitionId
|
||||
WfProcessInstance instance = wfProcessInstanceDao.selectByPrimaryKey(task.getProcessInstanceId());
|
||||
if (instance != null) {
|
||||
map.put("processDefinitionId", String.valueOf(instance.getProcessDefId()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String, Object> wfProcessInstanceToMap(WfProcessInstance inst) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", String.valueOf(inst.getId()));
|
||||
map.put("businessKey", inst.getBusinessKey());
|
||||
map.put("processDefinitionId", String.valueOf(inst.getProcessDefId()));
|
||||
map.put("processDefinitionKey", inst.getProcessKey());
|
||||
map.put("suspended", false);
|
||||
map.put("activityId", inst.getCurrentNodeId() != null ? String.valueOf(inst.getCurrentNodeId()) : null);
|
||||
map.put("startTime", inst.getCreateTime());
|
||||
map.put("endTime", inst.getEndTime());
|
||||
map.put("startActivityId", null);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
90
src/main/resources/sql/wf_tables.sql
Normal file
90
src/main/resources/sql/wf_tables.sql
Normal file
@ -0,0 +1,90 @@
|
||||
-- ============================================================
|
||||
-- 自研工作流引擎建表脚本(SQL Server)
|
||||
-- 共5张表:wf_process_definition、wf_node_definition、
|
||||
-- wf_transition、wf_process_instance、wf_task
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义表
|
||||
CREATE TABLE wf_process_definition (
|
||||
id BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
process_key VARCHAR(100) NOT NULL, -- 流程标识,对应 ProcessType.id
|
||||
process_name NVARCHAR(200) NOT NULL, -- 流程名称,对应 ProcessType.name
|
||||
description NVARCHAR(500) NULL, -- 描述
|
||||
version INT NOT NULL DEFAULT 1, -- 版本号
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'ACTIVE', -- ACTIVE / DISABLED
|
||||
create_time DATETIME NOT NULL DEFAULT GETDATE(),
|
||||
update_time DATETIME NULL
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_wf_procdef_key_ver ON wf_process_definition(process_key, version);
|
||||
|
||||
-- 2. 流程节点定义表
|
||||
CREATE TABLE wf_node_definition (
|
||||
id BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
process_def_id BIGINT NOT NULL, -- 所属流程定义ID
|
||||
node_key VARCHAR(100) NOT NULL, -- 节点标识
|
||||
node_name NVARCHAR(200) NOT NULL, -- 节点名称
|
||||
node_type VARCHAR(20) NOT NULL, -- START / USER_TASK / END
|
||||
sort_order INT NOT NULL DEFAULT 0, -- 排序
|
||||
description NVARCHAR(500) NULL,
|
||||
CONSTRAINT fk_wf_node_procdef FOREIGN KEY (process_def_id) REFERENCES wf_process_definition(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_wf_nodedef_procdef ON wf_node_definition(process_def_id);
|
||||
|
||||
-- 3. 节点连线/路由表
|
||||
CREATE TABLE wf_transition (
|
||||
id BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
process_def_id BIGINT NOT NULL, -- 所属流程定义ID
|
||||
source_node_id BIGINT NOT NULL, -- 源节点ID
|
||||
target_node_id BIGINT NOT NULL, -- 目标节点ID
|
||||
condition_expr VARCHAR(200) NULL, -- 条件表达式,如 pass==true, route==1
|
||||
transition_name NVARCHAR(200) NULL, -- 连线名称(通过/驳回/作废)
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
CONSTRAINT fk_wf_trans_procdef FOREIGN KEY (process_def_id) REFERENCES wf_process_definition(id),
|
||||
CONSTRAINT fk_wf_trans_source FOREIGN KEY (source_node_id) REFERENCES wf_node_definition(id),
|
||||
CONSTRAINT fk_wf_trans_target FOREIGN KEY (target_node_id) REFERENCES wf_node_definition(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_wf_trans_procdef ON wf_transition(process_def_id);
|
||||
CREATE INDEX idx_wf_trans_source ON wf_transition(source_node_id);
|
||||
|
||||
-- 4. 流程实例表
|
||||
CREATE TABLE wf_process_instance (
|
||||
id BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
process_def_id BIGINT NOT NULL, -- 流程定义ID
|
||||
process_key VARCHAR(100) NOT NULL, -- 冗余:流程标识
|
||||
business_key VARCHAR(100) NOT NULL, -- 业务数据主键
|
||||
starter VARCHAR(100) NOT NULL, -- 发起人
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'RUNNING', -- RUNNING / COMPLETED / CANCELLED
|
||||
current_node_id BIGINT NULL, -- 当前节点ID
|
||||
create_time DATETIME NOT NULL DEFAULT GETDATE(),
|
||||
end_time DATETIME NULL,
|
||||
CONSTRAINT fk_wf_inst_procdef FOREIGN KEY (process_def_id) REFERENCES wf_process_definition(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_wf_inst_bizkey ON wf_process_instance(business_key);
|
||||
CREATE INDEX idx_wf_inst_starter ON wf_process_instance(starter);
|
||||
CREATE INDEX idx_wf_inst_status ON wf_process_instance(status);
|
||||
CREATE INDEX idx_wf_inst_prockey ON wf_process_instance(process_key);
|
||||
|
||||
-- 5. 任务表(合并待办+历史)
|
||||
CREATE TABLE wf_task (
|
||||
id BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
process_instance_id BIGINT NOT NULL, -- 流程实例ID
|
||||
node_def_id BIGINT NOT NULL, -- 节点定义ID
|
||||
node_name NVARCHAR(200) NULL, -- 冗余:节点名称
|
||||
assignee VARCHAR(100) NULL, -- 处理人
|
||||
candidate_users VARCHAR(500) NULL, -- 候选人(逗号分隔)
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'PENDING', -- PENDING / COMPLETED / REJECTED / CANCELLED
|
||||
result VARCHAR(20) NULL, -- 处理结果
|
||||
comment NVARCHAR(1000) NULL, -- 审批意见
|
||||
create_time DATETIME NOT NULL DEFAULT GETDATE(),
|
||||
complete_time DATETIME NULL,
|
||||
CONSTRAINT fk_wf_task_inst FOREIGN KEY (process_instance_id) REFERENCES wf_process_instance(id),
|
||||
CONSTRAINT fk_wf_task_node FOREIGN KEY (node_def_id) REFERENCES wf_node_definition(id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_wf_task_inst ON wf_task(process_instance_id);
|
||||
CREATE INDEX idx_wf_task_status_assignee ON wf_task(status, assignee);
|
||||
CREATE INDEX idx_wf_task_status_candidate ON wf_task(status, candidate_users);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 专项安全检查 (safety_check_special) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('safety_check_special', N'专项安全检查', N'专项安全检查流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/丢失申请(Lose_Apply).sql
Normal file
40
src/main/resources/sql/workflow_init/丢失申请(Lose_Apply).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 丢失申请 (Lose_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Lose_Apply', N'丢失申请', N'丢失申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 临时任务 (Administration_Temporary) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Administration_Temporary', N'临时任务', N'临时任务流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 保养工单 (Workorder_Maintain) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Workorder_Maintain', N'保养工单', N'保养工单流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/保养计划(Maintain_Plan).sql
Normal file
40
src/main/resources/sql/workflow_init/保养计划(Maintain_Plan).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 保养计划 (Maintain_Plan) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Maintain_Plan', N'保养计划', N'保养计划流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/入库管理(In_Stock).sql
Normal file
40
src/main/resources/sql/workflow_init/入库管理(In_Stock).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 入库管理 (In_Stock) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('In_Stock', N'入库管理', N'入库管理流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 公司运维 (Business_Maintenance) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Business_Maintenance', N'公司运维', N'公司运维流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 公司采购 (Business_Purchase) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Business_Purchase', N'公司采购', N'公司采购流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 内部作业会签 (safety_job_inside) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('safety_job_inside', N'内部作业会签', N'内部作业会签流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/出售申请(Sale_Apply).sql
Normal file
40
src/main/resources/sql/workflow_init/出售申请(Sale_Apply).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 出售申请 (Sale_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Sale_Apply', N'出售申请', N'出售申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/出库管理(Out_Stock).sql
Normal file
40
src/main/resources/sql/workflow_init/出库管理(Out_Stock).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 出库管理 (Out_Stock) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Out_Stock', N'出库管理', N'出库管理流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 化验管理 (TestManagement) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('TestManagement', N'化验管理', N'化验管理流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/参观申请(Visit_Apply).sql
Normal file
40
src/main/resources/sql/workflow_init/参观申请(Visit_Apply).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 参观申请 (Visit_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Visit_Apply', N'参观申请', N'参观申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 参观登记 (Visit_Register) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Visit_Register', N'参观登记', N'参观登记流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 合同管理 (Business_Contract) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Business_Contract', N'合同管理', N'合同管理流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 合理化建议 (Reasonable_Advice) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Reasonable_Advice', N'合理化建议', N'合理化建议流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/吐槽内容(Roast).sql
Normal file
40
src/main/resources/sql/workflow_init/吐槽内容(Roast).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 吐槽内容 (Roast) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Roast', N'吐槽内容', N'吐槽内容流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 周期常规任务 (Routine_Work) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Routine_Work', N'周期常规任务', N'周期常规任务流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 处级物资领用 (Scetion_Stock) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Scetion_Stock', N'处级物资领用', N'处级物资领用流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/大修计划(Overhaul_PLAN).sql
Normal file
40
src/main/resources/sql/workflow_init/大修计划(Overhaul_PLAN).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 大修计划 (Overhaul_PLAN) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Overhaul_PLAN', N'大修计划', N'大修计划流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/大修项目(Overhaul).sql
Normal file
40
src/main/resources/sql/workflow_init/大修项目(Overhaul).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 大修项目 (Overhaul) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Overhaul', N'大修项目', N'大修项目流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/安装调试(Install_Debug).sql
Normal file
40
src/main/resources/sql/workflow_init/安装调试(Install_Debug).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 安装调试 (Install_Debug) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Install_Debug', N'安装调试', N'安装调试流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,77 @@
|
||||
-- ============================================================
|
||||
-- 客户运维 (System_Maintenance) 工作流初始化数据
|
||||
-- 流程:开始 → 负责人审核发布 → [同意/驳回/作废] → 运维商接单确认
|
||||
-- → 运维商执行 → [完成提交/退回] → 负责人完成确认 → [确认完成/退回] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('System_Maintenance', N'客户运维', N'客户运维流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'ApplicantSubmit', N'负责人审核发布', 'USER_TASK', 2);
|
||||
DECLARE @n_applicant_submit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'LaunchProblem', N'问题调整', 'USER_TASK', 3);
|
||||
DECLARE @n_launch_problem BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'MaintainerConfirm', N'运维商接单确认', 'USER_TASK', 4);
|
||||
DECLARE @n_maintainer_confirm BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'MaintainerSubmit', N'运维商执行', 'USER_TASK', 5);
|
||||
DECLARE @n_maintainer_submit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'ApplicantFinish', N'负责人完成确认', 'USER_TASK', 6);
|
||||
DECLARE @n_applicant_finish BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 7);
|
||||
DECLARE @n_end1 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 8);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 负责人审核发布
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_applicant_submit, NULL, NULL, 1);
|
||||
|
||||
-- 负责人审核发布 → 运维商接单确认(同意 target==1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_applicant_submit, @n_maintainer_confirm, 'target==1', N'同意', 2);
|
||||
|
||||
-- 负责人审核发布 → 问题调整(驳回 target==0)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_applicant_submit, @n_launch_problem, 'target==0', N'驳回', 3);
|
||||
|
||||
-- 负责人审核发布 → 结束(作废)(作废 target==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_applicant_submit, @n_end2, 'target==-1', N'作废', 4);
|
||||
|
||||
-- 问题调整 → 负责人审核发布
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_launch_problem, @n_applicant_submit, NULL, NULL, 5);
|
||||
|
||||
-- 运维商接单确认 → 运维商执行
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_maintainer_confirm, @n_maintainer_submit, NULL, NULL, 6);
|
||||
|
||||
-- 运维商执行 → 负责人完成确认(完成提交 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_maintainer_submit, @n_applicant_finish, 'pass==true', N'完成提交', 7);
|
||||
|
||||
-- 运维商执行 → 负责人审核发布(退回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_maintainer_submit, @n_applicant_submit, 'pass==false', N'退回', 8);
|
||||
|
||||
-- 负责人完成确认 → 结束(确认完成 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_applicant_finish, @n_end1, 'pass==true', N'确认完成', 9);
|
||||
|
||||
-- 负责人完成确认 → 运维商执行(退回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_applicant_finish, @n_maintainer_submit, 'pass==false', N'退回', 10);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 巡检计划确认 (Patrol_Record) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Patrol_Record', N'巡检计划确认', N'巡检计划确认流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 工艺调整 (Process_Adjustment) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Process_Adjustment', N'工艺调整', N'工艺调整流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/库存盘点(Stock_Check).sql
Normal file
40
src/main/resources/sql/workflow_init/库存盘点(Stock_Check).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 库存盘点 (Stock_Check) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Stock_Check', N'库存盘点', N'库存盘点流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 异常上报-设备 (Workorder_Abnormity_Equipment) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Workorder_Abnormity_Equipment', N'异常上报-设备', N'异常上报(设备)流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 异常上报-设施 (Workorder_Abnormity_Facilities) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Workorder_Abnormity_Facilities', N'异常上报-设施', N'异常上报(设施)流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 异常上报-运行 (Workorder_Abnormity_Run) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Workorder_Abnormity_Run', N'异常上报-运行', N'异常上报(运行)流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/报废申请(Scrap_Apply).sql
Normal file
40
src/main/resources/sql/workflow_init/报废申请(Scrap_Apply).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 报废申请 (Scrap_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Scrap_Apply', N'报废申请', N'报废申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/报表审核(Report_Check).sql
Normal file
40
src/main/resources/sql/workflow_init/报表审核(Report_Check).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 报表审核 (Report_Check) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Report_Check', N'报表审核', N'报表审核流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/招标比价(Bidding_Price).sql
Normal file
40
src/main/resources/sql/workflow_init/招标比价(Bidding_Price).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 招标比价 (Bidding_Price) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Bidding_Price', N'招标比价', N'招标比价流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 指标控制 (Administration_IndexWork) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Administration_IndexWork', N'指标控制', N'指标控制流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 方案编制 (Programme_Write) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Programme_Write', N'方案编制', N'方案编制流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 日常安全检查 (safety_check_dayly) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('safety_check_dayly', N'日常安全检查', N'日常安全检查流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/水质化验(Water_Test).sql
Normal file
40
src/main/resources/sql/workflow_init/水质化验(Water_Test).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 水质化验 (Water_Test) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Water_Test', N'水质化验', N'水质化验流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 组织工作 (Administration_Organization) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Administration_Organization', N'组织工作', N'组织工作流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 绩效方案审核 (KPI_MAKE_PLAN) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('KPI_MAKE_PLAN', N'绩效方案审核', N'绩效考核:绩效方案审核流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 维修工单 (Workorder_Repair) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Workorder_Repair', N'维修工单', N'维修工单流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 维修流程 (Maintenance_Repair) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Maintenance_Repair', N'维修流程', N'维修流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/维修计划(Repair_Plan).sql
Normal file
40
src/main/resources/sql/workflow_init/维修计划(Repair_Plan).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 维修计划 (Repair_Plan) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Repair_Plan', N'维修计划', N'维修计划流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 综合安全检查 (safety_check_comprehensive) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('safety_check_comprehensive', N'综合安全检查', N'综合安全检查流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/考核项目评分(KPI_MARK).sql
Normal file
40
src/main/resources/sql/workflow_init/考核项目评分(KPI_MARK).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 考核项目评分 (KPI_MARK) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('KPI_MARK', N'考核项目评分', N'绩效考核:考核项目评分流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/药剂管理(Raw_Material).sql
Normal file
40
src/main/resources/sql/workflow_init/药剂管理(Raw_Material).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 药剂管理 (Raw_Material) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Raw_Material', N'药剂管理', N'药剂管理流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 设备停用申请 (EquipmentStop_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('EquipmentStop_Apply', N'设备停用申请', N'设备停用申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,64 @@
|
||||
-- ============================================================
|
||||
-- 请假补假 (Administration_Leave) 工作流初始化数据
|
||||
-- 流程:开始 → 科长/副科长审批 → [通过/驳回] → 分管经理审批
|
||||
-- → [通过/驳回] → 总经理审批 → [通过/驳回] → 结束
|
||||
-- 驳回统一退回到"退回修改"节点,修改后重新提交到科长审批
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Administration_Leave', N'请假补假', N'请假补假流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'sectionChiefAudit', N'科长/副科长审批', 'USER_TASK', 2);
|
||||
DECLARE @n_section BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'managerAudit', N'分管经理审批', 'USER_TASK', 3);
|
||||
DECLARE @n_manager BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'generalManagerAudit', N'总经理审批', 'USER_TASK', 4);
|
||||
DECLARE @n_general BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'modifyApply', N'退回修改', 'USER_TASK', 5);
|
||||
DECLARE @n_modify BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 6);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 科长/副科长审批
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_section, NULL, NULL, 1);
|
||||
|
||||
-- 科长/副科长审批 → 分管经理审批(通过)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_section, @n_manager, 'pass==true&&route==1', N'通过', 2);
|
||||
|
||||
-- 科长/副科长审批 → 退回修改(驳回)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_section, @n_modify, 'pass==false&&route==0', N'驳回', 3);
|
||||
|
||||
-- 分管经理审批 → 总经理审批(通过)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_manager, @n_general, 'pass==true&&route==1', N'通过', 4);
|
||||
|
||||
-- 分管经理审批 → 退回修改(驳回)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_manager, @n_modify, 'pass==false&&route==0', N'驳回', 5);
|
||||
|
||||
-- 总经理审批 → 结束(通过)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_general, @n_end, 'pass==true&&route==1', N'通过', 6);
|
||||
|
||||
-- 总经理审批 → 退回修改(驳回)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_general, @n_modify, 'pass==false&&route==0', N'驳回', 7);
|
||||
|
||||
-- 退回修改 → 科长/副科长审批(重新提交)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_modify, @n_section, NULL, N'重新提交', 8);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 调拨申请 (Transfers_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Transfers_Apply', N'调拨申请', N'调拨申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/车辆维保(Maintain_Car).sql
Normal file
40
src/main/resources/sql/workflow_init/车辆维保(Maintain_Car).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 车辆维保 (Maintain_Car) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Maintain_Car', N'车辆维保', N'车辆维保流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/车辆维修(Repair_Car).sql
Normal file
40
src/main/resources/sql/workflow_init/车辆维修(Repair_Car).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 车辆维修 (Repair_Car) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Repair_Car', N'车辆维修', N'车辆维修流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
40
src/main/resources/sql/workflow_init/项目验收(Project_Check).sql
Normal file
40
src/main/resources/sql/workflow_init/项目验收(Project_Check).sql
Normal file
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 项目验收 (Project_Check) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Project_Check', N'项目验收', N'项目验收流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 预案工作 (Administration_Reserve) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Administration_Reserve', N'预案工作', N'预案工作流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
@ -0,0 +1,40 @@
|
||||
-- ============================================================
|
||||
-- 验收申请 (Acceptance_Apply) 工作流初始化数据
|
||||
-- 流程:开始 → 提交审核 → [通过/驳回/作废] → 结束
|
||||
-- ============================================================
|
||||
|
||||
-- 1. 流程定义
|
||||
INSERT INTO wf_process_definition (process_key, process_name, description, version, status)
|
||||
VALUES ('Acceptance_Apply', N'验收申请', N'验收申请流程', 1, 'ACTIVE');
|
||||
|
||||
DECLARE @pd_id BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 2. 节点定义
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'startevent1', N'开始', 'START', 1);
|
||||
DECLARE @n_start BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'audit', N'提交审核', 'USER_TASK', 2);
|
||||
DECLARE @n_audit BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent1', N'结束', 'END', 3);
|
||||
DECLARE @n_end BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO wf_node_definition (process_def_id, node_key, node_name, node_type, sort_order) VALUES (@pd_id, 'endevent2', N'结束(作废)', 'END', 4);
|
||||
DECLARE @n_end2 BIGINT = SCOPE_IDENTITY();
|
||||
|
||||
-- 3. 路由/连线
|
||||
-- 开始 → 提交审核
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_start, @n_audit, NULL, NULL, 1);
|
||||
|
||||
-- 提交审核 → 结束(通过 pass==true)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==true', N'通过', 2);
|
||||
|
||||
-- 提交审核 → 结束(驳回 pass==false)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end, 'pass==false', N'驳回', 3);
|
||||
|
||||
-- 提交审核 → 结束(作废)(作废 route==-1)
|
||||
INSERT INTO wf_transition (process_def_id, source_node_id, target_node_id, condition_expr, transition_name, sort_order)
|
||||
VALUES (@pd_id, @n_audit, @n_end2, 'route==-1', N'作废', 4);
|
||||
2
src/main/resources/workflow.properties
Normal file
2
src/main/resources/workflow.properties
Normal file
@ -0,0 +1,2 @@
|
||||
#工作流引擎切换配置 activiti:使用Activiti引擎 simple:使用自研引擎
|
||||
workflow.engine=activiti
|
||||
@ -32,6 +32,7 @@
|
||||
<value>classpath:library.properties</value>
|
||||
<value>classpath:thirdRequest.properties</value>
|
||||
<value>classpath:xxl-job-executor.properties</value>
|
||||
<value>classpath:workflow.properties</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
Reference in New Issue
Block a user