作者 tangxvhui

调整任务排序

@@ -1185,7 +1185,6 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1185,7 +1185,6 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1185 taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{ 1185 taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
1186 "transactionContext": transactionContext, 1186 "transactionContext": transactionContext,
1187 }) 1187 })
1188 - nowTime := time.Now().Unix()  
1189 for _, val := range taskListData { 1188 for _, val := range taskListData {
1190 tk := adapter.TaskItem{ 1189 tk := adapter.TaskItem{
1191 Id: val.TaskId, 1190 Id: val.TaskId,
@@ -1197,7 +1196,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1197,7 +1196,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1197 LevelName: val.LevelName, 1196 LevelName: val.LevelName,
1198 UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"), 1197 UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
1199 Anomaly: val.Anomaly, 1198 Anomaly: val.Anomaly,
1200 - WarnFlag: 0, 1199 + WarnFlag: val.WarnFlag,
1201 LastStage: adapter.TaskStage{ 1200 LastStage: adapter.TaskStage{
1202 Id: val.LastStage.Id, 1201 Id: val.LastStage.Id,
1203 Name: val.LastStage.Name, 1202 Name: val.LastStage.Name,
@@ -1226,12 +1225,12 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1226,12 +1225,12 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1226 if val.CurrentStage.RealCompletedAt > 0 { 1225 if val.CurrentStage.RealCompletedAt > 0 {
1227 tk.CurrentStage.RealCompletedAt = time.Unix(int64(val.CurrentStage.RealCompletedAt), 0).Local().Format("2006-01-02") 1226 tk.CurrentStage.RealCompletedAt = time.Unix(int64(val.CurrentStage.RealCompletedAt), 0).Local().Format("2006-01-02")
1228 } 1227 }
1229 - if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {  
1230 - tk.WarnFlag = int(domain.TaskWarn)  
1231 - }  
1232 - if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {  
1233 - tk.WarnFlag = int(domain.TaskWarn)  
1234 - } 1228 + // if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {
  1229 + // tk.WarnFlag = int(domain.TaskWarn)
  1230 + // }
  1231 + // if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {
  1232 + // tk.WarnFlag = int(domain.TaskWarn)
  1233 + // }
1235 _, stageList, err := taskStageRepo.Find(map[string]interface{}{ 1234 _, stageList, err := taskStageRepo.Find(map[string]interface{}{
1236 "taskId": val.TaskId, 1235 "taskId": val.TaskId,
1237 }) 1236 })
@@ -1468,7 +1467,6 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1468,7 +1467,6 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1468 taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{ 1467 taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
1469 "transactionContext": transactionContext, 1468 "transactionContext": transactionContext,
1470 }) 1469 })
1471 - nowTime := time.Now().Unix()  
1472 for _, val := range taskListData { 1470 for _, val := range taskListData {
1473 tk := adapter.TaskItem{ 1471 tk := adapter.TaskItem{
1474 Id: val.TaskId, 1472 Id: val.TaskId,
@@ -1480,7 +1478,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1480,7 +1478,7 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1480 LevelName: val.LevelName, 1478 LevelName: val.LevelName,
1481 UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"), 1479 UpdatedAt: val.UpdatedAt.Local().Format("2006-01-02 15:04:05"),
1482 Anomaly: val.Anomaly, 1480 Anomaly: val.Anomaly,
1483 - WarnFlag: 0, 1481 + WarnFlag: val.WarnFlag,
1484 LastStage: adapter.TaskStage{ 1482 LastStage: adapter.TaskStage{
1485 Id: val.LastStage.Id, 1483 Id: val.LastStage.Id,
1486 Name: val.LastStage.Name, 1484 Name: val.LastStage.Name,
@@ -1505,12 +1503,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1505,12 +1503,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1505 if val.CurrentStage.RealCompletedAt > 0 { 1503 if val.CurrentStage.RealCompletedAt > 0 {
1506 tk.CurrentStage.RealCompletedAt = time.Unix(int64(val.CurrentStage.RealCompletedAt), 0).Local().Format("2006-01-02") 1504 tk.CurrentStage.RealCompletedAt = time.Unix(int64(val.CurrentStage.RealCompletedAt), 0).Local().Format("2006-01-02")
1507 } 1505 }
1508 - if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {  
1509 - tk.WarnFlag = int(domain.TaskWarn)  
1510 - }  
1511 - if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {  
1512 - tk.WarnFlag = int(domain.TaskWarn)  
1513 - } 1506 + // if val.LastStage.Id > 0 && val.LastStage.PlanCompletedAt < val.LastStage.RealCompletedAt {
  1507 + // tk.WarnFlag = int(domain.TaskWarn)
  1508 + // }
  1509 + // if val.CurrentStage.Id > 0 && val.CurrentStage.PlanCompletedAt < nowTime {
  1510 + // tk.WarnFlag = int(domain.TaskWarn)
  1511 + // }
1514 _, stageList, err := taskStageRepo.Find(map[string]interface{}{ 1512 _, stageList, err := taskStageRepo.Find(map[string]interface{}{
1515 "taskId": val.TaskId, 1513 "taskId": val.TaskId,
1516 }) 1514 })
@@ -2,6 +2,7 @@ package dao @@ -2,6 +2,7 @@ package dao
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "strconv"
5 "time" 6 "time"
6 7
7 "github.com/go-pg/pg/v10" 8 "github.com/go-pg/pg/v10"
@@ -319,7 +320,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ @@ -319,7 +320,9 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
319 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id 320 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id
320 where t_task_ignore.id isnull and task.deleted_at isnull 321 where t_task_ignore.id isnull and task.deleted_at isnull
321 and task_anomaly.company_id = ? 322 and task_anomaly.company_id = ?
322 - and task.related_user@> ? ` 323 + and task.related_user@> ?
  324 + and task.leader->>'id' <> ?
  325 + `
323 326
324 sqlStr2 := ` with t_task_ignore as ( 327 sqlStr2 := ` with t_task_ignore as (
325 select task_ignore.id ,task_ignore.task_id 328 select task_ignore.id ,task_ignore.task_id
@@ -331,9 +334,10 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ @@ -331,9 +334,10 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
331 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id 334 left join t_task_ignore on task_anomaly.task_id=t_task_ignore.task_id
332 where t_task_ignore.id isnull and task.deleted_at isnull 335 where t_task_ignore.id isnull and task.deleted_at isnull
333 and task_anomaly.company_id = ? 336 and task_anomaly.company_id = ?
334 - and task.related_user@> ? ` 337 + and task.related_user@> ?
  338 + and task.leader->>'id' <> ? `
335 339
336 - condition := []interface{}{userId, companyId, fmt.Sprintf("[%d]", userId)} 340 + condition := []interface{}{userId, companyId, fmt.Sprintf("[%d]", userId), strconv.Itoa(userId)}
337 if len(dayTime) > 0 { 341 if len(dayTime) > 0 {
338 condition = append(condition, dayTime) 342 condition = append(condition, dayTime)
339 sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? ` 343 sqlStr2 += ` and to_char(task_anomaly.created_at,'yyyy-MM-dd') =? `
@@ -572,7 +572,9 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -572,7 +572,9 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
572 where 1=1 572 where 1=1
573 )select * 573 )select *
574 from t_task_1 574 from t_task_1
575 - order by t_task_1.status, t_task_1.sort_by_1, 575 + order by t_task_1.status,
  576 + t_task_1.warn_flag
  577 + t_task_1.sort_by_1,
576 t_task_1.anomaly desc, 578 t_task_1.anomaly desc,
577 t_task_1.sort_by,t_task_1."created_at" 579 t_task_1.sort_by,t_task_1."created_at"
578 limit ? offset ? 580 limit ? offset ?
@@ -655,7 +657,9 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -655,7 +657,9 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
655 where 1=1 657 where 1=1
656 )select * 658 )select *
657 from tt_task_1 659 from tt_task_1
658 - order by tt_task_1.status,tt_task_1.sort_by_1, 660 + order by tt_task_1.status,
  661 + tt_task_1.warn_flag,
  662 + tt_task_1.sort_by_1,
659 tt_task_1.anomaly desc, 663 tt_task_1.anomaly desc,
660 tt_task_1.sort_by,tt_task_1."created_at" 664 tt_task_1.sort_by,tt_task_1."created_at"
661 limit ? offset ? 665 limit ? offset ?
@@ -866,7 +870,9 @@ func (d *TaskDao) ListTaskByHrbpV3(param ListTaskCondition) ([]ListTask, error) @@ -866,7 +870,9 @@ func (d *TaskDao) ListTaskByHrbpV3(param ListTaskCondition) ([]ListTask, error)
866 where 1=1 870 where 1=1
867 )select * 871 )select *
868 from t_task_1 872 from t_task_1
869 - order by t_task_1.status, t_task_1.sort_by_1, 873 + order by t_task_1.status,
  874 + t_task_1.warn_flag,
  875 + t_task_1.sort_by_1,
870 t_task_1.anomaly desc, 876 t_task_1.anomaly desc,
871 t_task_1.sort_by,t_task_1."created_at" 877 t_task_1.sort_by,t_task_1."created_at"
872 limit ? offset ? 878 limit ? offset ?