作者 tangxvhui

调整列表数据

package adapter
import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
type TaskItem struct {
Id int `json:"id,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
Leader string `json:"leader"` // 任务负责人
Status int `json:"status"` // 任务的状态
Level int `json:"level"` // 优先级,值越小优先级越高
LevelName string `json:"levelName"` // 优先级名称
StageA TaskStage `json:"stageA"` // 里程碑1
StageB TaskStage `json:"stageB"` // 里程碑2
StageC TaskStage `json:"stageC"` // 里程碑3
StageD TaskStage `json:"stageD"` // 里程碑4
StageE TaskStage `json:"stageE"` // 里程碑5
LastStage TaskStage `json:"lastStage"` //
CurrentStage TaskStage `json:"currentStage"` //
UpdatedAt string `json:"updatedAt"` //
Anomaly int `json:"anomaly"` //异常反馈情况
WarnFlag int `json:"warnFlag"` //里程碑完成时间异常标记 0:正常 1标记为异常
Id int `json:"id,string"`
Name string `json:"name"` // 任务名称
Alias string `json:"alias"` // 任务别名
Leader string `json:"leader"` // 任务负责人
Status int `json:"status"` // 任务的状态
StatusDescript string `json:"statusDescript"` //任务的整体状态描述
SortBy int `json:"level"` // 优先级,值越小优先级越高
LevelName string `json:"levelName"` // 任务分类名称
StageA TaskStage `json:"stageA"` // 里程碑1
StageB TaskStage `json:"stageB"` // 里程碑2
StageC TaskStage `json:"stageC"` // 里程碑3
StageD TaskStage `json:"stageD"` // 里程碑4
StageE TaskStage `json:"stageE"` // 里程碑5
LastStage TaskStage `json:"lastStage"` //
CurrentStage TaskStage `json:"currentStage"` //
UpdatedAt string `json:"updatedAt"` //
Anomaly int `json:"anomaly"` //异常反馈情况
WarnFlag int `json:"warnFlag"` //里程碑完成时间异常标记 0:正常 1标记为异常
}
func (t *TaskItem) GenStatusDescript() {
statusNamed := ""
if domain.TaskState(t.Status) == domain.TaskRunning {
statusNamed = "进行中"
}
if t.CurrentStage.Id == 0 && t.LastStage.PlanCompletedAt < t.LastStage.RealCompletedAt {
statusNamed = "逾期完成"
}
if t.CurrentStage.Id == 0 && t.LastStage.PlanCompletedAt >= t.LastStage.RealCompletedAt {
statusNamed = "如期完成"
}
if domain.TaskState(t.Status) == domain.TaskStop {
statusNamed = "已停止"
}
if domain.TaskWarnFlag(t.WarnFlag) == domain.TaskWarn {
statusNamed = "里程碑异常"
}
if t.Anomaly > 0 {
statusNamed = "反馈异常"
}
t.StatusDescript = statusNamed
}
... ...
... ... @@ -655,7 +655,7 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
Alias: val.Alias,
Leader: val.Leader.Name,
Status: int(val.Status),
Level: val.Level,
SortBy: int(val.SortBy),
LevelName: val.LevelName,
Anomaly: val.Anomaly,
WarnFlag: int(val.WarnFlag),
... ... @@ -1069,7 +1069,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
Alias: val.Alias,
Leader: val.LeaderName,
Status: val.Status,
Level: val.Level,
SortBy: val.SortBy,
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
... ... @@ -1135,6 +1135,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
tk.StageE = stage
}
}
tk.GenStatusDescript()
taskResult = append(taskResult, &tk)
}
result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
... ... @@ -1216,7 +1217,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
Alias: val.Alias,
Leader: val.LeaderName,
Status: val.Status,
Level: val.Level,
SortBy: val.SortBy,
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
... ... @@ -1228,7 +1229,6 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
SortBy: val.LastStage.SortBy,
PlanCompletedAt: time.Unix(int64(val.LastStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
RealCompletedAt: "",
IsRef: false,
},
CurrentStage: adapter.TaskStage{
Id: val.CurrentStage.Id,
... ... @@ -1237,7 +1237,6 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
SortBy: val.CurrentStage.SortBy,
PlanCompletedAt: time.Unix(int64(val.CurrentStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
RealCompletedAt: "",
IsRef: false,
},
}
if val.LastStage.RealCompletedAt > 0 {
... ... @@ -1283,6 +1282,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
tk.StageE = stage
}
}
tk.GenStatusDescript()
taskResult = append(taskResult, &tk)
}
result := tool_funs.SimpleWrapGridMap(int64(taskCount), taskResult)
... ... @@ -1388,7 +1388,7 @@ func (srv *TaskService) ListTaskIgnore(param *command.SearchTaskCommand) (result
Alias: val.Alias,
Leader: val.LeaderName,
Status: val.Status,
Level: val.Level,
SortBy: val.SortBy,
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
... ... @@ -1400,7 +1400,6 @@ func (srv *TaskService) ListTaskIgnore(param *command.SearchTaskCommand) (result
SortBy: val.LastStage.SortBy,
PlanCompletedAt: time.Unix(int64(val.LastStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
RealCompletedAt: "",
IsRef: false,
},
CurrentStage: adapter.TaskStage{
Id: val.CurrentStage.Id,
... ... @@ -1409,7 +1408,6 @@ func (srv *TaskService) ListTaskIgnore(param *command.SearchTaskCommand) (result
SortBy: val.CurrentStage.SortBy,
PlanCompletedAt: time.Unix(int64(val.CurrentStage.PlanCompletedAt), 0).Local().Format("2006-01-02"),
RealCompletedAt: "",
IsRef: false,
},
}
if val.LastStage.RealCompletedAt > 0 {
... ... @@ -1455,6 +1453,7 @@ func (srv *TaskService) ListTaskIgnore(param *command.SearchTaskCommand) (result
tk.StageE = stage
}
}
tk.GenStatusDescript()
taskResult = append(taskResult, &tk)
}
... ...