|
|
@@ -1323,27 +1323,27 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
.collect(Collectors.toList());
|
|
|
param.setCompanyIds(companyIds);
|
|
|
|
|
|
- Map<Long, FsCourseReportVO> watchStatistics = getWatchStatistics(param);
|
|
|
- Map<Long, FsCourseReportVO> answerStatistics = getAnswerStatistics(param);
|
|
|
- Map<Long, FsCourseReportVO> redPacketStatistics = getRedPacketStatistics(param);
|
|
|
+ Map<String , FsCourseReportVO> watchStatistics = getWatchStatistics(param);
|
|
|
+ Map<String, FsCourseReportVO> answerStatistics = getAnswerStatistics(param);
|
|
|
+ Map<String, FsCourseReportVO> redPacketStatistics = getRedPacketStatistics(param);
|
|
|
// 4. 组装最终结果
|
|
|
return assembleStatisticsResult(companyList, watchStatistics, answerStatistics,
|
|
|
redPacketStatistics, param);
|
|
|
}
|
|
|
|
|
|
- private List<FsCourseReportVO> assembleStatisticsResult(List<FsCourseReportVO> companyList, Map<Long, FsCourseReportVO> watchStatistics, Map<Long, FsCourseReportVO> answerStatistics, Map<Long, FsCourseReportVO> redPacketStatistics, FsCourseWatchLogStatisticsListParam param) {
|
|
|
+ private List<FsCourseReportVO> assembleStatisticsResult(List<FsCourseReportVO> companyList, Map<String, FsCourseReportVO> watchStatistics, Map<String, FsCourseReportVO> answerStatistics, Map<String, FsCourseReportVO> redPacketStatistics, FsCourseWatchLogStatisticsListParam param) {
|
|
|
for (FsCourseReportVO company : companyList) {
|
|
|
FsCourseReportVO watchStats;
|
|
|
FsCourseReportVO answerStats;
|
|
|
FsCourseReportVO redPacketStats;
|
|
|
if ("camp".equals(param.getDimension())) {
|
|
|
- watchStats = watchStatistics.getOrDefault(company.getPeriodId(), new FsCourseReportVO());
|
|
|
- answerStats = answerStatistics.getOrDefault(company.getPeriodId(), new FsCourseReportVO());
|
|
|
- redPacketStats = redPacketStatistics.getOrDefault(company.getPeriodId(), new FsCourseReportVO());
|
|
|
+ watchStats = watchStatistics.getOrDefault(company.getPeriodId() + "_" + company.getCompanyId(), new FsCourseReportVO());
|
|
|
+ answerStats = answerStatistics.getOrDefault(company.getPeriodId() + "_" + company.getCompanyId(), new FsCourseReportVO());
|
|
|
+ redPacketStats = redPacketStatistics.getOrDefault(company.getPeriodId() + "_" + company.getCompanyId(), new FsCourseReportVO());
|
|
|
} else {
|
|
|
- watchStats = watchStatistics.getOrDefault(company.getCompanyId(), new FsCourseReportVO());
|
|
|
- answerStats = answerStatistics.getOrDefault(company.getCompanyId(), new FsCourseReportVO());
|
|
|
- redPacketStats = redPacketStatistics.getOrDefault(company.getCompanyId(), new FsCourseReportVO());
|
|
|
+ watchStats = watchStatistics.getOrDefault(company.getCompanyId().toString(), new FsCourseReportVO());
|
|
|
+ answerStats = answerStatistics.getOrDefault(company.getCompanyId().toString(), new FsCourseReportVO());
|
|
|
+ redPacketStats = redPacketStatistics.getOrDefault(company.getCompanyId().toString(), new FsCourseReportVO());
|
|
|
}
|
|
|
// 设置看课统计数据
|
|
|
if (watchStats != null) {
|
|
|
@@ -1395,20 +1395,20 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
.setScale(2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
- private Map<Long, FsCourseReportVO> getWatchStatistics(FsCourseWatchLogStatisticsListParam query) {
|
|
|
+ private Map<String, FsCourseReportVO> getWatchStatistics(FsCourseWatchLogStatisticsListParam query) {
|
|
|
List<FsCourseReportVO> watchStatistics = fsCourseWatchLogMapper.selectWatchStatistics(query);
|
|
|
- Map<Long, FsCourseReportVO> watchStatisticsMap = new HashMap<>();
|
|
|
+ Map<String, FsCourseReportVO> watchStatisticsMap = new HashMap<>();
|
|
|
if ("company".equals(query.getDimension())) {
|
|
|
watchStatisticsMap = watchStatistics.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
- stats -> stats.getCompanyId(),
|
|
|
+ stats -> String.valueOf(stats.getCompanyId()),
|
|
|
Function.identity(),
|
|
|
(existing, replacement) -> existing // 当出现重复键时,保留第一个值
|
|
|
));
|
|
|
} else if ("camp".equals(query.getDimension())) {
|
|
|
watchStatisticsMap = watchStatistics.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
- stats -> stats.getPeriodId(),
|
|
|
+ stats -> stats.getPeriodId() + "_" + stats.getCompanyId(),
|
|
|
Function.identity(),
|
|
|
(existing, replacement) -> existing // 当出现重复键时,保留第一个值
|
|
|
));
|
|
|
@@ -1417,20 +1417,20 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
return watchStatisticsMap;
|
|
|
}
|
|
|
|
|
|
- private Map<Long, FsCourseReportVO> getAnswerStatistics(FsCourseWatchLogStatisticsListParam query) {
|
|
|
+ private Map<String, FsCourseReportVO> getAnswerStatistics(FsCourseWatchLogStatisticsListParam query) {
|
|
|
List<FsCourseReportVO> answerStatistics = fsCourseWatchLogMapper.selectAnswerStatistics(query);
|
|
|
- Map<Long, FsCourseReportVO> answerMap = new HashMap<>();
|
|
|
+ Map<String, FsCourseReportVO> answerMap = new HashMap<>();
|
|
|
if ("company".equals(query.getDimension())) {
|
|
|
answerMap = answerStatistics.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
- stats -> stats.getCompanyId(),
|
|
|
+ stats -> String.valueOf(stats.getCompanyId()),
|
|
|
Function.identity(),
|
|
|
(existing, replacement) -> existing // 当出现重复键时,保留第一个值
|
|
|
));
|
|
|
} else if ("camp".equals(query.getDimension())) {
|
|
|
answerMap = answerStatistics.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
- stats -> stats.getPeriodId(),
|
|
|
+ stats -> stats.getPeriodId() + "_" + stats.getCompanyId(),
|
|
|
Function.identity(),
|
|
|
(existing, replacement) -> existing // 当出现重复键时,保留第一个值
|
|
|
));
|
|
|
@@ -1439,18 +1439,18 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
|
|
|
return answerMap;
|
|
|
}
|
|
|
|
|
|
- private Map<Long, FsCourseReportVO> getRedPacketStatistics(FsCourseWatchLogStatisticsListParam query) {
|
|
|
+ private Map<String, FsCourseReportVO> getRedPacketStatistics(FsCourseWatchLogStatisticsListParam query) {
|
|
|
List<FsCourseReportVO> redPacketStatistics = fsCourseWatchLogMapper.selectRedPacketStatistics(query);
|
|
|
- Map<Long, FsCourseReportVO> redPacketMap = new HashMap<>();
|
|
|
+ Map<String, FsCourseReportVO> redPacketMap = new HashMap<>();
|
|
|
if ("company".equals(query.getDimension())) {
|
|
|
redPacketMap = redPacketStatistics.stream().collect(Collectors.toMap(
|
|
|
- stats -> stats.getCompanyId(),
|
|
|
+ stats -> String.valueOf(stats.getCompanyId()),
|
|
|
Function.identity(),
|
|
|
(existing, replacement) -> existing // 当出现重复键时,保留第一个值
|
|
|
));
|
|
|
} else if ("camp".equals(query.getDimension())) {
|
|
|
redPacketMap = redPacketStatistics.stream().collect(Collectors.toMap(
|
|
|
- stats -> stats.getPeriodId(),
|
|
|
+ stats -> stats.getPeriodId() + "_" + stats.getCompanyId(),
|
|
|
Function.identity(),
|
|
|
(existing, replacement) -> existing // 当出现重复键时,保留第一个值
|
|
|
));
|