重启逻辑更新

This commit is contained in:
磷叶 2025-04-29 08:55:30 +08:00
parent 4cd4a6ee4e
commit 655fb876c2

View File

@ -152,8 +152,8 @@ public class IotReceiveServiceImpl implements IotReceiveService {
if (!isOpen) {
// 若当前数据点的上报时间和设备内上次上报的时间不一样但是定位一样则重启设备
log.info("当前定位:{},{},上次定位:{},{}", sys.getLon(), sys.getLat(), device.getLongitude(), device.getLatitude());
if (at.isAfter(device.getLastLocationTime()) && MathUtils.equals(device.getLongitude(), sys.getLon()) && MathUtils.equals(device.getLatitude(), sys.getLat())) {
String reason = String.format("设备不同时间的两次定位一样,重启设备。定位:%s,%s", sys.getLon(), sys.getLat());
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());
deviceIotService.reboot(device, reason, true);
return 1;
}