作者 郑周

Merge remote-tracking branch 'origin/test' into test

... ... @@ -923,6 +923,9 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error())
}
if len(stageList) == 0 {
continue
}
if val.AnomalyState == domain.AnomalyState0 {
taskData.Anomaly += 1
... ... @@ -1200,11 +1203,11 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
//
taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计异常的任务里程碑总数"+err.Error())
}
taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error())
}
taskResult := []*adapter.TaskItem{}
... ... @@ -1341,12 +1344,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
//里程碑异常
taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计异常的任务里程碑总数"+err.Error())
}
//反馈异常数
taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error())
}
taskResult := []*adapter.TaskItem{}
... ...
... ... @@ -314,16 +314,17 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) {
// 统计里程碑异常的数量,以非hrbp角色统计
func (d *TaskDao) CountTaskStageAnomalyNotHrbp(param ListTaskCondition) (int, error) {
task1 := d.catchTaskIdByPermission(param.UserId)
withSql := task1 + ` select count(*)
from task_stage
join task on task_stage.task_id =task.id
withSql := task1 + ` select count(*)
from task
join t_task_1 on task.id =t_task_1.id
where 1=1 and task.company_id=?
and(
(task_stage.plan_completed_at <task_stage.real_completed_at)
or
(task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
) `
where 1=1
and task.company_id =?
and (
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
or
task.warn_flag = 1
)
`
condition := []interface{}{param.CompanyId}
whereSql := ``
if param.OnlyMy {
... ... @@ -346,16 +347,17 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
withSql := `with
t_task_ignore as (
select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =?
)select count(*)
from task_stage
join task on task_stage.task_id =task.id
)select count(*)
from task
left join t_task_ignore on t_task_ignore.task_id=task.id
where 1=1 and task.company_id=?
and(
(task_stage.plan_completed_at <task_stage.real_completed_at)
or
(task_stage.real_completed_at=0 and task_stage.plan_completed_at<extract(epoch from now()))
) `
where 1=1
and task.company_id =?
and t_task_ignore.id isnull
and (
cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now()))
or
task.warn_flag = 1
)`
condition := []interface{}{param.UserId, param.CompanyId}
whereSql := ``
if param.OnlyMy {
... ...