|
@@ -132,6 +132,14 @@ func (service OrderService) CreateOrder(command command.CreateOrderCommand) erro |
|
@@ -132,6 +132,14 @@ func (service OrderService) CreateOrder(command command.CreateOrderCommand) erro |
132
|
transactionContext.RollbackTransaction()
|
132
|
transactionContext.RollbackTransaction()
|
133
|
}()
|
133
|
}()
|
134
|
|
134
|
|
|
|
135
|
+ orderDao, _ := factory.CreateOrderDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
136
|
+ ok, err := orderDao.OrderCodeIsExist(command.OrderCode, 0)
|
|
|
137
|
+ if err != nil {
|
|
|
138
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
139
|
+ }
|
|
|
140
|
+ if ok {
|
|
|
141
|
+ return lib.ThrowError(lib.BUSINESS_ERROR, "订单编号已存在")
|
|
|
142
|
+ }
|
135
|
var PartnerInfoRepository domain.PartnerInfoRepository
|
143
|
var PartnerInfoRepository domain.PartnerInfoRepository
|
136
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
144
|
if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{
|
137
|
"transactionContext": transactionContext,
|
145
|
"transactionContext": transactionContext,
|
|
@@ -210,6 +218,14 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman |
|
@@ -210,6 +218,14 @@ func (service OrderService) UpdateOrderPurpose(command command.UpdateOrderComman |
210
|
defer func() {
|
218
|
defer func() {
|
211
|
transactionContext.RollbackTransaction()
|
219
|
transactionContext.RollbackTransaction()
|
212
|
}()
|
220
|
}()
|
|
|
221
|
+ orderDao, _ := factory.CreateOrderDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
222
|
+ ok, err := orderDao.OrderCodeIsExist(command.OrderCode, command.Id)
|
|
|
223
|
+ if err != nil {
|
|
|
224
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
225
|
+ }
|
|
|
226
|
+ if ok {
|
|
|
227
|
+ return lib.ThrowError(lib.BUSINESS_ERROR, "订单编号已存在")
|
|
|
228
|
+ }
|
213
|
var (
|
229
|
var (
|
214
|
orderRepository domain.OrderRepository
|
230
|
orderRepository domain.OrderRepository
|
215
|
orderData *domain.Order
|
231
|
orderData *domain.Order
|
|
@@ -318,6 +334,14 @@ func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealComma |
|
@@ -318,6 +334,14 @@ func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealComma |
318
|
defer func() {
|
334
|
defer func() {
|
319
|
transactionContext.RollbackTransaction()
|
335
|
transactionContext.RollbackTransaction()
|
320
|
}()
|
336
|
}()
|
|
|
337
|
+ orderDao, _ := factory.CreateOrderDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
338
|
+ ok, err := orderDao.OrderCodeIsExist(command.OrderCode, command.Id)
|
|
|
339
|
+ if err != nil {
|
|
|
340
|
+ return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
341
|
+ }
|
|
|
342
|
+ if ok {
|
|
|
343
|
+ return lib.ThrowError(lib.BUSINESS_ERROR, "订单编号已存在")
|
|
|
344
|
+ }
|
321
|
var (
|
345
|
var (
|
322
|
orderRepository domain.OrderRepository
|
346
|
orderRepository domain.OrderRepository
|
323
|
orderData *domain.Order
|
347
|
orderData *domain.Order
|