移除外观专利转 Linux 后台后的废弃代码
- Java:删除无调用方的 parsed-payload/queue-payload/parsed-groups 三个 HTTP 端点、service 的 parsedPayload/parsedGroupPage 方法与 AppearancePatentParsedGroupPageDto;service.queuePayload 保留(内部认领 SPI 仍在用) - 前端:删除 getAppearancePatentParsedPayload/getAppearancePatentQueuePayload/activateAppearancePatentTask 封装与 endpoints 条目、ParsedPayloadDto 类型,以及外观专利页永远为空的 queuePayloadText 模板/声明/清零/样式
This commit is contained in:
-30
@@ -3,8 +3,6 @@ package com.nanri.aiimage.modules.appearancepatent.controller;
|
||||
import com.nanri.aiimage.common.api.ApiResponse;
|
||||
import com.nanri.aiimage.common.security.AdminAuthSupport;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentParseRequest;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentParsedGroupPageDto;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentParsedPayloadDto;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentSubmitResultRequest;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentTaskBatchRequest;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.vo.AppearancePatentDashboardVo;
|
||||
@@ -57,34 +55,6 @@ public class AppearancePatentController {
|
||||
adminAuthSupport.currentDeviceId(httpRequest)));
|
||||
}
|
||||
|
||||
@GetMapping("/tasks/{taskId}/parsed-payload")
|
||||
@Operation(summary = "获取外观专利完整解析载荷", description = "供 Python 队列消费端使用。parse 接口仅返回轻量结果,完整行数据通过本接口按 taskId 拉取。")
|
||||
public ApiResponse<AppearancePatentParsedPayloadDto> parsedPayload(
|
||||
@Parameter(description = "外观专利任务 ID", required = true, example = "7004")
|
||||
@PathVariable Long taskId,
|
||||
@Parameter(description = "当前用户 ID", required = true, example = "1")
|
||||
@RequestParam("user_id") Long userId) {
|
||||
return ApiResponse.success(service.parsedPayload(taskId, userId));
|
||||
}
|
||||
|
||||
@GetMapping("/tasks/{taskId}/queue-payload")
|
||||
@Operation(summary = "获取外观专利 Python 队列载荷", description = "只返回 Python 当前需要的 groups,避免前端搬运完整解析大数据。")
|
||||
public ApiResponse<AppearancePatentParsedPayloadDto> queuePayload(
|
||||
@PathVariable Long taskId,
|
||||
@RequestParam("user_id") Long userId) {
|
||||
return ApiResponse.success(service.queuePayload(taskId, userId));
|
||||
}
|
||||
|
||||
@GetMapping("/tasks/{taskId}/parsed-groups")
|
||||
@Operation(summary = "分页获取外观专利解析分组", description = "供后续优化使用,按页返回解析分组。")
|
||||
public ApiResponse<AppearancePatentParsedGroupPageDto> parsedGroups(
|
||||
@PathVariable Long taskId,
|
||||
@RequestParam("user_id") Long userId,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "page_size", required = false, defaultValue = "50") Integer pageSize) {
|
||||
return ApiResponse.success(service.parsedGroupPage(taskId, userId, page, pageSize));
|
||||
}
|
||||
|
||||
@GetMapping("/dashboard")
|
||||
@Operation(summary = "查询外观专利检测总览", description = "查询当前用户的运行中、成功、失败和已结束任务数量。页面进入时请求一次即可,不需要持续轮询。")
|
||||
public ApiResponse<AppearancePatentDashboardVo> dashboard(
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.nanri.aiimage.modules.appearancepatent.model.dto;
|
||||
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.vo.AppearancePatentParsedGroupVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AppearancePatentParsedGroupPageDto {
|
||||
private String aiPrompt;
|
||||
private String apiKey;
|
||||
private Integer page;
|
||||
private Integer pageSize;
|
||||
private Integer totalGroups;
|
||||
private Integer totalRows;
|
||||
private Boolean hasNext;
|
||||
private List<AppearancePatentParsedGroupVo> groups = new ArrayList<>();
|
||||
}
|
||||
-36
@@ -18,7 +18,6 @@ import com.nanri.aiimage.config.InstanceMetadata;
|
||||
import com.nanri.aiimage.config.StorageProperties;
|
||||
import com.nanri.aiimage.modules.appearancepatent.client.AppearancePatentLlmClient;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentParseRequest;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentParsedGroupPageDto;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentParsedPayloadDto;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentResultGroupDto;
|
||||
import com.nanri.aiimage.modules.appearancepatent.model.dto.AppearancePatentResultRowDto;
|
||||
@@ -3042,15 +3041,6 @@ public class AppearancePatentTaskService {
|
||||
return hydrateParsedPayloadRows(new AppearancePatentParsedPayloadDto());
|
||||
}
|
||||
|
||||
public AppearancePatentParsedPayloadDto parsedPayload(Long taskId, Long userId) {
|
||||
FileTaskEntity task = fileTaskMapper.selectById(taskId);
|
||||
if (task == null || !MODULE_TYPE.equals(task.getModuleType()) || userId != null && !Objects.equals(userId, task.getUserId())) {
|
||||
throw new BusinessException("任务不存在");
|
||||
}
|
||||
ensureTaskOwnedByCurrentInstance(task, "parsed payload");
|
||||
return readParsedPayload(task);
|
||||
}
|
||||
|
||||
public AppearancePatentParsedPayloadDto queuePayload(Long taskId, Long userId) {
|
||||
FileTaskEntity task = fileTaskMapper.selectById(taskId);
|
||||
if (task == null || !MODULE_TYPE.equals(task.getModuleType()) || userId != null && !Objects.equals(userId, task.getUserId())) {
|
||||
@@ -3069,32 +3059,6 @@ public class AppearancePatentTaskService {
|
||||
return queuePayload;
|
||||
}
|
||||
|
||||
public AppearancePatentParsedGroupPageDto parsedGroupPage(Long taskId, Long userId, Integer page, Integer pageSize) {
|
||||
FileTaskEntity task = fileTaskMapper.selectById(taskId);
|
||||
if (task == null || !MODULE_TYPE.equals(task.getModuleType()) || userId != null && !Objects.equals(userId, task.getUserId())) {
|
||||
throw new BusinessException("任务不存在");
|
||||
}
|
||||
int safePage = Math.max(1, page == null ? 1 : page);
|
||||
int safePageSize = Math.max(1, Math.min(pageSize == null ? 50 : pageSize, 200));
|
||||
AppearancePatentParsedPayloadDto payload = readParsedPayload(task);
|
||||
List<AppearancePatentParsedGroupVo> groups = payload.getGroups() == null ? List.of() : payload.getGroups();
|
||||
int totalGroups = groups.size();
|
||||
int totalRows = payload.getAllItems() == null ? 0 : payload.getAllItems().size();
|
||||
int fromIndex = Math.min((safePage - 1) * safePageSize, totalGroups);
|
||||
int toIndex = Math.min(fromIndex + safePageSize, totalGroups);
|
||||
|
||||
AppearancePatentParsedGroupPageDto vo = new AppearancePatentParsedGroupPageDto();
|
||||
vo.setAiPrompt(payload.getAiPrompt());
|
||||
vo.setApiKey(payload.getApiKey());
|
||||
vo.setPage(safePage);
|
||||
vo.setPageSize(safePageSize);
|
||||
vo.setTotalGroups(totalGroups);
|
||||
vo.setTotalRows(totalRows);
|
||||
vo.setHasNext(toIndex < totalGroups);
|
||||
vo.setGroups(fromIndex >= toIndex ? List.of() : groups.subList(fromIndex, toIndex));
|
||||
return vo;
|
||||
}
|
||||
|
||||
private AppearancePatentParsedPayloadDto hydrateParsedPayloadRows(AppearancePatentParsedPayloadDto payload) {
|
||||
if (payload == null) {
|
||||
return new AppearancePatentParsedPayloadDto();
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
<div>任务 ID:{{ visibleTaskSummary.taskId }}</div>
|
||||
<div>总行数:{{ visibleTaskSummary.totalRows }},有效:{{ visibleTaskSummary.acceptedRows }},分组:{{ visibleTaskSummary.groupCount || 0 }},过滤:{{ visibleTaskSummary.droppedRows }}</div>
|
||||
</div>
|
||||
<pre v-if="queuePayloadText" class="queue-payload">{{ queuePayloadText }}</pre>
|
||||
<ModuleTemplateDownload module-code="appearance-patent" filename="外观专利检测 文档格式.xlsx" />
|
||||
</aside>
|
||||
|
||||
@@ -122,7 +121,6 @@ const queuedTaskSummary = ref<TaskSummary | null>(null)
|
||||
const aiPrompt = ref('')
|
||||
const parsing = ref(false)
|
||||
const pushing = ref(false)
|
||||
const queuePayloadText = ref('')
|
||||
const pollingTaskIds = ref<number[]>([])
|
||||
const pendingFileTaskIds = ref<number[]>([])
|
||||
const pollTimer = ref<number | null>(null)
|
||||
@@ -306,14 +304,12 @@ async function selectFiles() {
|
||||
selectedFileNames.value = files.map((f) => f.relativePath || f.originalFilename || f.fileKey)
|
||||
parseResult.value = null
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
} catch (error) {
|
||||
// 上传失败时清空选择,避免残留上一批文件让用户误以为新文件已就绪
|
||||
uploadedFiles.value = []
|
||||
selectedFileNames.value = []
|
||||
parseResult.value = null
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
ElMessage.error(error instanceof Error ? error.message : '文件上传失败')
|
||||
}
|
||||
}
|
||||
@@ -338,7 +334,6 @@ async function selectFolder() {
|
||||
selectedFileNames.value = result.items.map((item) => item.relativePath || item.absolutePath)
|
||||
parseResult.value = null
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
ElMessage.success(`已选择文件夹内 ${result.items.length} 个 Excel 文件`)
|
||||
} catch (error) {
|
||||
uploadedFiles.value = []
|
||||
@@ -397,19 +392,16 @@ async function parseFiles() {
|
||||
if (!(await passGuard(guard))) {
|
||||
parseResult.value = null
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
return
|
||||
}
|
||||
if (await abortOnCollapsedGroups(res)) {
|
||||
parseResult.value = null
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
ElMessage.info('已取消,修正 id 列后重新解析')
|
||||
return
|
||||
}
|
||||
parseResult.value = res
|
||||
queuedTaskSummary.value = null
|
||||
queuePayloadText.value = ''
|
||||
ElMessage.success(`解析完成,共 ${res.groupCount || 0} 组 / ${res.acceptedRows} 条`)
|
||||
} catch (e) {
|
||||
ElMessage.error(e instanceof Error ? e.message : '解析失败')
|
||||
@@ -443,7 +435,6 @@ async function pushToPythonQueue() {
|
||||
|
||||
function clearParsedTask() {
|
||||
parseResult.value = null
|
||||
queuePayloadText.value = ''
|
||||
}
|
||||
|
||||
function addPollingTask(taskId: number) {
|
||||
@@ -941,8 +932,7 @@ async function batchDeleteHistory(views: TaskItemView[]) {
|
||||
.prompt-input { width: 100%; box-sizing: border-box; resize: vertical; min-height: 180px; padding: 10px 12px; border: 1px solid #333; border-radius: 8px; background: #222b3d; color: #c8d2e2; font-size: 12px; line-height: 1.6; outline: none; }
|
||||
.secret-input { width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px; border: 1px solid #333; border-radius: 8px; background: #222b3d; color: #c8d2e2; font-size: 12px; outline: none; }
|
||||
.prompt-input:focus, .secret-input:focus { border-color: #3498db; }
|
||||
.parse-card, .queue-payload { margin-top: 14px; padding: 12px; border: 1px solid #2e3a52; border-radius: 8px; background: #222b3d; color: #a0acbe; font-size: 12px; }
|
||||
.queue-payload { max-height: 220px; overflow: auto; color: #8fd3ff; white-space: pre-wrap; }
|
||||
.parse-card { margin-top: 14px; padding: 12px; border: 1px solid #2e3a52; border-radius: 8px; background: #222b3d; color: #a0acbe; font-size: 12px; }
|
||||
.result-table { --el-table-bg-color: #242424; --el-table-tr-bg-color: #242424; --el-table-header-bg-color: #2e3a52; --el-table-text-color: #c8d2e2; --el-table-border-color: #333; }
|
||||
.result-hint { margin-top: 6px; color: #e0b96d; }
|
||||
.download { padding: 6px 10px; color: #c8d2e2; background: rgba(52, 152, 219, .18); }
|
||||
|
||||
@@ -190,14 +190,11 @@ export const API_ENDPOINTS = {
|
||||
},
|
||||
appearancePatent: {
|
||||
parse: '/api/appearance-patent/parse',
|
||||
parsedPayload: '/api/appearance-patent/tasks/{taskId}/parsed-payload',
|
||||
queuePayload: '/api/appearance-patent/tasks/{taskId}/queue-payload',
|
||||
dashboard: '/api/appearance-patent/dashboard',
|
||||
history: '/api/appearance-patent/history',
|
||||
historyDelete: '/api/appearance-patent/history/{resultId}',
|
||||
progressBatch: '/api/appearance-patent/tasks/progress/batch',
|
||||
progressLight: '/api/appearance-patent/tasks/progress/light',
|
||||
taskActivate: '/api/appearance-patent/tasks/{taskId}/activate',
|
||||
taskDelete: '/api/appearance-patent/tasks/{taskId}',
|
||||
resultDownload: '/api/appearance-patent/results/{resultId}/download',
|
||||
},
|
||||
|
||||
@@ -46,16 +46,6 @@ export interface AppearancePatentParseVo {
|
||||
groups?: AppearancePatentParsedGroup[];
|
||||
}
|
||||
|
||||
export interface AppearancePatentParsedPayloadDto {
|
||||
aiPrompt?: string;
|
||||
apiKey?: string;
|
||||
sourceFiles?: UploadedFileRef[];
|
||||
headers?: string[];
|
||||
items?: AppearancePatentParsedRow[];
|
||||
groups?: AppearancePatentParsedGroup[];
|
||||
allItems?: AppearancePatentParsedRow[];
|
||||
}
|
||||
|
||||
export interface AppearancePatentDashboardVo {
|
||||
pendingTaskCount: number;
|
||||
processedTaskCount: number;
|
||||
@@ -190,24 +180,6 @@ export function parseAppearancePatent(files: UploadedFileRef[], aiPrompt: string
|
||||
);
|
||||
}
|
||||
|
||||
export function getAppearancePatentParsedPayload(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<AppearancePatentParsedPayloadDto>>(
|
||||
buildJavaUrl(API_ENDPOINTS.appearancePatent.parsedPayload.replace('{taskId}', String(taskId))),
|
||||
{ params: { user_id: getCurrentUserId() } },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getAppearancePatentQueuePayload(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<AppearancePatentParsedPayloadDto>>(
|
||||
buildJavaUrl(API_ENDPOINTS.appearancePatent.queuePayload.replace('{taskId}', String(taskId))),
|
||||
{ params: { user_id: getCurrentUserId() } },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getAppearancePatentDashboard() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<AppearancePatentDashboardVo>>(
|
||||
@@ -237,15 +209,6 @@ export function getAppearancePatentTaskProgressBatch(
|
||||
);
|
||||
}
|
||||
|
||||
export function activateAppearancePatentTask(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<null>, undefined>(
|
||||
`${JAVA_API_PREFIX}/appearance-patent/tasks/${taskId}/activate?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
undefined,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteAppearancePatentTask(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/appearance-patent/tasks/${taskId}`, {
|
||||
|
||||
Reference in New Issue
Block a user