WiiCITMS/process/common/workflow_service.go
2025-11-07 14:14:34 +08:00

111 lines
3.2 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package common
import (
"WiiGoLibrary/apply/middle/process/v1"
"time"
)
// 工作流查询请求
type QueryWorkflowsRequest struct {
WorkflowName string // 工作流名称,模糊查询
WorkflowType int // 工作流类型,-1表示所有类型
IsActive bool // 是否只查询启用的工作流
Limit int // 分页参数,每页数量
Offset int // 分页参数,偏移量
}
// 工作流节点创建请求
type CreateNodeRequest struct {
WorkflowGuid string // 所属工作流ID
NodeName string // 节点名称
NodeType int // 节点类型
NodeOrder int // 节点顺序
ApproverType int // 审批人类型
ApproverValue string // 审批人值
ConditionExp string // 条件表达式
Description string // 节点描述
}
// 创建工作流请求
type CreateWorkflowRequest struct {
WorkflowName string // 工作流名称
WorkflowType int // 工作流类型
Description string // 工作流描述
CreatorGuid string // 创建人GUID
}
// 工作流实例查询请求
type QueryInstancesRequest struct {
WorkflowGuid string // 工作流ID可选
BusinessType int // 业务类型,-1表示所有类型
BusinessID string // 业务ID可选
InitiatorGuid string // 发起人ID可选
Status int // 状态,-1表示所有状态
Limit int // 分页参数,每页数量
Offset int // 分页参数,偏移量
}
// WorkflowModel 简化接口
type WorkflowModel interface {
GetGuid() string
}
// WorkflowNodeModel 简化接口
type WorkflowNodeModel interface {
GetGuid() string
GetType() int16
GetApproverType() int16
GetApproverValue() string
}
// WorkflowInstanceModel 简化接口
type WorkflowInstanceModel interface {
GetGuid() string
GetWorkflowGuid() string
GetCurrentNodeID() string
GetInitiatorGuid() string
GetStatus() int16
GetCreateTime() time.Time
GetUpdateTime() time.Time
GetCompletionTime() time.Time
}
// ApprovalRecordModel 简化接口
type ApprovalRecordModel interface {
GetGuid() string
GetStatus() int16
GetComment() string
GetApproverGuid() string
GetCreateTime() time.Time
GetActionTime() time.Time
}
// WorkflowService 工作流服务接口
// 这个接口会由oa包实现hr包通过这个接口调用oa包的功能
// 解除hr和oa包之间的循环依赖
type WorkflowService interface {
// 创建工作流
CreateWorkflow(params CreateWorkflowRequest) (WorkflowModel, *process.Process)
// 查询工作流列表
QueryWorkflows(params QueryWorkflowsRequest) ([]WorkflowModel, *process.Process)
// 创建工作流节点
CreateWorkflowNode(params CreateNodeRequest) (WorkflowNodeModel, *process.Process)
// 启动工作流实例
StartWorkflowInstance(params CreateInstanceRequest, checkPermission bool) (WorkflowInstanceModel, *process.Process)
// 查询工作流实例
QueryWorkflowInstances(params QueryInstancesRequest) ([]WorkflowInstanceModel, *process.Process)
// 查询审批历史
QueryApprovalHistory(instanceGuid string) ([]ApprovalRecordModel, *process.Process)
// 权限检查
CheckPermission(staffGuid string, operation string, instanceGuid string) *process.Process
}
// 全局工作流服务实例
var WorkflowSvc WorkflowService