Files
crawler-plugin/backend-java/src/main/java/com/nanri/aiimage/config/EvidenceProperties.java
T
huangzd1997 6fe5c8c8d0 feat(phase-3,4): 证据件服务端落点与两前端大档分片接线
- 后端新增 evidence 模块(V182 证据表/独立桶/超管读取面/内部登记)与
  application.yml evidence 块;管理员四端点逐个 requireSuperAdmin。
- 分片通道补 @Scheduled 回收与 LocalTempCleanupService 的 chunk-uploads 覆盖;
  版本/教程 confirm 接受 file_key,把拼装件搬进 client 桶后落库。
- 用户端 9MB 视频改走 uploadTempFileToJava 分片;后管版本/教程 >8MB 走分片,
  小文件仍走原 presign 直传。
- 激活 Phase 3/4 后端与两前端预置契约。
2026-10-31 03:45:50 +08:00

52 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.nanri.aiimage.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 任务异常证据件配置(v1.2 Phase 3/AC-13)。
*
* <p>证据件落在**独立桶**:默认桶 nanri-ai-images 带 7 天整桶 ILM,
* 与"证据单独保留、单独回收"的口径互相绑死;桶名必须显式写在 application.yml,
* 不许只在代码里留默认值(部署漏配就变成隐形行为)。</p>
*/
@Data
@ConfigurationProperties(prefix = "aiimage.evidence")
public class EvidenceProperties {
/** 证据桶;默认 task-evidence,独立于业务桶。 */
private String bucket = "task-evidence";
/** 证据保留天数(本地与云端同口径,按天回收)。 */
private Integer retentionDays = 7;
/** 对象 key 前缀;实际 key = 前缀 + taskId + "/" + UUID + 扩展名。 */
private String keyPrefix = "task-evidence/";
/** 单件证据上限(字节),超过直接拒绝,避免截图/大 JSON 打满桶。 */
private Long maxFileBytes = 64L * 1024 * 1024;
/** 保留期回收 cron;默认每天 03:30。 */
private String retentionCron = "0 30 3 * * *";
public String bucketOrDefault() {
return bucket == null || bucket.isBlank() ? "task-evidence" : bucket.trim();
}
public int retentionDaysOrDefault() {
return retentionDays == null || retentionDays < 1 ? 7 : retentionDays;
}
public String keyPrefixOrDefault() {
String prefix = keyPrefix == null ? "" : keyPrefix.trim();
if (prefix.isEmpty()) {
return "task-evidence/";
}
return prefix.endsWith("/") ? prefix : prefix + "/";
}
public long maxFileBytesOrDefault() {
return maxFileBytes == null || maxFileBytes < 1 ? 64L * 1024 * 1024 : maxFileBytes;
}
}