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