feat:人脸删除同步
This commit is contained in:
1 parent
593aa39b78
commit
b916d6ca85
6 files changed
+55
-13
No files matched your search
@@ -106,13 +106,36 @@ class SyncFaceTool {
|
||||
}
|
||||
}
|
||||
for (final v in data) {
|
||||
final faceEntity = await faceDao.findBySampleId(v.autoCode!);
|
||||
if (ObjectUtil.isEmpty(v.autoCode) || ObjectUtil.isEmpty(v.userId)) {
|
||||
logger.e(
|
||||
"|$_tag|同步人脸跳过无效数据:|autoCode=${v.autoCode}|userId=${v.userId}|deptId=${v.deptId}|username=${v.username}|",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
final sampleId = v.autoCode!;
|
||||
final userId = v.userId!;
|
||||
// 删除人脸
|
||||
if (v.delFlag == true) {
|
||||
// 先查询数据库是否存在
|
||||
final detail = await faceDao.findBySampleId(sampleId);
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detail.path)) {
|
||||
await delFaceByStorage(filePath: detail.path!);
|
||||
}
|
||||
await AppFaceTool.removeFace(sampleId: sampleId);
|
||||
await faceDao.delBySampleId(sampleId);
|
||||
continue;
|
||||
}
|
||||
final faceEntity = await faceDao.findBySampleId(sampleId);
|
||||
if (faceEntity == null) {
|
||||
final add = FaceEntity(
|
||||
userId: v.userId!,
|
||||
sampleId: v.autoCode!,
|
||||
userId: userId,
|
||||
sampleId: sampleId,
|
||||
userName: v.username ?? "",
|
||||
deptId: v.deptId!,
|
||||
deptId: v.deptId,
|
||||
deptName: v.deptName ?? "",
|
||||
imagePath: v.faceImg ?? "",
|
||||
createTime: DateTime.now(),
|
||||
@@ -146,10 +169,10 @@ class SyncFaceTool {
|
||||
}
|
||||
final edit = FaceEntity(
|
||||
id: faceEntity.id!,
|
||||
userId: v.userId!,
|
||||
sampleId: v.autoCode!,
|
||||
userId: userId,
|
||||
sampleId: sampleId,
|
||||
userName: v.username ?? "",
|
||||
deptId: v.deptId!,
|
||||
deptId: v.deptId,
|
||||
deptName: v.deptName ?? "",
|
||||
imagePath: v.faceImg ?? "",
|
||||
createTime: DateTime.now(),
|
||||
|
||||
Reference in new issue
Block a user