64 lines
3.2 KiB
Go
64 lines
3.2 KiB
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gitee.com/red-future---jilin-g/common/beans"
|
|
)
|
|
|
|
// OrderStatistics 订单统计数据实体
|
|
type OrderStatistics struct {
|
|
beans.MongoBaseDO `bson:",inline"`
|
|
ReportType string `bson:"report_type" json:"report_type"` // 报表类型: daily, monthly, quarterly, yearly
|
|
ReportDate time.Time `bson:"report_date" json:"report_date"` // 统计日期
|
|
Period string `bson:"period" json:"period"` // 统计周期描述: 2024-01-01, 2024-01, 2024-Q1, 2024
|
|
|
|
// 订单基础统计
|
|
TotalOrders int64 `bson:"total_orders" json:"total_orders"` // 总订单数
|
|
CompletedOrders int64 `bson:"completed_orders" json:"completed_orders"` // 已完成订单数
|
|
CancelledOrders int64 `bson:"cancelled_orders" json:"cancelled_orders"` // 已取消订单数
|
|
PaidOrders int64 `bson:"paid_orders" json:"paid_orders"` // 已支付订单数
|
|
|
|
// 金额统计(单位:分)
|
|
TotalAmount int64 `bson:"total_amount" json:"total_amount"` // 订单总金额
|
|
PaidAmount int64 `bson:"paid_amount" json:"paid_amount"` // 已支付金额
|
|
RefundAmount int64 `bson:"refund_amount" json:"refund_amount"` // 退款金额
|
|
NetAmount int64 `bson:"net_amount" json:"net_amount"` // 净收入金额
|
|
|
|
// 业务指标
|
|
AverageOrderValue int64 `bson:"average_order_value" json:"average_order_value"` // 平均客单价
|
|
PaymentRate float64 `bson:"payment_rate" json:"payment_rate"` // 支付成功率
|
|
CompletionRate float64 `bson:"completion_rate" json:"completion_rate"` // 完成率
|
|
|
|
// 用户统计
|
|
UniqueUsers int64 `bson:"unique_users" json:"unique_users"` // 唯一用户数
|
|
NewUsers int64 `bson:"new_users" json:"new_users"` // 新用户数
|
|
ReturningUsers int64 `bson:"returning_users" json:"returning_users"` // 回头用户数
|
|
|
|
// 商品统计
|
|
TotalItems int64 `bson:"total_items" json:"total_items"` // 商品总数量
|
|
UniqueAssets int64 `bson:"unique_assets" json:"unique_assets"` // 唯一资产数
|
|
TopAssetID string `bson:"top_asset_id,omitempty" json:"top_asset_id"` // 热门资产ID
|
|
TopAssetName string `bson:"top_asset_name,omitempty" json:"top_asset_name"` // 热门资产名称
|
|
TopAssetCount int64 `bson:"top_asset_count,omitempty" json:"top_asset_count"` // 热门资产销量
|
|
}
|
|
|
|
// OrderStatisticsUserStats 用户统计明细
|
|
type OrderStatisticsUserStats struct {
|
|
UserID int64 `bson:"user_id" json:"user_id"`
|
|
OrderCount int64 `bson:"order_count" json:"order_count"`
|
|
TotalAmount int64 `bson:"total_amount" json:"total_amount"`
|
|
FirstOrder time.Time `bson:"first_order" json:"first_order"`
|
|
LastOrder time.Time `bson:"last_order" json:"last_order"`
|
|
}
|
|
|
|
// OrderStatisticsAssetStats 资产统计明细
|
|
type OrderStatisticsAssetStats struct {
|
|
AssetID string `bson:"asset_id" json:"asset_id"`
|
|
AssetName string `bson:"asset_name" json:"asset_name"`
|
|
AssetType string `bson:"asset_type" json:"asset_type"`
|
|
OrderCount int64 `bson:"order_count" json:"order_count"`
|
|
TotalAmount int64 `bson:"total_amount" json:"total_amount"`
|
|
Quantity int64 `bson:"quantity" json:"quantity"`
|
|
}
|