task-98: 移除 similar-asin/appearance-patent 模块 Coze,状态机与共享组件改名 LLM

- similarasin/appearancepatent 模块全部 Coze 工作流调用改走 direct-LLM(已确认唯一运行路径)
- 共享组件改名:CozeTaskQueueGate→TaskQueueGate、CozeGroupResultPropagator→GroupResultPropagator
- 状态机改名:biz_task_scope_state 的 coze_* 列→llm_*、stateJson coze 键→llm(V100 迁移已应用生产)
- 删除 biz_coze_credential 表、CozeCredential* 类、SimilarAsinCozeClient、AppearancePatentCozeClient→LlmClient
- 前端 brand 页 Coze 文案→LLM;Python 后端删除 cozepy 依赖与死配置
- 修复 TaskResultFileJobWorker 启动失败:TaskFileJobConfig 注册 ResultFileJobHandlerRegistry 与 13 个 handler bean(含 validateCoverage 启动校验)
This commit is contained in:
2026-09-01 02:19:45 +08:00
parent acdb1dd030
commit da0eaccf3b
109 changed files with 6903 additions and 4582 deletions
@@ -0,0 +1,192 @@
-- Task:移除 similar-asin / appearance-patent 模块的 Coze 命名残留。
-- biz_task_scope_state 的 coze_* 列改名为 llm_*(Java 实体 TaskScopeStateEntity 已映射 llm_*),
-- idx_task_coze_status 索引同步改名;biz_coze_credential 表已无代码引用,直接删除。
SET @db_name = DATABASE();
-- 1. 列改名:coze_execute_id -> llm_execute_id
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_execute_id'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_execute_id'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_execute_id llm_execute_id VARCHAR(128) NULL COMMENT ''LLM execute id''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 2. coze_status -> llm_status
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_status'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_status'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_status llm_status VARCHAR(32) NULL COMMENT ''LLM workflow status''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 3. coze_submitted_at -> llm_submitted_at
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_submitted_at'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_submitted_at'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_submitted_at llm_submitted_at DATETIME NULL COMMENT ''LLM submitted time''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 4. coze_last_polled_at -> llm_last_polled_at
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_last_polled_at'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_last_polled_at'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_last_polled_at llm_last_polled_at DATETIME NULL COMMENT ''LLM last polled time''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 5. coze_completed_at -> llm_completed_at
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_completed_at'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_completed_at'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_completed_at llm_completed_at DATETIME NULL COMMENT ''LLM completed time''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 6. coze_attempt_count -> llm_attempt_count
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_attempt_count'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_attempt_count'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_attempt_count llm_attempt_count INT NOT NULL DEFAULT 0 COMMENT ''LLM poll attempt count''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 7. coze_error -> llm_error
SET @col_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'coze_error'
);
SET @llm_exists := (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND COLUMN_NAME = 'llm_error'
);
SET @sql := IF(@col_exists = 1 AND @llm_exists = 0,
'ALTER TABLE biz_task_scope_state CHANGE COLUMN coze_error llm_error VARCHAR(1000) NULL COMMENT ''LLM error message''',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 8. 索引改名:idx_task_coze_status -> idx_task_llm_status
SET @idx_exists := (
SELECT COUNT(*)
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND INDEX_NAME = 'idx_task_coze_status'
);
SET @llm_idx_exists := (
SELECT COUNT(*)
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = @db_name
AND TABLE_NAME = 'biz_task_scope_state'
AND INDEX_NAME = 'idx_task_llm_status'
);
SET @sql := IF(@idx_exists = 1 AND @llm_idx_exists = 0,
'ALTER TABLE biz_task_scope_state DROP INDEX idx_task_coze_status, ADD INDEX idx_task_llm_status (module_type, llm_status, updated_at)',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 9. 删除已无代码引用的 Coze 凭据表
DROP TABLE IF EXISTS biz_coze_credential;