diff --git a/pom.xml b/pom.xml
index 1567ab7..f0fd597 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
../dc-parent/pom.xml
- dc-tranlog-server
+ dc-tranlog-service
DC TranLog Server
交易日志服务器 - 处理交易数据、MTC(分钟交易数据)、价格成交量等业务逻辑
@@ -41,7 +41,7 @@
com.afe.dc
- dc-data-feign
+ dc-common-dao
${project.version}
diff --git a/src/main/java/com/afe/dc/tranlog/TranLogServiceApplication.java b/src/main/java/com/afe/dc/tranlog/TranLogServiceApplication.java
index 1d66ded..6dd475c 100644
--- a/src/main/java/com/afe/dc/tranlog/TranLogServiceApplication.java
+++ b/src/main/java/com/afe/dc/tranlog/TranLogServiceApplication.java
@@ -1,9 +1,6 @@
package com.afe.dc.tranlog;
import com.afe.dc.tranlog.service.TranDatabaseService;
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
@@ -14,6 +11,7 @@ import org.springframework.context.annotation.Bean;
/**
* TranLogServer 主应用类
* 对应C++的main函数和CTranLogServer::Initialize
+ * @author ben.yang
*/
@Slf4j
@SpringBootApplication
@@ -29,30 +27,20 @@ public class TranLogServiceApplication {
* 应用启动后初始化
* 对应C++的Initialize方法
*/
- @Bean
- public CommandLineRunner init(TranDatabaseService tranDatabaseService) {
+ @Bean(name = "tranLogInitializer")
+ public CommandLineRunner tranLogInitializer(TranDatabaseService tranDatabaseService) {
return args -> {
- log.info("[TranLogServerApplication] Initializing TranLogServer...");
+ log.info("[TranLogServiceApplication] Initializing TranLogServer...");
// 初始化数据库
if (tranDatabaseService.initialize()) {
- log.info("[TranLogServerApplication] TranDatabase initialized successfully");
+ log.info("[TranLogServiceApplication] TranDatabase initialized successfully");
} else {
- log.error("[TranLogServerApplication] Failed to initialize TranDatabase");
+ log.error("[TranLogServiceApplication] Failed to initialize TranDatabase");
System.exit(1);
}
- log.info("[TranLogServerApplication] TranLogServer started successfully");
+ log.info("[TranLogServiceApplication] TranLogServer started successfully");
};
}
-
- /**
- * MyBatis-Plus 分页插件配置
- */
- @Bean
- public MybatisPlusInterceptor mybatisPlusInterceptor() {
- MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
- interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
- return interceptor;
- }
}
diff --git a/src/main/java/com/afe/dc/tranlog/controller/internal/JobController.java b/src/main/java/com/afe/dc/tranlog/controller/internal/JobController.java
new file mode 100644
index 0000000..791a04d
--- /dev/null
+++ b/src/main/java/com/afe/dc/tranlog/controller/internal/JobController.java
@@ -0,0 +1,63 @@
+package com.afe.dc.tranlog.controller.internal;
+
+import com.afe.dc.common.core.result.Result;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 任务执行控制器
+ * 供 dc-job-service 通过 Feign 调用执行任务
+ *
+ * @author stock-system
+ */
+@Slf4j
+@RestController
+@RequestMapping("/internal/api/v1/job")
+@RequiredArgsConstructor
+public class JobController {
+
+ /**
+ * 执行交易日志同步任务
+ *
+ * @param param 任务参数(JSON格式,可选)
+ * @return 执行结果
+ */
+ @PostMapping("/sync-tranlog")
+ public Result syncTranlog(@RequestParam(value = "param", required = false) String param) {
+ log.info("开始执行交易日志同步任务,参数: {}", param);
+
+ try {
+ // TODO: 实现交易日志同步逻辑
+ // 例如:从外部系统同步交易日志数据
+
+ log.info("交易日志同步任务执行成功");
+ return Result.success("交易日志同步任务执行成功");
+ } catch (Exception e) {
+ log.error("交易日志同步任务执行失败", e);
+ return Result.fail("交易日志同步任务执行失败: " + e.getMessage());
+ }
+ }
+
+ /**
+ * 执行交易日志归档任务
+ *
+ * @param param 任务参数(JSON格式,可选)
+ * @return 执行结果
+ */
+ @PostMapping("/archive")
+ public Result archiveTranlog(@RequestParam(value = "param", required = false) String param) {
+ log.info("开始执行交易日志归档任务,参数: {}", param);
+
+ try {
+ // TODO: 实现交易日志归档逻辑
+ // 例如:将历史交易日志归档到文件系统或对象存储
+
+ log.info("交易日志归档任务执行成功");
+ return Result.success("交易日志归档任务执行成功");
+ } catch (Exception e) {
+ log.error("交易日志归档任务执行失败", e);
+ return Result.fail("交易日志归档任务执行失败: " + e.getMessage());
+ }
+ }
+}