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 3ca952df59927c2473bb21ad01fde52f87516d14..4cef14443f681198cdce73c93103b0214579ea21 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 3820ae8e2b55e027f7234c5edbb3862ac687babc..3d104784e55482f20326df49ce97eb9f42c2da47 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 2c176b60ad2eb19a73d5719412933d2fdea5a04a..27a0186e05e0d64dc42bb7b9f10b78a3dd64b3a9 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 2609296a0a3780c38112c461d21cc63ee8b53afb..77c95da5291b0e41e5f9a62d23a38ebbde28f3d0 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;