Merge remote-tracking branch 'refs/remotes/ztcloud/test' into dev
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -204,7 +204,7 @@
|
||||
<repository>
|
||||
<id>ZT</id>
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||
<url>http://172.16.46.63:30708/repository/zt-cloud/</url>
|
||||
<releases>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>warn</checksumPolicy>
|
||||
@@ -222,11 +222,11 @@
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||
</repository>
|
||||
<!-- <snapshotRepository>-->
|
||||
<!-- <id>ZT</id>-->
|
||||
<!-- <name>中铜 ZStack 私服</name>-->
|
||||
<!-- <url>https://your-nexus.example.com/repository/maven-snapshots/</url>-->
|
||||
<!-- </snapshotRepository>-->
|
||||
<snapshotRepository>
|
||||
<id>ZT-snap</id>
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test-snap/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
-- 为 API 客户端凭证表添加"是否启用加密"字段
|
||||
-- 2026-01-14
|
||||
|
||||
ALTER TABLE databus_api_client_credential
|
||||
ADD enable_encryption BIT DEFAULT '1' NOT NULL;
|
||||
|
||||
COMMENT ON COLUMN databus_api_client_credential.enable_encryption IS '是否启用加密传输';
|
||||
@@ -339,7 +339,8 @@ CREATE TABLE infra_file (
|
||||
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
updater varchar(64) DEFAULT '' NULL,
|
||||
update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
deleted bit DEFAULT '0' NOT NULL
|
||||
deleted bit DEFAULT '0' NOT NULL,
|
||||
DOWNLOAD_COUNT INT DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
COMMENT ON COLUMN infra_file.id IS '文件编号';
|
||||
@@ -356,6 +357,7 @@ COMMENT ON COLUMN infra_file.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN infra_file.updater IS '更新者';
|
||||
COMMENT ON COLUMN infra_file.update_time IS '更新时间';
|
||||
COMMENT ON COLUMN infra_file.deleted IS '是否删除';
|
||||
COMMENT ON COLUMN INFRA_FILE.DOWNLOAD_COUNT IS '下载次数';
|
||||
COMMENT ON TABLE infra_file IS '文件表';
|
||||
|
||||
CREATE INDEX idx_infra_file_hash ON infra_file(hash);
|
||||
|
||||
5
sql/dm/添加文件下载次数统计字段.sql
Normal file
5
sql/dm/添加文件下载次数统计字段.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
-- 添加文件下载次数统计字段
|
||||
ALTER TABLE JYGK_TEST.INFRA_FILE
|
||||
ADD DOWNLOAD_COUNT INT DEFAULT 0 NOT NULL;
|
||||
|
||||
COMMENT ON COLUMN JYGK_TEST.INFRA_FILE.DOWNLOAD_COUNT IS '下载次数';
|
||||
@@ -10,11 +10,11 @@
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||
</repository>
|
||||
<!-- <snapshotRepository>-->
|
||||
<!-- <id>ZT</id>-->
|
||||
<!-- <name>中铜 ZStack 私服</name>-->
|
||||
<!-- <url>https://your-nexus.example.com/repository/maven-snapshots/</url>-->
|
||||
<!-- </snapshotRepository>-->
|
||||
<snapshotRepository>
|
||||
<id>ZT-snap</id>
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test-snap/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-dependencies</artifactId>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<module>zt-spring-boot-starter-job</module>
|
||||
<module>zt-spring-boot-starter-mq</module>
|
||||
<module>zt-spring-boot-starter-rpc</module>
|
||||
|
||||
<module>zt-spring-boot-starter-seata-dm</module>
|
||||
<module>zt-spring-boot-starter-excel</module>
|
||||
<module>zt-spring-boot-starter-test</module>
|
||||
|
||||
|
||||
19
zt-module-databus/zt-module-databus-server-app/Dockerfile
Normal file
19
zt-module-databus/zt-module-databus-server-app/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
||||
|
||||
FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
|
||||
## 创建目录,并使用它作为工作目录
|
||||
RUN mkdir -p /zt-module-databus-server-app
|
||||
WORKDIR /zt-module-databus-server-app
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ./target/zt-module-databus-server-app.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx1024m"
|
||||
|
||||
## 暴露后端项目的 48080 端口
|
||||
EXPOSE 48082
|
||||
|
||||
## 启动后端项目
|
||||
CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
|
||||
@@ -42,6 +42,9 @@ public class ApiClientCredentialRespVO {
|
||||
@Schema(description = "匿名访问固定用户昵称", example = "张三")
|
||||
private String anonymousUserNickname;
|
||||
|
||||
@Schema(description = "是否启用加密", example = "true")
|
||||
private Boolean enableEncryption;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@@ -45,4 +45,8 @@ public class ApiClientCredentialSaveReqVO {
|
||||
@Schema(description = "匿名访问固定用户 ID", example = "1024")
|
||||
private Long anonymousUserId;
|
||||
|
||||
@Schema(description = "是否启用加密", example = "true")
|
||||
@NotNull(message = "启用加密标识不能为空")
|
||||
private Boolean enableEncryption;
|
||||
|
||||
}
|
||||
|
||||
@@ -38,4 +38,6 @@ public class ApiClientCredentialDO extends BaseDO {
|
||||
|
||||
private Long anonymousUserId;
|
||||
|
||||
private Boolean enableEncryption;
|
||||
|
||||
}
|
||||
|
||||
@@ -238,6 +238,11 @@ public class GatewaySecurityFilter extends OncePerRequestFilter {
|
||||
private byte[] decryptRequestBody(byte[] originalBody,
|
||||
ApiClientCredentialDO credential,
|
||||
ApiGatewayProperties.Security security) {
|
||||
// 检查是否启用加密,如果未启用则直接返回原文
|
||||
if (credential != null && Boolean.FALSE.equals(credential.getEnableEncryption())) {
|
||||
return originalBody != null ? originalBody : new byte[0];
|
||||
}
|
||||
|
||||
if (originalBody == null || originalBody.length == 0) {
|
||||
return new byte[0];
|
||||
}
|
||||
@@ -390,6 +395,11 @@ public class GatewaySecurityFilter extends OncePerRequestFilter {
|
||||
private void encryptResponse(ContentCachingResponseWrapper responseWrapper,
|
||||
ApiClientCredentialDO credential,
|
||||
ApiGatewayProperties.Security security) throws IOException {
|
||||
// 检查是否启用加密,如果未启用则直接返回,不加密响应
|
||||
if (credential != null && Boolean.FALSE.equals(credential.getEnableEncryption())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!security.isEncryptResponse()) {
|
||||
return;
|
||||
}
|
||||
@@ -524,6 +534,10 @@ public class GatewaySecurityFilter extends OncePerRequestFilter {
|
||||
if (security == null || credential == null) {
|
||||
return false;
|
||||
}
|
||||
// 检查是否启用加密,如果未启用则不加密错误响应
|
||||
if (Boolean.FALSE.equals(credential.getEnableEncryption())) {
|
||||
return false;
|
||||
}
|
||||
if (!security.isEncryptResponse()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -34,4 +34,7 @@ public class FileRespDTO {
|
||||
@Schema(description = "文件内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private byte[] content;
|
||||
|
||||
@Schema(description = "文件下载次数")
|
||||
private Integer downloadCount;
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
RUN mkdir -p /zt-module-infra-server-app
|
||||
WORKDIR /zt-module-infra-server-app
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ../zt-module-infra-server/target/zt-module-infra-server-app.jar app.jar
|
||||
COPY ./target/zt-module-infra-server-app.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
|
||||
@@ -133,6 +133,10 @@ public class FileController {
|
||||
response.setStatus(HttpStatus.NOT_FOUND.value());
|
||||
return;
|
||||
}
|
||||
|
||||
// 统计下载次数
|
||||
fileService.incDownloadCount(configId,path);
|
||||
|
||||
writeAttachment(response, path, content);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,4 +99,7 @@ public class FileRespVO {
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "下载次数")
|
||||
private Integer downloadCount;
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,11 @@ public class FileDO extends BaseDO {
|
||||
*/
|
||||
private String aesIv;
|
||||
|
||||
/**
|
||||
* 文件下载次数统计
|
||||
*/
|
||||
private Integer downloadCount;
|
||||
|
||||
/**
|
||||
* 是否加密
|
||||
* <p>
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||
import com.zt.plat.module.infra.dal.dataobject.file.FileDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* 文件操作 Mapper
|
||||
@@ -32,4 +34,7 @@ public interface FileMapper extends BaseMapperX<FileDO> {
|
||||
return selectFirstOne(FileDO::getHash, hash);
|
||||
}
|
||||
|
||||
|
||||
@Update("UPDATE INFRA_FILE SET DOWNLOAD_COUNT = DOWNLOAD_COUNT + 1 WHERE CONFIG_ID = #{configId} AND PATH = #{path}")
|
||||
int incDownloadCount(@Param("configId") Long configId, @Param("path") String path);
|
||||
}
|
||||
|
||||
@@ -112,4 +112,11 @@ public interface FileService {
|
||||
FileDO getActiveFileById(Long fileId);
|
||||
|
||||
boolean verifyCode(Long fileId, Long userId, String code) throws Exception;
|
||||
|
||||
/**
|
||||
* 更新文件下载次数
|
||||
* @param configId
|
||||
* @param path
|
||||
*/
|
||||
void incDownloadCount(Long configId, String path);
|
||||
}
|
||||
|
||||
@@ -334,4 +334,9 @@ public class FileServiceImpl implements FileService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incDownloadCount(Long configId, String path) {
|
||||
fileMapper.incDownloadCount(configId, path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
RUN mkdir -p /zt-module-report-server-app
|
||||
WORKDIR /zt-module-report-server-app
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ../zt-module-report-server/target/zt-module-report-server-app.jar app.jar
|
||||
COPY ./target/zt-module-report-server-app.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
|
||||
@@ -6,7 +6,7 @@ FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
RUN mkdir -p /zt-module-system-server-app
|
||||
WORKDIR /zt-module-system-server-app
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ../zt-module-system-server/target/zt-module-system-server-app.jar app.jar
|
||||
COPY ./target/zt-module-system-server-app.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
|
||||
@@ -6,7 +6,7 @@ FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
RUN mkdir -p /zt-module-template-server-app
|
||||
WORKDIR /zt-module-template-server-app
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ../zt-module-template-server/target/zt-module-template-server-app.jar app.jar
|
||||
COPY ./target/zt-module-template-server-app.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
|
||||
Reference in New Issue
Block a user