作者 tangxvhui

调整 任务列表查询

@@ -1293,11 +1293,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1293,11 +1293,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1293 if err != nil { 1293 if err != nil {
1294 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error()) 1294 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
1295 } 1295 }
1296 - // 1296 + //里程碑异常
1297 taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) 1297 taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
1298 if err != nil { 1298 if err != nil {
1299 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) 1299 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
1300 } 1300 }
  1301 + //反馈异常数
1301 taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition) 1302 taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition)
1302 if err != nil { 1303 if err != nil {
1303 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) 1304 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
@@ -608,6 +608,7 @@ func (d TaskDao) TaskStageAnomalyAll(companyId int) ([]TaskData4, error) { @@ -608,6 +608,7 @@ func (d TaskDao) TaskStageAnomalyAll(companyId int) ([]TaskData4, error) {
608 } 608 }
609 609
610 type ListTask struct { 610 type ListTask struct {
  611 + SortBy1 int `pg:"sort_by_1"`
611 CPlanCompletedAt int `pg:"c_plan_completed_at"` 612 CPlanCompletedAt int `pg:"c_plan_completed_at"`
612 LastStageDiff int `pg:"last_stage_diff"` 613 LastStageDiff int `pg:"last_stage_diff"`
613 TaskId int `pg:"task_id"` 614 TaskId int `pg:"task_id"`
@@ -636,6 +637,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -636,6 +637,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
636 cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at, 637 cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at,
637 cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at, 638 cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at,
638 cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at, 639 cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at,
  640 + floor(extract(epoch from now())) as now_time,
639 task.id , 641 task.id ,
640 task.alias , 642 task.alias ,
641 task.leader ->>'name' as leader_name, 643 task.leader ->>'name' as leader_name,
@@ -647,7 +649,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -647,7 +649,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
647 task.created_at 649 task.created_at
648 from task 650 from task
649 left join t_task_ignore on t_task_ignore.task_id=task.id 651 left join t_task_ignore on t_task_ignore.task_id=task.id
650 - where 1=1 and t_task_ignore.id isnull 652 + where 1=1 and t_task_ignore.id isnull and task.company_id=?
651 %s 653 %s
652 ), 654 ),
653 t_task_1 as ( 655 t_task_1 as (
@@ -659,7 +661,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -659,7 +661,7 @@ func (d *TaskDao) ListTaskByHrbpV2(param ListTaskCondition) ([]ListTask, error)
659 end) as sort_by_1, 661 end) as sort_by_1,
660 t_task.c_plan_completed_at , 662 t_task.c_plan_completed_at ,
661 t_task.l_plan_completed_at-t_task.l_real_completed_at as last_stage_diff, 663 t_task.l_plan_completed_at-t_task.l_real_completed_at as last_stage_diff,
662 - t_task.id , 664 + t_task.id as task_id,
663 t_task.alias , 665 t_task.alias ,
664 t_task.leader_name, 666 t_task.leader_name,
665 t_task."level", 667 t_task."level",
@@ -702,6 +704,7 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -702,6 +704,7 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
702 cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at, 704 cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) as c_plan_completed_at,
703 cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at, 705 cast(COALESCE(task.last_stage ->>'plan_completed_at','0') as int) as l_plan_completed_at,
704 cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at, 706 cast(COALESCE(task.last_stage ->>'real_completed_at','0') as int) as l_real_completed_at,
  707 + floor(extract(epoch from now())) as now_time,
705 task.id , 708 task.id ,
706 task.alias , 709 task.alias ,
707 task.leader ->>'name' as leader_name, 710 task.leader ->>'name' as leader_name,
@@ -713,7 +716,7 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -713,7 +716,7 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
713 task.created_at 716 task.created_at
714 from task 717 from task
715 join t_task_1 on t_task_1.id=task.id 718 join t_task_1 on t_task_1.id=task.id
716 - where 1=1 719 + where 1=1 and task.company_id=?
717 %s 720 %s
718 ), 721 ),
719 t_task_1 as ( 722 t_task_1 as (
@@ -725,7 +728,7 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error) @@ -725,7 +728,7 @@ func (d *TaskDao) ListTaskNotHrbpV2(param ListTaskCondition) ([]ListTask, error)
725 end) as sort_by_1, 728 end) as sort_by_1,
726 t_task.c_plan_completed_at , 729 t_task.c_plan_completed_at ,
727 t_task.l_plan_completed_at-t_task.l_real_completed_at as last_stage_diff, 730 t_task.l_plan_completed_at-t_task.l_real_completed_at as last_stage_diff,
728 - t_task.id , 731 + t_task.id as task_id,
729 t_task.alias , 732 t_task.alias ,
730 t_task.leader_name, 733 t_task.leader_name,
731 t_task."level", 734 t_task."level",
@@ -137,7 +137,7 @@ func (c *TaskController) ListTask2() { @@ -137,7 +137,7 @@ func (c *TaskController) ListTask2() {
137 userReq := middlewares.GetUser(c.Ctx) 137 userReq := middlewares.GetUser(c.Ctx)
138 paramReq.CompanyId = int(userReq.CompanyId) 138 paramReq.CompanyId = int(userReq.CompanyId)
139 paramReq.UserId = int(userReq.UserId) 139 paramReq.UserId = int(userReq.UserId)
140 - result, err := srv.ListTask2(paramReq) 140 + result, err := srv.ListTask3(paramReq)
141 c.Response(result, err) 141 c.Response(result, err)
142 } 142 }
143 143