From aae48957ba971ed0a1bfbfa182701cd22bbe8694 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Wed, 31 Aug 2022 18:12:16 +0800 Subject: [PATCH] 新增编辑页 查询接口 --- snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleOutsideController.java | 3 snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticlePrivateController.java | 96 +++++++++++++++++++ snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/entity/BlogArticlePrivateVo.java | 185 +++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 2 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 7fb96dd..26834c9 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 @@ -30,7 +30,6 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.PageUtil; 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; @@ -84,7 +83,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(ConstantContextHolder.getPushCode())) { + if (!addDto.getSecret().equals(ConstantContextHolder.getPushCode())) { throw new BlogException("口令错误.."); } diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticlePrivateController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticlePrivateController.java new file mode 100644 index 0000000..35f4d41 --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticlePrivateController.java @@ -0,0 +1,96 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.blogarticle.controller; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import vip.xiaonuo.core.annotion.BusinessLog; +import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; +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.BlogArticleQueryDto; +import vip.xiaonuo.modular.blogarticle.service.BlogArticleService; +import vip.xiaonuo.modular.blogarticletype.service.BlogArticleTypeService; +import vip.xiaonuo.sys.modular.file.service.SysFileInfoService; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * blog文章控制器 (提供给外部blog系统查询) + * + * @author inleft + * @date 2022-02-09 18:20:22 + */ +@RestController +@RequestMapping("/outside/private/") +@Slf4j +public class BlogArticlePrivateController { + + @Resource + private BlogArticleService blogArticleService; + + + @Resource + private BlogArticleTypeService blogArticleTypeService; + + @Resource + private SysFileInfoService fileInfoService; + + + /** + * 查询blog文章(私有查询) + */ + @GetMapping("/blogArticle/queryBlogArticlePrivateList") + @BusinessLog(title = "外部blog系统_blog文章_私有列表", opType = LogAnnotionOpTypeEnum.QUERY) + public ResponseData queryBlogArticlePrivateList(BlogArticleQueryDto queryDto) { + +// if (StrUtil.isEmpty(queryDto.getAuthWord()) || !queryDto.getAuthWord().equals(ConstantContextHolder.getPushCode())) { +// throw new BlogException("口令错误.."); +// } + + Page queryPage = new Page<>(queryDto.getPageNo(), queryDto.getPageSize()); + + queryPage.setRecords((List) blogArticleService.lambdaQuery() + .orderByDesc(BlogArticle::getUpdateDate) + .select(BlogArticle::getId, BlogArticle::getTitle) + .page(queryPage).getRecords().stream().map(e -> { + BlogArticleVo vo = new BlogArticleVo(); + BeanUtil.copyProperties(e, vo); + return vo; + }).collect(Collectors.toList())); + + return new SuccessResponseData(queryPage); + } + + +} diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/entity/BlogArticlePrivateVo.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/entity/BlogArticlePrivateVo.java new file mode 100644 index 0000000..aca212c --- /dev/null +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/entity/BlogArticlePrivateVo.java @@ -0,0 +1,185 @@ +/* +Copyright [2020] [https://www.xiaonuo.vip] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + +1.请不要删除和修改根目录下的LICENSE文件。 +2.请不要删除和修改Snowy源码头部的版权声明。 +3.请保留源码和相关描述文件的项目出处,作者声明等。 +4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy +5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy +6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.modular.blogarticle.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * blog文章主体 + * + * @author inleft + * @date 2022-01-22 16:53:06 + */ +@Data +public class BlogArticlePrivateVo { + + /** + * 主键 + */ + private Long id; + + /** + * 文章标题 + */ + private String title; + + /** + * 文章文件地址 + */ + private String articleFileURL; + + private String coverFileURL; + + /** + * 文件类型 1:markdown 2:html + */ + private Integer articleFileType; + + /** + * 文章分类id 0:没有分类 + */ + private Long articleTypeId; + + + /** + * 分类名称 + */ + private String articleTypeName; + + /** + * 文章引言 + */ + private String introduce; + + /** + * 封面文件地址(id) + */ + private Long coverFileId; + + + /** + * 上次编辑时间 + */ + private Date lastEditorDate; + + /** + * 发布时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + private Date publishDate; + + /** + * 更新时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateDate; + + /** + * 是否置顶 0:否 1:是 + */ + private Integer isTop; + + + /** + * 公开状态 1:公开 2:私密 3:密码授权 + */ + private Integer authStatus; + + /** + * 是否允许评论 0:否 1:是 + */ + private Integer isAllowedComment; + + /** + * 是否有任意更新 + */ + private Integer isAnyUpdate; + + /** + * 外链跳转 + */ + private String jumpURL; + + /** + * 上篇日志 + */ + private BlogArticlePrivateVo previousRecord; + + /** + * 下篇日志 + */ + private BlogArticlePrivateVo nextRecord; + + + /** + * 图库地址列表 + */ + private List<String> pictureUrlList; + + /** + * 视频地址列表 + */ + private List<String> videoUrlList; + + private String videoIds; + + private String pictureIds; + + /** + * 置顶值(越小越靠前) + */ + private Integer topValue; + + /** + * 编辑状态 0:草稿 1:发布 + */ + private Integer editorStatus; + + /** + * 归档年份(以初次发布时间为准) + */ + private Integer separateYear; + + /** + * 归档月份 + */ + private Integer separateMonth; + + /** + * 归档日 + */ + private Integer separateDay; + + /** + * 是否启用 0:否 1:是 + */ + private Integer isEnable; + + +} -- Gitblit v1.9.1