From 1e152bbcfb357073d8bcf0b51fe701e3fb81540d Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Mon, 22 Aug 2022 23:22:00 +0800 Subject: [PATCH] 修正邮箱拉取条数 添加日志上下篇 --- snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleOutsideController.java | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleOutsideController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleOutsideController.java index 72ae337..8c2ee6f 100644 --- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleOutsideController.java +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleOutsideController.java @@ -31,6 +31,7 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import vip.xiaonuo.core.annotion.BusinessLog; @@ -56,6 +57,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Future; import java.util.stream.Collectors; /** @@ -66,6 +68,7 @@ */ @RestController @RequestMapping("/outside") +@Slf4j public class BlogArticleOutsideController { @Resource @@ -81,7 +84,7 @@ @PostMapping("/blogArticle/add") @BusinessLog(title = "外部blog系统_blog文章_增加", opType = LogAnnotionOpTypeEnum.ADD) public ResponseData add(@RequestBody @Validated(BlogArticleAddDto.add.class) BlogArticleAddDto addDto) { - if (!SecureUtil.md5(addDto.getSecret()).equals("b49e4cc48616cfb8d5ed3e5b983165c8")) { + if (!SecureUtil.md5(addDto.getSecret()).equals(ConstantContextHolder.getPushCode())) { throw new BlogException("口令错误.."); } @@ -148,6 +151,7 @@ param.put("pageNo", PageUtil.getStart(queryDto.getPageNo() - 1, queryDto.getPageSize())); param.put("pageSize", queryDto.getPageSize()); param.put("typeId", queryDto.getTypeId()); + param.put("fileType", queryDto.getFileType()); String blogSourcePrefix = ConstantContextHolder.getBlogSourcePrefix(); @@ -162,7 +166,7 @@ } } - //前端根据条件标注小红点(发布时间和更新时间在7天内) + //前端根据条件标注小红点(发布时间小于更新时间,且在7天内) if (e.getPublishDate().before(e.getUpdateDate()) && DateUtil.between(e.getUpdateDate(), now, DateUnit.DAY) <= 7) { e.setIsAnyUpdate(MyConstant.Yes); @@ -209,6 +213,9 @@ throw new BlogException(BlogExceptionEnum.article_auth_private_error); } + //异步查询相邻记录 + Future<List<BlogArticleVo>> adjoiningRecord = blogArticleService.getAdjoiningRecord(queryDto); + BlogArticleVo vo = new BlogArticleVo(); BeanUtil.copyProperties(find, vo); @@ -216,10 +223,25 @@ String tempURL = this.getBlogSourceURL(find.getArticleFileId()); - if (StrUtil.isEmpty(tempURL)) - throw new BlogException(BlogExceptionEnum.article_file_lose); + //if (StrUtil.isEmpty(tempURL)) + //throw new BlogException(BlogExceptionEnum.article_file_lose); vo.setArticleFileURL(tempURL); + vo.setCoverFileURL(this.getBlogSourceURL(vo.getCoverFileId())); + + while (!adjoiningRecord.isDone()) { + try { + Thread.sleep(50); + } catch (InterruptedException e) { + } + } + + try { + vo.setPreviousRecord(adjoiningRecord.get().get(0)); + vo.setNextRecord(adjoiningRecord.get().get(1)); + } catch (Exception e) { + log.error("异步获取上下相邻日志id异常,id:{} ,msg:{}", queryDto.getId(), e.getMessage()); + } return new SuccessResponseData(vo); } -- Gitblit v1.9.1