...
|
...
|
@@ -200,10 +200,17 @@ func (orderService *OrderService) ReceiveGoods(receivingCommand *command.Receive |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
shippingService, err := factory.CreateReceivingService(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
order, err := shippingService.Receiving(int64(receivingCommand.OrderId), receivingCommand.OrderGoods)
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
return order, nil
|
|
|
}
|
|
|
|
|
|
// 移除订单增删改查
|
...
|
...
|
@@ -261,10 +268,19 @@ func (orderService *OrderService) ReturnGoods(returnGoodsCommand *command.Return |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
returnGoodsService, err := factory.CreateReturnGoodsService(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
order, err := returnGoodsService.Return(int64(returnGoodsCommand.OrderId))
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
return order, nil
|
|
|
}
|
|
|
|
|
|
// 订单发货服务
|
...
|
...
|
@@ -282,10 +298,18 @@ func (orderService *OrderService) ShippingGoods(shippingGoodsCommand *command.Sh |
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
shippingService, err := factory.CreateShippingService(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
order, err := shippingService.Shipping(int64(shippingGoodsCommand.OrderId))
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return nil, nil
|
|
|
return order, nil
|
|
|
}
|
|
|
|
|
|
// 更新订单增删改查
|
...
|
...
|
|