approveflow/app/provider/flow_instance/model/approval_reversal.go

36 lines
1.2 KiB
Go

package model
import "approveflow/app/base"
// ApprovalReversal 审批反转表
type ApprovalReversal struct {
InstanceID int64 `gorm:"index;not null" json:"instance_id"` // 关联的审批实例ID
StepID int64 `gorm:"index;not null" json:"step_id"` // 关联的步骤ID
ReversedStepID int64 `gorm:"index;not null" json:"reversed_step_id"` // 反转的步骤ID
FixAction string `gorm:"type:varchar(100);not null" json:"fix_action"` // 修正动作
Reason string `gorm:"type:text" json:"reason"` // 反转原因
base.Model
}
// ReverseStep 执行步骤的反转操作
func (reversal *ApprovalReversal) ReverseStep(step *InstanceStep, reason string) error {
reversal.InstanceID = step.InstanceID
reversal.StepID = step.StepID
reversal.ReversedStepID = step.ID
reversal.Reason = reason
reversal.FixAction = "Reversal"
// 更新步骤状态为反转
step.Status = "Reversed"
return nil
}
// FixIssue 执行修正操作
func (reversal *ApprovalReversal) FixIssue(instance *ApprovalInstance, action, reason string) error {
reversal.InstanceID = instance.ID
reversal.FixAction = action
reversal.Reason = reason
// 根据修正动作进行修正逻辑
return nil
}