Commit af110c15 authored by 张辰's avatar 张辰

es 返回时按时间倒叙

parent f2cff67c
...@@ -104,14 +104,17 @@ public class ThemeManager { ...@@ -104,14 +104,17 @@ public class ThemeManager {
return !excludeIds.contains(tId); return !excludeIds.contains(tId);
}).limit(pageSize).collect(Collectors.toList()); }).limit(pageSize).collect(Collectors.toList());
List<ThemeQo> themes = ConvertUtil.themeEntitiesToDTOs(themeService.queryByThemeIds(filterEsIds));
resp.themes = convertEntityToQo(themeService.queryByThemeIds(filterEsIds), userId); resp.themes = convertEntityToQo(themeService.queryByThemeIds(filterEsIds), userId);
resp.themes.sort(new Comparator<ThemeQo>() {
@Override
public int compare(ThemeQo o1, ThemeQo o2) {
return o2.createTime.compareTo(o1.createTime);
}
});
// 截取关键词出现的那一部分段落 // 截取关键词出现的那一部分段落
for (ThemeQo theme : resp.themes) { for (ThemeQo theme : resp.themes) {
theme.briefContent4FullSearch = BizUtils.getThemeContent(keyword, theme); theme.briefContent4FullSearch = BizUtils.getThemeContent(keyword, theme);
} }
resp.excludeIds.addAll(filterEsIds); resp.excludeIds.addAll(filterEsIds);
return resp; return resp;
...@@ -133,7 +136,7 @@ public class ThemeManager { ...@@ -133,7 +136,7 @@ public class ThemeManager {
if (ThemeTypeEnum.DISCUSSION.getCode().equals(themeEntity.getThemeType())) { if (ThemeTypeEnum.DISCUSSION.getCode().equals(themeEntity.getThemeType())) {
String content = req.getContent().get(0).getValue(); String content = req.getContent().get(0).getValue();
if (content.length()>256){ if (content.length()>256){
content= content.substring(0,255); content= content.substring(0, 255);
} }
themeEntity.setDiscussContent(content); themeEntity.setDiscussContent(content);
} }
...@@ -186,7 +189,6 @@ public class ThemeManager { ...@@ -186,7 +189,6 @@ public class ThemeManager {
//修改 //修改
themeService.update(themeEntity, req.getEditThemeId()); themeService.update(themeEntity, req.getEditThemeId());
themeEntity.setThemeId(req.getEditThemeId()); themeEntity.setThemeId(req.getEditThemeId());
} }
return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build(); return CreateThemeResp.builder().themeId(themeEntity.getThemeId()).build();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment