...
|
...
|
@@ -29,7 +29,8 @@ func NewOrderInfoService(option map[string]interface{}) *OrderInfoService { |
|
|
}
|
|
|
|
|
|
// PageListOrderBase 获取订单列表
|
|
|
func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrderBaseQuery) ([]domain.OrderBase, int, error) {
|
|
|
func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrderBaseQuery) ([]map[string]interface{}, int, error) {
|
|
|
var err error
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -41,28 +42,24 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder |
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var (
|
|
|
orderRepository domain.OrderBaseRepository
|
|
|
orders []domain.OrderBase
|
|
|
cnt int
|
|
|
orderDao *dao.OrderBaseDao
|
|
|
orders []models.OrderBase
|
|
|
cnt int
|
|
|
)
|
|
|
|
|
|
if value, err := factory.CreateOrderBaseRepository(map[string]interface{}{
|
|
|
if orderDao, err = factory.CreateOrderBaseDao(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
}); err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
|
|
orderRepository = value
|
|
|
}
|
|
|
query := domain.OrderBaseFindQuery{
|
|
|
PartnerId: listOrderQuery.PartnerId,
|
|
|
OrderCode: listOrderQuery.OrderCode,
|
|
|
Offset: listOrderQuery.Offset,
|
|
|
Limit: listOrderQuery.Limit,
|
|
|
OrderType: listOrderQuery.OrderType,
|
|
|
DeliveryCode: listOrderQuery.DeliveryCode,
|
|
|
CompanyId: listOrderQuery.CompanyId,
|
|
|
}
|
|
|
orders, cnt, err = orderRepository.Find(query)
|
|
|
}
|
|
|
orders, cnt, err = orderDao.OrderListByCondition(
|
|
|
listOrderQuery.CompanyId,
|
|
|
listOrderQuery.OrderType,
|
|
|
listOrderQuery.PartnerOrCode,
|
|
|
[2]string{listOrderQuery.UpdateTimeBegin, listOrderQuery.UpdateTimeEnd},
|
|
|
listOrderQuery.PartnerCategory,
|
|
|
listOrderQuery.Limit, listOrderQuery.Offset,
|
|
|
)
|
|
|
if err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -72,6 +69,8 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder |
|
|
}); err != nil {
|
|
|
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
orderDataReturn := make([]map[string]interface{}, 0)
|
|
|
for i := range orders {
|
|
|
partnerData := &domain.PartnerInfo{}
|
|
|
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
|
...
|
...
|
@@ -79,12 +78,33 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder |
|
|
})
|
|
|
if err != nil {
|
|
|
logs.Error("获取合伙(id=%d)失败%s", orders[i].PartnerId, err)
|
|
|
} else {
|
|
|
orders[i].PartnerInfo = partnerData.Partner
|
|
|
}
|
|
|
m := map[string]interface{}{
|
|
|
"createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"buyer": orders[i].Buyer.BuyerName,
|
|
|
"id": orders[i].Id,
|
|
|
"orderId": orders[i].OrderCode,
|
|
|
"shipmentsId": orders[i].DeliveryCode,
|
|
|
"partner": partnerData.Partner.PartnerName,
|
|
|
"orderNum": orders[i].PlanOrderCount,
|
|
|
"orderPrice": orders[i].PlanOrderAmount,
|
|
|
"orderDist": orders[i].RegionInfo.RegionName,
|
|
|
"quantityControl": "",
|
|
|
"priceControl": "",
|
|
|
"status": orders[i].IsDisable,
|
|
|
"partnerCategory": orders[i].PartnerCategory.Name,
|
|
|
}
|
|
|
if orders[i].UseOrderCount >= 0 {
|
|
|
m["quantityControl"] = fmt.Sprint(orders[i].UseOrderCount)
|
|
|
}
|
|
|
if orders[i].UseOrderAmount >= 0 {
|
|
|
m["priceControl"] = fmt.Sprint(orders[i].UseOrderAmount)
|
|
|
}
|
|
|
orderDataReturn = append(orderDataReturn, m)
|
|
|
}
|
|
|
transactionContext.CommitTransaction()
|
|
|
return orders, cnt, nil
|
|
|
return orderDataReturn, cnt, nil
|
|
|
}
|
|
|
|
|
|
//GetOrderDetail 获取订单详情
|
...
|
...
|
@@ -766,6 +786,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde |
|
|
listOrderQuery.CompanyId,
|
|
|
listOrderQuery.OrderType,
|
|
|
listOrderQuery.PartnerOrCode,
|
|
|
listOrderQuery.PartnerCategory,
|
|
|
listOrderQuery.Limit,
|
|
|
listOrderQuery.Offset,
|
|
|
)
|
...
|
...
|
|