|
@@ -202,11 +202,11 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
|
@@ -202,11 +202,11 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
202
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
202
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
203
|
}
|
203
|
}
|
204
|
//检查order_code是否重复
|
204
|
//检查order_code是否重复
|
205
|
- // if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode); err != nil {
|
|
|
206
|
- // return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
207
|
- // } else if ok {
|
|
|
208
|
- // return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
209
|
- // }
|
205
|
+ if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.PartnerCategory, cmd.PartnerId); err != nil {
|
|
|
206
|
+ return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
207
|
+ } else if ok {
|
|
|
208
|
+ return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
209
|
+ }
|
210
|
//检查delivery_code是否重复
|
210
|
//检查delivery_code是否重复
|
211
|
if len(cmd.DeliveryCode) > 0 {
|
211
|
if len(cmd.DeliveryCode) > 0 {
|
212
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId); err != nil {
|
212
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId); err != nil {
|
|
@@ -388,11 +388,13 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
|
@@ -388,11 +388,13 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
388
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
388
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
389
|
}
|
389
|
}
|
390
|
//检查order_code是否重复
|
390
|
//检查order_code是否重复
|
391
|
- // if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.Id); err != nil {
|
|
|
392
|
- // return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
393
|
- // } else if ok {
|
|
|
394
|
- // return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
395
|
- // }
|
391
|
+ if oldOrderData.OrderCode != cmd.OrderCode || cmd.PartnerCategory != oldOrderData.PartnerCategory.Id {
|
|
|
392
|
+ if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.PartnerCategory, cmd.PartnerId); err != nil {
|
|
|
393
|
+ return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
394
|
+ } else if ok {
|
|
|
395
|
+ return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
396
|
+ }
|
|
|
397
|
+ }
|
396
|
//检查delivery_code是否重复
|
398
|
//检查delivery_code是否重复
|
397
|
if cmd.DeliveryCode != oldOrderData.DeliveryCode {
|
399
|
if cmd.DeliveryCode != oldOrderData.DeliveryCode {
|
398
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.Id); err != nil {
|
400
|
if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.Id); err != nil {
|