|
@@ -85,34 +85,35 @@ public class WeComMessageDataJob {
|
|
|
DateUtil.getBeforeDayDateString());
|
|
|
List<Record> recordList = OdpsUtil.getOdpsData(sql);
|
|
|
if (CollectionUtils.isEmpty(recordList)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- List<PushMessage> list = new ArrayList<>();
|
|
|
- for (Record record : recordList) {
|
|
|
- PushMessage pushMessage = new PushMessage();
|
|
|
- Long videoId = Long.parseLong((String) record.get(0));
|
|
|
- Set<Long> userIds = new HashSet<>(JSONObject.parseArray((String) record.get(1), Long.class));
|
|
|
- Long staffId = Long.parseLong((String) record.get(2));
|
|
|
- Double score = Double.parseDouble((String) record.get(3));
|
|
|
- pushMessage.setVideoId(videoId);
|
|
|
- pushMessage.setUserIds(userIds);
|
|
|
- pushMessage.setStaffId(staffId);
|
|
|
- pushMessage.setScore(score);
|
|
|
- list.add(pushMessage);
|
|
|
- }
|
|
|
- historicalTopMap = list.stream()
|
|
|
- .collect(Collectors.groupingBy(PushMessage::getStaffId,
|
|
|
- Collectors.mapping(pushMessage -> pushMessage,
|
|
|
- Collectors.toList())))
|
|
|
- .entrySet()
|
|
|
- .stream()
|
|
|
- .collect(Collectors.toMap(
|
|
|
- Map.Entry::getKey,
|
|
|
- entry -> entry.getValue().stream()
|
|
|
- .sorted(Comparator.comparing(PushMessage::getScore).reversed()) // 根据 score 降序排序
|
|
|
- .collect(Collectors.toList())
|
|
|
- ));
|
|
|
+ LarkRobotUtil.sendMessage("历史优质视频为空");
|
|
|
+ } else {
|
|
|
+ List<PushMessage> list = new ArrayList<>();
|
|
|
+ for (Record record : recordList) {
|
|
|
+ PushMessage pushMessage = new PushMessage();
|
|
|
+ Long videoId = Long.parseLong((String) record.get(0));
|
|
|
+ Set<Long> userIds = new HashSet<>(JSONObject.parseArray((String) record.get(1), Long.class));
|
|
|
+ Long staffId = Long.parseLong((String) record.get(2));
|
|
|
+ Double score = Double.parseDouble((String) record.get(3));
|
|
|
+ pushMessage.setVideoId(videoId);
|
|
|
+ pushMessage.setUserIds(userIds);
|
|
|
+ pushMessage.setStaffId(staffId);
|
|
|
+ pushMessage.setScore(score);
|
|
|
+ list.add(pushMessage);
|
|
|
+ }
|
|
|
+ historicalTopMap = list.stream()
|
|
|
+ .collect(Collectors.groupingBy(PushMessage::getStaffId,
|
|
|
+ Collectors.mapping(pushMessage -> pushMessage,
|
|
|
+ Collectors.toList())))
|
|
|
+ .entrySet()
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ Map.Entry::getKey,
|
|
|
+ entry -> entry.getValue().stream()
|
|
|
+ .sorted(Comparator.comparing(PushMessage::getScore).reversed()) // 根据 score 降序排序
|
|
|
+ .collect(Collectors.toList())
|
|
|
+ ));
|
|
|
|
|
|
+ }
|
|
|
//保底视频获取
|
|
|
String key = String.format(GUARANTEED_MINI_PROGRAM_KEY, DateUtil.getThatDayDateString());
|
|
|
GuaranteedParam guaranteedParam = (GuaranteedParam) redisTemplate.opsForValue().get(key);
|
|
@@ -161,6 +162,7 @@ public class WeComMessageDataJob {
|
|
|
LarkRobotUtil.sendMessage("保底视频没有默认组,请查看" + guaranteedParam.getDate());
|
|
|
throw new RuntimeException();
|
|
|
}
|
|
|
+ log.info("保底数据获取,videoMap={}", videoMap);
|
|
|
this.guaranteedVideoMap = videoMap;
|
|
|
}
|
|
|
|
|
@@ -323,6 +325,7 @@ public class WeComMessageDataJob {
|
|
|
videoCombination = guaranteedVideoMap.get(0L);
|
|
|
}
|
|
|
if (videoCombination == null) {
|
|
|
+ log.error("保底数据获取失败,staffId={}, guaranteedVideoMap={}", staffId, guaranteedVideoMap);
|
|
|
LarkRobotUtil.sendMessage("组装数据时,保底数据获取异常");
|
|
|
throw new RuntimeException("保底数据获取异常");
|
|
|
}
|