diff options
author | Vitaly Takmazov | 2016-12-01 13:56:53 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-12-01 13:56:53 +0300 |
commit | 3d7f60c1c0b48dad2f58bffe3352d1c5c1b93f00 (patch) | |
tree | ab311d5d6102b2c76c03b266fc1b794108cba0fc /juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java | |
parent | 92d6700919e87c81db4a42a4b286257f62566cbf (diff) |
juick-api: Tags controller from perl, refactoring
Diffstat (limited to 'juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java index bd915961..767c62fc 100644 --- a/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/juick-server/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -23,9 +23,11 @@ import java.util.stream.Collectors; public class SubscriptionServiceImpl extends BaseJdbcService implements SubscriptionService { private final UserService userService; private final MessagesService messagesService; + private final TagService tagService; @Inject - public SubscriptionServiceImpl(JdbcTemplate jdbcTemplate, UserService userService, MessagesService messagesService) { + public SubscriptionServiceImpl(JdbcTemplate jdbcTemplate, UserService userService, + MessagesService messagesService, TagService tagService) { super(jdbcTemplate, null); Assert.notNull(userService); @@ -33,6 +35,9 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip Assert.notNull(messagesService); this.messagesService = messagesService; + + Assert.notNull(tagService); + this.tagService = tagService; } @Transactional(readOnly = true) @@ -60,7 +65,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip .map(User::getUid) .collect(Collectors.toList())); - List<Integer> tags = messagesService.getMessageTagsIDs(mid); + List<Integer> tags = tagService.getMessageTagsIDs(mid); if (!tags.isEmpty()) { List<Integer> tagUsers = getNamedParameterJdbcTemplate().queryForList( "SELECT st.suser_id FROM subscr_tags st " + @@ -94,7 +99,7 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip @Transactional(readOnly = true) @Override public List<User> getUsersSubscribedToUserRecommendations(final int uid, final int mid, final int muid) { - List<Integer> tags = messagesService.getMessageTagsIDs(mid); + List<Integer> tags = tagService.getMessageTagsIDs(mid); String query = "SELECT s.suser_id FROM subscr_users s WHERE s.user_id = :uid " + " AND NOT EXISTS (SELECT 1 FROM bl_users b WHERE b.bl_user_id = :muid and b.user_id = s.user_id) " + |