store_track_statistics 表中的各个数据字段存储的是JSON格式的统计数据。本文档详细说明各个字段的JSON格式。
字段说明:存储流量相关的统计数据
JSON格式:
{
"searchCount": 100, // 搜索量(Long类型)
"viewCount": 500, // 浏览量(Long类型)
"visitorCount": 300, // 访客数(去重后的用户数,Long类型)
"newVisitorCount": 50, // 新增访客数(Long类型)
"totalDuration": 1500000, // 总访问时长(毫秒,Long类型)
"avgDuration": 5000 // 平均访问时长(毫秒,Long类型)
}
字段说明:
searchCount: 店铺搜索次数viewCount: 店铺浏览次数visitorCount: 访客数(去重后的用户ID数量)newVisitorCount: 新增访客数(在统计日期之前没有访问记录的用户)totalDuration: 总访问时长(所有浏览事件duration字段的总和,单位:毫秒)avgDuration: 平均访问时长(totalDuration / 有duration的浏览事件数,单位:毫秒)字段说明:存储用户互动相关的统计数据
JSON格式:
{
"collectCount": 50, // 收藏次数(Long类型)
"shareCount": 30, // 分享次数(Long类型)
"checkinCount": 20, // 打卡次数(Long类型)
"consultCount": 10, // 咨询次数(Long类型)
"friendCount": 100, // 好友数量(互相关注的用户数,Long类型)
"followCount": 200, // 关注数量(店铺用户关注的人数,Long类型)
"fansCount": 150, // 粉丝数量(关注店铺用户的人数,Long类型)
"postCount": 25, // 发布动态数量(Long类型)
"postLikeCount": 200, // 动态点赞数量(Long类型)
"postCommentCount": 80, // 动态评论数量(Long类型)
"postRepostCount": 15, // 动态转发数量(Long类型)
"reportCount": 5, // 被举报次数(Long类型)
"blockCount": 2 // 被拉黑次数(Long类型)
}
字段说明:
collectCount: 店铺收藏次数(从埋点事件中统计COLLECT类型)shareCount: 店铺分享次数(从埋点事件中统计SHARE类型)checkinCount: 店铺打卡次数(从埋点事件中统计CHECKIN类型)consultCount: 咨询商家次数(从埋点事件中统计CONSULT类型)friendCount: 好友数量(通过life_fans表查询互相关注的用户数)followCount: 关注数量(店铺用户关注的人数)fansCount: 粉丝数量(关注店铺用户的人数)postCount: 发布动态数量(从life_user_dynamics表查询,type=2商家社区)postLikeCount: 动态点赞数量(从埋点事件中统计POST_LIKE类型)postCommentCount: 动态评论数量(从埋点事件中统计POST_COMMENT类型)postRepostCount: 动态转发数量(从埋点事件中统计POST_REPOST类型)reportCount: 被举报次数(从埋点事件中统计REPORT类型)blockCount: 被拉黑次数(从埋点事件中统计BLOCK类型)字段说明:存储优惠券相关的统计数据
JSON格式:
{
"giveToFriendCount": 50, // 赠送好友数量(Long类型)
"giveToFriendAmount": 5000.00, // 赠送好友金额合计(BigDecimal类型,单位:元)
"giveToFriendUseCount": 30, // 赠送好友使用数量(Long类型)
"giveToFriendUseAmount": 3000.00, // 赠送好友使用金额合计(BigDecimal类型,单位:元)
"giveToFriendUseAmountPercent": 60.00, // 赠送好友使用金额占比(Double类型,单位:%)
"friendGiveCount": 20, // 好友赠送数量(Long类型)
"friendGiveAmount": 2000.00, // 好友赠送金额合计(BigDecimal类型,单位:元)
"friendGiveUseCount": 15, // 好友赠送使用数量(Long类型)
"friendGiveUseAmount": 1500.00, // 好友赠送使用金额合计(BigDecimal类型,单位:元)
"friendGiveUseAmountPercent": 75.00 // 好友赠送使用金额占比(Double类型,单位:%)
}
字段说明:
giveToFriendCount: 赠送好友数量(从life_discount_coupon_user表统计,关联店铺的优惠券)giveToFriendAmount: 赠送好友金额合计(优惠券面值的总和)giveToFriendUseCount: 赠送好友使用数量(status=1已使用的数量)giveToFriendUseAmount: 赠送好友使用金额合计(已使用优惠券的面值总和)giveToFriendUseAmountPercent: 赠送好友使用金额占比(giveToFriendUseAmount / giveToFriendAmount * 100)friendGiveCount: 好友赠送数量(好友赠送给店铺用户的优惠券数量,从life_discount_coupon_store_friend表统计)friendGiveAmount: 好友赠送金额合计(好友赠送的优惠券面值总和)friendGiveUseCount: 好友赠送使用数量(已使用的数量)friendGiveUseAmount: 好友赠送使用金额合计(已使用的优惠券面值总和)friendGiveUseAmountPercent: 好友赠送使用金额占比(friendGiveUseAmount / friendGiveAmount * 100)字段说明:存储代金券相关的统计数据
JSON格式:
{
"giveToFriendCount": 30, // 赠送好友数量(Long类型)
"giveToFriendAmount": 3000.00, // 赠送好友金额合计(BigDecimal类型,单位:元)
"giveToFriendUseCount": 20, // 赠送好友使用数量(Long类型)
"giveToFriendUseAmount": 2000.00, // 赠送好友使用金额合计(BigDecimal类型,单位:元)
"giveToFriendUseAmountPercent": 66.67, // 赠送好友使用金额占比(Double类型,单位:%)
"friendGiveCount": 10, // 好友赠送数量(Long类型)
"friendGiveAmount": 1000.00, // 好友赠送金额合计(BigDecimal类型,单位:元)
"friendGiveUseCount": 8, // 好友赠送使用数量(Long类型)
"friendGiveUseAmount": 800.00, // 好友赠送使用金额合计(BigDecimal类型,单位:元)
"friendGiveUseAmountPercent": 80.00 // 好友赠送使用金额占比(Double类型,单位:%)
}
字段说明:
giveToFriendCount: 赠送好友数量(从埋点事件中统计VOUCHER_GIVE类型)giveToFriendAmount: 赠送好友金额合计(从埋点事件的amount字段汇总)giveToFriendUseCount: 赠送好友使用数量(从埋点事件中统计VOUCHER_USE类型)giveToFriendUseAmount: 赠送好友使用金额合计(从埋点事件的amount字段汇总)giveToFriendUseAmountPercent: 赠送好友使用金额占比(giveToFriendUseAmount / giveToFriendAmount * 100)friendGiveCount: 好友赠送数量(好友赠送给店铺用户的代金券数量,从life_discount_coupon_store_friend表统计,type=1代金券)friendGiveAmount: 好友赠送金额合计(好友赠送的代金券面值总和)friendGiveUseCount: 好友赠送使用数量(已使用的数量)friendGiveUseAmount: 好友赠送使用金额合计(已使用的代金券面值总和)friendGiveUseAmountPercent: 好友赠送使用金额占比(friendGiveUseAmount / friendGiveAmount * 100)字段说明:存储服务质量相关的统计数据
JSON格式:
{
"storeScore": 4.5, // 店铺评分(Double类型,0-5分)
"tasteScore": 4.3, // 口味评分(Double类型,0-5分)
"environmentScore": 4.2, // 环境评分(Double类型,0-5分)
"serviceScore": 4.4, // 服务评分(Double类型,0-5分)
"ratingCount": 100, // 评价数量(Long类型)
"goodRatingCount": 60, // 好评数量(score >= 4.5,Long类型)
"midRatingCount": 30, // 中评数量(3.0 <= score <= 4.0,Long类型)
"badRatingCount": 10, // 差评数量(0.5 <= score <= 2.5,Long类型)
"badRatingPercent": 10.00, // 差评占比(Double类型,单位:%)
"appealCount": 5, // 差评申诉次数(Long类型)
"appealSuccessCount": 3, // 差评申诉成功次数(Long类型)
"appealSuccessPercent": 60.00 // 差评申诉成功占比(Double类型,单位:%)
}
字段说明:
storeScore: 店铺评分(从common_rating表统计,businessType=1,计算平均分)tasteScore: 口味评分(从common_rating表的otherScore字段解析"口味"评分,计算平均分)environmentScore: 环境评分(从common_rating表的otherScore字段解析"环境"评分,计算平均分)serviceScore: 服务评分(从common_rating表的otherScore字段解析"服务"评分,计算平均分)ratingCount: 评价数量(common_rating表中该店铺的评价总数)goodRatingCount: 好评数量(score >= 4.5的评价数)midRatingCount: 中评数量(3.0 <= score <= 4.0的评价数)badRatingCount: 差评数量(0.5 <= score <= 2.5的评价数)badRatingPercent: 差评占比(badRatingCount / ratingCount * 100)appealCount: 差评申诉次数(从埋点事件中统计APPEAL类型)appealSuccessCount: 差评申诉成功次数(从store_comment_appeal表统计,appealStatus=2已同意)appealSuccessPercent: 差评申诉成功占比(appealSuccessCount / appealCount * 100)otherScore字段格式示例:
{
"口味": 5.0,
"环境": 4.5,
"服务": 4.0
}
字段说明:存储价目表排名相关的统计数据(数组格式)
JSON格式:
[
{
"priceId": 1001, // 价目表ID(Integer类型)
"viewCount": 500, // 浏览量(Integer类型)
"visitorCount": 300, // 访客数(Integer类型)
"shareCount": 50 // 分享数(Integer类型)
},
{
"priceId": 1002,
"viewCount": 400,
"visitorCount": 250,
"shareCount": 40
},
{
"priceId": 1003,
"viewCount": 300,
"visitorCount": 200,
"shareCount": 30
}
]
字段说明:
viewCount(浏览量)降序排列priceId: 价目表ID(targetId字段)viewCount: 浏览量(PRICE_VIEW事件数量)visitorCount: 访客数(去重后的用户ID数量)shareCount: 分享数(PRICE_SHARE事件数量)统计数据通过定时任务自动计算并保存:
定时任务类:TrackStatisticsScheduler.java
如果需要手动触发统计数据计算,可以调用:
trackEventService.calculateAndSaveStatistics(storeId, statDate, statType);
参数说明:
storeId: 店铺IDstatDate: 统计日期statType: 统计类型(DAILY/WEEKLY/MONTHLY)uk_store_date_type 保证唯一性数据类型:
空值处理:
数据精度:
性能优化: