|
@@ -408,17 +408,21 @@ type TaskData3 struct { |
|
@@ -408,17 +408,21 @@ type TaskData3 struct { |
408
|
|
408
|
|
409
|
// 根据负责人获取超期未完成的异常的里程碑任务
|
409
|
// 根据负责人获取超期未完成的异常的里程碑任务
|
410
|
func (d *TaskDao) TaskStageAnomalyByLeader(leaderId []string) ([]TaskData3, error) {
|
410
|
func (d *TaskDao) TaskStageAnomalyByLeader(leaderId []string) ([]TaskData3, error) {
|
411
|
- sqlStr := `select distinct
|
411
|
+ sqlStr := `select
|
412
|
task.id as task_id,
|
412
|
task.id as task_id,
|
413
|
- task.leader ->>'name' as leader_name,
|
|
|
414
|
- task.leader ->>'id' as leader_id,
|
413
|
+ task."name" as task_name ,
|
415
|
task.alias as task_alias,
|
414
|
task.alias as task_alias,
|
416
|
- task.name as task_name
|
|
|
417
|
- from task
|
|
|
418
|
- join task_stage on task.id=task_stage.task_id
|
|
|
419
|
- where 1=1
|
|
|
420
|
- and task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now())
|
|
|
421
|
- and task.leader ->>'id' in(?) `
|
415
|
+ task.leader ->>'id' as leader_id,
|
|
|
416
|
+ task.leader ->>'name' as leader_name
|
|
|
417
|
+from task where 1=1
|
|
|
418
|
+and task.deleted_at isnull
|
|
|
419
|
+and (
|
|
|
420
|
+ task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
|
|
|
421
|
+ or
|
|
|
422
|
+ cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now()))
|
|
|
423
|
+)
|
|
|
424
|
+and task.leader ->>'id' in(?) `
|
|
|
425
|
+
|
422
|
result := []TaskData3{}
|
426
|
result := []TaskData3{}
|
423
|
tx := d.transactionContext.PgTx
|
427
|
tx := d.transactionContext.PgTx
|
424
|
_, err := tx.Query(&result, sqlStr, pg.In(leaderId))
|
428
|
_, err := tx.Query(&result, sqlStr, pg.In(leaderId))
|
|
@@ -427,17 +431,20 @@ func (d *TaskDao) TaskStageAnomalyByLeader(leaderId []string) ([]TaskData3, erro |
|
@@ -427,17 +431,20 @@ func (d *TaskDao) TaskStageAnomalyByLeader(leaderId []string) ([]TaskData3, erro |
427
|
|
431
|
|
428
|
// 根据任务相关人获取超期未完成的异常的里程碑任务
|
432
|
// 根据任务相关人获取超期未完成的异常的里程碑任务
|
429
|
func (d *TaskDao) TaskStageAnomalyByRelatedUser(relatedUserId int) ([]TaskData3, error) {
|
433
|
func (d *TaskDao) TaskStageAnomalyByRelatedUser(relatedUserId int) ([]TaskData3, error) {
|
430
|
- sqlStr := `select distinct
|
434
|
+ sqlStr := `select
|
431
|
task.id as task_id,
|
435
|
task.id as task_id,
|
432
|
- task.leader ->>'name' as leader_name,
|
|
|
433
|
- task.leader ->>'id' as leader_id,
|
436
|
+ task."name" as task_name ,
|
434
|
task.alias as task_alias,
|
437
|
task.alias as task_alias,
|
435
|
- task.name as task_name
|
|
|
436
|
- from task
|
|
|
437
|
- join task_stage on task.id=task_stage.task_id
|
|
|
438
|
- where 1=1
|
|
|
439
|
- and task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now())
|
|
|
440
|
- and task.related_user @>? `
|
438
|
+ task.leader ->>'id' as leader_id,
|
|
|
439
|
+ task.leader ->>'name' as leader_name
|
|
|
440
|
+from task where 1=1
|
|
|
441
|
+and task.deleted_at isnull
|
|
|
442
|
+and (
|
|
|
443
|
+ task.last_stage ->>'planCompletedAt'< task.last_stage ->>'realCompletedAt'
|
|
|
444
|
+ or
|
|
|
445
|
+ cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int) between 1 and floor(extract(epoch from now()))
|
|
|
446
|
+)
|
|
|
447
|
+and task.related_user @>? `
|
441
|
|
448
|
|
442
|
relatedUser := fmt.Sprintf("[%d]", relatedUserId)
|
449
|
relatedUser := fmt.Sprintf("[%d]", relatedUserId)
|
443
|
result := []TaskData3{}
|
450
|
result := []TaskData3{}
|