作者 tangxvhui

调整任务排序

... ... @@ -1185,7 +1185,6 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
nowTime := time.Now().Unix()
for _, val := range taskListData {
tk := adapter.TaskItem{
Id: val.TaskId,
... ... @@ -1197,7 +1196,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
WarnFlag: 0,
WarnFlag: val.WarnFlag,
LastStage: adapter.TaskStage{
Id: val.LastStage.Id,
Name: val.LastStage.Name,
... ... @@ -1226,12 +1225,12 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
if val.CurrentStage.RealCompletedAt > 0 {
tk.CurrentStage.RealCompletedAt = time.Unix(int64(val.CurrentStage.RealCompletedAt), 0).Local().Format("2006-01-02")
}
if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {
tk.WarnFlag = int(domain.TaskWarn)
}
if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {
tk.WarnFlag = int(domain.TaskWarn)
}
// if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {
// tk.WarnFlag = int(domain.TaskWarn)
// }
// if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {
// tk.WarnFlag = int(domain.TaskWarn)
// }
_, stageList, err := taskStageRepo.Find(map[string]interface{}{
"taskId": val.TaskId,
})
... ... @@ -1468,7 +1467,6 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
nowTime := time.Now().Unix()
for _, val := range taskListData {
tk := adapter.TaskItem{
Id: val.TaskId,
... ... @@ -1480,7 +1478,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
LevelName: val.LevelName,
UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
Anomaly: val.Anomaly,
WarnFlag: 0,
WarnFlag: val.WarnFlag,
LastStage: adapter.TaskStage{
Id: val.LastStage.Id,
Name: val.LastStage.Name,
... ... @@ -1505,12 +1503,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
if val.CurrentStage.RealCompletedAt > 0 {
tk.CurrentStage.RealCompletedAt = time.Unix(int64(val.CurrentStage.RealCompletedAt), 0).Local().Format("2006-01-02")
}
if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {
tk.WarnFlag = int(domain.TaskWarn)
}
if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {
tk.WarnFlag = int(domain.TaskWarn)
}
// if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {
// tk.WarnFlag = int(domain.TaskWarn)
// }
// if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {
// tk.WarnFlag = int(domain.TaskWarn)
// }
_, stageList, err := taskStageRepo.Find(map[string]interface{}{
"taskId": val.TaskId,
})
... ...
... ... @@ -2,6 +2,7 @@ package dao
import (
"fmt"
"strconv"
"time"
"github.com/go-pg/pg/v10"
... ... @@ -319,7 +320,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id
where t_task_ignore.id isnull and task.deleted_at isnull
and task_anomaly.company_id = ?
and task.related_user@> ? `
and task.related_user@> ?
and task.leader->>'id' <> ?
`
sqlStr2 := ` with t_task_ignore as (
select task_ignore.id ,task_ignore.task_id
... ... @@ -331,9 +334,10 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id
where t_task_ignore.id isnull and task.deleted_at isnull
and task_anomaly.company_id = ?
and task.related_user@> ? `
and task.related_user@> ?
and task.leader->>'id' <> ? `
condition := []interface{}{userId, companyId, fmt.Sprintf("[%d]", userId)}
condition := []interface{}{userId, companyId, fmt.Sprintf("[%d]", userId), strconv.Itoa(userId)}
if len(dayTime) > 0 {
condition = append(condition, dayTime)
sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
... ...
... ... @@ -572,7 +572,9 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
where 1=1
)select *
from t_task_1
order by t_task_1.status, t_task_1.sort_by_1,
order by t_task_1.status,
t_task_1.warn_flag
t_task_1.sort_by_1,
t_task_1.anomaly desc,
t_task_1.sort_by,t_task_1."created_at"
limit ? offset ?
... ... @@ -655,7 +657,9 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
where 1=1
)select *
from tt_task_1
order by tt_task_1.status,tt_task_1.sort_by_1,
order by tt_task_1.status,
tt_task_1.warn_flag,
tt_task_1.sort_by_1,
tt_task_1.anomaly desc,
tt_task_1.sort_by,tt_task_1."created_at"
limit ? offset ?
... ... @@ -866,7 +870,9 @@ func (d *TaskDao) ListTaskByHrbpV3(param ListTaskCondition) ([]ListTask, error)
where 1=1
)select *
from t_task_1
order by t_task_1.status, t_task_1.sort_by_1,
order by t_task_1.status,
t_task_1.warn_flag,
t_task_1.sort_by_1,
t_task_1.anomaly desc,
t_task_1.sort_by,t_task_1."created_at"
limit ? offset ?
... ...