refactor(face): 移除样本筛选轨迹功能及相关枚举

- 删除 FaceRecognitionFilterReason 枚举类
- 移除 SampleFilterTrace 类及其相关逻辑
- 简化样本筛选方法,去除轨迹记录功能- 更新 FaceServiceImpl 和 TaskFaceServiceImpl 中的调用逻辑
- 移除 SearchFaceRespVo 中的 filterTrace 字段- 清理无用的 import语句和相关代码引用
This commit is contained in:
2025-10-29 19:26:35 +08:00
parent b6bde4ad62
commit 745943fc23
8 changed files with 19 additions and 138 deletions

View File

@@ -46,7 +46,7 @@ import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
import com.ycwl.basic.model.repository.TaskUpdateResult;
import com.ycwl.basic.model.task.resp.SampleFilterTrace;
import com.ycwl.basic.model.task.resp.SearchFaceRespVo;
import com.ycwl.basic.repository.DeviceRepository;
import com.ycwl.basic.repository.FaceRepository;
@@ -1196,13 +1196,9 @@ public class FaceServiceImpl implements FaceService {
// 3. 应用后置筛选逻辑
if (mergedResult.getSampleListIds() != null && !mergedResult.getSampleListIds().isEmpty()) {
List<FaceSampleEntity> allFaceSampleList = faceSampleMapper.listByIds(mergedResult.getSampleListIds());
SampleFilterTrace filterTrace = faceService.applySampleFiltersWithTrace(
List<Long> filteredSampleIds = faceService.applySampleFilters(
mergedResult.getSampleListIds(), allFaceSampleList, scenicConfig);
List<Long> filteredSampleIds = filterTrace.getAcceptedSampleIds() == null
? Collections.emptyList()
: filterTrace.getAcceptedSampleIds();
mergedResult.setSampleListIds(filteredSampleIds);
mergedResult.setFilterTrace(filterTrace);
log.debug("应用后置筛选:原始样本数={}, 筛选后样本数={}",
allFaceSampleList.size(), filteredSampleIds.size());
}
@@ -1280,8 +1276,6 @@ public class FaceServiceImpl implements FaceService {
List<Long> currentAccepted = parseMatchSampleIds(face.getMatchSampleIds());
List<Long> manualAccepted = Optional.ofNullable(req.getManualAcceptedSampleIds()).orElse(Collections.emptyList());
List<Long> manualRejected = Optional.ofNullable(req.getManualRejectedSampleIds()).orElse(Collections.emptyList());
Set<Long> manualRejectedSet = new HashSet<>(manualRejected);
LinkedHashSet<Long> finalSampleSet = new LinkedHashSet<>();
manualAccepted.stream()
@@ -1289,10 +1283,9 @@ public class FaceServiceImpl implements FaceService {
.forEach(finalSampleSet::add);
currentAccepted.stream()
.filter(Objects::nonNull)
.filter(id -> !manualRejectedSet.contains(id))
.forEach(finalSampleSet::add);
boolean hasManualChange = !manualAccepted.isEmpty() || !manualRejectedSet.isEmpty();
boolean hasManualChange = !manualAccepted.isEmpty();
List<Long> finalSampleList = new ArrayList<>(finalSampleSet);
boolean needsUpdate = hasManualChange && !finalSampleList.equals(currentAccepted);