diff --git a/mh-admin/src/main/java/com/mh/web/controller/monitor/AirHandingUnitsMonitorController.java b/mh-admin/src/main/java/com/mh/web/controller/monitor/AirHandingUnitsMonitorController.java new file mode 100644 index 0000000..f3a38ea --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/monitor/AirHandingUnitsMonitorController.java @@ -0,0 +1,42 @@ +package com.mh.web.controller.monitor; + +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.dto.DeviceMonitorDTO; +import com.mh.common.core.page.TableDataInfo; +import com.mh.system.service.device.ICollectionParamsManageService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 风柜监控系统 + * @date 2025-03-17 17:33:24 + */ +@RestController +@RequestMapping("/device/ahu") +public class AirHandingUnitsMonitorController extends BaseController { + + private final ICollectionParamsManageService iCollectionParamsManageService; + + public AirHandingUnitsMonitorController(ICollectionParamsManageService iCollectionParamsManageService) { + this.iCollectionParamsManageService = iCollectionParamsManageService; + } + + /** + * 获取监控列表内容数据 + */ + @GetMapping("/monitor/list") + public TableDataInfo list(@RequestParam(name = "systemType") String systemType, @RequestParam(name = "houseId") String houseId) + { + List list = iCollectionParamsManageService.selectMonitorListBySystemTypeAndHouseId(systemType, houseId); + return getDataTable(list); + } + +} diff --git a/mh-admin/src/main/java/com/mh/web/controller/monitor/CoolingSystemMonitorController.java b/mh-admin/src/main/java/com/mh/web/controller/monitor/CoolingSystemMonitorController.java new file mode 100644 index 0000000..95f4dc1 --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/monitor/CoolingSystemMonitorController.java @@ -0,0 +1,64 @@ +package com.mh.web.controller.monitor; + +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.dto.DeviceMonitorDTO; +import com.mh.common.core.domain.vo.DeviceOperateMonitorVO; +import com.mh.common.core.page.TableDataInfo; +import com.mh.system.service.device.ICollectionParamsManageService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 冷源系统监测 + * @date 2025-03-17 17:36:44 + */ +@Slf4j +@RestController +@RequestMapping("/device/cs") +public class CoolingSystemMonitorController extends BaseController { + + private final ICollectionParamsManageService iCollectionParamsManageService; + + public CoolingSystemMonitorController(ICollectionParamsManageService iCollectionParamsManageService) { + this.iCollectionParamsManageService = iCollectionParamsManageService; + } + + /** + * 获取监控列表内容数据 + */ + @PreAuthorize("@ss.hasPermi('device:cpm:list')") + @GetMapping("/monitor/list") + public TableDataInfo list(@RequestParam(name = "systemType") String systemType) + { + List list = iCollectionParamsManageService.selectMonitorListBySystemType(systemType); + return getDataTable(list); + } + + /** + * 对设备进行操作处理获取对应的列表数据 + * + * @param systemType + * @return + */ + @PreAuthorize("@ss.hasPermi('device:cpm:operationList')") + @GetMapping("/operation/list") + public TableDataInfo operationDeviceList(@RequestParam(name = "systemType") String systemType) { + try { + List deviceOperateMonitorVOS = iCollectionParamsManageService.operationDeviceList(systemType); + return getDataTable(deviceOperateMonitorVOS); + } catch (Exception e) { + log.error("设备操作失败", e); + return getDataTable(null); + } + } + +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java b/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java index 1500aff..56ea0e7 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java @@ -265,4 +265,28 @@ public interface CollectionParamsManageMapper extends BaseMapper selectHotWaterBySystemTypeAndBuildingId(@Param("systemType") String systemType, @Param("floorId") String floorId); + + @Select("select " + + " cpm.id, " + + " dl.device_type as mt_type, " + + " cpm.device_ledger_id, " + + " dl.device_name, " + + " cpm.other_name, " + + " cpm.cur_value, " + + " cpm.cur_time, " + + " cpm.param_type " + + "from " + + " collection_params_manage cpm " + + "left join device_ledger dl on " + + " cpm.device_ledger_id = dl.id " + + "left join cpm_space_relation csr on " + + " cpm.id = csr.cpm_id " + + "left join house_info hi on " + + " csr.house_id = hi.id " + + "where " + + " csr.house_id = #{houseId} " + + " and cpm.system_type = #{systemType} " + + " order by dl.order_num ") + List selectBySystemTypeAndHouseId(@Param("systemType") String systemType, + @Param("houseId") String houseId); } diff --git a/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java b/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java index 206f864..4b46366 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java +++ b/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java @@ -68,4 +68,12 @@ public interface ICollectionParamsManageService { * @return */ List operateList(String systemType, String floorId); + + /** + * 获取风柜系统相关控制信息 + * @param systemType + * @param houseId + * @return + */ + List selectMonitorListBySystemTypeAndHouseId(String systemType, String houseId); } diff --git a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java index 2e275d7..4a768f8 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java @@ -506,4 +506,49 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag .collect(Collectors.toList()); } + @Override + public List selectMonitorListBySystemTypeAndHouseId(String systemType, String houseId) { + // 根据系统类型查询出对应的设备 + List collectionParamsManages = collectionParamsManageMapper.selectBySystemTypeAndHouseId(systemType, houseId); + if (collectionParamsManages.isEmpty()) { + return List.of(); + } + // 得出的collectionParamsManages进行数据赋值,如果paramType="1',则是运行状态,则赋值给runStatus, + // 如果paramType="5",则是故障报警,则赋值给alarmStatus + // 如果paramType="6",则是手自动状态,则赋值给handOrAuto + // 如果paramType="4",则是频率反馈,则赋值给frequency + // 使用Stream API处理数据 + Map> groupedByDeviceType = collectionParamsManages.stream() + .collect(Collectors.groupingBy(CollectionParamsManageVO::getId)) + .values() + .stream() + .map(params -> { + DeviceMonitorVO deviceMonitorVO = new DeviceMonitorVO(); + for (CollectionParamsManageVO param : params) { + deviceMonitorVO.setId(param.getId()); + deviceMonitorVO.setDeviceLedgerId(param.getDeviceLedgerId()); + deviceMonitorVO.setDeviceName(param.getDeviceName()); + deviceMonitorVO.setDeviceType(param.getMtType()); + deviceMonitorVO.setCollectName(param.getOtherName()); + deviceMonitorVO.setCollectTime(param.getCurTime()); + deviceMonitorVO.setCollectValue(String.valueOf(param.getCurValue())); + deviceMonitorVO.setParamType(param.getParamType()); + } + return deviceMonitorVO; + }) + .collect(Collectors.groupingBy(DeviceMonitorVO::getDeviceType)); + + // 根据deviceType进行分组,赋值给List得出结果集 + List result = groupedByDeviceType.entrySet().stream() + .map(entry -> { + DeviceMonitorDTO deviceMonitorDTO = new DeviceMonitorDTO(); + deviceMonitorDTO.setName(entry.getKey()); + deviceMonitorDTO.setValues(entry.getValue()); + return deviceMonitorDTO; + }) + .collect(Collectors.toList()); + + return result; + } + }