|
@@ -448,7 +448,7 @@ func (cooperationContractService *CooperationContractService) BatchRemoveCoopera |
|
@@ -448,7 +448,7 @@ func (cooperationContractService *CooperationContractService) BatchRemoveCoopera |
448
|
return nil, nil
|
448
|
return nil, nil
|
449
|
}
|
449
|
}
|
450
|
|
450
|
|
451
|
-// OperateRemoveCooperationContract TODO 暂停或恢复共创合约
|
451
|
+// OperateCooperationContract 暂停或恢复共创合约
|
452
|
func (cooperationContractService *CooperationContractService) OperateCooperationContract(operateCooperationContractCommand *command.OperateCooperationContractCommand) (interface{}, error) {
|
452
|
func (cooperationContractService *CooperationContractService) OperateCooperationContract(operateCooperationContractCommand *command.OperateCooperationContractCommand) (interface{}, error) {
|
453
|
if err := operateCooperationContractCommand.ValidateCommand(); err != nil {
|
453
|
if err := operateCooperationContractCommand.ValidateCommand(); err != nil {
|
454
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
454
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
@@ -463,10 +463,34 @@ func (cooperationContractService *CooperationContractService) OperateCooperation |
|
@@ -463,10 +463,34 @@ func (cooperationContractService *CooperationContractService) OperateCooperation |
463
|
defer func() {
|
463
|
defer func() {
|
464
|
_ = transactionContext.RollbackTransaction()
|
464
|
_ = transactionContext.RollbackTransaction()
|
465
|
}()
|
465
|
}()
|
|
|
466
|
+ var cooperationContractRepository domain.CooperationContractRepository
|
|
|
467
|
+ if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{
|
|
|
468
|
+ "transactionContext": transactionContext,
|
|
|
469
|
+ }); err != nil {
|
|
|
470
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
471
|
+ } else {
|
|
|
472
|
+ cooperationContractRepository = value
|
|
|
473
|
+ }
|
|
|
474
|
+ cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": operateCooperationContractCommand.CooperationContractId})
|
|
|
475
|
+ if err != nil {
|
|
|
476
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
477
|
+ }
|
|
|
478
|
+ if cooperationContract == nil {
|
|
|
479
|
+ return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(operateCooperationContractCommand.CooperationContractId)))
|
|
|
480
|
+ }
|
|
|
481
|
+ if err := cooperationContract.Update(map[string]interface{}{
|
|
|
482
|
+ "action": operateCooperationContractCommand,
|
|
|
483
|
+ }); err != nil {
|
|
|
484
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
485
|
+ }
|
|
|
486
|
+ if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil {
|
|
|
487
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
488
|
+ } else {
|
466
|
if err := transactionContext.CommitTransaction(); err != nil {
|
489
|
if err := transactionContext.CommitTransaction(); err != nil {
|
467
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
490
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
468
|
}
|
491
|
}
|
469
|
- return nil, nil
|
492
|
+ return cooperationContract, nil
|
|
|
493
|
+ }
|
470
|
}
|
494
|
}
|
471
|
|
495
|
|
472
|
// BatchOperateCooperationContract TODO 批量暂停或恢复共创合约
|
496
|
// BatchOperateCooperationContract TODO 批量暂停或恢复共创合约
|