Browse Source

1、风柜系统监控接口编写;

dev
mh 2 months ago
parent
commit
7d669cc84b
  1. 42
      mh-admin/src/main/java/com/mh/web/controller/monitor/AirHandingUnitsMonitorController.java
  2. 64
      mh-admin/src/main/java/com/mh/web/controller/monitor/CoolingSystemMonitorController.java
  3. 24
      mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java
  4. 8
      mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java
  5. 45
      mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java

42
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<DeviceMonitorDTO> list = iCollectionParamsManageService.selectMonitorListBySystemTypeAndHouseId(systemType, houseId);
return getDataTable(list);
}
}

64
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<DeviceMonitorDTO> 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<DeviceOperateMonitorVO> deviceOperateMonitorVOS = iCollectionParamsManageService.operationDeviceList(systemType);
return getDataTable(deviceOperateMonitorVOS);
} catch (Exception e) {
log.error("设备操作失败", e);
return getDataTable(null);
}
}
}

24
mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java

@ -265,4 +265,28 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam
" order by dl.order_num ") " order by dl.order_num ")
List<HotWaterControlListVO> selectHotWaterBySystemTypeAndBuildingId(@Param("systemType") String systemType, List<HotWaterControlListVO> selectHotWaterBySystemTypeAndBuildingId(@Param("systemType") String systemType,
@Param("floorId") String floorId); @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<CollectionParamsManageVO> selectBySystemTypeAndHouseId(@Param("systemType") String systemType,
@Param("houseId") String houseId);
} }

8
mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java

@ -68,4 +68,12 @@ public interface ICollectionParamsManageService {
* @return * @return
*/ */
List<HotWaterControlDTO> operateList(String systemType, String floorId); List<HotWaterControlDTO> operateList(String systemType, String floorId);
/**
* 获取风柜系统相关控制信息
* @param systemType
* @param houseId
* @return
*/
List<DeviceMonitorDTO> selectMonitorListBySystemTypeAndHouseId(String systemType, String houseId);
} }

45
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()); .collect(Collectors.toList());
} }
@Override
public List<DeviceMonitorDTO> selectMonitorListBySystemTypeAndHouseId(String systemType, String houseId) {
// 根据系统类型查询出对应的设备
List<CollectionParamsManageVO> 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<String, List<DeviceMonitorVO>> 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<DeviceMonitorDTO>得出结果集
List<DeviceMonitorDTO> 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;
}
} }

Loading…
Cancel
Save