修复图片下载问题

This commit is contained in:
super
2026-06-16 22:19:55 +08:00
parent f44110fae5
commit 021b0c618b
11 changed files with 358 additions and 43 deletions
@@ -78,7 +78,7 @@ public class PriceTrackTaskService {
private FileTaskEntity loadTaskForExecution(Long taskId) {
Map<Long, FileTaskEntity> cachedTasks = priceTrackTaskCacheService.getTaskCacheBatch(List.of(taskId));
FileTaskEntity cached = cachedTasks.get(taskId);
if (cached != null) {
if (cached != null && hasText(cached.getRequestJson())) {
return cached;
}
FileTaskEntity dbTask = fileTaskMapper.selectById(taskId);
@@ -396,7 +396,6 @@ public class PriceTrackTaskService {
task.setCreatedAt(LocalDateTime.now());
task.setUpdatedAt(LocalDateTime.now());
fileTaskMapper.insert(task);
priceTrackTaskCacheService.saveTaskCache(task);
priceTrackTaskCacheService.touchTaskHeartbeat(task.getId());
if (request.getLoopRunId() != null) {
priceTrackLoopRunService.bindChildTask(request.getLoopRunId(), task.getId(), request.getRoundIndex(), request.getShopIndex());
@@ -447,6 +446,7 @@ public class PriceTrackTaskService {
throw new BusinessException("序列化任务数据失败");
}
fileTaskMapper.updateById(task);
priceTrackTaskCacheService.saveTaskCache(task);
// TODO: Python 侧轮询 RUNNING 任务,pickup 后开始处理
// Java 侧通过 submitResult 接口接收 Python 回传结果
@@ -1548,6 +1548,10 @@ public class PriceTrackTaskService {
return taskDistributedLockService.acquire(MODULE_TYPE, taskId);
}
private static boolean hasText(String value) {
return value != null && !value.isBlank();
}
private void cleanupTaskCacheIfTerminal(Long taskId, String taskStatus) {
if (!"SUCCESS".equals(taskStatus) && !"FAILED".equals(taskStatus) && !"DELETE_EMPTY".equals(taskStatus)) {
return;