refactor(sis):
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
- E8平台授权逻辑调整
This commit is contained in:
parent
baf9502b61
commit
a065d72724
@ -11,12 +11,12 @@ import lombok.Data;
|
||||
public class AuthDoorDeviceFindRes {
|
||||
|
||||
/**
|
||||
* id
|
||||
* 门id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* deviceId
|
||||
* 门禁Id
|
||||
*/
|
||||
private Long deviceId;
|
||||
}
|
||||
|
@ -149,7 +149,6 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
|
||||
Assert.notEmpty(acList, "门禁设备不存在!");
|
||||
|
||||
|
||||
|
||||
try {
|
||||
log.info("开始对宇视盒子下发照片,图片:{}、设备:{}", bo.getImgIds(), eqpIds);
|
||||
for (SisPersonLibImgVo imgVo : imgList) {
|
||||
@ -239,36 +238,40 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
|
||||
log.info("E8平台发行凭证完成!");
|
||||
|
||||
log.info("E8平台授权凭证");
|
||||
// 查询所有e8设备并分组
|
||||
List<AuthDoorDeviceFindRes> authDoor = e8DoorDeviceService.getPageAuthDoorDeviceList();
|
||||
Map<Long, AuthDoorDeviceFindRes> authDoorMap = authDoor.stream().collect(Collectors.toMap(AuthDoorDeviceFindRes::getDeviceId, authDoorRes -> authDoorRes));
|
||||
// 查询E8授权门列表
|
||||
List<AuthDoorDeviceFindRes> authDoorList = e8DoorDeviceService.getPageAuthDoorDeviceList();
|
||||
Assert.notEmpty(authDoorList, "E8平台授权门列表为空");
|
||||
|
||||
// E8 授权列表
|
||||
List<CustomerAuthAddReq.AuthGroupData> authList = new ArrayList<>(acList.size());
|
||||
// 授权记录
|
||||
List<SisAuthRecord> recordList = new ArrayList<>(acList.size());
|
||||
// E8授权门
|
||||
AuthDoorDeviceFindRes authDoor = null;
|
||||
for (SisAccessControlVo sisAccessControlVo : acList) {
|
||||
if (sisAccessControlVo.getControlType() != 1 && sisAccessControlVo.getAccessType() != 2) {
|
||||
SisAuthRecord authRecord = new SisAuthRecord();
|
||||
|
||||
// 通过门禁ID匹配授权门
|
||||
authDoor = authDoorList.stream().filter(item -> item.getDeviceId() == Long.parseLong(sisAccessControlVo.getOutCode())).findFirst().orElse(null);
|
||||
|
||||
if (authDoor != null) {
|
||||
CustomerAuthAddReq.AuthGroupData door = new CustomerAuthAddReq.AuthGroupData();
|
||||
door.setType(0);
|
||||
door.setGatewayType(1);
|
||||
Long id = Long.parseLong(sisAccessControlVo.getOutCode());
|
||||
door.setId(id);
|
||||
// E8授权传入ID为门ID,非门禁ID
|
||||
door.setId(authDoor.getId());
|
||||
authList.add(door);
|
||||
|
||||
authRecord.setDoorId(id);
|
||||
// 如果 authDoorMap 中存在对应的 deviceId,则更新 id
|
||||
AuthDoorDeviceFindRes authDoorRes = authDoorMap.get(id);
|
||||
if (authDoorRes != null) {
|
||||
door.setId(authDoorRes.getId());
|
||||
authRecord.setDeviceId(authDoorRes.getDeviceId());
|
||||
}
|
||||
SisAuthRecord authRecord = new SisAuthRecord();
|
||||
authRecord.setDoorId(authDoor.getId());
|
||||
authRecord.setDeviceId(authDoor.getDeviceId());
|
||||
authRecord.setLibId(imgVo.getLibId());
|
||||
authRecord.setImgId(imgVo.getId());
|
||||
authRecord.setAcId(sisAccessControlVo.getId());
|
||||
recordList.add(authRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomerAuthAddReq authReq = new CustomerAuthAddReq();
|
||||
authReq.setAuthType(0);
|
||||
|
Loading…
Reference in New Issue
Block a user