作者 tangxvhui

修复一些问题

... ... @@ -138,8 +138,9 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
return resp, nil
}
userDao := dao.NewUserDao(map[string]interface{}{"transactionContext": transactionContext})
// 针对任务负责人
taskDao := dao.NewTaskDao(map[string]interface{}{"transactionContext": transactionContext})
// 我作为任务负责人的提醒
leaderIds := []string{strconv.Itoa(param.UserId)}
taskStageList, err := taskDao.TaskStageAnomaly(leaderIds)
if err != nil {
... ... @@ -155,7 +156,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
childUserId = append(childUserId, strconv.Itoa(val.Id))
}
}
// 针对上级
// 作为上级,我的下级员工的异常里程碑
var taskStageList2 []dao.TaskStageData
if len(childUserId) == 0 {
taskStageList2, err = taskDao.TaskStageAnomaly(childUserId)
... ... @@ -169,7 +170,7 @@ func (srv *MessagePersonalService) TodayMessageTaskStageAnomaly(param *command.G
childUserId = append(childUserId, strconv.Itoa(val.Id))
}
}
// 针对上上级
// 作为上级, 我的下下级员工的异常里程碑
var taskStageList3 []dao.TaskStageData
if len(childUserId) == 0 {
taskStageList3, err = taskDao.TaskStageAnomaly(childUserId2)
... ...
... ... @@ -431,8 +431,6 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取项目EvaluationProject信息"+err.Error())
}
// projectData.PrincipalId
userIdstr := strconv.Itoa(staffAssess.Executor.UserId)
if projectData.PrincipalId != userIdstr {
return nil, nil
... ... @@ -454,6 +452,7 @@ func (srv StaffAssessServeice) buildTaskRecord(staffAssess *domain.StaffAssess)
_, taskList, err := taskRepo.Find(map[string]interface{}{
"name": val.Name,
"leaderId": projectData.PrincipalId,
"status": domain.TaskRunning,
})
if err != nil {
return nil, application.ThrowError(application.ARG_ERROR, "获取评估项指标任务task信息"+err.Error())
... ...
... ... @@ -698,14 +698,17 @@ func (srv TaskService) ListTask2(param *command.SearchTaskCommand) (map[string]i
taskDao := dao.NewTaskDao(map[string]interface{}{
"transactionContext": transactionContext,
})
//任务列表数据
tasklistData, err := taskDao.ListTaskStageNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务列表"+err.Error())
}
//查到的任务数据总数
taskCount, err := taskDao.CountTaskStageNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务总数"+err.Error())
}
//
taskStageAnomalyCnt, err := taskDao.CountTaskStageAnomalyNotHrbp(condition)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "统计任务里程碑总数"+err.Error())
... ...
... ... @@ -125,7 +125,7 @@ func (d *TaskDao) ListTaskStageNotHrbp(param ListTaskCondition) ([]ListTaskStage
join t_task_1 on task.id=t_task_1.id
join task_stage on task.id =task_stage.task_id
where 1=1 and task.company_id=?
order by diff_time,task."level",task.created_at
order by diff_time,task."level",task.created_at desc
),
-- 按任务数据分页获取
t_task_page as (
... ... @@ -234,7 +234,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
from task
join task_stage on task.id =task_stage.task_id
where 1=1 and task.company_id=?
order by diff_time,task."level",task.created_at
order by diff_time,task."level",task.created_at desc
),
-- 按任务数据分页获取
t_task_page as (
... ... @@ -274,7 +274,7 @@ func (d *TaskDao) ListTaskStageByHrbp(param ListTaskCondition) ([]ListTaskStage,
}
if param.SearchWord != "" {
condition = append(condition, param.SearchWord, param.SearchWord)
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?)`
whereSql += ` and (t_task_tage_1.leader_name like ? or t_task_tage_1.task_alias_name like ?) `
}
condition = append(condition, param.Limit, param.Offset)
sqlStr := fmt.Sprintf(withSql, whereSql)
... ... @@ -374,6 +374,9 @@ func (d *TaskDao) CountTaskStageAnomalyByHrbp(param ListTaskCondition) (int, err
}
func (d *TaskDao) IncreaseAnomaly(id []int, incr int) error {
if len(id) == 0 {
return nil
}
sqlStr := `update task set anomaly=task.anomaly+?
where id in(?)`
tx := d.transactionContext.PgTx
... ...
... ... @@ -132,6 +132,9 @@ func (repo *TaskRepository) Find(queryOptions map[string]interface{}) (int, []*d
if val, ok := queryOptions["aliasOrLeader"]; ok {
query.Where(`task.alias like ? or task.leader->>'name' like ?`, val, val)
}
if val, ok := queryOptions["status"]; ok {
query.Where("task.status=?", val)
}
query.Order("id desc")
count, err := query.SelectAndCount()
if err != nil {
... ...