...
|
...
|
@@ -202,11 +202,11 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
//检查order_code是否重复
|
|
|
// if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode); 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.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 {
|
...
|
...
|
@@ -388,11 +388,13 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
|
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
//检查order_code是否重复
|
|
|
// if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.Id); err != nil {
|
|
|
// return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
// } else if ok {
|
|
|
// return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
// }
|
|
|
if oldOrderData.OrderCode != cmd.OrderCode || cmd.PartnerCategory != oldOrderData.PartnerCategory.Id {
|
|
|
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 cmd.DeliveryCode != oldOrderData.DeliveryCode {
|
|
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.Id); err != nil {
|
...
|
...
|
|