refactor(property): 优化人员导入和人脸上传功能
This commit is contained in:
@@ -61,7 +61,7 @@ public class AuthSyncTask {
|
||||
/**
|
||||
* 每两分钟执行一次
|
||||
*/
|
||||
@Scheduled(cron = "0 */2 * * * ?")
|
||||
@Scheduled(cron = "0 */5 * * * ?")
|
||||
public void autoAuth() {
|
||||
AtomicReference<List<RemoteResidentPersonVo>> unAuthPersonRef = new AtomicReference<>(new ArrayList<>());
|
||||
AtomicReference<byte[]> imgByteRef = new AtomicReference<>(new byte[0]);
|
||||
@@ -81,43 +81,44 @@ public class AuthSyncTask {
|
||||
// 判断是否已存在授权
|
||||
SisAuthRecordVo authRecord = sisAuthRecordService.queryByGroupIdAndPersonId(person.getAuthGroupId(), person.getId());
|
||||
if (ObjectUtil.isEmpty(authRecord)) {
|
||||
// 无授权记录时,补录
|
||||
log.info("无授权记录:{}", person.getId());
|
||||
this.syncAuthRecord(person);
|
||||
|
||||
imgByteRef.set(remoteFileService.downloadToByteArray(Long.parseLong(person.getOssId())));
|
||||
// 读取人像
|
||||
byte[] imgByte = imgByteRef.get();
|
||||
if (imgByte == null) continue;
|
||||
|
||||
// String nowMd5 = this.calculateMD5(imgByte);
|
||||
// SisPersonLibImgVo imgVo = sisPersonLibImgService.queryByImgMd5(nowMd5);
|
||||
//
|
||||
// Long huaweiId;
|
||||
// Boolean update;
|
||||
// if (ObjectUtil.isEmpty(imgVo)) {
|
||||
// // 写入华为盒子
|
||||
// huaweiId = syncHuaweiBox(person, imgByte);
|
||||
// } else {
|
||||
// if (imgVo.getRemoteImgId() == null) {
|
||||
// huaweiId = syncHuaweiBox(person, imgByte);
|
||||
// } else {
|
||||
// huaweiId = imgVo.getRemoteImgId();
|
||||
// }
|
||||
// }
|
||||
// if (huaweiId == null) continue;
|
||||
//
|
||||
// // 更新人像信息huaweiBoxId
|
||||
// update = sisPersonLibImgService.updateByPersonId(person.getId(), huaweiId, nowMd5);
|
||||
// if (!update) continue;
|
||||
|
||||
// 同步E8平台
|
||||
Long e8Id = syncE8Plat(person, imgByte);
|
||||
if (e8Id == null) continue;
|
||||
|
||||
// 更新入驻员工E8平台id
|
||||
remoteResidentPersonService.updateE8Id(person.getId(), e8Id);
|
||||
}else{
|
||||
log.info("已存在授权记录:{}", person.getId());
|
||||
}
|
||||
|
||||
imgByteRef.set(remoteFileService.downloadToByteArray(Long.parseLong(person.getOssId())));
|
||||
// 读取人像
|
||||
byte[] imgByte = imgByteRef.get();
|
||||
if (imgByte == null) continue;
|
||||
|
||||
String nowMd5 = this.calculateMD5(imgByte);
|
||||
SisPersonLibImgVo imgVo = sisPersonLibImgService.queryByImgMd5(nowMd5);
|
||||
|
||||
Long huaweiId;
|
||||
Boolean update;
|
||||
if (ObjectUtil.isEmpty(imgVo)) {
|
||||
// 写入华为盒子
|
||||
huaweiId = syncHuaweiBox(person, imgByte);
|
||||
} else {
|
||||
if (imgVo.getRemoteImgId() == null) {
|
||||
huaweiId = syncHuaweiBox(person, imgByte);
|
||||
} else {
|
||||
huaweiId = imgVo.getRemoteImgId();
|
||||
}
|
||||
}
|
||||
if (huaweiId == null) continue;
|
||||
|
||||
// 更新人像信息huaweiBoxId
|
||||
update = sisPersonLibImgService.updateByPersonId(person.getId(), huaweiId, nowMd5);
|
||||
if (!update) continue;
|
||||
|
||||
// 同步E8平台
|
||||
Long e8Id = syncE8Plat(person, imgByte);
|
||||
if (e8Id == null) continue;
|
||||
|
||||
// 更新入驻员工E8平台id
|
||||
remoteResidentPersonService.updateE8Id(person.getId(), e8Id);
|
||||
|
||||
}
|
||||
} else {
|
||||
log.info("无待授权人员");
|
||||
|
Reference in New Issue
Block a user