作者 唐旭辉

更新:去除实际订单的订单号查重的限制

... ... @@ -225,11 +225,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, 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, "订单号已存在")
}
// 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 {
... ... @@ -427,13 +427,13 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand)
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
}
//检查order_code是否重复
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, "订单号已存在")
}
}
// 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 {
... ...