- 重写主设计文档与详细设计文档,移除 FTP 中转方案口径 - 新增 Git 直连架构设计文档,明确单 prod-agent 部署模式 - 将生产侧主同步流程切换为 Git -> PROD 和 PROD -> Git 两条直连链路 - 新增正式调度任务 GitToProdSyncJob 与 ProdToGitSnapshotJob - 移除 commons-net 主依赖并将 FTP 能力退出主运行面 - 清理 application.properties 中 FTP/ACK 相关公共配置 - 收敛 SyncProperties,删除 FTP 远端目录与 ACK 扫描字段 - 精简 schema.sql,移除 sync_ack 表,仅保留 sync_checkpoint 与 sync_task - 将 dev-agent、FTP、ACK 相关旧类降级为退役占位实现 - 调整项目命名与默认配置,统一到 Git 直连架构 - 完成编译验证
46 lines
1.4 KiB
Java
46 lines
1.4 KiB
Java
package com.ftptool.sync.service;
|
|
|
|
import com.ftptool.sync.model.PackageManifest;
|
|
import com.ftptool.sync.model.SyncDirection;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.time.OffsetDateTime;
|
|
import java.util.UUID;
|
|
|
|
@Service
|
|
public class SyncMetadataService {
|
|
|
|
public String newTraceId() {
|
|
return UUID.randomUUID().toString().replace("-", "");
|
|
}
|
|
|
|
public PackageManifest createManifest(
|
|
String traceId,
|
|
SyncDirection direction,
|
|
String sourceEnv,
|
|
String sourceVersion,
|
|
String contentHash
|
|
) {
|
|
PackageManifest manifest = new PackageManifest();
|
|
manifest.setTraceId(traceId);
|
|
manifest.setDirection(direction);
|
|
manifest.setSourceEnv(sourceEnv);
|
|
manifest.setSourceVersion(sourceVersion);
|
|
manifest.setContentHash(contentHash);
|
|
manifest.setCreatedAt(OffsetDateTime.now().toString());
|
|
manifest.setPackageName(buildPackageFileName(direction, sourceVersion, traceId));
|
|
return manifest;
|
|
}
|
|
|
|
public String buildPackageFileName(SyncDirection direction, String sourceVersion, String traceId) {
|
|
return direction.name().toLowerCase() + "-" + sanitize(sourceVersion) + "-" + sanitize(traceId) + ".zip";
|
|
}
|
|
|
|
private String sanitize(String value) {
|
|
if (value == null || value.trim().isEmpty()) {
|
|
return "unknown";
|
|
}
|
|
return value.replaceAll("[^a-zA-Z0-9._-]", "_");
|
|
}
|
|
}
|