Commit f09ab871 authored by 刘基明's avatar 刘基明

关注话题排序

parent 8577e00c
......@@ -45,6 +45,9 @@ public class TopicFollowQo {
@ApiModelProperty(value = "最近一条讨论")
public String lastTheme;
@ApiModelProperty(value = "最近一条讨论发表时间")
public long lastThemeSecond;
@ApiModelProperty(value = "最近一条讨论发表时间-格式化")
public String lastThemeTime;
......
......@@ -111,7 +111,7 @@ public class TopicManager {
// 排序
List<TopicFollowQo> res = topicFollowQos.stream().filter(o -> o.checkTopicName(keyword)).sorted(Comparator.comparing(TopicFollowQo::getSpecialPermission, Comparator.reverseOrder()).
thenComparing(TopicFollowQo::getLastThemeTime, Comparator.nullsFirst(String::compareTo).reversed()))
thenComparing(TopicFollowQo::getLastThemeSecond, Comparator.nullsFirst(Long::compareTo).reversed()))
.collect(Collectors.toList());
return res;
......
......@@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
......@@ -361,6 +362,7 @@ public class ThemeService {
topic.setLastTheme(getUserName(themeQo.getAuthorId()) + ":" + themeQo.content.get(0).getValue());
topic.setLastThemeTime(TimeUtils.formatTopicListTime(themeEntity.getUpdateTime()));
topic.setLastThemeSecond(themeEntity.getUpdateTime().toEpochSecond(ZoneOffset.of("+8")));
}
......
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