海康门禁sdk对接
This commit is contained in:
parent
c4778e30c9
commit
b07b6fe9bd
@ -192,6 +192,9 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
} else if (tempProjectUfaceConfig.getSupplierType() == 6) {
|
||||
//佳信捷新设备
|
||||
JxjNewUfaceDevUtil.deleteWorkerInfo(workerInfo, tempProjectUfaceConfig);
|
||||
} else if (tempProjectUfaceConfig.getSupplierType() == 7) {
|
||||
//海康门禁sdk
|
||||
HikvisionUfaceUtil.deletePerson(workerInfo, tempProjectUfaceConfig, workerInfo.getUfaceDevId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -207,7 +210,10 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("projectSn", workerInfo.getProjectSn());
|
||||
log.info("---新数据:" + workerInfo.getUfaceDevId() + "-----老数据:" + oldWorkerInfo.getUfaceDevId());
|
||||
//有选择设备
|
||||
Boolean hasDev = true;
|
||||
if (StringUtils.isEmpty(workerInfo.getUfaceDevId())) {
|
||||
hasDev = false;
|
||||
workerInfo.setUfaceDevId(oldWorkerInfo.getUfaceDevId());
|
||||
}
|
||||
if ("0".equals(workerInfo.getUfaceDevId())) {
|
||||
@ -262,6 +268,12 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
|
||||
} else if (tempProjectUfaceConfig.getSupplierType() == 6) {
|
||||
//佳信捷新设备
|
||||
JxjNewUfaceDevUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, basePath, devBuilder.toString(), jxjDevImageType);
|
||||
} else if (tempProjectUfaceConfig.getSupplierType() == 7) {
|
||||
//海康门禁sdk
|
||||
HikvisionUfaceUtil.deletePerson(workerInfo, tempProjectUfaceConfig, oldWorkerInfo.getUfaceDevId());
|
||||
if (hasDev) {
|
||||
HikvisionUfaceUtil.addOrUpdatePerson(workerInfo, tempProjectUfaceConfig, devBuilder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.util.SpringContextUtils;
|
||||
import com.zhgd.mqtt.server.IMqttSender;
|
||||
import com.zhgd.xmgl.modules.bigdevice.entity.dto.LifterDataInfoDTO;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -19,16 +17,54 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
public class HikvisionUfaceUtil {
|
||||
private static String mqttTopic = "hikvision/uface/worker/";
|
||||
|
||||
/**
|
||||
* 添加人员
|
||||
*
|
||||
* @param workerInfo
|
||||
* @param tempProjectUfaceConfig
|
||||
* @param devSn
|
||||
*/
|
||||
public static void addOrUpdatePerson(WorkerInfo workerInfo, ProjectUfaceConfig tempProjectUfaceConfig, String devSn) {
|
||||
if (StrUtil.isNotBlank(devSn)) {
|
||||
Map<String, Object> map = BeanUtil.beanToMap(workerInfo);
|
||||
map.put("isDelete", false);
|
||||
String payload = JSON.toJSONString(map);
|
||||
String topic = "";
|
||||
log.info("发送主题信息:{},主题为:{}", payload, topic);
|
||||
IMqttSender mqttSender = SpringContextUtils.getBean(IMqttSender.class);
|
||||
mqttSender.sendToMqtt(topic, 2, payload);
|
||||
String[] splitArr = StringUtils.split(devSn, ",");
|
||||
for (int i = 0; i < splitArr.length; i++) {
|
||||
String ds = splitArr[i];
|
||||
Map<String, Object> map = BeanUtil.beanToMap(workerInfo);
|
||||
map.put("isDelete", false);
|
||||
map.put("devSn", ds);
|
||||
String payload = JSON.toJSONString(map);
|
||||
String topic = mqttTopic + ds;
|
||||
log.info("发送主题信息:{},主题为:{}", payload, topic);
|
||||
IMqttSender mqttSender = SpringContextUtils.getBean(IMqttSender.class);
|
||||
mqttSender.sendToMqtt(topic, 2, payload);
|
||||
}
|
||||
} else {
|
||||
log.info("海康门禁sdk,未查询到设备sn");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人员
|
||||
*
|
||||
* @param workerInfo
|
||||
* @param tempProjectUfaceConfig
|
||||
*/
|
||||
public static void deletePerson(WorkerInfo workerInfo, ProjectUfaceConfig tempProjectUfaceConfig, String devSn) {
|
||||
if (StrUtil.isNotBlank(devSn)) {
|
||||
String[] splitArr = StringUtils.split(devSn, ",");
|
||||
for (int i = 0; i < splitArr.length; i++) {
|
||||
String ds = splitArr[i];
|
||||
Map<String, Object> map = BeanUtil.beanToMap(workerInfo);
|
||||
map.put("isDelete", true);
|
||||
map.put("devSn", ds);
|
||||
String payload = JSON.toJSONString(map);
|
||||
String topic = mqttTopic + ds;
|
||||
log.info("发送主题信息:{},主题为:{}", payload, topic);
|
||||
IMqttSender mqttSender = SpringContextUtils.getBean(IMqttSender.class);
|
||||
mqttSender.sendToMqtt(topic, 2, payload);
|
||||
}
|
||||
} else {
|
||||
log.error("海康门禁sdk,未查询到设备sn");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user