Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
2c5a595a0b
@ -63,7 +63,7 @@ public class FunctionAvgValue extends AbstractFunction {
|
||||
if (deviceInfoCache == null) {
|
||||
return AviatorNil.NIL;
|
||||
}
|
||||
Double value = dataService.getTimeSumValue(deviceInfoCache.getDeviceId(), attrName, startTime.getTime(), endTime.getTime());
|
||||
Double value = dataService.getTimeAvgValue(deviceInfoCache.getDeviceId(), attrName, startTime.getTime(), endTime.getTime());
|
||||
if (value == null){
|
||||
return AviatorNil.NIL;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -254,9 +254,6 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
||||
String fieldName = keysHigh.next();
|
||||
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||
keyValueMap.put(key, values.get(fieldName));
|
||||
if(fieldName.toLowerCase().equals("iwindspeed")){
|
||||
log.info("风速更新redis数据key:{},value:{}",key,values.get(fieldName));
|
||||
}
|
||||
if (highKey.contains(fieldName)){
|
||||
highSpeedValueMap.put(fieldName,values.get(fieldName));
|
||||
}
|
||||
|
@ -22,17 +22,22 @@
|
||||
<el-date-picker
|
||||
class="datetime-picker"
|
||||
v-model="statAnalysisTime"
|
||||
:type="statAnalysisInterval == '1d' ? 'daterange' : 'datetimerange'"
|
||||
:value-format="statAnalysisInterval == '1d' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||
type="datetimerange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]"
|
||||
:teleported="false"
|
||||
:shortcuts="shortcuts"
|
||||
/>
|
||||
</div>
|
||||
<div class="selectPart">
|
||||
<span>{{ t('statAnalysis.interval') }}</span>
|
||||
<el-select v-model="statAnalysisInterval" :placeholder="'请选择' + t('statAnalysis.interval')" class="statAnalysisSelect">
|
||||
<el-option v-for="v in statAnalysisSelectOptions.interval" :key="v.value" :label="v.label" :value="v.value"></el-option>
|
||||
<span>风速来源</span>
|
||||
<el-select v-model="statAnalysisSpeedSource" placeholder="请选择风速来源" class="statAnalysisSelect">
|
||||
<el-option
|
||||
v-for="v in statAnalysisSelectOptions.speedSource"
|
||||
:key="v.value"
|
||||
:label="v.label"
|
||||
:value="v.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="selectPart">
|
||||
@ -73,17 +78,12 @@ const { t } = useI18n()
|
||||
|
||||
const statAnalysisFatory = ref('')
|
||||
const statAnalysisFatoryList: any = ref([])
|
||||
const statAnalysisInterval = ref('1h')
|
||||
const statAnalysisSpeedSource = ref('AvgWindSpeed_10min')
|
||||
const statAnalysisDeviceId = ref('')
|
||||
const statAnalysisSelectOptions: any = reactive({
|
||||
interval: [
|
||||
{ label: '一分钟', value: '1m' },
|
||||
{ label: '五分钟', value: '5m' },
|
||||
{ label: '十分钟', value: '10m' },
|
||||
{ label: '十五分钟', value: '15m' },
|
||||
{ label: '一小时', value: '1h' },
|
||||
{ label: '一天', value: '1d' },
|
||||
{ label: '原始', value: 'NONE' },
|
||||
speedSource: [
|
||||
{ label: '原始风速', value: 'AvgWindSpeed_10min' },
|
||||
{ label: '处理后风速', value: 'AvgWindSpeedCal_10min' },
|
||||
],
|
||||
deviceId: [],
|
||||
})
|
||||
@ -278,10 +278,9 @@ const statAnalysisOperate = () => {
|
||||
devices: [
|
||||
{
|
||||
deviceId: deviceId,
|
||||
attributes: ['iGenPower', 'iWindSpeed'],
|
||||
attributes: [statAnalysisSpeedSource.value, 'AvgActivePower_10min'],
|
||||
},
|
||||
],
|
||||
interval: statAnalysisInterval.value || '5m',
|
||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||
}
|
||||
@ -323,8 +322,8 @@ const statAnalysisOperate = () => {
|
||||
const resData0 = results[1][statAnalysisDeviceId.value.split(':')[2]]
|
||||
const resData1 = results[0]
|
||||
if (resData0) {
|
||||
const iGenPower = resData0['iGenPower']['values']
|
||||
const iWindSpeed = resData0['iWindSpeed']['values']
|
||||
const iGenPower = resData0['AvgActivePower_10min']['values']
|
||||
const iWindSpeed = resData0[statAnalysisSpeedSource.value]['values']
|
||||
if (!iWindSpeed.length) {
|
||||
ElMessage.info(`实时值数据为空`)
|
||||
} else {
|
||||
@ -336,7 +335,7 @@ const statAnalysisOperate = () => {
|
||||
})
|
||||
|
||||
const series = {
|
||||
type: 'line',
|
||||
type: 'scatter',
|
||||
data: seriesData,
|
||||
name: '实际值',
|
||||
smooth: true,
|
||||
@ -356,6 +355,8 @@ const statAnalysisOperate = () => {
|
||||
name: '理论值',
|
||||
smooth: true,
|
||||
animation: false,
|
||||
symbolSize: 0.1,
|
||||
symbol: 'circle',
|
||||
}
|
||||
option.series.push(series)
|
||||
option.legend.data.push('理论值')
|
||||
@ -374,16 +375,14 @@ const statAnalysisExport = () => {
|
||||
devices: [
|
||||
{
|
||||
deviceId: statAnalysisDeviceId.value.split(':')[2],
|
||||
attributes: ['iGenPower', 'iWindSpeed'],
|
||||
attributes: [statAnalysisSpeedSource.value, 'AvgActivePower_10min'],
|
||||
},
|
||||
],
|
||||
interval: statAnalysisInterval.value || '5m',
|
||||
startTime: new Date(statAnalysisTime.value[0]).getTime(),
|
||||
endTime: new Date(statAnalysisTime.value[1]).getTime(),
|
||||
madeinfactory: params.split(':')[0],
|
||||
model: params.split(':')[1],
|
||||
}
|
||||
console.log(requestData)
|
||||
powerCurveExport(requestData).then((res: any) => {
|
||||
const downloadUrl = window.URL.createObjectURL(res)
|
||||
const a = document.createElement('a')
|
||||
|
@ -399,9 +399,6 @@ const getTimeIntervals = (startTimestamp: number, endTimestamp: number) => {
|
||||
case '15m':
|
||||
count = Math.floor((endDate - startDate) / (15 * 60 * 1000))
|
||||
break
|
||||
case '15m':
|
||||
count = Math.floor((endDate - startDate) / (15 * 60 * 1000))
|
||||
break
|
||||
case '1h':
|
||||
count = Math.floor((endDate - startDate) / (1 * 60 * 60 * 1000))
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user