| | |
| | | package vip.xiaonuo.modular.blogarticle.controller; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.PageUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | import vip.xiaonuo.core.pojo.response.ResponseData; |
| | | import vip.xiaonuo.core.pojo.response.SuccessResponseData; |
| | | import vip.xiaonuo.modular.blogarticle.entity.BlogArticle; |
| | | import vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo; |
| | | import vip.xiaonuo.modular.blogarticle.param.BlogArticleAddDto; |
| | | import vip.xiaonuo.modular.blogarticle.param.BlogArticleQueryDto; |
| | | import vip.xiaonuo.modular.blogarticle.entity.BlogArticleVo; |
| | | import vip.xiaonuo.modular.blogarticle.service.BlogArticleService; |
| | | import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType; |
| | | import vip.xiaonuo.modular.blogarticletype.service.BlogArticleTypeService; |
| | |
| | | param.put("typeId", queryDto.getTypeId()); |
| | | |
| | | String blogSourcePrefix = ConstantContextHolder.getBlogSourcePrefix(); |
| | | |
| | | Date now = DateUtil.date(); |
| | | //空类型查询条件,排除笔记系列,按更新时间倒序 |
| | | //含有类型查询,按发布时间倒序 |
| | | List<BlogArticleVo> resList = blogArticleService.searchList(param).stream().map(e -> { |
| | | if (StrUtil.isNotEmpty(e.getCoverFileURL())) { |
| | | if (!e.getCoverFileURL().startsWith("http")) { |
| | |
| | | e.setCoverFileURL(blogSourcePrefix + e.getCoverFileURL()); |
| | | } |
| | | } |
| | | |
| | | //前端根据条件标注小红点(发布时间和更新时间在7天内) |
| | | if (e.getPublishDate().before(e.getUpdateDate()) |
| | | && DateUtil.between(e.getUpdateDate(), now, DateUnit.DAY) <= 7) { |
| | | e.setIsAnyUpdate(MyConstant.Yes); |
| | | } else { |
| | | e.setIsAnyUpdate(MyConstant.No); |
| | | } |
| | | |
| | | return e; |
| | | }).collect(Collectors.toList()); |
| | | |