use of top.hcode.hoj.pojo.vo.UserMsgVo in project HOJ by HimitZH.
the class MsgRemindServiceImpl method getUserDiscussMsgList.
public IPage<UserMsgVo> getUserDiscussMsgList(IPage<UserMsgVo> userMsgList) {
List<Integer> discussionIds = userMsgList.getRecords().stream().map(UserMsgVo::getSourceId).collect(Collectors.toList());
Collection<Discussion> discussions = discussionMapper.selectBatchIds(discussionIds);
for (Discussion discussion : discussions) {
for (UserMsgVo userMsgVo : userMsgList.getRecords()) {
if (Objects.equals(discussion.getId(), userMsgVo.getSourceId())) {
userMsgVo.setSourceTitle(discussion.getTitle());
break;
}
}
}
applicationContext.getBean(MsgRemindServiceImpl.class).updateUserMsgRead(userMsgList);
return userMsgList;
}
use of top.hcode.hoj.pojo.vo.UserMsgVo in project HOJ by HimitZH.
the class MsgRemindServiceImpl method getUserReplyMsgList.
public IPage<UserMsgVo> getUserReplyMsgList(IPage<UserMsgVo> userMsgList) {
for (UserMsgVo userMsgVo : userMsgList.getRecords()) {
if ("Discussion".equals(userMsgVo.getSourceType())) {
Discussion discussion = discussionMapper.selectById(userMsgVo.getSourceId());
if (discussion != null) {
userMsgVo.setSourceTitle(discussion.getTitle());
} else {
userMsgVo.setSourceTitle("原讨论帖已被删除!【The original discussion post has been deleted!】");
}
} else if ("Contest".equals(userMsgVo.getSourceType())) {
Contest contest = contestService.getById(userMsgVo.getSourceId());
if (contest != null) {
userMsgVo.setSourceTitle(contest.getTitle());
} else {
userMsgVo.setSourceTitle("原比赛已被删除!【The original contest has been deleted!】");
}
}
if ("Comment".equals(userMsgVo.getQuoteType())) {
Comment comment = commentMapper.selectById(userMsgVo.getQuoteId());
if (comment != null) {
String content;
if (comment.getContent().length() < 100) {
content = comment.getFromName() + " : " + comment.getContent();
} else {
content = comment.getFromName() + " : " + comment.getContent().substring(0, 100) + "...";
}
userMsgVo.setQuoteContent(content);
} else {
userMsgVo.setQuoteContent("您的原评论信息已被删除!【Your original comments have been deleted!】");
}
} else if ("Reply".equals(userMsgVo.getQuoteType())) {
Reply reply = replyMapper.selectById(userMsgVo.getQuoteId());
if (reply != null) {
String content;
if (reply.getContent().length() < 100) {
content = reply.getFromName() + " : @" + reply.getToName() + ":" + reply.getContent();
} else {
content = reply.getFromName() + " : @" + reply.getToName() + ":" + reply.getContent().substring(0, 100) + "...";
}
userMsgVo.setQuoteContent(content);
} else {
userMsgVo.setQuoteContent("您的原回复信息已被删除!【Your original reply has been deleted!】");
}
}
}
applicationContext.getBean(MsgRemindServiceImpl.class).updateUserMsgRead(userMsgList);
return userMsgList;
}
use of top.hcode.hoj.pojo.vo.UserMsgVo in project HOJ by HimitZH.
the class UserMessageManager method getUserDiscussMsgList.
private IPage<UserMsgVo> getUserDiscussMsgList(IPage<UserMsgVo> userMsgList) {
List<Integer> discussionIds = userMsgList.getRecords().stream().map(UserMsgVo::getSourceId).collect(Collectors.toList());
Collection<Discussion> discussions = discussionEntityService.listByIds(discussionIds);
for (Discussion discussion : discussions) {
for (UserMsgVo userMsgVo : userMsgList.getRecords()) {
if (Objects.equals(discussion.getId(), userMsgVo.getSourceId())) {
userMsgVo.setSourceTitle(discussion.getTitle());
break;
}
}
}
applicationContext.getBean(UserMessageManager.class).updateUserMsgRead(userMsgList);
return userMsgList;
}
use of top.hcode.hoj.pojo.vo.UserMsgVo in project HOJ by HimitZH.
the class UserMessageManager method getUserReplyMsgList.
private IPage<UserMsgVo> getUserReplyMsgList(IPage<UserMsgVo> userMsgList) {
for (UserMsgVo userMsgVo : userMsgList.getRecords()) {
if ("Discussion".equals(userMsgVo.getSourceType())) {
Discussion discussion = discussionEntityService.getById(userMsgVo.getSourceId());
if (discussion != null) {
userMsgVo.setSourceTitle(discussion.getTitle());
} else {
userMsgVo.setSourceTitle("原讨论帖已被删除!【The original discussion post has been deleted!】");
}
} else if ("Contest".equals(userMsgVo.getSourceType())) {
Contest contest = contestEntityService.getById(userMsgVo.getSourceId());
if (contest != null) {
userMsgVo.setSourceTitle(contest.getTitle());
} else {
userMsgVo.setSourceTitle("原比赛已被删除!【The original contest has been deleted!】");
}
}
if ("Comment".equals(userMsgVo.getQuoteType())) {
Comment comment = commentEntityService.getById(userMsgVo.getQuoteId());
if (comment != null) {
String content;
if (comment.getContent().length() < 100) {
content = comment.getFromName() + " : " + comment.getContent();
} else {
content = comment.getFromName() + " : " + comment.getContent().substring(0, 100) + "...";
}
userMsgVo.setQuoteContent(content);
} else {
userMsgVo.setQuoteContent("您的原评论信息已被删除!【Your original comments have been deleted!】");
}
} else if ("Reply".equals(userMsgVo.getQuoteType())) {
Reply reply = replyEntityService.getById(userMsgVo.getQuoteId());
if (reply != null) {
String content;
if (reply.getContent().length() < 100) {
content = reply.getFromName() + " : @" + reply.getToName() + ":" + reply.getContent();
} else {
content = reply.getFromName() + " : @" + reply.getToName() + ":" + reply.getContent().substring(0, 100) + "...";
}
userMsgVo.setQuoteContent(content);
} else {
userMsgVo.setQuoteContent("您的原回复信息已被删除!【Your original reply has been deleted!】");
}
}
}
applicationContext.getBean(UserMessageManager.class).updateUserMsgRead(userMsgList);
return userMsgList;
}
Aggregations