Skip to content

Commit

Permalink
bump: 发布2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
uncarbon97 authored Apr 6, 2024
1 parent b763a19 commit 1f6f7c2
Show file tree
Hide file tree
Showing 99 changed files with 678 additions and 810 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# helio-boot-modular

## 项目介绍
基于 Spring Boot 2.7.x,是一款预置SaaS、RBAC能力的单体项目脚手架,适合初学者学习 JavaWeb 开发的良好实践
基于 Spring Boot 3.x,是一款预置SaaS、RBAC能力的单体项目脚手架,适合初学者学习 JavaWeb 开发的良好实践
按职责拆分为多Maven模块,依然是大单体,但命名及用途对标`helio-cloud`;适合多人协作、但不打算使用微服务架构的团队
单模块版请移步至[helio-boot](https://github.com/uncarbon97/helio-boot)项目

JDK compatibility: 1.8 - 21
JDK compatibility: 17 - 21

[前端演示站](https://helio-demo.uncarbon.cc/)
[官方文档](https://helio.uncarbon.cc/)
Expand Down
8 changes: 4 additions & 4 deletions api/admin-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
<parent>
<groupId>cc.uncarbon.module</groupId>
<artifactId>helio-boot-modular</artifactId>
<version>1.11.0</version>
<version>2.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>admin-api</artifactId>
<version>1.11.0</version>
<version>2.0.0</version>

<properties>
<!-- 引入其他服务模块 -->
<!-- 后台管理服务 -->
<sys.version>1.11.0</sys.version>
<sys.version>2.0.0</sys.version>
<!-- 对象存储服务 -->
<oss.version>1.11.0</oss.version>
<oss.version>2.0.0</oss.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ public class SysLogAspectExtensionForSysUserLogin extends DefaultSysLogAspectExt
@Override
public void beforeSaving(AdminInsertSysLogDTO insertSysLogDTO, JoinPoint joinPoint, SysLog annotation, Throwable e, Object ret) {
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof SysUserLoginDTO) {
SysUserLoginDTO argDTO = (SysUserLoginDTO) arg;
insertSysLogDTO.setUsername(argDTO.getUsername());
if (arg instanceof SysUserLoginDTO dto) {
insertSysLogDTO.setUsername(dto.getUsername());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public enum AdminApiErrorEnum implements HelioBaseEnum<Integer> {

CAPTCHA_VALIDATE_FAILED(400, "验证码不正确,请重新输入"),

;
/**
* 很少遇到;但是如果出现了只会提示默认的「请稍后再试」,不方便排查,还是整个文案比较好
*/
UPLOAD_FILE_NOT_EXIST(400, "欲上传的文件可能已被删除,请重新选择");

private final Integer value;
private final String label;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cc.uncarbon.module.adminapi.model.response;

import cc.uncarbon.module.adminapi.model.interior.AdminCaptchaContainer;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;

import java.time.LocalDateTime;
Expand All @@ -12,13 +12,13 @@
@Getter
public class AdminCaptchaVO {

@ApiModelProperty(value = "验证码图片Base64")
@Schema(description = "验证码图片Base64")
private final String captchaImage;

@ApiModelProperty(value = "验证码唯一标识")
@Schema(description = "验证码唯一标识")
private final String captchaId;

@ApiModelProperty(value = "验证码失效时刻")
@Schema(description = "验证码失效时刻")
private final LocalDateTime expiredAt;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cc.uncarbon.framework.core.enums.HelioBaseEnum;
import cn.hutool.core.collection.CollUtil;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
Expand All @@ -16,7 +16,6 @@
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
Expand All @@ -30,17 +29,17 @@ public class SelectOptionItemVO implements Serializable {
private static final long serialVersionUID = 1L;

// ID👉名称 一对(用于关联各种实体)
@ApiModelProperty(value = "ID")
@Schema(description = "ID")
private Number id;
@ApiModelProperty(value = "名称")
@Schema(description = "名称")
private String name;
public SelectOptionItemVO(Number id, String name) {
this.id = id;
this.name = name;
}

// 有时候额外需要上级ID
@ApiModelProperty(value = "上级ID")
@Schema(description = "上级ID")
@Setter
private Number parentId;
public SelectOptionItemVO(Number id, String name, Number parentId) {
Expand All @@ -51,9 +50,9 @@ public SelectOptionItemVO(Number id, String name, Number parentId) {


// 值👉标签 一对(仅用于枚举)
@ApiModelProperty(value = "值")
@Schema(description = "值")
private Number value;
@ApiModelProperty(value = "标签")
@Schema(description = "标签")
private String label;
public SelectOptionItemVO(HelioBaseEnum<? extends Number> helioBaseEnum) {
this.value = helioBaseEnum.getValue();
Expand Down Expand Up @@ -136,7 +135,7 @@ public static <T> List<SelectOptionItemVO> listOf(
return stream.map(item ->
new SelectOptionItemVO(idGetter.apply(item), nameGetter.apply(item),
parentIdGetter == null ? null : parentIdGetter.apply(item)))
.collect(Collectors.toList());
.toList();
}

/**
Expand Down Expand Up @@ -165,6 +164,6 @@ public static <E extends Enum<?> & HelioBaseEnum<? extends Number>> List<SelectO
if (enumConstantFilter != null) {
stream = stream.filter(enumConstantFilter);
}
return stream.map(SelectOptionItemVO::new).collect(Collectors.toList());
return stream.map(SelectOptionItemVO::new).toList();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cc.uncarbon.module.adminapi.web.auth;


import cc.uncarbon.framework.core.constant.HelioConstant;
import cc.uncarbon.framework.core.context.TenantContext;
import cc.uncarbon.framework.core.context.TenantContextHolder;
import cc.uncarbon.framework.core.context.UserContext;
Expand All @@ -15,27 +14,21 @@
import cc.uncarbon.module.adminapi.model.response.AdminCaptchaVO;
import cc.uncarbon.module.adminapi.util.AdminStpUtil;
import cc.uncarbon.module.sys.annotation.SysLog;
import cc.uncarbon.module.sys.constant.SysConstant;
import cc.uncarbon.module.sys.model.request.SysUserLoginDTO;
import cc.uncarbon.module.sys.model.response.SysUserLoginBO;
import cc.uncarbon.module.sys.model.response.SysUserLoginVO;
import cc.uncarbon.module.sys.service.SysUserService;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


@Api(value = "后台管理-鉴权接口", tags = {"后台管理-鉴权接口"})
@RequestMapping(value = {
// 兼容旧的API路由前缀
SysConstant.SYS_MODULE_CONTEXT_PATH + HelioConstant.Version.HTTP_API_VERSION_V1,
AdminApiConstant.HTTP_API_URL_PREFIX + "/api/v1"
})
@Tag(name = "后台管理-鉴权接口")
@RequestMapping(value = AdminApiConstant.HTTP_API_URL_PREFIX + "/api/v1")
@RequiredArgsConstructor
@RestController
@Slf4j
Expand All @@ -49,7 +42,7 @@ public class AdminAuthController {


@SysLog(value = "登录后台用户", syncSave = true, extension = SysLogAspectExtensionForSysUserLogin.class, queryIPLocation = true)
@ApiOperation(value = "登录")
@Operation(summary = "登录")
@PostMapping(value = "/auth/login")
public ApiResult<SysUserLoginVO> login(@RequestBody @Valid SysUserLoginDTO dto) {
// 登录验证码核验;前端项目搜索关键词「 Helio: 登录验证码」
Expand Down Expand Up @@ -89,7 +82,7 @@ public ApiResult<SysUserLoginVO> login(@RequestBody @Valid SysUserLoginDTO dto)
}

@SaCheckLogin(type = AdminStpUtil.TYPE)
@ApiOperation(value = "登出")
@Operation(summary = "登出")
@PostMapping(value = "/auth/logout")
public ApiResult<Void> logout() {
AdminStpUtil.logout();
Expand All @@ -99,7 +92,7 @@ public ApiResult<Void> logout() {
return ApiResult.success();
}

@ApiOperation(value = "获取验证码")
@Operation(summary = "获取验证码")
@GetMapping(value = "/auth/captcha")
public ApiResult<AdminCaptchaVO> captcha() {
// 核验方法:captchaHelper.validate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import cc.uncarbon.module.sys.service.SysDeptService;
import cc.uncarbon.module.sys.service.SysRoleService;
import cn.dev33.satoken.annotation.SaCheckLogin;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -21,7 +21,7 @@

// 约束:登录后才能使用 👇 后台管理对应的鉴权工具类
@SaCheckLogin(type = AdminStpUtil.TYPE)
@Api(value = "后台管理-下拉框数据源接口", tags = {"后台管理-下拉框数据源接口"})
@Tag(name = "后台管理-下拉框数据源接口")
@RequestMapping(AdminApiConstant.HTTP_API_URL_PREFIX + "/api/v1")
@RequiredArgsConstructor
@RestController
Expand All @@ -37,15 +37,15 @@ public class AdminSelectOptionsController {
避免多人协作时,不知道原来是否已经有了,或者写在某个边边角角里,造成重复开发
*/

@ApiOperation(value = "后台角色下拉框")
@Operation(summary = "后台角色下拉框")
@GetMapping(value = "/select-options/roles")
public ApiResult<List<SelectOptionItemVO>> roles() {
return ApiResult.data(
SelectOptionItemVO.listOf(sysRoleService.adminSelectOptions(), SysRoleBO::getId, SysRoleBO::getTitle)
);
}

@ApiOperation(value = "部门下拉框(前端负责转为树状数据)")
@Operation(summary = "部门下拉框(前端负责转为树状数据)")
@GetMapping(value = "/select-options/depts")
public ApiResult<List<SelectOptionItemVO>> depts() {
return ApiResult.data(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,23 @@
import cc.uncarbon.framework.web.model.request.IdsDTO;
import cc.uncarbon.framework.web.model.response.ApiResult;
import cc.uncarbon.module.adminapi.constant.AdminApiConstant;
import cc.uncarbon.module.adminapi.util.AdminStpUtil;
import cc.uncarbon.module.oss.model.request.AdminListOssFileInfoDTO;
import cc.uncarbon.module.oss.model.response.OssFileInfoBO;
import cc.uncarbon.module.oss.service.OssFileInfoService;
import cc.uncarbon.module.sys.constant.SysConstant;
import cc.uncarbon.module.adminapi.util.AdminStpUtil;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


@SaCheckLogin(type = AdminStpUtil.TYPE)
@Api(value = "后台管理-上传文件信息管理接口", tags = {"后台管理-上传文件信息管理接口"})
@RequestMapping(value = {
// 兼容旧的API路由前缀
SysConstant.SYS_MODULE_CONTEXT_PATH + HelioConstant.Version.HTTP_API_VERSION_V1,
AdminApiConstant.HTTP_API_URL_PREFIX + "/api/v1"
})
@Tag(name = "后台管理-上传文件信息管理接口")
@RequestMapping(value = AdminApiConstant.HTTP_API_URL_PREFIX + "/api/v1")
@RequiredArgsConstructor
@RestController
@Slf4j
Expand All @@ -41,21 +35,21 @@ public class AdminOssFileInfoController {


@SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.RETRIEVE)
@ApiOperation(value = "分页列表")
@Operation(summary = "分页列表")
@GetMapping(value = "/oss/file/infos")
public ApiResult<PageResult<OssFileInfoBO>> list(PageParam pageParam, AdminListOssFileInfoDTO dto) {
return ApiResult.data(ossFileInfoService.adminList(pageParam, dto));
}

@SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.RETRIEVE)
@ApiOperation(value = "详情")
@Operation(summary = "详情")
@GetMapping(value = "/oss/file/infos/{id}")
public ApiResult<OssFileInfoBO> getById(@PathVariable Long id) {
return ApiResult.data(ossFileInfoService.getOneById(id, true));
}

@SaCheckPermission(type = AdminStpUtil.TYPE, value = PERMISSION_PREFIX + HelioConstant.Permission.DELETE)
@ApiOperation(value = "删除")
@Operation(summary = "删除")
@DeleteMapping(value = "/oss/file/infos")
public ApiResult<Void> delete(@RequestBody @Valid IdsDTO<Long> dto) {
ossFileInfoService.adminDelete(dto.getIds());
Expand Down
Loading

0 comments on commit 1f6f7c2

Please sign in to comment.