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