-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liuxinwang
committed
Sep 9, 2023
1 parent
1382c02
commit ab0e2a6
Showing
16 changed files
with
573 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/static/* | ||
conf.toml | ||
conf_local.toml | ||
/horizon.log | ||
/bin/ | ||
build.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package handler | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"horizon/service" | ||
) | ||
|
||
func WorkflowTemplateGet(c *gin.Context) { | ||
service.WorkflowTemplateSelectByList(c) | ||
} | ||
|
||
func WorkflowTemplatePost(c *gin.Context) { | ||
service.WorkflowTemplateInsert(c) | ||
} | ||
|
||
func WorkflowTemplatePut(c *gin.Context) { | ||
service.WorkflowTemplateUpdate(c) | ||
} | ||
|
||
func WorkflowTemplateDelete(c *gin.Context) { | ||
service.WorkflowTemplateDelete(c) | ||
} | ||
|
||
func WorkflowTemplateConfigPost(c *gin.Context) { | ||
service.WorkflowTemplateConfigInsert(c) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package model | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
type LocalTime time.Time | ||
|
||
func (t *LocalTime) MarshalJSON() ([]byte, error) { | ||
tTime := time.Time(*t) | ||
return []byte(fmt.Sprintf("\"%v\"", tTime.Format("2006-01-02 15:04:05"))), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,74 @@ | ||
package model | ||
|
||
import "time" | ||
import ( | ||
"database/sql" | ||
"time" | ||
) | ||
|
||
type workflowAuditStatus string | ||
type workflowStatus string | ||
|
||
const ( | ||
WorkflowStatusWaitForAudit workflowStatus = "wait_for_audit" | ||
WorkflowStatusWaitForExecution workflowStatus = "wait_for_execution" | ||
WorkflowStatusReject workflowStatus = "rejected" | ||
WorkflowStatusCancel workflowStatus = "canceled" | ||
WorkflowStatusExecuting workflowStatus = "executing" | ||
WorkflowStatusExecFailed workflowStatus = "exec_failed" | ||
WorkflowStatusFinish workflowStatus = "finished" | ||
WorkflowStatusPendingAudit workflowStatus = "PendingAudit" | ||
WorkflowStatusPendingExecution workflowStatus = "PendingExecution" | ||
WorkflowStatusRejected workflowStatus = "Rejected" | ||
WorkflowStatusCanceled workflowStatus = "Canceled" | ||
WorkflowStatusExecuting workflowStatus = "Executing" | ||
WorkflowStatusExecutionFailed workflowStatus = "ExecutionFailed" | ||
WorkflowStatusFinished workflowStatus = "Finished" | ||
|
||
FlowAuditStatusPendingAudit workflowAuditStatus = "PendingAudit" | ||
FlowAuditStatusPassed workflowAuditStatus = "Passed" | ||
FlowAuditStatusAuditRejected workflowAuditStatus = "Rejected" | ||
) | ||
|
||
type Workflow struct { | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
Name string `gorm:"type:varchar(50);not null;comment:名称" json:"name"` | ||
Describe string `gorm:"type:varchar(255);not null;comment:描述" json:"describe"` | ||
Status workflowStatus `gorm:"type:varchar(50);not null;default:'wait_for_audit';comment:状态" json:"status"` | ||
ProjId string `gorm:"type:varchar(20);not null;comment:项目ID" json:"projId"` | ||
InstId string `gorm:"type:varchar(20);not null;comment:实例ID" json:"instId"` | ||
DbName string `gorm:"type:varchar(255);not null;comment:数据库名" json:"dbName"` | ||
SqlContent string `gorm:"type:text;not null;comment:SQL内容" json:"sqlContent"` | ||
UserName string `gorm:"type:varchar(50);not null;comment:用户名" json:"userName"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
Name string `gorm:"type:varchar(50);not null;comment:名称" json:"name"` | ||
Describe string `gorm:"type:varchar(255);not null;comment:描述" json:"describe"` | ||
Status workflowStatus `gorm:"type:varchar(50);not null;default:'PendingAudit';comment:状态" json:"status"` | ||
ProjId string `gorm:"type:varchar(20);not null;comment:项目ID" json:"projId"` | ||
InstId string `gorm:"type:varchar(20);not null;comment:实例ID" json:"instId"` | ||
DbName string `gorm:"type:varchar(255);not null;comment:数据库名" json:"dbName"` | ||
SqlContent string `gorm:"type:text;not null;comment:SQL内容" json:"sqlContent"` | ||
UserName string `gorm:"type:varchar(50);not null;comment:用户名" json:"userName"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
WorkflowRecords []WorkflowRecord `gorm:"foreignKey:WorkflowId;references:ID" json:"workflowRecords"` | ||
} | ||
|
||
type WorkflowTemplate struct { | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
Code uint `gorm:"uniqueIndex:uniq_code;not null;comment:编号" json:"code"` | ||
Name string `gorm:"type:varchar(50);not null;comment:名称" json:"name"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
WorkflowTemplateDetails []WorkflowTemplateDetail `gorm:"foreignKey:WorkflowTemplateId;references:ID" json:"workflowTemplateDetails"` | ||
// Projects []Project `gorm:"foreignKey:WorkflowTemplateCode;references:Code" json:"projects"` | ||
} | ||
|
||
type WorkflowTemplateDetail struct { | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
WorkflowTemplateId uint `gorm:"not null;comment:工作流模版ID" json:"workflowTemplateId"` | ||
WorkflowTemplateCode uint `gorm:"not null;comment:工作流模版编号" json:"workflowTemplateCode"` | ||
SerialNumber uint `gorm:"not null;comment:工作流序号" json:"serialNumber"` | ||
NodeName string `gorm:"type:varchar(20);not null;comment:节点名称" json:"nodeName"` | ||
ProjectRoleId string `gorm:"type:varchar(50);not null;comment:项目角色ID" json:"projectRoleId"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
} | ||
|
||
type WorkflowRecord struct { | ||
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"` | ||
WorkflowId uint `gorm:"not null;comment:工单ID" json:"workflowId"` | ||
WorkflowTemplateCode uint `gorm:"not null;comment:工作流模版Code" json:"workflowTemplateCode"` | ||
FlowNodeName string `gorm:"type:varchar(20);not null;comment:节点名称" json:"flowNodeName"` | ||
FlowSerialNumber uint `gorm:"not null;comment:工作流序号" json:"flowSerialNumber"` | ||
AssigneeUserName string `gorm:"type:varchar(50);not null;comment:受理用户" json:"assigneeUserName"` | ||
HandledAt sql.NullTime `gorm:"type:datetime;default null;comment:处理时间" json:"handledAt"` | ||
Remarks string `gorm:"type:varchar(255);not null;comment:处理结果/备注" json:"remarks"` | ||
AuditStatus workflowAuditStatus `gorm:"type:varchar(50);not null;default:'PendingAudit';comment:状态" json:"auditStatus"` | ||
IsAudit uint `gorm:"not null;default:0;comment:审核标识(0:未审核,1:已审核)" json:"isAudit"` | ||
CreatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp;comment:创建时间" json:"createdAt"` | ||
UpdatedAt time.Time `gorm:"type:datetime;not null;default:current_timestamp on update current_timestamp;comment:修改时间" json:"updatedAt"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.