...
|
...
|
@@ -1055,7 +1055,30 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if err := task.Update(tool_funs.SimpleStructToMap(updateTaskCommand)); err != nil {
|
|
|
updateData := tool_funs.SimpleStructToMap(updateTaskCommand)
|
|
|
if task.TaskType == domain.TASK_TYPE_DESIGNATE && updateTaskCommand.AssignedPerson != 0 {
|
|
|
var employeeRepository domain.EmployeeRepository
|
|
|
if value, err := factory.CreateEmployeeRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
employeeRepository = value
|
|
|
}
|
|
|
employee, err := employeeRepository.FindOne(map[string]interface{}{
|
|
|
"uid": updateTaskCommand.AssignedPerson,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if employee == nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员")
|
|
|
}
|
|
|
if _, ok := updateData["assignedPerson"]; ok {
|
|
|
updateData["assignedPerson"] = employee.EmployeeInfo
|
|
|
}
|
|
|
}
|
|
|
if err := task.Update(updateData); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if task, err := taskRepository.Save(task); err != nil {
|
...
|
...
|
|