作者 tangxvhui

更新

@@ -314,16 +314,18 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { @@ -314,16 +314,18 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
314 // 统计里程碑异常的数量,以非hrbp角色统计 314 // 统计里程碑异常的数量,以非hrbp角色统计
315 func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, error) { 315 func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, error) {
316 task1 := d.catchTaskIdByPermission(param.UserId) 316 task1 := d.catchTaskIdByPermission(param.UserId)
317 - withSql := task1 + ` select count(*)  
318 - from task_stage  
319 - join task on task_stage.task_id =task.id 317 + withSql := task1 + ` select count(*)
  318 + from task
320 join t_task_1 on task.id =t_task_1.id 319 join t_task_1 on task.id =t_task_1.id
321 - where 1=1 and task.company_id=?  
322 - and(  
323 - (task_stage.plan_completed_at <task_stage.real_completed_at)  
324 - or  
325 - (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))  
326 - ) ` 320 + where 1=1
  321 + and task.company_id =?
  322 + and t_task_ignore.id isnull
  323 + and (
  324 + cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
  325 + or
  326 + task.warn_flag = 1
  327 + )
  328 + `
327 condition := []interface{}{param.CompanyId} 329 condition := []interface{}{param.CompanyId}
328 whereSql := `` 330 whereSql := ``
329 if param.OnlyMy { 331 if param.OnlyMy {
@@ -346,16 +348,17 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err @@ -346,16 +348,17 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
346 withSql := `with 348 withSql := `with
347 t_task_ignore as ( 349 t_task_ignore as (
348 select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =? 350 select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
349 - )select count(*)  
350 - from task_stage  
351 - join task on task_stage.task_id =task.id 351 + )select count(*)
  352 + from task
352 left join t_task_ignore on t_task_ignore.task_id=task.id 353 left join t_task_ignore on t_task_ignore.task_id=task.id
353 - where 1=1 and task.company_id=?  
354 - and(  
355 - (task_stage.plan_completed_at <task_stage.real_completed_at)  
356 - or  
357 - (task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))  
358 - ) ` 354 + where 1=1
  355 + and task.company_id =?
  356 + and t_task_ignore.id isnull
  357 + and (
  358 + cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
  359 + or
  360 + task.warn_flag = 1
  361 + )`
359 condition := []interface{}{param.UserId, param.CompanyId} 362 condition := []interface{}{param.UserId, param.CompanyId}
360 whereSql := `` 363 whereSql := ``
361 if param.OnlyMy { 364 if param.OnlyMy {