正在显示
3 个修改的文件
包含
28 行增加
和
4 行删除
@@ -208,7 +208,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | @@ -208,7 +208,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | ||
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | -// ImportDividendsReturnedOrder 导入分红退货单 | 211 | +// ImportDividendsReturnedOrder TODO 导入分红退货单 |
212 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDividendsReturnedOrder(importDividendsReturnedOrderCommand *command.ImportDividendsReturnedOrderCommand) (interface{}, error) { | 212 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDividendsReturnedOrder(importDividendsReturnedOrderCommand *command.ImportDividendsReturnedOrderCommand) (interface{}, error) { |
213 | if err := importDividendsReturnedOrderCommand.ValidateCommand(); err != nil { | 213 | if err := importDividendsReturnedOrderCommand.ValidateCommand(); err != nil { |
214 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 214 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -367,10 +367,27 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide | @@ -367,10 +367,27 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide | ||
367 | defer func() { | 367 | defer func() { |
368 | _ = transactionContext.RollbackTransaction() | 368 | _ = transactionContext.RollbackTransaction() |
369 | }() | 369 | }() |
370 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
371 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 370 | + var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository |
371 | + if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{ | ||
372 | + "transactionContext": transactionContext, | ||
373 | + }); err != nil { | ||
374 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
375 | + } else { | ||
376 | + dividendsReturnedOrderRepository = value | ||
377 | + } | ||
378 | + if count, dividendsReturnedOrders, err := dividendsReturnedOrderRepository.Find(tool_funs.SimpleStructToMap(searchDividendsReturnedOrderQuery)); err != nil { | ||
379 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
380 | + } else { | ||
381 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
382 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
383 | + } | ||
384 | + return map[string]interface{}{ | ||
385 | + "grid": map[string]interface{}{ | ||
386 | + "total": count, | ||
387 | + "list": dividendsReturnedOrders, | ||
388 | + }, | ||
389 | + }, nil | ||
372 | } | 390 | } |
373 | - return nil, nil | ||
374 | } | 391 | } |
375 | 392 | ||
376 | // UpdateDividendsReturnedOrder 更新分红退货单服务 | 393 | // UpdateDividendsReturnedOrder 更新分红退货单服务 |
@@ -329,6 +329,12 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string | @@ -329,6 +329,12 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string | ||
329 | if dividendsReturnedOrderIds, ok := queryOptions["dividendsReturnedOrderIds"]; ok && len(dividendsReturnedOrderIds.([]int64)) > 0 { | 329 | if dividendsReturnedOrderIds, ok := queryOptions["dividendsReturnedOrderIds"]; ok && len(dividendsReturnedOrderIds.([]int64)) > 0 { |
330 | query.Where("dividends_returned_order_id IN (?)", pg.In(dividendsReturnedOrderIds.([]int64))) | 330 | query.Where("dividends_returned_order_id IN (?)", pg.In(dividendsReturnedOrderIds.([]int64))) |
331 | } | 331 | } |
332 | + if dividendsReturnedOrderNumber, ok := queryOptions["dividendsReturnedOrderNumber"]; ok && dividendsReturnedOrderNumber != "" { | ||
333 | + query.Where("dividends_returned_order_number ilike ?", fmt.Sprintf("%%%s%%", dividendsReturnedOrderNumber)) | ||
334 | + } | ||
335 | + if dividendsReturnedCustomerName, ok := queryOptions["dividendsReturnedCustomerName"]; ok && dividendsReturnedCustomerName != "" { | ||
336 | + query.Where("dividends_returned_customer_name like ?", fmt.Sprintf("%%%s%%", dividendsReturnedCustomerName)) | ||
337 | + } | ||
332 | offsetLimitFlag := true | 338 | offsetLimitFlag := true |
333 | if offsetLimit, ok := queryOptions["offsetLimit"]; ok { | 339 | if offsetLimit, ok := queryOptions["offsetLimit"]; ok { |
334 | offsetLimitFlag = offsetLimit.(bool) | 340 | offsetLimitFlag = offsetLimit.(bool) |
@@ -83,6 +83,7 @@ func (controller *DividendsReturnedOrderController) BatchRemoveDividendsReturned | @@ -83,6 +83,7 @@ func (controller *DividendsReturnedOrderController) BatchRemoveDividendsReturned | ||
83 | func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder() { | 83 | func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder() { |
84 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) | 84 | dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil) |
85 | searchDividendsReturnedOrderQuery := &query.SearchDividendsReturnedOrderQuery{} | 85 | searchDividendsReturnedOrderQuery := &query.SearchDividendsReturnedOrderQuery{} |
86 | + _ = controller.Unmarshal(searchDividendsReturnedOrderQuery) | ||
86 | header := controller.GetRequestHeader(controller.Ctx) | 87 | header := controller.GetRequestHeader(controller.Ctx) |
87 | searchDividendsReturnedOrderQuery.CompanyId = header.CompanyId | 88 | searchDividendsReturnedOrderQuery.CompanyId = header.CompanyId |
88 | searchDividendsReturnedOrderQuery.OrgId = header.OrgId | 89 | searchDividendsReturnedOrderQuery.OrgId = header.OrgId |
-
请 注册 或 登录 后发表评论