Commit dd5a553f authored by 赵啸非's avatar 赵啸非

添加设备上线和下线的业务日志记录

parent 266f2b47
......@@ -99,7 +99,7 @@ public class DirectDynamicListener implements MessageListener {
BizLogPdu bizLogPdu = new BizLogPdu();
bizLogPdu.initAttrValue();
//保存为产品名称
bizLogPdu.setAppName(productEntity.getProductName());
bizLogPdu.setAppName(productEntity.getProductCode());
bizLogPdu.setTraceID(IdUtil.objectId());
bizLogPdu.setUserCode("system");
bizLogPdu.setDeviceCode(deviceEntity.getDeviceCode());
......
......@@ -3,7 +3,9 @@ package com.mortals.xhx.daemon.applicationservice;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.Constant;
......@@ -56,6 +58,9 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
private SendTaskThreadPool sendTaskThreadPool;
@Autowired
private ICacheService cacheService;
@Autowired
private IMessageProduceService messageProducer;
protected volatile ExecutorService consumersExecutor;
......@@ -174,6 +179,22 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台
deviceService.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ONLINE);
//保存业务消息为离线
BizLogPdu bizLogPdu = new BizLogPdu();
bizLogPdu.initAttrValue();
//保存为产品名称
bizLogPdu.setAppName(productEntity.getProductCode());
bizLogPdu.setTraceID(IdUtil.objectId());
bizLogPdu.setUserCode("system");
bizLogPdu.setDeviceCode(deviceEntity.getDeviceCode());
bizLogPdu.setEventTopic("online");
bizLogPdu.setEventTopicName(LogTypeEnum.上报事件.name());
bizLogPdu.setMsg("设备上线");
bizLogPdu.setLogLevel("INFO");
bizLogPdu.setLogTime(new Date());
messageProducer.syncBizSend(bizLogPdu);
}
}
if (!Constant.MESSAGETYPE_HEARTBEAT.equalsIgnoreCase(messageType)) {
......
......@@ -91,7 +91,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
BizLogPdu bizLogPdu = new BizLogPdu();
bizLogPdu.initAttrValue();
//保存为产品名称
bizLogPdu.setAppName(productEntity.getProductName());
bizLogPdu.setAppName(productEntity.getProductCode());
bizLogPdu.setTraceID(IdUtil.objectId());
bizLogPdu.setUserCode("system");
bizLogPdu.setDeviceCode(deviceEntity.getDeviceCode());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment