|
@@ -81,44 +81,44 @@ public class WeComMessageDataJob {
|
|
//初始化操作
|
|
//初始化操作
|
|
private void init(List<Long> staffIds) {
|
|
private void init(List<Long> staffIds) {
|
|
List<PushMessage> list = new ArrayList<>();
|
|
List<PushMessage> list = new ArrayList<>();
|
|
-// try {
|
|
|
|
-// //历史优质视频获取分页获取
|
|
|
|
-// String countSql = String.format("SELECT count(*) FROM loghubods.history_good_video_can_push_user_list where dt = %s;",
|
|
|
|
-// DateUtil.getBeforeDayDateString());
|
|
|
|
-// List<Record> countData = OdpsUtil.getOdpsData(countSql);
|
|
|
|
-// int size = 10;
|
|
|
|
-// if (!CollectionUtils.isEmpty(countData)) {
|
|
|
|
-// int count = Integer.parseInt((String) countData.get(0).get(0));
|
|
|
|
-// if (count > 0) {
|
|
|
|
-// List<Record> dataList = new ArrayList<>();
|
|
|
|
-// for (int i = 0; i < count; i += 10) {
|
|
|
|
-// String sql = String.format("SELECT * FROM loghubods.history_good_video_can_push_user_list where dt = %s order by score desc limit %s,%s;",
|
|
|
|
-// DateUtil.getBeforeDayDateString(), i, size);
|
|
|
|
-// List<Record> data = OdpsUtil.getOdpsData(sql);
|
|
|
|
-// if (!CollectionUtils.isEmpty(data)) {
|
|
|
|
-// dataList.addAll(data);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// for (Record record : dataList) {
|
|
|
|
-// 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);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// log.error("history good video error", e);
|
|
|
|
-// }
|
|
|
|
|
|
+ try {
|
|
|
|
+ //历史优质视频获取分页获取
|
|
|
|
+ String countSql = String.format("SELECT count(*) FROM loghubods.history_good_video_can_push_user_list where dt = %s;",
|
|
|
|
+ DateUtil.getBeforeDayDateString());
|
|
|
|
+ List<Record> countData = OdpsUtil.getOdpsData(countSql);
|
|
|
|
+ int size = 10;
|
|
|
|
+ if (!CollectionUtils.isEmpty(countData)) {
|
|
|
|
+ int count = Integer.parseInt((String) countData.get(0).get(0));
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ List<Record> dataList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < count; i += 10) {
|
|
|
|
+ String sql = String.format("SELECT * FROM loghubods.history_good_video_can_push_user_list where dt = %s order by score desc limit %s,%s;",
|
|
|
|
+ DateUtil.getBeforeDayDateString(), i, size);
|
|
|
|
+ List<Record> data = OdpsUtil.getOdpsData(sql);
|
|
|
|
+ if (!CollectionUtils.isEmpty(data)) {
|
|
|
|
+ dataList.addAll(data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (Record record : dataList) {
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("history good video error", e);
|
|
|
|
+ }
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
-// LarkRobotUtil.sendMessage("历史优质视频为空");
|
|
|
|
|
|
+ LarkRobotUtil.sendMessage("历史优质视频为空");
|
|
} else {
|
|
} else {
|
|
historicalTopMap = list.stream()
|
|
historicalTopMap = list.stream()
|
|
.collect(Collectors.groupingBy(PushMessage::getStaffId,
|
|
.collect(Collectors.groupingBy(PushMessage::getStaffId,
|