wf_process.go 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. package model
  2. import (
  3. "gin-vue-admin/global"
  4. "gorm.io/gorm"
  5. "time"
  6. )
  7. type GVA_Workflow interface {
  8. CreateWorkflow(WorkflowNode,GVA_Workflow)
  9. GetBusinessType()string
  10. }
  11. type WorkflowFunc struct {
  12. BusinessType string
  13. }
  14. func(w *WorkflowFunc)CreateWorkflow(node WorkflowNode,businessModel GVA_Workflow){
  15. }
  16. func(w *WorkflowFunc)GetBusinessType()(businessType string){
  17. return w.BusinessType
  18. }
  19. //定义clazz常量
  20. const (
  21. USER_TASK string = "userTask"
  22. SCRIPT_TASK string = "scriptTask"
  23. RECEIVE_TASK string = "receiveTask"
  24. MAIL_TASK string = "mailTask"
  25. TIMER_START string = "timerStart"
  26. MESSAGE_START string = "messageStart"
  27. GATEWAY string = "gateway"
  28. FLOW string = "flow"
  29. START string = "start"
  30. END string = "end"
  31. PROCESS string = "process"
  32. )
  33. type WorkflowMove struct {
  34. global.GVA_MODEL
  35. WorkflowProcessID string `json:"workflowProcessID" gorm:"comment:工作流模板ID"`
  36. BusinessType string `json:"businessType" gorm:"comment:业务标记"`
  37. BusinessID uint `json:"businessID" gorm:"comment:业务ID"`
  38. WorkflowMoveInfo []WorkflowMoveInfo `json:"workflowMoveInfo" gorm:"comment:当前流转详情"`
  39. Promoter uint `json:"Promoter" gorm:"comment:当前流转发起人"`
  40. }
  41. type WorkflowMoveInfo struct {
  42. global.GVA_MODEL
  43. WorkflowMoveID uint `json:"workflowMoveID" gorm:"comment:关联WorkflowMove"`
  44. WorkflowNodeID string `json:"workflowNodeID" gorm:"comment:流程节点ID"`
  45. Params string `json:"params" gorm:"comment:流转参数"`
  46. Description string `json:"description" gorm:"comment:流转说明"`
  47. Status int `json:"status" gorm:"comment:流转状态(来自字典 0为进行中)"`
  48. }
  49. type WorkflowProcess struct {
  50. ID string `json:"id" form:"id" gorm:"comment:流程标识;primaryKey;unique;not null"`
  51. CreatedAt time.Time
  52. UpdatedAt time.Time
  53. DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
  54. Name string `json:"name" gorm:"comment:流程名称"`
  55. Category string `json:"category" gorm:"comment:分类"`
  56. Clazz string `json:"clazz" gorm:"comment:类型"`
  57. Label string `json:"label" gorm:"comment:流程标题"`
  58. HideIcon bool `json:"hideIcon" gorm:"comment:是否隐藏图标"`
  59. Description string `json:"description" gorm:"comment:详细介绍"`
  60. View string `json:"view" gorm:"comment:前端视图文件"`
  61. Nodes []WorkflowNode `json:"nodes"` // 流程节点数据
  62. Edges []WorkflowEdge `json:"edges"` // 流程链接数据
  63. }
  64. type WorkflowNode struct {
  65. ID string `json:"id" form:"id" gorm:"comment:节点id;primaryKey;unique;not null"`
  66. CreatedAt time.Time
  67. UpdatedAt time.Time
  68. DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
  69. WorkflowProcessID string `json:"-" gorm:"comment:流程标识"`
  70. Clazz string `json:"clazz" gorm:"comment:节点类型"`
  71. Label string `json:"label" gorm:"comment:节点名称"`
  72. Type string `json:"type" gorm:"comment:图标类型"`
  73. Shape string `json:"shape" gorm:"comment:形状"`
  74. Description string `json:"description" gorm:"comment:详细介绍"`
  75. View string `json:"view" gorm:"comment:前端视图文件"`
  76. X float64 `json:"y" gorm:"comment:x位置"`
  77. Y float64 `json:"x" gorm:"comment:y位置"`
  78. WaitState string `json:"waitState" gorm:"comment:等待属性"`
  79. StateValue string `json:"stateValue" gorm:"comment:等待值"`
  80. To string `json:"to" gorm:"comment:收件人"`
  81. Subject string `json:"subject" gorm:"comment:标题"`
  82. Content string `json:"content" gorm:"comment:内容"`
  83. Cycle string `json:"cycle" gorm:"comment:循环时间"`
  84. Duration string `json:"duration" gorm:"comment:持续时间"`
  85. HideIcon bool `json:"hideIcon" gorm:"comment:是否隐藏图标"`
  86. DueDate time.Time `json:"dueDate" gorm:"comment:到期时间"`
  87. AssignType string `json:"assignType" gorm:"comment:审批类型"`
  88. AssignValue string `json:"assignValue" gorm:"comment:审批类型值"`
  89. Success bool `json:"success" gorm:"comment:是否成功"`
  90. }
  91. type WorkflowEdge struct {
  92. ID string `json:"id" form:"id" gorm:"comment:唯一标识;primaryKey;unique;not null"`
  93. CreatedAt time.Time
  94. UpdatedAt time.Time
  95. DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
  96. WorkflowProcessID string `json:"-" gorm:"comment:流程标识"`
  97. Clazz string `json:"clazz" gorm:"comment:类型(线)"`
  98. Source string `json:"source" gorm:"comment:起点节点"`
  99. Target string `json:"target" gorm:"comment:目标节点"`
  100. SourceAnchor int `json:"sourceAnchor" gorm:"comment:起点"`
  101. TargetAnchor int `json:"targetAnchor" gorm:"comment:目标点"`
  102. Description string `json:"description" gorm:"comment:详细介绍"`
  103. Shape string `json:"shape" gorm:"comment:形状"`
  104. StartPoint WorkflowStartPoint `json:"startPoint"` // 起点信息
  105. EndPoint WorkflowEndPoint `json:"endPoint"` // 终点信息
  106. Label string `json:"label" gorm:"comment:标题"`
  107. HideIcon bool `json:"hideIcon" gorm:"comment:隐藏图标"`
  108. ConditionExpression string `json:"conditionExpression" gorm:"comment:条件标识"`
  109. Seq string `json:"seq" gorm:"comment:序号"`
  110. Reverse bool `json:"reverse" gorm:"comment:是否反向"`
  111. }
  112. type WorkflowStartPoint struct {
  113. WorkflowEdgeID string
  114. WorkflowPoint
  115. }
  116. type WorkflowEndPoint struct {
  117. WorkflowEdgeID string
  118. WorkflowPoint
  119. }
  120. //
  121. type WorkflowPoint struct {
  122. global.GVA_MODEL
  123. X float64 `json:"x"`
  124. Y float64 `json:"y"`
  125. Index int `json:"index"`
  126. }