|
@@ -494,6 +494,23 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask |
|
@@ -494,6 +494,23 @@ func (taskService *TaskService) CreateTask(createTaskCommand *command.CreateTask |
494
|
if err := transactionContext.CommitTransaction(); err != nil {
|
494
|
if err := transactionContext.CommitTransaction(); err != nil {
|
495
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
495
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
496
|
}
|
496
|
}
|
|
|
497
|
+ if task.ReferenceResource != nil && len(task.ReferenceResource.ReferenceResourceItems) > 0 {
|
|
|
498
|
+ abilityServiceGateway, err := factory.CreateAbilityServiceGateway(nil)
|
|
|
499
|
+ if err != nil {
|
|
|
500
|
+ fmt.Println(err.Error())
|
|
|
501
|
+ } else {
|
|
|
502
|
+ var serials []int64
|
|
|
503
|
+ for _, referenceResourceItem := range task.ReferenceResource.ReferenceResourceItems {
|
|
|
504
|
+ serials = append(serials, referenceResourceItem.SerialNumber)
|
|
|
505
|
+ }
|
|
|
506
|
+ data, err := abilityServiceGateway.SaveTaskCallback(task.Sponsor.Uid, task.TaskId, serials)
|
|
|
507
|
+ if err != nil {
|
|
|
508
|
+ fmt.Println(err.Error())
|
|
|
509
|
+ } else {
|
|
|
510
|
+ fmt.Println(data)
|
|
|
511
|
+ }
|
|
|
512
|
+ }
|
|
|
513
|
+ }
|
497
|
return task, nil
|
514
|
return task, nil
|
498
|
}
|
515
|
}
|
499
|
}
|
516
|
}
|
|
@@ -609,6 +626,23 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask |
|
@@ -609,6 +626,23 @@ func (taskService *TaskService) UpdateTask(updateTaskCommand *command.UpdateTask |
609
|
if err := transactionContext.CommitTransaction(); err != nil {
|
626
|
if err := transactionContext.CommitTransaction(); err != nil {
|
610
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
627
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
611
|
}
|
628
|
}
|
|
|
629
|
+ if task.ReferenceResource != nil && len(task.ReferenceResource.ReferenceResourceItems) > 0 {
|
|
|
630
|
+ abilityServiceGateway, err := factory.CreateAbilityServiceGateway(nil)
|
|
|
631
|
+ if err != nil {
|
|
|
632
|
+ fmt.Println(err.Error())
|
|
|
633
|
+ } else {
|
|
|
634
|
+ var serials []int64
|
|
|
635
|
+ for _, referenceResourceItem := range task.ReferenceResource.ReferenceResourceItems {
|
|
|
636
|
+ serials = append(serials, referenceResourceItem.SerialNumber)
|
|
|
637
|
+ }
|
|
|
638
|
+ data, err := abilityServiceGateway.SaveTaskCallback(task.Sponsor.Uid, task.TaskId, serials)
|
|
|
639
|
+ if err != nil {
|
|
|
640
|
+ fmt.Println(err.Error())
|
|
|
641
|
+ } else {
|
|
|
642
|
+ fmt.Println(data)
|
|
|
643
|
+ }
|
|
|
644
|
+ }
|
|
|
645
|
+ }
|
612
|
return task, nil
|
646
|
return task, nil
|
613
|
}
|
647
|
}
|
614
|
}
|
648
|
}
|
|
@@ -649,6 +683,23 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask |
|
@@ -649,6 +683,23 @@ func (taskService *TaskService) RemoveTask(removeTaskCommand *command.RemoveTask |
649
|
if err := transactionContext.CommitTransaction(); err != nil {
|
683
|
if err := transactionContext.CommitTransaction(); err != nil {
|
650
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
684
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
651
|
}
|
685
|
}
|
|
|
686
|
+ if task.ReferenceResource != nil && len(task.ReferenceResource.ReferenceResourceItems) > 0 {
|
|
|
687
|
+ abilityServiceGateway, err := factory.CreateAbilityServiceGateway(nil)
|
|
|
688
|
+ if err != nil {
|
|
|
689
|
+ fmt.Println(err.Error())
|
|
|
690
|
+ } else {
|
|
|
691
|
+ var serials []int64
|
|
|
692
|
+ for _, referenceResourceItem := range task.ReferenceResource.ReferenceResourceItems {
|
|
|
693
|
+ serials = append(serials, referenceResourceItem.SerialNumber)
|
|
|
694
|
+ }
|
|
|
695
|
+ data, err := abilityServiceGateway.DeleteTaskCallback(task.Sponsor.Uid, task.TaskId, serials)
|
|
|
696
|
+ if err != nil {
|
|
|
697
|
+ fmt.Println(err.Error())
|
|
|
698
|
+ } else {
|
|
|
699
|
+ fmt.Println(data)
|
|
|
700
|
+ }
|
|
|
701
|
+ }
|
|
|
702
|
+ }
|
652
|
return task, nil
|
703
|
return task, nil
|
653
|
}
|
704
|
}
|
654
|
}
|
705
|
}
|