作者 陈志颖

合并分支 'dev' 到 'test'

fix:修改今日实发订单统计



查看合并请求 !52
... ... @@ -120,6 +120,13 @@ func orderTotalStatic(order *domain.OrderBase) interface{} {
return item
}
/**
* @Author SteveChan
* @Description //TODO 订单统计
* @Date 18:14 2021/1/28
* @Param
* @return
**/
// 订单统计
func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatisticsRequest) (rsp *protocol.OrderStatisticsResponse, err error) {
var (
... ... @@ -127,15 +134,18 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic
OrderDao, _ = factory.CreateOrderBaseDao(transactionContext)
BusinessBonusRepository, _ = factory.CreateBusinessBonusRepository(transactionContext)
)
if err = transactionContext.StartTransaction(); err != nil {
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
rsp = &protocol.OrderStatisticsResponse{Statistics: &protocol.OrderStatics{}}
// 当天订单/累计订单
// 今日新增实发订单
if rsp.Statistics.TodayRealQuantity, rsp.Statistics.TodayRealMoney, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
BeginTime: utils.GetDayBegin().Unix() * 1000,
EndTime: utils.GetDayEnd().Unix() * 1000,
... ... @@ -144,6 +154,8 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic
}); err != nil {
return
}
// 累计实发订单
if rsp.Statistics.CumulativeQuantity, rsp.Statistics.CumulativeMoney, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: time.Now().Unix() * 1000,
OrderTypes: domain.UserOrderTypes(domain.Career),
... ... @@ -151,6 +163,7 @@ func Statistics(header *protocol.RequestHeader, request *protocol.OrderStatistic
}); err != nil {
return
}
rsp.Statistics.TodayRealMoney = utils.Decimal(rsp.Statistics.TodayRealMoney)
rsp.Statistics.CumulativeMoney = utils.Decimal(rsp.Statistics.CumulativeMoney)
... ... @@ -206,7 +219,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
OrderType: request.OrderType,
OrderTypes: request.OrderTypes,
}
// 当月累计订单
// 当月累计实发订单
d := time.Now()
if request.StartTime > 0 {
queryOption.BeginTime = time.Unix(request.StartTime/1000, 0)
... ... @@ -218,7 +231,8 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
} else {
queryOption.EndTime = utils.GetLastDateOfMonth(d)
}
// 今日订单
// 今日新增实发订单
if request.IsToday {
queryOption.BeginTime = utils.GetZeroTime(d)
queryOption.EndTime = utils.GetEndTime(d)
... ... @@ -235,7 +249,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
}
}
// 【特殊处理1】 查询第0页时,需要查询累计实发订单数
// 【特殊处理1】 查询第0页时,需要查询累计实发订单数,并下发时间戳
if request.PageIndex == 0 {
var (
cumulativeQuantity int
... ... @@ -257,6 +271,22 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r
}
}
// 【特殊处理3】今日新增实发订单统计
if request.IsToday {
var (
todayQuantity int
)
todayQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
BeginTime: queryOption.BeginTime.Unix() * 1000,
//EndTime: time.Now().Unix() * 1000,
EndTime: queryOption.EndTime.Unix() * 1000,
OrderTypes: domain.UserOrderTypes(domain.Career),
PartnerId: request.PartnerId,
PartnerCategoryId: request.JoinWay,
})
rsp.Total = todayQuantity
}
err = transactionContext.CommitTransaction()
return
}
... ...
... ... @@ -4,9 +4,9 @@ import "os"
var POSTGRESQL_DB_NAME = "partner_test" //partner_test/partner_dev
var POSTGRESQL_USER = "postgres" //postgres
var POSTGRESQL_PASSWORD = "eagle1010" //pgsql@123/1993618jack
var POSTGRESQL_HOST = "114.55.200.59" //127.0.0.1/114.55.200.59
var POSTGRESQL_PORT = "31543" //5432/31543
var POSTGRESQL_PASSWORD = "1993618jack" //pgsql@123/1993618jack/eagle1010
var POSTGRESQL_HOST = "127.0.0.1" //127.0.0.1/114.55.200.59
var POSTGRESQL_PORT = "5432" //5432/31543
var DISABLE_CREATE_TABLE = true
var DISABLE_SQL_GENERATE_PRINT = false
... ...