From 84ab8820c83ba02e560d858151f1c96e655266df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=9E=E5=AE=9D=E5=B1=B1?= <1253070437@qq.com> Date: Fri, 19 Jul 2024 02:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=9B=B4=E6=96=B0=E3=80=91=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E5=8A=A0=E5=85=A5=E8=BD=AE=E6=92=AD=E5=9B=BE=E3=80=81?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=85=B6=E6=AC=A1=E6=8F=90=E4=BE=9B=E4=B8=9A=E5=8A=A1=E9=A6=96?= =?UTF-8?q?=E9=A1=B5API=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/vip/xiaonuo/auth/api/AuthApi.java | 40 +++++ .../vip/xiaonuo/dev/api/DevSlideshowApi.java | 34 ++++ .../auth/modular/auth/AuthApiProvider.java | 78 +++++++++ .../index/controller/BizIndexController.java | 87 ++++++++++ .../index/param/BizIndexNoticeIdParam.java | 32 ++++ .../index/param/BizIndexNoticeListParam.java | 32 ++++ .../param/BizIndexSlideshowListParam.java | 32 ++++ .../result/BizIndexNoticeListResult.java | 58 +++++++ .../result/BizIndexSlideshowDetailResult.java | 70 ++++++++ .../result/BizIndexSlideshowListResult.java | 44 +++++ .../index/service/BizIndexService.java | 56 ++++++ .../service/impl/BizIndexServiceImpl.java | 74 ++++++++ .../controller/BizNoticeController.java | 153 +++++++++++++++++ .../biz/modular/notice/entity/BizNotice.java | 80 +++++++++ .../notice/enums/BizNoticeStatusEnum.java | 49 ++++++ .../notice/mapper/BizNoticeMapper.java | 25 +++ .../notice/mapper/mapping/BizNoticeMapper.xml | 5 + .../notice/param/BizNoticeAddParam.java | 66 +++++++ .../notice/param/BizNoticeEditParam.java | 71 ++++++++ .../notice/param/BizNoticeIdParam.java | 34 ++++ .../notice/param/BizNoticePageParam.java | 73 ++++++++ .../notice/service/BizNoticeService.java | 96 +++++++++++ .../service/impl/BizNoticeServiceImpl.java | 128 ++++++++++++++ .../xiaonuo/dev/core/conts/DevConstants.java | 28 +++ .../controller/DevSlideshowController.java | 132 ++++++++++++++ .../slideshow/entity/DevSlideshow.java | 68 ++++++++ .../slideshow/enums/DevSlideshowEnum.java | 34 ++++ .../enums/DevSlideshowStatusEnum.java | 49 ++++++ .../slideshow/mapper/DevSlideshowMapper.java | 25 +++ .../mapper/mapping/DevSlideshowMapper.xml | 5 + .../slideshow/param/DevSlideshowAddParam.java | 58 +++++++ .../param/DevSlideshowEditParam.java | 63 +++++++ .../slideshow/param/DevSlideshowIdParam.java | 35 ++++ .../param/DevSlideshowPageParam.java | 63 +++++++ .../provider/DevSlideshowApiProvider.java | 39 +++++ .../service/DevSlideshowService.java | 97 +++++++++++ .../service/impl/DevSlideshowServiceImpl.java | 162 ++++++++++++++++++ .../index/controller/SysIndexController.java | 36 ++++ .../index/result/SysBizDataCountResult.java | 27 +++ .../index/result/SysOpDataCountResult.java | 33 ++++ .../index/result/SysToolDataCountResult.java | 27 +++ .../index/service/SysIndexService.java | 26 ++- .../service/impl/SysIndexServiceImpl.java | 52 ++++++ .../xiaonuo/core/config/GlobalConfigure.java | 4 + 44 files changed, 2479 insertions(+), 1 deletion(-) create mode 100644 snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/api/AuthApi.java create mode 100644 snowy-plugin-api/snowy-plugin-dev-api/src/main/java/vip/xiaonuo/dev/api/DevSlideshowApi.java create mode 100644 snowy-plugin/snowy-plugin-auth/src/main/java/vip/xiaonuo/auth/modular/auth/AuthApiProvider.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/controller/BizIndexController.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeIdParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeListParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexSlideshowListParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexNoticeListResult.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowDetailResult.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowListResult.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/BizIndexService.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/impl/BizIndexServiceImpl.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/controller/BizNoticeController.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/entity/BizNotice.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/enums/BizNoticeStatusEnum.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/BizNoticeMapper.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/mapping/BizNoticeMapper.xml create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeAddParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeEditParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeIdParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticePageParam.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/BizNoticeService.java create mode 100644 snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/impl/BizNoticeServiceImpl.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/core/conts/DevConstants.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/controller/DevSlideshowController.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/entity/DevSlideshow.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowEnum.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowStatusEnum.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/DevSlideshowMapper.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/mapping/DevSlideshowMapper.xml create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowAddParam.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowEditParam.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowIdParam.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowPageParam.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/provider/DevSlideshowApiProvider.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/DevSlideshowService.java create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/impl/DevSlideshowServiceImpl.java create mode 100644 snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysBizDataCountResult.java create mode 100644 snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysOpDataCountResult.java create mode 100644 snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysToolDataCountResult.java diff --git a/snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/api/AuthApi.java b/snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/api/AuthApi.java new file mode 100644 index 00000000..1fad76b9 --- /dev/null +++ b/snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/api/AuthApi.java @@ -0,0 +1,40 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.auth.api; + +import cn.hutool.json.JSONObject; + +/** + * 认证鉴权API + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ +public interface AuthApi { + + /** + * 获取基础登录业务数据,b端在线用户,c端在线用户 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + JSONObject getUserSessionCount(); + + /** + * 获取三方用户总量 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + Long getThirdUserCount(); +} diff --git a/snowy-plugin-api/snowy-plugin-dev-api/src/main/java/vip/xiaonuo/dev/api/DevSlideshowApi.java b/snowy-plugin-api/snowy-plugin-dev-api/src/main/java/vip/xiaonuo/dev/api/DevSlideshowApi.java new file mode 100644 index 00000000..9fc2e5fb --- /dev/null +++ b/snowy-plugin-api/snowy-plugin-dev-api/src/main/java/vip/xiaonuo/dev/api/DevSlideshowApi.java @@ -0,0 +1,34 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.api; + +import cn.hutool.json.JSONObject; + +import java.util.List; + +/** + * 轮播图API + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +public interface DevSlideshowApi { + + /** + * 通过位置获得轮播图列表 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ + List getListByPlace(String place); +} diff --git a/snowy-plugin/snowy-plugin-auth/src/main/java/vip/xiaonuo/auth/modular/auth/AuthApiProvider.java b/snowy-plugin/snowy-plugin-auth/src/main/java/vip/xiaonuo/auth/modular/auth/AuthApiProvider.java new file mode 100644 index 00000000..3836f2f5 --- /dev/null +++ b/snowy-plugin/snowy-plugin-auth/src/main/java/vip/xiaonuo/auth/modular/auth/AuthApiProvider.java @@ -0,0 +1,78 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.auth.modular.auth; + + +import cn.dev33.satoken.session.SaSession; +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import vip.xiaonuo.auth.api.AuthApi; +import vip.xiaonuo.auth.core.util.StpClientUtil; +import vip.xiaonuo.auth.modular.third.service.AuthThirdService; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 认证鉴权API实现类 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + **/ +@Service +public class AuthApiProvider implements AuthApi { + + @Resource + private AuthThirdService authThirdService; + + @Override + public JSONObject getUserSessionCount() { + JSONObject resultObj = new JSONObject(); + List sessionListB = StpUtil.searchSessionId("", -1, -1, true).stream().map(sessionId -> { + JSONObject jsonObject = JSONUtil.createObj(); + String userId = StrUtil.split(sessionId, StrUtil.COLON).get(3); + SaSession saSession = StpUtil.getSessionByLoginId(userId, false); + int tokenCount = saSession.getTokenSignList().size(); + long createTime = saSession.getCreateTime(); + jsonObject.set("userId", userId); + jsonObject.set("tokenCount", tokenCount); + jsonObject.set("createTime", DateTime.of(createTime)); + return jsonObject; + }).collect(Collectors.toList()); + + List sessionListC = StpClientUtil.searchSessionId("", -1, -1, true).stream().map(sessionId -> { + JSONObject jsonObject = JSONUtil.createObj(); + String userId = StrUtil.split(sessionId, StrUtil.COLON).get(3); + SaSession saSession = StpClientUtil.getSessionByLoginId(userId, false); + int tokenCount = saSession.getTokenSignList().size(); + long createTime = saSession.getCreateTime(); + jsonObject.set("userId", userId); + jsonObject.set("tokenCount", tokenCount); + jsonObject.set("createTime", DateTime.of(createTime)); + return jsonObject; + }).collect(Collectors.toList()); + resultObj.set("backUserSessionCount" ,sessionListB.size()); + resultObj.set("clientUserSessionCount" ,sessionListC.size()); + return resultObj; + } + + @Override + public Long getThirdUserCount() { + return authThirdService.count(); + } +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/controller/BizIndexController.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/controller/BizIndexController.java new file mode 100644 index 00000000..c02365ea --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/controller/BizIndexController.java @@ -0,0 +1,87 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import vip.xiaonuo.biz.modular.index.param.BizIndexNoticeIdParam; +import vip.xiaonuo.biz.modular.index.param.BizIndexNoticeListParam; +import vip.xiaonuo.biz.modular.index.param.BizIndexSlideshowListParam; +import vip.xiaonuo.biz.modular.index.result.BizIndexNoticeListResult; +import vip.xiaonuo.biz.modular.index.result.BizIndexSlideshowDetailResult; +import vip.xiaonuo.biz.modular.index.result.BizIndexSlideshowListResult; +import vip.xiaonuo.biz.modular.index.service.BizIndexService; +import vip.xiaonuo.common.pojo.CommonResult; +import javax.validation.Valid; +import java.util.List; + +/** + * 业务首页控制器 + * + * @author yubaoshan + * @date 2024/7/13 21:02 + */ +@Tag(name = "业务首页控制器") +@ApiSupport(author = "SNOWY_TEAM", order = 0) +@RestController +@Validated +public class BizIndexController { + + @Resource + private BizIndexService bizIndexService; + + /** + * 获取轮播图列表 + * + * @author yubaoshan + * @date 2024/7/13 21:02 + */ + @ApiOperationSupport(order = 1) + @Operation(summary = "获取轮播图列表") + @GetMapping("/biz/index/slideshow/list") + public CommonResult> slideshowListByPlace(@Valid BizIndexSlideshowListParam bizIndexSlideshowListParam) { + return CommonResult.data(bizIndexService.slideshowListByPlace(bizIndexSlideshowListParam)); + } + + /** + * 获取通知公告列表 + * + * @author yubaoshan + * @date 2024/7/13 21:02 + */ + @ApiOperationSupport(order = 2) + @Operation(summary = "获取通知公告列表") + @GetMapping("/biz/index/notice/list") + public CommonResult> noticeListByLimit(BizIndexNoticeListParam bizIndexNoticeListParam) { + return CommonResult.data(bizIndexService.noticeListByLimit(bizIndexNoticeListParam)); + } + + /** + * 获取通知公告详情 + * + * @author yubaoshan + * @date 2024/7/13 21:02 + */ + @ApiOperationSupport(order = 3) + @Operation(summary = "获取通知公告详情") + @GetMapping("/biz/index/notice/detail") + public CommonResult noticeDetailById(@Valid BizIndexNoticeIdParam bizIndexNoticeIdParam) { + return CommonResult.data(bizIndexService.noticeDetailById(bizIndexNoticeIdParam)); + } +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeIdParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeIdParam.java new file mode 100644 index 00000000..9c0aa265 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeIdParam.java @@ -0,0 +1,32 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 通知公告详情参数 + * + * @author yubaoshan + * @date 2024/7/13 21:02 + **/ +@Getter +@Setter +public class BizIndexNoticeIdParam { + + /** ID */ + @Schema(description = "ID") + private String id; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeListParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeListParam.java new file mode 100644 index 00000000..9a460b26 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeListParam.java @@ -0,0 +1,32 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 通知公告列表参数 + * + * @author yubaoshan + * @date 2024/7/13 21:02 + **/ +@Getter +@Setter +public class BizIndexNoticeListParam { + + /** 条数" */ + @Schema(description = "条数") + private Integer limit; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexSlideshowListParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexSlideshowListParam.java new file mode 100644 index 00000000..4e7039d1 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexSlideshowListParam.java @@ -0,0 +1,32 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 轮播图列表参数 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +@Setter +public class BizIndexSlideshowListParam { + + /** 位置" */ + @Schema(description = "位置") + private String place; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexNoticeListResult.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexNoticeListResult.java new file mode 100644 index 00000000..b98b949a --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexNoticeListResult.java @@ -0,0 +1,58 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.result; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.Date; + +/** + * 轮播图结果 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +@Getter +@Setter +public class BizIndexNoticeListResult { + + /** 主键 */ + @Schema(description = "主键") + private String id; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 封面图 */ + @Schema(description = "封面图") + private String image; + + /** 摘要 */ + @Schema(description = "摘要") + private String digest; + + /** 类型 */ + @Schema(description = "类型") + private String type; + + /** 排序 */ + @Schema(description = "排序") + private String sortCode; + + /** 创建时间 */ + @Schema(description = "创建时间") + private Date createTime; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowDetailResult.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowDetailResult.java new file mode 100644 index 00000000..8cd54b18 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowDetailResult.java @@ -0,0 +1,70 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.result; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 轮播图结果 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +@Getter +@Setter +public class BizIndexSlideshowDetailResult { + + /** 主键 */ + @TableId + @Schema(description = "主键") + private String id; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 封面图 */ + @Schema(description = "封面图") + private String image; + + /** 内容 */ + @Schema(description = "内容") + private String content; + + /** 摘要 */ + @Schema(description = "摘要") + private String digest; + + /** 类型 */ + @Schema(description = "类型") + private String type; + + /** 状态 */ + @Schema(description = "状态") + private String status; + + /** 备注 */ + @Schema(description = "备注") + private String remark; + + /** 排序 */ + @Schema(description = "排序") + private String sortCode; + + /** 扩展信息 */ + @Schema(description = "扩展信息") + private String extJson; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowListResult.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowListResult.java new file mode 100644 index 00000000..df45bdf3 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowListResult.java @@ -0,0 +1,44 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.result; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 轮播图结果 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +@Getter +@Setter +public class BizIndexSlideshowListResult { + + /** id */ + @Schema(description = "主键") + private String id; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 图片 */ + @Schema(description = "图片") + private String image; + + /** 路径详情 */ + @Schema(description = "路径详情") + private String pathDetails; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/BizIndexService.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/BizIndexService.java new file mode 100644 index 00000000..d516415f --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/BizIndexService.java @@ -0,0 +1,56 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.service; + +import vip.xiaonuo.biz.modular.index.param.BizIndexNoticeIdParam; +import vip.xiaonuo.biz.modular.index.param.BizIndexNoticeListParam; +import vip.xiaonuo.biz.modular.index.param.BizIndexSlideshowListParam; +import vip.xiaonuo.biz.modular.index.result.BizIndexNoticeListResult; +import vip.xiaonuo.biz.modular.index.result.BizIndexSlideshowDetailResult; +import vip.xiaonuo.biz.modular.index.result.BizIndexSlideshowListResult; + +import javax.validation.Valid; +import java.util.List; + +/** + * 业务首页Service接口 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +public interface BizIndexService { + + /** + * 获取轮播图列表 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + List slideshowListByPlace(BizIndexSlideshowListParam bizIndexSlideshowListParam); + + /** + * 获取通知公告列表 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + List noticeListByLimit(@Valid BizIndexNoticeListParam bizIndexNoticeListParam); + + /** + * 获取通知公告详情 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + BizIndexSlideshowDetailResult noticeDetailById(BizIndexNoticeIdParam bizIndexNoticeIdParam); +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/impl/BizIndexServiceImpl.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/impl/BizIndexServiceImpl.java new file mode 100644 index 00000000..34542190 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/impl/BizIndexServiceImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.index.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import vip.xiaonuo.biz.modular.index.param.BizIndexNoticeIdParam; +import vip.xiaonuo.biz.modular.index.param.BizIndexNoticeListParam; +import vip.xiaonuo.biz.modular.index.param.BizIndexSlideshowListParam; +import vip.xiaonuo.biz.modular.index.result.BizIndexNoticeListResult; +import vip.xiaonuo.biz.modular.index.result.BizIndexSlideshowDetailResult; +import vip.xiaonuo.biz.modular.index.result.BizIndexSlideshowListResult; +import vip.xiaonuo.biz.modular.index.service.BizIndexService; +import vip.xiaonuo.biz.modular.notice.entity.BizNotice; +import vip.xiaonuo.biz.modular.notice.enums.BizNoticeStatusEnum; +import vip.xiaonuo.biz.modular.notice.service.BizNoticeService; +import vip.xiaonuo.dev.api.DevSlideshowApi; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 业务首页Service接口实现类 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +@Service +public class BizIndexServiceImpl implements BizIndexService { + + + @Resource + private DevSlideshowApi devSlideshowApi; + + @Resource + private BizNoticeService bizNoticeService; + + @Override + public List slideshowListByPlace(BizIndexSlideshowListParam bizIndexSlideshowListParam) { + return devSlideshowApi.getListByPlace(bizIndexSlideshowListParam.getPlace()).stream() + .map(jsonObject -> JSONUtil.toBean(jsonObject, BizIndexSlideshowListResult.class)).collect(Collectors.toList()); + } + + @Override + public List noticeListByLimit(BizIndexNoticeListParam bizIndexNoticeListParam) { + return bizNoticeService.list(new LambdaQueryWrapper() + .eq(BizNotice::getStatus, BizNoticeStatusEnum.ENABLE.getValue()) + .orderByAsc(BizNotice::getCreateTime) + ) + .stream() + .limit(ObjectUtil.isNotEmpty(bizIndexNoticeListParam.getLimit())? bizIndexNoticeListParam.getLimit().longValue() : 10) + .map(notice -> JSONUtil.toBean(JSONUtil.toJsonStr(notice), BizIndexNoticeListResult.class)).collect(Collectors.toList()); + } + + @Override + public BizIndexSlideshowDetailResult noticeDetailById(BizIndexNoticeIdParam bizIndexNoticeIdParam) { + BizIndexSlideshowDetailResult result = new BizIndexSlideshowDetailResult(); + BeanUtil.copyProperties(bizNoticeService.getById(bizIndexNoticeIdParam.getId()), result); + return result; + } +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/controller/BizNoticeController.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/controller/BizNoticeController.java new file mode 100644 index 00000000..b6635904 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/controller/BizNoticeController.java @@ -0,0 +1,153 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import vip.xiaonuo.common.annotation.CommonLog; +import vip.xiaonuo.common.pojo.CommonResult; +import vip.xiaonuo.biz.modular.notice.entity.BizNotice; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeAddParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeEditParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeIdParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticePageParam; +import vip.xiaonuo.biz.modular.notice.service.BizNoticeService; + +import jakarta.annotation.Resource; +import javax.validation.Valid; +import jakarta.validation.constraints.NotEmpty; +import java.util.List; + +/** + * 通知公告控制器 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ +@Tag(name = "通知公告控制器") +@RestController +@Validated +public class BizNoticeController { + + @Resource + private BizNoticeService bizNoticeService; + + /** + * 获取通知公告分页 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "获取通知公告分页") + @SaCheckPermission("/biz/notice/page") + @GetMapping("/biz/notice/page") + public CommonResult> page(BizNoticePageParam bizNoticePageParam) { + return CommonResult.data(bizNoticeService.page(bizNoticePageParam)); + } + + /** + * 添加通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "添加通知公告") + @CommonLog("添加通知公告") + @SaCheckPermission("/biz/notice/add") + @PostMapping("/biz/notice/add") + public CommonResult add(@RequestBody @Valid BizNoticeAddParam bizNoticeAddParam) { + bizNoticeService.add(bizNoticeAddParam); + return CommonResult.ok(); + } + + /** + * 编辑通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "编辑通知公告") + @CommonLog("编辑通知公告") + @SaCheckPermission("/biz/notice/edit") + @PostMapping("/biz/notice/edit") + public CommonResult edit(@RequestBody @Valid BizNoticeEditParam bizNoticeEditParam) { + bizNoticeService.edit(bizNoticeEditParam); + return CommonResult.ok(); + } + + /** + * 删除通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "删除通知公告") + @CommonLog("删除通知公告") + @SaCheckPermission("/biz/notice/delete") + @PostMapping("/biz/notice/delete") + public CommonResult delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空") + List bizNoticeIdParamList) { + bizNoticeService.delete(bizNoticeIdParamList); + return CommonResult.ok(); + } + + /** + * 获取通知公告详情 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "获取通知公告详情") + @SaCheckPermission("/biz/notice/detail") + @GetMapping("/biz/notice/detail") + public CommonResult detail(@Valid BizNoticeIdParam bizNoticeIdParam) { + return CommonResult.data(bizNoticeService.detail(bizNoticeIdParam)); + } + + /** + * 禁用通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "禁用通知公告") + @CommonLog("禁用通知公告") + @SaCheckPermission("/biz/notice/disableStatus") + @PostMapping("/biz/notice/disableStatus") + public CommonResult disableStatus(@RequestBody @Valid BizNoticeIdParam bizNoticeIdParam) { + bizNoticeService.disableStatus(bizNoticeIdParam); + return CommonResult.ok(); + } + + /** + * 启用通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + @Operation(summary = "启用通知公告") + @CommonLog("启用通知公告") + @SaCheckPermission("/biz/notice/enableStatus") + @PostMapping("/biz/notice/enableStatus") + public CommonResult enableStatus(@RequestBody @Valid BizNoticeIdParam bizNoticeIdParam) { + bizNoticeService.enableStatus(bizNoticeIdParam); + return CommonResult.ok(); + } +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/entity/BizNotice.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/entity/BizNotice.java new file mode 100644 index 00000000..b28512da --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/entity/BizNotice.java @@ -0,0 +1,80 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import vip.xiaonuo.common.pojo.CommonEntity; + +/** + * 通知公告实体 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +@Getter +@Setter +@TableName("biz_notice") +public class BizNotice extends CommonEntity { + + /** 主键 */ + @TableId + @Schema(description = "主键") + private String id; + + /** 租户id */ + @Schema(description = "租户id") + private String tenantId; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 封面图 */ + @Schema(description = "封面图") + private String image; + + /** 内容 */ + @Schema(description = "内容") + private String content; + + /** 摘要 */ + @Schema(description = "摘要") + private String digest; + + /** 类型 */ + @Schema(description = "类型") + private String type; + + /** 发布位置 */ + @Schema(description = "发布位置") + private String place; + + /** 状态 */ + @Schema(description = "状态") + private String status; + + /** 备注 */ + @Schema(description = "备注") + private String remark; + + /** 排序 */ + @Schema(description = "排序") + private String sortCode; + + /** 扩展信息 */ + @Schema(description = "扩展信息") + private String extJson; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/enums/BizNoticeStatusEnum.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/enums/BizNoticeStatusEnum.java new file mode 100644 index 00000000..0f9a38e7 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/enums/BizNoticeStatusEnum.java @@ -0,0 +1,49 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.enums; + +import lombok.Getter; +import vip.xiaonuo.common.exception.CommonException; + +/** + * 通知公告状态枚举 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ +@Getter +public enum BizNoticeStatusEnum { + + /** + * 正常 + */ + ENABLE("ENABLE"), + + /** + * 禁用 + */ + DISABLE("DISABLE"); + + private final String value; + + BizNoticeStatusEnum(String value) { + this.value = value; + } + + public static void validate(String value) { + boolean flag = ENABLE.getValue().equals(value) || DISABLE.getValue().equals(value); + if(!flag) { + throw new CommonException("不支持的状态:{}", value); + } + } +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/BizNoticeMapper.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/BizNoticeMapper.java new file mode 100644 index 00000000..a03f8747 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/BizNoticeMapper.java @@ -0,0 +1,25 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.biz.modular.notice.entity.BizNotice; + +/** + * 通知公告Mapper接口 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +public interface BizNoticeMapper extends BaseMapper { +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/mapping/BizNoticeMapper.xml b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/mapping/BizNoticeMapper.xml new file mode 100644 index 00000000..c81ed946 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/mapping/BizNoticeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeAddParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeAddParam.java new file mode 100644 index 00000000..4fd42fa8 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeAddParam.java @@ -0,0 +1,66 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import jakarta.validation.constraints.NotBlank; + +/** + * 通知公告添加参数 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +@Getter +@Setter +public class BizNoticeAddParam { + + /** 标题 */ + @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "title不能为空") + private String title; + + /** 封面图 */ + @Schema(description = "封面图") + private String image; + + /** 内容 */ + @Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "content不能为空") + private String content; + + /** 摘要 */ + @Schema(description = "摘要", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "digest不能为空") + private String digest; + + /** 类型 */ + @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "type不能为空") + private String type; + + /** 发布位置 */ + @Schema(description = "发布位置", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "place不能为空") + private String place; + + /** 备注 */ + @Schema(description = "备注") + private String remark; + + /** 排序码 */ + @Schema(description = "排序码") + private Integer sortCode; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeEditParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeEditParam.java new file mode 100644 index 00000000..2ea1403f --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeEditParam.java @@ -0,0 +1,71 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import jakarta.validation.constraints.NotBlank; + +/** + * 通知公告编辑参数 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +@Getter +@Setter +public class BizNoticeEditParam { + + /** 主键 */ + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空") + private String id; + + /** 标题 */ + @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "title不能为空") + private String title; + + /** 封面图 */ + @Schema(description = "封面图") + private String image; + + /** 内容 */ + @Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "content不能为空") + private String content; + + /** 摘要 */ + @Schema(description = "摘要", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "digest不能为空") + private String digest; + + /** 类型 */ + @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "type不能为空") + private String type; + + /** 发布位置 */ + @Schema(description = "发布位置", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "place不能为空") + private String place; + + /** 备注 */ + @Schema(description = "备注") + private String remark; + + /** 排序码 */ + @Schema(description = "排序码") + private Integer sortCode; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeIdParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeIdParam.java new file mode 100644 index 00000000..5d72ff8b --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeIdParam.java @@ -0,0 +1,34 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import jakarta.validation.constraints.NotBlank; + +/** + * 通知公告Id参数 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +@Getter +@Setter +public class BizNoticeIdParam { + + /** 主键 */ + @Schema(description = "主键") + @NotBlank(message = "id不能为空") + private String id; +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticePageParam.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticePageParam.java new file mode 100644 index 00000000..b9d8f778 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticePageParam.java @@ -0,0 +1,73 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +/** + * 通知公告查询参数 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +@Getter +@Setter +public class BizNoticePageParam { + + /** 当前页 */ + @Schema(description = "当前页码") + private Integer current; + + /** 每页条数 */ + @Schema(description = "每页条数") + private Integer size; + + /** 排序字段 */ + @Schema(description = "排序字段,字段驼峰名称,如:userName") + private String sortField; + + /** 排序方式 */ + @Schema(description = "排序方式,升序:ASCEND;降序:DESCEND") + private String sortOrder; + + /** 关键词 */ + @Schema(description = "关键词") + private String searchKey; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 类型 */ + @Schema(description = "类型") + private String type; + + /** 发布位置 */ + @Schema(description = "发布位置") + private String place; + + /** 状态 */ + @Schema(description = "状态") + private String status; + + /** 创建时间开始 */ + @Schema(description = "创建时间开始") + private String startCreateTime; + + /** 创建时间结束 */ + @Schema(description = "创建时间结束") + private String endCreateTime; + +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/BizNoticeService.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/BizNoticeService.java new file mode 100644 index 00000000..1d290e56 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/BizNoticeService.java @@ -0,0 +1,96 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.biz.modular.notice.entity.BizNotice; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeAddParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeEditParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeIdParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticePageParam; + +import java.util.List; + +/** + * 通知公告Service接口 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +public interface BizNoticeService extends IService { + + /** + * 获取通知公告分页 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + Page page(BizNoticePageParam bizNoticePageParam); + + /** + * 添加通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + void add(BizNoticeAddParam bizNoticeAddParam); + + /** + * 编辑通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + void edit(BizNoticeEditParam bizNoticeEditParam); + + /** + * 删除通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + void delete(List bizNoticeIdParamList); + + /** + * 获取通知公告详情 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + BizNotice detail(BizNoticeIdParam bizNoticeIdParam); + + /** + * 获取通知公告详情 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ + BizNotice queryEntity(String id); + + /** + * 禁用通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + void disableStatus(BizNoticeIdParam bizNoticeIdParam); + + /** + * 启用通知公告 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ + void enableStatus(BizNoticeIdParam bizNoticeIdParam); +} diff --git a/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/impl/BizNoticeServiceImpl.java b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/impl/BizNoticeServiceImpl.java new file mode 100644 index 00000000..7fe2d977 --- /dev/null +++ b/snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/impl/BizNoticeServiceImpl.java @@ -0,0 +1,128 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.biz.modular.notice.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollStreamUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import vip.xiaonuo.biz.modular.notice.enums.BizNoticeStatusEnum; +import vip.xiaonuo.common.enums.CommonSortOrderEnum; +import vip.xiaonuo.common.exception.CommonException; +import vip.xiaonuo.common.page.CommonPageRequest; +import vip.xiaonuo.biz.modular.notice.entity.BizNotice; +import vip.xiaonuo.biz.modular.notice.mapper.BizNoticeMapper; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeAddParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeEditParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticeIdParam; +import vip.xiaonuo.biz.modular.notice.param.BizNoticePageParam; +import vip.xiaonuo.biz.modular.notice.service.BizNoticeService; + +import java.util.List; + +/** + * 通知公告Service接口实现类 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + **/ +@Service +public class BizNoticeServiceImpl extends ServiceImpl implements BizNoticeService { + + + @Override + public Page page(BizNoticePageParam bizNoticePageParam) { + QueryWrapper queryWrapper = new QueryWrapper().checkSqlInjection(); + if(ObjectUtil.isNotEmpty(bizNoticePageParam.getTitle())) { + queryWrapper.lambda().like(BizNotice::getTitle, bizNoticePageParam.getTitle()); + } + if(ObjectUtil.isNotEmpty(bizNoticePageParam.getType())) { + queryWrapper.lambda().eq(BizNotice::getType, bizNoticePageParam.getType()); + } + if(ObjectUtil.isNotEmpty(bizNoticePageParam.getPlace())) { + queryWrapper.lambda().like(BizNotice::getPlace, bizNoticePageParam.getPlace()); + } + if(ObjectUtil.isNotEmpty(bizNoticePageParam.getStatus())) { + queryWrapper.lambda().eq(BizNotice::getStatus, bizNoticePageParam.getStatus()); + } + if(ObjectUtil.isNotEmpty(bizNoticePageParam.getStartCreateTime()) && ObjectUtil.isNotEmpty(bizNoticePageParam.getEndCreateTime())) { + queryWrapper.lambda().between(BizNotice::getCreateTime, bizNoticePageParam.getStartCreateTime(), bizNoticePageParam.getEndCreateTime()); + } + if(ObjectUtil.isAllNotEmpty(bizNoticePageParam.getSortField(), bizNoticePageParam.getSortOrder())) { + CommonSortOrderEnum.validate(bizNoticePageParam.getSortOrder()); + queryWrapper.orderBy(true, bizNoticePageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()), + StrUtil.toUnderlineCase(bizNoticePageParam.getSortField())); + } else { + queryWrapper.lambda().orderByAsc(BizNotice::getId); + } + return this.page(CommonPageRequest.defaultPage(), queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void add(BizNoticeAddParam bizNoticeAddParam) { + BizNotice bizNotice = BeanUtil.toBean(bizNoticeAddParam, BizNotice.class); + // 默认为禁用的 + bizNotice.setStatus(BizNoticeStatusEnum.DISABLE.getValue()); + this.save(bizNotice); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(BizNoticeEditParam bizNoticeEditParam) { + BizNotice bizNotice = this.queryEntity(bizNoticeEditParam.getId()); + BeanUtil.copyProperties(bizNoticeEditParam, bizNotice); + this.updateById(bizNotice); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List bizNoticeIdParamList) { + // 执行删除 + this.removeByIds(CollStreamUtil.toList(bizNoticeIdParamList, BizNoticeIdParam::getId)); + } + + @Override + public BizNotice detail(BizNoticeIdParam bizNoticeIdParam) { + return this.queryEntity(bizNoticeIdParam.getId()); + } + + @Override + public BizNotice queryEntity(String id) { + BizNotice bizNotice = this.getById(id); + if(ObjectUtil.isEmpty(bizNotice)) { + throw new CommonException("通知公告不存在,id值为:{}", id); + } + return bizNotice; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void disableStatus(BizNoticeIdParam bizNoticeIdParam) { + this.update(new LambdaUpdateWrapper().eq(BizNotice::getId, + bizNoticeIdParam.getId()).set(BizNotice::getStatus, BizNoticeStatusEnum.DISABLE.getValue())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void enableStatus(BizNoticeIdParam bizNoticeIdParam) { + this.update(new LambdaUpdateWrapper().eq(BizNotice::getId, + bizNoticeIdParam.getId()).set(BizNotice::getStatus, BizNoticeStatusEnum.ENABLE.getValue())); + } +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/core/conts/DevConstants.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/core/conts/DevConstants.java new file mode 100644 index 00000000..5aab3d98 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/core/conts/DevConstants.java @@ -0,0 +1,28 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.core.conts; + +/** + * dev工具类静态变量 + * + * @author yubaoshan + * @date 2022/7/13 16:53 + */ +public interface DevConstants { + + /** + * 静态的轮播图base64图片 + */ + String STATIC_SLIDESHOW_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAADcCAIAAAAJPMQyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDcuMi1jMDAwIDc5LjU2NmViYzViNCwgMjAyMi8wNS8wOS0wODoyNTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjQgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjE5RDQ0MENFMDc2RjExRURBRTU5RTM4OUFDNjE5MDUyIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjE5RDQ0MENGMDc2RjExRURBRTU5RTM4OUFDNjE5MDUyIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MTlENDQwQ0MwNzZGMTFFREFFNTlFMzg5QUM2MTkwNTIiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MTlENDQwQ0QwNzZGMTFFREFFNTlFMzg5QUM2MTkwNTIiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7jEwzPAAAFT0lEQVR42uzdW3JTRxSG0YanMAGYU+ZflQFgxxAnuBKXJFvWJRwCpHAUWUc6l9271xrCfvgeus4vvfr5l30BCO/dm/L2J2c41WsnAKrw26osN84g7kAu+1KulmXnrUHcgWQet+Vm5QziDqTz6bHcPzmDuAPpXC3LZucM4g7k8rns10tnEHcgnb+euvcZxB3I5mZV1h5nxB1IZrcv7xfFh5HiDmSz3JTbB2cQdyAds1VxBxLqZqsLs1VxB9J53JmtijuQkdmquAM5ma2KO5CQ2aq4AzmZrYo7kJPZqrgDCZmtijuQ03LTLZsQdyCb2wezVXEH0tmX7nGm8dmquAMJrZufrYo7kNOnx+7jSHEHyOa64dmquANpfS77VauzVXEHMrtvdbYq7kByN6vuZ4HFHSCV3b77Q4/WPowUdyC/Bmer4g40obXZqrgDTWhttiruQCuamq2KO9CQdmar4g605XrRxGxV3IG2bPZNzFbFHWhOC7NVcQda1M1Wt+IOkMvuy+NM4g8jxR1oVO7ZqrgD7Uo8WxV3oF2JZ6viDjQt62xV3IHWpZytijtAwtmquAMknK2KO0An2WxV3AG+yjRbFXeArzLNVsUd4F9pZqviDvCDHLNVcQf4QY7ZqrgDPJdgtiruAAfUPlsVd4DDqp6tijvAYVXPVsUd4H/VO1sVd4BjKp2tijvAMbt9eV/hbFXcAV6wqnC2Ku4AL6tutiruAC+rbrYq7gAnWe/Kr/U8zog7wKnu6pmtijtAD7XMVsUdoIdaZqviDtDP/VP5I/xsVdwBevsQfrYq7gC9xZ+tijvAOYLPVsUd4EyRZ6viDnCmyLNVcQc4X9jZqrgDXCTmbFXcAS4VcLYq7gCXCjhbFXeAAUSbrYo7wDBCzVbFHWAYoWar4g4wmDizVXEHGFKQ2aq4AwwpyGxV3AEGFmG2Ku4Aw5t9tiruAKOYd7Yq7gCjmHe2Ku4AY5lxtiruACOaa7Yq7gAjmmu2Ku4A45pltiruAKObfrYq7gCjm362Ku4AU5h4tiruABOZcrYq7gDTmWy2Ku4A05lstiruAJOaZrYq7gBTm2C2Ku4AU+tmq4txZ6viDjCD1Xbc2aq4A8xj1NmquAPMY9TZqrgDzGa82aq4A8xppNmquAPM7GqE2aq4A8xsO8JsVdwB5jf4bFXcAUIYdrYq7gAhDDtbFXeAKAacrYo7QCBDzVbFHSCQoWar4g4QSzdbvfjLSHEHCOdufelsVdwBIrpwtiruABFdOFsVd4CgLpmtijtAXGfPVsUdIK6zZ6viDhDaebNVcQeI7vahLHrOVsUdILr9ly8je81WxR2gAn1nq+IOUIdes1VxB6jG6bNVcQeoxumzVXEHqMmJs1VxB6jMKbNVcQeozCmzVXEHqM+Ls1VxB6jS8dmquANU6fhsVdwBanVktiruABW7W5c/1+IOkM718sBsVdwB6nZwtiruANX772xV3AEyeDZbFXeADJ7NVsUdIInVtnxciTtAOr9/m62KO0Ae32er4g6Qyj+zVXEHyOZuLe4AGYk7gLgDIO4AiDsA4g6AuAOIOwDiDoC4AyDuAIg7gLg7AYC4AyDuAIg7AOIOgLgDiDsA4g6AuAMg7gCIO4C4AyDuAIg7AOIOgLgDIO4A4g6AuAMg7gCIOwDiDiDuAIg7AOIOgLgDIO4AiDuAuAMg7gCIOwDiDoC4A4g7AOIOgLgDIO4AiDsA4g4g7gCIOwDiDoC4AyDuAOIOgLgDIO4AiDsA4g6AuAOIOwDiDoC4AyDuAIg7gLgDIO4AiDsA4g6AuAMg7gDiDoC4AxDD3wIMAJ+nRtxsLfxoAAAAAElFTkSuQmCC"; + +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/controller/DevSlideshowController.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/controller/DevSlideshowController.java new file mode 100644 index 00000000..7a554175 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/controller/DevSlideshowController.java @@ -0,0 +1,132 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import vip.xiaonuo.common.annotation.CommonLog; +import vip.xiaonuo.common.pojo.CommonResult; +import vip.xiaonuo.dev.modular.slideshow.entity.DevSlideshow; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowAddParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowEditParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowIdParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowPageParam; +import vip.xiaonuo.dev.modular.slideshow.service.DevSlideshowService; +import jakarta.annotation.Resource; +import javax.validation.Valid; +import jakarta.validation.constraints.NotEmpty; +import java.util.List; + +/** + * 轮播图控制器 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +@Tag(name = "轮播图控制器") +@RestController +@Validated +public class DevSlideshowController { + + @Resource + private DevSlideshowService devSlideshowService; + + /** + * 获取轮播图分页 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + @Operation(summary = "获取轮播图分页") + @GetMapping("/dev/slideshow/page") + public CommonResult> page(DevSlideshowPageParam devSlideshowPageParam) { + return CommonResult.data(devSlideshowService.page(devSlideshowPageParam)); + } + + /** + * 添加轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + @Operation(summary = "添加轮播图") + @CommonLog("添加轮播图") + @PostMapping("/dev/slideshow/add") + public CommonResult add(@RequestBody @Valid DevSlideshowAddParam devSlideshowAddParam) { + devSlideshowService.add(devSlideshowAddParam); + return CommonResult.ok(); + } + + /** + * 编辑轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + @Operation(summary = "编辑轮播图") + @CommonLog("编辑轮播图") + @PostMapping("/dev/slideshow/edit") + public CommonResult edit(@RequestBody @Valid DevSlideshowEditParam devSlideshowEditParam) { + devSlideshowService.edit(devSlideshowEditParam); + return CommonResult.ok(); + } + + /** + * 删除轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + @Operation(summary = "删除轮播图") + @CommonLog("删除轮播图") + @PostMapping("/dev/slideshow/delete") + public CommonResult delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空") + List devSlideshowIdParamList) { + devSlideshowService.delete(devSlideshowIdParamList); + return CommonResult.ok(); + } + + /** + * 禁用轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + @Operation(summary = "禁用轮播图") + @CommonLog("禁用轮播图") + @PostMapping("/dev/slideshow/disableStatus") + public CommonResult disableStatus(@RequestBody @Valid DevSlideshowIdParam devSlideshowIdParam) { + devSlideshowService.disableStatus(devSlideshowIdParam); + return CommonResult.ok(); + } + + /** + * 启用轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + @Operation(summary = "启用轮播图") + @CommonLog("启用轮播图") + @PostMapping("/dev/slideshow/enableStatus") + public CommonResult enableStatus(@RequestBody @Valid DevSlideshowIdParam devSlideshowIdParam) { + devSlideshowService.enableStatus(devSlideshowIdParam); + return CommonResult.ok(); + } +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/entity/DevSlideshow.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/entity/DevSlideshow.java new file mode 100644 index 00000000..fd277799 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/entity/DevSlideshow.java @@ -0,0 +1,68 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import vip.xiaonuo.common.pojo.CommonEntity; + +/** + * 轮播图实体 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +@Setter +@TableName("dev_slideshow") +public class DevSlideshow extends CommonEntity { + + /** 主键 */ + @TableId + @Schema(description = "主键") + private String id; + + /** 租户id */ + @Schema(description = "租户id") + private String tenantId; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 展示位置 */ + @Schema(description = "展示位置") + private String place; + + /** 图片 */ + @Schema(description = "图片") + private String image; + + /** 路径详情 */ + @Schema(description = "路径详情") + private String pathDetails; + + /** 状态 */ + @Schema(description = "状态") + private String status; + + /** 排序 */ + @Schema(description = "排序") + private Integer sortCode; + + /** 扩展信息 */ + @Schema(description = "扩展信息") + private String extJson; +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowEnum.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowEnum.java new file mode 100644 index 00000000..5ffa6ef9 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowEnum.java @@ -0,0 +1,34 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.enums; + +import lombok.Getter; + +/** + * 轮播图枚举 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +public enum DevSlideshowEnum { + + /** 测试 */ + TEST("TEST"); + + private final String value; + + DevSlideshowEnum(String value) { + this.value = value; + } +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowStatusEnum.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowStatusEnum.java new file mode 100644 index 00000000..b066026e --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowStatusEnum.java @@ -0,0 +1,49 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.enums; + +import lombok.Getter; +import vip.xiaonuo.common.exception.CommonException; + +/** + * 轮播图状态枚举 + * + * @author yubaoshan + * @date 2024/07/11 14:46 + */ +@Getter +public enum DevSlideshowStatusEnum { + + /** + * 正常 + */ + ENABLE("ENABLE"), + + /** + * 禁用 + */ + DISABLE("DISABLE"); + + private final String value; + + DevSlideshowStatusEnum(String value) { + this.value = value; + } + + public static void validate(String value) { + boolean flag = ENABLE.getValue().equals(value) || DISABLE.getValue().equals(value); + if(!flag) { + throw new CommonException("不支持的状态:{}", value); + } + } +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/DevSlideshowMapper.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/DevSlideshowMapper.java new file mode 100644 index 00000000..824872da --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/DevSlideshowMapper.java @@ -0,0 +1,25 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import vip.xiaonuo.dev.modular.slideshow.entity.DevSlideshow; + +/** + * 轮播图Mapper接口 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +public interface DevSlideshowMapper extends BaseMapper { +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/mapping/DevSlideshowMapper.xml b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/mapping/DevSlideshowMapper.xml new file mode 100644 index 00000000..1fb7abe7 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/mapping/DevSlideshowMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowAddParam.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowAddParam.java new file mode 100644 index 00000000..82789f6f --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowAddParam.java @@ -0,0 +1,58 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 轮播图添加参数 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +@Setter +public class DevSlideshowAddParam { + + /** 标题 */ + @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "title不能为空") + private String title; + + /** 展示位置 */ + @Schema(description = "展示位置", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "place不能为空") + private String place; + + /** 图片 */ + @Schema(description = "图片") + private String image; + + /** 路径详情 */ + @Schema(description = "路径详情", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "pathDetails不能为空") + private String pathDetails; + + /** 排序 */ + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "sortCode不能为空") + private Integer sortCode; + +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowEditParam.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowEditParam.java new file mode 100644 index 00000000..27dea75b --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowEditParam.java @@ -0,0 +1,63 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 轮播图编辑参数 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +@Setter +public class DevSlideshowEditParam { + + /** 主键 */ + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "id不能为空") + private String id; + + /** 标题 */ + @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "title不能为空") + private String title; + + /** 展示位置 */ + @Schema(description = "展示位置", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "place不能为空") + private String place; + + /** 图片 */ + @Schema(description = "图片") + private String image; + + /** 路径详情 */ + @Schema(description = "路径详情", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "pathDetails不能为空") + private String pathDetails; + + /** 排序 */ + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "sortCode不能为空") + private Integer sortCode; + +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowIdParam.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowIdParam.java new file mode 100644 index 00000000..224a2da7 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowIdParam.java @@ -0,0 +1,35 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import jakarta.validation.constraints.NotBlank; + +/** + * 轮播图Id参数 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +@Setter +public class DevSlideshowIdParam { + + /** 主键 */ + @Schema(description = "主键") + @NotBlank(message = "id不能为空") + private String id; +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowPageParam.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowPageParam.java new file mode 100644 index 00000000..492c7d54 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowPageParam.java @@ -0,0 +1,63 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 轮播图查询参数 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Getter +@Setter +public class DevSlideshowPageParam { + + /** 当前页 */ + @Schema(description = "当前页码") + private Integer current; + + /** 每页条数 */ + @Schema(description = "每页条数") + private Integer size; + + /** 排序字段 */ + @Schema(description = "排序字段,字段驼峰名称,如:userName") + private String sortField; + + /** 排序方式 */ + @Schema(description = "排序方式,升序:ASCEND;降序:DESCEND") + private String sortOrder; + + /** 关键词 */ + @Schema(description = "关键词") + private String searchKey; + + /** 标题 */ + @Schema(description = "标题") + private String title; + + /** 展示位置 */ + @Schema(description = "展示位置") + private String place; + + /** 状态 */ + @Schema(description = "状态") + private String status; + +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/provider/DevSlideshowApiProvider.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/provider/DevSlideshowApiProvider.java new file mode 100644 index 00000000..16f4aa44 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/provider/DevSlideshowApiProvider.java @@ -0,0 +1,39 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.provider; + +import cn.hutool.json.JSONObject; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import vip.xiaonuo.dev.api.DevSlideshowApi; +import vip.xiaonuo.dev.modular.slideshow.service.DevSlideshowService; + +import java.util.List; + +/** + * 轮播图API接口实现类 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ +@Service +public class DevSlideshowApiProvider implements DevSlideshowApi { + + @Resource + private DevSlideshowService devSlideshowService; + + @Override + public List getListByPlace(String place) { + return devSlideshowService.getListByPlace(place); + } +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/DevSlideshowService.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/DevSlideshowService.java new file mode 100644 index 00000000..aed16f16 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/DevSlideshowService.java @@ -0,0 +1,97 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.service; + +import cn.hutool.json.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import vip.xiaonuo.dev.modular.slideshow.entity.DevSlideshow; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowAddParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowEditParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowIdParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowPageParam; + +import java.util.List; + +/** + * 轮播图Service接口 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +public interface DevSlideshowService extends IService { + + /** + * 获取轮播图分页 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + Page page(DevSlideshowPageParam devSlideshowPageParam); + + /** + * 添加轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + void add(DevSlideshowAddParam devSlideshowAddParam); + + /** + * 编辑轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + void edit(DevSlideshowEditParam devSlideshowEditParam); + + /** + * 删除轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + */ + void delete(List devSlideshowIdParamList); + + /** + * 获取轮播图详情 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ + DevSlideshow queryEntity(String id); + + /** + * 禁用轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ + void disableStatus(DevSlideshowIdParam devSlideshowIdParam); + + /** + * 启用轮播图 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ + void enableStatus(DevSlideshowIdParam devSlideshowIdParam); + + /** + * 通过位置获得轮播图列表 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ + List getListByPlace(String place); +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/impl/DevSlideshowServiceImpl.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/impl/DevSlideshowServiceImpl.java new file mode 100644 index 00000000..12f10566 --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/impl/DevSlideshowServiceImpl.java @@ -0,0 +1,162 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.slideshow.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollStreamUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import vip.xiaonuo.common.enums.CommonSortOrderEnum; +import vip.xiaonuo.common.exception.CommonException; +import vip.xiaonuo.common.page.CommonPageRequest; +import vip.xiaonuo.dev.core.conts.DevConstants; +import vip.xiaonuo.dev.modular.slideshow.entity.DevSlideshow; +import vip.xiaonuo.dev.modular.slideshow.enums.DevSlideshowStatusEnum; +import vip.xiaonuo.dev.modular.slideshow.mapper.DevSlideshowMapper; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowAddParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowEditParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowIdParam; +import vip.xiaonuo.dev.modular.slideshow.param.DevSlideshowPageParam; +import vip.xiaonuo.dev.modular.slideshow.service.DevSlideshowService; + +import java.util.List; + +/** + * 轮播图Service接口实现类 + * + * @author yubaoshan + * @date 2024/07/13 00:31 + **/ +@Service +public class DevSlideshowServiceImpl extends ServiceImpl implements DevSlideshowService { + + + @Override + public Page page(DevSlideshowPageParam devSlideshowPageParam) { + QueryWrapper queryWrapper = new QueryWrapper().checkSqlInjection(); + if(ObjectUtil.isNotEmpty(devSlideshowPageParam.getTitle())) { + queryWrapper.lambda().like(DevSlideshow::getTitle, devSlideshowPageParam.getTitle()); + } + if(ObjectUtil.isNotEmpty(devSlideshowPageParam.getPlace())) { + queryWrapper.lambda().like(DevSlideshow::getPlace, devSlideshowPageParam.getPlace()); + } + if(ObjectUtil.isNotEmpty(devSlideshowPageParam.getStatus())) { + queryWrapper.lambda().eq(DevSlideshow::getStatus, devSlideshowPageParam.getStatus()); + } + if(ObjectUtil.isAllNotEmpty(devSlideshowPageParam.getSortField(), devSlideshowPageParam.getSortOrder())) { + CommonSortOrderEnum.validate(devSlideshowPageParam.getSortOrder()); + queryWrapper.orderBy(true, devSlideshowPageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()), + StrUtil.toUnderlineCase(devSlideshowPageParam.getSortField())); + } else { + queryWrapper.lambda().orderByAsc(DevSlideshow::getSortCode); + } + return this.page(CommonPageRequest.defaultPage(), queryWrapper); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void add(DevSlideshowAddParam devSlideshowAddParam) { + DevSlideshow devSlideshow = BeanUtil.toBean(devSlideshowAddParam, DevSlideshow.class); + // 默认禁用的 + devSlideshow.setStatus(DevSlideshowStatusEnum.DISABLE.getValue()); + this.save(devSlideshow); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void edit(DevSlideshowEditParam devSlideshowEditParam) { + DevSlideshow devSlideshow = this.queryEntity(devSlideshowEditParam.getId()); + BeanUtil.copyProperties(devSlideshowEditParam, devSlideshow); + this.updateById(devSlideshow); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void delete(List devSlideshowIdParamList) { + // 执行删除 + this.removeByIds(CollStreamUtil.toList(devSlideshowIdParamList, DevSlideshowIdParam::getId)); + } + + @Override + public DevSlideshow queryEntity(String id) { + DevSlideshow devSlideshow = this.getById(id); + if(ObjectUtil.isEmpty(devSlideshow)) { + throw new CommonException("轮播图不存在,id值为:{}", id); + } + return devSlideshow; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void disableStatus(DevSlideshowIdParam devSlideshowIdParam) { + this.update(new LambdaUpdateWrapper().eq(DevSlideshow::getId, + devSlideshowIdParam.getId()).set(DevSlideshow::getStatus, DevSlideshowStatusEnum.DISABLE.getValue())); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void enableStatus(DevSlideshowIdParam devSlideshowIdParam) { + this.update(new LambdaUpdateWrapper().eq(DevSlideshow::getId, + devSlideshowIdParam.getId()).set(DevSlideshow::getStatus, DevSlideshowStatusEnum.ENABLE.getValue())); + } + + @Override + public List getListByPlace(String place){ + List resultList = CollectionUtil.newArrayList(); + List slideshowList = this.list(new LambdaQueryWrapper().eq(DevSlideshow::getStatus, + DevSlideshowStatusEnum.ENABLE.getValue()).orderByDesc(DevSlideshow::getSortCode)); + if (slideshowList.size() == 0) { + // 如果库里未配置,则补充一条静态的,避免图片为空 + JSONObject staticObj = new JSONObject(); + staticObj.set("id", IdWorker.getIdStr()); + staticObj.set("title", "静态文件"); + staticObj.set("image", DevConstants.STATIC_SLIDESHOW_IMAGE); + staticObj.set("pathDetails", null); + resultList.add(staticObj); + return resultList; + } + slideshowList.forEach((item) -> { + JSONArray slideshowPlaceArray = JSONUtil.parseArray(item.getPlace()); + slideshowPlaceArray.forEach((placeArray) -> { + if (place.equals(placeArray)) { + JSONObject obj = new JSONObject(); + obj.set("id", item.getId()); + obj.set("title", item.getTitle()); + // TODO 判断这个图片是否库里真是存在,不存在则返回base64国定的,不能让前端图片裂开 + obj.set("image", item.getImage()); + JSONArray array = JSONUtil.parseArray(item.getPathDetails()); + array.forEach((detail) -> { + JSONObject detailObj = JSONUtil.parseObj(detail); + if (detailObj.get("key").equals(place)) { + obj.set("pathDetails", detailObj); + } + }); + resultList.add(obj); + } + }); + }); + return resultList; + } +} diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/controller/SysIndexController.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/controller/SysIndexController.java index a399169f..c020405f 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/controller/SysIndexController.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/controller/SysIndexController.java @@ -160,4 +160,40 @@ public class SysIndexController { public SseEmitter createSseConnect(String clientId){ return sysIndexService.createSseConnect(clientId); } + + /** + * 获取基础系统业务数据 + * + * @author xuyuxiang、yubaoshan + * @date 2024/7/18 17:35 + */ + @Operation(summary = "获取基础系统业务数据") + @GetMapping("/sys/index/bizDataCount") + public CommonResult getBizDataCount() { + return CommonResult.data(sysIndexService.getBizDataCount()); + } + + /** + * 获取运维一览数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + @Operation(summary = "获取运维一览数据") + @GetMapping("/sys/index/opDataCount") + public CommonResult getOpDataCount() { + return CommonResult.data(sysIndexService.getOpDataCount()); + } + + /** + * 获取基础工具数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + @Operation(summary = "获取基础工具数据") + @GetMapping("/sys/index/toolDataCount") + public CommonResult getToolDataCount() { + return CommonResult.data(sysIndexService.getToolDataCount()); + } } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysBizDataCountResult.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysBizDataCountResult.java new file mode 100644 index 00000000..e1708db7 --- /dev/null +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysBizDataCountResult.java @@ -0,0 +1,27 @@ +package vip.xiaonuo.sys.modular.index.result; + +import lombok.Getter; +import lombok.Setter; + +/** + * 系统业务数量 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ +@Getter +@Setter +public class SysBizDataCountResult { + + /** 用户数量 */ + private Long userCount; + + /** 角色数量 */ + private Long roleCount; + + /** 机构数量 */ + private Long orgCount; + + /** 职位数量 */ + private Long positionCount; +} diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysOpDataCountResult.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysOpDataCountResult.java new file mode 100644 index 00000000..a081aee7 --- /dev/null +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysOpDataCountResult.java @@ -0,0 +1,33 @@ +package vip.xiaonuo.sys.modular.index.result; + +import lombok.Getter; +import lombok.Setter; + +/** + * 运维一览数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ +@Getter +@Setter +public class SysOpDataCountResult { + + /** 定时任务数量 */ + private Long jobCount; + + /** 系统字典数量 */ + private Long sysDictCount; + + /** 业务字典数量 */ + private Long bizDictCount; + + /** B端用户在线数量 */ + private Long backUserSessionCount; + + /** C端用户在线数量 */ + private Long clientUserSessionCount; + + /** 三方用户数量 */ + private Long thirdUserCount; +} diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysToolDataCountResult.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysToolDataCountResult.java new file mode 100644 index 00000000..39c5843d --- /dev/null +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysToolDataCountResult.java @@ -0,0 +1,27 @@ +package vip.xiaonuo.sys.modular.index.result; + +import lombok.Getter; +import lombok.Setter; + +/** + * 基础工具数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ +@Getter +@Setter +public class SysToolDataCountResult { + + /** 文件数量 */ + private Long fileCount; + + /** 短信数量 */ + private Long smsCount; + + /** 邮件数量 */ + private Long emailCount; + + /** 站内信数量 */ + private Long messageCount; +} diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/SysIndexService.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/SysIndexService.java index 0c42ef95..d82369ae 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/SysIndexService.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/SysIndexService.java @@ -96,5 +96,29 @@ public interface SysIndexService { * @author diantu * @date 2023/7/10 **/ - public SseEmitter createSseConnect(String clientId); + SseEmitter createSseConnect(String clientId); + + /** + * 获取基础系统业务数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + SysBizDataCountResult getBizDataCount(); + + /** + * 获取基础系统业务数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + SysOpDataCountResult getOpDataCount(); + + /** + * 获取基础系统业务数据 + * + * @author yubaoshan + * @date 2024/7/18 17:35 + */ + SysToolDataCountResult getToolDataCount(); } diff --git a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/impl/SysIndexServiceImpl.java b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/impl/SysIndexServiceImpl.java index 4b37ceed..a6ccd1c6 100644 --- a/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/impl/SysIndexServiceImpl.java +++ b/snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/impl/SysIndexServiceImpl.java @@ -13,25 +13,33 @@ package vip.xiaonuo.sys.modular.index.service.impl; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; +import vip.xiaonuo.auth.api.AuthApi; import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser; import vip.xiaonuo.auth.core.util.StpLoginUserUtil; import vip.xiaonuo.common.sse.CommonSseParam; +import vip.xiaonuo.dev.api.DevApi; import vip.xiaonuo.dev.api.DevLogApi; import vip.xiaonuo.dev.api.DevMessageApi; import vip.xiaonuo.dev.api.DevSseApi; import vip.xiaonuo.sys.modular.index.param.*; import vip.xiaonuo.sys.modular.index.result.*; import vip.xiaonuo.sys.modular.index.service.SysIndexService; +import vip.xiaonuo.sys.modular.org.service.SysOrgService; +import vip.xiaonuo.sys.modular.position.service.SysPositionService; import vip.xiaonuo.sys.modular.relation.entity.SysRelation; import vip.xiaonuo.sys.modular.relation.enums.SysRelationCategoryEnum; import vip.xiaonuo.sys.modular.relation.service.SysRelationService; +import vip.xiaonuo.sys.modular.role.service.SysRoleService; +import vip.xiaonuo.sys.modular.user.service.SysUserService; import java.util.List; import java.util.function.Consumer; @@ -58,6 +66,24 @@ public class SysIndexServiceImpl implements SysIndexService { @Resource private DevSseApi devSseApi; + @Resource + private SysUserService sysUserService; + + @Resource + private SysRoleService sysRoleService; + + @Resource + private SysOrgService sysOrgService; + + @Resource + private SysPositionService sysPositionService; + + @Resource + private DevApi devApi; + + @Resource + private AuthApi authApi; + @Override public void addSchedule(SysIndexScheduleAddParam sysIndexScheduleAddParam) { SaBaseLoginUser loginUser = StpLoginUserUtil.getLoginUser(); @@ -127,4 +153,30 @@ public class SysIndexServiceImpl implements SysIndexService { }; return devSseApi.createSseConnect(clientId,true,false,consumer); } + + @Override + public SysBizDataCountResult getBizDataCount() { + SysBizDataCountResult result = new SysBizDataCountResult(); + result.setUserCount(sysUserService.count()); + result.setRoleCount(sysRoleService.count()); + result.setOrgCount(sysOrgService.count()); + result.setPositionCount(sysPositionService.count()); + return result; + } + + @Override + public SysOpDataCountResult getOpDataCount() { + JSONObject devObj = devApi.getDevOpCount(); + SysOpDataCountResult result = BeanUtil.toBean(devObj, SysOpDataCountResult.class); + JSONObject authObj = authApi.getUserSessionCount(); + result.setBackUserSessionCount(authObj.getLong("backUserSessionCount")); + result.setClientUserSessionCount(authObj.getLong("clientUserSessionCount")); + result.setThirdUserCount(authApi.getThirdUserCount()); + return result; + } + + @Override + public SysToolDataCountResult getToolDataCount() { + return BeanUtil.toBean(devApi.getToolDataCount(), SysToolDataCountResult.class); + } } diff --git a/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java b/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java index c8a39450..a937cc61 100644 --- a/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java +++ b/snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java @@ -163,6 +163,9 @@ public class GlobalConfigure implements WebMvcConfigurer { "/sys/module/**", "/sys/role/**", "/sys/user/**", + "/sys/index/bizDataCount", + "/sys/index/opDataCount", + "/sys/index/toolDataCount", "/dev/config/**", "/dev/dict/**", "/dev/email/page", @@ -181,6 +184,7 @@ public class GlobalConfigure implements WebMvcConfigurer { "/dev/sms/page", "/dev/sms/delete", "/dev/sms/detail", + "/dev/slideshow/**", "/gen/basic/**", "/gen/config/**", "/mobile/menu/**",