diff --git a/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java b/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java
index 0d9151c7..377249f6 100644
--- a/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java
+++ b/src/main/java/com/ycwl/basic/model/pc/face/entity/FaceEntity.java
@@ -41,6 +41,10 @@ public class FaceEntity {
* 匹配的结果,JSON字符串
*/
private String matchResult;
+ /**
+ * 是否人工调整过,0-否,1-是
+ */
+ private Integer isManual;
private Date createAt;
private Date updateAt;
private int isDelete;
diff --git a/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java b/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java
index 38cb83c7..77c65b8f 100644
--- a/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java
+++ b/src/main/java/com/ycwl/basic/service/pc/impl/FaceServiceImpl.java
@@ -290,19 +290,23 @@ public class FaceServiceImpl implements FaceService {
if (faceId == null) {
throw new IllegalArgumentException("faceId 不能为空");
}
-
+ // 1. 数据准备:获取人脸信息、景区配置、适配器等
+ FaceEntity face = faceRepository.getFace(faceId);
+ if (face == null) {
+ log.warn("人脸不存在,faceId: {}", faceId);
+ return null;
+ }
+
+ if (!isNew && Integer.valueOf(1).equals(face.getIsManual())) {
+ log.info("人工选择的,无需匹配,faceId: {}", faceId);
+ return null;
+ }
log.debug("开始人脸匹配:faceId={}, isNew={}", faceId, isNew);
// 记录识别次数到Redis,设置2天过期时间
recordFaceRecognitionCount(faceId);
try {
- // 1. 数据准备:获取人脸信息、景区配置、适配器等
- FaceEntity face = faceRepository.getFace(faceId);
- if (face == null) {
- log.warn("人脸不存在,faceId: {}", faceId);
- return null;
- }
ScenicConfigManager scenicConfig = scenicRepository.getScenicConfigManager(face.getScenicId());
IFaceBodyAdapter faceBodyAdapter = scenicService.getScenicFaceBodyAdapter(face.getScenicId());
@@ -1293,6 +1297,14 @@ public class FaceServiceImpl implements FaceService {
if (finalSampleList.isEmpty()) {
throw new BaseException("至少需要保留一个样本");
}
+
+ // 设置人工调整标记
+ FaceEntity updateEntity = new FaceEntity();
+ updateEntity.setId(faceId);
+ updateEntity.setIsManual(1);
+ faceMapper.update(updateEntity);
+ faceRepository.clearFaceCache(faceId);
+
handleCustomFaceMatching(faceId, finalSampleList);
}
diff --git a/src/main/resources/mapper/FaceMapper.xml b/src/main/resources/mapper/FaceMapper.xml
index f6c37c50..3053eb77 100644
--- a/src/main/resources/mapper/FaceMapper.xml
+++ b/src/main/resources/mapper/FaceMapper.xml
@@ -20,6 +20,9 @@
face_url = #{faceUrl},
+
+ is_manual = #{isManual},
+
match_sample_ids = #{matchSampleIds},
first_match_rate = #{firstMatchRate},
match_result = #{matchResult},