修改avgv脚本函数

This commit is contained in:
谷成伟 2024-12-06 11:50:07 +08:00
parent df8c900be7
commit 41d3be9e1a

View File

@ -274,12 +274,13 @@ public class DataServiceImpl implements DataService {
return null;
}
String tableName = "";
if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("h_%s", deviceInfoCache.getDeviceId());
if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("c_%d_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
return tdEngineService.getTimeSumCalcValue(tableName, attr.toLowerCase(), startTime, endTime);
} else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("h%d", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("l_%s", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("c_%s", deviceInfoCache.getDeviceId());
tableName = String.format("l%d", deviceInfoCache.getDeviceId());
}
return tdEngineService.getTimeTopValue(tableName, attr, startTime, endTime);
}
@ -292,14 +293,14 @@ public class DataServiceImpl implements DataService {
}
String tableName = "";
if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("c_%s_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
return tdEngineService.getTimeSumCalcValue(tableName, attr, startTime, endTime);
} else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){
tableName = String.format("h_%s", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){
tableName = String.format("l_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
tableName = String.format("c_%d_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
return tdEngineService.getTimeSumCalcValue(tableName, attr.toLowerCase(), startTime, endTime);
} else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("h%d", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("l%d", deviceInfoCache.getDeviceId());
}
return tdEngineService.getTimeSumValue(tableName, attr, startTime, endTime);
return tdEngineService.getTimeSumValue(tableName, attr.toLowerCase(), startTime, endTime);
}
@Override
@ -310,13 +311,13 @@ public class DataServiceImpl implements DataService {
}
String tableName = "";
if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("c_%s_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
return tdEngineService.getTimeAvgCalcValue(tableName, attr, startTime, endTime);
} else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){
tableName = String.format("h_%s", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){
tableName = String.format("l_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
tableName = String.format("c_%d_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase());
return tdEngineService.getTimeAvgCalcValue(tableName, attr.toLowerCase(), startTime, endTime);
} else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("h%d", deviceInfoCache.getDeviceId());
} else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr)){
tableName = String.format("l%d", deviceInfoCache.getDeviceId());
}
return tdEngineService.getTimeAvgValue(tableName, attr, startTime, endTime);
return tdEngineService.getTimeAvgValue(tableName, attr.toLowerCase(), startTime, endTime);
}
}