Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
eb4a27fbe7
@ -2,8 +2,6 @@ package com.das.modules.cache.domain;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IotModelInfoCache {
|
public class IotModelInfoCache {
|
||||||
private Long iotModelId;
|
private Long iotModelId;
|
||||||
|
@ -10,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class IotModelCacheImpl implements IotModelCache {
|
public class IotModelCacheImpl implements IotModelCache {
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.das.modules.calc.controller;
|
package com.das.modules.calc.controller;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
|
||||||
import com.das.common.result.R;
|
import com.das.common.result.R;
|
||||||
import com.das.modules.calc.domain.vo.CalcModuleVo;
|
import com.das.modules.calc.domain.vo.CalcModuleVo;
|
||||||
import com.das.modules.calc.service.CalcService;
|
import com.das.modules.calc.service.CalcService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.quartz.SchedulerException;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -13,9 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -10,7 +10,6 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@TableName("sys_calc_module")
|
@TableName("sys_calc_module")
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.das.modules.calc.functions;
|
package com.das.modules.calc.functions;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateField;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.das.modules.cache.domain.DeviceInfoCache;
|
import com.das.modules.cache.domain.DeviceInfoCache;
|
||||||
import com.das.modules.cache.service.CacheService;
|
import com.das.modules.cache.service.CacheService;
|
||||||
import com.das.modules.data.service.DataService;
|
import com.das.modules.data.service.DataService;
|
||||||
@ -65,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;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aviator扩展函数 - 获取设备实时数据
|
* Aviator扩展函数 - 获取设备实时数据
|
||||||
|
@ -30,27 +30,27 @@ public class FunctionOffsetDate extends AbstractFunction {
|
|||||||
public AviatorObject call(Map<String, Object> env, AviatorObject dateData, AviatorObject dimData, AviatorObject offsetData) {
|
public AviatorObject call(Map<String, Object> env, AviatorObject dateData, AviatorObject dimData, AviatorObject offsetData) {
|
||||||
Date date = (Date) dateData.getValue(env);
|
Date date = (Date) dateData.getValue(env);
|
||||||
String dim = (String) dimData.getValue(env);
|
String dim = (String) dimData.getValue(env);
|
||||||
Integer offset = (Integer) offsetData.getValue(env);
|
Long offset = (Long) offsetData.getValue(env);
|
||||||
|
|
||||||
Date result = null;
|
Date result = null;
|
||||||
switch (dim) {
|
switch (dim) {
|
||||||
case "day":
|
case "day":
|
||||||
result = DateUtil.offset(date, DateField.DAY_OF_MONTH, offset);
|
result = DateUtil.offset(date, DateField.DAY_OF_MONTH, offset.intValue());
|
||||||
break;
|
break;
|
||||||
case "month":
|
case "month":
|
||||||
result = DateUtil.offset(date, DateField.MONTH, offset);
|
result = DateUtil.offset(date, DateField.MONTH, offset.intValue());
|
||||||
break;
|
break;
|
||||||
case "year":
|
case "year":
|
||||||
result = DateUtil.offset(date, DateField.YEAR, offset);
|
result = DateUtil.offset(date, DateField.YEAR, offset.intValue());
|
||||||
break;
|
break;
|
||||||
case "hour":
|
case "hour":
|
||||||
result = DateUtil.offset(date, DateField.HOUR, offset);
|
result = DateUtil.offset(date, DateField.HOUR, offset.intValue());
|
||||||
break;
|
break;
|
||||||
case "minute":
|
case "minute":
|
||||||
result = DateUtil.offset(date, DateField.MINUTE, offset);
|
result = DateUtil.offset(date, DateField.MINUTE, offset.intValue());
|
||||||
break;
|
break;
|
||||||
case "second":
|
case "second":
|
||||||
result = DateUtil.offset(date, DateField.SECOND, offset);
|
result = DateUtil.offset(date, DateField.SECOND, offset.intValue());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.error("不支持的维度: {}", dim);
|
log.error("不支持的维度: {}", dim);
|
||||||
|
@ -5,7 +5,8 @@ import com.das.modules.cache.service.CacheService;
|
|||||||
import com.das.modules.data.domain.SnapshotValueQueryParam;
|
import com.das.modules.data.domain.SnapshotValueQueryParam;
|
||||||
import com.das.modules.data.service.DataService;
|
import com.das.modules.data.service.DataService;
|
||||||
import com.googlecode.aviator.runtime.function.AbstractFunction;
|
import com.googlecode.aviator.runtime.function.AbstractFunction;
|
||||||
import com.googlecode.aviator.runtime.type.*;
|
import com.googlecode.aviator.runtime.type.AviatorObject;
|
||||||
|
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -12,7 +12,10 @@ import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
|||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aviator扩展函数 - 获取设备实时数据
|
* Aviator扩展函数 - 获取设备实时数据
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.das.modules.calc.functions;
|
package com.das.modules.calc.functions;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.das.modules.cache.domain.DeviceInfoCache;
|
import com.das.modules.cache.domain.DeviceInfoCache;
|
||||||
import com.das.modules.cache.service.CacheService;
|
import com.das.modules.cache.service.CacheService;
|
||||||
import com.das.modules.data.service.DataService;
|
import com.das.modules.data.service.DataService;
|
||||||
@ -8,12 +7,10 @@ import com.googlecode.aviator.runtime.function.AbstractFunction;
|
|||||||
import com.googlecode.aviator.runtime.type.AviatorNil;
|
import com.googlecode.aviator.runtime.type.AviatorNil;
|
||||||
import com.googlecode.aviator.runtime.type.AviatorObject;
|
import com.googlecode.aviator.runtime.type.AviatorObject;
|
||||||
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aviator扩展函数 - 获取时间维度内最早的一条数据
|
* Aviator扩展函数 - 获取时间维度内最早的一条数据
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package com.das.modules.calc.functions;
|
package com.das.modules.calc.functions;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUnit;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.das.modules.cache.domain.DeviceInfoCache;
|
import com.das.modules.cache.domain.DeviceInfoCache;
|
||||||
import com.das.modules.cache.service.CacheService;
|
import com.das.modules.cache.service.CacheService;
|
||||||
import com.das.modules.data.domain.SnapshotValueQueryParam;
|
|
||||||
import com.das.modules.data.service.DataService;
|
import com.das.modules.data.service.DataService;
|
||||||
import com.googlecode.aviator.runtime.function.AbstractFunction;
|
import com.googlecode.aviator.runtime.function.AbstractFunction;
|
||||||
import com.googlecode.aviator.runtime.type.AviatorNil;
|
import com.googlecode.aviator.runtime.type.AviatorNil;
|
||||||
@ -14,8 +12,6 @@ import lombok.Data;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import com.googlecode.aviator.runtime.type.AviatorObject;
|
|||||||
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import com.das.modules.cache.service.CacheService;
|
|||||||
import com.das.modules.calc.domain.entity.CalcModule;
|
import com.das.modules.calc.domain.entity.CalcModule;
|
||||||
import com.googlecode.aviator.AviatorEvaluatorInstance;
|
import com.googlecode.aviator.AviatorEvaluatorInstance;
|
||||||
import com.googlecode.aviator.Expression;
|
import com.googlecode.aviator.Expression;
|
||||||
import com.googlecode.aviator.runtime.type.AviatorRuntimeJavaType;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobDataMap;
|
import org.quartz.JobDataMap;
|
||||||
|
@ -2,6 +2,7 @@ package com.das.modules.calc.service;
|
|||||||
|
|
||||||
import cn.hutool.core.codec.Base64Encoder;
|
import cn.hutool.core.codec.Base64Encoder;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.das.common.utils.AdminRedisTemplate;
|
import com.das.common.utils.AdminRedisTemplate;
|
||||||
import com.das.modules.cache.service.CacheService;
|
import com.das.modules.cache.service.CacheService;
|
||||||
import com.das.modules.calc.domain.entity.CalcModule;
|
import com.das.modules.calc.domain.entity.CalcModule;
|
||||||
@ -134,6 +135,9 @@ public class CalcService {
|
|||||||
|
|
||||||
FunctionOffsetDate offsetDate = new FunctionOffsetDate();
|
FunctionOffsetDate offsetDate = new FunctionOffsetDate();
|
||||||
aviator.addFunction(offsetDate);
|
aviator.addFunction(offsetDate);
|
||||||
|
|
||||||
|
FunctionWindSpeedFactor windSpeedFactor = new FunctionWindSpeedFactor(dataService,cacheService);
|
||||||
|
aviator.addFunction(windSpeedFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,7 +180,9 @@ public class CalcService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<CalcModuleVo> queryCalcModules() {
|
public List<CalcModuleVo> queryCalcModules() {
|
||||||
List<CalcModule> scriptModules = calcModuleMapper.selectList(null);
|
LambdaQueryWrapper<CalcModule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.orderByAsc(CalcModule::getLocalName);
|
||||||
|
List<CalcModule> scriptModules = calcModuleMapper.selectList(queryWrapper);
|
||||||
|
|
||||||
return scriptModules.stream().map(CalcModuleVo::of).toList();
|
return scriptModules.stream().map(CalcModuleVo::of).toList();
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class HeartbeatCommand implements BaseCommand{
|
|||||||
}
|
}
|
||||||
//判断是不是风机
|
//判断是不是风机
|
||||||
String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId);
|
String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId);
|
||||||
String keyCommFaultState = String.format("RT:%d:commfaultstate");
|
String keyCommFaultState = String.format("RT:%d:commfaultstate",deviceId);
|
||||||
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
|
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
|
||||||
if (plcDeviceStatus == null){
|
if (plcDeviceStatus == null){
|
||||||
adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1);
|
adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1);
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -376,13 +376,16 @@ PS: 同一节点只允许建立一条连接。
|
|||||||
"dataTime": 123123123123,
|
"dataTime": 123123123123,
|
||||||
//设备ID
|
//设备ID
|
||||||
"deviceId": "1123451235464",
|
"deviceId": "1123451235464",
|
||||||
//是否存储历史数据
|
|
||||||
"isStore": true,
|
|
||||||
"values": {
|
"values": {
|
||||||
//key为属性名
|
//key为属性名
|
||||||
"Ia": 123.1,
|
"Ia": 123.1,
|
||||||
"Ib": 122.1,
|
"Ib": 122.1,
|
||||||
"Ic": 123.1
|
"Ic": 123.1
|
||||||
|
},
|
||||||
|
//需要归档的数据
|
||||||
|
"archiveValues":{
|
||||||
|
"P": 1234.12,
|
||||||
|
"Q": 12
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -402,11 +405,13 @@ PS: 同一节点只允许建立一条连接。
|
|||||||
"dataTime": 123123123123,
|
"dataTime": 123123123123,
|
||||||
//设备ID
|
//设备ID
|
||||||
"deviceId": "1123451235464",
|
"deviceId": "1123451235464",
|
||||||
//是否存储历史数据
|
|
||||||
"isStore": true,
|
|
||||||
"values": {
|
"values": {
|
||||||
//key为属性名
|
//key为属性名
|
||||||
"Switch01": 1
|
"Switch01": 1
|
||||||
|
},
|
||||||
|
//需要归档的数据
|
||||||
|
"archiveValues":{
|
||||||
|
"Fault001": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -168,3 +168,14 @@ export const getRealValueRangeReq = (data: { startTime: number, endTime: number,
|
|||||||
timeout: 60 * 1000
|
timeout: 60 * 1000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function queryfaultCodeDict(params: object = {}) {
|
||||||
|
return createAxios({
|
||||||
|
url: '/api/fdr/faultCodeDict/query',
|
||||||
|
method: 'POST',
|
||||||
|
data: params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
showErrorMessage: false
|
||||||
|
})
|
||||||
|
}
|
BIN
ui/dasadmin/src/assets/energyManage/AGC.png
Normal file
BIN
ui/dasadmin/src/assets/energyManage/AGC.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
ui/dasadmin/src/assets/energyManage/AVC.png
Normal file
BIN
ui/dasadmin/src/assets/energyManage/AVC.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
ui/dasadmin/src/assets/energyManage/defaultSave.png
Normal file
BIN
ui/dasadmin/src/assets/energyManage/defaultSave.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 480 B |
BIN
ui/dasadmin/src/assets/energyManage/noPower.png
Normal file
BIN
ui/dasadmin/src/assets/energyManage/noPower.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
ui/dasadmin/src/assets/energyManage/power.png
Normal file
BIN
ui/dasadmin/src/assets/energyManage/power.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@ -21,7 +21,7 @@
|
|||||||
:total="pageSetting.total"
|
:total="pageSetting.total"
|
||||||
:page-sizes="pageSetting.pageSizes"
|
:page-sizes="pageSetting.pageSizes"
|
||||||
background
|
background
|
||||||
:pager-count="7"
|
:pager-count="4"
|
||||||
layout="prev, pager, next, jumper,sizes,total"
|
layout="prev, pager, next, jumper,sizes,total"
|
||||||
@size-change="sizeChangePage"
|
@size-change="sizeChangePage"
|
||||||
></el-pagination>
|
></el-pagination>
|
||||||
|
1073
ui/dasadmin/src/views/backend/energyManage/index.vue
Normal file
1073
ui/dasadmin/src/views/backend/energyManage/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -85,25 +85,31 @@ import { reactive, ref, watch, onMounted } from 'vue'
|
|||||||
import { ElMessage, FormInstance, dayjs } from 'element-plus'
|
import { ElMessage, FormInstance, dayjs } from 'element-plus'
|
||||||
import type { ModelAttributeFieldsEnums, GetModelAttributeType } from '/@/views/backend/auth/model/type'
|
import type { ModelAttributeFieldsEnums, GetModelAttributeType } from '/@/views/backend/auth/model/type'
|
||||||
import { ModelAttributeType } from '/@/views/backend/auth/model/type'
|
import { ModelAttributeType } from '/@/views/backend/auth/model/type'
|
||||||
import { getModelAttributeListReq, getRealValueListReq } from '/@/api/backend/deviceModel/request'
|
import { getModelAttributeListReq, getRealValueListReq, getRealValueRangeReq, queryfaultCodeDict } from '/@/api/backend/deviceModel/request'
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts'
|
||||||
import { getRealValueRangeReq } from '/@/api/backend/deviceModel/request'
|
|
||||||
import { useEnumStore } from '/@/stores/enums'
|
import { useEnumStore } from '/@/stores/enums'
|
||||||
import { queryfaultCodeDict } from '/@/api/backend/theoreticalpowerCurve/request'
|
import { malFunctionKeys } from '/@/views/backend/equipment/airBlower/utils'
|
||||||
import { malFunctionKeys} from '/@/views/backend/equipment/airBlower/utils'
|
|
||||||
|
|
||||||
const enumStore = useEnumStore()
|
const enumStore = useEnumStore()
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{ iotModelId: string; deviceId: string; show: boolean; autoUpdate: boolean; attributeType: ModelAttributeType;model:string;madeinFactory:string }>(),
|
defineProps<{
|
||||||
|
iotModelId: string
|
||||||
|
deviceId: string
|
||||||
|
show: boolean
|
||||||
|
autoUpdate: boolean
|
||||||
|
attributeType: ModelAttributeType
|
||||||
|
model: string
|
||||||
|
madeinFactory: string
|
||||||
|
}>(),
|
||||||
{
|
{
|
||||||
iotModelId: '',
|
iotModelId: '',
|
||||||
deviceId: '',
|
deviceId: '',
|
||||||
show: false,
|
show: false,
|
||||||
autoUpdate: false,
|
autoUpdate: false,
|
||||||
attributeType: 138,
|
attributeType: 138,
|
||||||
model:'',
|
model: '',
|
||||||
madeinFactory:''
|
madeinFactory: '',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -214,7 +220,7 @@ const getMalfunctionEnums = () => {
|
|||||||
queryfaultCodeDict({ madeinfactory: props.madeinFactory, model: props.model }).then((res) => {
|
queryfaultCodeDict({ madeinfactory: props.madeinFactory, model: props.model }).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const data: any = {}
|
const data: any = {}
|
||||||
res.data.forEach((item: any) => {
|
res.data.forEach((item: any) => {
|
||||||
data[item.code] = item.description
|
data[item.code] = item.description
|
||||||
})
|
})
|
||||||
malFunctionEnums = data
|
malFunctionEnums = data
|
||||||
@ -222,7 +228,6 @@ const getMalfunctionEnums = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const getCompleteData = () => {
|
const getCompleteData = () => {
|
||||||
getAttributeList()
|
getAttributeList()
|
||||||
.then(({ data, codeList }: any) => {
|
.then(({ data, codeList }: any) => {
|
||||||
@ -236,7 +241,7 @@ const getCompleteData = () => {
|
|||||||
if (enumStore.keys.includes(item.attributeCode)) {
|
if (enumStore.keys.includes(item.attributeCode)) {
|
||||||
realValItem = enumStore.data[item.attributeCode][realValItem]
|
realValItem = enumStore.data[item.attributeCode][realValItem]
|
||||||
}
|
}
|
||||||
if(malFunctionKeys.includes(item.attributeCode)){
|
if (malFunctionKeys.includes(item.attributeCode)) {
|
||||||
realValItem = malFunctionEnums?.[realValItem] ?? realValItem
|
realValItem = malFunctionEnums?.[realValItem] ?? realValItem
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
@ -119,6 +119,10 @@ export const excelDefaultConfig: any = {
|
|||||||
{
|
{
|
||||||
label: '限值2下限',
|
label: '限值2下限',
|
||||||
code: 'limit2Low'
|
code: 'limit2Low'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'强制归档',
|
||||||
|
code:'forceArchive',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
R0C4: ['03', '04'],
|
R0C4: ['03', '04'],
|
||||||
@ -233,6 +237,10 @@ export const excelDefaultConfig: any = {
|
|||||||
label: '寄存器地址',
|
label: '寄存器地址',
|
||||||
code: 'col3',
|
code: 'col3',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label:'强制归档',
|
||||||
|
code:'forceArchive',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
R0C4: ['03', '04'],
|
R0C4: ['03', '04'],
|
||||||
R0C5: [
|
R0C5: [
|
||||||
@ -262,6 +270,10 @@ export const excelDefaultConfig: any = {
|
|||||||
label: '寄存器',
|
label: '寄存器',
|
||||||
code: 'col3',
|
code: 'col3',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label:'强制归档',
|
||||||
|
code:'forceArchive',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
R0C4: ['01', '02', '03', '04'],
|
R0C4: ['01', '02', '03', '04'],
|
||||||
},
|
},
|
||||||
@ -335,6 +347,10 @@ export const excelDefaultConfig: any = {
|
|||||||
{
|
{
|
||||||
label: '限值2下限',
|
label: '限值2下限',
|
||||||
code: 'limit2Low'
|
code: 'limit2Low'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:'强制归档',
|
||||||
|
code:'forceArchive',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
R0C4: [
|
R0C4: [
|
||||||
@ -394,6 +410,10 @@ export const excelDefaultConfig: any = {
|
|||||||
139: {
|
139: {
|
||||||
name: '累计量',
|
name: '累计量',
|
||||||
head: [
|
head: [
|
||||||
|
{
|
||||||
|
label:'强制归档',
|
||||||
|
code:'forceArchive',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
//遥信140 DISCRETE
|
//遥信140 DISCRETE
|
||||||
@ -412,6 +432,10 @@ export const excelDefaultConfig: any = {
|
|||||||
label: '寄存器地址',
|
label: '寄存器地址',
|
||||||
code: 'registerAddr',
|
code: 'registerAddr',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label:'强制归档',
|
||||||
|
code:'forceArchive',
|
||||||
|
}
|
||||||
],
|
],
|
||||||
R0C4: [
|
R0C4: [
|
||||||
"8位归一化值",
|
"8位归一化值",
|
||||||
|
@ -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,11 +335,12 @@ const statAnalysisOperate = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const series = {
|
const series = {
|
||||||
type: 'line',
|
type: 'scatter',
|
||||||
data: seriesData,
|
data: seriesData,
|
||||||
name: '实际值',
|
name: '实际值',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
animation: false,
|
symbolSize: 5,
|
||||||
|
symbol: 'circle',
|
||||||
}
|
}
|
||||||
option.series.push(series)
|
option.series.push(series)
|
||||||
option.legend.data.push('实际值')
|
option.legend.data.push('实际值')
|
||||||
@ -355,7 +355,8 @@ const statAnalysisOperate = () => {
|
|||||||
data: seriesData,
|
data: seriesData,
|
||||||
name: '理论值',
|
name: '理论值',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
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
|
||||||
@ -515,8 +512,8 @@ const historyDataReq = (promises: any) => {
|
|||||||
data: yData.map((value: any) => ({
|
data: yData.map((value: any) => ({
|
||||||
value: getCutDecimalsValue(value, 2),
|
value: getCutDecimalsValue(value, 2),
|
||||||
})),
|
})),
|
||||||
showSymbol: true,
|
symbolSize: 5,
|
||||||
animation: false,
|
symbol: 'circle',
|
||||||
}
|
}
|
||||||
option.legend.data.push(customName[index])
|
option.legend.data.push(customName[index])
|
||||||
option.series.push(seriesData)
|
option.series.push(seriesData)
|
||||||
|
@ -459,7 +459,8 @@ const historyDataReq = (data: any) => {
|
|||||||
value: getCutDecimalsValue(value, 2),
|
value: getCutDecimalsValue(value, 2),
|
||||||
unit: unit, // 将单位添加到每个数据点
|
unit: unit, // 将单位添加到每个数据点
|
||||||
})),
|
})),
|
||||||
animation: false,
|
symbolSize: 5,
|
||||||
|
symbol: 'circle',
|
||||||
}
|
}
|
||||||
option.tooltip = {
|
option.tooltip = {
|
||||||
show: true,
|
show: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user