Merge remote-tracking branch 'origin/test' into test
正在显示
2 个修改的文件
包含
27 行增加
和
22 行删除
@@ -923,6 +923,9 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction | @@ -923,6 +923,9 @@ func (srv TaskService) ReplyTaskStage(transactionContext application.Transaction | ||
923 | if err != nil { | 923 | if err != nil { |
924 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error()) | 924 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "找不到任务里程碑数据"+err.Error()) |
925 | } | 925 | } |
926 | + if len(stageList) == 0 { | ||
927 | + continue | ||
928 | + } | ||
926 | 929 | ||
927 | if val.AnomalyState == domain.AnomalyState0 { | 930 | if val.AnomalyState == domain.AnomalyState0 { |
928 | taskData.Anomaly += 1 | 931 | taskData.Anomaly += 1 |
@@ -1200,11 +1203,11 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i | @@ -1200,11 +1203,11 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i | ||
1200 | // | 1203 | // |
1201 | taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) | 1204 | taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) |
1202 | if err != nil { | 1205 | if err != nil { |
1203 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) | 1206 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计异常的任务里程碑总数"+err.Error()) |
1204 | } | 1207 | } |
1205 | taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition) | 1208 | taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition) |
1206 | if err != nil { | 1209 | if err != nil { |
1207 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) | 1210 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error()) |
1208 | } | 1211 | } |
1209 | 1212 | ||
1210 | taskResult := []*adapter.TaskItem{} | 1213 | taskResult := []*adapter.TaskItem{} |
@@ -1341,12 +1344,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s | @@ -1341,12 +1344,12 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s | ||
1341 | //里程碑异常 | 1344 | //里程碑异常 |
1342 | taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) | 1345 | taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) |
1343 | if err != nil { | 1346 | if err != nil { |
1344 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) | 1347 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计异常的任务里程碑总数"+err.Error()) |
1345 | } | 1348 | } |
1346 | //反馈异常数 | 1349 | //反馈异常数 |
1347 | taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition) | 1350 | taskAnomalyCnt, err := taskDao.CountTaskAnomalyNotHrbp(condition) |
1348 | if err != nil { | 1351 | if err != nil { |
1349 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) | 1352 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务反馈异常总数"+err.Error()) |
1350 | } | 1353 | } |
1351 | 1354 | ||
1352 | taskResult := []*adapter.TaskItem{} | 1355 | taskResult := []*adapter.TaskItem{} |
@@ -314,16 +314,17 @@ func (d *TaskDao) CountTaskStageByHrbp(param ListTaskCondition) (int, error) { | @@ -314,16 +314,17 @@ 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 ( | ||
323 | + cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now())) | ||
324 | + or | ||
325 | + task.warn_flag = 1 | ||
326 | + ) | ||
327 | + ` | ||
327 | condition := []interface{}{param.CompanyId} | 328 | condition := []interface{}{param.CompanyId} |
328 | whereSql := `` | 329 | whereSql := `` |
329 | if param.OnlyMy { | 330 | if param.OnlyMy { |
@@ -346,16 +347,17 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err | @@ -346,16 +347,17 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err | ||
346 | withSql := `with | 347 | withSql := `with |
347 | t_task_ignore as ( | 348 | t_task_ignore as ( |
348 | select task_ignore.task_id,task_ignore.id from task_ignore where task_ignore.user_id =? | 349 | 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 | 350 | + )select count(*) |
351 | + from task | ||
352 | left join t_task_ignore on t_task_ignore.task_id=task.id | 352 | 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 | - ) ` | 353 | + where 1=1 |
354 | + and task.company_id =? | ||
355 | + and t_task_ignore.id isnull | ||
356 | + and ( | ||
357 | + cast(COALESCE(task.current_stage ->>'plan_completed_at','0') as int)<floor(extract(epoch from now())) | ||
358 | + or | ||
359 | + task.warn_flag = 1 | ||
360 | + )` | ||
359 | condition := []interface{}{param.UserId, param.CompanyId} | 361 | condition := []interface{}{param.UserId, param.CompanyId} |
360 | whereSql := `` | 362 | whereSql := `` |
361 | if param.OnlyMy { | 363 | if param.OnlyMy { |
-
请 注册 或 登录 后发表评论