feat: redis支持工单流程审批

This commit is contained in:
meilin.huang
2024-03-02 19:08:19 +08:00
parent 76475e807e
commit 49d3f988c9
93 changed files with 1107 additions and 1014 deletions

View File

@@ -7,18 +7,19 @@ import (
"mayfly-go/pkg/logx"
)
// 流程业务处理函数(流程结束后会根据流程业务类型获取该函数进行处理)
// @param procinstStatus 流程实例状态
// @param bizKey 业务key可为业务数据对应的主键
// type FlowBizHandlerFunc func(ctx context.Context, procinstStatus entity.ProcinstStatus, bizKey string) error
type BizHandleParam struct {
BizType string //业务类型
BizKey string // 业务key
BizForm string // 业务表单信息
ProcinstStatus entity.ProcinstStatus // 业务状态
}
// 业务流程处理器(流程状态变更后会根据流程业务类型获取对应的处理器进行回调处理)
type FlowBizHandler interface {
// 业务流程处理函数
// @param procinstStatus 流程实例状态
// @param bizKey 业务key可为业务数据对应的主键
FlowBizHandle(ctx context.Context, procinstStatus entity.ProcinstStatus, bizKey string) error
// @param bizHandleParam 业务处理信息可获取实例状态、关联业务key等信息
FlowBizHandle(ctx context.Context, bizHandleParam *BizHandleParam) error
}
var (
@@ -32,11 +33,12 @@ func RegisterBizHandler(flowBizType string, handler FlowBizHandler) {
}
// 流程业务处理
func FlowBizHandle(ctx context.Context, flowBizType string, bizKey string, procinstStatus entity.ProcinstStatus) error {
func FlowBizHandle(ctx context.Context, bizHandleParam *BizHandleParam) error {
flowBizType := bizHandleParam.BizType
if handler, ok := handlers[flowBizType]; !ok {
logx.Warnf("flow biz handler not found: bizType=%s", flowBizType)
return errorx.NewBiz("业务流程处理器不存在")
return errorx.NewBiz("业务处理器不存在")
} else {
return handler.FlowBizHandle(ctx, procinstStatus, bizKey)
return handler.FlowBizHandle(ctx, bizHandleParam)
}
}