...
|
...
|
@@ -225,20 +225,14 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
|
|
}); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
//检查order_code是否重复
|
|
|
// if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.PartnerCategory, cmd.PartnerId); err != nil {
|
|
|
// return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
// } else if ok {
|
|
|
// return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
// }
|
|
|
//检查delivery_code是否重复
|
|
|
if len(cmd.DeliveryCode) > 0 {
|
|
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
} else if ok {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "发货号已存在")
|
|
|
}
|
|
|
|
|
|
if ok, err := orderBaseDao.CheckOrderExist(cmd.CompanyId, cmd.OrderCode, cmd.DeliveryCode,
|
|
|
cmd.PartnerCategory, cmd.PartnerId, 0); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
} else if ok {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单已存在")
|
|
|
}
|
|
|
|
|
|
newOrder := &domain.OrderBase{
|
|
|
OrderType: cmd.OrderType, OrderCode: cmd.OrderCode,
|
|
|
DeliveryCode: cmd.DeliveryCode,
|
...
|
...
|
@@ -436,12 +430,10 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
|
|
// }
|
|
|
// }
|
|
|
//检查delivery_code是否重复
|
|
|
if cmd.DeliveryCode != oldOrderData.DeliveryCode {
|
|
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.Id); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
} else if ok {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "发货号已存在")
|
|
|
}
|
|
|
if ok, err := orderBaseDao.CheckOrderExist(cmd.CompanyId, cmd.OrderCode, cmd.DeliveryCode, cmd.PartnerCategory, cmd.PartnerId, cmd.Id); err != nil {
|
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
} else if ok {
|
|
|
return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单已存在")
|
|
|
}
|
|
|
//获取旧的订单中的商品
|
|
|
oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|
...
|
...
|
|