...
|
...
|
@@ -161,9 +161,6 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
taskStageRepo := factory.CreateTaskStageRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
taskData, err := taskRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.Id,
|
|
|
})
|
...
|
...
|
@@ -183,22 +180,9 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string] |
|
|
if !ok {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "日评数据已生成,任务不能再被编辑")
|
|
|
}
|
|
|
leaderData, err := userRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.LeaderId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
taskData.Alias = param.Alias
|
|
|
taskData.Leader = domain.TaskLeader{
|
|
|
Id: leaderData.Id,
|
|
|
Account: leaderData.Account,
|
|
|
Name: leaderData.Name,
|
|
|
}
|
|
|
taskData.ApplyLevelName(param.LevelName)
|
|
|
|
|
|
nowTime := time.Now()
|
|
|
|
|
|
stageMap := map[int]*domain.TaskStage{}
|
|
|
for _, val := range stageList {
|
|
|
val.DeletedAt = &nowTime
|
...
|
...
|
@@ -292,12 +276,15 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
}
|
|
|
|
|
|
relatedUserId := taskData.RelatedUser
|
|
|
_, relatedUserList, err := userRepo.Find(map[string]interface{}{
|
|
|
var relatedUserList []*domain.User
|
|
|
if len(relatedUserId) > 0 {
|
|
|
_, relatedUserList, err = userRepo.Find(map[string]interface{}{
|
|
|
"ids": relatedUserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取相关人员"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -306,12 +293,14 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task |
|
|
Id: taskData.Id,
|
|
|
Name: taskData.Name,
|
|
|
Alias: taskData.Alias,
|
|
|
LeaderId: taskData.Leader.Id,
|
|
|
Leader: adapter.UserData{
|
|
|
Id: taskData.Leader.Id,
|
|
|
Account: taskData.Leader.Account,
|
|
|
Name: taskData.Leader.Name,
|
|
|
},
|
|
|
Status: int(taskData.Status),
|
|
|
StatusDescript: taskData.StatusDescript(),
|
|
|
Level: taskData.Level,
|
|
|
LevalName: taskData.LevelName,
|
|
|
RelatedUserId: []string{},
|
...
|
...
|
|