|
|
@@ -17,6 +17,7 @@ import com.zswl.dataservice.service.base.CommonService;
|
|
|
import com.zswl.dataservice.service.base.SuperService;
|
|
|
import com.zswl.dataservice.service.sync.DeviceSyncFullCardService;
|
|
|
import com.zswl.dataservice.type.DataState;
|
|
|
+import com.zswl.dataservice.type.DeviceType;
|
|
|
import com.zswl.dataservice.utils.DateUtils;
|
|
|
import com.zswl.dataservice.utils.bean.BeanUtils;
|
|
|
import com.zswl.dataservice.utils.mqtt.type.OnLineState;
|
|
|
@@ -70,6 +71,7 @@ public class DevicePingInfoService extends SuperService {
|
|
|
|
|
|
// ping记录
|
|
|
DevicePingInfo devicePingInfo = new DevicePingInfo();
|
|
|
+ devicePingInfo.setPingType(DeviceType.Consumer.name());
|
|
|
devicePingInfo.setDeviceId(deviceId);
|
|
|
devicePingInfo.setDeviceName(deviceInfo.getDeviceName());
|
|
|
devicePingInfo.setGateWayId(param.getGateWayId());
|
|
|
@@ -77,6 +79,8 @@ public class DevicePingInfoService extends SuperService {
|
|
|
devicePingInfo.setTTL(new Date(System.currentTimeMillis() + 7 * 24L * 60 * 60 * 1000L));
|
|
|
devicePingInfo.setTimeStr(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.FORMAT_LONG));
|
|
|
devicePingInfoDao.save(devicePingInfo);
|
|
|
+
|
|
|
+ // 通知设备
|
|
|
deviceSyncFullCardService.noticeSyncDeviceOnlineTimeChange(deviceId);
|
|
|
} else {
|
|
|
log.info("心跳设备未找到: {}", deviceId);
|
|
|
@@ -84,9 +88,8 @@ public class DevicePingInfoService extends SuperService {
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
- @ExecuteAnnotationServiceMethod(value = "ping", remark = "设备心跳")
|
|
|
+ @ExecuteAnnotationServiceMethod(value = "ping", remark = "网关心跳")
|
|
|
public ResultContent<Object> ping(String dataStr) {
|
|
|
- log.info("dataStr: {}", dataStr);
|
|
|
PingResult pingResult = new PingResult();
|
|
|
GateWayPingInfoParam param = JSONUtil.toBean(dataStr, GateWayPingInfoParam.class);
|
|
|
GateWayInfo gateWayInfo = gateWayInfoDao.findTopByGateWayId(param.getGateWayId());
|
|
|
@@ -100,6 +103,7 @@ public class DevicePingInfoService extends SuperService {
|
|
|
|
|
|
// ping记录
|
|
|
DevicePingInfo devicePingInfo = new DevicePingInfo();
|
|
|
+ devicePingInfo.setPingType(DeviceType.GateWay.name());
|
|
|
devicePingInfo.setGateWayId(param.getGateWayId());
|
|
|
devicePingInfo.setProjectInfoCode(gateWayInfo.getProjectInfoCode());
|
|
|
devicePingInfo.setTTL(new Date(System.currentTimeMillis() + 1 * 24L * 60 * 60 * 1000L));
|