You've already forked FrameTour-BE
人脸真实删除、清理逻辑优化
This commit is contained in:
@ -9,6 +9,7 @@ import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
import com.ycwl.basic.mapper.ScenicMapper;
|
||||
import com.ycwl.basic.mapper.SourceMapper;
|
||||
import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||
@ -105,17 +106,23 @@ public class FaceCleaner {
|
||||
}
|
||||
FaceReqQuery req = new FaceReqQuery();
|
||||
req.setScenicId(scenic.getId());
|
||||
req.setUpdateEndTime(DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -faceStoreDay));
|
||||
List<FaceRespVO> list = faceMapper.list(req);
|
||||
Date faceEndDate = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -faceStoreDay);
|
||||
List<FaceEntity> list = faceMapper.listEntityBeforeDate(scenic.getId(), faceEndDate);
|
||||
list.forEach(face -> {
|
||||
boolean result = adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId(), face.getId().toString());
|
||||
if (result) {
|
||||
log.info("当前景区{},人脸样本ID{},删除成功", scenic.getId(), face.getId());
|
||||
faceMapper.deleteById(face.getId());
|
||||
} else {
|
||||
log.info("当前景区{},人脸样本ID{},删除失败", scenic.getId(), face.getId());
|
||||
result = adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId(), face.getId().toString());
|
||||
if (result) {
|
||||
log.info("当前景区{},人脸样本ID{},删除成功", scenic.getId(), face.getId());
|
||||
} else {
|
||||
log.info("当前景区{},人脸样本ID{},删除失败", scenic.getId(), face.getId());
|
||||
}
|
||||
}
|
||||
faceMapper.forceDeleteById(face.getId());
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user