P2-3: 横切服务桩换 framework 真实现(文件/日志/消息)

保真层原样移植三块横切服务,删除对应桩,bean 名/包名/签名不动:

- 文件 com.dsasp.server.file.*:FileServiceImpl(bean fileService)真实现,
  存储后端经替换类 FTPClientTemplate(保包名/类名/签名,FTP→本地盘,
  根目录 eip4.file.root 配置化默认 ./data/files,resolveSafe 防 ../ 逃逸);
  BASE64Decoder→java.util.Base64、ant zip→java.util.zip、commons-codec→MessageDigest。
- 日志 com.dsasp.server.log.*:SystemLogManagerImpl/DataOperatorLogger/
  DataLogRecorderImpl + 异步调度(DataLogManager/ProcessLogThread/ProcessSysLogThread)
  原样移植,落 SYS_LOG/SYS_DATA_LOG/SYS_DATA_LOGITEM(后者 insert-only 无审计列,§5.1)。
- 消息 com.dsasp.server.mail.*:SystemEmailServiceImpl + SystemEmail/SystemEmailService
  移植;SMTP 配置缺省时降级 no-op + WARN,不阻塞启动(§5.38)。

装配/配置/自举/验证:
- LegacyXmlWiring 等价补齐三处 jdbcTemplate setter + MainApp.destPath 注入(§4.1);
- application.yml 加 eip4.file.root;bootstrap-xservice.sql 自举四张横切表 + LOGLEVEL;
- 删除 StubFileService/StubSystemLogManager/StubDataOperatorLog(StubProjectSwitchService
  属 viewframework 域非本任务范畴,保留);
- 单测 12 + 本地 DB 集成 4,全模块 mvn clean test 绿(含 ArchUnit);8087 启动验证毕已 kill。

报告:platform-auth/P2横切服务实测报告.md;坑入 docs/迁移手册.md §3.1/§3.2/§5.36-5.38。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 14:06:31 +08:00
parent b6de637905
commit 6cc7b3fb61
31 changed files with 2400 additions and 153 deletions

View File

@@ -1,16 +1,21 @@
package com.eip4.platform.app.config;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.dsasp.server.common.util.MainApp;
import com.dsasp.server.common.log.service.DataOperatorLog;
import com.dsasp.server.common.log.service.SystemLogManager;
import com.dsasp.server.core.service.FlowServiceImpl;
import com.dsasp.server.file.service.FileServiceImpl;
import com.dsasp.server.log.service.DataLogRecorderImpl;
import com.dsasp.server.log.service.SystemLogManagerImpl;
import com.dsasp.server.dataDic.service.POJOCRUDServiceImpl;
import com.dsasp.server.dataDic.service.POJOServiceImpl;
import com.dsasp.server.organize.service.AssignmentHandlerImpl;
@@ -41,6 +46,13 @@ public class LegacyXmlWiring implements SmartInitializingSingleton {
private final UserFindServiceImpl userFindService;
private final UserOtpServiceImpl userOtpService;
private final AssignmentHandlerImpl assignmentHandler;
private final FileServiceImpl fileService;
private final SystemLogManagerImpl systemLogManagerImpl;
private final DataLogRecorderImpl dataLogRecorder;
/** 附件本地盘根目录(配置化,默认 ./data/files);注入保真层 MainApp.destPath。 */
@Value("${eip4.file.root:./data/files}")
private String fileRoot;
public LegacyXmlWiring(POJOCRUDServiceImpl pojoCRUDService,
POJOServiceImpl pojoService,
@@ -51,7 +63,10 @@ public class LegacyXmlWiring implements SmartInitializingSingleton {
OrganizationServiceImpl organizationService,
UserFindServiceImpl userFindService,
UserOtpServiceImpl userOtpService,
AssignmentHandlerImpl assignmentHandler) {
AssignmentHandlerImpl assignmentHandler,
FileServiceImpl fileService,
SystemLogManagerImpl systemLogManagerImpl,
DataLogRecorderImpl dataLogRecorder) {
this.pojoCRUDService = pojoCRUDService;
this.pojoService = pojoService;
this.systemLogManager = systemLogManager;
@@ -62,6 +77,9 @@ public class LegacyXmlWiring implements SmartInitializingSingleton {
this.userFindService = userFindService;
this.userOtpService = userOtpService;
this.assignmentHandler = assignmentHandler;
this.fileService = fileService;
this.systemLogManagerImpl = systemLogManagerImpl;
this.dataLogRecorder = dataLogRecorder;
}
@Override
@@ -83,6 +101,18 @@ public class LegacyXmlWiring implements SmartInitializingSingleton {
userOtpService.setJdbcTemplate(jdbcTemplate);
assignmentHandler.setOrganizationService(organizationService);
assignmentHandler.setUserFindService(userFindService);
// P2 横切服务(文件/日志):FileServiceImpl / SystemLogManagerImpl / DataLogRecorderImpl
// 的 jdbcTemplate 在 framework 同为 XML <property> setter 注入(非 @Autowired),
// 这里等价补齐(见 §4.1)。三块真实现接替原 Stub*,bean 名一致(fileService/
// systemLogManager/dataLogRecorder),旧引擎调用方零感知。
fileService.setJdbcTemplate(jdbcTemplate);
systemLogManagerImpl.setJdbcTemplate(jdbcTemplate);
dataLogRecorder.setJdbcTemplate(jdbcTemplate);
// 附件本地盘根目录配置化(eip4.file.root,默认 ./data/files)注入保真层 MainApp。
// 保真层不反向依赖现代层(ArchUnit),故由现代层单向 set,旧 FileServiceImpl 零修改。
MainApp.setDestPath(fileRoot);
}
/** 引擎字段值含 joda DateTime(CREATETIME 等),Boot 3 需显式注册序列化模块。 */

View File

@@ -29,6 +29,10 @@ eip4:
secret: ${EIP4_AUTH_JWT_SECRET:dev-only-eip4-jwt-secret-change-me-in-production-0123456789}
expire-seconds: 28800 # 8h
issuer: eip4-platform
# 附件横切服务(P2):本地盘存储根目录。注入保真层 MainApp.destPath。
# 默认 ./data/files(相对启动工作目录),生产经环境变量 EIP4_FILE_ROOT 覆盖为绝对路径。
file:
root: ${EIP4_FILE_ROOT:./data/files}
logging:
level: