37 lines
1.3 KiB
Java
37 lines
1.3 KiB
Java
|
|
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 java.util.Map;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 海康门禁sdk
|
|||
|
|
*/
|
|||
|
|
@Slf4j
|
|||
|
|
public class HikvisionUfaceUtil {
|
|||
|
|
|
|||
|
|
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);
|
|||
|
|
} else {
|
|||
|
|
log.error("海康门禁sdk,未查询到设备sn");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|