正在显示
1 个修改的文件
包含
24 行增加
和
1 行删除
@@ -1055,7 +1055,30 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | @@ -1055,7 +1055,30 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask | ||
1055 | } | 1055 | } |
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | - if err := task.Update(tool_funs.SimpleStructToMap(updateTaskCommand)); err != nil { | 1058 | + updateData := tool_funs.SimpleStructToMap(updateTaskCommand) |
1059 | + if task.TaskType == domain.TASK_TYPE_DESIGNATE && updateTaskCommand.AssignedPerson != 0 { | ||
1060 | + var employeeRepository domain.EmployeeRepository | ||
1061 | + if value, err := factory.CreateEmployeeRepository(map[string]interface{}{ | ||
1062 | + "transactionContext": transactionContext, | ||
1063 | + }); err != nil { | ||
1064 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1065 | + } else { | ||
1066 | + employeeRepository = value | ||
1067 | + } | ||
1068 | + employee, err := employeeRepository.FindOne(map[string]interface{}{ | ||
1069 | + "uid": updateTaskCommand.AssignedPerson, | ||
1070 | + }) | ||
1071 | + if err != nil { | ||
1072 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1073 | + } | ||
1074 | + if employee == nil { | ||
1075 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "无效的指派人员") | ||
1076 | + } | ||
1077 | + if _, ok := updateData["assignedPerson"]; ok { | ||
1078 | + updateData["assignedPerson"] = employee.EmployeeInfo | ||
1079 | + } | ||
1080 | + } | ||
1081 | + if err := task.Update(updateData); err != nil { | ||
1059 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 1082 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
1060 | } | 1083 | } |
1061 | if task, err := taskRepository.Save(task); err != nil { | 1084 | if task, err := taskRepository.Save(task); err != nil { |
-
请 注册 或 登录 后发表评论