Merge remote-tracking branch 'base-version/main' into dev

This commit is contained in:
chenbowen
2025-12-02 17:47:36 +08:00
22 changed files with 662 additions and 407 deletions

View File

@@ -2,6 +2,7 @@ package com.zt.plat.module.template;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 项目的启动类
@@ -9,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author 周迪
*/
@SpringBootApplication
@EnableScheduling
public class TemplateServerApplication {
public static void main(String[] args) {

View File

@@ -0,0 +1,12 @@
package com.zt.plat.module.template.dal.mysql.databus;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.template.dal.dataobject.databus.TemplateDatabusRequestLogDO;
import org.apache.ibatis.annotations.Mapper;
/**
* Databus 请求日志 Mapper。
*/
@Mapper
public interface TemplateDatabusRequestLogMapper extends BaseMapperX<TemplateDatabusRequestLogDO> {
}

View File

@@ -0,0 +1,21 @@
package com.zt.plat.module.template.job.databus;
import com.zt.plat.module.template.service.databus.TemplateDatabusInvokeService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 基于 Spring 的 Databus 调度任务。
*/
@Component
@RequiredArgsConstructor
public class TemplateDatabusScheduler {
private final TemplateDatabusInvokeService invokeService;
@Scheduled(cron = "0 0/10 * * * ?")
public void execute() {
invokeService.invokeAndRecord();
}
}

View File

@@ -0,0 +1,49 @@
CREATE TABLE template_databus_request_log (
ID BIGINT NOT NULL,
REQUEST_ID VARCHAR(64) NOT NULL,
TARGET_URL VARCHAR(512) NOT NULL,
HTTP_METHOD VARCHAR(16) NOT NULL,
QUERY_PARAMS TEXT,
REQUEST_HEADERS TEXT,
REQUEST_BODY TEXT,
ENCRYPTED_REQUEST_BODY TEXT,
SIGNATURE VARCHAR(128),
NONCE VARCHAR(64),
ZT_TIMESTAMP VARCHAR(32),
RESPONSE_STATUS INT,
ENCRYPTED_RESPONSE_BODY TEXT,
RESPONSE_BODY TEXT,
SUCCESS BIT DEFAULT '0' NOT NULL,
ERROR_MESSAGE TEXT,
DURATION_MS BIGINT,
CREATE_TIME DATETIME(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
UPDATE_TIME DATETIME(6) DEFAULT CURRENT_TIMESTAMP NOT NULL,
CREATOR VARCHAR(64),
UPDATER VARCHAR(64),
DELETED BIT DEFAULT '0' NOT NULL,
PRIMARY KEY (ID)
);
COMMENT ON TABLE template_databus_request_log IS 'Databus 请求调度日志表';
COMMENT ON COLUMN template_databus_request_log.ID IS '主键';
COMMENT ON COLUMN template_databus_request_log.REQUEST_ID IS '请求唯一标识';
COMMENT ON COLUMN template_databus_request_log.TARGET_URL IS '目标地址(含 Query';
COMMENT ON COLUMN template_databus_request_log.HTTP_METHOD IS 'HTTP 方法';
COMMENT ON COLUMN template_databus_request_log.QUERY_PARAMS IS 'Query 参数 JSON';
COMMENT ON COLUMN template_databus_request_log.REQUEST_HEADERS IS '请求头 JSON';
COMMENT ON COLUMN template_databus_request_log.REQUEST_BODY IS '原始请求体';
COMMENT ON COLUMN template_databus_request_log.ENCRYPTED_REQUEST_BODY IS '加密请求体';
COMMENT ON COLUMN template_databus_request_log.SIGNATURE IS '签名';
COMMENT ON COLUMN template_databus_request_log.NONCE IS '随机串';
COMMENT ON COLUMN template_databus_request_log.ZT_TIMESTAMP IS '时间戳';
COMMENT ON COLUMN template_databus_request_log.RESPONSE_STATUS IS '响应状态码';
COMMENT ON COLUMN template_databus_request_log.ENCRYPTED_RESPONSE_BODY IS '加密响应体';
COMMENT ON COLUMN template_databus_request_log.RESPONSE_BODY IS '解密后的响应体';
COMMENT ON COLUMN template_databus_request_log.SUCCESS IS '是否成功';
COMMENT ON COLUMN template_databus_request_log.ERROR_MESSAGE IS '错误信息';
COMMENT ON COLUMN template_databus_request_log.DURATION_MS IS '耗时(毫秒)';
COMMENT ON COLUMN template_databus_request_log.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN template_databus_request_log.UPDATE_TIME IS '更新时间';
COMMENT ON COLUMN template_databus_request_log.CREATOR IS '创建人';
COMMENT ON COLUMN template_databus_request_log.UPDATER IS '更新人';
COMMENT ON COLUMN template_databus_request_log.DELETED IS '逻辑删除标记';