作者 陈志颖

feat:调整分红退货单查找服务

... ... @@ -208,7 +208,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends
}
}
// ImportDividendsReturnedOrder 导入分红退货单
// ImportDividendsReturnedOrder TODO 导入分红退货单
func (dividendsReturnedOrderService *DividendsReturnedOrderService) ImportDividendsReturnedOrder(importDividendsReturnedOrderCommand *command.ImportDividendsReturnedOrderCommand) (interface{}, error) {
if err := importDividendsReturnedOrderCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -367,10 +367,27 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide
defer func() {
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{
"transactionContext": transactionContext,
}); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
dividendsReturnedOrderRepository = value
}
if count, dividendsReturnedOrders, err := dividendsReturnedOrderRepository.Find(tool_funs.SimpleStructToMap(searchDividendsReturnedOrderQuery)); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return map[string]interface{}{
"grid": map[string]interface{}{
"total": count,
"list": dividendsReturnedOrders,
},
}, nil
}
return nil, nil
}
// UpdateDividendsReturnedOrder 更新分红退货单服务
... ...
... ... @@ -329,6 +329,12 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
if dividendsReturnedOrderIds, ok := queryOptions["dividendsReturnedOrderIds"]; ok && len(dividendsReturnedOrderIds.([]int64)) > 0 {
query.Where("dividends_returned_order_id IN (?)", pg.In(dividendsReturnedOrderIds.([]int64)))
}
if dividendsReturnedOrderNumber, ok := queryOptions["dividendsReturnedOrderNumber"]; ok && dividendsReturnedOrderNumber != "" {
query.Where("dividends_returned_order_number ilike ?", fmt.Sprintf("%%%s%%", dividendsReturnedOrderNumber))
}
if dividendsReturnedCustomerName, ok := queryOptions["dividendsReturnedCustomerName"]; ok && dividendsReturnedCustomerName != "" {
query.Where("dividends_returned_customer_name like ?", fmt.Sprintf("%%%s%%", dividendsReturnedCustomerName))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
offsetLimitFlag = offsetLimit.(bool)
... ...
... ... @@ -83,6 +83,7 @@ func (controller *DividendsReturnedOrderController) BatchRemoveDividendsReturned
func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder() {
dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
searchDividendsReturnedOrderQuery := &query.SearchDividendsReturnedOrderQuery{}
_ = controller.Unmarshal(searchDividendsReturnedOrderQuery)
header := controller.GetRequestHeader(controller.Ctx)
searchDividendsReturnedOrderQuery.CompanyId = header.CompanyId
searchDividendsReturnedOrderQuery.OrgId = header.OrgId
... ...