refactor(cutejava): 优化代码结构和配置

- 移除 application-dev.yml 中的冗余空行
- 更新 SystemQuartzJobController 中的方法名
- 修改 CreateSystemDictDetailArgs 中的注解
- 更新 SystemUserMapper 中的方法参数名
- 增加 MultipartConfig 中的文件上传大小限制配置
This commit is contained in:
2025-06-26 12:05:26 +08:00
parent 42053ecb8c
commit 2bd3fea625
5 changed files with 11 additions and 7 deletions
@@ -29,7 +29,6 @@ server:
# GRACEFUL (优雅): 当应用程序以"GRACEFUL"模式关闭时,它不会接受新的请求且会尝试完成所有正在进行的请求和处理,然后才会终止。这种方式适用于那些可能需要一些时间来清理资源或完成正在进行的任务的场景。 # GRACEFUL (优雅): 当应用程序以"GRACEFUL"模式关闭时,它不会接受新的请求且会尝试完成所有正在进行的请求和处理,然后才会终止。这种方式适用于那些可能需要一些时间来清理资源或完成正在进行的任务的场景。
# IMMEDIATE(立即): 当应用程序以"IMMEDIATE"模式关闭时,它会立即终止,而不管当前是否有任何活动任务或请求。这种方式适用于那些可以立即停止而不会造成严重问题的情况。 # IMMEDIATE(立即): 当应用程序以"IMMEDIATE"模式关闭时,它会立即终止,而不管当前是否有任何活动任务或请求。这种方式适用于那些可以立即停止而不会造成严重问题的情况。
shutdown: graceful shutdown: graceful
spring: spring:
application: application:
name: cutejava name: cutejava
@@ -50,7 +49,6 @@ spring:
repositories: repositories:
# 是否启用Redis存储(关闭防止出现 Multiple Spring Data modules found, entering strict repository configuration mode) # 是否启用Redis存储(关闭防止出现 Multiple Spring Data modules found, entering strict repository configuration mode)
enabled: false enabled: false
# 数据源
datasource: datasource:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
@@ -156,7 +154,6 @@ mybatis-plus:
table-underline: true table-underline: true
# 是否控制台 print mybatisplus-plus 的 LOGO # 是否控制台 print mybatisplus-plus 的 LOGO
banner: true banner: true
app: app:
# 密码加密传输,前端公钥加密,后端私钥解密 # 密码加密传输,前端公钥加密,后端私钥解密
rsa: rsa:
@@ -37,7 +37,7 @@ public class SystemQuartzJobController {
@ApiOperation("查询定时任务") @ApiOperation("查询定时任务")
@PostMapping @PostMapping
@PreAuthorize("@el.check('quartzJob:list')") @PreAuthorize("@el.check('quartzJob:list')")
public ResponseEntity<CsResultVo<List<SystemQuartzJobTb>>> queryQuartzJobByArgs(@Validated @RequestBody CsPageArgs<QuerySystemQuartzJobArgs> args) { public ResponseEntity<CsResultVo<List<SystemQuartzJobTb>>> queryQuartzJobByCrud(@Validated @RequestBody CsPageArgs<QuerySystemQuartzJobArgs> args) {
QuerySystemQuartzJobArgs criteria = args.getArgs(); QuerySystemQuartzJobArgs criteria = args.getArgs();
Page<SystemQuartzJobTb> page = new Page<>(criteria.getPage(), criteria.getSize()); Page<SystemQuartzJobTb> page = new Page<>(criteria.getPage(), criteria.getSize());
return new ResponseEntity<>(systemQuartzJobService.queryQuartzJobByArgs(criteria, page), HttpStatus.OK); return new ResponseEntity<>(systemQuartzJobService.queryQuartzJobByArgs(criteria, page), HttpStatus.OK);
@@ -11,7 +11,7 @@ import javax.validation.constraints.NotNull;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class CreateSystemDictDetailArgs extends CsSerializeObject { public class CreateSystemDictDetailArgs extends CsSerializeObject {
@NotBlank(message = "参数dict必填") @NotNull(message = "参数dict必填")
private SystemDictTb dict; private SystemDictTb dict;
@NotBlank(message = "字典标签必填") @NotBlank(message = "字典标签必填")
private String label; private String label;
@@ -39,5 +39,5 @@ public interface SystemUserMapper extends BaseMapper<SystemUserTb> {
void updateUserEmailByUsername(@Param("username") String username, @Param("email") String email); void updateUserEmailByUsername(@Param("username") String username, @Param("email") String email);
void batchUpdatePassword(@Param("pwd") String password, @Param("userIds") Set<Long> userIds); void batchUpdatePassword(@Param("password") String password, @Param("userIds") Set<Long> userIds);
} }
@@ -1,10 +1,13 @@
package cn.odboy.core.framework.server.config; package cn.odboy.core.framework.server.config;
import cn.odboy.core.framework.server.core.FileUploadPathHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.MultipartConfigFactory; import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;
import javax.servlet.MultipartConfigElement; import javax.servlet.MultipartConfigElement;
import java.io.File; import java.io.File;
@@ -15,6 +18,8 @@ import java.io.File;
public class MultipartConfig { public class MultipartConfig {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String name; private String name;
@Autowired
private FileUploadPathHelper fileUploadPathHelper;
/** /**
* 文件上传临时路径 * 文件上传临时路径
@@ -22,6 +27,8 @@ public class MultipartConfig {
@Bean @Bean
public MultipartConfigElement multipartConfigElement() { public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory(); MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize(DataSize.ofMegabytes(fileUploadPathHelper.getFileMaxSize()));
factory.setMaxRequestSize(DataSize.ofMegabytes(fileUploadPathHelper.getAvatarMaxSize()));
String location = System.getProperty("user.home") + "/" + name + "/tmp"; String location = System.getProperty("user.home") + "/" + name + "/tmp";
File tmpFile = new File(location); File tmpFile = new File(location);
if (!tmpFile.exists()) { if (!tmpFile.exists()) {