From f63ed152fcdd479b7514b8404cba08d6460347b3 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 10:13:14 +0800 Subject: [PATCH 1/9] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=9C=80=E5=90=8E=E5=9C=A8=E7=BA=BF=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/service/security/SecurityAspect.java | 4 +- .../forest/jwt/service/RedisTokenManager.java | 9 ++- .../forest/service/impl/UserServiceImpl.java | 60 +++++++++---------- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/rymcu/forest/core/service/security/SecurityAspect.java b/src/main/java/com/rymcu/forest/core/service/security/SecurityAspect.java index b107a82..f6ba82c 100644 --- a/src/main/java/com/rymcu/forest/core/service/security/SecurityAspect.java +++ b/src/main/java/com/rymcu/forest/core/service/security/SecurityAspect.java @@ -37,7 +37,7 @@ public class SecurityAspect { Logger logger = LoggerFactory.getLogger(SecurityAspect.class); @Pointcut("@annotation(com.rymcu.forest.core.service.security.annotation.SecurityInterceptor)") - public void pointCut() { + public void securityPointCut() { } /** @@ -47,7 +47,7 @@ public class SecurityAspect { * @return 方法执行结果 * @throws Throwable 调用出错 */ - @Before(value = "pointCut()") + @Before(value = "securityPointCut()") public void doBefore(JoinPoint joinPoint) throws BaseApiException { logger.info("检查用户修改信息权限 start ..."); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); diff --git a/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java b/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java index a875e98..26f11bd 100644 --- a/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java +++ b/src/main/java/com/rymcu/forest/jwt/service/RedisTokenManager.java @@ -5,12 +5,12 @@ import com.rymcu.forest.jwt.def.JwtConstants; import com.rymcu.forest.jwt.model.TokenModel; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.concurrent.TimeUnit; @@ -46,7 +46,7 @@ public class RedisTokenManager implements TokenManager { if (model == null) { return false; } - String token = (String) redisTemplate.boundValueOps(model.getUsername()).get(); + String token = redisTemplate.boundValueOps(model.getUsername()).get(); if (token == null || !token.equals(model.getToken())) { return false; } @@ -54,7 +54,10 @@ public class RedisTokenManager implements TokenManager { redisTemplate.boundValueOps(model.getUsername()).expire(JwtConstants.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS); StringBuilder key = new StringBuilder(); key.append(JwtConstants.LAST_ONLINE).append(model.getUsername()); - redisTemplate.boundValueOps(key.toString()).set(LocalDateTime.now().toString(), JwtConstants.LAST_ONLINE_EXPIRES_MINUTE, TimeUnit.MINUTES); + String result = redisTemplate.boundValueOps(key.toString()).get(); + if (StringUtils.isBlank(result)) { + redisTemplate.boundValueOps(key.toString()).set(LocalDateTime.now().toString(), JwtConstants.LAST_ONLINE_EXPIRES_MINUTE, TimeUnit.MINUTES); + } return true; } diff --git a/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java index eceeb58..4fb3ca7 100644 --- a/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/UserServiceImpl.java @@ -27,7 +27,6 @@ import java.util.*; /** - * * @author CodeGenerator * @date 2018/05/29 */ @@ -48,7 +47,7 @@ public class UserServiceImpl extends AbstractService implements UserServic private final static String DEFAULT_AVATAR = "https://static.rymcu.com/article/1578475481946.png"; @Override - public User findByAccount(String account) throws TooManyResultsException{ + public User findByAccount(String account) throws TooManyResultsException { return userMapper.findByAccount(account); } @@ -56,13 +55,13 @@ public class UserServiceImpl extends AbstractService implements UserServic @Transactional(rollbackFor = Exception.class) public Map register(String email, String password, String code) { Map map = new HashMap(2); - map.put("message","验证码无效!"); + map.put("message", "验证码无效!"); String vCode = redisService.get(email); - if(StringUtils.isNotBlank(vCode)){ - if(vCode.equals(code)){ + if (StringUtils.isNotBlank(vCode)) { + if (vCode.equals(code)) { User user = userMapper.findByAccount(email); - if(user != null){ - map.put("message","该邮箱已被注册!"); + if (user != null) { + map.put("message", "该邮箱已被注册!"); } else { user = new User(); String nickname = email.split("@")[0]; @@ -83,8 +82,8 @@ public class UserServiceImpl extends AbstractService implements UserServic .nickname(user.getNickname()) .signature(user.getSignature()) .build()); - map.put("message","注册成功!"); - map.put("flag",1); + map.put("message", "注册成功!"); + map.put("flag", 1); redisService.delete(email); } } @@ -106,19 +105,20 @@ public class UserServiceImpl extends AbstractService implements UserServic public Map login(String account, String password) { Map map = new HashMap(1); User user = userMapper.findByAccount(account); - if(user != null){ - if(Utils.comparePwd(password, user.getPassword())){ + if (user != null) { + if (Utils.comparePwd(password, user.getPassword())) { userMapper.updateLastLoginTime(user.getIdUser()); + userMapper.updateLastOnlineTimeByEmail(user.getEmail()); TokenUser tokenUser = new TokenUser(); BeanCopierUtil.copy(user, tokenUser); tokenUser.setToken(tokenManager.createToken(account)); tokenUser.setWeights(userMapper.selectRoleWeightsByUser(user.getIdUser())); map.put("user", tokenUser); } else { - map.put("message","密码错误!"); + map.put("message", "密码错误!"); } } else { - map.put("message","该账号不存在!"); + map.put("message", "该账号不存在!"); } return map; } @@ -133,12 +133,12 @@ public class UserServiceImpl extends AbstractService implements UserServic public Map forgetPassword(String code, String password) { Map map = new HashMap<>(2); String email = redisService.get(code); - if(StringUtils.isBlank(email)){ - map.put("message","链接已失效"); + if (StringUtils.isBlank(email)) { + map.put("message", "链接已失效"); } else { - userMapper.updatePasswordByEmail(email,Utils.entryptPassword(password)); - map.put("message","修改成功,正在跳转登录登陆界面!"); - map.put("flag",1); + userMapper.updatePasswordByEmail(email, Utils.entryptPassword(password)); + map.put("message", "修改成功,正在跳转登录登陆界面!"); + map.put("flag", 1); } return map; } @@ -147,9 +147,9 @@ public class UserServiceImpl extends AbstractService implements UserServic @Transactional(rollbackFor = Exception.class) public Map updateUserRole(Integer idUser, Integer idRole) { Map map = new HashMap(1); - Integer result = userMapper.updateUserRole(idUser,idRole); - if(result == 0) { - map.put("message","更新失败!"); + Integer result = userMapper.updateUserRole(idUser, idRole); + if (result == 0) { + map.put("message", "更新失败!"); } return map; } @@ -158,9 +158,9 @@ public class UserServiceImpl extends AbstractService implements UserServic @Transactional(rollbackFor = Exception.class) public Map updateStatus(Integer idUser, String status) { Map map = new HashMap(1); - Integer result = userMapper.updateStatus(idUser,status); - if(result == 0) { - map.put("message","更新失败!"); + Integer result = userMapper.updateStatus(idUser, status); + if (result == 0) { + map.put("message", "更新失败!"); } return map; } @@ -199,7 +199,7 @@ public class UserServiceImpl extends AbstractService implements UserServic user.setAvatarUrl(avatarUrl); user.setAvatarType("0"); } - Integer result = userMapper.updateUserInfo(user.getIdUser(), user.getNickname(), user.getAvatarType(),user.getAvatarUrl(),user.getSignature(), user.getSex()); + Integer result = userMapper.updateUserInfo(user.getIdUser(), user.getNickname(), user.getAvatarType(), user.getAvatarUrl(), user.getSignature(), user.getSex()); UserIndexUtil.addIndex(UserLucene.builder() .idUser(user.getIdUser()) .nickname(user.getNickname()) @@ -209,7 +209,7 @@ public class UserServiceImpl extends AbstractService implements UserServic map.put("message", "操作失败!"); return map; } - map.put("user",user); + map.put("user", user); return map; } @@ -257,15 +257,15 @@ public class UserServiceImpl extends AbstractService implements UserServic @Override public Map updateEmail(ChangeEmailDTO changeEmailDTO) { Map map = new HashMap(2); - map.put("message","验证码无效!"); + map.put("message", "验证码无效!"); Integer idUser = changeEmailDTO.getIdUser(); String email = changeEmailDTO.getEmail(); String code = changeEmailDTO.getCode(); String vCode = redisService.get(email); - if(StringUtils.isNotBlank(vCode) && StringUtils.isNotBlank(code)){ - if(vCode.equals(code)){ + if (StringUtils.isNotBlank(vCode) && StringUtils.isNotBlank(code)) { + if (vCode.equals(code)) { userMapper.updateEmail(idUser, email); - map.put("message","更新成功!"); + map.put("message", "更新成功!"); map.put("email", email); } } From dff2145c0f8450f12e30843ddd083ceaac8f8f51 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 10:20:45 +0800 Subject: [PATCH 2/9] =?UTF-8?q?:art:=20=E5=89=94=E9=99=A4=E4=B8=BB?= =?UTF-8?q?=E5=8A=A8=E6=8E=A8=E9=80=81=E7=99=BE=E5=BA=A6=20SEO=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ArticleServiceImpl.java | 22 +++---------------- .../com/rymcu/forest/task/BaiDuCronTask.java | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java index 7db94a9..4144a04 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java @@ -199,30 +199,14 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } if (StringUtils.isNotBlank(articleContentHtml)) { - String previewContent; - if (articleContentHtml.length() > MAX_PREVIEW) { - previewContent = BaiDuAipUtils.getNewsSummary(newArticle.getArticleTitle(), articleContentHtml, MAX_PREVIEW); - if (previewContent.length() > MAX_PREVIEW) { - previewContent = previewContent.substring(0, MAX_PREVIEW); - } - } else { - previewContent = Html2TextUtil.getContent(articleContentHtml); + String previewContent = Html2TextUtil.getContent(articleContentHtml); + if (previewContent.length() > MAX_PREVIEW) { + previewContent = previewContent.substring(0, MAX_PREVIEW); } newArticle.setArticlePreviewContent(previewContent); } articleMapper.updateByPrimaryKeySelective(newArticle); - // 推送百度 SEO - if (!ProjectConstant.ENV.equals(env) - && defaultStatus.equals(newArticle.getArticleStatus()) - && articleContent.length() >= MAX_PREVIEW) { - if (isUpdate) { - BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink()); - } else { - BaiDuUtils.sendSEOData(newArticle.getArticlePermalink()); - } - } - map.put("id", newArticle.getIdArticle()); return map; } diff --git a/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java b/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java index 097d7ff..6872773 100644 --- a/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java +++ b/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; /** * @author ronger */ -@Component +//@Component @Slf4j public class BaiDuCronTask { From bb9c20997f8c43b8f8216f9ce1d457ea81e70477 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 11:08:56 +0800 Subject: [PATCH 3/9] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ArticleServiceImpl.java | 91 +++++++++---------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java index 4144a04..7012647 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java @@ -15,6 +15,7 @@ import com.rymcu.forest.service.TagService; import com.rymcu.forest.service.UserService; import com.rymcu.forest.util.*; import com.rymcu.forest.web.api.exception.BaseApiException; +import com.rymcu.forest.web.api.exception.ErrorCode; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.apache.commons.text.StringEscapeUtils; @@ -46,24 +47,21 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Value("${resource.domain}") private String domain; - @Value("${env}") - private String env; private static final int MAX_PREVIEW = 200; - private static final String defaultStatus = "0"; - private static final String defaultTopicUri = "news"; + private static final String DEFAULT_STATUS = "0"; + private static final String DEFAULT_TOPIC_URI = "news"; + private static final int ADMIN_ROLE_WEIGHTS = 2; @Override public List findArticles(ArticleSearchDTO searchDTO) { List list; - if (StringUtils.isNotBlank(searchDTO.getTopicUri()) && !defaultTopicUri.equals(searchDTO.getTopicUri())) { + if (StringUtils.isNotBlank(searchDTO.getTopicUri()) && !DEFAULT_TOPIC_URI.equals(searchDTO.getTopicUri())) { list = articleMapper.selectArticlesByTopicUri(searchDTO.getTopicUri()); } else { list = articleMapper.selectArticles(searchDTO.getSearchText(), searchDTO.getTag(), searchDTO.getTopicUri()); } - list.forEach(article -> { - genArticle(article, 0); - }); + list.forEach(articleDTO -> genArticle(articleDTO,0)); return list; } @@ -73,31 +71,26 @@ public class ArticleServiceImpl extends AbstractService
implements Arti if (articleDTO == null) { return null; } - articleDTO = genArticle(articleDTO, type); + genArticle(articleDTO, type); return articleDTO; } @Override public List findArticlesByTopicUri(String name) { - List articleDTOS = articleMapper.selectArticlesByTopicUri(name); - articleDTOS.forEach(articleDTO -> { - genArticle(articleDTO, 0); - }); - return articleDTOS; + List list = articleMapper.selectArticlesByTopicUri(name); + list.forEach(articleDTO -> genArticle(articleDTO,0)); + return list; } @Override public List findArticlesByTagName(String name) { - List articleDTOS = articleMapper.selectArticlesByTagName(name); - return articleDTOS; + return articleMapper.selectArticlesByTagName(name); } @Override public List findUserArticlesByIdUser(Integer idUser) { List list = articleMapper.selectUserArticles(idUser); - list.forEach(article -> { - genArticle(article, 0); - }); + list.forEach(articleDTO -> genArticle(articleDTO,0)); return list; } @@ -119,11 +112,14 @@ public class ArticleServiceImpl extends AbstractService
implements Arti String articleContent = article.getArticleContent(); String articleContentHtml = article.getArticleContentHtml(); User user = UserUtils.getCurrentUserByToken(); + if (Objects.isNull(user)) { + throw new BaseApiException(ErrorCode.INVALID_TOKEN); + } String reservedTag = checkTags(articleTags); boolean notification = false; if (StringUtils.isNotBlank(reservedTag)) { Integer roleWeights = userService.findRoleWeightsByUser(user.getIdUser()); - if (roleWeights > 2) { + if (roleWeights > ADMIN_ROLE_WEIGHTS) { map.put("message", StringEscapeUtils.unescapeJava(reservedTag) + "标签为系统保留标签!"); return map; } else { @@ -144,10 +140,8 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } else { newArticle = articleMapper.selectByPrimaryKey(article.getIdArticle()); // 如果文章之前状态为草稿则应视为新发布文章 - if (defaultStatus.equals(newArticle.getArticleStatus())) { + if (DEFAULT_STATUS.equals(newArticle.getArticleStatus())) { isUpdate = true; - } else { - isUpdate = false; } if (!user.getIdUser().equals(newArticle.getArticleAuthorId())) { map.put("message", "非法访问!"); @@ -161,13 +155,13 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } // 发送相关通知 - if (defaultStatus.equals(newArticle.getArticleStatus())) { + if (DEFAULT_STATUS.equals(newArticle.getArticleStatus())) { // 发送系统通知 if (notification) { NotificationUtils.sendAnnouncement(newArticle.getIdArticle(), NotificationConstant.Article, newArticle.getArticleTitle()); } else { // 发送关注通知 - StringBuffer dataSummary = new StringBuffer(); + StringBuilder dataSummary = new StringBuilder(); if (isUpdate) { dataSummary.append(user.getNickname()).append("更新了文章: ").append(newArticle.getArticleTitle()); NotificationUtils.sendArticlePush(newArticle.getIdArticle(), NotificationConstant.UpdateArticle, dataSummary.toString(), newArticle.getArticleAuthorId()); @@ -176,27 +170,23 @@ public class ArticleServiceImpl extends AbstractService
implements Arti NotificationUtils.sendArticlePush(newArticle.getIdArticle(), NotificationConstant.PostArticle, dataSummary.toString(), newArticle.getArticleAuthorId()); } } - } - // 草稿不更新索引 - if ("0".equals(article.getArticleStatus())) { - System.out.println("开始增加索引"); + // 草稿不更新索引 if (isUpdate) { - log.info("更新文章索引,id={}",newArticle.getIdArticle()); + log.info("更新文章索引,id={}", newArticle.getIdArticle()); luceneService.updateArticle(newArticle.getIdArticle().toString()); } else { - log.info("写入文章索引,id={}",newArticle.getIdArticle()); + log.info("写入文章索引,id={}", newArticle.getIdArticle()); luceneService.writeArticle(newArticle.getIdArticle().toString()); } - } - tagService.saveTagArticle(newArticle, articleContentHtml); - - if (defaultStatus.equals(newArticle.getArticleStatus())) { + // 更新文章链接 newArticle.setArticlePermalink(domain + "/article/" + newArticle.getIdArticle()); newArticle.setArticleLink("/article/" + newArticle.getIdArticle()); } else { + // 更新文章链接 newArticle.setArticlePermalink(domain + "/draft/" + newArticle.getIdArticle()); newArticle.setArticleLink("/draft/" + newArticle.getIdArticle()); } + tagService.saveTagArticle(newArticle, articleContentHtml); if (StringUtils.isNotBlank(articleContentHtml)) { String previewContent = Html2TextUtil.getContent(articleContentHtml); @@ -249,15 +239,18 @@ public class ArticleServiceImpl extends AbstractService
implements Arti Map map = new HashMap(1); // 鉴权 User user = UserUtils.getCurrentUserByToken(); + if (Objects.isNull(user)) { + throw new BaseApiException(ErrorCode.INVALID_TOKEN); + } Integer roleWeights = userService.findRoleWeightsByUser(user.getIdUser()); - if (roleWeights > 2) { + if (roleWeights > ADMIN_ROLE_WEIGHTS) { Article article = articleMapper.selectByPrimaryKey(id); if (!user.getIdUser().equals(article.getArticleAuthorId())) { map.put("message", "非法访问!"); return map; } } - Integer result; + int result; // 判断是否有评论 boolean isHavComment = articleMapper.existsCommentWithPrimaryKey(id); if (isHavComment) { @@ -296,6 +289,9 @@ public class ArticleServiceImpl extends AbstractService
implements Arti public Map share(Integer id) throws BaseApiException { Article article = articleMapper.selectByPrimaryKey(id); User user = UserUtils.getCurrentUserByToken(); + if (Objects.isNull(user)) { + throw new BaseApiException(ErrorCode.INVALID_TOKEN); + } StringBuilder shareUrl = new StringBuilder(article.getArticlePermalink()); shareUrl.append("?s=").append(user.getNickname()); Map map = new HashMap(1); @@ -306,28 +302,25 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findDrafts() throws BaseApiException { User user = UserUtils.getCurrentUserByToken(); + if (Objects.isNull(user)) { + throw new BaseApiException(ErrorCode.INVALID_TOKEN); + } List list = articleMapper.selectDrafts(user.getIdUser()); - list.forEach(article -> { - genArticle(article, 0); - }); + list.forEach(articleDTO -> genArticle(articleDTO,0)); return list; } @Override public List findArticlesByIdPortfolio(Integer idPortfolio) { List list = articleMapper.selectArticlesByIdPortfolio(idPortfolio); - list.forEach(article -> { - genArticle(article, 0); - }); + list.forEach(articleDTO -> genArticle(articleDTO,0)); return list; } @Override public List selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) { List list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio, searchText, idUser); - list.forEach(article -> { - genArticle(article, 0); - }); + list.forEach(articleDTO -> genArticle(articleDTO,0)); return list; } @@ -364,9 +357,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findAnnouncements() { List list = articleMapper.selectAnnouncements(); - list.forEach(article -> { - genArticle(article, 0); - }); + list.forEach(articleDTO -> genArticle(articleDTO,0)); return list; } @@ -385,7 +376,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti article.setArticleContent(articleContent.getArticleContentHtml()); // 获取所属作品集列表数据 List portfolioArticleDTOList = articleMapper.selectPortfolioArticles(article.getIdArticle()); - portfolioArticleDTOList.forEach(portfolioArticleDTO -> genPortfolioArticles(portfolioArticleDTO)); + portfolioArticleDTOList.forEach(this::genPortfolioArticles); article.setPortfolios(portfolioArticleDTOList); } else if (type.equals(articleEdit)) { article.setArticleContent(articleContent.getArticleContent()); From b8f892fe8e0e9921514d485bcbdbac92a7eeaf6d Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 11:09:49 +0800 Subject: [PATCH 4/9] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../forest/service/impl/ArticleServiceImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java index 7012647..970bbf6 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java @@ -61,7 +61,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } else { list = articleMapper.selectArticles(searchDTO.getSearchText(), searchDTO.getTag(), searchDTO.getTopicUri()); } - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } @@ -78,7 +78,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findArticlesByTopicUri(String name) { List list = articleMapper.selectArticlesByTopicUri(name); - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } @@ -90,7 +90,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findUserArticlesByIdUser(Integer idUser) { List list = articleMapper.selectUserArticles(idUser); - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } @@ -306,21 +306,21 @@ public class ArticleServiceImpl extends AbstractService
implements Arti throw new BaseApiException(ErrorCode.INVALID_TOKEN); } List list = articleMapper.selectDrafts(user.getIdUser()); - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } @Override public List findArticlesByIdPortfolio(Integer idPortfolio) { List list = articleMapper.selectArticlesByIdPortfolio(idPortfolio); - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } @Override public List selectUnbindArticles(Integer idPortfolio, String searchText, Integer idUser) { List list = articleMapper.selectUnbindArticlesByIdPortfolio(idPortfolio, searchText, idUser); - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } @@ -357,7 +357,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti @Override public List findAnnouncements() { List list = articleMapper.selectAnnouncements(); - list.forEach(articleDTO -> genArticle(articleDTO,0)); + list.forEach(articleDTO -> genArticle(articleDTO, 0)); return list; } From d29ab19066cdf9eaaec9d4d94adf359f44312fba Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 11:20:52 +0800 Subject: [PATCH 5/9] Create log4j2.component.properties --- src/main/resources/log4j2.component.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/main/resources/log4j2.component.properties diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties new file mode 100644 index 0000000..6d60578 --- /dev/null +++ b/src/main/resources/log4j2.component.properties @@ -0,0 +1 @@ +log4j2.formatMsgNoLookups=True \ No newline at end of file From 87ad80c221323c9d17a0026c68ae20da7031b816 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 11:25:28 +0800 Subject: [PATCH 6/9] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=9C=80=E5=90=8E=E5=9C=A8=E7=BA=BF=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/mapper/UserMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/mapper/UserMapper.xml b/src/main/java/mapper/UserMapper.xml index 601adaf..4dc17f4 100644 --- a/src/main/java/mapper/UserMapper.xml +++ b/src/main/java/mapper/UserMapper.xml @@ -80,7 +80,7 @@