|
@@ -213,9 +213,8 @@ public class MqttCallbackHandler {
|
|
setService.getDeviceLocation_LP(num);
|
|
setService.getDeviceLocation_LP(num);
|
|
//如果远程设备的信息与数据库的信息不一致,则发送消息更新远程信息
|
|
//如果远程设备的信息与数据库的信息不一致,则发送消息更新远程信息
|
|
DeviceLp dbDevice = deviceLpService.getByNum(num);
|
|
DeviceLp dbDevice = deviceLpService.getByNum(num);
|
|
- System.out.println(dbDevice.getWakeInt());
|
|
|
|
Double dbWakeInt = dbDevice.getWakeInt() == null ? null : dbDevice.getWakeInt().setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue();
|
|
Double dbWakeInt = dbDevice.getWakeInt() == null ? null : dbDevice.getWakeInt().setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue();
|
|
- Double wakeInt = msg.getDouble("sleept") == null ? null : new BigDecimal(msg.getDouble("sleept")).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue();
|
|
|
|
|
|
+ Double wakeInt = msg.getDouble("sleept") == null ? null : BigDecimal.valueOf(msg.getDouble("sleept")).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue();
|
|
if (dbWakeInt == null || !dbWakeInt.equals(wakeInt) || !dbDevice.getThresh().equals(msg.getInt("thresh"))) {
|
|
if (dbWakeInt == null || !dbWakeInt.equals(wakeInt) || !dbDevice.getThresh().equals(msg.getInt("thresh"))) {
|
|
setService.updateDevice_LP(num, dbDevice.getWakeInt(), dbDevice.getThresh());
|
|
setService.updateDevice_LP(num, dbDevice.getWakeInt(), dbDevice.getThresh());
|
|
}
|
|
}
|