...
|
...
|
@@ -177,7 +177,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic |
|
|
func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (rsp *protocol.OrderListResponse, err error) {
|
|
|
var (
|
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
OrderResponsitory, _ = factory.CreateOrderBaseRepository(transactionContext)
|
|
|
OrderRepository, _ = factory.CreateOrderBaseRepository(transactionContext)
|
|
|
OrderDao, _ = factory.CreateOrderBaseDao(transactionContext)
|
|
|
orders []*domain.OrderBase
|
|
|
total int64
|
...
|
...
|
@@ -200,6 +200,8 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r |
|
|
SortByUpdateTime: domain.DESC,
|
|
|
PartnerId: request.PartnerId,
|
|
|
PartnerCategoryId: request.JoinWay,
|
|
|
OrderType: request.OrderType,
|
|
|
OrderTypes: request.OrderTypes,
|
|
|
}
|
|
|
if request.StartTime > 0 {
|
|
|
queryOption.BeginTime = time.Unix(request.StartTime/1000, 0)
|
...
|
...
|
@@ -207,21 +209,18 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r |
|
|
if request.EndTime > 0 {
|
|
|
queryOption.EndTime = time.Unix(request.EndTime/1000, 0)
|
|
|
}
|
|
|
queryOption.OrderType = request.OrderType
|
|
|
queryOption.OrderTypes = request.OrderTypes
|
|
|
total, orders, _ = OrderResponsitory.Find(utils.ObjectJsonToMap(queryOption))
|
|
|
total, orders, _ = OrderRepository.Find(utils.ObjectJsonToMap(queryOption))
|
|
|
if len(orders) != 0 {
|
|
|
for i := range orders {
|
|
|
rsp.List = append(rsp.List, DomainOrderToOrderListItem(orders[i]))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 查询统计数据
|
|
|
// 【特殊处理1】 查询第0页时,需要查询累计实发订单数
|
|
|
if request.PageIndex == 0 {
|
|
|
var (
|
|
|
cumulativeQuantity int
|
|
|
)
|
|
|
//累计实发订单
|
|
|
cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
|
|
|
EndTime: time.Now().Unix() * 1000,
|
|
|
OrderTypes: domain.UserOrderTypes(domain.Career),
|
...
|
...
|
@@ -230,7 +229,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r |
|
|
})
|
|
|
rsp.Total = cumulativeQuantity
|
|
|
}
|
|
|
// 今天累计数量特殊处理,不需要返回所有订单总数(因为要复用rsp.Total字段)
|
|
|
//【特殊处理2】 今天累计数量特殊处理 当前查询时间段内所有订单总数(复用rsp.Total字段)
|
|
|
if request.StartTime > 0 && request.EndTime > 0 {
|
|
|
zero := time.Time(xtime.XTime(time.Now()).DayBefore(0)).Unix()
|
|
|
if request.StartTime == (zero * 1000) {
|
...
|
...
|
|