service/erp/workflow.go

85 lines
2.9 KiB
Go
Raw Normal View History

2024-08-01 14:51:51 +08:00
package erp
import (
"context"
"git.kumo.work/shama/service/client"
2024-08-08 10:50:16 +08:00
workflow2 "git.kumo.work/shama/service/erp/workflow"
"git.kumo.work/shama/service/lib/bean"
"time"
2024-08-01 14:51:51 +08:00
)
type workflow struct {
2024-08-08 10:50:16 +08:00
workflow2.Workflow
2024-08-01 14:51:51 +08:00
}
2024-08-08 10:50:16 +08:00
type ArgsWorkflowList struct {
Page bean.Page
Search WorkflowSearch
2024-08-01 14:51:51 +08:00
}
2024-08-08 10:50:16 +08:00
type WorkflowSearch struct {
BusinessId int64 // 业务id
BusinessType string
Status AuditStatus
}
type ReplyWorkflowList struct {
List []WorkflowItem
Total int64
}
type WorkflowItem struct {
Id int64 `json:"id"` // 审批流id
BusinessId int64 `json:"businessId"` // 业务id
BusinessType string `json:"businessType"` // 业务类型
BusinessName string `json:"businessName"` // 业务名称
Title string `json:"title"` // 审批流标题
Content string `json:"content"` // 审批流内容
Status AuditStatus `json:"status"` // 审批流状态
CreatedStaffId int64 `json:"createdStaffId"` // 创建人
CreatedAt *time.Time `json:"createdAt"` // 创建时间
}
// List @TITLE 审核列表
func (w *workflow) List(ctx context.Context, args ArgsWorkflowList) (reply ReplyWorkflowList, err error) {
2024-08-01 14:51:51 +08:00
xClient, err := client.GetClient(w)
if err != nil {
return
}
2024-08-08 10:50:16 +08:00
err = xClient.Call(ctx, "List", args, &reply)
2024-08-01 14:51:51 +08:00
return
}
2024-08-08 10:50:16 +08:00
type ReplyWorkflowInfo struct {
Id int64 `json:"id"` // 审批流id
BusinessId int64 `json:"businessId"` // 业务id
BusinessType string `json:"businessType"` // 业务类型
BusinessName string `json:"businessName"` // 业务名称
Title string `json:"title"` // 审批流标题
Content string `json:"content"` // 审批流内容
Status AuditStatus `json:"status"` // 审批流状态
CreatedStaffId int64 `json:"createdStaffId"` // 创建人
CreatedAt *time.Time `json:"createdAt"` // 创建时间
Nodes []WorkflowNodeItem `json:"nodes"`
}
type WorkflowNodeItem struct {
Id int64 `json:"id"` // 审批流节点id
Status AuditStatus `json:"status"` // 审批流节点状态
ReviewStaffId int64 `json:"reviewStaffId"` // 审批流节点审核人
ReviewAt *time.Time `json:"reviewAt"` // 审批流节点审核时间
ReviewComments string `json:"reviewComments"` // 审批流节点审核意见
Index int64 `json:"index"` // 审批流节点顺序
}
type ArgsWorkflowInfo struct {
WorkflowId int64 // 审批流id
WorkflowNodeId int64 // 审批流节点
2024-08-01 14:51:51 +08:00
}
2024-08-08 10:50:16 +08:00
// Info @TITLE 审核详情
func (w *workflow) Info(ctx context.Context, args ArgsWorkflowInfo) (reply ReplyWorkflowInfo, err error) {
2024-08-01 14:51:51 +08:00
xClient, err := client.GetClient(w)
if err != nil {
return
}
2024-08-08 10:50:16 +08:00
err = xClient.Call(ctx, "Info", args, &reply)
2024-08-01 14:51:51 +08:00
return
}