完成这个地址替换
This commit is contained in:
@@ -126,7 +126,6 @@ public class AppearancePatentTaskService {
|
||||
"价格",
|
||||
"标题维度(商标)",
|
||||
"外观维度(外观设计专利)",
|
||||
"专利维度(发明/实用新型专利)",
|
||||
"结论",
|
||||
"状态",
|
||||
"评分"
|
||||
@@ -3216,6 +3215,7 @@ public class AppearancePatentTaskService {
|
||||
List<String> resultHeaders = new ArrayList<>(RESULT_HEADERS);
|
||||
resultHeaders.add(4, "标题");
|
||||
resultHeaders.add(5, "图片链接");
|
||||
resultHeaders.add(6, "sku");
|
||||
Row header = sheet.createRow(0);
|
||||
for (int i = 0; i < resultHeaders.size(); i++) {
|
||||
Cell cell = header.createCell(i);
|
||||
@@ -3239,9 +3239,9 @@ public class AppearancePatentTaskService {
|
||||
row.createCell(col++).setCellValue(firstNonBlank(parsedRow.getPrice(), ""));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? firstNonBlank(parsedRow.getTitle(), "") : firstNonBlank(resultRow.getTitle(), parsedRow.getTitle()));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? firstNonBlank(parsedRow.getUrl(), "") : firstNonBlank(resultRow.getUrl(), parsedRow.getUrl()));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? firstNonBlank(parsedRow.getSku(), "") : firstNonBlank(resultRow.getSku(), parsedRow.getSku()));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? missingReason : userFacingCozeCellValue(resultRow, resultRow.getTitleRisk()));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? missingReason : userFacingCozeCellValue(resultRow, resultRow.getAppearanceRisk()));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? missingReason : userFacingCozeCellValue(resultRow, resultRow.getPatentRisk()));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? "未送检" : userFacingConclusion(resultRow));
|
||||
row.createCell(col++).setCellValue(resultRow == null ? "" : userFacingStatus(resultRow));
|
||||
row.createCell(col).setCellValue(resultRow == null ? "" : firstNonBlank(resultRow.getScore(), ""));
|
||||
|
||||
@@ -696,7 +696,7 @@ public class SimilarAsinTaskService {
|
||||
scope.setCreatedAt(LocalDateTime.now());
|
||||
}
|
||||
scope.setChunkTotal(chunkTotal);
|
||||
scope.setReceivedChunkCount(countChunks(taskId, scopeHash));
|
||||
scope.setReceivedChunkCount(resolveReceivedChunkProgress(taskId, scopeHash, scope.getChunkTotal()));
|
||||
scope.setLastChunkAt(LocalDateTime.now());
|
||||
scope.setLastError(request.getError());
|
||||
scope.setCompleted(Boolean.TRUE.equals(request.getDone()) ? 1 : 0);
|
||||
@@ -1199,7 +1199,7 @@ public class SimilarAsinTaskService {
|
||||
if (chunkTotal != null) {
|
||||
scope.setChunkTotal(chunkTotal);
|
||||
}
|
||||
scope.setReceivedChunkCount(countChunks(taskId, scopeHash));
|
||||
scope.setReceivedChunkCount(resolveReceivedChunkProgress(taskId, scopeHash, scope.getChunkTotal()));
|
||||
scope.setLastChunkAt(now);
|
||||
scope.setLastError(error);
|
||||
scope.setCompleted(completed ? 1 : 0);
|
||||
@@ -4822,6 +4822,36 @@ public class SimilarAsinTaskService {
|
||||
return count == null ? 0 : count.intValue();
|
||||
}
|
||||
|
||||
private int resolveReceivedChunkProgress(Long taskId, String scopeHash, Integer chunkTotal) {
|
||||
int receivedCount = countChunks(taskId, scopeHash);
|
||||
Integer maxChunkIndex = taskChunkMapper.selectObjs(new LambdaQueryWrapper<TaskChunkEntity>()
|
||||
.select(TaskChunkEntity::getChunkIndex)
|
||||
.eq(TaskChunkEntity::getTaskId, taskId)
|
||||
.eq(TaskChunkEntity::getModuleType, MODULE_TYPE)
|
||||
.eq(TaskChunkEntity::getScopeHash, scopeHash)
|
||||
.orderByDesc(TaskChunkEntity::getChunkIndex)
|
||||
.last("limit 1"))
|
||||
.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(value -> {
|
||||
if (value instanceof Number number) {
|
||||
return number.intValue();
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(value.toString());
|
||||
} catch (Exception ignored) {
|
||||
return 0;
|
||||
}
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(0);
|
||||
int current = Math.max(receivedCount, maxChunkIndex == null ? 0 : maxChunkIndex);
|
||||
if (chunkTotal != null && chunkTotal > 0) {
|
||||
current = Math.min(current, chunkTotal);
|
||||
}
|
||||
return Math.max(0, current);
|
||||
}
|
||||
|
||||
private SimilarAsinTaskItemVo toTaskItem(FileTaskEntity task) {
|
||||
SimilarAsinTaskItemVo vo = new SimilarAsinTaskItemVo();
|
||||
vo.setId(task.getId());
|
||||
@@ -4938,7 +4968,7 @@ public class SimilarAsinTaskService {
|
||||
PythonUploadProgress progress = resolvePythonUploadProgress(taskId);
|
||||
int total = progress.total() > 0 ? progress.total() : Math.max(1, progress.current() + 1);
|
||||
int current = Math.max(0, Math.min(progress.current(), total));
|
||||
int percent = current <= 0 ? 1 : Math.min(95, (int) Math.floor(current * 100.0 / total));
|
||||
int percent = current <= 0 ? 1 : Math.min(95, (int) Math.ceil(current * 100.0 / total));
|
||||
vo.setFileProgressCurrent(current);
|
||||
vo.setFileProgressTotal(total);
|
||||
vo.setFileProgressPercent(percent);
|
||||
@@ -4987,6 +5017,7 @@ public class SimilarAsinTaskService {
|
||||
}
|
||||
int stateTotal = state.getChunkTotal() == null ? 0 : state.getChunkTotal();
|
||||
int stateCurrent = state.getReceivedChunkCount() == null ? 0 : state.getReceivedChunkCount();
|
||||
stateCurrent = Math.max(stateCurrent, resolveReceivedChunkProgress(taskId, state.getScopeHash(), stateTotal));
|
||||
if (stateTotal > total || total <= 0 && stateCurrent > current) {
|
||||
total = stateTotal;
|
||||
current = stateCurrent;
|
||||
@@ -5010,6 +5041,9 @@ public class SimilarAsinTaskService {
|
||||
}
|
||||
String scopeHash = firstNonBlank(chunk.getScopeHash(), "");
|
||||
receivedByScope.merge(scopeHash, 1, Integer::sum);
|
||||
if (chunk.getChunkIndex() != null && chunk.getChunkIndex() > 0) {
|
||||
receivedByScope.merge(scopeHash, chunk.getChunkIndex(), Math::max);
|
||||
}
|
||||
if (chunk.getChunkTotal() != null && chunk.getChunkTotal() > 0) {
|
||||
totalByScope.merge(scopeHash, chunk.getChunkTotal(), Math::max);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user