资源软删除判断,bbxo查询返回临时签名链接
This commit is contained in:
@@ -26,6 +26,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -109,7 +110,7 @@ public class AnnotationResultService {
|
||||
}
|
||||
|
||||
private AnnotationResultDetailResponse toDetailResponse(AnnotationResult result,
|
||||
QaContent qaContent, DiffContent diffContent) {
|
||||
QaContent qaContent, DiffContent diffContent) {
|
||||
|
||||
// 转换 QA 内容(仅保留 records)
|
||||
AnnotationResultDetailResponse.QaContentDto qaContentDto = new AnnotationResultDetailResponse.QaContentDto(
|
||||
@@ -299,6 +300,10 @@ public class AnnotationResultService {
|
||||
private QaContent loadQaContent(AnnotationResult result) {
|
||||
try {
|
||||
String filePath = result.getQaContentFilePath();
|
||||
if (!StringUtils.hasText(filePath)) {
|
||||
log.warn("Qa content file path is empty, resultId={}", result.getId());
|
||||
return new QaContent(null, null, List.of(), null);
|
||||
}
|
||||
String bucketName = extractBucketName(filePath);
|
||||
String objectKey = extractObjectKey(filePath);
|
||||
byte[] content = objectStorageService.download(bucketName, objectKey);
|
||||
@@ -306,15 +311,19 @@ public class AnnotationResultService {
|
||||
return objectMapper.readValue(jsonContent, new TypeReference<QaContent>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to load qa content, resultId={}, filePath={}", result.getId(),
|
||||
result.getQaContentFilePath(), e);
|
||||
throw new BusinessException(ResultCode.ERROR, "加载问答内容失败");
|
||||
log.warn("Failed to load qa content, returning empty content. resultId={}, filePath={}, error={}",
|
||||
result.getId(), result.getQaContentFilePath(), e.getMessage());
|
||||
return new QaContent(null, null, List.of(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private DiffContent loadDiffSummary(AnnotationResult result) {
|
||||
try {
|
||||
String filePath = result.getDiffSummaryFilePath();
|
||||
if (!StringUtils.hasText(filePath)) {
|
||||
log.warn("Diff summary file path is empty, resultId={}", result.getId());
|
||||
return new DiffContent(null, null, List.of(), null);
|
||||
}
|
||||
String bucketName = extractBucketName(filePath);
|
||||
String objectKey = extractObjectKey(filePath);
|
||||
byte[] content = objectStorageService.download(bucketName, objectKey);
|
||||
@@ -322,9 +331,9 @@ public class AnnotationResultService {
|
||||
return objectMapper.readValue(jsonContent, new TypeReference<DiffContent>() {
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to load diff summary, resultId={}, filePath={}", result.getId(),
|
||||
result.getDiffSummaryFilePath(), e);
|
||||
throw new BusinessException(ResultCode.ERROR, "加载差异摘要失败");
|
||||
log.warn("Failed to load diff summary, returning empty content. resultId={}, filePath={}, error={}",
|
||||
result.getId(), result.getDiffSummaryFilePath(), e.getMessage());
|
||||
return new DiffContent(null, null, List.of(), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user