70 lines
2.4 KiB
Go
70 lines
2.4 KiB
Go
package task
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gitea.com/red-future/common/beans"
|
|
)
|
|
|
|
type baseTaskCol struct {
|
|
beans.SQLBaseCol
|
|
TaskType string
|
|
Status string
|
|
Priority string
|
|
ParentTaskID string
|
|
TotalItems string
|
|
ProcessedItems string
|
|
Progress string
|
|
StartTime string
|
|
EndTime string
|
|
Duration string
|
|
SuccessCount string
|
|
FailCount string
|
|
Executor string
|
|
DocumentID string
|
|
Remark string
|
|
}
|
|
|
|
var BaseTaskCol = baseTaskCol{
|
|
SQLBaseCol: beans.DefSQLBaseCol,
|
|
TaskType: "task_type",
|
|
Status: "status",
|
|
Priority: "task_priority",
|
|
ParentTaskID: "parent_task_id",
|
|
TotalItems: "total_items",
|
|
ProcessedItems: "processed_items",
|
|
Progress: "progress",
|
|
StartTime: "start_time",
|
|
EndTime: "end_time",
|
|
Duration: "duration",
|
|
SuccessCount: "success_count",
|
|
FailCount: "fail_count",
|
|
Executor: "executor",
|
|
DocumentID: "document_id",
|
|
Remark: "remark",
|
|
}
|
|
|
|
// SQLBaseTask 任务基类 - SQL版本
|
|
type SQLBaseTask struct {
|
|
beans.SQLBaseDO `orm:",inline"`
|
|
// 任务核心信息
|
|
TaskType TaskType `orm:"task_type" json:"taskType" dc:"任务类型"`
|
|
Status TaskStatus `orm:"status" json:"status" dc:"任务状态"`
|
|
Priority TaskPriority `orm:"task_priority" json:"priority,omitempty" dc:"任务优先级"`
|
|
ParentTaskID int64 `orm:"parent_task_id" json:"parentTaskId,omitempty" dc:"父任务ID"`
|
|
// 任务进度
|
|
TotalItems int64 `orm:"total_items" json:"totalItems" dc:"总数"`
|
|
ProcessedItems int64 `orm:"processed_items" json:"processedItems" dc:"已处理数"`
|
|
Progress float64 `orm:"progress" json:"progress" dc:"进度"` // 0~100 百分比
|
|
// 任务结果
|
|
StartTime *time.Time `orm:"start_time" json:"startTime" dc:"开始时间"`
|
|
EndTime *time.Time `orm:"end_time" json:"endTime,omitempty" dc:"结束时间"`
|
|
Duration int64 `orm:"duration" json:"duration,omitempty" dc:"耗时(毫秒)"`
|
|
SuccessCount int64 `orm:"success_count" json:"successCount" dc:"成功数"`
|
|
FailCount int64 `orm:"fail_count" json:"failCount" dc:"失败数"`
|
|
// 其他
|
|
Executor string `orm:"executor" json:"executor,omitempty" dc:"执行器标识"`
|
|
DocumentID int64 `orm:"document_id" json:"documentId,omitempty" dc:"文档ID"`
|
|
Remark string `orm:"remark" json:"remark,omitempty" dc:"备注/错误信息"`
|
|
}
|