Merge branch 'master' of gitee.com:lab1024/smart-admin into master

Signed-off-by: 大熊 <daxiongren@foxmail.com>
This commit is contained in:
大熊
2024-03-20 07:51:46 +00:00
committed by Gitee
311 changed files with 22477 additions and 71 deletions

View File

@@ -109,6 +109,11 @@ public class AdminInterceptor implements HandlerInterceptor {
return true;
}
// 如果是超级管理员的话,不需要校验权限
if(requestEmployee.getAdministratorFlag()){
return true;
}
SaStrategy.instance.checkMethodAnnotation.accept(method);
} catch (SaTokenException e) {

View File

@@ -44,11 +44,9 @@ public class NoticeVO {
private LocalDateTime publishTime;
@Schema(description = "作者")
@NotBlank(message = "作者不能为空")
private String author;
@Schema(description = "来源")
@NotBlank(message = "标题不能为空")
private String source;
@Schema(description = "文号")

View File

@@ -1,5 +1,6 @@
package net.lab1024.sa.admin.module.system.login.controller;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.extra.servlet.ServletUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
@@ -47,7 +48,10 @@ public class LoginController {
@GetMapping("/login/getLoginInfo")
@Operation(summary = "获取登录结果信息 @author 卓大")
public ResponseDTO<LoginResultVO> getLoginInfo() {
return ResponseDTO.ok(loginService.getLoginResult(AdminRequestUtil.getRequestUser()));
LoginResultVO loginResult = loginService.getLoginResult(AdminRequestUtil.getRequestUser());
String tokenValue = StpUtil.getTokenValue();
loginResult.setToken(tokenValue);
return ResponseDTO.ok(loginResult);
}
@Operation(summary = "退出登陆 @author 卓大")

View File

@@ -25,12 +25,12 @@ public class PageParam {
@Schema(description = "页码(不能为空)", example = "1")
@NotNull(message = "分页参数不能为空")
private Integer pageNum;
private Long pageNum;
@Schema(description = "每页数量(不能为空)", example = "10")
@NotNull(message = "每页数量不能为空")
@Max(value = 200, message = "每页最大为200")
private Integer pageSize;
@Max(value = 500, message = "每页最大为500")
private Long pageSize;
@Schema(description = "是否查询总条数")
protected Boolean searchCount;

View File

@@ -24,7 +24,7 @@ public class ResponseDTO<T> {
public static final int OK_CODE = 0;
public static final String OK_MSG = "success";
public static final String OK_MSG = "操作成功";
@Schema(description = "返回码")
private Integer code;

View File

@@ -9,9 +9,7 @@ import net.lab1024.sa.base.constant.SwaggerTagConst;
import net.lab1024.sa.base.module.support.changelog.domain.form.ChangeLogQueryForm;
import net.lab1024.sa.base.module.support.changelog.domain.vo.ChangeLogVO;
import net.lab1024.sa.base.module.support.changelog.service.ChangeLogService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
@@ -36,4 +34,11 @@ public class ChangeLogController extends SupportBaseController {
public ResponseDTO<PageResult<ChangeLogVO>> queryPage(@RequestBody @Valid ChangeLogQueryForm queryForm) {
return ResponseDTO.ok(changeLogService.queryPage(queryForm));
}
@Operation(summary = "变更内容详情 @author 卓大")
@GetMapping("/changeLog/getDetail/{changeLogId}")
public ResponseDTO<ChangeLogVO> getDetail(@PathVariable Long changeLogId) {
return ResponseDTO.ok(changeLogService.getById(changeLogId));
}
}

View File

@@ -33,7 +33,6 @@ public class ChangeLogService {
/**
* 分页查询
*
*/
public PageResult<ChangeLogVO> queryPage(ChangeLogQueryForm queryForm) {
Page<?> page = SmartPageUtil.convert2PageQuery(queryForm);
@@ -57,7 +56,6 @@ public class ChangeLogService {
/**
* 更新
*
*/
public synchronized ResponseDTO<String> update(ChangeLogUpdateForm updateForm) {
ChangeLogEntity existVersion = changeLogDao.selectByVersion(updateForm.getVersion());
@@ -71,7 +69,6 @@ public class ChangeLogService {
/**
* 批量删除
*
*/
public synchronized ResponseDTO<String> batchDelete(List<Long> idList) {
if (CollectionUtils.isEmpty(idList)) {
@@ -93,4 +90,8 @@ public class ChangeLogService {
changeLogDao.deleteById(changeLogId);
return ResponseDTO.ok();
}
public ChangeLogVO getById(Long changeLogId) {
return SmartBeanUtil.copy(changeLogDao.selectById(changeLogId), ChangeLogVO.class);
}
}

View File

@@ -87,7 +87,7 @@ public class CodeGeneratorController extends SupportBaseController {
ResponseDTO<byte[]> download = codeGeneratorService.download(tableName);
if (download.getOk()) {
SmartResponseUtil.setDownloadFileHeader(response, tableName + "-code.zip", (long) download.getData().length);
SmartResponseUtil.setDownloadFileHeader(response, tableName + "_code.zip", (long) download.getData().length);
response.getOutputStream().write(download.getData());
} else {
SmartResponseUtil.write(response, download);

View File

@@ -55,24 +55,15 @@ public class RepeatSubmitAspect {
if (StringUtils.isEmpty(ticket)) {
return point.proceed();
}
Long timeStamp = this.repeatSubmitTicket.getTicketTimestamp(ticket);
if (timeStamp != null) {
Long lastRequestTime = this.repeatSubmitTicket.getTicketTimestamp(ticket);
if (lastRequestTime != null) {
Method method = ((MethodSignature) point.getSignature()).getMethod();
RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class);
// 说明注解去掉了
if (annotation == null) {
return point.proceed();
}
int interval = Math.min(annotation.value(), RepeatSubmit.MAX_INTERVAL);
if (System.currentTimeMillis() < timeStamp + interval) {
// 续上时间 能在间隔时间内反复提示用户提交频繁
this.repeatSubmitTicket.putTicket(ticket);
if (System.currentTimeMillis() < lastRequestTime + interval) {
// 提交频繁
return ResponseDTO.error(UserErrorCode.REPEAT_SUBMIT);
}
}
Object obj = null;
try {

View File

@@ -9,6 +9,7 @@ import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

View File

@@ -62,25 +62,9 @@ server:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 7
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"
# 文件上传 配置
#file:
# storage:
# mode: local
# local:
# upload-path: /home/smart_admin_v3/upload/ #文件上传目录
# url-prefix:
# cloud:
# region: oss-cn-qingdao
# endpoint: oss-cn-qingdao.aliyuncs.com
# bucket-name: common
# access-key:
# secret-key:
# url-prefix: https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
# private-url-expire-seconds: 3600
# 文件上传 配置
file:
storage:
@@ -108,7 +92,7 @@ springdoc:
knife4j:
enable: true
basic:
enable: true
enable: false
username: api # Basic认证用户名
password: 1024 # Basic认证密码

View File

@@ -62,6 +62,7 @@ server:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 7
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"

View File

@@ -62,6 +62,7 @@ server:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 30
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"

View File

@@ -62,6 +62,7 @@ server:
basedir: ${project.log-directory}/tomcat-logs
accesslog:
enabled: true
max-days: 7
pattern: "%t %{X-Forwarded-For}i %a %r %s (%D ms) %I (%B byte)"