feat(sis): 支持黑名单人员管理

- 新增人员标签类型字段,用于区分红名单、白名单和黑名单
- 修改授权逻辑,黑名单人员不进行授权记录和E8平台同步
- 优化定时任务,对不同名单类型的人员进行差异化处理
- 增加黑名单人员入内的告警功能
This commit is contained in:
2025-08-07 22:34:06 +08:00
parent 1c23320f5a
commit e3867b7a12
19 changed files with 207 additions and 78 deletions

View File

@@ -34,4 +34,6 @@ public class RemoteResidentPersonVo implements Serializable {
private Date authBegDate; private Date authBegDate;
private Date authEndDate; private Date authEndDate;
private Integer rosterType;
} }

View File

@@ -38,12 +38,12 @@ public interface RemoteSisAuthService {
Boolean queryPersonAuth(Long authGroupId, Long personId); Boolean queryPersonAuth(Long authGroupId, Long personId);
/** /**
* 通过MD5查询图片id * 通过MD5查询华为盒子id
* *
* @param imgMd5 图片MD5 * @param imgMd5 图片MD5
* @return Long * @return Long
*/ */
Long queryImgIdByImgMd5(String imgMd5); Long queryHuaweiBoxIdByImgMd5(String imgMd5);
/** /**
* 图片写入华为盒子 * 图片写入华为盒子

View File

@@ -43,4 +43,6 @@ public class RemotePersonAuth implements Serializable {
private Date authEndDate; private Date authEndDate;
private Integer rosterType;
} }

View File

@@ -108,6 +108,12 @@ public class ResidentPerson extends TenantEntity {
* e8平台id * e8平台id
*/ */
private Long eEightId; private Long eEightId;
/**
* 人员标签类型
*/
private Integer rosterType;
/** /**
* 创建人id * 创建人id
*/ */

View File

@@ -121,5 +121,10 @@ public class ResidentPersonBo extends BaseEntity {
*/ */
private String remark; private String remark;
/**
* 人员标签类型
*/
private Integer rosterType = 2;
} }

View File

@@ -138,5 +138,10 @@ public class ResidentPersonVo implements Serializable {
*/ */
private String idCard; private String idCard;
/**
* 人员标签类型
*/
private Integer rosterType;
} }

View File

@@ -35,6 +35,7 @@ public class RemoteResidentPersonServiceImpl implements RemoteResidentPersonServ
remoteResidentPersonVo.setName(vo.getUserName()); remoteResidentPersonVo.setName(vo.getUserName());
remoteResidentPersonVo.setIdCard(vo.getIdCard()); remoteResidentPersonVo.setIdCard(vo.getIdCard());
remoteResidentPersonVo.setGender(vo.getGender()); remoteResidentPersonVo.setGender(vo.getGender());
remoteResidentPersonVo.setRosterType(vo.getRosterType());
remoteResidentPersonVo.setAuthGroupId(vo.getAuthGroupId()); remoteResidentPersonVo.setAuthGroupId(vo.getAuthGroupId());
remoteResidentPersonVo.setAuthBegDate(vo.getAuthBegDate()); remoteResidentPersonVo.setAuthBegDate(vo.getAuthBegDate());
remoteResidentPersonVo.setAuthEndDate(vo.getAuthEndDate()); remoteResidentPersonVo.setAuthEndDate(vo.getAuthEndDate());

View File

@@ -140,31 +140,26 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
ResidentPerson update = MapstructUtils.convert(bo, ResidentPerson.class); ResidentPerson update = MapstructUtils.convert(bo, ResidentPerson.class);
assert update != null; assert update != null;
boolean flag;
// 人脸照片存在时,才同步修改授权 // 人脸照片存在时,才同步修改授权
if (update.getAuthGroupId() != null && update.getAuthEndDate() != null && update.getImg() != null) { if (update.getAuthGroupId() != null && update.getAuthEndDate() != null && update.getImg() != null) {
ResidentPersonVo vo = queryById(update.getId()); ResidentPersonVo vo = queryById(update.getId());
Long e8Id = vo.getEEightId(); Long e8Id = vo.getEEightId();
baseMapper.updateById(update);
// 显式移除e8id // 显式移除e8id
LambdaUpdateWrapper<ResidentPerson> lqw = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<ResidentPerson> lqw = new LambdaUpdateWrapper<>();
lqw.eq(ResidentPerson::getId, update.getId()) lqw.eq(ResidentPerson::getId, update.getId())
.set(ResidentPerson::getEEightId, null); .set(ResidentPerson::getEEightId, null);
flag = baseMapper.update(lqw) > 0; boolean check = baseMapper.update(lqw) > 0;
if (check && e8Id != null) {
if (flag && e8Id != null) {
log.info("开始修改授权记录, {}", bo.getUserName()); log.info("开始修改授权记录, {}", bo.getUserName());
// 先删除,定时任务增加 // 先删除,定时任务增加
Boolean auth = remoteSisAuthService.deletePersonAuth(List.of(update.getId()), List.of(e8Id)); Boolean auth = remoteSisAuthService.deletePersonAuth(List.of(update.getId()), List.of(e8Id));
Assert.isTrue(auth, "修改授权记录失败!"); Assert.isTrue(auth, "修改授权记录失败!");
} }
} else {
flag = baseMapper.updateById(update) > 0;
} }
boolean flag = baseMapper.updateById(update) > 0;
Assert.isTrue(flag, "修改入驻员工失败!"); Assert.isTrue(flag, "修改入驻员工失败!");
return flag; return flag;
} }

View File

@@ -83,4 +83,9 @@ public class SisPersonLibImg extends TenantEntity {
*/ */
private String imgMd5Value; private String imgMd5Value;
/**
* 人员标签
*/
private Integer rosterType;
} }

View File

@@ -91,4 +91,9 @@ public class SisPersonLibImgBo extends BaseEntity {
*/ */
private String imgMd5Value; private String imgMd5Value;
/**
* 人员标签
*/
private Integer rosterType;
} }

View File

@@ -0,0 +1,32 @@
package org.dromara.sis.domain.enums;
import lombok.Getter;
/**
* @author lsm
* @apiNote RosterTypeEnum
* @since 2025/8/7
*/
@Getter
public enum RosterTypeEnum {
/**
* 红名单
*/
RED_LIST(1),
/**
* 白名单
*/
WHITE_LIST(2),
/**
* 黑名单名单
*/
BLACK_LIST(3);
private final Integer code;
RosterTypeEnum(Integer code) {
this.code = code;
}
}

View File

@@ -62,5 +62,9 @@ public class SisAuthRecordVo implements Serializable {
@ExcelProperty(value = "结束时间") @ExcelProperty(value = "结束时间")
private Date endDate; private Date endDate;
/**
* 人员标签
*/
private Integer rosterType;
} }

View File

@@ -102,4 +102,10 @@ public class SisPersonLibImgVo implements Serializable {
*/ */
@ExcelProperty(value = "图片MD5") @ExcelProperty(value = "图片MD5")
private String imgMd5Value; private String imgMd5Value;
/**
* 人员标签
*/
@ExcelProperty(value = "人员标签")
private Integer rosterType;
} }

View File

@@ -85,15 +85,15 @@ public class RemoteSisAuthServiceImpl implements RemoteSisAuthService {
} }
/** /**
* 通过MD5查询图片id * 通过MD5查询华为盒子id
* *
* @param imgMd5 图片MD5 * @param imgMd5 图片MD5
* @return Long * @return Long
*/ */
@Override @Override
public Long queryImgIdByImgMd5(String imgMd5) { public Long queryHuaweiBoxIdByImgMd5(String imgMd5) {
SisPersonLibImgVo vo = sisPersonLibImgService.queryByImgMd5(imgMd5); SisPersonLibImgVo vo = sisPersonLibImgService.queryByImgMd5(imgMd5);
return vo != null ? vo.getId() : null; return vo != null ? vo.getRemoteImgId() : null;
} }
/** /**
@@ -118,6 +118,7 @@ public class RemoteSisAuthServiceImpl implements RemoteSisAuthService {
pId = huaWeiBoxApi.addPerson(List.of(req)); pId = huaWeiBoxApi.addPerson(List.of(req));
} catch (Exception e) { } catch (Exception e) {
log.error("同步华为盒子失败:{}----{}", person.getName(), person.getId());
return null; return null;
} }
return pId; return pId;
@@ -152,7 +153,7 @@ public class RemoteSisAuthServiceImpl implements RemoteSisAuthService {
try { try {
log.info("e8平台上传照片"); log.info("e8平台上传照片");
String e8ImgUrl = e8PlatformApi.uploadFace(imgByte); String e8ImgUrl = e8PlatformApi.uploadFace(imgByte);
Assert.notNull(e8ImgUrl, "图片上传E8平台失败"); Assert.notNull(e8ImgUrl, "图片上传E8平台失败" + person.getName() + "----" + person.getId());
log.info("e8平台上传照片完成"); log.info("e8平台上传照片完成");
count++; // 图片上传完成步进器+1 count++; // 图片上传完成步进器+1
@@ -161,7 +162,7 @@ public class RemoteSisAuthServiceImpl implements RemoteSisAuthService {
req.setName(person.getName()); req.setName(person.getName());
req.setGender(person.getSex() != 1 ? 0 : 1); req.setGender(person.getSex() != 1 ? 0 : 1);
e8Id = e8PlatformApi.addCustomer(req).getId(); e8Id = e8PlatformApi.addCustomer(req).getId();
Assert.notNull(e8Id, "e8同步新建人员失败"); Assert.notNull(e8Id, "e8同步新建人员失败" + person.getName() + "----" + person.getId());
log.info("e8同步新建人员完成"); log.info("e8同步新建人员完成");
count++; // 新增人员完成步进器+1 count++; // 新增人员完成步进器+1
@@ -172,7 +173,7 @@ public class RemoteSisAuthServiceImpl implements RemoteSisAuthService {
voucherReq.setTxtData(e8ImgUrl); voucherReq.setTxtData(e8ImgUrl);
voucherReq.setCardType(34); voucherReq.setCardType(34);
Long voucherId = e8PlatformApi.issueVoucher(voucherReq); Long voucherId = e8PlatformApi.issueVoucher(voucherReq);
Assert.notNull(voucherId, "e8平台发行凭证失败"); Assert.notNull(voucherId, "e8平台发行凭证失败" + person.getName() + "----" + person.getId());
log.info("e8平台发行凭证成功"); log.info("e8平台发行凭证成功");
count++; // 发行凭证完成步进器+1 count++; // 发行凭证完成步进器+1
@@ -199,11 +200,12 @@ public class RemoteSisAuthServiceImpl implements RemoteSisAuthService {
log.info("e8平台开始授权"); log.info("e8平台开始授权");
Boolean flag = e8PlatformApi.addCustomerAuth(authReq); Boolean flag = e8PlatformApi.addCustomerAuth(authReq);
Assert.isTrue(flag, "E8平台授权失败"); Assert.isTrue(flag, "E8平台授权失败" + person.getName() + "----" + person.getId());
log.info("E8平台授权完成!"); log.info("E8平台授权完成!");
count++; // 授权完成步进器+1 count++; // 授权完成步进器+1
} }
} catch (Exception e) { } catch (Exception e) {
log.info(e.getMessage());
return null; return null;
} }

View File

@@ -18,6 +18,7 @@ import org.dromara.sis.api.domain.RemotePersonAuth;
import org.dromara.sis.domain.bo.SisAccessControlBo; import org.dromara.sis.domain.bo.SisAccessControlBo;
import org.dromara.sis.domain.bo.SisElevatorInfoBo; import org.dromara.sis.domain.bo.SisElevatorInfoBo;
import org.dromara.sis.domain.bo.SisPersonLibImgBo; import org.dromara.sis.domain.bo.SisPersonLibImgBo;
import org.dromara.sis.domain.enums.RosterTypeEnum;
import org.dromara.sis.domain.vo.SisAccessControlVo; import org.dromara.sis.domain.vo.SisAccessControlVo;
import org.dromara.sis.domain.vo.SisElevatorInfoVo; import org.dromara.sis.domain.vo.SisElevatorInfoVo;
import org.dromara.sis.domain.vo.SisPersonLibImgVo; import org.dromara.sis.domain.vo.SisPersonLibImgVo;
@@ -115,6 +116,8 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean insertByPerson(RemotePersonAuth bo) { public Boolean insertByPerson(RemotePersonAuth bo) {
// 黑名单不加授权记录
if (!Objects.equals(bo.getRosterType(), RosterTypeEnum.BLACK_LIST.getCode())) {
SisAuthRecord add = new SisAuthRecord(); SisAuthRecord add = new SisAuthRecord();
add.setTargetType(1L); add.setTargetType(1L);
add.setTargetId(bo.getId()); add.setTargetId(bo.getId());
@@ -124,21 +127,23 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
add.setTenantId("000000"); add.setTenantId("000000");
boolean flag = baseMapper.insert(add) > 0; boolean flag = baseMapper.insert(add) > 0;
Assert.isTrue(flag, "新增授权记录失败"); Assert.isTrue(flag, "新增授权记录失败");
}
try { try {
// 记录图片md5值 // 记录图片md5值
byte[] imgByte = remoteFileService.downloadToByteArray(Long.parseLong(bo.getOssId())); byte[] imgByte = remoteFileService.downloadToByteArray(Long.parseLong(bo.getOssId()));
String md5 = calculateMD5(imgByte); String md5 = calculateMD5(imgByte);
// 写入安防人像信息 // 写入安防人像信息
this.syncPersonImg(bo, md5); Boolean sync = this.syncPersonImg(bo, md5);
Assert.isTrue(sync, "写入安防人像信息失败");
} catch (Exception e) { } catch (Exception e) {
log.info("下载图片失败"); log.info(e.getMessage());
} }
return flag; return true;
} }
private void syncPersonImg(RemotePersonAuth bo, String md5) { private Boolean syncPersonImg(RemotePersonAuth bo, String md5) {
log.info("开始写入安防人像信息"); log.info("开始写入安防人像信息");
SisPersonLibImgBo personLibImg = new SisPersonLibImgBo(); SisPersonLibImgBo personLibImg = new SisPersonLibImgBo();
personLibImg.setImgOssId(Long.parseLong(bo.getOssId())); personLibImg.setImgOssId(Long.parseLong(bo.getOssId()));
@@ -149,8 +154,10 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
personLibImg.setCertificateNo(bo.getIdCardNumber()); personLibImg.setCertificateNo(bo.getIdCardNumber());
personLibImg.setResidentPersonId(bo.getId()); personLibImg.setResidentPersonId(bo.getId());
personLibImg.setImgMd5Value(md5); personLibImg.setImgMd5Value(md5);
sisPersonLibImgService.insertByBo(personLibImg); personLibImg.setRosterType(bo.getRosterType());
log.info("写入安防人像信息完成"); Boolean flag = sisPersonLibImgService.insertByBo(personLibImg);
if (flag) log.info("写入安防人像信息完成");
return flag;
} }
/** /**
@@ -352,10 +359,8 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
public Boolean deleteByPersonIds(Collection<Long> ids, Collection<Long> e8Ids) { public Boolean deleteByPersonIds(Collection<Long> ids, Collection<Long> e8Ids) {
LambdaQueryWrapper<SisAuthRecord> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SisAuthRecord> lqw = new LambdaQueryWrapper<>();
lqw.in(SisAuthRecord::getTargetId, ids); lqw.in(SisAuthRecord::getTargetId, ids);
boolean flag = baseMapper.delete(lqw) > 0; baseMapper.delete(lqw);
Assert.isTrue(flag, "删除授权记录失败");
if (flag) {
List<SisPersonLibImgVo> list = new ArrayList<>(); List<SisPersonLibImgVo> list = new ArrayList<>();
ids.forEach(id -> { ids.forEach(id -> {
SisPersonLibImgVo imgVo = sisPersonLibImgService.queryByPersonId(id); SisPersonLibImgVo imgVo = sisPersonLibImgService.queryByPersonId(id);
@@ -364,16 +369,16 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
} }
}); });
Collection<Long> imgIds = list.stream().map(SisPersonLibImgVo::getId).toList(); Collection<Long> imgIds = list.stream().map(SisPersonLibImgVo::getId).toList();
if (CollUtil.isNotEmpty(imgIds)){ if (CollUtil.isNotEmpty(imgIds)) {
flag = sisPersonLibImgService.deleteWithValidByIds(imgIds, false); Boolean flag = sisPersonLibImgService.deleteWithValidByIds(imgIds, false);
Assert.isTrue(flag, "删除人像库图片失败"); Assert.isTrue(flag, "删除人像库图片失败");
} }
if (CollUtil.isNotEmpty(e8Ids)){ if (CollUtil.isNotEmpty(e8Ids)) {
e8Ids.forEach(e8PlatformApi::deleteCustomer); e8Ids.forEach(e8PlatformApi::deleteCustomer);
} }
}
return flag; return true;
} }
/** /**
@@ -382,7 +387,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
* @param groupIds 权限组IDs * @param groupIds 权限组IDs
*/ */
@Override @Override
public Boolean queryByGroupIds(Collection<Long> groupIds){ public Boolean queryByGroupIds(Collection<Long> groupIds) {
LambdaQueryWrapper<SisAuthRecord> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<SisAuthRecord> lqw = Wrappers.lambdaQuery();
lqw.in(SisAuthRecord::getGroupId, groupIds); lqw.in(SisAuthRecord::getGroupId, groupIds);
List<SisAuthRecordVo> authVoList = baseMapper.selectVoList(lqw); List<SisAuthRecordVo> authVoList = baseMapper.selectVoList(lqw);

View File

@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.property.api.RemoteFloorService; import org.dromara.property.api.RemoteFloorService;
import org.dromara.sis.domain.enums.RosterTypeEnum;
import org.dromara.sis.domain.vo.*; import org.dromara.sis.domain.vo.*;
import org.dromara.sis.producer.CleanLiftAuthRocketProducer; import org.dromara.sis.producer.CleanLiftAuthRocketProducer;
import org.dromara.sis.sdk.e8.E8PlatformApi; import org.dromara.sis.sdk.e8.E8PlatformApi;
@@ -70,6 +71,12 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer
// 不是内部人员 产生紧急的告警信息 // 不是内部人员 产生紧急的告警信息
alarmEventsService.createAlarmRecord(deviceIp, 1, 1, "陌生人员入内", smallImg, bigImg); alarmEventsService.createAlarmRecord(deviceIp, 1, 1, "陌生人员入内", smallImg, bigImg);
return; return;
}else {
if (Objects.equals(authRecord.getRosterType(), RosterTypeEnum.BLACK_LIST.getCode())) {
log.info("人员[{}]在黑名单中,暂不处理。", person);
alarmEventsService.createAlarmRecord(deviceIp, 3, 1, "黑名单人员入内", smallImg, bigImg);
return;
}
} }
Date now = new Date(); Date now = new Date();

View File

@@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="org.dromara.sis.mapper.SisAuthRecordMapper"> <mapper namespace="org.dromara.sis.mapper.SisAuthRecordMapper">
<select id="checkAuth" resultType="org.dromara.sis.domain.vo.SisAuthRecordVo"> <select id="checkAuth" resultType="org.dromara.sis.domain.vo.SisAuthRecordVo">
SELECT c.target_id, c.group_id, c.beg_date, c.end_date SELECT c.target_id, c.group_id, c.beg_date, c.end_date, a.roster_type
FROM sis_person_lib_img a FROM sis_person_lib_img a
LEFT JOIN resident_person b ON a.resident_person_id = b.id and b.state = 1 LEFT JOIN resident_person b ON a.resident_person_id = b.id and b.state = 1
LEFT JOIN sis_auth_record c LEFT JOIN sis_auth_record c

View File

@@ -0,0 +1,32 @@
package org.dromara.job.entity.enums;
import lombok.Getter;
/**
* @author lsm
* @apiNote RosterTypeEnum
* @since 2025/8/7
*/
@Getter
public enum RosterTypeEnum {
/**
* 红名单
*/
RED_LIST(1),
/**
* 白名单
*/
WHITE_LIST(2),
/**
* 黑名单名单
*/
BLACK_LIST(3);
private final Integer code;
RosterTypeEnum(Integer code) {
this.code = code;
}
}

View File

@@ -8,6 +8,7 @@ import com.aizuda.snailjob.client.job.core.dto.JobArgs;
import com.aizuda.snailjob.client.model.ExecuteResult; import com.aizuda.snailjob.client.model.ExecuteResult;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.job.entity.enums.RosterTypeEnum;
import org.dromara.property.api.RemoteResidentPersonService; import org.dromara.property.api.RemoteResidentPersonService;
import org.dromara.property.api.domain.vo.RemoteResidentPersonVo; import org.dromara.property.api.domain.vo.RemoteResidentPersonVo;
import org.dromara.resource.api.RemoteFileService; import org.dromara.resource.api.RemoteFileService;
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Component;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
/** /**
@@ -53,20 +55,9 @@ public class SyncGrantAuthTask {
try { try {
if (CollUtil.isNotEmpty(unAuthPerson)) { if (CollUtil.isNotEmpty(unAuthPerson)) {
for (RemoteResidentPersonVo person : unAuthPerson) { for (RemoteResidentPersonVo person : unAuthPerson) {
log.info("开始定时授权:{}----{}", person.getName(), person.getId());
// 判断是否存在授权 // 判断是否存在授权
Boolean auth = remoteSisAuthService.queryPersonAuth(person.getAuthGroupId(), person.getId()); Boolean auth = remoteSisAuthService.queryPersonAuth(person.getAuthGroupId(), person.getId());
if (!auth) { if (!auth) {
log.info("无授权记录:{}----{}", person.getName(), person.getId());
// 补录授权记录、人像信息
Boolean flag = syncAuthRecord(person);
if (!flag) {
log.info("补录授权记录、人像信息失败:{}----{}", person.getName(), person.getId());
continue;
}
// 下载人像 // 下载人像
byte[] imgByte; byte[] imgByte;
try { try {
@@ -78,10 +69,30 @@ public class SyncGrantAuthTask {
continue; continue;
} }
// 当前人员是黑名单
if (Objects.equals(person.getRosterType(), RosterTypeEnum.BLACK_LIST.getCode())) {
// 计算图片MD5
String nowMd5 = calculateMD5(imgByte);
// 通过MD5、入驻员工id查询相同图片
Long remoteId = remoteSisAuthService.queryHuaweiBoxIdByImgMd5(nowMd5);
// 人像信息已上传,跳过
if (remoteId != null) continue;
}
log.info("开始定时授权:{}----{}", person.getName(), person.getId());
// 补录授权记录、人像信息
Boolean flag = syncAuthRecord(person);
if (!flag) {
log.info("录入授权记录、人像信息失败:{}----{}", person.getName(), person.getId());
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
continue;
}
// // 计算图片MD5 // // 计算图片MD5
// String nowMd5 = calculateMD5(imgByte); // String nowMd5 = calculateMD5(imgByte);
// // 通过MD5查询相同图片 // // 通过MD5查询相同图片
// Long remoteId = remoteSisAuthService.queryImgIdByImgMd5(nowMd5); // Long remoteId = remoteSisAuthService.queryHuaweiBoxIdByImgMd5(nowMd5);
// //
// Long huaweiId; // Long huaweiId;
// if (remoteId == null) { // if (remoteId == null) {
@@ -102,6 +113,7 @@ public class SyncGrantAuthTask {
// update = remoteSisAuthService.updateImgByPersonId(person.getId(), huaweiId, nowMd5); // update = remoteSisAuthService.updateImgByPersonId(person.getId(), huaweiId, nowMd5);
// } catch (Exception e) { // } catch (Exception e) {
// remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>()); // remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
// continue;
// } // }
// //
// if (!update) { // if (!update) {
@@ -110,6 +122,8 @@ public class SyncGrantAuthTask {
// continue; // continue;
// } // }
// 黑名单不授权到E8
if (!Objects.equals(person.getRosterType(), RosterTypeEnum.BLACK_LIST.getCode())) {
// 同步人像到E8平台 // 同步人像到E8平台
Long e8Id = syncE8Plat(person, imgByte); Long e8Id = syncE8Plat(person, imgByte);
if (e8Id == null) { if (e8Id == null) {
@@ -117,11 +131,11 @@ public class SyncGrantAuthTask {
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>()); remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
continue; continue;
} }
// 更新入驻员工E8平台id // 更新入驻员工E8平台id
remoteResidentPersonService.updateE8Id(person.getId(), e8Id); remoteResidentPersonService.updateE8Id(person.getId(), e8Id);
}
} else { } else {
// 存在授权记录,为了避免重复授权,删除授权记录 // 存在授权记录,为了避免重复授权,删除授权记录,等待下次定时任务
remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>()); remoteSisAuthService.deletePersonAuth(List.of(person.getId()), new ArrayList<>());
} }
} }
@@ -144,14 +158,14 @@ public class SyncGrantAuthTask {
* @param person bean * @param person bean
*/ */
private Boolean syncAuthRecord(RemoteResidentPersonVo person) { private Boolean syncAuthRecord(RemoteResidentPersonVo person) {
log.info("开始录授权记录、人像信息:{}----{}", person.getName(), person.getId()); log.info("开始录授权记录、人像信息:{}----{}", person.getName(), person.getId());
RemotePersonAuth personAuth = getRemotePersonAuth(person); RemotePersonAuth personAuth = getRemotePersonAuth(person);
Boolean flag; Boolean flag;
try { try {
flag = remoteSisAuthService.personAuth(personAuth); flag = remoteSisAuthService.personAuth(personAuth);
if (flag) { if (flag) {
log.info("录授权记录、人像信息完成:{}----{}", person.getName(), person.getId()); log.info("授权记录、人像信息完成:{}----{}", person.getName(), person.getId());
} }
} catch (Exception e) { } catch (Exception e) {
return false; return false;
@@ -168,11 +182,12 @@ public class SyncGrantAuthTask {
personAuth.setOssId(person.getOssId()); personAuth.setOssId(person.getOssId());
personAuth.setName(person.getName()); personAuth.setName(person.getName());
personAuth.setPhone(person.getPhone()); personAuth.setPhone(person.getPhone());
personAuth.setSex(person.getGender().intValue());
personAuth.setIdCardNumber(person.getIdCard()); personAuth.setIdCardNumber(person.getIdCard());
personAuth.setSex(person.getGender().intValue());
personAuth.setAuthGroupId(person.getAuthGroupId()); personAuth.setAuthGroupId(person.getAuthGroupId());
personAuth.setAuthBegDate(person.getAuthBegDate()); personAuth.setAuthBegDate(person.getAuthBegDate());
personAuth.setAuthEndDate(person.getAuthEndDate()); personAuth.setAuthEndDate(person.getAuthEndDate());
personAuth.setRosterType(person.getRosterType());
return personAuth; return personAuth;
} }