inleft
2022-08-22 1e152bbcfb357073d8bcf0b51fe701e3fb81540d
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
@@ -163,7 +166,7 @@
                }
            }
            //前端根据条件标注小红点(发布时间和更新时间在7天内)
            //前端根据条件标注小红点(发布时间小于更新时间,且在7天内)
            if (e.getPublishDate().before(e.getUpdateDate())
                    && DateUtil.between(e.getUpdateDate(), now, DateUnit.DAY) <= 7) {
                e.setIsAnyUpdate(MyConstant.Yes);
@@ -210,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);
@@ -217,11 +223,26 @@
        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);
    }