diff --git a/backend/pom.xml b/backend/pom.xml
index 3c5e33d..22e36f0 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -12,7 +12,7 @@
platform
1.0
jar
- platform
+ qgc-platform
springboot 项目基础框架4.0.3
21
diff --git a/backend/src/main/java/com/yfd/platform/data/utils/ZipFileUtil.java b/backend/src/main/java/com/yfd/platform/data/utils/ZipFileUtil.java
index 137e293..4d921e9 100644
--- a/backend/src/main/java/com/yfd/platform/data/utils/ZipFileUtil.java
+++ b/backend/src/main/java/com/yfd/platform/data/utils/ZipFileUtil.java
@@ -1,5 +1,7 @@
package com.yfd.platform.data.utils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
@@ -14,11 +16,34 @@ import java.util.Map;
import java.util.UUID;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
+@Component
public class ZipFileUtil {
- public static final String DEFAULT_TEMP_BASE = "D:\\zip_import_temp";
+ private static String tempBaseDir;
+
+ @Value("${app.zip-import.temp-dir:}")
+ public void setTempBaseDir(String tempDir) {
+ if (tempDir != null && !tempDir.trim().isEmpty()) {
+ ZipFileUtil.tempBaseDir = tempDir.trim();
+ }
+ }
+
+ public static String getDefaultTempDir() {
+ if (tempBaseDir != null && !tempBaseDir.isEmpty()) {
+ return tempBaseDir;
+ }
+ String os = System.getProperty("os.name").toLowerCase();
+ if (os.contains("win")) {
+ return "D:\\zip_import_temp";
+ } else {
+ return "/tmp/zip_import_temp";
+ }
+ }
+
+ public static String getTempBase() {
+ return getDefaultTempDir();
+ }
public static class ZipContent {
public String excelFileName;
@@ -42,12 +67,8 @@ public class ZipFileUtil {
}
}
- public static String getDefaultTempDir() {
- return DEFAULT_TEMP_BASE;
- }
-
public static ZipContent extractZipToTemp(MultipartFile file) throws IOException {
- return extractZipToTemp(file, DEFAULT_TEMP_BASE);
+ return extractZipToTemp(file, getDefaultTempDir());
}
public static ZipContent extractZipToTemp(MultipartFile file, String baseTempDir) throws IOException {
diff --git a/backend/src/main/resources/application-dev.yml b/backend/src/main/resources/application-dev.yml
index 37c1cdd..8d16f53 100644
--- a/backend/src/main/resources/application-dev.yml
+++ b/backend/src/main/resources/application-dev.yml
@@ -53,6 +53,9 @@ login:
# 启动自动数据库初始化(仅 dev/server):
app:
+ # ZIP导入临时目录配置
+ zip-import:
+ temp-dir: ${ZIP_IMPORT_TEMP_DIR:D:\zip_import_temp}
init:
enabled: false
schema: classpath:db-init/sql/min-schema.sql
diff --git a/backend/src/main/resources/application-prod.yml b/backend/src/main/resources/application-prod.yml
new file mode 100644
index 0000000..8021243
--- /dev/null
+++ b/backend/src/main/resources/application-prod.yml
@@ -0,0 +1,119 @@
+server:
+ port: 8093
+
+spring:
+ #应用名称
+ application:
+ name: Project-plateform
+ datasource:
+ type: com.alibaba.druid.pool.DruidDataSource
+ druid:
+ master:
+ driverClassName: oracle.jdbc.OracleDriver
+ url: "${DB_MASTER_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}"
+ username: "${DB_MASTER_USERNAME:QGC_REFA}"
+ password: "${DB_MASTER_PASSWORD:Y4M4K1oCkL8U}"
+ slave:
+ driverClassName: oracle.jdbc.OracleDriver
+ url: "${DB_SLAVE_URL:jdbc:oracle:thin:@172.16.21.134:1521/SDLYZ}"
+ username: "${DB_SLAVE_USERNAME:QGC_REFA}"
+ password: "${DB_SLAVE_PASSWORD:Y4M4K1oCkL8U}"
+
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: GMT+8
+ mvc:
+ pathmatch:
+ matching-strategy: ant_path_matcher
+ servlet:
+ multipart:
+ max-file-size: 30MB
+ max-request-size: 100MB
+
+logging:
+ file:
+ name: logs/projectname.log
+ level:
+ com.genersoft.iot: debug
+ com.genersoft.iot.vmp.storager.dao: info
+ com.genersoft.iot.vmp.gb28181: info
+
+# 在线文档: swagger-ui(生产环境建议关闭)
+swagger-ui:
+ enabled: true
+
+mybatis-plus:
+# mapper-locations: classpath*:**/mapper/*Mapper.xml,classpath*:**/mapping/*Mapper.xml
+ global-config:
+ banner: false
+ db-config:
+ id-type: ASSIGN_ID
+ insert-strategy: not_null
+ update-strategy: not_null
+ select-strategy: not_empty
+ table-underline: true
+ logic-delete-value: 1
+ logic-not-delete-value: 0
+ logic-delete-field: isDeleted
+ configuration:
+ map-underscore-to-camel-case: true
+ cache-enabled: false
+ log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
+# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+
+# 登录相关配置
+login:
+ # 登录缓存
+ cache-enable: true
+ # 是否限制单用户登录
+ single-login: false
+ # 验证码
+ login-code:
+ # 验证码类型配置 查看 LoginProperties 类
+ code-type: arithmetic
+
+# 启动自动数据库初始化(仅 dev/server):
+app:
+ # ZIP导入临时目录配置
+ zip-import:
+ temp-dir: ${ZIP_IMPORT_TEMP_DIR:/tmp/zip_import_temp}
+ init:
+ enabled: false
+ schema: classpath:db-init/sql/min-schema.sql
+ # data 文件可选;为避免复杂 dump 解析问题,先不导入
+ # data:
+ marker-table: sys_user
+ marker-version: v1.0.0
+ # 登录图形验证码有效时间/分钟
+ expiration: 2
+ # 验证码高度
+ width: 111
+ # 验证码宽度
+ heigth: 36
+ # 内容长度
+ length: 2
+ # 字体名称,为空则使用默认字体
+ font-name:
+ # 字体大小
+ font-size: 25
+
+# IP 本地解析
+ip:
+ local-parsing: true
+
+
+file-space: #项目文档空间
+ files: D:\demoproject\files\ #单独上传的文件附件
+ system: D:\demoproject\system\ #单独上传的文件
+
+task:
+ pool:
+ # 核心线程池大小
+ core-pool-size: 10
+ # 最大线程数
+ max-pool-size: 30
+ # 活跃时间
+ keep-alive-seconds: 60
+ # 队列容量
+ queue-capacity: 50
diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml
index 8f42778..547f405 100644
--- a/backend/src/main/resources/application.yml
+++ b/backend/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
profiles:
- active: devtw
+ active: prod
jasypt:
encryptor: