This commit is contained in:
2025-09-09 20:56:04 +08:00
parent 6fac063f61
commit 81c95f124e
5 changed files with 59 additions and 78 deletions

View File

@@ -48,7 +48,6 @@ public class SyncGrantAuthTask {
// 需要先设置模拟上下文
SaTokenContextMockUtil.setMockContext(() -> {
// 模拟登录
StpUtil.login(1);
unAuthPersonRef.set(remoteResidentPersonService.queryUnAuthPerson());
List<RemoteResidentPersonVo> unAuthPerson = unAuthPersonRef.get();
@@ -89,38 +88,39 @@ public class SyncGrantAuthTask {
continue;
}
// // 计算图片MD5
// String nowMd5 = calculateMD5(imgByte);
// // 通过MD5查询相同图片
// Long remoteId = remoteSisAuthService.queryHuaweiBoxIdByImgMd5(nowMd5);
//
// Long huaweiId;
// if (remoteId == null) {
// // 当前本地人像信息不存在相同照片,直接上传华为盒子
// huaweiId = syncHuaweiBox(person, imgByte);
// } else {
// huaweiId = remoteId;
// }
//
// if (huaweiId == null) {
// log.info("华为盒子人像上传失败:{}-----{}", person.getName(), person.getId());
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
// continue;
// }
//
// Boolean update = false;
// try {
// update = remoteSisAuthService.updateImgByPersonId(person.getId(), huaweiId, nowMd5);
// } catch (Exception e) {
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
// continue;
// }
//
// if (!update) {
// log.info("更新人像信息失败:{}-----{}", person.getName(), person.getId());
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
// continue;
// }
// 计算图片MD5
String nowMd5 = calculateMD5(imgByte);
// 通过MD5查询相同图片
Long remoteId = remoteSisAuthService.queryHuaweiBoxIdByImgMd5(nowMd5);
Long huaweiId;
if (remoteId == null) {
// 当前本地人像信息不存在相同照片,直接上传华为盒子
huaweiId = syncHuaweiBox(person, imgByte);
} else {
huaweiId = remoteId;
}
if (huaweiId == null) {
log.info("华为盒子人像上传失败:{}-----{}", person.getName(), person.getId());
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
continue;
}
Boolean update;
try {
update = remoteSisAuthService.updateImgByPersonId(person.getId(), huaweiId, nowMd5);
} catch (Exception e) {
log.info("更新人像信息出错:{}-----{}", person.getName(), person.getId());
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
continue;
}
if (!update) {
log.info("更新人像信息失败:{}-----{}", person.getName(), person.getId());
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
continue;
}
// 黑名单不授权到E8
if (!Objects.equals(person.getRosterType(), RosterTypeEnum.BLACK_LIST.getCode())) {