pixel
5 years ago
10 changed files with 319 additions and 28 deletions
-
25QMPlusServer/controller/api/workFlow.go
-
86QMPlusServer/docs/docs.go
-
84QMPlusServer/docs/swagger.json
-
58QMPlusServer/docs/swagger.yaml
-
1QMPlusServer/init/initRouter/initRouter.go
-
11QMPlusServer/init/registTable/registTable.go
-
18QMPlusServer/model/dbModel/application.go
-
36QMPlusServer/model/dbModel/worfFlow.go
-
14QMPlusServer/model/dbModel/workFlowProcess.go
-
14QMPlusServer/router/workflow.go
@ -0,0 +1,25 @@ |
|||||
|
package api |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
"github.com/gin-gonic/gin" |
||||
|
"main/controller/servers" |
||||
|
"main/model/dbModel" |
||||
|
) |
||||
|
|
||||
|
// @Tags workflow
|
||||
|
// @Summary 注册工作流
|
||||
|
// @Produce application/json
|
||||
|
// @Param data body dbModel.Workflow true "注册工作流接口"
|
||||
|
// @Success 200 {string} json "{"success":true,"data":{},"msg":"注册成功"}"
|
||||
|
// @Router /workflow/createWorkFlow [post]
|
||||
|
func CreateWorkFlow(c *gin.Context) { |
||||
|
var wk dbModel.Workflow |
||||
|
_ = c.ShouldBind(&wk) |
||||
|
err := wk.Create() |
||||
|
if err != nil { |
||||
|
servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{}) |
||||
|
} else { |
||||
|
servers.ReportFormat(c, true, "获取成功", gin.H{}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package dbModel |
||||
|
|
||||
|
import ( |
||||
|
"github.com/jinzhu/gorm" |
||||
|
"time" |
||||
|
) |
||||
|
|
||||
|
//申请model 工作流实例
|
||||
|
|
||||
|
type Application struct { |
||||
|
gorm.Model |
||||
|
WorkFlowID string // 所属工作流ID
|
||||
|
WorkFlowStepInfoID string // 当前节点ID
|
||||
|
ApplicationName string // 申请人姓名
|
||||
|
ApplicationCause string // 请假原因
|
||||
|
ApplicationStartData time.Time // 请假开始日期
|
||||
|
ApplicationEndData time.Time // 请假开始日期
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package dbModel |
||||
|
|
||||
|
import "github.com/jinzhu/gorm" |
||||
|
|
||||
|
// 工作流流转表
|
||||
|
type WorkFlowProcess struct { |
||||
|
gorm.Model |
||||
|
ApplicationID uint // 当前工作流所属申请的ID
|
||||
|
CurrentNode string // 当前进度节点
|
||||
|
HistoricalNode string //上一个进度节点
|
||||
|
CurrentUser string // 当前进度操作人
|
||||
|
HistoricalUser string // 上一个进度的操作人
|
||||
|
State bool // 状态 是否是正在进行的状态
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package router |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gin-gonic/gin" |
||||
|
"main/controller/api" |
||||
|
) |
||||
|
|
||||
|
func InitWorkflowRouter(Router *gin.Engine) { |
||||
|
WorkflowRouter := Router.Group("workflow") |
||||
|
//.Use(middleware.JWTAuth())
|
||||
|
{ |
||||
|
WorkflowRouter.POST("createWorkFlow", api.CreateWorkFlow) // 创建工作流
|
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue