bug修改
This commit is contained in:
parent
f6f7b7b76c
commit
dca25fc2ff
@ -126,27 +126,33 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
ProjectUfaceConfig tempProjectUfaceConfig = projectUfaceConfigMapper.selectOne(queryWrapper);
|
||||
//判断是否配置并下发设备
|
||||
if (tempProjectUfaceConfig != null && tempProjectUfaceConfig.getIssueDev() == 1) {
|
||||
String ufaceDevId = workerInfo.getUfaceDevId();
|
||||
if (tempProjectUfaceConfig.getSupplierType() == 9) {
|
||||
//isc设备
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("projectSn", workerInfo.getProjectSn());
|
||||
if ("0".equals(workerInfo.getUfaceDevId())) {
|
||||
if ("0".equals(ufaceDevId)) {
|
||||
workerInfo.setUfaceDevId(null);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(workerInfo.getUfaceDevId())) {
|
||||
if (StringUtils.isNotEmpty(ufaceDevId)) {
|
||||
param.put("registerType", workerInfo.getRegisterType());
|
||||
param.put("accountType", workerInfo.getAccountType());
|
||||
}
|
||||
param.put("accountType", 2);
|
||||
if (Objects.equals(workerInfo.getDevType(), 1)) {
|
||||
param.put("devIds", workerInfo.getUfaceDevId());
|
||||
if (StrUtil.isBlank(ufaceDevId)) {
|
||||
return;
|
||||
}
|
||||
param.put("devIds", ufaceDevId);
|
||||
} else if (Objects.equals(workerInfo.getDevType(), 2)) {
|
||||
//设备分组情况!
|
||||
String ufaceDevGroupId = workerInfo.getUfaceDevGroupId();
|
||||
if (StringUtils.isEmpty(ufaceDevGroupId)) {
|
||||
ufaceDevGroupId = "0";
|
||||
return;
|
||||
}
|
||||
List<Long> ufaceIds = ufaceDevToGroupMapper.selectList(new LambdaQueryWrapper<UfaceDevToGroup>()
|
||||
.in(UfaceDevToGroup::getUfaceDevGroupId, Arrays.asList(StringUtils.split(ufaceDevGroupId, ",")))).stream().map(UfaceDevToGroup::getUfaceDevId).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(ufaceIds)) {
|
||||
ufaceIds.add(0L);
|
||||
return;
|
||||
}
|
||||
ufaceIds.stream().distinct();
|
||||
param.put("devIds", StringUtils.join(ufaceIds, ","));
|
||||
@ -167,6 +173,34 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
}
|
||||
sendDev(tempProjectUfaceConfig, workerInfo, devBuilder.toString(), devIdBuilder.toString());
|
||||
}
|
||||
} else {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("projectSn", workerInfo.getProjectSn());
|
||||
if ("0".equals(ufaceDevId)) {
|
||||
workerInfo.setUfaceDevId(null);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(ufaceDevId)) {
|
||||
param.put("registerType", workerInfo.getRegisterType());
|
||||
param.put("accountType", workerInfo.getAccountType());
|
||||
param.put("devIds", ufaceDevId);
|
||||
}
|
||||
List<UfaceDev> list = ufaceDevMapper.selectUserUfaceDevList(param);
|
||||
if (list != null && list.size() > 0) {
|
||||
StringBuilder devBuilder = new StringBuilder();
|
||||
StringBuilder devIdBuilder = new StringBuilder();
|
||||
for (UfaceDev dev : list) {
|
||||
if (devBuilder.length() > 0) {
|
||||
devBuilder.append(",");
|
||||
}
|
||||
if (devIdBuilder.length() > 0) {
|
||||
devIdBuilder.append(",");
|
||||
}
|
||||
devBuilder.append(dev.getDevSn());
|
||||
devIdBuilder.append(dev.getDeviceId());
|
||||
}
|
||||
sendDev(tempProjectUfaceConfig, workerInfo, devBuilder.toString(), devIdBuilder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,6 +240,64 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
ProjectUfaceConfig tempProjectUfaceConfig = projectUfaceConfigMapper.selectOne(queryWrapper);
|
||||
//判断是否配置并下发设备
|
||||
if (tempProjectUfaceConfig != null && tempProjectUfaceConfig.getIssueDev() == 1) {
|
||||
if (tempProjectUfaceConfig.getSupplierType() == 9) {
|
||||
//海康门禁isc
|
||||
String devSns = "";
|
||||
String notDevSns = "";
|
||||
if (Objects.equals(workerInfo.getDevType(), 1)) {
|
||||
devSns = workerInfo.getUfaceDevId();
|
||||
if (StrUtil.isNotBlank(devSns)) {
|
||||
List<UfaceDev> existList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn())
|
||||
.in(UfaceDev::getId, StrUtil.split(devSns, ","))
|
||||
);
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn())
|
||||
.notIn(UfaceDev::getId, StrUtil.split(devSns, ","))
|
||||
);
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(existList)) {
|
||||
devSns = StrUtil.join(",", existList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.addPersonAuth(workerInfo, devSns);
|
||||
}
|
||||
} else {
|
||||
//只删除
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn()));
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(workerInfo.getDevType(), 2)) {
|
||||
//设备分组情况!
|
||||
String ufaceDevGroupId = workerInfo.getUfaceDevGroupId();
|
||||
if (StrUtil.isNotBlank(ufaceDevGroupId)) {
|
||||
List<UfaceDev> listForIsc = ufaceDevMapper.getUfaceDevListForIsc(StrUtil.split(ufaceDevGroupId, ","), workerInfo.getProjectSn());
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.getUfaceDevListForIscNotExist(StrUtil.split(ufaceDevGroupId, ","), workerInfo.getProjectSn());
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(listForIsc)) {
|
||||
devSns = StrUtil.join(",", listForIsc.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.addPersonAuth(workerInfo, devSns);
|
||||
}
|
||||
} else {
|
||||
//只删除
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn())
|
||||
);
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("projectSn", workerInfo.getProjectSn());
|
||||
log.info("---新数据:" + workerInfo.getUfaceDevId() + "-----老数据:" + oldWorkerInfo.getUfaceDevId());
|
||||
@ -272,63 +364,6 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tempProjectUfaceConfig.getSupplierType() == 9) {
|
||||
//海康门禁isc
|
||||
String devSns = "";
|
||||
String notDevSns = "";
|
||||
if (Objects.equals(workerInfo.getDevType(), 1)) {
|
||||
devSns = workerInfo.getUfaceDevId();
|
||||
if (StrUtil.isNotBlank(devSns)) {
|
||||
List<UfaceDev> existList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn())
|
||||
.in(UfaceDev::getId, StrUtil.split(devSns, ","))
|
||||
);
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn())
|
||||
.notIn(UfaceDev::getId, StrUtil.split(devSns, ","))
|
||||
);
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(existList)) {
|
||||
devSns = StrUtil.join(",", existList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.addPersonAuth(workerInfo, devSns);
|
||||
}
|
||||
} else {
|
||||
//只删除
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.selectList(new LambdaQueryWrapper<UfaceDev>()
|
||||
.eq(UfaceDev::getProjectSn, workerInfo.getProjectSn()));
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(workerInfo.getDevType(), 2)) {
|
||||
//设备分组情况!
|
||||
String ufaceDevGroupId = workerInfo.getUfaceDevGroupId();
|
||||
if (StrUtil.isNotBlank(ufaceDevGroupId)) {
|
||||
List<UfaceDev> listForIsc = ufaceDevMapper.getUfaceDevListForIsc(StrUtil.split(ufaceDevGroupId, ","), workerInfo.getProjectSn());
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.getUfaceDevListForIscNotExist(StrUtil.split(ufaceDevGroupId, ","), workerInfo.getProjectSn());
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(listForIsc)) {
|
||||
devSns = StrUtil.join(",", listForIsc.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.addPersonAuth(workerInfo, devSns);
|
||||
}
|
||||
} else {
|
||||
//只删除
|
||||
List<UfaceDev> notExistList = ufaceDevMapper.getUfaceDevListForIscNotExist(StrUtil.split(ufaceDevGroupId, ","), workerInfo.getProjectSn());
|
||||
if (CollUtil.isNotEmpty(notExistList)) {
|
||||
notDevSns = StrUtil.join(",", notExistList.stream().map(UfaceDev::getDevSn).collect(Collectors.toList()));
|
||||
asyncHikvision.deletePersonAuth(workerInfo, notDevSns);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -388,6 +423,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("projectSn", workerInfo.getProjectSn());
|
||||
param.put("devIds", StringUtils.join(ufaceIds, ","));
|
||||
param.put("accountType", 2);
|
||||
List<UfaceDev> list1 = ufaceDevMapper.selectUserUfaceDevList(param);
|
||||
if (CollUtil.isEmpty(list1)) {
|
||||
return;
|
||||
|
||||
@ -135,19 +135,20 @@
|
||||
separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and ud.project_sn =#{projectSn}
|
||||
</select>
|
||||
<select id="getUfaceDevListForIscNotExist" resultType="com.zhgd.xmgl.modules.worker.entity.UfaceDev">
|
||||
select distinct ud.* from uface_dev ud
|
||||
LEFT join uface_dev_to_group udtg on ud.id = udtg.uface_dev_id
|
||||
where (1=1
|
||||
where 1=1
|
||||
<if test="list != null">
|
||||
and udtg.uface_dev_group_id not in
|
||||
and (udtg.uface_dev_group_id not in
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
OR udtg.id is null)
|
||||
</if>
|
||||
and ud.project_sn =#{projectSn}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user