正赢增加人脸心跳检测

This commit is contained in:
pengjie 2025-08-12 09:41:20 +08:00
parent 8ff888f270
commit 6ad362778a
4 changed files with 30 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package com.zhgd.mqtt.server;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zhgd.xmgl.modules.worker.service.IUfaceDevService;
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
import com.zhgd.xmgl.modules.xz.service.IXzHikvisionSyncService;
import net.sf.jsqlparser.statement.select.PlainSelect;
@ -19,6 +20,9 @@ public class DispatchHandler {
@Resource
private IWorkerAttendanceService workerAttendanceService;
@Resource
private IUfaceDevService ufaceDevService;
public void message(String topic, Object payLoad) {
// 下发人脸返回
if (topic.contains("mqtt/face/") && topic.contains("/Ack")) {
@ -51,5 +55,12 @@ public class DispatchHandler {
JSONObject body = jsonObject.getJSONObject("body");
workerAttendanceService.zyMqttRec(body);
}
// 正赢人脸设备心跳推送
if (topic.equals("heartbeat/response")) {
JSONObject jsonObject = JSONObject.parseObject(payLoad.toString());
JSONObject body = jsonObject.getJSONObject("body");
ufaceDevService.online(body.getString("sn"));
}
}
}

View File

@ -116,4 +116,12 @@ public interface IUfaceDevService extends IService<UfaceDev> {
* @return
*/
List<UfaceDev> getDevSnListByGroupId(String groupId);
/**
* 收到心跳设置设备在线并充值心跳时间
*
* @param devSn
* @return
*/
void online(String devSn);
}

View File

@ -3,6 +3,8 @@ package com.zhgd.xmgl.modules.worker.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
@ -279,4 +281,12 @@ public class UfaceDevServiceImpl extends ServiceImpl<UfaceDevMapper, UfaceDev> i
public List<UfaceDev> getDevSnListByGroupId(String groupId) {
return ufaceDevMapper.getDevSnListByGroupId(groupId);
}
@Override
public void online(String devSn) {
LambdaUpdateWrapper<UfaceDev> wrapper = Wrappers.<UfaceDev>lambdaUpdate();
wrapper.set(UfaceDev::getHeartBeatTime, new Date());
wrapper.eq(UfaceDev::getDevSn, devSn);
this.update(wrapper);
}
}

View File

@ -71,7 +71,7 @@ mqtt.url=tcp://jxj.zhgdyun.com:1883
mqtt.producer.clientId=mqttProd0729
mqtt.producer.defaultTopic=topic1
mqtt.consumer.clientId=mqttConsumer0729
mqtt.consumer.defaultTopic=topic1,mqtt/face/+/Ack,mqtt/face/+/Rec,face/createFace/response,face/response
mqtt.consumer.defaultTopic=topic1,mqtt/face/+/Ack,mqtt/face/+/Rec,face/createFace/response,face/response,heartbeat/response
#mqtt.consumer.defaultTopic=/P114101/202203010084
#server.http2.enabled=true
#server.ssl.key-store=classpath:www.cscec1b1.com.jks