|
@@ -1764,6 +1764,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
Long videoId = param.getVideoId();
|
|
Long videoId = param.getVideoId();
|
|
|
Long periodId = param.getPeriodId();
|
|
Long periodId = param.getPeriodId();
|
|
|
Long companyId = param.getCompanyId() != null ? param.getCompanyId() : null;
|
|
Long companyId = param.getCompanyId() != null ? param.getCompanyId() : null;
|
|
|
|
|
+ Long companyUserId = param.getCompanyUserId() != null ? param.getCompanyUserId() : null;
|
|
|
|
|
|
|
|
// 总体数据
|
|
// 总体数据
|
|
|
|
|
|
|
@@ -1775,11 +1776,11 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 统计累计观看人数(对userId去重)
|
|
// 2. 统计累计观看人数(对userId去重)
|
|
|
- Long totalWatchCount = fsCourseWatchLogMapper.countDistinctWatchUsers(videoId, periodId,companyId);
|
|
|
|
|
|
|
+ Long totalWatchCount = fsCourseWatchLogMapper.countDistinctWatchUsers(videoId, periodId,companyId,companyUserId);
|
|
|
vo.setTotalWatchCount(totalWatchCount != null ? totalWatchCount : 0L);
|
|
vo.setTotalWatchCount(totalWatchCount != null ? totalWatchCount : 0L);
|
|
|
|
|
|
|
|
// 3. 统计累计完课人数(duration >= 1200秒,即20分钟,对userId去重)
|
|
// 3. 统计累计完课人数(duration >= 1200秒,即20分钟,对userId去重)
|
|
|
- Long totalCompleteCount = fsCourseWatchLogMapper.countDistinctCompleteUsers(videoId, periodId,companyId);
|
|
|
|
|
|
|
+ Long totalCompleteCount = fsCourseWatchLogMapper.countDistinctCompleteUsers(videoId, periodId,companyId,companyUserId);
|
|
|
vo.setTotalCompleteCount(totalCompleteCount != null ? totalCompleteCount : 0L);
|
|
vo.setTotalCompleteCount(totalCompleteCount != null ? totalCompleteCount : 0L);
|
|
|
|
|
|
|
|
// 4. 计算到课完课率 = 累计完课人数 / 累计观看人数
|
|
// 4. 计算到课完课率 = 累计完课人数 / 累计观看人数
|
|
@@ -1793,7 +1794,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
|
|
|
|
|
// 首次点播数据:营期开始时间+视频时长内的观看记录,view_start=update_time-duration 或 finish_time-duration(SQL内联计算窗口)
|
|
// 首次点播数据:营期开始时间+视频时长内的观看记录,view_start=update_time-duration 或 finish_time-duration(SQL内联计算窗口)
|
|
|
if (periodId != null && videoId != null) {
|
|
if (periodId != null && videoId != null) {
|
|
|
- Map<String, Object> firstStats = fsCourseWatchLogMapper.selectFirstPlaybackStats(videoId, periodId,companyId);
|
|
|
|
|
|
|
+ Map<String, Object> firstStats = fsCourseWatchLogMapper.selectFirstPlaybackStats(videoId, periodId,companyId,companyUserId);
|
|
|
if (firstStats != null && !firstStats.isEmpty()) {
|
|
if (firstStats != null && !firstStats.isEmpty()) {
|
|
|
Long firstWatch = getLongFromMap(firstStats, "firstWatchCount");
|
|
Long firstWatch = getLongFromMap(firstStats, "firstWatchCount");
|
|
|
Long first20 = getLongFromMap(firstStats, "firstWatch20MinCount");
|
|
Long first20 = getLongFromMap(firstStats, "firstWatch20MinCount");
|
|
@@ -1831,7 +1832,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
|
|
|
|
|
//实际看课数据
|
|
//实际看课数据
|
|
|
if (periodId != null && videoId != null) {
|
|
if (periodId != null && videoId != null) {
|
|
|
- vo.setFsActualCompletionVO(fsCourseWatchLogMapper.selectActualCompletionList(periodId,videoId,companyId));
|
|
|
|
|
|
|
+ vo.setFsActualCompletionVO(fsCourseWatchLogMapper.selectActualCompletionList(periodId,videoId,companyId,companyUserId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 订单数据:fs_store_order_scrm order_type=3,videoId+periodId 匹配,paid=1
|
|
// 订单数据:fs_store_order_scrm order_type=3,videoId+periodId 匹配,paid=1
|
|
@@ -1841,6 +1842,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
orderQuery.setVideoId(videoId.intValue());
|
|
orderQuery.setVideoId(videoId.intValue());
|
|
|
orderQuery.setPeriodId(periodId.intValue());
|
|
orderQuery.setPeriodId(periodId.intValue());
|
|
|
orderQuery.setCompanyId(companyId);
|
|
orderQuery.setCompanyId(companyId);
|
|
|
|
|
+ orderQuery.setCompanyUserId(companyUserId);
|
|
|
orderQuery.setPaid(1);
|
|
orderQuery.setPaid(1);
|
|
|
List<FsStoreOrderScrm> orders = fsStoreOrderScrmMapper.selectFsStoreOrderList(orderQuery);
|
|
List<FsStoreOrderScrm> orders = fsStoreOrderScrmMapper.selectFsStoreOrderList(orderQuery);
|
|
|
List<FsStoreOrderScrm> paidOrders = orders != null ? orders.stream()
|
|
List<FsStoreOrderScrm> paidOrders = orders != null ? orders.stream()
|
|
@@ -1871,10 +1873,10 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
vo.setCompleteRValue(gmv.divide(BigDecimal.valueOf(vo.getTotalCompleteCount()), 2, RoundingMode.HALF_UP));
|
|
vo.setCompleteRValue(gmv.divide(BigDecimal.valueOf(vo.getTotalCompleteCount()), 2, RoundingMode.HALF_UP));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Long answerCount = fsCourseAnswerLogsMapper.countDistinctUsersByVideoAndPeriod(videoId, periodId,companyId);
|
|
|
|
|
|
|
+ Long answerCount = fsCourseAnswerLogsMapper.countDistinctUsersByVideoAndPeriod(videoId, periodId,companyId,companyUserId);
|
|
|
vo.setAnswerUserCount(answerCount != null ? answerCount : 0L);
|
|
vo.setAnswerUserCount(answerCount != null ? answerCount : 0L);
|
|
|
|
|
|
|
|
- Long redCount = fsCourseRedPacketLogMapper.countDistinctUsersByVideoAndPeriod(videoId, periodId,companyId);
|
|
|
|
|
|
|
+ Long redCount = fsCourseRedPacketLogMapper.countDistinctUsersByVideoAndPeriod(videoId, periodId,companyId,companyUserId);
|
|
|
vo.setRedPacketUserCount(redCount != null ? redCount : 0L);
|
|
vo.setRedPacketUserCount(redCount != null ? redCount : 0L);
|
|
|
|
|
|
|
|
// 单品销量统计:从订单明细汇总
|
|
// 单品销量统计:从订单明细汇总
|