Index: forgon-core/src/main/java/com/forgon/workflow/model/NodeApproval.java =================================================================== diff -u --- forgon-core/src/main/java/com/forgon/workflow/model/NodeApproval.java (revision 0) +++ forgon-core/src/main/java/com/forgon/workflow/model/NodeApproval.java (revision 21786) @@ -0,0 +1,81 @@ +package com.forgon.workflow.model; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; + +import com.forgon.security.model.Role; +import com.forgon.security.model.User; + +/** + * 节点审批 + * @author zql + * + */ +@Entity +@Table +public class NodeApproval { + + private Long id; + + /** + * 角色id + */ + private Long roleId; + + /** + * 用户id + */ + private Long userId; + + /** + * 所属节点 + * */ + private NodeDefinition nodeDefinition; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "nodeDefinition_ID") + public NodeDefinition getNodeDefinition() { + return nodeDefinition; + } + + public void setNodeDefinition(NodeDefinition nodeDefinition) { + this.nodeDefinition = nodeDefinition; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + +} Index: forgon-core/src/main/java/com/forgon/workflow/model/NodeDefinition.java =================================================================== diff -u --- forgon-core/src/main/java/com/forgon/workflow/model/NodeDefinition.java (revision 0) +++ forgon-core/src/main/java/com/forgon/workflow/model/NodeDefinition.java (revision 21786) @@ -0,0 +1,107 @@ +package com.forgon.workflow.model; + +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 节点定义 + * @author zql + * + */ +@Entity +@Table +public class NodeDefinition { + private Long id; + + /** + * 节点名字 + * */ + private String name; + + /** + * 所属流程 + * */ + private WorkFlow workFlow; + + /** + * 顺序号 + * */ + private int sequenceNumber; + + /** + * 是否回退 + * */ + private Boolean allowRollback; + + /** + * 是否支持不同意 + * */ + private Boolean allowDisagree; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn + public WorkFlow getWorkFlow() { + return workFlow; + } + + public void setWorkFlow(WorkFlow workFlow) { + this.workFlow = workFlow; + } + + public int getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(int sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + public Boolean getAllowRollback() { + return allowRollback; + } + + public void setAllowRollback(Boolean allowRollback) { + this.allowRollback = allowRollback; + } + + public Boolean getAllowDisagree() { + return allowDisagree; + } + + public void setAllowDisagree(Boolean allowDisagree) { + this.allowDisagree = allowDisagree; + } + + +} Index: forgon-core/src/main/java/com/forgon/workflow/model/WorkFlow.java =================================================================== diff -u --- forgon-core/src/main/java/com/forgon/workflow/model/WorkFlow.java (revision 0) +++ forgon-core/src/main/java/com/forgon/workflow/model/WorkFlow.java (revision 21786) @@ -0,0 +1,137 @@ +package com.forgon.workflow.model; + +import java.util.Date; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 流程定义 + * @author zql + * + */ +@Entity +@Table +@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) +public class WorkFlow { + + private Long id; + + /** + * 流程名字 + * */ + private String workFlowName; + + /** + * 单类型 + * */ + private String invoicePlanType; + + /** + * false:草稿版 true:正式版 + * */ + private Boolean status=false; + + /** + * 创建时间 + * */ + private Date createTime; + + /** + * 创建人 + * */ + private String createrName; + + /** + * 最后修改人 + * */ + private String lastUpdaterName; + + /** + * 最后修改时间 + * */ + private Date lastUpdateTime; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getWorkFlowName() { + return workFlowName; + } + + public void setWorkFlowName(String workFlowName) { + this.workFlowName = workFlowName; + } + + public String getCreaterName() { + return createrName; + } + + public void setCreaterName(String createrName) { + this.createrName = createrName; + } + + public String getInvoicePlanType() { + return invoicePlanType; + } + + public void setInvoicePlanType(String invoicePlanType) { + this.invoicePlanType = invoicePlanType; + } + + public Boolean getStatus() { + return status; + } + + public void setStatus(Boolean status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getLastUpdaterName() { + return lastUpdaterName; + } + + public void setLastUpdaterName(String lastUpdaterName) { + this.lastUpdaterName = lastUpdaterName; + } + + public Date getLastUpdateTime() { + return lastUpdateTime; + } + + public void setLastUpdateTime(Date lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + } + + + + +} Index: forgon-core/src/main/java/com/forgon/workflow/model/WorkFlowApprovalTask.java =================================================================== diff -u --- forgon-core/src/main/java/com/forgon/workflow/model/WorkFlowApprovalTask.java (revision 0) +++ forgon-core/src/main/java/com/forgon/workflow/model/WorkFlowApprovalTask.java (revision 21786) @@ -0,0 +1,227 @@ +package com.forgon.workflow.model; + +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; + +import com.fasterxml.jackson.annotation.JsonIgnore; + + +/** + * 待处理任务 + * @author zql + * + */ +@Entity +@Table +public class WorkFlowApprovalTask { + private Long id; + + /** + * 工单号id + **/ + private Long formId; + + /** + * 工单类型 + **/ + private String formType; + + /** + * 节点:获取方便 任务名称的赋值 不能延迟 + * */ + private NodeDefinition nodeDefinition; + + /** + * 标题 + * */ + private String title; + + /** + * 任务生成时间 + * */ + private Date createTaskTime; + + /** + * 任务名称 + * */ + private String taskName; + + /** + * 实际处理人id + * */ + private Long handlerId; + + /** + * 实际处理人 + * */ + private String handler; + + /** + * 处理时间 + * */ + private Date handleTime; + + /** + * 处理状态: 0(已处理) 1(未处理) -1(默认) + * */ + private int status; + + /** + * 审批结果: 0(通过) 1(未通过) -1(默认) + * */ + private int approvalResult; + + /** + * 处理意见 + * */ + private String handleOpinion; + + /** + * 待处理角色id + * */ + private Long roleId; + + /** + * 待处理用户id + * */ + private Long userId; + + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getFormId() { + return formId; + } + + public void setFormId(Long formId) { + this.formId = formId; + } + + public String getFormType() { + return formType; + } + + public void setFormType(String formType) { + this.formType = formType; + } + + @ManyToOne + @JoinColumn + public NodeDefinition getNodeDefinition() { + return nodeDefinition; + } + + public void setNodeDefinition(NodeDefinition nodeDefinition) { + this.nodeDefinition = nodeDefinition; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title =title; + } + + public Date getCreateTaskTime() { + return createTaskTime; + } + + public void setCreateTaskTime(Date createTaskTime) { + this.createTaskTime = createTaskTime; + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + if(taskName==null) + this.taskName = nodeDefinition.getName(); + this.taskName =taskName; + } + + public Long getHandlerId() { + return handlerId; + } + + public void setHandlerId(Long handlerId) { + this.handlerId = handlerId; + } + + public String getHandler() { + return handler; + } + + public void setHandler(String handler) { + this.handler = handler; + } + + public Date getHandleTime() { + return handleTime; + } + + public void setHandleTime(Date handleTime) { + this.handleTime = handleTime; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getApprovalResult() { + return approvalResult; + } + + public void setApprovalResult(int approvalResult) { + this.approvalResult = approvalResult; + } + + public String getHandleOpinion() { + return handleOpinion; + } + + public void setHandleOpinion(String handleOpinion) { + this.handleOpinion = handleOpinion; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } +}