作者 tangxvhui

调整 任务列表数据输出

... ... @@ -15,4 +15,5 @@ type TaskItem struct {
StageE TaskStage `json:"stageE"` // 里程碑5
UpdatedAt string `json:"updatedAt"` //
Anomaly int `json:"anomaly"` //异常反馈情况
WarnFlag int `json:"warnFlag"` //里程碑完成时间异常标记 0:正常 1标记为异常
}
... ...
... ... @@ -578,6 +578,7 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
Level: val.Level,
LevelName: val.LevelName,
Anomaly: val.Anomaly,
WarnFlag: int(val.WarnFlag),
// StageA: adapter.TaskStage{},
// StageB: adapter.TaskStage{},
// StageC: adapter.TaskStage{},
... ... @@ -726,12 +727,9 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
Status: val.TaskStatus,
Level: val.Level,
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
// StageA: adapter.TaskStage{},
// StageB: adapter.TaskStage{},
// StageC: adapter.TaskStage{},
// StageD: adapter.TaskStage{},
// StageE: adapter.TaskStage{},
WarnFlag: val.WarnFlag,
}
taskMapResult[val.TaskId] = &tk
taskResult = append(taskResult, &tk)
... ... @@ -836,7 +834,9 @@ func (srv TaskService) listTask2ForHrbp(param *command.SearchTaskCommand) (map[s
Status: val.TaskStatus,
Level: val.Level,
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
WarnFlag: val.WarnFlag,
// StageA: adapter.TaskStage{},
// StageB: adapter.TaskStage{},
// StageC: adapter.TaskStage{},
... ...
... ... @@ -24,17 +24,17 @@ type Task struct {
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt"`
CompanyId int `json:"companyId,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
Leader TaskLeader `json:"leader"` // 任务负责人
Status TaskState `json:"status"` // 任务的状态
Level int `json:"level"` // 优先级,值越小优先级越高
LevelName string `json:"levelName"` // 优先级名称
RelatedUser []int `json:"relatedUser"` // 相关的员工id
RunAt int64 `json:"runAt"` // 启动的时间戳,秒
StopAt int64 `json:"stopAt"` // 停止的时间戳,秒
Anomaly int `json:"anomaly"` // 异常反馈的次数
WarnFlag TaskWarnFlag `json:"stageAnomaly"` // 里程碑异常标记
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
Leader TaskLeader `json:"leader"` // 任务负责人
Status TaskState `json:"status"` // 任务的状态
Level int `json:"level"` // 优先级,值越小优先级越高
LevelName string `json:"levelName"` // 优先级名称
RelatedUser []int `json:"relatedUser"` // 相关的员工id
RunAt int64 `json:"runAt"` // 启动的时间戳,秒
StopAt int64 `json:"stopAt"` // 停止的时间戳,秒
Anomaly int `json:"anomaly"` // 异常反馈的次数
WarnFlag TaskWarnFlag `json:"warnFlag"` // 里程碑异常标记
}
type TaskLeader struct {
... ...
... ... @@ -80,6 +80,7 @@ type ListTaskStage struct {
LevelName string `pg:"level_name"`
Level int `pg:"level"`
Anomaly int `pg:"anomaly"`
WarnFlag int `pg:"warn_flag"`
UpdatedAt time.Time `pg:"updated_at"`
CreatedAt time.Time `pg:"created_at"`
StageId int `pg:"stage_id"`
... ... @@ -109,6 +110,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
task.updated_at ,
task.created_at ,
task."level" ,
task."warn_flag",
task."status" as task_status,
task_stage."id" as stage_id,
task_stage."name" as stage_name,
... ... @@ -148,7 +150,8 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
t_task_tage_1.real_completed_at,
t_task_tage_1.stage_name,
t_task_tage_1.stage_id,
t_task_tage_1.stage_sort_by
t_task_tage_1.stage_sort_by,
t_task_tage_1."warn_flag"
from t_task_tage_1
where t_task_tage_1.task_id in(
select t_task_page.task_id from t_task_page
... ... @@ -229,6 +232,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
task.level_name ,
task.anomaly ,
task.updated_at ,
task."warn_flag",
task.created_at ,
task."level" ,
task_stage."id" as stage_id,
... ... @@ -270,6 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
t_task_tage_1.real_completed_at,
t_task_tage_1.stage_name,
t_task_tage_1.stage_id,
t_task_tage_1."warn_flag",
t_task_tage_1.stage_sort_by
from t_task_tage_1
where t_task_tage_1.task_id in(
... ... @@ -305,7 +310,7 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
withSql := `with
t_task_ignore as (
select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
)select count(*) from task
left join t_task_ignore on t_task_ignore.task_id=task.id
where 1=1 `
... ...
... ... @@ -23,6 +23,6 @@ type Task struct {
RelatedUser []int `pg:"related_user"` //
RunAt int64 `pg:"run_at"` // 启动的时间
StopAt int64 `pg:"stop_at"` // 停止的时间
Anomaly int `json:"anomaly"` // 异常反馈的数量
Anomaly int `pg:"anomaly"` // 异常反馈的数量
WarnFlag int `pg:"warn_flag"` // 里程碑异常标记
}
... ...
... ... @@ -40,6 +40,7 @@ func (repo *TaskRepository) TransformToDomain(d *models.Task) *domain.Task {
RunAt: d.RunAt,
StopAt: d.StopAt,
Anomaly: d.Anomaly,
WarnFlag: domain.TaskWarnFlag(d.WarnFlag),
}
}
... ... @@ -55,15 +56,16 @@ func (repo *TaskRepository) Save(param *domain.Task) error {
DeletedAt: param.DeletedAt,
Name: param.Name,
Alias: param.Alias,
CompanyId: param.CompanyId,
Leader: param.Leader,
Status: int(param.Status),
Level: param.Level,
LevelName: param.LevelName,
RelatedUser: param.RelatedUser,
RunAt: param.RunAt,
CompanyId: param.CompanyId,
StopAt: param.StopAt,
Anomaly: param.Anomaly,
WarnFlag: int(param.WarnFlag),
}
db := repo.transactionContext.PgTx
if m.Id == 0 {
... ...