|
|
@@ -86,7 +86,7 @@ public class DeviceDataQuery {
|
|
|
private static final double FLOATING_RANGE_MIN1 = 0.0;
|
|
|
private static final double FLOATING_RANGE_MAX1 = 1.0;
|
|
|
private static final double SEWAGE_LEVEL_MIN = 0.0;
|
|
|
- private static final double SEWAGE_LEVEL_MAX = 0.5;
|
|
|
+ private static final double SEWAGE_LEVEL_MAX = 0.1;
|
|
|
|
|
|
private static int callCount = 0;
|
|
|
|
|
|
@@ -123,7 +123,7 @@ public class DeviceDataQuery {
|
|
|
LambdaQueryWrapper<DmpDevice> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(DmpDevice::getTenantId, 1205)
|
|
|
.eq(DmpDevice::getDeviceType, transferVO.getDeviceType())
|
|
|
- .orderByDesc(DmpDevice::getId)
|
|
|
+ .orderByAsc(DmpDevice::getId)
|
|
|
.last("LIMIT 1");
|
|
|
DmpDevice xiangyuDevice = dmpDeviceMapper.selectOne(queryWrapper);
|
|
|
|
|
|
@@ -472,7 +472,9 @@ public class DeviceDataQuery {
|
|
|
break;
|
|
|
|
|
|
case 716:
|
|
|
- simData.put("sensorValue", formatNumber(ThreadLocalRandom.current().nextDouble(SEWAGE_LEVEL_MIN, SEWAGE_LEVEL_MAX), FORMAT_1_2));
|
|
|
+ String deviceId1 = device.getDeviceId();
|
|
|
+ double value = FixedWaterLevelGenerator.getSensorValue(deviceId1);
|
|
|
+ simData.put("sensorValue", formatNumber(value, FORMAT_1_2));
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
@@ -520,7 +522,7 @@ public class DeviceDataQuery {
|
|
|
double noise = original * noiseFactor * (ThreadLocalRandom.current().nextDouble(-1, 1));
|
|
|
double newValue = original + noise;
|
|
|
|
|
|
- // System.out.println("加噪: " + key + " | 原值=" + original + " | 噪声=" + noise + " | 新值=" + newValue);
|
|
|
+ System.out.println("加噪: " + key + " | 原值=" + original + " | 噪声=" + noise + " | 新值=" + newValue);
|
|
|
|
|
|
// 保持原类型:原来是 String 就格式化回 String,原来是 Number 就放 Double
|
|
|
if (value instanceof String) {
|