作者 tangxvhui

修复bug

... ... @@ -157,7 +157,9 @@ func (srv TaskService) CreateTask(param *command.CreateTaskCommand, userReq *dom
if len(leaderList) == 0 {
return map[string]interface{}{}, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有查询到人员")
}
relatedUserIds := []int{}
leaderData := leaderList[0]
//默认填入人员的上级
relatedUserIds := []int{int(leaderData.ParentId)}
for _, val := range param.RelatedUserId {
id, _ := strconv.Atoi(val)
relatedUserIds = append(relatedUserIds, id)
... ... @@ -172,7 +174,7 @@ func (srv TaskService) CreateTask(param *command.CreateTaskCommand, userReq *dom
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取任务的相关人员"+err.Error())
}
}
leaderData := leaderList[0]
nowTime := time.Now()
newTask := domain.Task{
Id: 0,
... ...
... ... @@ -118,7 +118,7 @@ func (d *TaskAnomalyDao) List1(userId int, companyId int, taskName string, categ
}
condition = append(condition, limit, offset)
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
sqlStr1 += ` order by task_anomaly.id desc,task.sort_by limit ? offset ? `
result := []ListTaskAnomaly{}
tx := d.transactionContext.PgTx
_, err := tx.Query(&result, sqlStr1, condition...)
... ... @@ -268,7 +268,7 @@ func (d *TaskAnomalyDao) List2(userId int, companyId int, taskName string, categ
sqlStr1 += ` and t_task.leader_id in (?) `
}
condition = append(condition, limit, offset)
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
sqlStr1 += ` order by task_anomaly.id desc,t_task.task_sort_by limit ? offset ? `
result := []ListTaskAnomaly{}
tx := d.transactionContext.PgTx
... ... @@ -356,7 +356,7 @@ func (d *TaskAnomalyDao) List3(userId int, companyId int, taskName string, categ
sqlStr2 += ` and task.leader->>'id' in (?) `
}
condition = append(condition, limit, offset)
sqlStr1 += ` order by task_anomaly.id desc limit ? offset ? `
sqlStr1 += ` order by task_anomaly.id desc,task.sort_by limit ? offset ? `
result := []ListTaskAnomaly{}
tx := d.transactionContext.PgTx
_, err := tx.Query(&result, sqlStr1, condition...)
... ...
... ... @@ -26,5 +26,5 @@ func SubDayAbs(t1, t2 time.Time) int {
t3 := day1.Sub(day2)
h := int(math.Abs(t3.Hours()))
return (h / 24) + 1
return (h / 24)
}
... ...