作者 陈志颖

feat:调整订单应用服务

... ... @@ -7,7 +7,7 @@ import (
"github.com/beego/beego/v2/core/validation"
)
type ReceivingGoodsCommand struct {
type ReceiveGoodsCommand struct {
// 订单号
OrderNo string `json:"orderNo" valid:"Required"`
// 是否是公司负责人
... ... @@ -38,13 +38,13 @@ type ReceivingGoodsCommand struct {
CompanyId int64 `json:"companyId" valid:"Required"`
}
func (receivingGoodsCommand *ReceivingGoodsCommand) Valid(validation *validation.Validation) {
func (receiveGoodsCommand *ReceiveGoodsCommand) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (receivingGoodsCommand *ReceivingGoodsCommand) ValidateCommand() error {
func (receiveGoodsCommand *ReceiveGoodsCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(receivingGoodsCommand)
b, err := valid.Valid(receiveGoodsCommand)
if err != nil {
return err
}
... ...
... ... @@ -16,7 +16,7 @@ type OrderService struct {
}
// 取消订单服务
func (orderService *OrderService) Cancel(cancelCommand *command.CancelOrderCommand) (interface{}, error) {
func (orderService *OrderService) CancelOrder(cancelCommand *command.CancelOrderCommand) (interface{}, error) {
if err := cancelCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
... ... @@ -172,7 +172,7 @@ func (orderService *OrderService) ListOrder(listOrderQuery *query.ListOrderQuery
}
// 订单收货服务
func (orderService *OrderService) Receiving(receivingCommand *command.ReceivingGoodsCommand) (interface{}, error) {
func (orderService *OrderService) ReceiveGoods(receivingCommand *command.ReceiveGoodsCommand) (interface{}, error) {
if err := receivingCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
... ... @@ -233,8 +233,8 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove
}
// 订单退货服务
func (orderService *OrderService) Return(returnCommand *command.ReturnGoodsCommand) (interface{}, error) {
if err := returnCommand.ValidateCommand(); err != nil {
func (orderService *OrderService) ReturnGoods(returnGoodsCommand *command.ReturnGoodsCommand) (interface{}, error) {
if err := returnGoodsCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
... ... @@ -254,8 +254,8 @@ func (orderService *OrderService) Return(returnCommand *command.ReturnGoodsComma
}
// 订单发货服务
func (orderService *OrderService) Shipping(shippingCommand *command.ShippingGoodsCommand) (interface{}, error) {
if err := shippingCommand.ValidateCommand(); err != nil {
func (orderService *OrderService) ShippingGoods(shippingGoodsCommand *command.ShippingGoodsCommand) (interface{}, error) {
if err := shippingGoodsCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
transactionContext, err := factory.CreateTransactionContext(nil)
... ...
... ... @@ -65,6 +65,6 @@ func (controller *OrderController) Shipping() {
_ = controller.Unmarshal(shippingCmd)
orderId, _ := controller.GetInt(":orderId")
shippingCmd.OrderId = orderId
data, err := orderService.Shipping(shippingCmd)
data, err := orderService.ShippingGoods(shippingCmd)
controller.Response(data, err)
}
... ...