From e73fbbc1b180bf63ba7bbf4c3a3ccf4ea75ae674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E8=8B=B1=E6=9D=B0?= <327782001@qq.com> Date: Tue, 24 Oct 2023 02:41:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CsdnCollectServiceImpl.java | 13 +++++++------ .../service/impl/CsdnCommentServiceImpl.java | 7 ++++--- .../service/impl/CsdnLikeServiceImpl.java | 4 ++-- .../service/impl/CsdnUserInfoServiceImpl.java | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java index 3ca952d..4cef144 100644 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java +++ b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java @@ -4,7 +4,6 @@ import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.Lists; import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; import com.kwan.springbootkwan.entity.resp.CollectInfoQuery; import com.kwan.springbootkwan.entity.resp.CollectResponse; @@ -14,6 +13,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.ArrayList; + @Slf4j @Service public class CsdnCollectServiceImpl implements CsdnCollectService { @@ -52,9 +53,9 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { if (code == 200) { final boolean status = data.status; if (status) { - log.info("已收藏"); + log.info("文章{}已经收藏过", articleId); } else { - log.info("未收藏"); + log.info("文章{}未收藏", articleId); } return status; } @@ -79,7 +80,7 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { collectInfoQuery.setAuthor(username); collectInfoQuery.setDescription(article.getDescription()); collectInfoQuery.setSource("blog"); - collectInfoQuery.setFolderIdList(Lists.newArrayList(selfFolderId)); + collectInfoQuery.setFolderIdList(new ArrayList<>(selfFolderId)); collectInfoQuery.setTitle(article.getTitle()); collectInfoQuery.setUrl(article.getUrl()); collectInfoQuery.setUsername(selfUserName); @@ -97,9 +98,9 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { } final Long code = collectResponse.code; if (code.equals(200)) { - log.info("收藏成功"); + log.info("文章{}收藏成功", articleId); } else if (code.equals(400000101)) { - log.info("参数缺失"); + log.info("收藏文章{}参数缺失", articleId); } else if (code.equals(400)) { COLLECT_IS_FULL = true; log.info("今日收藏次数已达上限!"); diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java index 3820ae8..3d10478 100644 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java +++ b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java @@ -29,7 +29,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { @Value("${csdn.url.comment_url}") private String commentUrl; /** - * 收藏满了 + * 评论满了 */ private static boolean COMMENT_IS_FULL = false; @@ -62,7 +62,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { final String userName = info.getUserName(); if (StringUtils.equals(userName, selfUserName)) { //评论过 - log.info("文章已经评论过"); + log.info("文章{}已经评论过", articleId); return true; } } @@ -83,7 +83,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { final int code = comment.code; final String message = comment.getMessage(); if (code == 200) { - log.info("评论成功"); + log.info("文章{}评论成功", articleId); } else if (code == 400 && StringUtils.equals(message, "您已达到当日发送上限,请明天尝试!")) { log.info(message); COMMENT_IS_FULL = true; @@ -106,6 +106,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { .form("content", "支持博主优质文章,讲解得非常详细,干货满满,通俗易懂,期待博主下次更新") .execute(); final String body = response.body(); + log.info(body); ObjectMapper objectMapper = new ObjectMapper(); CommentResponse commentResponse = null; try { diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java index 2c176b6..27a0186 100644 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java +++ b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnLikeServiceImpl.java @@ -45,9 +45,9 @@ public class CsdnLikeServiceImpl implements CsdnLikeService { if (code == 200) { final boolean status = data.status; if (status) { - log.info("点赞成功"); + log.info("文章{}点赞成功", articleId); } else { - log.info("点赞取消"); + log.info("文章{}点赞取消", articleId); } return status; } else if (code == 400) { diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java index 2609296..77c95da 100644 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java +++ b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnUserInfoServiceImpl.java @@ -1,8 +1,8 @@ package com.kwan.springbootkwan.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.kwan.springbootkwan.mapper.CsdnUserInfoMapper; import com.kwan.springbootkwan.entity.CsdnUserInfo; +import com.kwan.springbootkwan.mapper.CsdnUserInfoMapper; import com.kwan.springbootkwan.service.CsdnUserInfoService; import org.springframework.stereotype.Service; -- GitLab