From b675c93480c97c41d8334f3452f2d25070dfef33 Mon Sep 17 00:00:00 2001 From: xs Date: Thu, 29 Jan 2026 14:09:02 +0800 Subject: [PATCH] =?UTF-8?q?4.1.0=20fix(=E7=9B=91=E6=8E=A7=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0)=EF=BC=9A=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=9B=91=E6=B5=8B=E6=9F=A5=E8=AF=A2=E5=8D=95=E4=BD=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HwDeviceServiceImpl.java | 421 ++++++++++++------ .../business/HwDeviceModeFunctionMapper.xml | 2 +- 2 files changed, 291 insertions(+), 132 deletions(-) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java index ed5538d..5a0cf21 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java @@ -424,159 +424,318 @@ public class HwDeviceServiceImpl implements IHwDeviceService { */ @Override public Map> getDevicesByMonitor(HwDevice queryHwDevice) { - Map> devicesMap = new HashMap>(); - List controlDeviceVos = new ArrayList(); - List acquisitionDeviceVos = new ArrayList(); - String databaseName = TdEngineConstants.getDatabaseName(); + try { + Map> devicesMap = new HashMap<>(); + List controlDeviceVos = new ArrayList<>(); + List acquisitionDeviceVos = new ArrayList<>(); + String databaseName = TdEngineConstants.getDatabaseName(); - List hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice); + List hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice); -/* 获取该监控单元节点下的所有子孙节点的设备 */ - //获取所有监控单元 - List hwMonitorUnits = hwMonitorUnitMapper.selectHwMonitorUnitList(new HwMonitorUnit()); - Long targetNodeId = queryHwDevice.getMonitorUnitId();//目标节点,即父节点ID - //TODO(zangch,2024.10.16):在hwDevices拼接子孙节点的设备列表,数据库样本少未完全验证性能和有效性 - //调用递归方法 - List descendants = getAllHwMonitorUnits(hwMonitorUnits,targetNodeId); - // 遍历所有监控单元 - for (HwMonitorUnit hwMonitorUnit : descendants){ - // 创建设备对象 - HwDevice hwMonitorUnitDevice = new HwDevice(); - // 设置监控单元ID - hwMonitorUnitDevice.setMonitorUnitId(hwMonitorUnit.getMonitorUnitId()); - // 根据监控单元ID查询设备列表 - List hwDevicesByMonitor = hwDeviceMapper.selectHwDeviceListByMonitor(hwMonitorUnitDevice); - // 将查询到的设备列表添加到总列表中 - hwDevices.addAll(hwDevicesByMonitor); - } + /* 获取该监控单元节点下的所有子孙节点的设备 */ + List hwMonitorUnits = hwMonitorUnitMapper.selectHwMonitorUnitList(new HwMonitorUnit()); + Long targetNodeId = queryHwDevice.getMonitorUnitId(); + List descendants = getAllHwMonitorUnits(hwMonitorUnits, targetNodeId); - if (hwDevices.size()>0){ - hwDevices.forEach(hwDevice -> { - Long deviceId = hwDevice.getDeviceId(); - HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); - queryDeviceModeFunction.setDeviceModeId(hwDevice.getDeviceModeId()); - List deviceModeFunctions = hwDevieModeFunctionMapper.selectHwDeviceModeFunctionList(queryDeviceModeFunction); + for (HwMonitorUnit hwMonitorUnit : descendants) { + HwDevice hwMonitorUnitDevice = new HwDevice(); + hwMonitorUnitDevice.setMonitorUnitId(hwMonitorUnit.getMonitorUnitId()); + List hwDevicesByMonitor = hwDeviceMapper.selectHwDeviceListByMonitor(hwMonitorUnitDevice); + hwDevices.addAll(hwDevicesByMonitor); + } - String tableName = TdEngineConstants.getDeviceDataTableName(deviceId); - TdSelectDto tdSelectDto = new TdSelectDto(); - tdSelectDto.setDatabaseName(databaseName); - tdSelectDto.setTableName(tableName); - List schemaFieldValues = new ArrayList(); - List modeFunctions = new ArrayList<>(); + if (hwDevices!=null && !hwDevices.isEmpty()) { + for (HwDevice hwDevice : hwDevices) { + Long deviceId = hwDevice.getDeviceId(); + HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); + queryDeviceModeFunction.setDeviceModeId(hwDevice.getDeviceModeId()); + List deviceModeFunctions = + hwDevieModeFunctionMapper.selectHwDeviceModeFunctionList(queryDeviceModeFunction); - deviceModeFunctions.forEach(mf -> { - //是属性的,并且是可显示的 - if (mf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) - && !mf.getDisplayFlag().equals(HwDictConstants.DEVICE_MODE_FUNCTION_DISPLAY_FLAG_NO)) { - TdField field = new TdField(); - String functionIdentifierTransfer = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(mf.getFunctionIdentifier()); - String functionIdentifier = functionIdentifierTransfer == null ? mf.getFunctionIdentifier() : functionIdentifierTransfer; - field.setFieldName(functionIdentifier); - schemaFieldValues.add(field); - } else if (mf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE)) { - modeFunctions.add(mf); - } + String tableName = TdEngineConstants.getDeviceDataTableName(deviceId); + TdSelectDto tdSelectDto = new TdSelectDto(); + tdSelectDto.setDatabaseName(databaseName); + tdSelectDto.setTableName(tableName); - }); - tdSelectDto.setSchemaFieldValues(schemaFieldValues); - //从tdengine获取此设备的最新数据 - List> deviceLatestDataMapList = - (List>) this.remoteTdEngineService.getLatestData(tdSelectDto, SecurityConstants.INNER).getData(); + List schemaFieldValues = new ArrayList<>(); + List modeFunctions = new ArrayList<>(); + for (HwDeviceModeFunction mf : deviceModeFunctions) { + if (mf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) + && !mf.getDisplayFlag().equals(HwDictConstants.DEVICE_MODE_FUNCTION_DISPLAY_FLAG_NO)) { + TdField field = new TdField(); + String functionIdentifierTransfer = + TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(mf.getFunctionIdentifier()); + String functionIdentifier = functionIdentifierTransfer == null ? + mf.getFunctionIdentifier() : functionIdentifierTransfer; + field.setFieldName(functionIdentifier); + schemaFieldValues.add(field); + } else if (mf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE)) { + modeFunctions.add(mf); + } + } - //获取此设备模型的功能列表 - //获取可控制设备:根据功能是属性的并且属性的数据类型是tinyint类型的(bool类型开关就是用tinyint),并且是读写的 -// List dds = deviceModeFunctions.stream() -// .filter(dmf -> dmf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) -// && dmf.getDataType() != null -// && String.valueOf(dmf.getDataType()) -// .equals(String.valueOf(DataTypeEnums.TINYINT.getDataCode())) -// && dmf.getRwFlag()!=null -// && dmf.getRwFlag().equals(HwDictConstants.RW_FLAG_RW) -// ).collect(Collectors.toList()); + tdSelectDto.setSchemaFieldValues(schemaFieldValues); + List> deviceLatestDataMapList = + (List>) this.remoteTdEngineService.getLatestData(tdSelectDto, SecurityConstants.INNER).getData(); - //转换成map,key为标识符,value为功能名称(主要tdengine存的是标识符,用来下面转换成功能名称) - Map functionIndentifierName = deviceModeFunctions.stream().collect( - Collectors.toMap(HwDeviceModeFunction::getFunctionIdentifier, - HwDeviceModeFunction::getFunctionName)); - Map functionIndentifierNameMap = new HashMap<>(); - functionIndentifierName.forEach((key, val) -> - { - String keyTransfer = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key) == null ? - key : TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key); - functionIndentifierNameMap.put(keyTransfer, val); + // 创建标识符映射 + Map functionIndentifierNameMap = new HashMap<>(); + for (HwDeviceModeFunction dmf : deviceModeFunctions) { + String key = dmf.getFunctionIdentifier(); + String val = dmf.getFunctionName(); + String keyTransfer = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key); + functionIndentifierNameMap.put(keyTransfer == null ? key : keyTransfer, val); + } - }); - //获取可控制设备,根据是否有服务判断 -// List modeFunctions = deviceModeFunctions.stream() -// .filter(dmf -> dmf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE) -// ).collect(Collectors.toList()); + // 处理控制设备 + if (modeFunctions!=null && !modeFunctions.isEmpty()) { + for (HwDeviceModeFunction modeFunction : modeFunctions) { + HwDeviceVo hwDeviceVo = new HwDeviceVo(); + hwDeviceVo.setDeviceId(deviceId); + hwDeviceVo.setDeviceType(HwDictConstants.CONTROL_DEVICE); + hwDeviceVo.setDeviceCode(hwDevice.getDeviceCode()); + hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); + hwDeviceVo.setDevicePic(hwDevice.getDevicePic()); + hwDeviceVo.setDeviceModeFunction(modeFunction); + controlDeviceVos.add(hwDeviceVo); + } + } - if (modeFunctions != null && modeFunctions.size() > 0) { - modeFunctions.forEach(modeFunction -> { + // 处理采集数据 + Map ddValueMap = new HashMap<>(); + Date updateTime = null; + + if (deviceLatestDataMapList!=null && !deviceLatestDataMapList.isEmpty()) { + for (Map deviceLatestDataMap : deviceLatestDataMapList) { + for (Map.Entry entry : deviceLatestDataMap.entrySet()) { + String dataFunctionIdentifier = entry.getKey(); + + // 处理时间戳字段 + if ("ts".equals(dataFunctionIdentifier) && entry.getValue() != null) { + try { + String ts = entry.getValue().toString(); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + ZonedDateTime parse = ZonedDateTime.parse(ts, dateTimeFormatter); + updateTime = Date.from(parse.toInstant()); + } catch (Exception e) { +// log.error("解析时间戳出错: {}", entry.getValue(), e); + } + continue; // 时间戳不添加到 ddValueMap + } + + // 处理其他数据字段 + if (functionIndentifierNameMap.containsKey(dataFunctionIdentifier)) { + String unit=""; + try { + // 修复:处理可能返回多个结果的情况 + if ("value1".equals(dataFunctionIdentifier)) { + unit = hwDevieModeFunctionMapper.selectUbitByIdAndName("value", hwDevice.getDeviceModeId()); + } else { + unit = hwDevieModeFunctionMapper.selectUbitByIdAndName(dataFunctionIdentifier, hwDevice.getDeviceModeId()); + } +// unit = (units != null && !units.isEmpty()) ? units.get(0) : null; + } catch (Exception e) { + System.out.println( dataFunctionIdentifier+"---"+hwDevice.getDeviceModeId()); +// log.error("查询单位时出错: functionIdentifier={}, deviceModeId={}", +// dataFunctionIdentifier, hwDevice.getDeviceModeId(), e); + } + + Object value = entry.getValue(); + if (unit != null && value != null) { + value = value.toString() + unit; + } + ddValueMap.put(functionIndentifierNameMap.get(dataFunctionIdentifier), value); + } + } + } + } + + // 创建设备VO对象 HwDeviceVo hwDeviceVo = new HwDeviceVo(); hwDeviceVo.setDeviceId(deviceId); - hwDeviceVo.setDeviceType(HwDictConstants.CONTROL_DEVICE); + hwDeviceVo.setDeviceModeId(hwDevice.getDeviceModeId()); hwDeviceVo.setDeviceCode(hwDevice.getDeviceCode()); hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); hwDeviceVo.setDevicePic(hwDevice.getDevicePic()); - hwDeviceVo.setDeviceModeFunction(modeFunction); - controlDeviceVos.add(hwDeviceVo); - }); + hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE); + hwDeviceVo.setDeviceDataMap(ddValueMap); + hwDeviceVo.setUpdateTime(updateTime); // 设置更新时间 + acquisitionDeviceVos.add(hwDeviceVo); + } } - //将functionIdetifier转换成功能名称 - Map ddValueMap = new HashMap(); - if (deviceLatestDataMapList != null) { - deviceLatestDataMapList.forEach(deviceLatestDataMap -> { - Set functionIdentifiers = deviceLatestDataMap.keySet(); - for (String dataFunctionIdentifier : functionIdentifiers) { - if (functionIndentifierNameMap.get(dataFunctionIdentifier) != null) { - String unit; - if (dataFunctionIdentifier.equals("value1")){ - unit = hwDevieModeFunctionMapper.selectUbitByIdAndName("value",hwDevice.getDeviceModeId()); - }else { - unit = hwDevieModeFunctionMapper.selectUbitByIdAndName(dataFunctionIdentifier,hwDevice.getDeviceModeId()); - } - Object value; - if (unit == null){ - value = deviceLatestDataMap.get(dataFunctionIdentifier); - }else { - value = deviceLatestDataMap.get(dataFunctionIdentifier) + unit; - } - ddValueMap.put(functionIndentifierNameMap.get(dataFunctionIdentifier), - value); - } - } - }); - } - //不论是否是控制型设备都显示最新数据 - HwDeviceVo hwDeviceVo = new HwDeviceVo(); - hwDeviceVo.setDeviceId(deviceId); - hwDeviceVo.setDeviceModeId(hwDevice.getDeviceModeId()); - hwDeviceVo.setDeviceCode(hwDevice.getDeviceCode()); - hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); - hwDeviceVo.setDevicePic(hwDevice.getDevicePic()); - hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE); - hwDeviceVo.setDeviceDataMap(ddValueMap); - if (deviceLatestDataMapList.size()>0){ - String ts = deviceLatestDataMapList.get(0).get("ts").toString(); - DateTimeFormatter dateTime = DateTimeFormatter.ISO_OFFSET_DATE_TIME; - ZonedDateTime parse = ZonedDateTime.parse(ts, dateTime); - Date updateTime = Date.from(parse.toInstant()); - hwDeviceVo.setUpdateTime(updateTime); - } - acquisitionDeviceVos.add(hwDeviceVo); + devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos); + devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos); - }); + return devicesMap; + } catch (Exception e) { + // 根据业务需求决定是否抛出异常或返回空结果 + return Collections.emptyMap(); } - - devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos); - devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos); - - return devicesMap; } + +// public Map> getDevicesByMonitor(HwDevice queryHwDevice) { +// try { +// Map> devicesMap = new HashMap>(); +// List controlDeviceVos = new ArrayList(); +// List acquisitionDeviceVos = new ArrayList(); +// String databaseName = TdEngineConstants.getDatabaseName(); +// +// List hwDevices = hwDeviceMapper.selectHwDeviceListByMonitor(queryHwDevice); +// +// /* 获取该监控单元节点下的所有子孙节点的设备 */ +// //获取所有监控单元 +// List hwMonitorUnits = hwMonitorUnitMapper.selectHwMonitorUnitList(new HwMonitorUnit()); +// Long targetNodeId = queryHwDevice.getMonitorUnitId();//目标节点,即父节点ID +// //TODO(zangch,2024.10.16):在hwDevices拼接子孙节点的设备列表,数据库样本少未完全验证性能和有效性 +// //调用递归方法 +// List descendants = getAllHwMonitorUnits(hwMonitorUnits, targetNodeId); +// // 遍历所有监控单元 +// for (HwMonitorUnit hwMonitorUnit : descendants) { +// // 创建设备对象 +// HwDevice hwMonitorUnitDevice = new HwDevice(); +// // 设置监控单元ID +// hwMonitorUnitDevice.setMonitorUnitId(hwMonitorUnit.getMonitorUnitId()); +// // 根据监控单元ID查询设备列表 +// List hwDevicesByMonitor = hwDeviceMapper.selectHwDeviceListByMonitor(hwMonitorUnitDevice); +// // 将查询到的设备列表添加到总列表中 +// hwDevices.addAll(hwDevicesByMonitor); +// } +// +// if (hwDevices != null && !hwDevices.isEmpty()) { +// for(HwDevice hwDevice : hwDevices) { +// Long deviceId = hwDevice.getDeviceId(); +// HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); +// queryDeviceModeFunction.setDeviceModeId(hwDevice.getDeviceModeId()); +// List deviceModeFunctions = hwDevieModeFunctionMapper.selectHwDeviceModeFunctionList(queryDeviceModeFunction); +// +// String tableName = TdEngineConstants.getDeviceDataTableName(deviceId); +// TdSelectDto tdSelectDto = new TdSelectDto(); +// tdSelectDto.setDatabaseName(databaseName); +// tdSelectDto.setTableName(tableName); +// List schemaFieldValues = new ArrayList(); +// List modeFunctions = new ArrayList<>(); +// +// for (HwDeviceModeFunction mf : deviceModeFunctions) { +// //是属性的,并且是可显示的 +// if (mf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) +// && !mf.getDisplayFlag().equals(HwDictConstants.DEVICE_MODE_FUNCTION_DISPLAY_FLAG_NO)) { +// TdField field = new TdField(); +// String functionIdentifierTransfer = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(mf.getFunctionIdentifier()); +// String functionIdentifier = functionIdentifierTransfer == null ? mf.getFunctionIdentifier() : functionIdentifierTransfer; +// field.setFieldName(functionIdentifier); +// schemaFieldValues.add(field); +// } else if (mf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE)) { +// modeFunctions.add(mf); +// } +// +// } +// tdSelectDto.setSchemaFieldValues(schemaFieldValues); +// //从tdengine获取此设备的最新数据 +// List> deviceLatestDataMapList = +// (List>) this.remoteTdEngineService.getLatestData(tdSelectDto, SecurityConstants.INNER).getData(); +// +// +// //获取此设备模型的功能列表 +// //获取可控制设备:根据功能是属性的并且属性的数据类型是tinyint类型的(bool类型开关就是用tinyint),并且是读写的 +//// List dds = deviceModeFunctions.stream() +//// .filter(dmf -> dmf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) +//// && dmf.getDataType() != null +//// && String.valueOf(dmf.getDataType()) +//// .equals(String.valueOf(DataTypeEnums.TINYINT.getDataCode())) +//// && dmf.getRwFlag()!=null +//// && dmf.getRwFlag().equals(HwDictConstants.RW_FLAG_RW) +//// ).collect(Collectors.toList()); +// +// //转换成map,key为标识符,value为功能名称(主要tdengine存的是标识符,用来下面转换成功能名称) +// Map functionIndentifierName = deviceModeFunctions.stream().collect( +// Collectors.toMap(HwDeviceModeFunction::getFunctionIdentifier, +// HwDeviceModeFunction::getFunctionName)); +// Map functionIndentifierNameMap = new HashMap<>(); +// functionIndentifierName.forEach((key, val) -> +// { +// String keyTransfer = TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key) == null ? +// key : TdEngineConstants.TDENGINE_KEY_TRANSFER_MAP.get(key); +// functionIndentifierNameMap.put(keyTransfer, val); +// +// }); +// //获取可控制设备,根据是否有服务判断 +//// List modeFunctions = deviceModeFunctions.stream() +//// .filter(dmf -> dmf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_SERVICE) +//// ).collect(Collectors.toList()); +// +// if (modeFunctions != null && modeFunctions.size() > 0) { +// for (HwDeviceModeFunction modeFunction : modeFunctions) { +// HwDeviceVo hwDeviceVo = new HwDeviceVo(); +// hwDeviceVo.setDeviceId(deviceId); +// hwDeviceVo.setDeviceType(HwDictConstants.CONTROL_DEVICE); +// hwDeviceVo.setDeviceCode(hwDevice.getDeviceCode()); +// hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); +// hwDeviceVo.setDevicePic(hwDevice.getDevicePic()); +// hwDeviceVo.setDeviceModeFunction(modeFunction); +// controlDeviceVos.add(hwDeviceVo); +// } +// } +// +// //将functionIdetifier转换成功能名称 +// Map ddValueMap = new HashMap(); +// if (deviceLatestDataMapList != null) { +// for (Map deviceLatestDataMap : deviceLatestDataMapList) { +// Set functionIdentifiers = deviceLatestDataMap.keySet(); +// for (String dataFunctionIdentifier : functionIdentifiers) { +// if (functionIndentifierNameMap.get(dataFunctionIdentifier) != null) { +// String unit; +// if (dataFunctionIdentifier.equals("value1")) { +// unit = hwDevieModeFunctionMapper.selectUbitByIdAndName("value", hwDevice.getDeviceModeId()); +// } else { +// unit = hwDevieModeFunctionMapper.selectUbitByIdAndName(dataFunctionIdentifier, hwDevice.getDeviceModeId()); +// } +// Object value; +// if (unit == null) { +// value = deviceLatestDataMap.get(dataFunctionIdentifier); +// } else { +// value = deviceLatestDataMap.get(dataFunctionIdentifier) + unit; +// } +// ddValueMap.put(functionIndentifierNameMap.get(dataFunctionIdentifier), +// value); +// } +// } +// } +// } +// //不论是否是控制型设备都显示最新数据 +// HwDeviceVo hwDeviceVo = new HwDeviceVo(); +// hwDeviceVo.setDeviceId(deviceId); +// hwDeviceVo.setDeviceModeId(hwDevice.getDeviceModeId()); +// hwDeviceVo.setDeviceCode(hwDevice.getDeviceCode()); +// hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); +// hwDeviceVo.setDevicePic(hwDevice.getDevicePic()); +// hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE); +// hwDeviceVo.setDeviceDataMap(ddValueMap); +// if (deviceLatestDataMapList.size() > 0) { +// String ts = deviceLatestDataMapList.get(0).get("ts").toString(); +// DateTimeFormatter dateTime = DateTimeFormatter.ISO_OFFSET_DATE_TIME; +// ZonedDateTime parse = ZonedDateTime.parse(ts, dateTime); +// Date updateTime = Date.from(parse.toInstant()); +// hwDeviceVo.setUpdateTime(updateTime); +// } +// acquisitionDeviceVos.add(hwDeviceVo); +// +// } +// } +// +// devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos); +// devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos); +// +// return devicesMap; +// }catch (Exception e){ +// e.printStackTrace(); +// System.out.println(e.getMessage()); +// return null; +// } +// } + //TODO(zangch,2024.10.16):递归获取所有子孙节点,数据库数据太少没办法验证是否完全有效 /* 根据节点ID获取所有子孙节点*/ private List getAllHwMonitorUnits(List hwMonitorUnits,Long nodeId){ diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml index fd3fc50..1c578a9 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceModeFunctionMapper.xml @@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where mode_function_id = #{modeFunctionId}