|
@@ -225,20 +225,14 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
|
@@ -225,20 +225,14 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( |
225
|
}); err != nil {
|
225
|
}); err != nil {
|
226
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
226
|
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
227
|
}
|
227
|
}
|
228
|
- //检查order_code是否重复
|
|
|
229
|
- // if ok, err := orderBaseDao.OrderCodeExist(cmd.OrderCode, cmd.PartnerCategory, cmd.PartnerId); err != nil {
|
|
|
230
|
- // return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
231
|
- // } else if ok {
|
|
|
232
|
- // return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单号已存在")
|
|
|
233
|
- // }
|
|
|
234
|
- //检查delivery_code是否重复
|
|
|
235
|
- if len(cmd.DeliveryCode) > 0 {
|
|
|
236
|
- if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId); err != nil {
|
|
|
237
|
- return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
238
|
- } else if ok {
|
|
|
239
|
- return nil, lib.ThrowError(lib.BUSINESS_ERROR, "发货号已存在")
|
|
|
240
|
- }
|
228
|
+
|
|
|
229
|
+ if ok, err := orderBaseDao.CheckOrderExist(cmd.CompanyId, cmd.OrderCode, cmd.DeliveryCode,
|
|
|
230
|
+ cmd.PartnerCategory, cmd.PartnerId, 0); err != nil {
|
|
|
231
|
+ return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
232
|
+ } else if ok {
|
|
|
233
|
+ return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单已存在")
|
241
|
}
|
234
|
}
|
|
|
235
|
+
|
242
|
newOrder := &domain.OrderBase{
|
236
|
newOrder := &domain.OrderBase{
|
243
|
OrderType: cmd.OrderType, OrderCode: cmd.OrderCode,
|
237
|
OrderType: cmd.OrderType, OrderCode: cmd.OrderCode,
|
244
|
DeliveryCode: cmd.DeliveryCode,
|
238
|
DeliveryCode: cmd.DeliveryCode,
|
|
@@ -436,12 +430,10 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
|
@@ -436,12 +430,10 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) |
436
|
// }
|
430
|
// }
|
437
|
// }
|
431
|
// }
|
438
|
//检查delivery_code是否重复
|
432
|
//检查delivery_code是否重复
|
439
|
- if cmd.DeliveryCode != oldOrderData.DeliveryCode {
|
|
|
440
|
- if ok, err := orderBaseDao.DeliveryCodeExist(cmd.DeliveryCode, cmd.CompanyId, cmd.Id); err != nil {
|
|
|
441
|
- return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
442
|
- } else if ok {
|
|
|
443
|
- return nil, lib.ThrowError(lib.BUSINESS_ERROR, "发货号已存在")
|
|
|
444
|
- }
|
433
|
+ if ok, err := orderBaseDao.CheckOrderExist(cmd.CompanyId, cmd.OrderCode, cmd.DeliveryCode, cmd.PartnerCategory, cmd.PartnerId, cmd.Id); err != nil {
|
|
|
434
|
+ return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
|
|
435
|
+ } else if ok {
|
|
|
436
|
+ return nil, lib.ThrowError(lib.BUSINESS_ERROR, "订单已存在")
|
445
|
}
|
437
|
}
|
446
|
//获取旧的订单中的商品
|
438
|
//获取旧的订单中的商品
|
447
|
oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|
439
|
oldOrderGoods, _, err = orderGoodRepository.Find(domain.OrderGoodFindQuery{
|