|
|
@ -193,12 +193,13 @@ public class VaaSyncService { |
|
|
vaaHttpUtil.httpDown(fileUrl, localPath, authToken); |
|
|
vaaHttpUtil.httpDown(fileUrl, localPath, authToken); |
|
|
logger.info("【重新同步】录音下载完成: {}", fileName); |
|
|
logger.info("【重新同步】录音下载完成: {}", fileName); |
|
|
|
|
|
|
|
|
// 8. 上传OSS(路径与原记录一致,覆盖同名文件,业务表无需更新)
|
|
|
// 8. 上传OSS(复用原OSS文件名覆盖,业务表无需更新)
|
|
|
|
|
|
String ossFileName = extractOssFileName(record.getRecordingFilePath(), fileName); |
|
|
String ossPath = "voice/" + cityCode + "/" + new SimpleDateFormat("yyyy-MM-dd").format(callStartTime) + "/"; |
|
|
String ossPath = "voice/" + cityCode + "/" + new SimpleDateFormat("yyyy-MM-dd").format(callStartTime) + "/"; |
|
|
OssFileResponse ossResponse = uploadRecording(localFile.toFile(), fileName, ossPath); |
|
|
OssFileResponse ossResponse = uploadRecording(localFile.toFile(), ossFileName, ossPath); |
|
|
String previewUrl = ossResponse.getFileUrl(); |
|
|
String previewUrl = ossResponse.getFileUrl(); |
|
|
if (previewUrl == null || previewUrl.trim().isEmpty()) { |
|
|
if (previewUrl == null || previewUrl.trim().isEmpty()) { |
|
|
throw new IllegalStateException("OSS上传成功但未返回文件地址: " + fileName); |
|
|
throw new IllegalStateException("OSS上传成功但未返回文件地址: " + ossFileName); |
|
|
} |
|
|
} |
|
|
ossFilePath = previewUrl; |
|
|
ossFilePath = previewUrl; |
|
|
|
|
|
|
|
|
@ -261,6 +262,28 @@ public class VaaSyncService { |
|
|
return callRecordId; |
|
|
return callRecordId; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 从原录音的 OSS 地址中提取 OSS 文件名(URL 最后一段),用于重新同步时覆盖原文件。 |
|
|
|
|
|
* 若地址为空或无法提取,则回退为录音盒原始文件名。 |
|
|
|
|
|
*/ |
|
|
|
|
|
private String extractOssFileName(String recordingFilePath, String fallback) { |
|
|
|
|
|
if (StringUtils.hasText(recordingFilePath)) { |
|
|
|
|
|
String path = recordingFilePath; |
|
|
|
|
|
int queryIdx = path.indexOf('?'); |
|
|
|
|
|
if (queryIdx >= 0) { |
|
|
|
|
|
path = path.substring(0, queryIdx); |
|
|
|
|
|
} |
|
|
|
|
|
int slashIdx = path.lastIndexOf('/'); |
|
|
|
|
|
if (slashIdx >= 0 && slashIdx < path.length() - 1) { |
|
|
|
|
|
String name = path.substring(slashIdx + 1); |
|
|
|
|
|
if (StringUtils.hasText(name)) { |
|
|
|
|
|
return name; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return fallback; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 保存重新同步操作记录到 mid_voice_resync_log 表 |
|
|
* 保存重新同步操作记录到 mid_voice_resync_log 表 |
|
|
*/ |
|
|
*/ |
|
|
|