更新
This commit is contained in:
parent
d38aba8df3
commit
6f3bb42742
|
@ -65,6 +65,7 @@ public class ReceiveController {
|
||||||
ObjBody obj = IotUtil.resolveBody(body, false);
|
ObjBody obj = IotUtil.resolveBody(body, false);
|
||||||
if (obj != null){
|
if (obj != null){
|
||||||
Object msg = obj.getMsg();
|
Object msg = obj.getMsg();
|
||||||
|
log.info("收到receive数据:{}", msg);
|
||||||
// 接收到msg
|
// 接收到msg
|
||||||
if (msg instanceof String) {
|
if (msg instanceof String) {
|
||||||
iotReceiveService.handleReceive(JSON.parseObject((String) msg, ReceiveMsg.class));
|
iotReceiveService.handleReceive(JSON.parseObject((String) msg, ReceiveMsg.class));
|
||||||
|
|
|
@ -152,7 +152,12 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
||||||
// 需要在设备未启动的时候做,否则可能有安全问题
|
// 需要在设备未启动的时候做,否则可能有安全问题
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
// 若当前数据点的上报时间和设备内上次上报的时间不一样,但是定位一样,则重启设备
|
||||||
log.info("当前定位:{},{},上次定位:{},{}", sys.getLon().setScale(8), sys.getLat().setScale(8), device.getLongitude().setScale(8), device.getLatitude().setScale(8));
|
log.info("当前定位:{},{},上次定位:{},{}",
|
||||||
|
sys.getLon().setScale(8, BigDecimal.ROUND_HALF_UP),
|
||||||
|
sys.getLat().setScale(8, BigDecimal.ROUND_HALF_UP),
|
||||||
|
device.getLongitude().setScale(8, BigDecimal.ROUND_HALF_UP),
|
||||||
|
device.getLatitude().setScale(8, BigDecimal.ROUND_HALF_UP)
|
||||||
|
);
|
||||||
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equalsFixed(device.getLongitude(), sys.getLon(), 8) && MathUtils.equalsFixed(device.getLatitude(), sys.getLat(), 8)) {
|
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equalsFixed(device.getLongitude(), sys.getLon(), 8) && MathUtils.equalsFixed(device.getLatitude(), sys.getLat(), 8)) {
|
||||||
String reason = String.format("设备不同时间的两次定位一样,重启设备。新定位:%s,%s,旧定位:%s,%s", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
|
String reason = String.format("设备不同时间的两次定位一样,重启设备。新定位:%s,%s,旧定位:%s,%s", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
|
||||||
deviceIotService.reboot(device, reason, true);
|
deviceIotService.reboot(device, reason, true);
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class DeviceTask {
|
||||||
/**
|
/**
|
||||||
* 将过久未上报数据的设备设置为离线
|
* 将过久未上报数据的设备设置为离线
|
||||||
*/
|
*/
|
||||||
public void monitorOffline(long seconds) {
|
public void monitorOffline(Integer seconds) {
|
||||||
// 条件:在线且最后上报时间小于当前时间 - seconds秒
|
// 条件:在线且最后上报时间小于当前时间 - seconds秒
|
||||||
DeviceQuery query = new DeviceQuery();
|
DeviceQuery query = new DeviceQuery();
|
||||||
query.setOnlineStatus(DeviceOnlineStatus.ONLINE.getStatus());
|
query.setOnlineStatus(DeviceOnlineStatus.ONLINE.getStatus());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user