Browse Source

【更新】后端加入轮播图、通知公告功能,其次提供业务首页API接口

pull/227/head
俞宝山 4 months ago
parent
commit
84ab8820c8
  1. 40
      snowy-plugin-api/snowy-plugin-auth-api/src/main/java/vip/xiaonuo/auth/api/AuthApi.java
  2. 34
      snowy-plugin-api/snowy-plugin-dev-api/src/main/java/vip/xiaonuo/dev/api/DevSlideshowApi.java
  3. 78
      snowy-plugin/snowy-plugin-auth/src/main/java/vip/xiaonuo/auth/modular/auth/AuthApiProvider.java
  4. 87
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/controller/BizIndexController.java
  5. 32
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeIdParam.java
  6. 32
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexNoticeListParam.java
  7. 32
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/param/BizIndexSlideshowListParam.java
  8. 58
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexNoticeListResult.java
  9. 70
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowDetailResult.java
  10. 44
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/result/BizIndexSlideshowListResult.java
  11. 56
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/BizIndexService.java
  12. 74
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/index/service/impl/BizIndexServiceImpl.java
  13. 153
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/controller/BizNoticeController.java
  14. 80
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/entity/BizNotice.java
  15. 49
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/enums/BizNoticeStatusEnum.java
  16. 25
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/BizNoticeMapper.java
  17. 5
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/mapping/BizNoticeMapper.xml
  18. 66
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeAddParam.java
  19. 71
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeEditParam.java
  20. 34
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticeIdParam.java
  21. 73
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/param/BizNoticePageParam.java
  22. 96
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/BizNoticeService.java
  23. 128
      snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/service/impl/BizNoticeServiceImpl.java
  24. 28
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/core/conts/DevConstants.java
  25. 132
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/controller/DevSlideshowController.java
  26. 68
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/entity/DevSlideshow.java
  27. 34
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowEnum.java
  28. 49
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/enums/DevSlideshowStatusEnum.java
  29. 25
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/DevSlideshowMapper.java
  30. 5
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/mapping/DevSlideshowMapper.xml
  31. 58
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowAddParam.java
  32. 63
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowEditParam.java
  33. 35
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowIdParam.java
  34. 63
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/param/DevSlideshowPageParam.java
  35. 39
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/provider/DevSlideshowApiProvider.java
  36. 97
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/DevSlideshowService.java
  37. 162
      snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/service/impl/DevSlideshowServiceImpl.java
  38. 36
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/controller/SysIndexController.java
  39. 27
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysBizDataCountResult.java
  40. 33
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysOpDataCountResult.java
  41. 27
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/result/SysToolDataCountResult.java
  42. 26
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/SysIndexService.java
  43. 52
      snowy-plugin/snowy-plugin-sys/src/main/java/vip/xiaonuo/sys/modular/index/service/impl/SysIndexServiceImpl.java
  44. 4
      snowy-web-app/src/main/java/vip/xiaonuo/core/config/GlobalConfigure.java

40
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();
}

34
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<JSONObject> getListByPlace(String place);
}

78
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<JSONObject> 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<JSONObject> 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();
}
}

87
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<List<BizIndexSlideshowListResult>> 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<List<BizIndexNoticeListResult>> 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<BizIndexSlideshowDetailResult> noticeDetailById(@Valid BizIndexNoticeIdParam bizIndexNoticeIdParam) {
return CommonResult.data(bizIndexService.noticeDetailById(bizIndexNoticeIdParam));
}
}

32
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;
}

32
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;
}

32
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;
}

58
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;
}

70
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;
}

44
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;
}

56
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<BizIndexSlideshowListResult> slideshowListByPlace(BizIndexSlideshowListParam bizIndexSlideshowListParam);
/**
* 获取通知公告列表
*
* @author yubaoshan
* @date 2024/07/13 00:31
*/
List<BizIndexNoticeListResult> noticeListByLimit(@Valid BizIndexNoticeListParam bizIndexNoticeListParam);
/**
* 获取通知公告详情
*
* @author yubaoshan
* @date 2024/07/13 00:31
*/
BizIndexSlideshowDetailResult noticeDetailById(BizIndexNoticeIdParam bizIndexNoticeIdParam);
}

74
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<BizIndexSlideshowListResult> slideshowListByPlace(BizIndexSlideshowListParam bizIndexSlideshowListParam) {
return devSlideshowApi.getListByPlace(bizIndexSlideshowListParam.getPlace()).stream()
.map(jsonObject -> JSONUtil.toBean(jsonObject, BizIndexSlideshowListResult.class)).collect(Collectors.toList());
}
@Override
public List<BizIndexNoticeListResult> noticeListByLimit(BizIndexNoticeListParam bizIndexNoticeListParam) {
return bizNoticeService.list(new LambdaQueryWrapper<BizNotice>()
.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;
}
}

153
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<BizNotice>> 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<String> 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<String> 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<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
List<BizNoticeIdParam> 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<BizNotice> 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<String> 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<String> enableStatus(@RequestBody @Valid BizNoticeIdParam bizNoticeIdParam) {
bizNoticeService.enableStatus(bizNoticeIdParam);
return CommonResult.ok();
}
}

80
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;
}

49
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);
}
}
}

25
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<BizNotice> {
}

5
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/notice/mapper/mapping/BizNoticeMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="vip.xiaonuo.biz.modular.notice.mapper.BizNoticeMapper">
</mapper>

66
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;
}

71
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;
}

34
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;
}

73
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;
}

96
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<BizNotice> {
/**
* 获取通知公告分页
*
* @author yubaoshan
* @date 2024/07/11 14:46
*/
Page<BizNotice> 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<BizNoticeIdParam> 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);
}

128
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<BizNoticeMapper, BizNotice> implements BizNoticeService {
@Override
public Page<BizNotice> page(BizNoticePageParam bizNoticePageParam) {
QueryWrapper<BizNotice> queryWrapper = new QueryWrapper<BizNotice>().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<BizNoticeIdParam> 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<BizNotice>().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<BizNotice>().eq(BizNotice::getId,
bizNoticeIdParam.getId()).set(BizNotice::getStatus, BizNoticeStatusEnum.ENABLE.getValue()));
}
}

28
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";
}

132
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<DevSlideshow>> 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<String> 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<String> 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<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
List<DevSlideshowIdParam> devSlideshowIdParamList) {
devSlideshowService.delete(devSlideshowIdParamList);
return CommonResult.ok();
}
/**
* 禁用轮播图
*
* @author yubaoshan
* @date 2024/07/13 00:31
*/
@Operation(summary = "禁用轮播图")
@CommonLog("禁用轮播图")
@PostMapping("/dev/slideshow/disableStatus")
public CommonResult<String> 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<String> enableStatus(@RequestBody @Valid DevSlideshowIdParam devSlideshowIdParam) {
devSlideshowService.enableStatus(devSlideshowIdParam);
return CommonResult.ok();
}
}

68
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;
}

34
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;
}
}

49
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);
}
}
}

25
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<DevSlideshow> {
}

5
snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/slideshow/mapper/mapping/DevSlideshowMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="vip.xiaonuo.dev.modular.slideshow.mapper.DevSlideshowMapper">
</mapper>

58
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;
}

63
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;
}

35
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;
}

63
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;
}

39
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<JSONObject> getListByPlace(String place) {
return devSlideshowService.getListByPlace(place);
}
}

97
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<DevSlideshow> {
/**
* 获取轮播图分页
*
* @author yubaoshan
* @date 2024/07/13 00:31
*/
Page<DevSlideshow> 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<DevSlideshowIdParam> 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<JSONObject> getListByPlace(String place);
}

162
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<DevSlideshowMapper, DevSlideshow> implements DevSlideshowService {
@Override
public Page<DevSlideshow> page(DevSlideshowPageParam devSlideshowPageParam) {
QueryWrapper<DevSlideshow> queryWrapper = new QueryWrapper<DevSlideshow>().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<DevSlideshowIdParam> 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<DevSlideshow>().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<DevSlideshow>().eq(DevSlideshow::getId,
devSlideshowIdParam.getId()).set(DevSlideshow::getStatus, DevSlideshowStatusEnum.ENABLE.getValue()));
}
@Override
public List<JSONObject> getListByPlace(String place){
List<JSONObject> resultList = CollectionUtil.newArrayList();
List<DevSlideshow> slideshowList = this.list(new LambdaQueryWrapper<DevSlideshow>().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;
}
}

36
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 xuyuxiangyubaoshan
* @date 2024/7/18 17:35
*/
@Operation(summary = "获取基础系统业务数据")
@GetMapping("/sys/index/bizDataCount")
public CommonResult<SysBizDataCountResult> getBizDataCount() {
return CommonResult.data(sysIndexService.getBizDataCount());
}
/**
* 获取运维一览数据
*
* @author yubaoshan
* @date 2024/7/18 17:35
*/
@Operation(summary = "获取运维一览数据")
@GetMapping("/sys/index/opDataCount")
public CommonResult<SysOpDataCountResult> getOpDataCount() {
return CommonResult.data(sysIndexService.getOpDataCount());
}
/**
* 获取基础工具数据
*
* @author yubaoshan
* @date 2024/7/18 17:35
*/
@Operation(summary = "获取基础工具数据")
@GetMapping("/sys/index/toolDataCount")
public CommonResult<SysToolDataCountResult> getToolDataCount() {
return CommonResult.data(sysIndexService.getToolDataCount());
}
}

27
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;
}

33
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;
}

27
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;
}

26
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();
}

52
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);
}
}

4
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/**",

Loading…
Cancel
Save