fix(face):修复人脸匹配样本ID处理逻辑

- 移除旧数据合并逻辑,直接使用上传的样本ID列表
- 使用stream过滤和去重处理样本ID
- 简化样本列表变更检测逻辑
- 移除不必要的LinkedHashSet转换
- 优化最终样本列表的生成方式
This commit is contained in:
2025-10-30 11:43:02 +08:00
parent 5979b1a275
commit 82d86c8c3c

View File

@@ -1289,16 +1289,13 @@ public class FaceServiceImpl implements FaceService {
List<Long> currentAccepted = parseMatchSampleIds(face.getMatchSampleIds());
List<Long> manualAccepted = Optional.ofNullable(req.getManualAcceptedSampleIds()).orElse(Collections.emptyList());
LinkedHashSet<Long> finalSampleSet = new LinkedHashSet<>();
manualAccepted.stream()
// 直接使用上传的样本ID列表,不与旧数据合并
List<Long> finalSampleList = manualAccepted.stream()
.filter(Objects::nonNull)
.forEach(finalSampleSet::add);
currentAccepted.stream()
.filter(Objects::nonNull)
.forEach(finalSampleSet::add);
.distinct()
.collect(Collectors.toList());
boolean hasManualChange = !manualAccepted.isEmpty();
List<Long> finalSampleList = new ArrayList<>(finalSampleSet);
boolean needsUpdate = hasManualChange && !finalSampleList.equals(currentAccepted);
if (needsUpdate) {