|
@@ -473,23 +473,28 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
private void publicHotData(String sceneNum, SceneEditInfo sceneEditInfo) throws IOException {
|
|
|
String hotDataKey = String.format(RedisKey.SCENE_HOT_DATA, sceneNum);
|
|
|
Map<String, String> hotMap = redisUtil.hmget(hotDataKey);
|
|
|
- List<String> hotList = Lists.newArrayList();
|
|
|
- hotMap.entrySet().stream().forEach(entry->{
|
|
|
- if(StrUtil.isNotEmpty(entry.getValue())){
|
|
|
- hotList.add(entry.getValue());
|
|
|
- }
|
|
|
- });
|
|
|
- if(CollUtil.isNotEmpty(hotList)){
|
|
|
- JSONArray jsonhots = new JSONArray();
|
|
|
- hotList.stream().forEach(hot->{
|
|
|
- jsonhots.add(JSONObject.parseObject(hot));
|
|
|
- });
|
|
|
- String hotJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "hot.json";
|
|
|
- uploadToOssUtil.upload(jsonhots.toString().getBytes(), hotJsonPath);
|
|
|
|
|
|
- //修改tags状态为是,标识有热点数据
|
|
|
- this.saveTagsToSceneEditInfo(sceneNum, sceneEditInfo);
|
|
|
+ JSONArray tags = new JSONArray();
|
|
|
+ if(CollUtil.isNotEmpty(hotMap)){
|
|
|
+ List<TagBean> tagBeanList = hotMap.entrySet().stream().map(entry -> {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(entry.getValue());
|
|
|
+ return TagBean.builder()
|
|
|
+ .createTime(jsonObject.getLong("createTime"))
|
|
|
+ .tag(jsonObject).build();
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ //按创建时间倒叙排序
|
|
|
+ tagBeanList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
|
|
|
+
|
|
|
+ //移除createTime字段
|
|
|
+ tagBeanList.stream().forEach(tagBean -> {
|
|
|
+ tags.add(tagBean.getTag());
|
|
|
+ });
|
|
|
}
|
|
|
+
|
|
|
+ String hotJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "hot.json";
|
|
|
+ uploadToOssUtil.upload(tags.toString().getBytes(), hotJsonPath);
|
|
|
+ this.saveTagsToSceneEditInfo(sceneNum, sceneEditInfo);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|