diff options
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/service/SubscriptionServiceImpl.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 85980f1a1..962f8460c 100644 --- a/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -64,7 +64,8 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip .collect(Collectors.toList()); List<User> users = ListUtils.union(subscribers, mentionedUsers); List<Integer> tags = tagService.getMessageTagsIDs(mid); - List<String> tagsStr = tagService.getMessageTags(mid).stream().map(t -> t.getTag().getName()).collect(Collectors.toList()); + List<String> tagsStr = tagService.getMessageTags(mid).stream().map(t -> t.getTag().getName()) + .collect(Collectors.toList()); Set<Integer> set = new HashSet<>(users.stream() .filter(u -> !u.isBanned()) @@ -75,7 +76,8 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip List<Integer> tagUsers = getNamedParameterJdbcTemplate().queryForList( "SELECT st.suser_id FROM subscr_tags st " + "WHERE st.tag_id IN (:ids) AND st.suser_id != :uid " + - " AND NOT EXISTS (SELECT 1 FROM bl_users bu WHERE bu.bl_user_id = :authorUid and st.suser_id = bu.user_id)" + + " AND NOT EXISTS (SELECT 1 FROM bl_users bu WHERE bu.bl_user_id = :authorUid and st.suser_id = bu.user_id)" + + " AND NOT EXISTS (SELECT 1 FROM bl_tags bt WHERE bt.tag_id IN (:ids) and st.suser_id = bt.user_id)", new MapSqlParameterSource() .addValue("ids", tags) @@ -86,6 +88,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip } return userService.getUsersByID(set); } + @Override public List<User> getUsersSubscribedToComments(@Nonnull final Message msg, @Nonnull final Message reply) { return getUsersSubscribedToComments(msg, reply, false); @@ -94,7 +97,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Transactional(readOnly = true) @Override public List<User> getUsersSubscribedToComments(@Nonnull final Message msg, @Nonnull final Message reply, - boolean blacklisted) { + boolean blacklisted) { List<User> subscribers = userService.getUsersByID(getJdbcTemplate().queryForList( "SELECT suser_id FROM subscr_messages WHERE message_id=? AND suser_id!=?", Integer.class, @@ -112,7 +115,8 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Override public List<User> getUsersSubscribedToUserRecommendations(final int uid, final Message msg) { - List<String> msgTags = tagService.getMessageTags(msg.getMid()).stream().map(t -> t.getTag().getName()).collect(Collectors.toList()); + List<String> msgTags = tagService.getMessageTags(msg.getMid()).stream().map(t -> t.getTag().getName()) + .collect(Collectors.toList()); if (msg.getLikes() == 1) { return userService.getUserReaders(uid).stream() .filter(u -> !u.equals(msg.getUser())) @@ -199,8 +203,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip }, user.getUid()); - return list.isEmpty() ? - new NotifyOpts() : list.get(0); + return list.isEmpty() ? new NotifyOpts() : list.get(0); } @Transactional |