...
|
...
|
@@ -494,6 +494,23 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask |
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if task.ReferenceResource != nil && len(task.ReferenceResource.ReferenceResourceItems) > 0 {
|
|
|
abilityServiceGateway, err := factory.CreateAbilityServiceGateway(nil)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
} else {
|
|
|
var serials []int64
|
|
|
for _, referenceResourceItem := range task.ReferenceResource.ReferenceResourceItems {
|
|
|
serials = append(serials, referenceResourceItem.SerialNumber)
|
|
|
}
|
|
|
data, err := abilityServiceGateway.SaveTaskCallback(task.Sponsor.Uid, task.TaskId, serials)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
} else {
|
|
|
fmt.Println(data)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return task, nil
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -609,6 +626,23 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask |
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if task.ReferenceResource != nil && len(task.ReferenceResource.ReferenceResourceItems) > 0 {
|
|
|
abilityServiceGateway, err := factory.CreateAbilityServiceGateway(nil)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
} else {
|
|
|
var serials []int64
|
|
|
for _, referenceResourceItem := range task.ReferenceResource.ReferenceResourceItems {
|
|
|
serials = append(serials, referenceResourceItem.SerialNumber)
|
|
|
}
|
|
|
data, err := abilityServiceGateway.SaveTaskCallback(task.Sponsor.Uid, task.TaskId, serials)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
} else {
|
|
|
fmt.Println(data)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return task, nil
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -649,6 +683,23 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask |
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if task.ReferenceResource != nil && len(task.ReferenceResource.ReferenceResourceItems) > 0 {
|
|
|
abilityServiceGateway, err := factory.CreateAbilityServiceGateway(nil)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
} else {
|
|
|
var serials []int64
|
|
|
for _, referenceResourceItem := range task.ReferenceResource.ReferenceResourceItems {
|
|
|
serials = append(serials, referenceResourceItem.SerialNumber)
|
|
|
}
|
|
|
data, err := abilityServiceGateway.DeleteTaskCallback(task.Sponsor.Uid, task.TaskId, serials)
|
|
|
if err != nil {
|
|
|
fmt.Println(err.Error())
|
|
|
} else {
|
|
|
fmt.Println(data)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return task, nil
|
|
|
}
|
|
|
}
|
...
|
...
|
|