提交代码实现v1.0
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.labelsys.backend.util;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public final class ObjectStoragePathBuilder {
|
||||
|
||||
private static final DateTimeFormatter YEAR_MONTH = DateTimeFormatter.ofPattern("yyyyMM");
|
||||
|
||||
private ObjectStoragePathBuilder() {
|
||||
}
|
||||
|
||||
public static String sourceObjectKey(Long companyId, String resourceType, Long resourceId, String extension) {
|
||||
String category = resourceType.toLowerCase();
|
||||
return "source/%d/%s/%s/%d/original.%s".formatted(
|
||||
companyId,
|
||||
category,
|
||||
YEAR_MONTH.format(LocalDateTime.now()),
|
||||
resourceId,
|
||||
extension.toLowerCase());
|
||||
}
|
||||
|
||||
public static String resultQaObjectKey(Long companyId, Long taskId, Long resultId) {
|
||||
return "result/%d/%s/%d/%d/qa.json".formatted(
|
||||
companyId,
|
||||
YEAR_MONTH.format(LocalDateTime.now()),
|
||||
taskId,
|
||||
resultId);
|
||||
}
|
||||
|
||||
public static String resultDiffObjectKey(Long companyId, Long taskId, Long resultId) {
|
||||
return "result/%d/%s/%d/%d/diff.json".formatted(
|
||||
companyId,
|
||||
YEAR_MONTH.format(LocalDateTime.now()),
|
||||
taskId,
|
||||
resultId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user