payload: {"action":"created","comment":{"url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/comments/362390651","pull_request_review_id":337555360,"id":362390651,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM2MjM5MDY1MQ==","diff_hunk":"@@ -0,0 +1,77 @@\n+package com.haipiao.articleservice.handler;\n+\n+import com.haipiao.articleservice.dto.req.GetArticleCommentsRequest;\n+import com.haipiao.articleservice.dto.resp.ArticleResponse;\n+import com.haipiao.articleservice.dto.resp.vo.ArticleData;\n+import com.haipiao.articleservice.service.GetArticleCommonService;\n+import com.haipiao.common.enums.StatusCode;\n+import com.haipiao.common.exception.AppException;\n+import com.haipiao.common.handler.AbstractHandler;\n+import com.haipiao.common.service.SessionService;\n+import com.haipiao.persist.entity.Article;\n+import com.haipiao.persist.repository.ArticleRepository;\n+import com.haipiao.persist.repository.ImageRepository;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.data.domain.Page;\n+import org.springframework.data.domain.PageRequest;\n+import org.springframework.data.domain.Pageable;\n+import org.springframework.stereotype.Component;\n+import org.springframework.util.CollectionUtils;\n+\n+import javax.annotation.Resource;\n+import java.util.List;\n+import java.util.Objects;\n+import java.util.stream.Collectors;\n+\n+/**\n+ * @author wangshun\n+ */\n+@Component\n+public class GetUserArticleHandler extends AbstractHandler<GetArticleCommentsRequest, ArticleResponse> {\n+\n+    public static final Logger LOG = LoggerFactory.getLogger(GetUserArticleHandler.class);\n+\n+    @Autowired\n+    private ArticleRepository articleRepository;\n+\n+    @Resource\n+    private GetArticleCommonService getArticleCommonService;\n+\n+    @Autowired\n+    private ImageRepository imageRepository;\n+\n+    protected GetUserArticleHandler(SessionService sessionService,\n+                                    ArticleRepository articleRepository,\n+                                    ImageRepository imageRepository) {\n+        super(ArticleResponse.class, sessionService);\n+        this.articleRepository = articleRepository;\n+        this.imageRepository = imageRepository;\n+    }\n+\n+    @Override\n+    public ArticleResponse execute(GetArticleCommentsRequest request) throws AppException {\n+        Integer userId = request.getId();\n+        Pageable pageable = PageRequest.of(Integer.valueOf(request.getCursor()), request.getLimit());\n+        Page<Article> articlesPage = articleRepository.findArticlesByAuthorIdAndStatus(userId, \"\", pageable);\n+        List<Article> articles = articlesPage.getContent();\n+        if (CollectionUtils.isEmpty(articles)) {\n+            ArticleResponse resp = new ArticleResponse(StatusCode.NOT_FOUND);\n+            resp.setErrorMessage(String.format(\"user %s not have article\", userId));\n+            return resp;\n+        }\n+\n+        List<ArticleData> articlesList = articles.stream()\n+                .filter(Objects::nonNull)\n+                .map(a -> new ArticleData(imageRepository.findFirstByArticleId(a.getArticleId(),0).getExternalUrl(),\n+                        a.getArticleId(), a.getTitle(), a.getLikes(), getArticleCommonService.checkIsLike(a.getArticleId(), userId),\n+                        getArticleCommonService.assemblerAuthor(a.getAuthorId())))\n+                .collect(Collectors.toList());\n+\n+        ArticleResponse resp = new ArticleResponse(StatusCode.SUCCESS);\n+        resp.setData(new ArticleResponse.Data(articlesList, (int) articlesPage.getTotalElements(),\n+                request.getCursor(), articlesPage.getTotalPages() > Integer.valueOf(request.getCursor())));","path":"article-service/src/main/java/com/haipiao/articleservice/handler/GetUserArticleHandler.java","position":74,"original_position":74,"commit_id":"2d54b58039675b48669ab25cf8a357e8174dc156","original_commit_id":"2d54b58039675b48669ab25cf8a357e8174dc156","user":{"login":"haipiaodev","id":41465052,"node_id":"MDQ6VXNlcjQxNDY1MDUy","avatar_url":"https://avatars0.githubusercontent.com/u/41465052?v=4","gravatar_id":"","url":"https://api.github.com/users/haipiaodev","html_url":"https://github.com/haipiaodev","followers_url":"https://api.github.com/users/haipiaodev/followers","following_url":"https://api.github.com/users/haipiaodev/following{/other_user}","gists_url":"https://api.github.com/users/haipiaodev/gists{/gist_id}","starred_url":"https://api.github.com/users/haipiaodev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haipiaodev/subscriptions","organizations_url":"https://api.github.com/users/haipiaodev/orgs","repos_url":"https://api.github.com/users/haipiaodev/repos","events_url":"https://api.github.com/users/haipiaodev/events{/privacy}","received_events_url":"https://api.github.com/users/haipiaodev/received_events","type":"User","site_admin":false},"body":"新的cursor应该是request.getCurso() + articles.size()。\r\n\r\n","created_at":"2020-01-02T07:51:01Z","updated_at":"2020-01-02T07:51:02Z","html_url":"https://github.com/HaiPiaoAPP/haipiao/pull/52#discussion_r362390651","pull_request_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/comments/362390651"},"html":{"href":"https://github.com/HaiPiaoAPP/haipiao/pull/52#discussion_r362390651"},"pull_request":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52","id":358071099,"node_id":"MDExOlB1bGxSZXF1ZXN0MzU4MDcxMDk5","html_url":"https://github.com/HaiPiaoAPP/haipiao/pull/52","diff_url":"https://github.com/HaiPiaoAPP/haipiao/pull/52.diff","patch_url":"https://github.com/HaiPiaoAPP/haipiao/pull/52.patch","issue_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues/52","number":52,"state":"open","locked":false,"title":"pr","user":{"login":"wangshun6","id":58417244,"node_id":"MDQ6VXNlcjU4NDE3MjQ0","avatar_url":"https://avatars2.githubusercontent.com/u/58417244?v=4","gravatar_id":"","url":"https://api.github.com/users/wangshun6","html_url":"https://github.com/wangshun6","followers_url":"https://api.github.com/users/wangshun6/followers","following_url":"https://api.github.com/users/wangshun6/following{/other_user}","gists_url":"https://api.github.com/users/wangshun6/gists{/gist_id}","starred_url":"https://api.github.com/users/wangshun6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangshun6/subscriptions","organizations_url":"https://api.github.com/users/wangshun6/orgs","repos_url":"https://api.github.com/users/wangshun6/repos","events_url":"https://api.github.com/users/wangshun6/events{/privacy}","received_events_url":"https://api.github.com/users/wangshun6/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-12-30T10:32:13Z","updated_at":"2020-01-02T07:51:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae7598f722ba16c7000e8f6935e3b27023eec7fa","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52/commits","review_comments_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52/comments","review_comment_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues/52/comments","statuses_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/statuses/2d54b58039675b48669ab25cf8a357e8174dc156","head":{"label":"wangshun6:master","ref":"master","sha":"2d54b58039675b48669ab25cf8a357e8174dc156","user":{"login":"wangshun6","id":58417244,"node_id":"MDQ6VXNlcjU4NDE3MjQ0","avatar_url":"https://avatars2.githubusercontent.com/u/58417244?v=4","gravatar_id":"","url":"https://api.github.com/users/wangshun6","html_url":"https://github.com/wangshun6","followers_url":"https://api.github.com/users/wangshun6/followers","following_url":"https://api.github.com/users/wangshun6/following{/other_user}","gists_url":"https://api.github.com/users/wangshun6/gists{/gist_id}","starred_url":"https://api.github.com/users/wangshun6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangshun6/subscriptions","organizations_url":"https://api.github.com/users/wangshun6/orgs","repos_url":"https://api.github.com/users/wangshun6/repos","events_url":"https://api.github.com/users/wangshun6/events{/privacy}","received_events_url":"https://api.github.com/users/wangshun6/received_events","type":"User","site_admin":false},"repo":{"id":228790006,"node_id":"MDEwOlJlcG9zaXRvcnkyMjg3OTAwMDY=","name":"haipiao","full_name":"wangshun6/haipiao","private":false,"owner":{"login":"wangshun6","id":58417244,"node_id":"MDQ6VXNlcjU4NDE3MjQ0","avatar_url":"https://avatars2.githubusercontent.com/u/58417244?v=4","gravatar_id":"","url":"https://api.github.com/users/wangshun6","html_url":"https://github.com/wangshun6","followers_url":"https://api.github.com/users/wangshun6/followers","following_url":"https://api.github.com/users/wangshun6/following{/other_user}","gists_url":"https://api.github.com/users/wangshun6/gists{/gist_id}","starred_url":"https://api.github.com/users/wangshun6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangshun6/subscriptions","organizations_url":"https://api.github.com/users/wangshun6/orgs","repos_url":"https://api.github.com/users/wangshun6/repos","events_url":"https://api.github.com/users/wangshun6/events{/privacy}","received_events_url":"https://api.github.com/users/wangshun6/received_events","type":"User","site_admin":false},"html_url":"https://github.com/wangshun6/haipiao","description":null,"fork":true,"url":"https://api.github.com/repos/wangshun6/haipiao","forks_url":"https://api.github.com/repos/wangshun6/haipiao/forks","keys_url":"https://api.github.com/repos/wangshun6/haipiao/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wangshun6/haipiao/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wangshun6/haipiao/teams","hooks_url":"https://api.github.com/repos/wangshun6/haipiao/hooks","issue_events_url":"https://api.github.com/repos/wangshun6/haipiao/issues/events{/number}","events_url":"https://api.github.com/repos/wangshun6/haipiao/events","assignees_url":"https://api.github.com/repos/wangshun6/haipiao/assignees{/user}","branches_url":"https://api.github.com/repos/wangshun6/haipiao/branches{/branch}","tags_url":"https://api.github.com/repos/wangshun6/haipiao/tags","blobs_url":"https://api.github.com/repos/wangshun6/haipiao/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wangshun6/haipiao/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wangshun6/haipiao/git/refs{/sha}","trees_url":"https://api.github.com/repos/wangshun6/haipiao/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wangshun6/haipiao/statuses/{sha}","languages_url":"https://api.github.com/repos/wangshun6/haipiao/languages","stargazers_url":"https://api.github.com/repos/wangshun6/haipiao/stargazers","contributors_url":"https://api.github.com/repos/wangshun6/haipiao/contributors","subscribers_url":"https://api.github.com/repos/wangshun6/haipiao/subscribers","subscription_url":"https://api.github.com/repos/wangshun6/haipiao/subscription","commits_url":"https://api.github.com/repos/wangshun6/haipiao/commits{/sha}","git_commits_url":"https://api.github.com/repos/wangshun6/haipiao/git/commits{/sha}","comments_url":"https://api.github.com/repos/wangshun6/haipiao/comments{/number}","issue_comment_url":"https://api.github.com/repos/wangshun6/haipiao/issues/comments{/number}","contents_url":"https://api.github.com/repos/wangshun6/haipiao/contents/{+path}","compare_url":"https://api.github.com/repos/wangshun6/haipiao/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wangshun6/haipiao/merges","archive_url":"https://api.github.com/repos/wangshun6/haipiao/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wangshun6/haipiao/downloads","issues_url":"https://api.github.com/repos/wangshun6/haipiao/issues{/number}","pulls_url":"https://api.github.com/repos/wangshun6/haipiao/pulls{/number}","milestones_url":"https://api.github.com/repos/wangshun6/haipiao/milestones{/number}","notifications_url":"https://api.github.com/repos/wangshun6/haipiao/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wangshun6/haipiao/labels{/name}","releases_url":"https://api.github.com/repos/wangshun6/haipiao/releases{/id}","deployments_url":"https://api.github.com/repos/wangshun6/haipiao/deployments","created_at":"2019-12-18T08:08:56Z","updated_at":"2019-12-31T11:08:16Z","pushed_at":"2019-12-31T11:08:13Z","git_url":"git://github.com/wangshun6/haipiao.git","ssh_url":"git@github.com:wangshun6/haipiao.git","clone_url":"https://github.com/wangshun6/haipiao.git","svn_url":"https://github.com/wangshun6/haipiao","homepage":null,"size":413,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"HaiPiaoAPP:master","ref":"master","sha":"d8eaaaf7dbe0c8ca10ba4203cd4fafec9f7720cf","user":{"login":"HaiPiaoAPP","id":41462858,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNDYyODU4","avatar_url":"https://avatars3.githubusercontent.com/u/41462858?v=4","gravatar_id":"","url":"https://api.github.com/users/HaiPiaoAPP","html_url":"https://github.com/HaiPiaoAPP","followers_url":"https://api.github.com/users/HaiPiaoAPP/followers","following_url":"https://api.github.com/users/HaiPiaoAPP/following{/other_user}","gists_url":"https://api.github.com/users/HaiPiaoAPP/gists{/gist_id}","starred_url":"https://api.github.com/users/HaiPiaoAPP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaiPiaoAPP/subscriptions","organizations_url":"https://api.github.com/users/HaiPiaoAPP/orgs","repos_url":"https://api.github.com/users/HaiPiaoAPP/repos","events_url":"https://api.github.com/users/HaiPiaoAPP/events{/privacy}","received_events_url":"https://api.github.com/users/HaiPiaoAPP/received_events","type":"Organization","site_admin":false},"repo":{"id":141668343,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2NjgzNDM=","name":"haipiao","full_name":"HaiPiaoAPP/haipiao","private":false,"owner":{"login":"HaiPiaoAPP","id":41462858,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNDYyODU4","avatar_url":"https://avatars3.githubusercontent.com/u/41462858?v=4","gravatar_id":"","url":"https://api.github.com/users/HaiPiaoAPP","html_url":"https://github.com/HaiPiaoAPP","followers_url":"https://api.github.com/users/HaiPiaoAPP/followers","following_url":"https://api.github.com/users/HaiPiaoAPP/following{/other_user}","gists_url":"https://api.github.com/users/HaiPiaoAPP/gists{/gist_id}","starred_url":"https://api.github.com/users/HaiPiaoAPP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaiPiaoAPP/subscriptions","organizations_url":"https://api.github.com/users/HaiPiaoAPP/orgs","repos_url":"https://api.github.com/users/HaiPiaoAPP/repos","events_url":"https://api.github.com/users/HaiPiaoAPP/events{/privacy}","received_events_url":"https://api.github.com/users/HaiPiaoAPP/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/HaiPiaoAPP/haipiao","description":null,"fork":false,"url":"https://api.github.com/repos/HaiPiaoAPP/haipiao","forks_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/forks","keys_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/teams","hooks_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/hooks","issue_events_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues/events{/number}","events_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/events","assignees_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/assignees{/user}","branches_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/branches{/branch}","tags_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/tags","blobs_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/git/refs{/sha}","trees_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/statuses/{sha}","languages_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/languages","stargazers_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/stargazers","contributors_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/contributors","subscribers_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/subscribers","subscription_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/subscription","commits_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/commits{/sha}","git_commits_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/git/commits{/sha}","comments_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/comments{/number}","issue_comment_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues/comments{/number}","contents_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/contents/{+path}","compare_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/merges","archive_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/downloads","issues_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues{/number}","pulls_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls{/number}","milestones_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/milestones{/number}","notifications_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/labels{/name}","releases_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/releases{/id}","deployments_url":"https://api.github.com/repos/HaiPiaoAPP/haipiao/deployments","created_at":"2018-07-20T05:41:04Z","updated_at":"2020-01-02T00:03:59Z","pushed_at":"2020-01-02T00:03:57Z","git_url":"git://github.com/HaiPiaoAPP/haipiao.git","ssh_url":"git@github.com:HaiPiaoAPP/haipiao.git","clone_url":"https://github.com/HaiPiaoAPP/haipiao.git","svn_url":"https://github.com/HaiPiaoAPP/haipiao","homepage":null,"size":258,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":2,"license":null,"forks":4,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52"},"html":{"href":"https://github.com/HaiPiaoAPP/haipiao/pull/52"},"issue":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues/52"},"comments":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/HaiPiaoAPP/haipiao/statuses/2d54b58039675b48669ab25cf8a357e8174dc156"}},"author_association":"NONE"}}
other: {"actor":{"display_login":"haipiaodev"}}