You've already forked FrameTour-BE
refactor(puzzle): 移除拼图生成记录中的复用逻辑
- 删除 PuzzleGenerationRecordEntity 中的 isDuplicate 和 originalRecordId 字段 - 移除插入记录时设置 isDuplicate 的逻辑 - 删除 FaceMatchingOrchestrator 中查询历史记录的逻辑 - 更新 Mapper XML 文件,移除相关字段和条件判断 - 简化生成流程,不再检查模板是否已生成
This commit is contained in:
@@ -70,20 +70,6 @@ public class PuzzleGenerationRecordEntity {
|
||||
@TableField("content_hash")
|
||||
private String contentHash;
|
||||
|
||||
/**
|
||||
* 是否为复用记录
|
||||
* 0-新生成, 1-复用历史记录
|
||||
*/
|
||||
@TableField("is_duplicate")
|
||||
private Boolean isDuplicate;
|
||||
|
||||
/**
|
||||
* 原始记录ID
|
||||
* 当is_duplicate=1时,记录被复用的原始记录ID
|
||||
*/
|
||||
@TableField("original_record_id")
|
||||
private Long originalRecordId;
|
||||
|
||||
/**
|
||||
* 生成的图片URL
|
||||
*/
|
||||
|
||||
@@ -125,7 +125,6 @@ public class PuzzleGenerateServiceImpl implements IPuzzleGenerateService {
|
||||
// 8. 没有历史记录,创建新的生成记录
|
||||
PuzzleGenerationRecordEntity record = createRecord(template, request, resolvedScenicId);
|
||||
record.setContentHash(contentHash);
|
||||
record.setIsDuplicate(false);
|
||||
recordMapper.insert(record);
|
||||
|
||||
try {
|
||||
|
||||
@@ -369,7 +369,6 @@ public class FaceMatchingOrchestrator {
|
||||
return;
|
||||
}
|
||||
ScenicV2DTO scenicBasic = scenicRepository.getScenicBasic(face.getScenicId());
|
||||
List<PuzzleGenerationRecordEntity> records = puzzleGenerationRecordMapper.listByFaceId(faceId);
|
||||
|
||||
// 准备公共动态数据
|
||||
Map<String, String> baseDynamicData = new HashMap<>();
|
||||
@@ -387,11 +386,6 @@ public class FaceMatchingOrchestrator {
|
||||
int failCount = 0;
|
||||
for (PuzzleTemplateDTO template : templateList) {
|
||||
try {
|
||||
boolean anyMatch = records.stream().anyMatch(record -> record.getTemplateCode().equals(template.getCode()));
|
||||
if (anyMatch) {
|
||||
log.info("模板已生成,跳过");
|
||||
continue;
|
||||
}
|
||||
log.info("开始生成拼图: scenicId={}, templateCode={}, templateName={}",
|
||||
scenicId, template.getCode(), template.getName());
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
<result column="business_type" property="businessType"/>
|
||||
<result column="generation_params" property="generationParams"/>
|
||||
<result column="content_hash" property="contentHash"/>
|
||||
<result column="is_duplicate" property="isDuplicate"/>
|
||||
<result column="original_record_id" property="originalRecordId"/>
|
||||
<result column="result_image_url" property="resultImageUrl"/>
|
||||
<result column="result_file_size" property="resultFileSize"/>
|
||||
<result column="result_width" property="resultWidth"/>
|
||||
@@ -33,7 +31,7 @@
|
||||
<!-- 基础列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, template_id, template_code, user_id, face_id, business_type,
|
||||
generation_params, content_hash, is_duplicate, original_record_id,
|
||||
generation_params, content_hash,
|
||||
result_image_url, result_file_size, result_width, result_height,
|
||||
status, error_message, generation_duration, retry_count,
|
||||
scenic_id, client_ip, user_agent, create_time, update_time
|
||||
@@ -78,13 +76,13 @@
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO puzzle_generation_record (
|
||||
template_id, template_code, user_id, face_id, business_type,
|
||||
generation_params, content_hash, is_duplicate, original_record_id,
|
||||
generation_params, content_hash,
|
||||
result_image_url, result_file_size, result_width, result_height,
|
||||
status, error_message, generation_duration, retry_count,
|
||||
scenic_id, client_ip, user_agent, create_time, update_time
|
||||
) VALUES (
|
||||
#{templateId}, #{templateCode}, #{userId}, #{faceId}, #{businessType},
|
||||
#{generationParams}, #{contentHash}, #{isDuplicate}, #{originalRecordId},
|
||||
#{generationParams}, #{contentHash},
|
||||
#{resultImageUrl}, #{resultFileSize}, #{resultWidth}, #{resultHeight},
|
||||
#{status}, #{errorMessage}, #{generationDuration}, #{retryCount},
|
||||
#{scenicId}, #{clientIp}, #{userAgent}, NOW(), NOW()
|
||||
@@ -138,7 +136,6 @@
|
||||
AND content_hash = #{contentHash}
|
||||
AND scenic_id = #{scenicId}
|
||||
AND status = 1
|
||||
AND is_duplicate = 0
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user