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