refactor(constant): 将应用名称和标题常量统一管理
This commit is contained in:
+3
-5
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
package cn.odboy.system.framework.storage.local;
|
||||
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import java.io.File;
|
||||
import jakarta.servlet.MultipartConfigElement;
|
||||
import java.io.File;
|
||||
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;
|
||||
@@ -31,8 +31,6 @@ import org.springframework.util.unit.DataSize;
|
||||
@Configuration
|
||||
public class MultipartConfig {
|
||||
|
||||
@Value("${spring.application.name}")
|
||||
private String name;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
|
||||
@@ -44,7 +42,7 @@ public class MultipartConfig {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
factory.setMaxFileSize(DataSize.ofMegabytes(properties.getOss().getMaxSize()));
|
||||
factory.setMaxRequestSize(DataSize.ofMegabytes(properties.getOss().getMaxSize()));
|
||||
String location = System.getProperty("user.home") + "/" + name + "/tmp";
|
||||
String location = System.getProperty("user.home") + "/" + SystemConst.CURRENT_APP_NAME + "/tmp";
|
||||
File tmpFile = new File(location);
|
||||
if (!tmpFile.exists()) {
|
||||
if (!tmpFile.mkdirs()) {
|
||||
|
||||
+2
-4
@@ -19,6 +19,7 @@ import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.extra.mail.Mail;
|
||||
import cn.hutool.extra.mail.MailAccount;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.properties.AppProperties;
|
||||
import cn.odboy.framework.redis.KitRedisHelper;
|
||||
@@ -32,7 +33,6 @@ import cn.odboy.util.KitResourceTemplateUtil;
|
||||
import java.util.Collections;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -46,8 +46,6 @@ public class SystemEmailService {
|
||||
private KitRedisHelper redisHelper;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
@Value("${spring.application.title}")
|
||||
private String applicationTitle;
|
||||
|
||||
/**
|
||||
* 更新邮件配置
|
||||
@@ -146,7 +144,7 @@ public class SystemEmailService {
|
||||
KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode));
|
||||
}
|
||||
SystemSendEmailArgs sendEmailRequest =
|
||||
new SystemSendEmailArgs(Collections.singletonList(email), applicationTitle, content);
|
||||
new SystemSendEmailArgs(Collections.singletonList(email), SystemConst.CURRENT_APP_TITLE, content);
|
||||
sendEmail(sendEmailRequest);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user