diff --git a/das/src/main/java/com/das/modules/admin/controller/LoggerController.java b/das/src/main/java/com/das/modules/admin/controller/LoggerController.java index cf41ce9a..acdffff4 100644 --- a/das/src/main/java/com/das/modules/admin/controller/LoggerController.java +++ b/das/src/main/java/com/das/modules/admin/controller/LoggerController.java @@ -12,7 +12,7 @@ import java.util.Map; import java.util.stream.Collectors; @RestController -@RequestMapping("/api/logger/") +@RequestMapping("/api/logger") public class LoggerController { private static final Logger logger = LogManager.getLogger(LoggerController.class); @@ -49,4 +49,29 @@ public class LoggerController { return R.fail(String.format("Invalid log level [%s]. Valid levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.", level)); } } + + /** + * 删除指定日志配置 + * + * @param loggerName 日志名称 + * @return 删除结果 + */ + @PostMapping("/delete") + public R deleteLogLevel(String loggerName) { + try { + LoggerContext context = (LoggerContext) LogManager.getContext(false); + LoggerConfig loggerConfig = context.getConfiguration().getLoggerConfig(loggerName); + if (loggerConfig.getName().equals(loggerName)) { + context.getConfiguration().removeLogger(loggerName); + context.updateLoggers(); + logger.info("Deleted logger [{}]", loggerName); + return R.success(String.format("Logger [%s] configuration deleted, using parent level now.", loggerName)); + } else { + return R.fail(String.format("Logger [%s] does not have a specific configuration.", loggerName)); + } + } catch (Exception e) { + logger.error("Failed to delete logger [{}]", loggerName, e); + return R.fail(String.format("Failed to delete logger [%s]: %s", loggerName, e.getMessage())); + } + } } \ No newline at end of file diff --git a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java index f4500301..b2ecf27b 100644 --- a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java @@ -9,8 +9,12 @@ import com.das.modules.node.domain.bo.TerminalMessage; import com.fasterxml.jackson.databind.JsonNode; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; +import java.util.concurrent.TimeUnit; + @Slf4j @Service(value = NodeConstant.HEARTBEAT) public class HeartbeatCommand implements BaseCommand{ @@ -18,7 +22,7 @@ public class HeartbeatCommand implements BaseCommand{ public static final long HEARTBEAT_TTL = 12L; @Autowired - AdminRedisTemplate adminRedisTemplate; + RedisTemplate redisTemplate; @Autowired CacheService cacheService; @@ -35,16 +39,28 @@ public class HeartbeatCommand implements BaseCommand{ // 解析心跳报文中的数据信息 JsonNode dataInfo = data.getData(); if (!dataInfo.isEmpty()) { + ValueOperations ops = redisTemplate.opsForValue(); // 处理链路信息 JsonNode links = data.getData().get("links"); if (links != null && links.isArray()) { for (JsonNode linkNode : links) { String linkId = linkNode.get("linkId").asText(); boolean online = linkNode.get("online").asBoolean(); + JsonNode realNode = linkNode.get("real"); + if (realNode != null){ + boolean real = realNode.asBoolean(); + String key = String.format("link:%s:modbus", linkId); + ops.set(key, real, HEARTBEAT_TTL, TimeUnit.SECONDS); + } + JsonNode ftpNode = linkNode.get("ftp"); + if (ftpNode != null){ + boolean ftp = ftpNode.asBoolean(); + String key = String.format("link:%s:ftp", linkId); + ops.set(key, ftp, HEARTBEAT_TTL, TimeUnit.SECONDS); + } String key = String.format("link:%s:online", linkId); // 更新链路在线状态到Redis - adminRedisTemplate.set(key, online ? 1 : 0); - adminRedisTemplate.expire(key, HEARTBEAT_TTL); + ops.set(key, online?1:0, HEARTBEAT_TTL, TimeUnit.SECONDS); } } @@ -62,19 +78,18 @@ public class HeartbeatCommand implements BaseCommand{ // 判断是不是风机 String keyDeviceOnline = String.format("device:%d:online", deviceId); // 更新设备在线状态到Redis - adminRedisTemplate.set(keyDeviceOnline, online ? 1 : 0); - adminRedisTemplate.expire(keyDeviceOnline, HEARTBEAT_TTL); + ops.set(keyDeviceOnline, online ? 1 : 0, HEARTBEAT_TTL, TimeUnit.SECONDS); String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId); String keyCommFaultState = String.format("RT:%d:commfaultstate",deviceId); - Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus); + Integer plcDeviceStatus = (Integer) ops.get(keyPLCDeviceStatus); log.debug("设备ID:{},在线状态:{},通讯状态: {}", deviceId, online, plcDeviceStatus); // 根据设备在线状态和通讯状态更新通讯故障状态 if (plcDeviceStatus == null){ - adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1); + ops.set(keyCommFaultState, online ? 0 : 1); } else{ - adminRedisTemplate.set(keyCommFaultState, online && (plcDeviceStatus != 0) ? 0 : 1); + ops.set(keyCommFaultState, online && (plcDeviceStatus != 0) ? 0 : 1); } } } diff --git a/docs/datacollect/README.md b/docs/datacollect/README.md index 106f3c71..988114c2 100644 --- a/docs/datacollect/README.md +++ b/docs/datacollect/README.md @@ -347,11 +347,16 @@ PS: 同一节点只允许建立一条连接。 //通讯链路IRN "linkId": "3444", //通讯链路状态 - "online": true + "online": true, + //实时数据状态 + "real": true, + //Ftp数据状态(在没有启用ftp的链路上不传此状态) + "ftp": true }, { "linkId": "123", - "online": false + "online": false, + "modbus": true } ], //设备监控信息 diff --git a/document/风电数据采集系统测试报告.docx b/document/风电数据采集系统测试报告.docx new file mode 100644 index 00000000..c9c6b10c Binary files /dev/null and b/document/风电数据采集系统测试报告.docx differ diff --git a/document/风电数据采集系统测试用例.docx b/document/风电数据采集系统测试用例.docx new file mode 100644 index 00000000..26812a1d Binary files /dev/null and b/document/风电数据采集系统测试用例.docx differ diff --git a/ui/dasadmin/src/views/backend/home/home.vue b/ui/dasadmin/src/views/backend/home/home.vue index aa845e02..1308e4a3 100644 --- a/ui/dasadmin/src/views/backend/home/home.vue +++ b/ui/dasadmin/src/views/backend/home/home.vue @@ -10,9 +10,6 @@
{{ item.name }} -
diff --git a/ui/dasadmin/src/views/backend/home/windMatrixpage.vue b/ui/dasadmin/src/views/backend/home/windMatrixpage.vue index 86e4690d..a85782df 100644 --- a/ui/dasadmin/src/views/backend/home/windMatrixpage.vue +++ b/ui/dasadmin/src/views/backend/home/windMatrixpage.vue @@ -71,10 +71,15 @@ - + {{ item.attributeMap.firsttriggeredcode }} + + {{ item.attributeMap.firsttriggeredcode }} + 已锁定
@@ -607,7 +612,7 @@ const getSafeImagePath = (item, type) => { display: flex; justify-content: space-between; height: 24px; - span{ + .rightTip{ display: inline-block; white-space: nowrap; overflow: hidden; diff --git a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue index f7881e4c..7056910b 100644 --- a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue +++ b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue @@ -441,7 +441,7 @@ const calculateAverages = (data: any) => { if (count > 0) { let averagePower = sumPower / count - result.push([windSpeed + interval, 2, getCutDecimalsValue(averagePower, 2)]) + result.push([windSpeed + interval, getCutDecimalsValue(averagePower, 2)]) } }