作者 tangxvhui

修复一些问题

@@ -138,8 +138,9 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -138,8 +138,9 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
138 return resp, nil 138 return resp, nil
139 } 139 }
140 userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext}) 140 userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
141 - // 针对任务负责人 141 +
142 taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext}) 142 taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
  143 + // 我作为任务负责人的提醒
143 leaderIds := []string{strconv.Itoa(param.UserId)} 144 leaderIds := []string{strconv.Itoa(param.UserId)}
144 taskStageList, err := taskDao.TaskStageAnomaly(leaderIds) 145 taskStageList, err := taskDao.TaskStageAnomaly(leaderIds)
145 if err != nil { 146 if err != nil {
@@ -155,7 +156,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -155,7 +156,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
155 childUserId = append(childUserId, strconv.Itoa(val.Id)) 156 childUserId = append(childUserId, strconv.Itoa(val.Id))
156 } 157 }
157 } 158 }
158 - // 针对上级 159 + // 作为上级,我的下级员工的异常里程碑
159 var taskStageList2 []dao.TaskStageData 160 var taskStageList2 []dao.TaskStageData
160 if len(childUserId) == 0 { 161 if len(childUserId) == 0 {
161 taskStageList2, err = taskDao.TaskStageAnomaly(childUserId) 162 taskStageList2, err = taskDao.TaskStageAnomaly(childUserId)
@@ -169,7 +170,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G @@ -169,7 +170,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
169 childUserId = append(childUserId, strconv.Itoa(val.Id)) 170 childUserId = append(childUserId, strconv.Itoa(val.Id))
170 } 171 }
171 } 172 }
172 - // 针对上上级 173 + // 作为上级, 我的下下级员工的异常里程碑
173 var taskStageList3 []dao.TaskStageData 174 var taskStageList3 []dao.TaskStageData
174 if len(childUserId) == 0 { 175 if len(childUserId) == 0 {
175 taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2) 176 taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2)
@@ -431,8 +431,6 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) @@ -431,8 +431,6 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
431 if err != nil { 431 if err != nil {
432 return nil, application.ThrowError(application.ARG_ERROR, "获取项目EvaluationProject信息"+err.Error()) 432 return nil, application.ThrowError(application.ARG_ERROR, "获取项目EvaluationProject信息"+err.Error())
433 } 433 }
434 -  
435 - // projectData.PrincipalId  
436 userIdstr := strconv.Itoa(staffAssess.Executor.UserId) 434 userIdstr := strconv.Itoa(staffAssess.Executor.UserId)
437 if projectData.PrincipalId != userIdstr { 435 if projectData.PrincipalId != userIdstr {
438 return nil, nil 436 return nil, nil
@@ -454,6 +452,7 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess) @@ -454,6 +452,7 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
454 _, taskList, err := taskRepo.Find(map[string]interface{}{ 452 _, taskList, err := taskRepo.Find(map[string]interface{}{
455 "name": val.Name, 453 "name": val.Name,
456 "leaderId": projectData.PrincipalId, 454 "leaderId": projectData.PrincipalId,
  455 + "status": domain.TaskRunning,
457 }) 456 })
458 if err != nil { 457 if err != nil {
459 return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error()) 458 return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error())
@@ -698,14 +698,17 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i @@ -698,14 +698,17 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
698 taskDao := dao.NewTaskDao(map[string]interface{}{ 698 taskDao := dao.NewTaskDao(map[string]interface{}{
699 "transactionContext": transactionContext, 699 "transactionContext": transactionContext,
700 }) 700 })
  701 + //任务列表数据
701 tasklistData, err := taskDao.ListTaskStageNotHrbp(condition) 702 tasklistData, err := taskDao.ListTaskStageNotHrbp(condition)
702 if err != nil { 703 if err != nil {
703 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error()) 704 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
704 } 705 }
  706 + //查到的任务数据总数
705 taskCount, err := taskDao.CountTaskStageNotHrbp(condition) 707 taskCount, err := taskDao.CountTaskStageNotHrbp(condition)
706 if err != nil { 708 if err != nil {
707 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error()) 709 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
708 } 710 }
  711 + //
709 taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition) 712 taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
710 if err != nil { 713 if err != nil {
711 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error()) 714 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
@@ -125,7 +125,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage @@ -125,7 +125,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
125 join t_task_1 on task.id=t_task_1.id 125 join t_task_1 on task.id=t_task_1.id
126 join task_stage on task.id =task_stage.task_id 126 join task_stage on task.id =task_stage.task_id
127 where 1=1 and task.company_id=? 127 where 1=1 and task.company_id=?
128 - order by diff_time,task."level",task.created_at 128 + order by diff_time,task."level",task.created_at desc
129 ), 129 ),
130 -- 按任务数据分页获取 130 -- 按任务数据分页获取
131 t_task_page as ( 131 t_task_page as (
@@ -234,7 +234,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, @@ -234,7 +234,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
234 from task 234 from task
235 join task_stage on task.id =task_stage.task_id 235 join task_stage on task.id =task_stage.task_id
236 where 1=1 and task.company_id=? 236 where 1=1 and task.company_id=?
237 - order by diff_time,task."level",task.created_at 237 + order by diff_time,task."level",task.created_at desc
238 ), 238 ),
239 -- 按任务数据分页获取 239 -- 按任务数据分页获取
240 t_task_page as ( 240 t_task_page as (
@@ -274,7 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage, @@ -274,7 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
274 } 274 }
275 if param.SearchWord != "" { 275 if param.SearchWord != "" {
276 condition = append(condition, param.SearchWord, param.SearchWord) 276 condition = append(condition, param.SearchWord, param.SearchWord)
277 - whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)` 277 + whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?) `
278 } 278 }
279 condition = append(condition, param.Limit, param.Offset) 279 condition = append(condition, param.Limit, param.Offset)
280 sqlStr := fmt.Sprintf(withSql, whereSql) 280 sqlStr := fmt.Sprintf(withSql, whereSql)
@@ -374,6 +374,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err @@ -374,6 +374,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
374 } 374 }
375 375
376 func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error { 376 func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error {
  377 + if len(id) == 0 {
  378 + return nil
  379 + }
377 sqlStr := `update task set anomaly=task.anomaly+? 380 sqlStr := `update task set anomaly=task.anomaly+?
378 where id in(?)` 381 where id in(?)`
379 tx := d.transactionContext.PgTx 382 tx := d.transactionContext.PgTx
@@ -132,6 +132,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d @@ -132,6 +132,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d
132 if val, ok := queryOptions["aliasOrLeader"]; ok { 132 if val, ok := queryOptions["aliasOrLeader"]; ok {
133 query.Where(`task.alias like ? or task.leader->>'name' like ?`, val, val) 133 query.Where(`task.alias like ? or task.leader->>'name' like ?`, val, val)
134 } 134 }
  135 + if val, ok := queryOptions["status"]; ok {
  136 + query.Where("task.status=?", val)
  137 + }
135 query.Order("id desc") 138 query.Order("id desc")
136 count, err := query.SelectAndCount() 139 count, err := query.SelectAndCount()
137 if err != nil { 140 if err != nil {