Compare commits

..

56 Commits

Author SHA1 Message Date
3067418132@qq.com 4e61bac0de 1、本地环境配置 1 week ago
25604 d6f030e552 1、能耗查询、设备组查询分析增加数据条数 2 months ago
25604 12e93c9b78 1、配置修改 2 months ago
25604 3b25a9e235 1、首页热回收数据日累积值计算优化; 2 months ago
25604 1b27a0c287 1、热回收系统触摸屏mqtt数据处理; 2 months ago
25604 f81769b738 1、热回收系统触摸屏mqtt数据接收 2 months ago
25604 0288f2cffb 1、设备采集参数管理; 2 months ago
25604 e5e5cee85a 1、广合二厂热回收系统:设备热量查询接口、设备组热量查询接口 2 months ago
25604 786da07f68 1、优化netty上线,减少cpu使用率; 3 months ago
25604 0a76509188 1、首页添加缓存优化; 3 months ago
25604 a383aa7cd7 1、抄表记录bug修复 4 months ago
25604 cc1a258a4f 1、运行报表增加分页参数。 4 months ago
25604 981ddd6126 1、运行报表增加分页参数。 4 months ago
25604 577e98b7b3 1、采暖系统运行报表,excel导出,编辑; 4 months ago
25604 c9e81f4ab0 1、梅州账号项目菜单区别; 4 months ago
25604 da80ade668 1、修复蒸汽机运行报表以及水箱指令生成; 5 months ago
25604 1d132511c6 1、蒸汽机运行报表记录查询、编辑、excel记录导出; 5 months ago
25604 a4739b576f 1、采暖泵接口编写 5 months ago
25604 bf81ca52c9 1、生活水箱液位前后端对接; 5 months ago
25604 1be07e2157 1、添加液位计采集 5 months ago
25604 e0df3ad93a 1、优化首页查询sql; 5 months ago
25604 22ce82f641 1、每日抄表记录报表、热水热泵运行报表添加。 6 months ago
v-lijf43 90f667ca72 1、添加豪生酒店运营部值班电话账号 6 months ago
25604 2b9f736dbb 1、风柜优化 6 months ago
25604 bc2ab582ea 1、修复热泵采集电流设置; 6 months ago
25604 6046c172a6 1、主机运行报表优化; 6 months ago
25604 bc7087a559 1、区域管理接口对接以及优化; 6 months ago
v-lijf43 42b108d055 1、日月年统计修复; 6 months ago
v-lijf43 fe759a75f4 1、添加采集点质量逻辑字段; 6 months ago
25604 f0ecb0f048 1、优化报警记录 6 months ago
v-lijf43 3c02d03a12 1、修复报警记录生成; 6 months ago
25604 60a954bcd3 1、优化风柜系统定时列表排序; 6 months ago
25604 4d64b681a9 1、定时开关风柜逻辑优化; 6 months ago
25604 99501add71 1、定时开关风柜逻辑优化; 7 months ago
25604 3754345b3d 1、当采集记录大于10000,推出; 7 months ago
25604 f8dad021d8 1、当采集记录小于等于0,则发送到延迟队列; 8 months ago
25604 0c0cf2bdf1 1、修复设备在线定时任务; 8 months ago
25604 77124eff14 1、添加锅炉主机数据点位处理(研华网关只支持4个mqtt,目前没有使用); 8 months ago
25604 5fb572cd4d 1、修复定时报警、热水记录生成; 8 months ago
25604 3ee23dea5a 1、主机系统参数报表导出、查询、编辑、定时执行存储过程 8 months ago
25604 5167e0c702 1、延迟队列实现异常误报警; 8 months ago
25604 9b4d5faf18 1、优化报警生成;2、优化微信推送异常功能; 8 months ago
25604 d2c9fca950 1、添加了冷源电表,优化对应功能。 9 months ago
25604 065e8df394 1、优化定时器:数据分析,楼层能耗分析。 9 months ago
25604 ff709ec621 1、优化策略管理排序问题。 9 months ago
25604 4d696317f2 1、报警添加微信通知功能,增加模板。 9 months ago
25604 b8d5667431 1、报警添加微信通知功能。 9 months ago
25604 4ad037f002 1、生活热水供水系统楼层查询、项目总览、能源分析、用能查询、数据分析相关接口 10 months ago
25604 dcc9307d54 1、生活热水供水系统获取设备状态信息数据 10 months ago
25604 e457861976 1、netty控制热泵设置; 10 months ago
25604 81c8a35c76 1、netty控制热泵设置; 10 months ago
25604 6973b889c8 1、netty控制热泵设置; 10 months ago
mh 36d60e0b79 1、添加通过DTU-4G,netty方式设置热泵信息; 10 months ago
mh 1603247df1 1、添加netty采集生活热水水电表、热泵信息; 10 months ago
v-lijf43 b22ba182dc PID调节风柜系统 10 months ago
mh d268edfce2 1、风柜系统添加定时开关机逻辑处理; 10 months ago
  1. BIN
      doc/节能改造每日能耗统计表.xlsx
  2. 4
      mh-admin/src/main/java/com/mh/MHRunner.java
  3. 55
      mh-admin/src/main/java/com/mh/web/controller/comprehensive/CompreReportController.java
  4. 14
      mh-admin/src/main/java/com/mh/web/controller/comprehensive/ProOverviewController.java
  5. 11
      mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java
  6. 11
      mh-admin/src/main/java/com/mh/web/controller/device/OperationController.java
  7. 8
      mh-admin/src/main/java/com/mh/web/controller/energy/SysEnergyConsumptionController.java
  8. 44
      mh-admin/src/main/java/com/mh/web/controller/energy/SysEnergyQueryController.java
  9. 6
      mh-admin/src/main/java/com/mh/web/controller/monitor/CoolingSystemMonitorController.java
  10. 45
      mh-admin/src/main/java/com/mh/web/controller/monitor/ERSMonitorController.java
  11. 70
      mh-admin/src/main/java/com/mh/web/controller/monitor/HeatingPumpMonitorController.java
  12. 57
      mh-admin/src/main/java/com/mh/web/controller/monitor/SteamBoilerMonitorController.java
  13. 96
      mh-admin/src/main/java/com/mh/web/controller/report/ReportHeatingController.java
  14. 144
      mh-admin/src/main/java/com/mh/web/controller/report/ReportHotWaterController.java
  15. 131
      mh-admin/src/main/java/com/mh/web/controller/report/ReportMeterReadingsController.java
  16. 156
      mh-admin/src/main/java/com/mh/web/controller/report/ReportSteamController.java
  17. 100
      mh-admin/src/main/java/com/mh/web/controller/report/ReportSysController.java
  18. 8
      mh-admin/src/main/java/com/mh/web/controller/space/BuildingInfoController.java
  19. 2
      mh-admin/src/main/java/com/mh/web/controller/system/SysLoginController.java
  20. 14
      mh-admin/src/main/resources/application-dev.yml
  21. 2
      mh-admin/src/main/resources/application-druid.yml
  22. 22
      mh-admin/src/main/resources/application-prod.yml
  23. 10
      mh-admin/src/main/resources/application-test.yml
  24. 2
      mh-admin/src/main/resources/application.yml
  25. 46
      mh-admin/src/main/resources/logback.xml
  26. BIN
      mh-admin/src/main/resources/节能岛改造每日能耗统计表.xlsx
  27. 137
      mh-admin/src/test/java/com/mh/MHApplicationTest.java
  28. 6
      mh-common/pom.xml
  29. 10
      mh-common/src/main/java/com/mh/common/constant/CacheConstants.java
  30. 5
      mh-common/src/main/java/com/mh/common/constant/Constants.java
  31. 170
      mh-common/src/main/java/com/mh/common/core/domain/dto/BFloorReportHotWaterDTO.java
  32. 74
      mh-common/src/main/java/com/mh/common/core/domain/dto/CompreReportDTO.java
  33. 20
      mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterNowDataDTO.java
  34. 284
      mh-common/src/main/java/com/mh/common/core/domain/dto/MaglevReportSysParamDTO.java
  35. 179
      mh-common/src/main/java/com/mh/common/core/domain/dto/ReportHeatingRunParamDTO.java
  36. 135
      mh-common/src/main/java/com/mh/common/core/domain/dto/ReportSteamRunParamDTO.java
  37. 210
      mh-common/src/main/java/com/mh/common/core/domain/dto/ThreeFloorReportHotWaterDTO.java
  38. 63
      mh-common/src/main/java/com/mh/common/core/domain/dto/WeatherDataDTO.java
  39. 19
      mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java
  40. 1
      mh-common/src/main/java/com/mh/common/core/domain/entity/CpmSpaceRelation.java
  41. 217
      mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHeatingRunParamHis.java
  42. 232
      mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHotWaterParamHis.java
  43. 114
      mh-common/src/main/java/com/mh/common/core/domain/entity/ReportMeterReadingsHis.java
  44. 170
      mh-common/src/main/java/com/mh/common/core/domain/entity/ReportSteamRunParamHis.java
  45. 310
      mh-common/src/main/java/com/mh/common/core/domain/entity/ReportSysRunParamHis.java
  46. 2
      mh-common/src/main/java/com/mh/common/core/domain/entity/SysRole.java
  47. 2
      mh-common/src/main/java/com/mh/common/core/domain/entity/SysUser.java
  48. 53
      mh-common/src/main/java/com/mh/common/core/domain/vo/CollectionParamsManageDataVO.java
  49. 5
      mh-common/src/main/java/com/mh/common/core/domain/vo/CollectionParamsManageVO.java
  50. 5
      mh-common/src/main/java/com/mh/common/core/domain/vo/DeviceMonitorVO.java
  51. 14
      mh-common/src/main/java/com/mh/common/core/domain/vo/EnergyConsumptionVO.java
  52. 4
      mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlVO.java
  53. 55
      mh-common/src/main/java/com/mh/common/enums/ComputeEnum.java
  54. 7
      mh-common/src/main/java/com/mh/common/model/request/AdvantechDatas.java
  55. 74
      mh-common/src/main/java/com/mh/common/model/request/AdvantechJsonParser.java
  56. 11
      mh-common/src/main/java/com/mh/common/utils/BigDecimalUtils.java
  57. 11
      mh-common/src/main/java/com/mh/common/utils/DateUtils.java
  58. 6
      mh-common/src/main/java/com/mh/common/utils/SecurityUtils.java
  59. 24
      mh-common/src/main/java/com/mh/common/utils/WeatherUtil.java
  60. 81
      mh-common/src/main/java/com/mh/common/utils/file/handle/ExcelFillCellMergeHandler.java
  61. 49
      mh-common/src/main/java/com/mh/common/utils/file/handle/ReportDayAndMonthParamHandler.java
  62. 46
      mh-common/src/main/java/com/mh/common/utils/file/handle/ReportSysParamHandler.java
  63. 25
      mh-common/src/main/java/com/mh/common/utils/file/handle/RowHeightStyleHandler.java
  64. 7
      mh-framework/pom.xml
  65. 2
      mh-framework/src/main/java/com/mh/framework/aspectj/ControlDeviceAspect.java
  66. 10
      mh-framework/src/main/java/com/mh/framework/dealdata/DataProcessService.java
  67. 113
      mh-framework/src/main/java/com/mh/framework/dealdata/impl/DataProcessServiceImpl.java
  68. 2
      mh-framework/src/main/java/com/mh/framework/mqtt/handler/InboundMessageRouter.java
  69. 8
      mh-framework/src/main/java/com/mh/framework/mqtt/service/impl/EventsServiceImpl.java
  70. 58
      mh-framework/src/main/java/com/mh/framework/rabbitmq/RabbitMqConfig.java
  71. 120
      mh-framework/src/main/java/com/mh/framework/rabbitmq/consumer/ReceiveHandler.java
  72. 33
      mh-framework/src/main/java/com/mh/framework/rabbitmq/producer/SendMsgByTopic.java
  73. 4
      mh-framework/src/main/java/com/mh/framework/web/service/PermissionService.java
  74. 11
      mh-quartz/src/main/java/com/mh/quartz/domain/FuzzyLevel.java
  75. 52
      mh-quartz/src/main/java/com/mh/quartz/domain/PIDParams.java
  76. 387
      mh-quartz/src/main/java/com/mh/quartz/task/AHUTask.java
  77. 206
      mh-quartz/src/main/java/com/mh/quartz/task/ChillersTask.java
  78. 82
      mh-quartz/src/main/java/com/mh/quartz/task/CreateAlarmTask.java
  79. 42
      mh-quartz/src/main/java/com/mh/quartz/task/DealDataTask.java
  80. 38
      mh-quartz/src/main/java/com/mh/quartz/task/HomeTask.java
  81. 2
      mh-quartz/src/main/java/com/mh/quartz/task/HotWaterTask.java
  82. 77
      mh-quartz/src/main/java/com/mh/quartz/task/PushDataToWechatTask.java
  83. 76
      mh-quartz/src/main/java/com/mh/quartz/task/ReportTask.java
  84. 84
      mh-quartz/src/main/java/com/mh/quartz/util/AHUPIDControlUtil.java
  85. 152
      mh-quartz/src/main/java/com/mh/quartz/util/FuzzyPIDControlUtil.java
  86. 29
      mh-quartz/src/main/java/com/mh/quartz/util/FuzzyRuleBase.java
  87. 14
      mh-system/src/main/java/com/mh/system/mapper/WeatherDataMapper.java
  88. 34
      mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java
  89. 23
      mh-system/src/main/java/com/mh/system/mapper/device/DataProcessMapper.java
  90. 4
      mh-system/src/main/java/com/mh/system/mapper/device/DeviceLedgerMapper.java
  91. 2
      mh-system/src/main/java/com/mh/system/mapper/device/MaintainInfoMapper.java
  92. 92
      mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java
  93. 6
      mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java
  94. 222
      mh-system/src/main/java/com/mh/system/mapper/energy/HeatEnergyQueryMapper.java
  95. 6
      mh-system/src/main/java/com/mh/system/mapper/energy/HotEnergyQueryMapper.java
  96. 28
      mh-system/src/main/java/com/mh/system/mapper/energy/OverviewMapper.java
  97. 2
      mh-system/src/main/java/com/mh/system/mapper/operation/AlarmRecordsMapper.java
  98. 6
      mh-system/src/main/java/com/mh/system/mapper/policy/PolicyManageMapper.java
  99. 134
      mh-system/src/main/java/com/mh/system/mapper/report/ComprehensiveReportMapper.java
  100. 32
      mh-system/src/main/java/com/mh/system/mapper/report/ReportHeatingRunParamHisMapper.java
  101. Some files were not shown because too many files have changed in this diff Show More

BIN
doc/节能改造每日能耗统计表.xlsx

Binary file not shown.

4
mh-admin/src/main/java/com/mh/MHRunner.java

@ -45,9 +45,9 @@ public class MHRunner implements ApplicationRunner {
// 初始化mqtt订阅记录
initializeMqttSubscription();
// 生成DTU采集参数
createDtuCollectionParams();
// createDtuCollectionParams();
// 启动netty服务端
startNettyServer();
// startNettyServer();
}
private void startNettyServer() {

55
mh-admin/src/main/java/com/mh/web/controller/comprehensive/CompreReportController.java

@ -0,0 +1,55 @@
package com.mh.web.controller.comprehensive;
import com.mh.common.core.controller.BaseController;
import com.mh.common.core.domain.vo.EnergyQueryVO;
import com.mh.common.core.page.TableDataInfo;
import com.mh.system.service.report.IComprehensiveReportService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Classname CompreReportController
* Todo: 综合报表
* @Date 2025-10-05 13:59
* @Created by LJF
*/
@RestController
@RequestMapping("/compre")
public class CompreReportController extends BaseController {
private final IComprehensiveReportService proOverviewService;
public CompreReportController(IComprehensiveReportService proOverviewService) {
this.proOverviewService = proOverviewService;
}
@PostMapping("/report")
public TableDataInfo report(@RequestBody EnergyQueryVO vo) {
TableDataInfo dataTable = getDataTable(proOverviewService.report(vo));
// 优化分页逻辑,防止出现数组越界异常
List<?> rows = dataTable.getRows();
int total = rows.size();
// 如果 pageNum 小于等于0,则返回全部
if (vo.getPageNum() <= 0) {
return dataTable;
}
int pageNum = vo.getPageNum() <= 0 ? 1 : vo.getPageNum();
int pageSize = vo.getPageSize() <= 0 ? 10 : vo.getPageSize();
// 计算起始索引和结束索引
int startIndex = (pageNum - 1) * pageSize;
int endIndex = Math.min(startIndex + pageSize, total);
// 边界检查
if (startIndex >= total || startIndex < 0) {
dataTable.setRows(List.of()); // 返回空列表而不是抛出异常
} else {
dataTable.setRows(rows.subList(startIndex, endIndex));
}
return dataTable;
}
}

14
mh-admin/src/main/java/com/mh/web/controller/comprehensive/ProOverviewController.java

@ -91,4 +91,18 @@ public class ProOverviewController extends BaseController {
return getDataTable(proOverviewService.mainParams());
}
/**
* 获取热回收系统相关数据
* 出水温度离心机高温出水温度中温换热出水温度低温1换热出水温度低温2换热出水温度
* 热量数据生产累积热量散热累积热量总热量回收热利用率
* 系统数据离心机入口温度离心机出水温度保障进水温度
* 阀门开度二通阀阀门开度三通阀阀门开度
* 热回收数据瞬时热量日累积热量累积热量
* 应用侧数据瞬时热量日累计热量累积热量
*
*/
@GetMapping("/ersDatas")
public TableDataInfo ersDatas(@RequestParam("systemType") String systemType) {
return getDataTable(proOverviewService.ersDatas(systemType));
}
}

11
mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java

@ -52,6 +52,7 @@ public class ChillersParamsController extends BaseController {
*/
@GetMapping("/list")
public TableDataInfo list(CollectionParamsManage collectionParamsManage) {
collectionParamsManage.setIsUse(0);
List<CollectionParamsManage> list = iCollectionParamsManageService.selectCollectionParamsManageList(collectionParamsManage);
// list中的CollectionParamsManage中的other_name去掉“号主机”之前数据
list.forEach(item -> {
@ -68,6 +69,10 @@ public class ChillersParamsController extends BaseController {
CollectionParamsManageVO2 vo = new CollectionParamsManageVO2();
BeanUtils.copyProperties(item, vo);
vo.setCurValue(item.getCurValue().setScale(2).toString());
// 再根据mtType判断,如果是压缩机的,就只保留整数
if (vo.getMtType().equals("9") || vo.getMtType().equals("10") || vo.getMtType().equals("11")) {
vo.setCurValue(new BigDecimal(vo.getCurValue()).intValue() + "");
}
// 判断运行状态、启停、故障、本地远程
switch (vo.getParamType()) {
case "1": // 运行状态
@ -82,7 +87,7 @@ public class ChillersParamsController extends BaseController {
break;
case "5": // 故障
if (!StringUtils.isEmpty(vo.getCurValue())) {
vo.setCurValue(new BigDecimal(vo.getCurValue()).intValue() == 1 ? "故障" : "正常");
vo.setCurValue(new BigDecimal(vo.getCurValue()).intValue() == 1 ? "故障" : "无故障");
}
break;
case "6": // 手自动切换
@ -114,8 +119,8 @@ public class ChillersParamsController extends BaseController {
return map;
}).collect(Collectors.toList());
result.sort((map1, map2) -> {
Integer mtType1 = Integer.parseInt((String)map1.get("mtType"));
Integer mtType2 = Integer.parseInt((String)map2.get("mtType"));
Integer mtType1 = Integer.parseInt((String) map1.get("mtType"));
Integer mtType2 = Integer.parseInt((String) map2.get("mtType"));
return mtType1.compareTo(mtType2); // 升序
});
return getDataTable(result);

11
mh-admin/src/main/java/com/mh/web/controller/device/OperationController.java

@ -99,8 +99,15 @@ public class OperationController extends BaseController {
@ControlDeviceAno(value = "设备操作")
public AjaxResult operationDevice(@RequestBody List<OrderEntity> changeValues) {
try {
// 判断id是否是DTU设备类型
if (!iOperationService.isAdvanTech(changeValues)) {
// 增加判断是否是昆仑通态触摸屏的MQTT设备
if (!iOperationService.isKuLunTouchScreen(changeValues)) {
String sendOrder = iOperationService.operationKLTTDevice(changeValues);
String name = mhConfig.getName();
// 获取mqtt操作队列(后期通过mqtt队列配置发送主题)
log.info("发送主题:{},消息:{}", name + "/" + controlTopic, sendOrder);
iMqttGatewayService.publish(name + "/" + controlTopic, sendOrder, 1);
} else if (!iOperationService.isAdvanTech(changeValues)) {
// 判断id是否是DTU设备类型
String sendOrder = iOperationService.operationDevice(changeValues);
String name = mhConfig.getName();
// 获取mqtt操作队列(后期通过mqtt队列配置发送主题)

8
mh-admin/src/main/java/com/mh/web/controller/energy/SysEnergyConsumptionController.java

@ -77,7 +77,13 @@ public class SysEnergyConsumptionController extends BaseController {
@PostMapping("/device")
public AjaxResult device(@RequestBody EnergyConsumptionVO vo) {
DateUtils.energyDateChange(vo);
return energyService.device(vo);
if (vo.getSystemType().equals("0")) {
// 冷源系统
return energyService.device(vo);
} else {
// 热回收系统
return energyService.deviceERS(vo);
}
}
}

44
mh-admin/src/main/java/com/mh/web/controller/energy/SysEnergyQueryController.java

@ -54,6 +54,9 @@ public class SysEnergyQueryController {
// 文件名
try {
String fileName = "机房整体能耗表.xlsx";
if (vo.getSystemType().equalsIgnoreCase("7")) {
fileName = "热回收热量总计表.xlsx";
}
// 从数据库获取数据
List<Map<String, Object>> dataList = (List<Map<String, Object>>) energyQueryService.sysQuery(vo).get("data");
if (dataList != null) {
@ -71,18 +74,33 @@ public class SysEnergyQueryController {
for (Map<String, Object> map : dataList) {
if (map.containsKey("titleArr")) {
titleArr = Arrays.asList((String[]) map.get("titleArr"));
List<String> head0 = ListUtils.newArrayList();
head0.add("日期");
List<String> head1 = ListUtils.newArrayList();
head1.add("制冷量");
List<String> head2 = ListUtils.newArrayList();
head2.add("耗电量");
List<String> head3= ListUtils.newArrayList();
head3.add("COP");
head.add(head0);
head.add(head1);
head.add(head2);
head.add(head3);
if (vo.getSystemType().equalsIgnoreCase("7")) {
List<String> head0 = ListUtils.newArrayList();
head0.add("日期");
List<String> head1 = ListUtils.newArrayList();
head1.add("散热量");
List<String> head2 = ListUtils.newArrayList();
head2.add("总热量回收");
List<String> head3 = ListUtils.newArrayList();
head3.add("热利用率");
head.add(head0);
head.add(head1);
head.add(head2);
head.add(head3);
} else {
List<String> head0 = ListUtils.newArrayList();
head0.add("日期");
List<String> head1 = ListUtils.newArrayList();
head1.add("制冷量");
List<String> head2 = ListUtils.newArrayList();
head2.add("耗电量");
List<String> head3 = ListUtils.newArrayList();
head3.add("COP");
head.add(head0);
head.add(head1);
head.add(head2);
head.add(head3);
}
}
if (map.containsKey("timeStrArr")) {
timeStrArr = Arrays.asList((String[])map.get("timeStrArr"));
@ -107,7 +125,7 @@ public class SysEnergyQueryController {
excelDataList.add(list1);
}
// 内容格式
EasyExcel.write(response.getOutputStream()).head(head).sheet("机房整体能耗表").doWrite(excelDataList);
EasyExcel.write(response.getOutputStream()).head(head).sheet(fileName.substring(0, fileName.lastIndexOf("."))).doWrite(excelDataList);
}
} catch (Exception e) {
log.error("下载报表异常", e);

6
mh-admin/src/main/java/com/mh/web/controller/monitor/CoolingSystemMonitorController.java

@ -111,4 +111,10 @@ public class CoolingSystemMonitorController extends BaseController {
return AjaxResult.success(iCoolingSystemMonitorService.getSystemMode(systemType, paramType));
}
@GetMapping("/getWeatherTemp")
public TableDataInfo getWeatherTemp(@RequestParam(name = "startTime") String startTime, @RequestParam(name = "endTime") String endTime){
startPage();
return getDataTable(iCoolingSystemMonitorService.getWeatherTemp(startTime, endTime));
}
}

45
mh-admin/src/main/java/com/mh/web/controller/monitor/ERSMonitorController.java

@ -0,0 +1,45 @@
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 jakarta.annotation.Resource;
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 2026-01-28 13:48:13
*/
@RestController
@RequestMapping("/device/ers")
public class ERSMonitorController extends BaseController {
@Resource
private 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);
}
@GetMapping("/monitor/totalDatas")
public TableDataInfo totalERSDatas(@RequestParam(name = "systemType") String systemType)
{
List<?> list = iCollectionParamsManageService.totalERSDatas(systemType);
return getDataTable(list);
}
}

70
mh-admin/src/main/java/com/mh/web/controller/monitor/HeatingPumpMonitorController.java

@ -0,0 +1,70 @@
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.entity.CollectionParamsManage;
import com.mh.common.core.page.TableDataInfo;
import com.mh.system.service.device.ICollectionParamsManageService;
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-09-12 09:36:33
*/
@RestController
@RequestMapping("/device")
public class HeatingPumpMonitorController extends BaseController {
private final ICollectionParamsManageService collectionParamsManageService;
public HeatingPumpMonitorController(ICollectionParamsManageService collectionParamsManageService) {
this.collectionParamsManageService = collectionParamsManageService;
}
/**
* 获取 alarmList 列表
* @param systemType 3
* @param type 0代表查询报警
* @return
*/
@RequestMapping("/heatPump/alarmList")
public TableDataInfo list(@RequestParam(name = "systemType") String systemType,
@RequestParam(name = "type", required = false, defaultValue = "0") String type) {
List<?> list = collectionParamsManageService.selectHeatPumpAlarmListByParams(systemType, type, "14", "5");
return getDataTable(list);
}
/**
* 获取 运行热泵统计 列表
* @param systemType 3
* @param type 0代表查询报警
* @return
*/
@RequestMapping("/heatPump/online")
public TableDataInfo online(@RequestParam(name = "systemType") String systemType,
@RequestParam(name = "type", required = false, defaultValue = "0") String type) {
List<?> list = collectionParamsManageService.selectHeatPumpOnlineByParams(systemType, type);
return getDataTable(list);
}
/**
* 获取 采暖泵 列表
* @param systemType 3
* @param type 0代表查询动画界面数据
* @return
*/
@RequestMapping("/heatPump/list")
public TableDataInfo heatPumpList(@RequestParam(name = "systemType") String systemType,
@RequestParam(name = "type", required = false, defaultValue = "0") String type) {
List<DeviceMonitorDTO> list = collectionParamsManageService.selectHotWaterBoilerListByParams(systemType, type, "14");
return getDataTable(list);
}
}

57
mh-admin/src/main/java/com/mh/web/controller/monitor/SteamBoilerMonitorController.java

@ -0,0 +1,57 @@
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.entity.CollectionParamsManage;
import com.mh.common.core.page.TableDataInfo;
import com.mh.system.service.device.ICollectionParamsManageService;
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-09-12 09:36:33
*/
@RestController
@RequestMapping("/device")
public class SteamBoilerMonitorController extends BaseController {
private final ICollectionParamsManageService collectionParamsManageService;
public SteamBoilerMonitorController(ICollectionParamsManageService collectionParamsManageService) {
this.collectionParamsManageService = collectionParamsManageService;
}
/**
* 获取 steamBoiler 列表
* @param systemType 3
* @param type 0代表查询动画界面数据1代表查询模拟量监测数据2代表查询继电器数据3查询端口输入数据4代表查询报警数据
* @return
*/
@RequestMapping("/steamBoiler/list")
public TableDataInfo list(@RequestParam(name = "systemType") String systemType,
@RequestParam(name = "type") String type) {
List<CollectionParamsManage> list = collectionParamsManageService.selectSteamBoilerListByParams(systemType, type);
return getDataTable(list);
}
/**
* 获取 热水锅炉 列表
* @param systemType 3
* @param type 0代表查询动画界面数据
* @return
*/
@RequestMapping("/hotWaterBoiler/list")
public TableDataInfo hotWaterBoilerList(@RequestParam(name = "systemType") String systemType,
@RequestParam(name = "type", required = false, defaultValue = "0") String type) {
List<DeviceMonitorDTO> list = collectionParamsManageService.selectHotWaterBoilerListByParams(systemType, type, "13");
return getDataTable(list);
}
}

96
mh-admin/src/main/java/com/mh/web/controller/report/ReportHeatingController.java

@ -0,0 +1,96 @@
package com.mh.web.controller.report;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.mh.common.core.controller.BaseController;
import com.mh.common.core.domain.AjaxResult;
import com.mh.common.core.domain.dto.ReportHeatingRunParamDTO;
import com.mh.common.core.domain.dto.ReportSteamRunParamDTO;
import com.mh.common.core.domain.entity.ReportHeatingRunParamHis;
import com.mh.common.core.domain.entity.ReportSteamRunParamHis;
import com.mh.common.core.page.PageDomain;
import com.mh.common.core.page.TableDataInfo;
import com.mh.common.core.page.TableSupport;
import com.mh.common.utils.file.handle.ExcelFillCellMergeHandler;
import com.mh.common.utils.file.handle.ReportSysParamHandler;
import com.mh.common.utils.file.handle.RowHeightStyleHandler;
import com.mh.common.utils.sql.SqlUtil;
import com.mh.system.service.report.IReportHeatingService;
import com.mh.system.service.report.IReportSteamService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author LJF
* @version 1.0
* @project eemcs
* @description 采暖系统运行参数报表
* @date 2024-05-30 08:45:57
*/
@RestController
@RequestMapping("/reportHeating")
@Slf4j
public class ReportHeatingController extends BaseController {
private final IReportHeatingService reportHeatingService;
private ReportHeatingController(IReportHeatingService reportHeatingService) {
this.reportHeatingService = reportHeatingService;
}
@PostMapping("/list")
public TableDataInfo list(@RequestBody ReportHeatingRunParamHis reportHeatingRunParamHis) {
if (reportHeatingRunParamHis.getPageNum() != 0) {
PageHelper.startPage(reportHeatingRunParamHis.getPageNum(), reportHeatingRunParamHis.getPageSize());
}
List<ReportHeatingRunParamHis> list = reportHeatingService.selectHeatingList(reportHeatingRunParamHis);
return getDataTable(list);
}
@PutMapping("/edit")
public AjaxResult edit(@RequestBody ReportHeatingRunParamHis reportHeatingRunParamHis) {
return toAjax(reportHeatingService.updateRunParams(reportHeatingRunParamHis));
}
@PostMapping("/export")
public void exportExcel(@RequestBody ReportHeatingRunParamHis reportSteamRunParamHis, HttpServletResponse response) {
// 文件名
try {
String fileName = "采暖系统运行记录表.xlsx";
String headTitle = "采暖系统运行记录表";
// 从数据库获取数据
List<ReportHeatingRunParamHis> list = reportHeatingService.selectHeatingList(reportSteamRunParamHis);
if (list != null) {
// 设置响应格式
response.setContentType("application/vdn.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName, StandardCharsets.UTF_8) + "\"");
response.setCharacterEncoding(String.valueOf(StandardCharsets.UTF_8));
ExcelFillCellMergeHandler mergePrevCol = new ExcelFillCellMergeHandler();
List<ReportHeatingRunParamDTO> infoDTOS = list.stream().map(info -> {
ReportHeatingRunParamDTO deviceInfoDTO = new ReportHeatingRunParamDTO();
BeanUtils.copyProperties(info, deviceInfoDTO);
return deviceInfoDTO;
}).collect(Collectors.toList());
// 内容格式
EasyExcel.write(response.getOutputStream(), ReportHeatingRunParamDTO.class)
.registerWriteHandler(new ReportSysParamHandler(headTitle))
.registerWriteHandler(mergePrevCol)
.registerWriteHandler(new RowHeightStyleHandler())
.sheet(fileName.replace(".xlsx", ""))
.doWrite(infoDTOS);
}
} catch (IOException e) {
throw new RuntimeException("下载报表异常");
}
}
}

144
mh-admin/src/main/java/com/mh/web/controller/report/ReportHotWaterController.java

@ -0,0 +1,144 @@
package com.mh.web.controller.report;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.mh.common.core.controller.BaseController;
import com.mh.common.core.domain.AjaxResult;
import com.mh.common.core.domain.dto.BFloorReportHotWaterDTO;
import com.mh.common.core.domain.dto.ThreeFloorReportHotWaterDTO;
import com.mh.common.core.domain.entity.ReportHotWaterParamHis;
import com.mh.common.core.domain.entity.ReportSysRunParamHis;
import com.mh.common.core.page.TableDataInfo;
import com.mh.common.utils.StringUtils;
import com.mh.common.utils.file.handle.ExcelFillCellMergeHandler;
import com.mh.common.utils.file.handle.ReportSysParamHandler;
import com.mh.common.utils.file.handle.RowHeightStyleHandler;
import com.mh.system.service.report.IReportHotWaterService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 热泵系统运行参数报表
* @date 2024-05-30 08:45:57
*/
@RestController
@RequestMapping("/reportHotWater")
@Slf4j
public class ReportHotWaterController extends BaseController {
private final IReportHotWaterService reportHotWaterService;
private ReportHotWaterController(IReportHotWaterService reportHotWaterService) {
this.reportHotWaterService = reportHotWaterService;
}
@PostMapping("/list")
public TableDataInfo list(@RequestBody ReportHotWaterParamHis reportHotWaterParamHis)
{
if (reportHotWaterParamHis.getPageNum() != 0) {
PageHelper.startPage(reportHotWaterParamHis.getPageNum(), reportHotWaterParamHis.getPageSize());
}
List<ReportHotWaterParamHis> list = reportHotWaterService.selectList(reportHotWaterParamHis);
return getDataTable(list);
}
@PutMapping("/edit")
public AjaxResult edit(@RequestBody ReportHotWaterParamHis reportHotWaterParamHis)
{
return toAjax(reportHotWaterService.updateRunParams(reportHotWaterParamHis));
}
@PostMapping("/export")
public void exportExcel(@RequestBody ReportHotWaterParamHis reportHotWaterParamHis, HttpServletResponse response) {
// 文件名
try {
String fileName = "热水热泵运行记录表.xlsx";
String floorId = reportHotWaterParamHis.getFloorId();
String headTitle = "热水热泵运行记录表";
if (!StringUtils.isBlank(floorId)) {
if (floorId.contains("-1楼")) {
fileName = "-1楼热水热泵运行记录表.xlsx";
headTitle = "-1楼热水热泵运行记录表";
} else {
fileName = "3楼热水热泵运行记录表.xlsx";
headTitle = "3楼热水热泵运行记录表";
}
}
// 从数据库获取数据
List<ReportHotWaterParamHis> list = reportHotWaterService.selectList(reportHotWaterParamHis);
if (list != null) {
// 设置响应格式
response.setContentType("application/vdn.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName, "UTF-8") + "\"");
response.setCharacterEncoding("UTF-8");
ExcelFillCellMergeHandler mergePrevCol = new ExcelFillCellMergeHandler();
int headSize = 3;
if (floorId.contains("-1楼")) {
List<BFloorReportHotWaterDTO> infoDTOS = list.stream().map(info -> {
BFloorReportHotWaterDTO deviceInfoDTO = new BFloorReportHotWaterDTO();
BeanUtils.copyProperties(info, deviceInfoDTO);
// 单独处理启停和运行状态
deviceInfoDTO.setStatusRunHotPumpOneStr(info.getStatusRunHotPumpOne() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusSwitchHotPumpOneStr(info.getStatusSwitchHotPumpOne() == 1 ? "开机" : "关机");
deviceInfoDTO.setStatusRunHotPumpTwoStr(info.getStatusRunHotPumpTwo() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusSwitchHotPumpTwoStr(info.getStatusSwitchHotPumpTwo() == 1 ? "开机" : "关机");
deviceInfoDTO.setStatusRunSupplyPumpOneStr(info.getStatusRunSupplyPumpOne() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusRunSupplyPumpTwoStr(info.getStatusRunSupplyPumpTwo() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusRunSupplyPumpThreeStr(info.getStatusRunSupplyPumpThree() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusRunSupplyPumpFourStr(info.getStatusRunSupplyPumpFour() == 1 ? "运行" : "不运行");
return deviceInfoDTO;
}).collect(Collectors.toList());
// 内容格式
EasyExcel.write(response.getOutputStream(), BFloorReportHotWaterDTO.class)
.registerWriteHandler(new ReportSysParamHandler(headTitle))
.registerWriteHandler(mergePrevCol)
.registerWriteHandler(new RowHeightStyleHandler())
.sheet(fileName.replace(".xlsx", ""))
.doWrite(infoDTOS);
} else {
List<ThreeFloorReportHotWaterDTO> infoDTOS = list.stream().map(info -> {
ThreeFloorReportHotWaterDTO deviceInfoDTO = new ThreeFloorReportHotWaterDTO();
BeanUtils.copyProperties(info, deviceInfoDTO);
// 单独处理启停和运行状态
deviceInfoDTO.setStatusRunHotPumpOneStr(info.getStatusRunHotPumpOne() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusSwitchHotPumpOneStr(info.getStatusSwitchHotPumpOne() == 1 ? "开机" : "关机");
deviceInfoDTO.setStatusRunHotPumpTwoStr(info.getStatusRunHotPumpTwo() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusSwitchHotPumpTwoStr(info.getStatusSwitchHotPumpTwo() == 1 ? "开机" : "关机");
deviceInfoDTO.setStatusRunHotPumpThreeStr(info.getStatusRunHotPumpThree() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusSwitchHotPumpThreeStr(info.getStatusSwitchHotPumpThree() == 1 ? "开机" : "关机");
deviceInfoDTO.setStatusRunHotPumpFourStr(info.getStatusRunHotPumpFour() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusSwitchHotPumpFourStr(info.getStatusSwitchHotPumpFour() == 1 ? "开机" : "关机");
deviceInfoDTO.setStatusRunSupplyPumpOneStr(info.getStatusRunSupplyPumpOne() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusRunSupplyPumpTwoStr(info.getStatusRunSupplyPumpTwo() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusRunSupplyPumpThreeStr(info.getStatusRunSupplyPumpThree() == 1 ? "运行" : "不运行");
deviceInfoDTO.setStatusRunSupplyPumpFourStr(info.getStatusRunSupplyPumpFour() == 1 ? "运行" : "不运行");
return deviceInfoDTO;
}).collect(Collectors.toList());
// 内容格式
EasyExcel.write(response.getOutputStream(), ThreeFloorReportHotWaterDTO.class)
.registerWriteHandler(new ReportSysParamHandler(headTitle))
.registerWriteHandler(mergePrevCol)
.registerWriteHandler(new RowHeightStyleHandler())
.sheet(fileName.replace(".xlsx", ""))
.doWrite(infoDTOS);
}
}
} catch (IOException e) {
throw new RuntimeException("下载报表异常");
}
}
}

131
mh-admin/src/main/java/com/mh/web/controller/report/ReportMeterReadingsController.java

@ -0,0 +1,131 @@
package com.mh.web.controller.report;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.mh.common.core.controller.BaseController;
import com.mh.common.core.domain.dto.WeatherDataDTO;
import com.mh.common.core.domain.entity.ReportMeterReadingsHis;
import com.mh.common.core.page.TableDataInfo;
import com.mh.common.utils.DateUtils;
import com.mh.system.service.device.ICoolingSystemMonitorService;
import com.mh.system.service.report.IMeterReadingsHisService;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.ss.usermodel.*;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 每日抄表记录查询
* @date 2025-10-21 16:04:09
*/
@RestController
@RequestMapping("/reportMeterReadings")
public class ReportMeterReadingsController extends BaseController {
private final IMeterReadingsHisService meterReadingsHisService;
private final ICoolingSystemMonitorService coolingSystemMonitorService;
public ReportMeterReadingsController(IMeterReadingsHisService meterReadingsHisService, ICoolingSystemMonitorService coolingSystemMonitorService) {
this.meterReadingsHisService = meterReadingsHisService;
this.coolingSystemMonitorService = coolingSystemMonitorService;
}
@PostMapping("/list")
public TableDataInfo list(@RequestBody ReportMeterReadingsHis todayTimestamp)
{
List<ReportMeterReadingsHis> list = meterReadingsHisService.selectList(todayTimestamp);
return getDataTable(list);
}
@PostMapping("/export")
public void exportExcel(@RequestBody ReportMeterReadingsHis reportMeterReadingsHis, HttpServletResponse response) {
// 文件名
try {
String fileName = "节能岛改造每日能耗统计表"+ DateUtils.dateToString(reportMeterReadingsHis.getTodayTimestamp(), "yyyyMMdd")+".xlsx";
// 读取资源文件
ClassPathResource classPathResource = new ClassPathResource(File.separator + "节能岛改造每日能耗统计表.xlsx");
// 获取数据
List<ReportMeterReadingsHis> list = meterReadingsHisService.selectList(reportMeterReadingsHis);
// 组织并填充模板数据
ByteArrayOutputStream byteArrayOutputStream = compositeFill(classPathResource.getInputStream(), reportMeterReadingsHis.getTodayTimestamp(), list);
// 设置响应格式
response.setContentType("application/vdn.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName, "UTF-8") + "\"");
response.setCharacterEncoding("UTF-8");
// 将文件内容写入响应输出流,浏览器可以直接触发下载
response.getOutputStream().write(byteArrayOutputStream.toByteArray());
response.getOutputStream().flush();
} catch (IOException e) {
throw new RuntimeException("下载报表异常");
}
}
private ByteArrayOutputStream compositeFill(InputStream templateInputStream, Date todayTimestamp, List<ReportMeterReadingsHis> list) throws IOException {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
// 使用EasyExcel的模板填充功能,在这里指定合并单元格,这里应该是easyExcel的bug,第一列无法合并,其他列都可以,所以第一列单独用原生poi进行合并
try (ExcelWriter excelWriter = EasyExcel.write(byteArrayOutputStream).withTemplate(templateInputStream)
.build()) {
WriteSheet writeSheet = EasyExcel.writerSheet().build();
// 防止上面两个表格覆盖下面两个表格,每一行都采用新增一行的方式
// FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
// 使用模板填充,必须使用FillWrapper,这是官方要求,并且每行两个表格只能有一个表格设置增行,否则会存在一个表格有空行,这里是造的测试数据
for (int i = 0; i < list.size(); i++) {
excelWriter.fill(new FillWrapper("data"+(i+1), List.of(list.get(i))), writeSheet);
}
// 设置表格外的填充数据,例如总计、日期等数据
HashMap<String, Object> map = new HashMap<>();
List<WeatherDataDTO> weatherTemp = (List<WeatherDataDTO>) coolingSystemMonitorService.getWeatherTemp(DateUtils.dateToString(todayTimestamp, "yyyy-MM-dd"), DateUtils.dateToString(todayTimestamp, "yyyy-MM-dd"));
if (!weatherTemp.isEmpty()) {
String maxTemp = weatherTemp.getFirst().getMaxTemp();
map.put("maxTemp", maxTemp);
String minTemp = weatherTemp.getFirst().getMinTemp();
map.put("minTemp", minTemp);
}
map.put("date", DateUtils.dateToString(todayTimestamp, "yyyy年MM月dd日"));
excelWriter.fill(map, writeSheet);
// 2. 获取 Workbook 并计算公式
Workbook workbook = excelWriter.writeContext()
.writeWorkbookHolder()
.getWorkbook();
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
for (Row row : workbook.getSheetAt(0)) {
for (Cell cell : row) {
if (cell.getCellType() == CellType.FORMULA) {
evaluator.evaluateFormulaCell(cell); // 单元格级计算
// evaluator.evaluateAll(); // 全工作簿计算(推荐)
}
}
}
// 3. 强制刷新计算结果
workbook.setForceFormulaRecalculation(true);
excelWriter.finish();
}
// 合并单元格,由于easyExcel自带的OnceAbsoluteMergeStrategy合并策略bug,这里需要用poi合并一下
return byteArrayOutputStream;
}
}

156
mh-admin/src/main/java/com/mh/web/controller/report/ReportSteamController.java

@ -0,0 +1,156 @@
package com.mh.web.controller.report;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.mh.common.core.controller.BaseController;
import com.mh.common.core.domain.AjaxResult;
import com.mh.common.core.domain.dto.ReportSteamRunParamDTO;
import com.mh.common.core.domain.dto.ThreeFloorReportHotWaterDTO;
import com.mh.common.core.domain.entity.ReportSteamRunParamHis;
import com.mh.common.core.page.TableDataInfo;
import com.mh.common.utils.file.handle.ExcelFillCellMergeHandler;
import com.mh.common.utils.file.handle.ReportSysParamHandler;
import com.mh.common.utils.file.handle.RowHeightStyleHandler;
import com.mh.system.service.report.IReportSteamService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author LJF
* @version 1.0
* @project eemcs
* @description 蒸汽系统运行参数报表
* @date 2024-05-30 08:45:57
*/
@RestController
@RequestMapping("/reportSteam")
@Slf4j
public class ReportSteamController extends BaseController {
private final IReportSteamService reportSteamService;
private ReportSteamController(IReportSteamService reportSteamService) {
this.reportSteamService = reportSteamService;
}
@PostMapping("/list")
public TableDataInfo list(@RequestBody ReportSteamRunParamHis reportSteamRunParamHis) {
if (reportSteamRunParamHis.getPageNum() != 0) {
PageHelper.startPage(reportSteamRunParamHis.getPageNum(), reportSteamRunParamHis.getPageSize());
}
List<ReportSteamRunParamHis> list = reportSteamService.selectList(reportSteamRunParamHis);
return getDataTable(list);
}
@PutMapping("/edit")
public AjaxResult edit(@RequestBody ReportSteamRunParamHis reportSteamRunParamHis) {
return toAjax(reportSteamService.updateRunParams(reportSteamRunParamHis));
}
@PostMapping("/export")
public void exportExcel(@RequestBody ReportSteamRunParamHis reportSteamRunParamHis, HttpServletResponse response) {
// 文件名
try {
String fileName = "蒸汽机运行记录表.xlsx";
String headTitle = "蒸汽机运行记录表";
// 从数据库获取数据
List<ReportSteamRunParamHis> list = reportSteamService.selectList(reportSteamRunParamHis);
if (list != null) {
// 设置响应格式
response.setContentType("application/vdn.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName, "UTF-8") + "\"");
response.setCharacterEncoding("UTF-8");
ExcelFillCellMergeHandler mergePrevCol = new ExcelFillCellMergeHandler();
List<ReportSteamRunParamDTO> infoDTOS = list.stream().map(info -> {
ReportSteamRunParamDTO deviceInfoDTO = new ReportSteamRunParamDTO();
BeanUtils.copyProperties(info, deviceInfoDTO);
// 单独处理运行状态
// 0:上电延时
// 1:关机
// 2:待机
// 3:前清扫
// 4:预点火
// 5:点火
// 6:传火
// 7:工作
// 8:后清扫
// 9:故障
// 10:小火保持
// 11:自检
// 12:检漏
// 13:开点火器
// 14:启动等待中
switch (info.getCurStatus()) {
case 0:
deviceInfoDTO.setCurStatus("上电延时");
break;
case 1:
deviceInfoDTO.setCurStatus("关机");
break;
case 2:
deviceInfoDTO.setCurStatus("待机");
break;
case 3:
deviceInfoDTO.setCurStatus("前清扫");
break;
case 4:
deviceInfoDTO.setCurStatus("预点火");
break;
case 5:
deviceInfoDTO.setCurStatus("点火");
break;
case 6:
deviceInfoDTO.setCurStatus("传火");
break;
case 7:
deviceInfoDTO.setCurStatus("工作");
break;
case 8:
deviceInfoDTO.setCurStatus("后清扫");
break;
case 9:
deviceInfoDTO.setCurStatus("故障");
break;
case 10:
deviceInfoDTO.setCurStatus("小火保持");
break;
case 11:
deviceInfoDTO.setCurStatus("自检");
break;
case 12:
deviceInfoDTO.setCurStatus("检漏");
break;
case 13:
deviceInfoDTO.setCurStatus("开点火器");
break;
case 14:
deviceInfoDTO.setCurStatus("启动等待中");
break;
default:
deviceInfoDTO.setCurStatus("未知");
break;
}
return deviceInfoDTO;
}).collect(Collectors.toList());
// 内容格式
EasyExcel.write(response.getOutputStream(), ReportSteamRunParamDTO.class)
.registerWriteHandler(new ReportSysParamHandler(headTitle))
.registerWriteHandler(mergePrevCol)
.registerWriteHandler(new RowHeightStyleHandler())
.sheet(fileName.replace(".xlsx", ""))
.doWrite(infoDTOS);
}
} catch (IOException e) {
throw new RuntimeException("下载报表异常");
}
}
}

100
mh-admin/src/main/java/com/mh/web/controller/report/ReportSysController.java

@ -0,0 +1,100 @@
package com.mh.web.controller.report;
import com.alibaba.excel.EasyExcel;
import com.github.pagehelper.PageHelper;
import com.mh.common.core.controller.BaseController;
import com.mh.common.core.domain.AjaxResult;
import com.mh.common.core.domain.dto.MaglevReportSysParamDTO;
import com.mh.common.core.domain.entity.ReportSysRunParamHis;
import com.mh.common.core.page.TableDataInfo;
import com.mh.common.utils.StringUtils;
import com.mh.common.utils.file.handle.ExcelFillCellMergeHandler;
import com.mh.common.utils.file.handle.ReportSysParamHandler;
import com.mh.common.utils.file.handle.RowHeightStyleHandler;
import com.mh.system.service.report.IReportSysService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 系统参数报表
* @date 2024-05-30 08:45:57
*/
@RestController
@RequestMapping("/reportSys")
@Slf4j
public class ReportSysController extends BaseController {
private final IReportSysService reportSysService;
private ReportSysController(IReportSysService reportSysService) {
this.reportSysService = reportSysService;
}
@PostMapping("/list")
public TableDataInfo list(@RequestBody ReportSysRunParamHis reportSysRunParamHis)
{
if (reportSysRunParamHis.getPageNum() != 0) {
PageHelper.startPage(reportSysRunParamHis.getPageNum(), reportSysRunParamHis.getPageSize());
}
List<ReportSysRunParamHis> list = reportSysService.selectList(reportSysRunParamHis);
return getDataTable(list);
}
@PutMapping("/edit")
public AjaxResult edit(@RequestBody ReportSysRunParamHis reportSysRunParamHis)
{
return toAjax(reportSysService.updateSysRunParams(reportSysRunParamHis));
}
@PostMapping("/export")
public void exportExcel(@RequestBody ReportSysRunParamHis reportSysRunParamHis, HttpServletResponse response) {
// 文件名
try {
String fileName = "系统参数运行日志报表.xlsx";
String deviceNum = (String) reportSysRunParamHis.getParams().get("deviceNum");
if (!StringUtils.isBlank(deviceNum)) {
if ("2".equals(deviceNum)) {
fileName = "变频螺杆主机系统参数报表.xlsx";
} else {
fileName = "磁悬浮主机系统参数报表.xlsx";
}
}
// 从数据库获取数据
List<ReportSysRunParamHis> list = reportSysService.selectList(reportSysRunParamHis);
if (list != null) {
// 设置响应格式
response.setContentType("application/vdn.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName, "UTF-8") + "\"");
response.setCharacterEncoding("UTF-8");
ExcelFillCellMergeHandler mergePrevCol = new ExcelFillCellMergeHandler();
int headSize = 3;
List<MaglevReportSysParamDTO> infoDTOS = list.stream().map(info -> {
MaglevReportSysParamDTO deviceInfoDTO = new MaglevReportSysParamDTO();
BeanUtils.copyProperties(info, deviceInfoDTO);
return deviceInfoDTO;
}).collect(Collectors.toList());
// 内容格式
EasyExcel.write(response.getOutputStream(), MaglevReportSysParamDTO.class)
.registerWriteHandler(new ReportSysParamHandler("磁悬浮水冷冷水机组数据运行记录表"))
.registerWriteHandler(mergePrevCol)
.registerWriteHandler(new RowHeightStyleHandler())
.sheet(fileName.replace(".xlsx", ""))
.doWrite(infoDTOS);
}
} catch (IOException e) {
throw new RuntimeException("下载报表异常");
}
}
}

8
mh-admin/src/main/java/com/mh/web/controller/space/BuildingInfoController.java

@ -94,11 +94,13 @@ public class BuildingInfoController extends BaseController {
* 获取楼栋管理列表内容数据
*/
@GetMapping("/hot_list")
public TableDataInfo hotWaterList()
public TableDataInfo hotWaterList(@RequestParam("systemType") String systemType)
{
List<Map<String, Object>> list = energyQueryService.queryFloorInfo();
List<Map<String, Object>> list = energyQueryService.queryFloorInfo(systemType);
// 在当前list首个坐标加个值
list.addFirst(Map.of("id", "所有", "building_name", "所有"));
if (systemType.equals("1")) {
list.addFirst(Map.of("id", "所有", "building_name", "所有"));
}
return getDataTable(list);
}

2
mh-admin/src/main/java/com/mh/web/controller/system/SysLoginController.java

@ -92,6 +92,6 @@ public class SysLoginController
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus));
return AjaxResult.success(menuService.buildMenus(menus,userId));
}
}

14
mh-admin/src/main/resources/application-dev.yml

@ -1,11 +1,11 @@
# 项目相关配置
mh:
# 名称
name: MH
name: gh_ers_dev
# 版本
version: 1.0.0
# 版权年份
copyrightYear: 2024
copyrightYear: 2026
# 文件路径 示例( Windows配置D:/mh/uploadPath,Linux配置 /home/mh/uploadPath)
profile: D:/mh/uploadPath
# 获取ip地址开关
@ -63,7 +63,7 @@ spring:
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
database: 1
# 密码
password:
# 连接超时时间
@ -84,7 +84,7 @@ spring:
port: 5672
username: eemcs
password: mh@803
virtual-host: /eemcs
virtual-host: /eemcs_gh_ers
listener:
direct:
prefetch: 2
@ -98,8 +98,8 @@ spring:
# 主库数据源
master:
#添加allowMultiQueries=true 在批量更新时才不会出错
url: jdbc:postgresql://127.0.0.1:5432/eemcs_hw_dev
# url: jdbc:postgresql://127.0.0.1:5432/eemcs
url: jdbc:postgresql://127.0.0.1:5432/eemcs_gh_ers_dev
# url: jdbc:postgresql://106.55.173.225:5505/eemcs
username: postgres
password: mh@803
# 从库数据源
@ -200,7 +200,7 @@ mqttSpring:
# port: 1883
# username: sa
# password: sa123
client-id: mqtt_mz_producer_dev
client-id: mqtt_gh_ers_producer_dev
# If the protocol is ws/wss, this value is required.
path:
# Topics that need to be subscribed when initially connecting to mqtt, multiple topics are divided by ",".

2
mh-admin/src/main/resources/application-druid.yml

@ -7,7 +7,7 @@ spring:
# 主库数据源
master:
#添加allowMultiQueries=true 在批量更新时才不会出错
url: jdbc:postgresql://127.0.0.1:5432/eemcs_hw
url: jdbc:postgresql://127.0.0.1:5432/eemcs_gh_ers_dev
# url: jdbc:postgresql://127.0.0.1:5432/eemcs
username: postgres
password: mh@803

22
mh-admin/src/main/resources/application-prod.yml

@ -1,11 +1,11 @@
# 项目相关配置
mh:
# 名称
name: hw
name: gh_ers
# 版本
version: 1.0.0
# 版权年份
copyrightYear: 2024
copyrightYear: 2026
# 文件路径 示例( Windows配置D:/mh/uploadPath,Linux配置 /home/mh/uploadPath)
profile: E:/mh/uploadPath
# 获取ip地址开关
@ -16,7 +16,7 @@ mh:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8090
port: 8091
servlet:
# 应用的访问路径
context-path: /
@ -63,7 +63,7 @@ spring:
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
database: 1
# 密码
password:
# 连接超时时间
@ -84,7 +84,7 @@ spring:
port: 5672
username: eemcs
password: mh@803
virtual-host: /eemcs
virtual-host: /eemcs_gh_ers
listener:
direct:
prefetch: 2
@ -98,8 +98,8 @@ spring:
# 主库数据源
master:
#添加allowMultiQueries=true 在批量更新时才不会出错
url: jdbc:postgresql://127.0.0.1:5505/eemcs_hw
# url: jdbc:postgresql://127.0.0.1:5505/eemcs
url: jdbc:postgresql://127.0.0.1:5505/eemcs_gh_ers
# url: jdbc:postgresql://127.0.0.1:5505/eemcs
username: postgres
password: mhtech@803
# 从库数据源
@ -193,9 +193,9 @@ mqttSpring:
protocol: MQTT
host: mqtt.mhito.net
port: 1883
username: sa
password: sa123
client-id: eemcs_hw_mqtt_pro
username: eemcs_gh_ers
password: mhtech@ghers
client-id: eemcs_gh_ers_mqtt_pro
# If the protocol is ws/wss, this value is required.
path:
# Topics that need to be subscribed when initially connecting to mqtt, multiple topics are divided by ",".
@ -208,7 +208,7 @@ mqttSpring:
port: 8083
path: /mqtt
control:
topic: mh_control/events_upload/devices
topic: mh_control/events_upload/devices/dev
amap:
key: fc4e79719daca2d0b8a11ba3124e1bd5

10
mh-admin/src/main/resources/application-test.yml

@ -1,11 +1,11 @@
# 项目相关配置
mh:
# 名称
name: MH
name: gh_ers
# 版本
version: 1.0.0
# 版权年份
copyrightYear: 2024
copyrightYear: 2026
# 文件路径 示例( Windows配置D:/mh/uploadPath,Linux配置 /home/mh/uploadPath)
profile: D:/mh/uploadPath
# 获取ip地址开关
@ -63,7 +63,7 @@ spring:
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
database: 1
# 密码
password:
# 连接超时时间
@ -98,7 +98,7 @@ spring:
# 主库数据源
master:
#添加allowMultiQueries=true 在批量更新时才不会出错
url: jdbc:postgresql://106.55.173.225:5505/eemcs_hw
url: jdbc:postgresql://106.55.173.225:5505/eemcs_gh_ers_dev
username: postgres
password: mhtech@803
# 从库数据源
@ -194,7 +194,7 @@ mqttSpring:
port: 2883
username: mh
password: mhtech@803
client-id: mqtt_mz_producer_dev
client-id: mqtt_gh_ers_producer_test
# If the protocol is ws/wss, this value is required.
path:
# Topics that need to be subscribed when initially connecting to mqtt, multiple topics are divided by ",".

2
mh-admin/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring:
profiles:
active: dev
active: prod
# 用户配置
user:

46
mh-admin/src/main/resources/logback.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/mh/hw/logs" />
<property name="log.path" value="/home/mh/gh_ers/logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
@ -13,27 +13,27 @@
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>1</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
<!-- <file>${log.path}/sys-info.log</file>-->
<!-- &lt;!&ndash; 循环政策:基于时间创建日志文件 &ndash;&gt;-->
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
<!-- &lt;!&ndash; 日志文件名格式 &ndash;&gt;-->
<!-- <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>-->
<!-- &lt;!&ndash; 日志最大的历史 60天 &ndash;&gt;-->
<!-- <maxHistory>1</maxHistory>-->
<!-- </rollingPolicy>-->
<!-- <encoder>-->
<!-- <pattern>${log.pattern}</pattern>-->
<!-- </encoder>-->
<!-- <filter class="ch.qos.logback.classic.filter.LevelFilter">-->
<!-- &lt;!&ndash; 过滤的级别 &ndash;&gt;-->
<!-- <level>INFO</level>-->
<!-- &lt;!&ndash; 匹配时的操作:接收(记录) &ndash;&gt;-->
<!-- <onMatch>ACCEPT</onMatch>-->
<!-- &lt;!&ndash; 不匹配时的操作:拒绝(不记录) &ndash;&gt;-->
<!-- <onMismatch>DENY</onMismatch>-->
<!-- </filter>-->
<!-- </appender>-->
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
@ -82,7 +82,7 @@
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<!-- <appender-ref ref="file_info" />-->
<appender-ref ref="file_error" />
</root>

BIN
mh-admin/src/main/resources/节能岛改造每日能耗统计表.xlsx

Binary file not shown.

137
mh-admin/src/test/java/com/mh/MHApplicationTest.java

@ -2,18 +2,26 @@ package com.mh;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.mh.common.core.domain.dto.ProProfileDTO;
import com.mh.common.core.domain.entity.DeviceReport;
import com.mh.common.core.domain.entity.SysParams;
import com.mh.common.core.domain.entity.SysUser;
import com.mh.common.core.domain.entity.WeatherData;
import com.mh.common.core.domain.vo.EnergyQueryVO;
import com.mh.common.utils.DateUtils;
import com.mh.common.utils.StringUtils;
import com.mh.quartz.task.DealDataTask;
import com.mh.quartz.task.GetWeatherDataTask;
import com.mh.quartz.task.HotWaterTask;
import com.mh.system.mapper.device.DataProcessMapper;
import com.mh.system.service.ISysParamsService;
import com.mh.system.service.ISysUserService;
import com.mh.system.service.device.IDeviceQrManageService;
import com.mh.system.service.operation.IAlarmRecordsService;
import com.mh.system.service.overview.IProOverviewService;
import com.mh.system.service.report.IComprehensiveReportService;
import com.mh.system.service.report.IMeterReadingsHisService;
import com.mh.system.service.report.IReportHotWaterService;
import jakarta.annotation.Resource;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
@ -40,6 +48,135 @@ public class MHApplicationTest {
@Autowired
private ISysUserService sysUserService;
@Autowired
private HotWaterTask hotWaterTask;
@Autowired
private IAlarmRecordsService alarmRecordsService;
@Autowired
private IMeterReadingsHisService meterReadingsHisService;
@Autowired
private IReportHotWaterService reportHotWaterService;
@Autowired
private IProOverviewService proOverviewService;
@Autowired
private IComprehensiveReportService comprehensiveReportService;
@Test
public void comprehensiveReport() {
long startTime = System.currentTimeMillis();
EnergyQueryVO vo = new EnergyQueryVO();
vo.setStartTime("2025-12-24 00:00:00");
vo.setEndTime("2025-12-24 23:59:59");
vo.setPageNum(1);
vo.setPageSize(10);
vo.setTimeType("hour");
System.out.println("开始查询");
List<?> report = comprehensiveReportService.report(vo);
System.out.println("报表耗时:" + (System.currentTimeMillis() - startTime) + "ms");
}
@Test
public void testHome() throws Exception {
// 开始计时
long startTime = System.currentTimeMillis();
List<ProProfileDTO> proProfile = proOverviewService.getProProfile();
System.out.println("耗时:" + (System.currentTimeMillis() - startTime) + "ms");
}
@Test
public void reportHotWater() {
reportHotWaterService.execProRunParamHis();
}
@Test
public void testExecProMeterReadingsHis() {
meterReadingsHisService.execProMeterReadingsHis("2025-12-11");
}
@Test
public void createAlarmTask() {
alarmRecordsService.insertOrUpdateAlarmRecord("e1a3034edw6a9b3a79a86332886b24896");
}
@Test
public void calcAnalysisData() {
for (int i = 9; i < 10; i++) {
hotWaterTask.calcAnalysisData("2025-07-0"+i);
}
}
@Test
public void testDate() {
Date date = new Date();
boolean sameDay = DateUtils.isSameDay(DateUtils.stringToDate("2025-09-24 00:00:00", "yyyy-MM-dd HH:mm:ss"), date);
System.out.println(sameDay);
}
@Test
public void calcEnergyData() {
for (int i = 1; i < 17; i++) {
// i < 10,则前面添加0
if (i < 10) {
hotWaterTask.calcEnergyData("2025-10-0"+i+" 00:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 01:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 02:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 03:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 04:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 05:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 06:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 07:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 08:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 09:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 10:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 11:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 12:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 13:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 14:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 15:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 16:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 17:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 18:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 19:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 20:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 21:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 22:00:00");
hotWaterTask.calcEnergyData("2025-10-0"+i+" 23:00:00");
} else {
hotWaterTask.calcEnergyData("2025-10-" + i + " 00:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 01:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 02:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 03:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 04:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 05:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 06:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 07:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 08:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 09:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 10:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 11:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 12:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 13:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 14:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 15:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 16:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 17:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 18:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 19:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 20:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 21:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 22:00:00");
hotWaterTask.calcEnergyData("2025-10-" + i + " 23:00:00");
}
}
}
@Test
public void test() throws Exception {
SysUser sysUser = sysUserService.selectUserById(1L);

6
mh-common/pom.xml

@ -159,6 +159,12 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.4.8-jre</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.binarywang/weixin-java-mp -->
<dependency>

10
mh-common/src/main/java/com/mh/common/constant/CacheConstants.java

@ -41,4 +41,14 @@ public class CacheConstants
* 登录账户密码错误次数 redis key
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
/**
* 获取项目概况
*/
public static final String PRO_PROFILE = "pro_profile";
/**
* 首页各个采集类型月数据
*/
public static final String ENERGY_ANALYSIS = "energy_analysis";
}

5
mh-common/src/main/java/com/mh/common/constant/Constants.java

@ -80,6 +80,8 @@ public class Constants {
*/
public static final String SUPER_ADMIN = "mhtech";
public static final String SUPER_ADMIN_TWO = "18675333710";
/**
* 角色权限分隔符
*/
@ -183,10 +185,13 @@ public class Constants {
public static final String CLOSE_HOST = "close_host_device_id"; // 关闭主机的设备id
public static final String OPEN_VALVE = "open_valve_device_id"; // 开启蝶阀的设备id
public static final String CHILLERS = "chillers";
public static final String BOILER = "boiler"; // 锅炉
public static final String OTHER = "other";
public static final String DEVICE = "devices";
public static final String CHILLERS_TYPE = "0"; // 主机类型设备
public static final String OTHER_TYPE = "1"; // 其他设备
public static final String BOILER_TYPE = "12"; // 锅炉设备
public static final String ERS = "ers"; // 热回收系统
public static boolean CONTROL_WEB_FLAG = false;
public static boolean SEND_STATUS = false; // 指令发送状态
public static boolean FLAG = false;

170
mh-common/src/main/java/com/mh/common/core/domain/dto/BFloorReportHotWaterDTO.java

@ -0,0 +1,170 @@
package com.mh.common.core.domain.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
//import java.math.String;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 三楼热水系统参数报表
* @date 2024-05-30 11:00:12
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@HeadRowHeight(25)
@HeadFontStyle(fontHeightInPoints = 14)
@ContentFontStyle(fontHeightInPoints = 13)
@ContentRowHeight(25)
@ContentStyle(
horizontalAlignment = HorizontalAlignmentEnum.CENTER,
borderBottom = BorderStyleEnum.THIN,
borderLeft = BorderStyleEnum.THIN,
borderRight = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN
)
@ColumnWidth(10)
public class BFloorReportHotWaterDTO {
/**
* 当前时间
*/
@ColumnWidth(17)
@ExcelProperty(value = {"${deviceType}", "时间", "时间"}, index = 0)
private String curTime;
// /**
// * 班次
// */
// @ColumnWidth(10)
// @ExcelProperty(value = {"${deviceType}", "班次", "班次"}, index = 1)
// private String classes;
/**
* 设定温度
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "1号热泵", "设定温度℃"}, index = 1)
private BigDecimal tempSetHotPumpOne;
/**
* 实际温度
*/
@ExcelProperty(value = {"${deviceType}", "1号热泵", "实际温度℃"}, index = 2)
@ColumnWidth(10)
private BigDecimal tempRealHotPumpOne;
/**
* 设备开关机
*/
@ExcelProperty(value = {"${deviceType}", "1号热泵", "设备开关机"}, index = 3)
@ColumnWidth(10)
private String statusSwitchHotPumpOneStr;
/**
* 设备运行状态
*/
@ExcelProperty(value = {"${deviceType}", "1号热泵", "设备运行状态"}, index = 4)
@ColumnWidth(10)
private String statusRunHotPumpOneStr;
/**
* 设定温度
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "2号热泵", "设定温度℃"}, index = 5)
private BigDecimal tempSetHotPumpTwo;
/**
* 实际温度
*/
@ExcelProperty(value = {"${deviceType}", "2号热泵", "实际温度℃"}, index = 6)
@ColumnWidth(10)
private BigDecimal tempRealHotPumpTwo;
/**
* 设备开关机
*/
@ExcelProperty(value = {"${deviceType}", "2号热泵", "设备开关机"}, index = 7)
@ColumnWidth(10)
private String statusSwitchHotPumpTwoStr;
/**
* 设备运行状态
*/
@ExcelProperty(value = {"${deviceType}", "2号热泵", "设备运行状态"}, index = 8)
@ColumnWidth(10)
private String statusRunHotPumpTwoStr;
// 高区/裙楼设定压力(bar)
@ExcelProperty(value = {"${deviceType}", "裙楼变频泵", "设定压力bar"}, index = 9)
@ColumnWidth(10)
private BigDecimal presSetSupplyPumpAreaOne;
// 高区/裙楼实际压力(bar)
@ExcelProperty(value = {"${deviceType}", "裙楼变频泵", "实际压力bar"}, index = 10)
@ColumnWidth(10)
private BigDecimal presRealSupplyPumpAreaOne;
// 高区/裙楼1号泵运行状态
@ExcelProperty(value = {"${deviceType}", "裙楼变频泵", "1号泵运行状态"}, index = 11)
@ColumnWidth(10)
private String statusRunSupplyPumpOneStr;
// 高区/裙楼2号泵运行状态
@ExcelProperty(value = {"${deviceType}", "裙楼变频泵", "2号泵运行状态"}, index = 12)
@ColumnWidth(10)
private String statusRunSupplyPumpTwoStr;
// 中区/中厨设定压力(bar)
@ExcelProperty(value = {"${deviceType}", "中厨变频泵", "设定压力bar"}, index = 13)
@ColumnWidth(10)
private BigDecimal presSetSupplyPumpAreaTwo;
// 中区/中厨实际压力(bar)
@ExcelProperty(value = {"${deviceType}", "中厨变频泵", "实际压力bar"}, index = 14)
@ColumnWidth(10)
private BigDecimal presRealSupplyPumpAreaTwo;
// 中区/中厨1号泵运行状态
@ExcelProperty(value = {"${deviceType}", "中厨变频泵", "1号泵运行状态"}, index = 15)
@ColumnWidth(10)
private String statusRunSupplyPumpThreeStr;
// 中区/中厨2号泵运行状态
@ExcelProperty(value = {"${deviceType}", "中厨变频泵", "2号泵运行状态"}, index = 16)
@ColumnWidth(10)
private String statusRunSupplyPumpFourStr;
// 高区/裙楼液位(米)
@ExcelProperty(value = {"${deviceType}", "水箱液位", "裙楼液位%"}, index = 17)
@ColumnWidth(10)
private BigDecimal levelWaterTankOne;
// 中区/中厨液位(米)
@ExcelProperty(value = {"${deviceType}", "水箱液位", "中厨液位%"}, index = 18)
@ColumnWidth(10)
private BigDecimal levelWaterTankTwo;
// 巡查记录人
@ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 19)
@ColumnWidth(20)
private String recorder;
// 备注信息
@ExcelProperty(value = {"${deviceType}", "备注", "备注"}, index = 20)
@ColumnWidth(20)
private String remark;
}

74
mh-common/src/main/java/com/mh/common/core/domain/dto/CompreReportDTO.java

@ -0,0 +1,74 @@
package com.mh.common.core.domain.dto;
import java.util.StringJoiner;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 综合系统能耗查询DTO
* @date 2025-10-09 10:17:26
*/
public class CompreReportDTO {
private String time;
private String electValue;
private String coldValue;
private String hotValue;
private String steamValue;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getElectValue() {
return electValue;
}
public void setElectValue(String electValue) {
this.electValue = electValue;
}
public String getColdValue() {
return coldValue;
}
public void setColdValue(String coldValue) {
this.coldValue = coldValue;
}
public String getHotValue() {
return hotValue;
}
public void setHotValue(String hotValue) {
this.hotValue = hotValue;
}
public String getSteamValue() {
return steamValue;
}
public void setSteamValue(String steamValue) {
this.steamValue = steamValue;
}
@Override
public String toString() {
return new StringJoiner(", ", CompreReportDTO.class.getSimpleName() + "[", "]")
.add("time='" + time + "'")
.add("electValue='" + electValue + "'")
.add("coldValue='" + coldValue + "'")
.add("hotValue='" + hotValue + "'")
.add("steamValue='" + steamValue + "'")
.toString();
}
}

20
mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterNowDataDTO.java

@ -22,16 +22,12 @@ public class HotWaterNowDataDTO {
private String waterTemp; //水箱水温
private String runState; //运行状态
private String isFault; //是否故障
private String levelSet; //水位1设置
private String levelSet2; //水位2设置
private String waterLevel1; //实际1水位
private String waterLevel2; //实际2水位
private String levelSet1; //水位设置
private String levelSet2; //水位设置
private String waterLevel1; //实际水位
private String waterLevel2; //实际水位
private String tankId; //水箱编号
private String tankName; //水箱名称
private String tankWaterTemp; // 水箱1温度
private String tankWaterTemp2; // 水箱2温度
private String tankId2; //水箱2编号
private String tankName2; //水箱2名称
private String envTemp; //环境温度
private String upWaterState1; // 供水1泵状态
@ -42,6 +38,14 @@ public class HotWaterNowDataDTO {
private String freq2; // 供水频率2
private String upWaterState3; // 供水3泵状态
private String freq3; // 供水频率3
private String upWaterState4; // 供水4泵状态
private String freq4; // 供水频率4
private String useWaterState; // 补水状态
private String backWaterState; // 回水状态

284
mh-common/src/main/java/com/mh/common/core/domain/dto/MaglevReportSysParamDTO.java

@ -0,0 +1,284 @@
package com.mh.common.core.domain.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
//import java.math.String;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 磁悬浮主机系统参数报表
* @date 2024-05-30 11:00:12
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@HeadRowHeight(25)
@HeadFontStyle(fontHeightInPoints = 14)
@ContentFontStyle(fontHeightInPoints = 13)
@ContentRowHeight(25)
@ContentStyle(
horizontalAlignment = HorizontalAlignmentEnum.CENTER,
borderBottom = BorderStyleEnum.THIN,
borderLeft = BorderStyleEnum.THIN,
borderRight = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN
)
@ColumnWidth(10)
public class MaglevReportSysParamDTO {
/**
* 当前时间
*/
@ColumnWidth(17)
@ExcelProperty(value = {"${deviceType}", "时间", "时间"}, index = 0)
private String curTime;
// /**
// * 班次
// */
// @ColumnWidth(10)
// @ExcelProperty(value = {"${deviceType}", "班次", "班次"}, index = 1)
// private String classes;
/**
* 冷冻水进水温度
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "蒸发器", "冷冻水进水温度℃"}, index = 1)
private BigDecimal tempInChillerWater;
/**
* 冷冻水出水温度
*/
@ExcelProperty(value = {"${deviceType}", "蒸发器", "冷冻水出水温度℃"}, index = 2)
@ColumnWidth(10)
private BigDecimal tempOutChillerWater;
/**
* 设计流量%
*/
@ExcelProperty(value = {"${deviceType}", "蒸发器", "设计流量%"}, index = 3)
@ColumnWidth(10)
private BigDecimal designFlow;
/**
* 蒸发器压力kpa
*/
@ExcelProperty(value = {"${deviceType}", "蒸发器", "蒸发器压力kpa"}, index = 4)
@ColumnWidth(10)
private BigDecimal pressEvapSaturation;
/**
* 蒸发器饱和温度
*/
@ExcelProperty(value = {"${deviceType}", "蒸发器", "蒸发器饱和温度℃"}, index = 5)
@ColumnWidth(10)
private BigDecimal tempEvapSaturation;
/**
* 趋近温度
*/
@ExcelProperty(value = {"${deviceType}", "蒸发器", "趋近温度℃"}, index = 6)
@ColumnWidth(10)
private BigDecimal tempEvapApproaching;
/**
* 冷却水进水温度
*/
@ExcelProperty(value = {"${deviceType}", "冷凝器", "冷却水进水温度℃"}, index = 7)
@ColumnWidth(10)
private BigDecimal tempInCoolingWater;
/**
* 冷却水出水温度
*/
@ExcelProperty(value = {"${deviceType}", "冷凝器", "冷却水出水温度℃"}, index = 8)
@ColumnWidth(10)
private BigDecimal tempOutCoolingWater;
/**
* 冷凝器压力kpa
*/
@ExcelProperty(value = {"${deviceType}", "冷凝器", "冷凝器压力kpa"}, index = 9)
@ColumnWidth(10)
private BigDecimal pressCondenserSaturation;
/**
* 冷凝器饱和温度
*/
@ExcelProperty(value = {"${deviceType}", "冷凝器", "冷凝器饱和温度℃"}, index = 10)
@ColumnWidth(10)
private BigDecimal tempCondenserSaturation;
/**
* 冷凝器趋近温度
*/
@ExcelProperty(value = {"${deviceType}", "冷凝器", "趋近温度℃"}, index = 11)
@ColumnWidth(10)
private BigDecimal tempCondenserApproaching;
/**
* 冷冻水设定值
*/
@ExcelProperty(value = {"${deviceType}", "系统", "冷冻水设定值℃"}, index = 12)
@ColumnWidth(10)
private BigDecimal setChillerWater;
/**
* 冷水机需求%
*/
@ExcelProperty(value = {"${deviceType}", "系统", "冷水机需求%"}, index = 13)
@ColumnWidth(10)
private BigDecimal setLoad;
/**
* 总电流A
*/
@ExcelProperty(value = {"${deviceType}", "系统", "总电流A"}, index = 14)
@ColumnWidth(10)
private BigDecimal currentTotal;
/**
* 总输入功率kw
*/
@ExcelProperty(value = {"${deviceType}", "系统", "总输入功率kw"}, index = 15)
@ColumnWidth(10)
private BigDecimal inputPowerTotal;
/**
* 压缩比
*/
// @ExcelProperty(value = {"${deviceType}", "系统", "压缩比"}, index = 16)
// @ColumnWidth(10)
// private BigDecimal ratioComp;
/**
* 压缩比1
*/
@ExcelProperty(value = {"${deviceType}", "系统", "1#压缩机压缩比"}, index = 16)
@ColumnWidth(10)
private BigDecimal ratioCompOne;
/**
* 压缩比2
*/
@ExcelProperty(value = {"${deviceType}", "系统", "2#压缩机压缩比"}, index = 17)
@ColumnWidth(10)
private BigDecimal ratioCompTwo;
/**
* 压缩比3
*/
@ExcelProperty(value = {"${deviceType}", "系统", "3#压缩机压缩比"}, index = 18)
@ColumnWidth(10)
private BigDecimal ratioCompThree;
/**
* 膨胀阀开度%
*/
@ExcelProperty(value = {"${deviceType}", "系统", "膨胀阀开度%"}, index = 19)
@ColumnWidth(10)
private BigDecimal openExv;
/**
* 运行中的压缩机数量
*/
@ExcelProperty(value = {"${deviceType}", "系统", "运行中的压缩机数量"}, index = 20)
@ColumnWidth(10)
private Integer runCompNum;
/**
* 冷冻水泵频率hz
*/
@ExcelProperty(value = {"${deviceType}", "冷冻泵", "冷冻水泵频率hz"}, index = 21)
@ColumnWidth(10)
private BigDecimal frequencyChiller;
/**
* 冷冻水进水压力kpa
*/
@ExcelProperty(value = {"${deviceType}", "冷冻泵", "冷冻水进水压力kpa"}, index = 22)
@ColumnWidth(10)
private BigDecimal pressInChillerWater;
/**
* 冷冻水出水压力kpa
*/
@ExcelProperty(value = {"${deviceType}", "冷冻泵", "冷冻水出水压力kpa"}, index = 23)
@ColumnWidth(10)
private BigDecimal pressOutChillerWater;
/**
* 冷却水泵频率hz
*/
@ExcelProperty(value = {"${deviceType}", "冷却泵", "冷却水泵频率hz"}, index = 24)
@ColumnWidth(10)
private BigDecimal frequencyCooling;
/**
* 冷却水进水压力kpa
*/
@ExcelProperty(value = {"${deviceType}", "冷却泵", "冷却水进水压力kpa"}, index = 25)
@ColumnWidth(10)
private BigDecimal pressInCoolingWater;
/**
* 冷却水出水压力kpa
*/
@ExcelProperty(value = {"${deviceType}", "冷却泵", "冷却水出水压力kpa"}, index = 26)
@ColumnWidth(10)
private BigDecimal pressOutCoolingWater;
/**
* 冷却塔频率hz
*/
@ExcelProperty(value = {"${deviceType}", "冷却塔", "冷却塔频率hz"}, index = 27)
private BigDecimal frequencyCoolingTower;
/**
* 冷却塔运行数量原注释可能有误根据列名调整
*/
@ExcelProperty(value = {"${deviceType}", "冷却塔", "冷却塔运行数量"}, index = 28)
private Integer runCoolingTower;
/**
* 室外温度
*/
@ExcelProperty(value = {"${deviceType}", "室外温度℃", "室外温度℃"}, index = 29)
@ColumnWidth(10)
private BigDecimal tempOutdoor;
/**
* 室外湿度%
*/
@ExcelProperty(value = {"${deviceType}", "室外湿度%", "室外湿度%"}, index = 30)
@ColumnWidth(10)
private BigDecimal humidityOutdoor;
/**
* 恒压补水罐压力
*/
@ExcelProperty(value = {"${deviceType}", "恒压补水罐压力MPa", "恒压补水罐压力MPa"}, index = 31)
@ColumnWidth(10)
private BigDecimal pressConstantWaterTank;
/**
* 巡查记录人
*/
@ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 32)
@ColumnWidth(20)
private String recorder;
}

179
mh-common/src/main/java/com/mh/common/core/domain/dto/ReportHeatingRunParamDTO.java

@ -0,0 +1,179 @@
package com.mh.common.core.domain.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 采暖系统参数报表
* @date 2024-05-30 11:00:12
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@HeadRowHeight(25)
@HeadFontStyle(fontHeightInPoints = 14)
@ContentFontStyle(fontHeightInPoints = 13)
@ContentRowHeight(20)
@ContentStyle(
horizontalAlignment = HorizontalAlignmentEnum.CENTER,
borderBottom = BorderStyleEnum.THIN,
borderLeft = BorderStyleEnum.THIN,
borderRight = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN
)
@ColumnWidth(10)
public class ReportHeatingRunParamDTO {
/**
* 当前时间
*/
@ColumnWidth(17)
@ExcelProperty(value = {"${deviceType}", "时间"}, index = 0)
private String curTime;
/**
* 当前状态
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "1号采暖设备", "运行状态"}, index = 1)
private String runStatusBoilerOne;
/**
* 设定温度
*/
@ExcelProperty(value = {"${deviceType}", "1号采暖设备", "设定温度(℃)"}, index = 2)
@ColumnWidth(10)
private BigDecimal tempSetBoilerOne;
/**
* 出水温度
*/
@ExcelProperty(value = {"${deviceType}", "1号采暖设备", "出水温度(℃)"}, index = 3)
@ColumnWidth(10)
private BigDecimal tempOutBoilerOne;
/**
* 回水温度
*/
@ExcelProperty(value = {"${deviceType}", "1号采暖设备", "回水温度(℃)"}, index = 4)
@ColumnWidth(10)
private BigDecimal tempInBoilerOne;
/**
* 炉水温度
*/
@ExcelProperty(value = {"${deviceType}", "1号采暖设备", "炉水温度(℃)"}, index = 5)
@ColumnWidth(10)
private BigDecimal tempWaterBoilerOne;
/**
* 烟道温度
*/
@ExcelProperty(value = {"${deviceType}", "1号采暖设备", "烟道温度(℃)"}, index = 6)
@ColumnWidth(10)
private BigDecimal tempFlueGasBoilerOne;
/**
* 当前状态
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "2号采暖设备", "运行状态"}, index = 7)
private String runStatusBoilerTwo;
/**
* 设定温度
*/
@ExcelProperty(value = {"${deviceType}", "2号采暖设备", "设定温度(℃)"}, index = 8)
@ColumnWidth(10)
private BigDecimal tempSetBoilerTwo;
/**
* 出水温度
*/
@ExcelProperty(value = {"${deviceType}", "2号采暖设备", "出水温度(℃)"}, index = 9)
@ColumnWidth(10)
private BigDecimal tempOutBoilerTwo;
/**
* 回水温度
*/
@ExcelProperty(value = {"${deviceType}", "2号采暖设备", "回水温度(℃)"}, index = 10)
@ColumnWidth(10)
private BigDecimal tempInBoilerTwo;
/**
* 炉水温度
*/
@ExcelProperty(value = {"${deviceType}", "2号采暖设备", "炉水温度(℃)"}, index = 11)
@ColumnWidth(10)
private BigDecimal tempWaterBoilerTwo;
/**
* 烟道温度
*/
@ExcelProperty(value = {"${deviceType}", "2号采暖设备", "烟道温度(℃)"}, index = 12)
@ColumnWidth(10)
private BigDecimal tempFlueGasBoilerTwo;
/**
* 当前状态
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "1号采暖泵", "运行状态"}, index = 13)
private String runStatusPumpOne;
/**
* 频率
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "1号采暖泵", "频率(Hz)"}, index = 14)
private BigDecimal frequencyPumpOne;
/**
* 当前状态
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "2号采暖泵", "运行状态"}, index = 15)
private String runStatusPumpTwo;
/**
* 频率
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "2号采暖泵", "频率(Hz)"}, index = 16)
private BigDecimal frequencyPumpTwo;
/**
* 当前状态
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "3号采暖泵", "运行状态"}, index = 17)
private String runStatusPumpThree;
/**
* 频率
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "3号采暖泵", "频率(Hz)"}, index = 18)
private BigDecimal frequencyPumpThree;
// 巡查记录人
@ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 19)
@ColumnWidth(20)
private String recorder;
// 备注信息
@ExcelProperty(value = {"${deviceType}", "备注", "备注"}, index = 20)
@ColumnWidth(20)
private String remark;
}

135
mh-common/src/main/java/com/mh/common/core/domain/dto/ReportSteamRunParamDTO.java

@ -0,0 +1,135 @@
package com.mh.common.core.domain.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 蒸汽机系统参数报表
* @date 2024-05-30 11:00:12
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@HeadRowHeight(25)
@HeadFontStyle(fontHeightInPoints = 14)
@ContentFontStyle(fontHeightInPoints = 13)
@ContentRowHeight(20)
@ContentStyle(
horizontalAlignment = HorizontalAlignmentEnum.CENTER,
borderBottom = BorderStyleEnum.THIN,
borderLeft = BorderStyleEnum.THIN,
borderRight = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN
)
@ColumnWidth(10)
public class ReportSteamRunParamDTO {
/**
* 当前时间
*/
@ColumnWidth(17)
@ExcelProperty(value = {"${deviceType}", "时间"}, index = 0)
private String curTime;
/**
* 当前状态
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "当前状态", "当前状态"}, index = 1)
private String curStatus;
/**
* 火焰强度
*/
@ExcelProperty(value = {"${deviceType}", "火焰强度", "火焰强度"}, index = 2)
@ColumnWidth(10)
private BigDecimal flameIntensity;
/**
* 烟气温度
*/
@ExcelProperty(value = {"${deviceType}", "烟气温度(℃)", "烟气温度(℃)"}, index = 3)
@ColumnWidth(10)
private BigDecimal tempFlueGas;
/**
* 火焰百分比%
*/
@ExcelProperty(value = {"${deviceType}", "火焰百分比(%)", "火焰百分比(%)"}, index = 4)
@ColumnWidth(10)
private BigDecimal percentFlameIntensity;
/**
* 液位%
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "液位(%)", "液位(%)"}, index = 5)
private BigDecimal waterLevel;
/**
* 蒸汽温度
*/
@ExcelProperty(value = {"${deviceType}", "蒸汽温度(℃)", "蒸汽温度(℃)"}, index = 6)
@ColumnWidth(10)
private BigDecimal tempCur;
/**
* 当前压力Mpa
*/
@ExcelProperty(value = {"${deviceType}", "当前压力(Mpa)", "当前压力(Mpa)"}, index = 7)
@ColumnWidth(10)
private BigDecimal pressCur;
/**
* 压力设定值Mpa
*/
@ExcelProperty(value = {"${deviceType}", "压力设定值(Mpa)", "压力设定值(Mpa)"}, index = 8)
@ColumnWidth(10)
private BigDecimal pressSet;
// 启动压差(Mpa)
@ExcelProperty(value = {"${deviceType}", "启动压差(Mpa)", "启动压差(Mpa)"}, index = 9)
@ColumnWidth(10)
private BigDecimal pressStartDiff;
// 停止压差(Mpa)
@ExcelProperty(value = {"${deviceType}", "停止压差(Mpa)", "停止压差(Mpa)"}, index = 10)
@ColumnWidth(10)
private BigDecimal pressShutdownDiff;
// 瞬时压力(Mpa)
@ExcelProperty(value = {"${deviceType}", "瞬时压力(Mpa)", "瞬时压力(Mpa)"}, index = 11)
@ColumnWidth(10)
private BigDecimal pressInstance;
// 瞬时流量(t/h)
@ExcelProperty(value = {"${deviceType}", "瞬时流量(t/h)", "瞬时流量(t/h)"}, index = 12)
@ColumnWidth(10)
private BigDecimal flowInstance;
// 累积流量(t)
@ExcelProperty(value = {"${deviceType}", "累积流量(t)", "累积流量(t)"}, index = 13)
@ColumnWidth(10)
private BigDecimal flowTotal;
// 巡查记录人
@ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 14)
@ColumnWidth(20)
private String recorder;
// 备注信息
@ExcelProperty(value = {"${deviceType}", "备注", "备注"}, index = 15)
@ColumnWidth(20)
private String remark;
}

210
mh-common/src/main/java/com/mh/common/core/domain/dto/ThreeFloorReportHotWaterDTO.java

@ -0,0 +1,210 @@
package com.mh.common.core.domain.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.*;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
//import java.math.String;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 三楼热水系统参数报表
* @date 2024-05-30 11:00:12
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@HeadRowHeight(25)
@HeadFontStyle(fontHeightInPoints = 14)
@ContentFontStyle(fontHeightInPoints = 13)
@ContentRowHeight(25)
@ContentStyle(
horizontalAlignment = HorizontalAlignmentEnum.CENTER,
borderBottom = BorderStyleEnum.THIN,
borderLeft = BorderStyleEnum.THIN,
borderRight = BorderStyleEnum.THIN,
borderTop = BorderStyleEnum.THIN
)
@ColumnWidth(10)
public class ThreeFloorReportHotWaterDTO {
/**
* 当前时间
*/
@ColumnWidth(17)
@ExcelProperty(value = {"${deviceType}", "时间", "时间"}, index = 0)
private String curTime;
// /**
// * 班次
// */
// @ColumnWidth(10)
// @ExcelProperty(value = {"${deviceType}", "班次", "班次"}, index = 1)
// private String classes;
/**
* 设定温度
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "1号热泵", "设定温度℃"}, index = 1)
private BigDecimal tempSetHotPumpOne;
/**
* 实际温度
*/
@ExcelProperty(value = {"${deviceType}", "1号热泵", "实际温度℃"}, index = 2)
@ColumnWidth(10)
private BigDecimal tempRealHotPumpOne;
/**
* 设备开关机
*/
@ExcelProperty(value = {"${deviceType}", "1号热泵", "设备开关机"}, index = 3)
@ColumnWidth(10)
private String statusSwitchHotPumpOneStr;
/**
* 设备运行状态
*/
@ExcelProperty(value = {"${deviceType}", "1号热泵", "设备运行状态"}, index = 4)
@ColumnWidth(10)
private String statusRunHotPumpOneStr;
/**
* 设定温度
*/
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "2号热泵", "设定温度℃"}, index = 5)
private BigDecimal tempSetHotPumpTwo;
/**
* 实际温度
*/
@ExcelProperty(value = {"${deviceType}", "2号热泵", "实际温度℃"}, index = 6)
@ColumnWidth(10)
private BigDecimal tempRealHotPumpTwo;
/**
* 设备开关机
*/
@ExcelProperty(value = {"${deviceType}", "2号热泵", "设备开关机"}, index = 7)
@ColumnWidth(10)
private String statusSwitchHotPumpTwoStr;
/**
* 设备运行状态
*/
@ExcelProperty(value = {"${deviceType}", "2号热泵", "设备运行状态"}, index = 8)
@ColumnWidth(10)
private String statusRunHotPumpTwoStr;
// 3号热泵设定温度(℃)
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "3号热泵", "设定温度℃"}, index = 9)
private BigDecimal tempSetHotPumpThree;
// 3号热泵实际温度(℃)
@ExcelProperty(value = {"${deviceType}", "3号热泵", "实际温度℃"}, index = 10)
@ColumnWidth(10)
private BigDecimal tempRealHotPumpThree;
// 3号热泵启停状态
@ExcelProperty(value = {"${deviceType}", "3号热泵", "设备开关机"}, index = 11)
@ColumnWidth(10)
private String statusSwitchHotPumpThreeStr;
// 3号热泵运行状态
@ExcelProperty(value = {"${deviceType}", "3号热泵", "设备运行状态"}, index = 12)
@ColumnWidth(10)
private String statusRunHotPumpThreeStr;
// 4号热泵设定温度(℃)
@ColumnWidth(10)
@ExcelProperty(value = {"${deviceType}", "4号热泵", "设定温度℃"}, index = 13)
private BigDecimal tempSetHotPumpFour;
// 4号热泵实际温度(℃)
@ExcelProperty(value = {"${deviceType}", "4号热泵", "实际温度℃"}, index = 14)
@ColumnWidth(10)
private BigDecimal tempRealHotPumpFour;
// 4号热泵启停状态
@ExcelProperty(value = {"${deviceType}", "4号热泵", "设备开关机"}, index = 15)
@ColumnWidth(10)
private String statusSwitchHotPumpFourStr;
// 4号热泵运行状态
@ExcelProperty(value = {"${deviceType}", "4号热泵", "设备运行状态"}, index = 16)
@ColumnWidth(10)
private String statusRunHotPumpFourStr;
// 高区/高区设定压力(bar)
@ExcelProperty(value = {"${deviceType}", "高区变频泵", "设定压力bar"}, index = 17)
@ColumnWidth(10)
private BigDecimal presSetSupplyPumpAreaOne;
// 高区/高区实际压力(bar)
@ExcelProperty(value = {"${deviceType}", "高区变频泵", "实际压力bar"}, index = 18)
@ColumnWidth(10)
private BigDecimal presRealSupplyPumpAreaOne;
// 高区/高区1号泵运行状态
@ExcelProperty(value = {"${deviceType}", "高区变频泵", "1号泵运行状态"}, index = 19)
@ColumnWidth(10)
private String statusRunSupplyPumpOneStr;
// 高区/高区2号泵运行状态
@ExcelProperty(value = {"${deviceType}", "高区变频泵", "2号泵运行状态"}, index = 20)
@ColumnWidth(10)
private String statusRunSupplyPumpTwoStr;
// 中区/中区设定压力(bar)
@ExcelProperty(value = {"${deviceType}", "中区变频泵", "设定压力bar"}, index = 21)
@ColumnWidth(10)
private BigDecimal presSetSupplyPumpAreaTwo;
// 中区/中区实际压力(bar)
@ExcelProperty(value = {"${deviceType}", "中区变频泵", "实际压力bar"}, index = 22)
@ColumnWidth(10)
private BigDecimal presRealSupplyPumpAreaTwo;
// 中区/中区1号泵运行状态
@ExcelProperty(value = {"${deviceType}", "中区变频泵", "1号泵运行状态"}, index = 23)
@ColumnWidth(10)
private String statusRunSupplyPumpThreeStr;
// 中区/中区2号泵运行状态
@ExcelProperty(value = {"${deviceType}", "中区变频泵", "2号泵运行状态"}, index = 24)
@ColumnWidth(10)
private String statusRunSupplyPumpFourStr;
// 高区/高区液位(米)
@ExcelProperty(value = {"${deviceType}", "水箱液位", "高区液位%"}, index = 25)
@ColumnWidth(10)
private BigDecimal levelWaterTankOne;
// 中区/中区液位(米)
@ExcelProperty(value = {"${deviceType}", "水箱液位", "中区液位%"}, index = 26)
@ColumnWidth(10)
private BigDecimal levelWaterTankTwo;
// 巡查记录人
@ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 27)
@ColumnWidth(20)
private String recorder;
// 备注信息
@ExcelProperty(value = {"${deviceType}", "备注", "备注"}, index = 28)
@ColumnWidth(20)
private String remark;
}

63
mh-common/src/main/java/com/mh/common/core/domain/dto/WeatherDataDTO.java

@ -0,0 +1,63 @@
package com.mh.common.core.domain.dto;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 天气温度历史记录查询
* @date 2025-06-16 11:21:48
*/
@Data
public class WeatherDataDTO {
/**
* 时间
*/
private String weatherDate;
/**
* 日期和星期
*/
private String dateAndWeek;
/**
* 最高温度
*/
private String maxTemp;
/**
* 最低温度
*/
private String minTemp;
/**
* 天气
*/
private String weatherConditions;
/**
* 风向
*/
private String windDirection;
/**
* 风速
*/
private String windPower;
@Override
public String toString() {
return new ToStringBuilder(this)
.append("weatherDate", weatherDate)
.append("dateAndWeek", dateAndWeek)
.append("maxTemp", maxTemp)
.append("minTemp", minTemp)
.append("weatherConditions", weatherConditions)
.append("windDirection", windDirection)
.append("windPower", windPower)
.toString();
}
}

19
mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java

@ -86,13 +86,26 @@ public class AlarmRecords implements Serializable {
/**
* 是否发送通知 0未发送 1已发送
*/
private Integer isSend;
private int isSend;
public Integer getIsSend() {
/**
* 推送次数大于3次不再推送
*/
private int sendNum;
public int getSendNum() {
return sendNum;
}
public void setSendNum(int sendNum) {
this.sendNum = sendNum;
}
public int getIsSend() {
return isSend;
}
public void setIsSend(Integer isSend) {
public void setIsSend(int isSend) {
this.isSend = isSend;
}

1
mh-common/src/main/java/com/mh/common/core/domain/entity/CpmSpaceRelation.java

@ -84,6 +84,7 @@ public class CpmSpaceRelation extends BaseEntity {
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("ledgerId", ledgerId)
.append("cpmId", cpmId)
.append("areaId", areaId)
.append("buildingId", buildingId)

217
mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHeatingRunParamHis.java

@ -0,0 +1,217 @@
package com.mh.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mh.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Map;
import java.util.StringJoiner;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 采暖系统运行记录表
* @date 2025-10-21 10:26:12
*/
@Data
@TableName("report_heating_run_param_his") // 指定数据库表名
public class ReportHeatingRunParamHis extends BaseEntity {
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
// 日期
@TableField("cur_date") // 字段映射(可选,若字段名与属性名不一致时需指定)
private LocalDate curDate;
// 时间
@TableField("cur_time")
private String curTime; // 字符串类型直接映射
// 班次
@TableField("classes")
private String classes;
// 锅炉1状态
@TableField("cur_status_boiler_one")
private Integer curStatusBoilerOne;
// 锅炉1状态
@TableField(exist = false)
private String runStatusBoilerOne;
// 锅炉1出水温度(℃)
@TableField("temp_out_boiler_one")
private BigDecimal tempOutBoilerOne; // 精度要求高时使用BigDecimal
// 锅炉1设定温度(℃)
@TableField("temp_set_boiler_one")
private BigDecimal tempSetBoilerOne; // 精度要求高时使用BigDecimal
// 锅炉1回水温度(℃)
@TableField("temp_in_boiler_one")
private BigDecimal tempInBoilerOne;
// 锅炉1炉水温度(℃)
@TableField("temp_water_boiler_one")
private BigDecimal tempWaterBoilerOne;
// 锅炉1烟道温度(℃)
@TableField("temp_flue_gas_boiler_one")
private BigDecimal tempFlueGasBoilerOne;
// 锅炉2状态
@TableField("cur_status_boiler_two")
private Integer curStatusBoilerTwo;
// 锅炉2状态
@TableField(exist = false)
private String runStatusBoilerTwo;
// 锅炉2设定温度(℃)
@TableField("temp_set_boiler_two")
private BigDecimal tempSetBoilerTwo; // 精度要求高时使用BigDecimal
// 锅炉2出水温度(℃)
@TableField("temp_out_boiler_two")
private BigDecimal tempOutBoilerTwo;
// 锅炉2回水温度(℃)
@TableField("temp_in_boiler_two")
private BigDecimal tempInBoilerTwo;
// 锅炉2炉水温度(℃)
@TableField("temp_water_boiler_two")
private BigDecimal tempWaterBoilerTwo;
// 锅炉2烟道温度(℃)
@TableField("temp_flue_gas_boiler_two")
private BigDecimal tempFlueGasBoilerTwo;
// 采暖泵1状态
@TableField("cur_status_pump_one")
private Integer curStatusPumpOne;
// 采暖泵1状态
@TableField(exist = false)
private String runStatusPumpOne;
// 采暖泵1频率(Hz)
@TableField("frequency_pump_one")
private BigDecimal frequencyPumpOne;
// 采暖泵2状态
@TableField("cur_status_pump_two")
private Integer curStatusPumpTwo;
// 采暖泵2状态
@TableField(exist = false)
private String runStatusPumpTwo;
// 采暖泵2频率(Hz)
@TableField("frequency_pump_two")
private BigDecimal frequencyPumpTwo;
// 采暖泵3状态
@TableField("cur_status_pump_three")
private Integer curStatusPumpThree;
// 采暖泵3状态
@TableField(exist = false)
private String runStatusPumpThree;
// 采暖泵3频率(Hz)
@TableField("frequency_pump_three")
private BigDecimal frequencyPumpThree;
// 巡查记录人
@TableField("recorder")
private String recorder;
// 备注
@TableField("remark")
private String remark;
// 创建时间(自动填充)
@TableField(value = "create_date", fill = FieldFill.INSERT) // 插入时自动填充
private LocalDateTime createDate;
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/**
* 请求参数
*/
@TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
/** 创建者 */
@JsonIgnore
@TableField(exist = false)
private String createBy;
/** 创建时间 */
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
@JsonIgnore
@TableField(exist = false)
private String updateBy;
/** 更新时间 */
@JsonIgnore
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 更新者 */
@TableField(exist = false)
private int pageNum;
/** 更新者 */
@TableField(exist = false)
private int pageSize;
@Override
public String toString() {
return new StringJoiner(", ", ReportHeatingRunParamHis.class.getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("curDate=" + curDate)
.add("curTime='" + curTime + "'")
.add("classes='" + classes + "'")
.add("curStatusBoilerOne=" + curStatusBoilerOne)
.add("tempOutBoilerOne=" + tempOutBoilerOne)
.add("tempInBoilerOne=" + tempInBoilerOne)
.add("tempWaterBoilerOne=" + tempWaterBoilerOne)
.add("tempFlueGasBoilerOne=" + tempFlueGasBoilerOne)
.add("curStatusBoilerTwo=" + curStatusBoilerTwo)
.add("tempOutBoilerTwo=" + tempOutBoilerTwo)
.add("tempInBoilerTwo=" + tempInBoilerTwo)
.add("tempWaterBoilerTwo=" + tempWaterBoilerTwo)
.add("tempFlueGasBoilerTwo=" + tempFlueGasBoilerTwo)
.add("curStatusPumpOne=" + curStatusPumpOne)
.add("frequencyPumpOne=" + frequencyPumpOne)
.add("curStatusPumpTwo=" + curStatusPumpTwo)
.add("frequencyPumpTwo=" + frequencyPumpTwo)
.add("curStatusPumpThree=" + curStatusPumpThree)
.add("frequencyPumpThree=" + frequencyPumpThree)
.add("recorder='" + recorder + "'")
.add("remark='" + remark + "'")
.add("createDate=" + createDate)
.toString();
}
}

232
mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHotWaterParamHis.java

@ -0,0 +1,232 @@
package com.mh.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mh.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Map;
import java.util.StringJoiner;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 生活热水供水热泵运行情况
* @date 2025-10-22 17:40:03
*/
@Setter
@Getter
@TableName("report_hot_water_param_his")
public class ReportHotWaterParamHis extends BaseEntity implements Serializable {
// 主键
@Serial
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
// 楼层ID
private String floorId;
// 记录日期
private LocalDate curDate;
// 记录时间(varchar格式)
private String curTime;
// 班次
private String classes;
// 1号热泵设定温度(℃)
private BigDecimal tempSetHotPumpOne;
// 1号热泵实际温度(℃)
private BigDecimal tempRealHotPumpOne;
// 1号热泵启停状态(0-关闭,1-开启)
private Integer statusSwitchHotPumpOne;
// 1号热泵运行状态(0-故障,1-正常)
private Integer statusRunHotPumpOne;
// 2号热泵设定温度(℃)
private BigDecimal tempSetHotPumpTwo;
// 2号热泵实际温度(℃)
private BigDecimal tempRealHotPumpTwo;
// 2号热泵启停状态
private Integer statusSwitchHotPumpTwo;
// 2号热泵运行状态
private Integer statusRunHotPumpTwo;
// 3号热泵设定温度(℃)
private BigDecimal tempSetHotPumpThree;
// 3号热泵实际温度(℃)
private BigDecimal tempRealHotPumpThree;
// 3号热泵启停状态
private Integer statusSwitchHotPumpThree;
// 3号热泵运行状态
private Integer statusRunHotPumpThree;
// 4号热泵设定温度(℃)
private BigDecimal tempSetHotPumpFour;
// 4号热泵实际温度(℃)
private BigDecimal tempRealHotPumpFour;
// 4号热泵启停状态
private Integer statusSwitchHotPumpFour;
// 4号热泵运行状态
private Integer statusRunHotPumpFour;
// 高区/裙楼设定压力(MPa)
private BigDecimal presSetSupplyPumpAreaOne;
// 高区/裙楼实际压力(MPa)
private BigDecimal presRealSupplyPumpAreaOne;
// 高区/裙楼1号泵运行状态
private Integer statusRunSupplyPumpOne;
// 高区/裙楼2号泵运行状态
private Integer statusRunSupplyPumpTwo;
// 中区/中厨设定压力(MPa)
private BigDecimal presSetSupplyPumpAreaTwo;
// 中区/中厨实际压力(MPa)
private BigDecimal presRealSupplyPumpAreaTwo;
// 中区/中厨1号泵运行状态
private Integer statusRunSupplyPumpThree;
// 中区/中厨2号泵运行状态
private Integer statusRunSupplyPumpFour;
// 高区/裙楼液位(米)
private BigDecimal levelWaterTankOne;
// 中区/中厨液位(米)
private BigDecimal levelWaterTankTwo;
// 巡查记录人
private String recorder;
// 备注信息
private String remark;
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/**
* 请求参数
*/
@TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
/** 创建者 */
@JsonIgnore
@TableField(exist = false)
private String createBy;
/** 创建时间 */
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
@JsonIgnore
@TableField(exist = false)
private String updateBy;
/** 更新时间 */
@JsonIgnore
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 更新者 */
@TableField(exist = false)
private int pageNum;
/** 更新者 */
@TableField(exist = false)
private int pageSize;
// 无参构造
public ReportHotWaterParamHis() {
}
// Getter/Setter 方法(此处省略,实际开发中建议使用 Lombok @Data)
// 业务方法示例:判断热泵1是否正常运行
public boolean isHotPump1Normal() {
return statusRunHotPumpOne != null && statusRunHotPumpOne == 1;
}
// 业务方法示例:获取当前压力差值(高区)
public BigDecimal getHighAreaPressureDiff() {
return presRealSupplyPumpAreaOne.subtract(presSetSupplyPumpAreaOne);
}
@Override
public String toString() {
return new StringJoiner(", ", ReportHotWaterParamHis.class.getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("floorId='" + floorId + "'")
.add("curDate=" + curDate)
.add("curTime='" + curTime + "'")
.add("classes='" + classes + "'")
.add("tempSetHotPumpOne=" + tempSetHotPumpOne)
.add("tempRealHotPumpOne=" + tempRealHotPumpOne)
.add("statusSwitchHotPumpOne=" + statusSwitchHotPumpOne)
.add("statusRunHotPumpOne=" + statusRunHotPumpOne)
.add("tempSetHotPumpTwo=" + tempSetHotPumpTwo)
.add("tempRealHotPumpTwo=" + tempRealHotPumpTwo)
.add("statusSwitchHotPumpTwo=" + statusSwitchHotPumpTwo)
.add("statusRunHotPumpTwo=" + statusRunHotPumpTwo)
.add("tempSetHotPumpThree=" + tempSetHotPumpThree)
.add("tempRealHotPumpThree=" + tempRealHotPumpThree)
.add("statusSwitchHotPumpThree=" + statusSwitchHotPumpThree)
.add("statusRunHotPumpThree=" + statusRunHotPumpThree)
.add("tempSetHotPumpFour=" + tempSetHotPumpFour)
.add("tempRealHotPumpFour=" + tempRealHotPumpFour)
.add("statusSwitchHotPumpFour=" + statusSwitchHotPumpFour)
.add("statusRunHotPumpFour=" + statusRunHotPumpFour)
.add("presSetSupplyPumpAreaOne=" + presSetSupplyPumpAreaOne)
.add("presRealSupplyPumpAreaOne=" + presRealSupplyPumpAreaOne)
.add("statusRunSupplyPumpOne=" + statusRunSupplyPumpOne)
.add("statusRunSupplyPumpTwo=" + statusRunSupplyPumpTwo)
.add("presSetSupplyPumpAreaTwo=" + presSetSupplyPumpAreaTwo)
.add("presRealSupplyPumpAreaTwo=" + presRealSupplyPumpAreaTwo)
.add("statusRunSupplyPumpThree=" + statusRunSupplyPumpThree)
.add("statusRunSupplyPumpFour=" + statusRunSupplyPumpFour)
.add("levelWaterTankOne=" + levelWaterTankOne)
.add("levelWaterTankTwo=" + levelWaterTankTwo)
.add("recorder='" + recorder + "'")
.add("remark='" + remark + "'")
.toString();
}
}

114
mh-common/src/main/java/com/mh/common/core/domain/entity/ReportMeterReadingsHis.java

@ -0,0 +1,114 @@
package com.mh.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
import java.util.StringJoiner;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 设备抄表记录表
* @date 2025-10-21 10:26:12
*/
@Setter
@Getter
public class ReportMeterReadingsHis {
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* 设备类型
*/
private String mtType;
/**
* 设备位置
*/
private String location;
/**
* 设备编号
*/
private String mtNum;
/**
* 昨日抄表读数
*/
private BigDecimal yesterdayReading;
/**
* 昨日抄表时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date yesterdayTimestamp;
/**
* 当日抄表读数
*/
private BigDecimal todayReading;
/**
* 当日抄表时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date todayTimestamp;
/**
* 设备倍率
*/
private int mtRatio;
/**
* 当日总读数*设备倍率
*/
private BigDecimal total;
/**
* 当日单价
*/
private BigDecimal unitPrice;
/**
* 当日金额
*/
private BigDecimal cost;
/**
* 记录创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 排序序号
*/
private int sortOrder;
@Override
public String toString() {
return new StringJoiner(", ", ReportMeterReadingsHis.class.getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("mtType='" + mtType + "'")
.add("location='" + location + "'")
.add("mtNum='" + mtNum + "'")
.add("yesterdayReading=" + yesterdayReading)
.add("yesterdayTimestamp=" + yesterdayTimestamp)
.add("todayReading=" + todayReading)
.add("todayTimestamp=" + todayTimestamp)
.add("mtRatio=" + mtRatio)
.add("total=" + total)
.add("unitPrice=" + unitPrice)
.add("cost=" + cost)
.add("createTime=" + createTime)
.add("sortOrder=" + sortOrder)
.toString();
}
}

170
mh-common/src/main/java/com/mh/common/core/domain/entity/ReportSteamRunParamHis.java

@ -0,0 +1,170 @@
package com.mh.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mh.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.Map;
import java.util.StringJoiner;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 生活热水供水热泵运行情况
* @date 2025-10-22 17:40:03
*/
@Setter
@Getter
@TableName("report_steam_run_param_his")
public class ReportSteamRunParamHis extends BaseEntity implements Serializable {
// 主键
@Serial
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
// 记录日期
private LocalDate curDate;
// 记录时间(varchar格式)
private String curTime;
// 班次
private String classes;
// 蒸汽机状态字
private Integer curStatus;
// 运行状态
// @JsonIgnore
@TableField(exist = false)
private String runStatus;
// 火焰强度
private BigDecimal flameIntensity;
// 烟气温度(℃)
private BigDecimal tempFlueGas;
// 火焰百分比(%)
private BigDecimal percentFlameIntensity;
// 液位(%)
private BigDecimal waterLevel;
// 蒸汽温度(℃)
private BigDecimal tempCur;
// 当前压力(Mpa)
private BigDecimal pressCur;
// 压力设定值(Mpa)
private BigDecimal pressSet;
// 启动压差(Mpa)
private BigDecimal pressStartDiff;
// 停止压差(Mpa)
private BigDecimal pressShutdownDiff;
// 瞬时压力(Mpa)
private BigDecimal pressInstance;
// 瞬时流量(t/h)
private BigDecimal flowInstance;
// 累积流量(t)
private BigDecimal flowTotal;
// 巡查记录人
private String recorder;
// 备注信息
private String remark;
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/**
* 请求参数
*/
@TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
/** 创建者 */
@JsonIgnore
@TableField(exist = false)
private String createBy;
/** 创建时间 */
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
@JsonIgnore
@TableField(exist = false)
private String updateBy;
/** 更新时间 */
@JsonIgnore
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 更新者 */
@TableField(exist = false)
private int pageNum;
/** 更新者 */
@TableField(exist = false)
private int pageSize;
@Override
public String toString() {
return new StringJoiner(", ", ReportSteamRunParamHis.class.getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("curDate=" + curDate)
.add("curTime='" + curTime + "'")
.add("classes='" + classes + "'")
.add("curStatus=" + curStatus)
.add("flameIntensity=" + flameIntensity)
.add("tempFlueGas=" + tempFlueGas)
.add("percentFlameIntensity=" + percentFlameIntensity)
.add("waterLevel=" + waterLevel)
.add("tempCur=" + tempCur)
.add("pressCur=" + pressCur)
.add("pressSet=" + pressSet)
.add("pressStartDiff=" + pressStartDiff)
.add("pressShutdownDiff=" + pressShutdownDiff)
.add("pressInstance=" + pressInstance)
.add("flowInstance=" + flowInstance)
.add("flowTotal=" + flowTotal)
.add("recorder='" + recorder + "'")
.add("remark='" + remark + "'")
.add("searchValue='" + searchValue + "'")
.add("params=" + params)
.add("createBy='" + createBy + "'")
.add("createTime=" + createTime)
.add("updateBy='" + updateBy + "'")
.add("updateTime=" + updateTime)
.toString();
}
}

310
mh-common/src/main/java/com/mh/common/core/domain/entity/ReportSysRunParamHis.java

@ -0,0 +1,310 @@
package com.mh.common.core.domain.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mh.common.core.domain.BaseEntity;
import lombok.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.data.annotation.Id;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.Map;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 系统参数设备运行历史记录
* @date 2025-08-12 10:44:36
*/
@Data
@TableName("report_sys_run_param_his")
public class ReportSysRunParamHis extends BaseEntity {
/**
* 自增主键
*/
@Id
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 主机id
*/
private String deviceNum;
/**
* 日期
*/
private LocalDate curDate;
/**
* 时间格式建议与数据库存储一致 "HH:mm:ss" "yyyy-MM-dd HH:mm:ss"
*/
private String curTime;
// /**
// * 班次
// */
// private String classes;
/**
* 冷冻水进水温度
*/
private BigDecimal tempInChillerWater;
/**
* 冷冻水出水温度
*/
private BigDecimal tempOutChillerWater;
/**
* 设计流量%修正列名 "design flow" 含空格
*/
private BigDecimal designFlow;
/**
* 蒸发器压力kpa--磁悬浮
*/
private BigDecimal pressEvapSaturation;
/**
* 蒸发器饱和温度
*/
private BigDecimal tempEvapSaturation;
/**
* 蒸发器趋近温度
*/
private BigDecimal tempEvapApproaching;
/**
* 冷却水进水温度
*/
private BigDecimal tempInCoolingWater;
/**
* 冷却水出水温度
*/
private BigDecimal tempOutCoolingWater;
/**
* 冷凝器压力kpa--磁悬浮
*/
private BigDecimal pressCondenserSaturation;
/**
* 冷凝器饱和温度
*/
private BigDecimal tempCondenserSaturation;
/**
* 冷凝器趋近温度
*/
private BigDecimal tempCondenserApproaching;
/**
* 冷冻水设定值
*/
private BigDecimal setChillerWater;
/**
* 冷水机需求%
*/
private BigDecimal setLoad;
/**
* 总电流%
*/
private BigDecimal currentTotal;
/**
* 总输入功率kw
*/
private BigDecimal inputPowerTotal;
/**
* 压缩比1
*/
private BigDecimal ratioCompOne;
/**
* 压缩比1
*/
private BigDecimal ratioCompTwo;
/**
* 压缩比1
*/
private BigDecimal ratioCompThree;
/**
* 膨胀阀开度%
*/
private BigDecimal openExv;
/**
* 运行中的压缩机数量
*/
private Integer runCompNum;
/**
* 冷冻水泵频率hz
*/
private BigDecimal frequencyChiller;
/**
* 冷冻水出水压力kpa
*/
private BigDecimal pressOutChillerWater;
/**
* 冷冻水进水压力kpa
*/
private BigDecimal pressInChillerWater;
/**
* 冷却水泵频率hz
*/
private BigDecimal frequencyCooling;
/**
* 冷却水出水压力kpa
*/
private BigDecimal pressOutCoolingWater;
/**
* 冷却水进水压力kpa
*/
private BigDecimal pressInCoolingWater;
/**
* 冷却塔水泵频率hz
*/
private BigDecimal frequencyCoolingTower;
/**
* 冷却塔运行数量原注释可能有误根据列名调整
*/
private Integer runCoolingTower;
/**
* 恒压补水罐压力
*/
private BigDecimal pressConstantWaterTank;
/**
* 室外温度
*/
private BigDecimal tempOutdoor;
/**
* 室外湿度%
*/
private BigDecimal humidityOutdoor;
/**
* 巡查记录人
*/
private String recorder;
/**
* 备注
*/
private String remark;
@JsonIgnore
@TableField(exist = false)
private String searchValue;
/**
* 请求参数
*/
@TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
/** 创建者 */
@TableField(exist = false)
private String createBy;
/** 创建时间 */
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
@TableField(exist = false)
private String updateBy;
/** 更新时间 */
@TableField(exist = false)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 更新者 */
@TableField(exist = false)
private int pageNum;
/** 更新者 */
@TableField(exist = false)
private int pageSize;
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("deviceNum", deviceNum)
.append("curDate", curDate)
.append("curTime", curTime)
.append("tempInChillerWater", tempInChillerWater)
.append("tempOutChillerWater", tempOutChillerWater)
.append("designFlow", designFlow)
.append("pressEvapSaturation", pressEvapSaturation)
.append("tempEvapSaturation", tempEvapSaturation)
.append("tempEvapApproaching", tempEvapApproaching)
.append("tempInCoolingWater", tempInCoolingWater)
.append("tempOutCoolingWater", tempOutCoolingWater)
.append("pressCondenserSaturation", pressCondenserSaturation)
.append("tempCondenserSaturation", tempCondenserSaturation)
.append("tempCondenserApproaching", tempCondenserApproaching)
.append("setChillerWater", setChillerWater)
.append("setLoad", setLoad)
.append("currentTotal", currentTotal)
.append("inputPowerTotal", inputPowerTotal)
.append("ratioCompOne", ratioCompOne)
.append("ratioCompTwo", ratioCompTwo)
.append("ratioCompThree", ratioCompThree)
.append("openExv", openExv)
.append("runCompNum", runCompNum)
.append("frequencyChiller", frequencyChiller)
.append("pressOutChillerWater", pressOutChillerWater)
.append("pressInChillerWater", pressInChillerWater)
.append("frequencyCooling", frequencyCooling)
.append("pressOutCoolingWater", pressOutCoolingWater)
.append("pressInCoolingWater", pressInCoolingWater)
.append("frequencyCoolingTower", frequencyCoolingTower)
.append("runCoolingTower", runCoolingTower)
.append("pressConstantWaterTank", pressConstantWaterTank)
.append("tempOutdoor", tempOutdoor)
.append("humidityOutdoor", humidityOutdoor)
.append("recorder", recorder)
.append("remark", remark)
.append("searchValue", searchValue)
.append("params", params)
.append("createBy", createBy)
.append("createTime", createTime)
.append("updateBy", updateBy)
.append("updateTime", updateTime)
.toString();
}
}

2
mh-common/src/main/java/com/mh/common/core/domain/entity/SysRole.java

@ -91,7 +91,7 @@ public class SysRole extends BaseEntity
public static boolean isAdmin(Long roleId)
{
return roleId != null && 1L == roleId;
return roleId != null && (1L == roleId || 10005L == roleId);
}
@NotBlank(message = "角色名称不能为空")

2
mh-common/src/main/java/com/mh/common/core/domain/entity/SysUser.java

@ -121,7 +121,7 @@ public class SysUser extends BaseEntity
public static boolean isAdmin(Long userId)
{
return userId != null && 1L == userId;
return userId != null && (1L == userId || 10005L == userId);
}
public Long getDeptId()

53
mh-common/src/main/java/com/mh/common/core/domain/vo/CollectionParamsManageDataVO.java

@ -0,0 +1,53 @@
package com.mh.common.core.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 辅助计算类
* @date 2026-01-28 14:27:20
*/
@Data
public class CollectionParamsManageDataVO {
// getter方法
private String deviceName;
private String mtNum;
private Integer orderNum;
private String systemType;
private String deviceType;
private String otherName;
private String paramType;
private BigDecimal curValue;
private Date curTime;
private Integer grade;
private Integer status;
// 构造函数
public CollectionParamsManageDataVO(Map<String, Object> map) {
this.deviceName = (String) map.get("device_name");
this.mtNum = (String) map.get("mt_num");
this.orderNum = map.get("order_num") instanceof Integer ?
(Integer) map.get("order_num") :
(map.get("order_num") != null ? Integer.valueOf(map.get("order_num").toString()) : null);
this.systemType = (String) map.get("system_type");
this.deviceType = (String) map.get("device_type");
this.otherName = (String) map.get("other_name");
this.paramType = (String) map.get("param_type");
this.curValue = map.get("cur_value") instanceof BigDecimal ?
(BigDecimal) map.get("cur_value") :
(map.get("cur_value") != null ? new BigDecimal(map.get("cur_value").toString()) : BigDecimal.ZERO);
this.curTime = (Date) map.get("cur_time");
this.grade = map.get("grade") instanceof Integer ?
(Integer) map.get("grade") :
(map.get("grade") != null ? Integer.valueOf(map.get("grade").toString()) : null);
this.status = (Integer) map.get("status");
}
}

5
mh-common/src/main/java/com/mh/common/core/domain/vo/CollectionParamsManageVO.java

@ -46,6 +46,11 @@ public class CollectionParamsManageVO {
private int mtRatio;
/**
* 通信质量
*/
private String quality;
public BigDecimal getCurValue() {
return curValue;
}

5
mh-common/src/main/java/com/mh/common/core/domain/vo/DeviceMonitorVO.java

@ -62,6 +62,11 @@ public class DeviceMonitorVO {
private int orderNum;
/**
* 采集值质量
*/
private String quality;
@Override
public String toString() {
return new ToStringBuilder(this)

14
mh-common/src/main/java/com/mh/common/core/domain/vo/EnergyConsumptionVO.java

@ -45,6 +45,20 @@ public class EnergyConsumptionVO implements Serializable {
*/
private String systemType;
/**
* 房间id
* @return
*/
private String houseId;
public String getHouseId() {
return houseId;
}
public void setHouseId(String houseId) {
this.houseId = houseId;
}
public String getSystemType() {
return systemType;
}

4
mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlVO.java

@ -115,6 +115,10 @@ public class HotWaterControlVO {
private int emergencyStopStatus;
private String emergencyStopStatusId;
// 最低设置值 44
private int minSet;
private String minSetId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date curTime;

55
mh-common/src/main/java/com/mh/common/enums/ComputeEnum.java

@ -11,6 +11,34 @@ import java.util.*;
*/
public enum ComputeEnum implements ComputeService {
/**
* 水表
*/
WATER("水表设备数据处理", 23) {
@Override
public ArrayList<Map<LocalDateTime, DeviceReport>> getDataList(
Map.Entry<String, Map<LocalDateTime, List<DeviceReport>>> entry) {
ArrayList<Map<LocalDateTime, DeviceReport>> result = new ArrayList<>();
//获取到电表的数据,按照表号分组分组,紧接着再按照小时分组。需要计算分组后的数据取出最大值
Map<LocalDateTime, List<DeviceReport>> deviceMap = entry.getValue();
String deviceNum = entry.getKey();
Set<Map.Entry<LocalDateTime, List<DeviceReport>>> groupEntryList = deviceMap.entrySet();
for (Map.Entry<LocalDateTime, List<DeviceReport>> listEntry : groupEntryList) {
LocalDateTime key = listEntry.getKey();
List<DeviceReport> value = listEntry.getValue();
DeviceReport maxEntity = value.stream()
.max(Comparator.comparing(obj -> Double.valueOf(obj.getCurValue())))
.orElse(null);
HashMap<LocalDateTime, DeviceReport> map = new HashMap<>();
map.put(key, maxEntity);
result.add(map);
}
return result;
}
},
/**
* 电表
*/
@ -75,6 +103,33 @@ public enum ComputeEnum implements ComputeService {
Map.Entry<String, Map<LocalDateTime, List<DeviceReport>>> entry) {
return null;
}
},
/**
* 蒸汽流量计数据处理
*/
STEAM_FLOW("蒸汽流量计数据处理", 12) {
@Override
public ArrayList<Map<LocalDateTime, DeviceReport>> getDataList(
Map.Entry<String, Map<LocalDateTime, List<DeviceReport>>> entry) {
ArrayList<Map<LocalDateTime, DeviceReport>> result = new ArrayList<>();
//获取到电表的数据,按照表号分组分组,紧接着再按照小时分组。需要计算分组后的数据取出最大值
Map<LocalDateTime, List<DeviceReport>> deviceMap = entry.getValue();
String deviceNum = entry.getKey();
Set<Map.Entry<LocalDateTime, List<DeviceReport>>> groupEntryList = deviceMap.entrySet();
for (Map.Entry<LocalDateTime, List<DeviceReport>> listEntry : groupEntryList) {
LocalDateTime key = listEntry.getKey();
List<DeviceReport> value = listEntry.getValue();
DeviceReport maxEntity = value.stream()
.max(Comparator.comparing(obj -> Double.valueOf(obj.getCurValue())))
.orElse(null);
HashMap<LocalDateTime, DeviceReport> map = new HashMap<>();
map.put(key, maxEntity);
result.add(map);
}
return result;
}
};
private String des;

7
mh-common/src/main/java/com/mh/common/model/request/AdvantechDatas.java

@ -27,4 +27,11 @@ public class AdvantechDatas<T extends Number> {
*/
private T quality;
public AdvantechDatas() {}
public AdvantechDatas(String tag, T value) {
this.tag = tag;
this.value = value;
}
}

74
mh-common/src/main/java/com/mh/common/model/request/AdvantechJsonParser.java

@ -0,0 +1,74 @@
package com.mh.common.model.request;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 昆仑通态触摸屏数据转换
* @date 2026-02-02 15:29:47
*/
public class AdvantechJsonParser {
/**
* 将JSON字符串解析为 AdvantechReceiver<AdvantechDatas<Number>>
* @param json 原始MQTT JSON
* @param defaultQuality quality默认值如192表示Good传null则不设置
* @return 解析后的接收对象
*/
public static AdvantechReceiver<AdvantechDatas<Number>> parse(
String json,
Number defaultQuality) {
JSONObject root = JSON.parseObject(json);
AdvantechReceiver<AdvantechDatas<Number>> receiver = new AdvantechReceiver<>();
// 1. 提取ts(保留原始字符串格式)
// "2026-02-02T18:33:57.712049"时间格式是这个,转成yyyy-MM-dd HH:mm:ss
root.put("ts", root.getString("ts").replace("T", " ").substring(0, 19));
receiver.setTs(root.getString("ts"));
// 2. 解析d数组:展开所有键值对 → AdvantechDatas
List<AdvantechDatas<Number>> dataList = new ArrayList<>();
JSONArray dArray = root.getJSONArray("d");
if (dArray != null) {
for (int i = 0; i < dArray.size(); i++) {
JSONObject item = dArray.getJSONObject(i);
if (item == null || item.isEmpty()) continue;
for (Map.Entry<String, Object> entry : item.entrySet()) {
String tag = entry.getKey();
Object val = entry.getValue();
if (val instanceof Number) {
AdvantechDatas<Number> data = new AdvantechDatas<>();
data.setTag(tag);
data.setValue((Number) val);
if (defaultQuality != null) {
data.setQuality(defaultQuality);
}
dataList.add(data);
}
// 非数值字段自动跳过(可扩展日志)
}
}
}
receiver.setD(dataList);
return receiver;
}
// 便捷重载:不设置quality
public static AdvantechReceiver<AdvantechDatas<Number>> parse(String json) {
return parse(json, 0);
}
}

11
mh-common/src/main/java/com/mh/common/utils/BigDecimalUtils.java

@ -42,4 +42,15 @@ public class BigDecimalUtils {
}
return predicate.test(a, b);
}
public static void main(String[] args) {
BigDecimal a = new BigDecimal("10.00");
BigDecimal b = new BigDecimal("10.00");
System.out.println(compare(">", a, b));
System.out.println(compare(">=", a, b));
System.out.println(compare("<", a, b));
System.out.println(compare("<=", a, b));
System.out.println(compare("==", a, b));
System.out.println(compare("!=", a, b));
}
}

11
mh-common/src/main/java/com/mh/common/utils/DateUtils.java

@ -39,6 +39,17 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
/**
* 判断日期是否为今天
*/
public static boolean isToday(Date date) {
if (date == null) return false;
LocalDate localDate = date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
return localDate.equals(LocalDate.now());
}
public static String localDateToStr(LocalDateTime timeType) {
return timeType.format(DATE_TIME_FORMATTER);
}

6
mh-common/src/main/java/com/mh/common/utils/SecurityUtils.java

@ -102,7 +102,7 @@ public class SecurityUtils {
* @return 结果
*/
public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId;
return userId != null && (1L == userId ||10005L == userId);
}
/**
@ -148,7 +148,9 @@ public class SecurityUtils {
*/
public static boolean hasRole(Collection<String> roles, String role) {
return roles.stream().filter(StringUtils::hasText)
.anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role));
.anyMatch(x -> Constants.SUPER_ADMIN.equals(x)
|| Constants.SUPER_ADMIN_TWO.equals(x)
|| PatternMatchUtils.simpleMatch(x, role));
}
}

24
mh-common/src/main/java/com/mh/common/utils/WeatherUtil.java

@ -2,6 +2,9 @@ package com.mh.common.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* @author LJF
@ -16,6 +19,27 @@ public class WeatherUtil {
private static final double A = 17.27;
private static final double B = 237.7;
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
/**
* 根据日期字符串yyyy-MM-dd获取星期几中文
*/
public static String getWeek(String dateStr) {
LocalDate date = LocalDate.parse(dateStr, DATE_FORMATTER);
DayOfWeek dayOfWeek = date.getDayOfWeek();
switch (dayOfWeek) {
case MONDAY: return "星期一";
case TUESDAY: return "星期二";
case WEDNESDAY: return "星期三";
case THURSDAY: return "星期四";
case FRIDAY: return "星期五";
case SATURDAY: return "星期六";
case SUNDAY: return "星期日";
default: return "未知";
}
}
public double E(double t) {
// 饱和水汽压:E(t)=611.2exp(17.67t/(243.5+t))
return 611.2 * Math.exp(17.67 * t / (243.5 + t));

81
mh-common/src/main/java/com/mh/common/utils/file/handle/ExcelFillCellMergeHandler.java

@ -0,0 +1,81 @@
package com.mh.common.utils.file.handle;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 列合并
* @date 2024-06-03 10:01:07
*/
public class ExcelFillCellMergeHandler implements CellWriteHandler {
private static final String KEY ="%s-%s";
//所有的合并信息都存在了这个map里面
Map<String, Integer> mergeInfo = new HashMap<>();
public ExcelFillCellMergeHandler() {
}
public ExcelFillCellMergeHandler(Map<String, Integer> mergeInfo) {
this.mergeInfo = mergeInfo;
}
@Override
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) {
}
@Override
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
@Override
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, WriteCellData<?> cellData, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
}
@Override
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
//当前行
int curRowIndex = cell.getRowIndex();
//当前列
int curColIndex = cell.getColumnIndex();
Integer num = mergeInfo.get(String.format(KEY, curRowIndex, curColIndex));
if(null != num){
// 合并最后一行 ,列
mergeWithPrevCol(writeSheetHolder, cell, curRowIndex, curColIndex,num);
}
}
public void mergeWithPrevCol(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex, int num) {
Sheet sheet = writeSheetHolder.getSheet();
CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex, curRowIndex, curColIndex, curColIndex + num);
sheet.addMergedRegion(cellRangeAddress);
}
//num从第几列开始增加多少列
// curRowIndex 在第几行进行行合并
// curColIndex 在第几列进行合并
// num 合并多少格
// 比如我上图中中心需要在第三行 从0列开始合并三列 所以我可以传入 (3,0,2)
public void add (int curRowIndex, int curColIndex , int num){
mergeInfo.put(String.format(KEY, curRowIndex, curColIndex),num);
}
}

49
mh-common/src/main/java/com/mh/common/utils/file/handle/ReportDayAndMonthParamHandler.java

@ -0,0 +1,49 @@
package com.mh.common.utils.file.handle;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.util.PropertyPlaceholderHelper;
import java.util.List;
import java.util.Properties;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 报表handle
* @date 2024-05-31 17:36:38
*/
public class ReportDayAndMonthParamHandler implements CellWriteHandler {
private final String title;
private final String value;
PropertyPlaceholderHelper placeholderHelper = new PropertyPlaceholderHelper("${", "}");
public ReportDayAndMonthParamHandler(String value, String title) {
this.title = title;
this.value = value;
}
@Override
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) {
if (head != null) {
List<String> headNameList = head.getHeadNameList();
if (CollectionUtils.isNotEmpty(headNameList)) {
Properties properties = new Properties();
properties.setProperty(title, value);
for (int i = 0; i < headNameList.size(); i++) {
headNameList.set(i, placeholderHelper.replacePlaceholders(headNameList.get(i), properties));
}
}
}
}
}

46
mh-common/src/main/java/com/mh/common/utils/file/handle/ReportSysParamHandler.java

@ -0,0 +1,46 @@
package com.mh.common.utils.file.handle;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.util.PropertyPlaceholderHelper;
import java.util.List;
import java.util.Properties;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 报表handle
* @date 2024-05-31 17:36:38
*/
public class ReportSysParamHandler implements CellWriteHandler {
private final String title;
PropertyPlaceholderHelper placeholderHelper = new PropertyPlaceholderHelper("${", "}");
public ReportSysParamHandler(String title) {
this.title = title;
}
@Override
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) {
if (head != null) {
List<String> headNameList = head.getHeadNameList();
if (CollectionUtils.isNotEmpty(headNameList)) {
Properties properties = new Properties();
properties.setProperty("deviceType", title);
for (int i = 0; i < headNameList.size(); i++) {
headNameList.set(i, placeholderHelper.replacePlaceholders(headNameList.get(i), properties));
}
}
}
}
}

25
mh-common/src/main/java/com/mh/common/utils/file/handle/RowHeightStyleHandler.java

@ -0,0 +1,25 @@
package com.mh.common.utils.file.handle;
import com.alibaba.excel.write.style.row.AbstractRowHeightStyleStrategy;
import org.apache.poi.ss.usermodel.Row;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 处理行高
* @date 2024-08-09 15:03:37
*/
public class RowHeightStyleHandler extends AbstractRowHeightStyleStrategy {
@Override
protected void setHeadColumnHeight(Row row, int i) {
if (i == 2) {
row.setHeightInPoints(70);
}
}
@Override
protected void setContentColumnHeight(Row row, int i) {
}
}

7
mh-framework/pom.xml

@ -64,6 +64,13 @@
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.4.8-jre</version>
</dependency>
</dependencies>
</project>

2
mh-framework/src/main/java/com/mh/framework/aspectj/ControlDeviceAspect.java

@ -96,6 +96,8 @@ public class ControlDeviceAspect {
} else if (null != orderEntity.getType() && orderEntity.getType() == 3) {
// 修改手动获取全自动
deviceControlLog.setControlContent(orderEntity.getParam().equals("0")?"关闭全自动":"开启全自动");
} else {
deviceControlLog.setControlContent(orderEntity.toString());
}
deviceControlLog.setCreateUser(SecurityUtils.getUsername());
deviceControlLog.setCreateTime(new Date());

10
mh-framework/src/main/java/com/mh/framework/dealdata/DataProcessService.java

@ -37,7 +37,7 @@ public interface DataProcessService {
* @param deviceNum
* @return
*/
String queryInitValue(String deviceNum);
String queryInitValue(String deviceNum, String mtCode, String registerAddr);
/**
* 查询上一次采集数据时间等参数
@ -113,4 +113,12 @@ public interface DataProcessService {
* @param oneTwoThreeTempData
*/
void insertTempData(OneTwoThreeTempData oneTwoThreeTempData);
/**
* 插入锅炉数据
* @param boilerData
*/
void insertBoilerData(AdvantechReceiver boilerData);
void insertERSData(AdvantechReceiver boilerData);
}

113
mh-framework/src/main/java/com/mh/framework/dealdata/impl/DataProcessServiceImpl.java

@ -59,7 +59,7 @@ public class DataProcessServiceImpl implements DataProcessService {
}
private void insertTempDataToDb(OneTwoThreeTempData data, String registerKey, String cacheKey) {
// log.info("{}数据解析入库:{}", registerKey.equals("SENSOR_REGISTER") ? "温湿度传感器" : "其他设备", data);
log.info("{}数据解析入库:{}", registerKey.equals("SENSOR_REGISTER") ? "温湿度传感器" : "其他设备", data);
if (registerKey.equals("SENSOR_REGISTER")) {
databaseMapper.createChillerTable();
} else {
@ -108,6 +108,7 @@ public class DataProcessServiceImpl implements DataProcessService {
continue;
}
collectionParamsManage.setCurTime(curTime);
collectionParamsManage.setQuality("0");
entities.add(collectionParamsManage);
}
}
@ -131,8 +132,18 @@ public class DataProcessServiceImpl implements DataProcessService {
insertData(data, "DEVICES_REGISTER", Constants.DEVICE);
}
@Override
public void insertBoilerData(AdvantechReceiver data) {
insertData(data, "BOILER_REGISTER", Constants.BOILER);
}
@Override
public void insertERSData(AdvantechReceiver data) {
insertData(data, "ERS_REGISTER", Constants.DEVICE);
}
private void insertData(AdvantechReceiver data, String registerKey, String cacheKey) {
// log.info("{}数据解析入库:{}", registerKey.equals("CHILLERS_REGISTER") ? "冷水机组" : "计量设备", data);
// log.info("{}数据解析入库:{}", registerKey.equals("CHILLERS_REGISTER") ? "机组设备" : "计量设备", data);
if (registerKey.equals("CHILLERS_REGISTER")) {
databaseMapper.createChillerTable();
} else {
@ -144,6 +155,8 @@ public class DataProcessServiceImpl implements DataProcessService {
if (null == registers || registers.isEmpty()) {
if (registerKey.equals("CHILLERS_REGISTER")) {
registers = collectionParamsManageService.queryCollectionParamsByMtType(Constants.CHILLERS_TYPE);
} else if (cacheKey.equals(Constants.BOILER) && registerKey.equals("BOILER_REGISTER") ) {
registers = collectionParamsManageService.queryCollectionParamsByMtType(Constants.BOILER_TYPE);
} else {
registers = collectionParamsManageService.queryCollectionParamsByMtType(Constants.OTHER_TYPE);
}
@ -151,42 +164,67 @@ public class DataProcessServiceImpl implements DataProcessService {
}
String timeString = data.getTs();
OffsetDateTime utcDateTime;
try {
// 尝试多种常见的时间格式
String formattedTime = "";
// 判断是否存在TimeZone
if (!timeString.contains("T")) {
formattedTime = timeString;
} else {
OffsetDateTime utcDateTime;
try {
utcDateTime = OffsetDateTime.parse(timeString, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (DateTimeParseException e1) {
// 尝试多种常见的时间格式
try {
utcDateTime = OffsetDateTime.parse(timeString, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[XXX][XX][X]"));
} catch (DateTimeParseException e2) {
utcDateTime = OffsetDateTime.parse(timeString, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS[XXX][XX][X]"));
utcDateTime = OffsetDateTime.parse(timeString, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
} catch (DateTimeParseException e1) {
try {
utcDateTime = OffsetDateTime.parse(timeString, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[XXX][XX][X]"));
} catch (DateTimeParseException e2) {
utcDateTime = OffsetDateTime.parse(timeString, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS[XXX][XX][X]"));
}
}
} catch (DateTimeParseException e) {
log.error("时间格式解析异常,时间字符串: {}", timeString, e);
return;
}
} catch (DateTimeParseException e) {
log.error("时间格式解析异常,时间字符串: {}", timeString, e);
return;
// 2. 转换为中国时区(UTC+8)
OffsetDateTime chinaDateTime = utcDateTime.withOffsetSameInstant(
ZoneOffset.ofHours(8)
);
// 3. 格式化为目标字符串
formattedTime = chinaDateTime.format(
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
);
}
// 2. 转换为中国时区(UTC+8)
OffsetDateTime chinaDateTime = utcDateTime.withOffsetSameInstant(
ZoneOffset.ofHours(8)
);
// 3. 格式化为目标字符串
String formattedTime = chinaDateTime.format(
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
);
String dString = data.getD().toString();
// 替换掉inf
if (dString.contains("inf")) {
dString = dString.replace("inf", "0");
List<AdvantechDatas> list;
Object dObject = data.getD();
if (dObject instanceof List) {
// 如果已经是List类型,直接转换
@SuppressWarnings("unchecked")
List<AdvantechDatas> tempList = (List<AdvantechDatas>) dObject;
list = tempList;
} else {
// 如果是其他类型(如String),则进行JSON解析
String dString = dObject.toString();
// 替换掉inf
if (dString.contains("inf")) {
dString = dString.replace("inf", "0");
}
try {
list = JSON.parseObject(dString, new TypeReference<List<AdvantechDatas>>() {});
} catch (Exception e) {
log.error("JSON解析失败,原始数据: {}", dString, e);
list = new ArrayList<>();
}
}
// 假设 data 是一个包含 JSON 数据的对象
List<AdvantechDatas> list = JSON.parseObject(dString, new TypeReference<List<AdvantechDatas>>() {});
for (AdvantechDatas advantechDatas : list) {
String tag = advantechDatas.getTag();
String value = String.valueOf(advantechDatas.getValue());
// log.info("时间: {},tag标签: {},value值: {}", formattedTime, tag, value);
String quality = String.valueOf(advantechDatas.getQuality());
// log.info("时间: {},tag标签: {},value值: {}, 质量:{}", formattedTime, tag, value, quality);
try {
if (StringUtils.isBlank(tag)) {
continue;
@ -197,6 +235,7 @@ public class DataProcessServiceImpl implements DataProcessService {
collectionParamsManage = entity;
try {
collectionParamsManage.setCurValue(new BigDecimal(value));
collectionParamsManage.setQuality(quality);
} catch (NumberFormatException e) {
log.error("数值格式解析异常", e);
continue;
@ -212,7 +251,12 @@ public class DataProcessServiceImpl implements DataProcessService {
}
}
redisCache.setCacheList(cacheKey, entities);
if (!entities.isEmpty()) {
redisCache.setCacheList(cacheKey, entities);
}
// redisCache.setCacheList(cacheKey, entities);
threadPoolService.execute(() -> {
if (!entities.isEmpty()) {
@ -227,8 +271,12 @@ public class DataProcessServiceImpl implements DataProcessService {
}
@Override
public String queryInitValue(String deviceNum) {
return dataProcessMapper.queryInitValue(deviceNum);
public String queryInitValue(String deviceNum, String mtCode, String registerAddr) {
if (StringUtils.isEmpty(mtCode)) {
return dataProcessMapper.queryInitValue1(deviceNum);
} else {
return dataProcessMapper.queryInitValue(deviceNum, mtCode, registerAddr);
}
}
@Override
@ -253,7 +301,6 @@ public class DataProcessServiceImpl implements DataProcessService {
entity = dataProcessMapper.queryLastValue(deviceNum, lastTable);
} catch (Exception e) {
log.error("没有当前表:{}", lastTable);
e.printStackTrace();
}
}
return entity;
@ -261,7 +308,7 @@ public class DataProcessServiceImpl implements DataProcessService {
@Override
public void insertDatabase(List<DeviceReport> dataMinList) {
// log.info("插入data_min数据,数据大小==>{}", dataMinList.size());
log.info("插入data_min数据,数据大小==>{}", dataMinList.size());
Calendar calendar = Calendar.getInstance();
//时间格式化0和5结尾的时间
int batchSize = 10;

2
mh-framework/src/main/java/com/mh/framework/mqtt/handler/InboundMessageRouter.java

@ -47,7 +47,7 @@ public class InboundMessageRouter extends AbstractMessageRouter {
// log.info("从当前主题 topic: {}, 接收到的消息:{}", topic, new String(payload));
// 判断当前主题是否是当前项目的,温湿度目前写死的
if (!topic.startsWith(mHConfig.getName()) && !topic.contains("/temp")) {
// log.info("当前主题 topic: {} 不是当前项目的,直接丢弃", topic);
log.info("当前主题 topic: {} 不是当前项目的,直接丢弃", topic);
return Collections.singleton(SpringUtils.getBean(ChannelName.DEFAULT_BOUND));
}
// 找到对应的主题消息通道

8
mh-framework/src/main/java/com/mh/framework/mqtt/service/impl/EventsServiceImpl.java

@ -88,8 +88,14 @@ public class EventsServiceImpl implements IEventsService {
} else if (topic.contains(Constants.TEMP)) {
// 温湿度数据
OneTwoThreeTempData oneTwoThreeTempData = mapper.readValue(receiver, OneTwoThreeTempData.class);
// log.info("主题:{},类型:{}: ,数据:{}", topic, logMessage, oneTwoThreeTempData.toString());
log.info("主题:{},类型:{}: ,数据:{}", topic, logMessage, oneTwoThreeTempData.toString());
sendMsgByTopic.sendToTempMQ(JSONObject.toJSONString(oneTwoThreeTempData));
} else if (topic.contains(Constants.BOILER)) {
// 锅炉系统
sendMsgByTopic.sendToBoilerMQ(JSONObject.toJSONString(commonTopicReceiver));
} else if (topic.contains(Constants.ERS)) {
// 热回收系统:针对昆仑通态触摸屏系统
sendMsgByTopic.sendToKunLunTDMQ(JSONObject.toJSONString(commonTopicReceiver));
} else {
// 非本地主题处理
log.info("非本地主题处理: {}", topic);

58
mh-framework/src/main/java/com/mh/framework/rabbitmq/RabbitMqConfig.java

@ -8,6 +8,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;
/**
* @Author : Rainbow
* @date : 2023/5/26
@ -16,6 +19,12 @@ import org.springframework.context.annotation.Configuration;
public class RabbitMqConfig {
/**交换机*/
public static final String EXCHANGE_NAME = "exchange_eemcs";
/**
* 延迟队列
*/
public static final String DELAY_EXCHANGE_NAME = "device.delayed.exchange";
/**主机队列*/
public static final String QUEUE_CHILLER = "queue_chiller";
/**主机routing-key*/
@ -34,6 +43,32 @@ public class RabbitMqConfig {
/**温湿度 routing-key*/
public static final String ROUTING_KEY_TEMP = "topic.temp.eemcs.#";
/**
* 报警队列
*/
public static final String QUEUE_ALARM = "device.alarm.queue";
public static final String ROUTING_KEY_ALARM = "topic.alarm.eemcs.#";
public static final String QUEUE_BOILER = "queue_boiler";
public static final String ROUTING_KEY_BOILER = "topic.boiler.eemcs.#";
// ERS队列:广合二厂热回收系统昆仑通态触摸屏
public static final String QUEUE_ERS = "queue_ers";
public static final String ROUTING_KEY_ERS = "topic.ers.eemcs.#";
/**热回收系统昆仑通态队列绑定交换机*/
@Bean(ROUTING_KEY_ERS)
public Binding ersBinding(@Qualifier(QUEUE_ERS) Queue queue,
@Qualifier(EXCHANGE_NAME) Exchange exchange){
return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY_ERS).noargs();
}
/**热回收系统昆仑通态触摸屏队列*/
@Bean(QUEUE_ERS)
public Queue ersQueue(){
return new Queue(QUEUE_ERS);
}
/**durable参数表示交换机是否持久化值为true表示持久化值为false表示不持久化
* 在RabbitMQ中持久化交换机会被存储在磁盘上以便在服务器重启后恢复
@ -120,4 +155,27 @@ public class RabbitMqConfig {
return factory;
}
// 延迟交换机(使用自定义类型x-delayed-message)
@Bean
public CustomExchange delayedExchange() {
Map<String, Object> args = new HashMap<>();
args.put("x-delayed-type", "direct"); // 底层转发类型
return new CustomExchange(DELAY_EXCHANGE_NAME, "x-delayed-message", true, false, args);
}
// 报警队列
@Bean
public Queue alarmQueue() {
return new Queue(QUEUE_ALARM, true);
}
// 绑定延迟交换机与队列
@Bean
public Binding binding(Queue alarmQueue, CustomExchange delayedExchange) {
return BindingBuilder.bind(alarmQueue)
.to(delayedExchange)
.with(ROUTING_KEY_ALARM)
.noargs();
}
}

120
mh-framework/src/main/java/com/mh/framework/rabbitmq/consumer/ReceiveHandler.java

@ -1,14 +1,15 @@
package com.mh.framework.rabbitmq.consumer;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.mh.common.core.redis.RedisCache;
import com.mh.common.model.request.AdvantechJsonParser;
import com.mh.common.model.request.AdvantechReceiver;
import com.mh.common.model.request.OneTwoThreeTempData;
import com.mh.framework.dealdata.DataProcessService;
import com.mh.framework.rabbitmq.RabbitMqConfig;
import com.mh.system.service.operation.IAlarmRecordsService;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
@ -33,6 +34,45 @@ public class ReceiveHandler {
@Autowired
DataProcessService dataProcessService;
@Autowired
IAlarmRecordsService alarmRecordsService;
@Autowired
private RedisCache redisTemplate;
private static final String ALARM_CANCEL_PREFIX = "alarm:cancel:";
/**
* 处理热回收系统昆仑通态触摸屏数据相关设备数据
*
* @param msg
* @param channel
* @param tag
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = RabbitMqConfig.QUEUE_ERS, durable = "true"),
exchange = @Exchange(
value = RabbitMqConfig.EXCHANGE_NAME,
ignoreDeclarationExceptions = "true",
type = ExchangeTypes.TOPIC
),
key = {RabbitMqConfig.ROUTING_KEY_ERS}
))
public void receiveERSData(@Payload String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws InterruptedException, IOException {
try {
//log.info("MQ消费者:热回收系统设备采集:{}", msg);
//TODO 数据解析入库操作 msg转成实体类,入库
AdvantechReceiver boilerData = AdvantechJsonParser.parse(msg);
dataProcessService.insertERSData(boilerData);
// 正常执行,手动确认ack
channel.basicAck(tag, false);
} catch (Exception e) {
log.error("data:{},ddcException:{}", msg, e);
Thread.sleep(100);
channel.basicAck(tag, false);
}
}
/**
* 监听主机参数
* queues指定监听的队列名可以接收单个队列也可以接收多个队列的数组或列表
@ -56,7 +96,7 @@ public class ReceiveHandler {
try {
//TODO 开启多线程处理主机数据,如果不通过线程池开启线程来处理,
// 设置SimpleRabbitListenerContainerFactory中的setConcurrentConsumers(10)数量也可以实现多线程处理
// log.info("MQ消费者:主机数据采集:{}", msg);
log.info("MQ消费者:主机数据采集:{}", msg);
//TODO 数据解析入库操作 msg转成实体类,入库
AdvantechReceiver chillerData = JSONObject.parseObject(msg, AdvantechReceiver.class);
dataProcessService.insertChillerData(chillerData);
@ -89,7 +129,7 @@ public class ReceiveHandler {
public void receiveDeviceData(@Payload String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws InterruptedException, IOException {
try {
//TODO 处理电表等数据
// log.info("MQ消费者:计量设备数据采集:{}", msg);
log.info("MQ消费者:计量设备数据采集:{}", msg);
//TODO 数据解析入库操作 msg转成实体类,入库
AdvantechReceiver deviceData = JSONObject.parseObject(msg, AdvantechReceiver.class);
dataProcessService.insertDeviceData(deviceData);
@ -121,7 +161,7 @@ public class ReceiveHandler {
))
public void receiveOtherData(@Payload String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws InterruptedException, IOException {
try {
// log.info("MQ消费者:其他设备采集:{}", msg);
log.info("MQ消费者:其他设备采集:{}", msg);
//TODO 数据解析入库操作 msg转成实体类,入库
AdvantechReceiver OtherData = JSONObject.parseObject(msg, AdvantechReceiver.class);
dataProcessService.insertOtherData(OtherData);
@ -152,7 +192,7 @@ public class ReceiveHandler {
))
public void receiveTempData(@Payload String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws InterruptedException, IOException {
try {
// log.info("MQ消费者:温湿度设备采集:{}", msg);
log.info("MQ消费者:温湿度设备采集:{}", msg);
//TODO 数据解析入库操作 msg转成实体类,入库
OneTwoThreeTempData oneTwoThreeTempData = JSONObject.parseObject(msg, OneTwoThreeTempData.class);
dataProcessService.insertTempData(oneTwoThreeTempData);
@ -165,4 +205,72 @@ public class ReceiveHandler {
}
}
/**
* 处理锅炉系统相关设备数据
*
* @param msg
* @param channel
* @param tag
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = RabbitMqConfig.QUEUE_BOILER, durable = "true"),
exchange = @Exchange(
value = RabbitMqConfig.EXCHANGE_NAME,
ignoreDeclarationExceptions = "true",
type = ExchangeTypes.TOPIC
),
key = {RabbitMqConfig.ROUTING_KEY_BOILER}
))
public void receiveBoilerData(@Payload String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws InterruptedException, IOException {
try {
log.info("MQ消费者:锅炉系统设备采集:{}", msg);
//TODO 数据解析入库操作 msg转成实体类,入库
AdvantechReceiver boilerData = JSONObject.parseObject(msg, AdvantechReceiver.class);
dataProcessService.insertBoilerData(boilerData);
// 正常执行,手动确认ack
channel.basicAck(tag, false);
} catch (Exception e) {
log.error("data:{},ddcException:{}", msg, e);
Thread.sleep(100);
channel.basicAck(tag, false);
}
}
/**
* 处理设备报警延时队列数据
*
* @param msg
* @param channel
* @param tag
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = RabbitMqConfig.QUEUE_ALARM, durable = "true"),
exchange = @Exchange(
value = RabbitMqConfig.DELAY_EXCHANGE_NAME,
ignoreDeclarationExceptions = "true",
type = ExchangeTypes.TOPIC
),
key = {RabbitMqConfig.ROUTING_KEY_ALARM}
))
public void handleAlarm(@Payload String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws InterruptedException, IOException {
try {
String deviceId = msg.split(":")[1];
String cancelKey = ALARM_CANCEL_PREFIX + deviceId;
// // 检查Redis中是否存在取消标记
// if (Boolean.TRUE.equals(redisTemplate.hasKey(cancelKey))) {
// redisTemplate.deleteObject(cancelKey);
// System.out.println("报警已取消: " + deviceId);
// return;
// }
// 执行生成报警数据
alarmRecordsService.insertOrUpdateAlarmRecord(deviceId);
// 正常执行,手动确认ack
channel.basicAck(tag, false);
} catch (Exception e) {
log.error("data:{},ddcException:{}", msg, e);
Thread.sleep(100);
channel.basicAck(tag, false);
}
}
}

33
mh-framework/src/main/java/com/mh/framework/rabbitmq/producer/SendMsgByTopic.java

@ -3,6 +3,8 @@ package com.mh.framework.rabbitmq.producer;
import com.mh.common.model.request.AdvantechReceiver;
import com.mh.framework.rabbitmq.RabbitMqConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -40,4 +42,35 @@ public class SendMsgByTopic {
rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME,"topic.temp.eemcs.data",data);
return "success";
}
/**延迟队列注入rabbitmq*/
public void sendDelayedAlarm(String deviceId, int delayMinutes) {
String message = "ALARM:" + deviceId;
MessageProperties props = new MessageProperties();
props.setHeader("x-delay", delayMinutes * 60 * 1000); // 延迟毫秒
Message msg = new Message(message.getBytes(), props);
rabbitTemplate.send(RabbitMqConfig.DELAY_EXCHANGE_NAME, RabbitMqConfig.ROUTING_KEY_ALARM, msg);
}
/**
* 锅炉数据报文注入rabbitmq
* @param data
* @return
*/
public String sendToBoilerMQ(String data) {
rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME,"topic.boiler.eemcs.data",data);
return "success";
}
/**
* 昆仑通态触摸屏数据报文注入rabbitmq
* @param data
* @return
*/
public String sendToKunLunTDMQ(String data) {
rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME,"topic.ers.eemcs.data",data);
return "success";
}
}

4
mh-framework/src/main/java/com/mh/framework/web/service/PermissionService.java

@ -86,7 +86,9 @@ public class PermissionService {
}
for (SysRole sysRole : loginUser.getUser().getRoles()) {
String roleKey = sysRole.getRoleKey();
if (Constants.SUPER_ADMIN.equals(roleKey) || roleKey.equals(StringUtils.trim(role))) {
if (Constants.SUPER_ADMIN.equals(roleKey)
|| Constants.SUPER_ADMIN_TWO.equals(roleKey)
|| roleKey.equals(StringUtils.trim(role))) {
return true;
}
}

11
mh-quartz/src/main/java/com/mh/quartz/domain/FuzzyLevel.java

@ -0,0 +1,11 @@
package com.mh.quartz.domain;
/**
* @Classname FuzzyLevel
* Todo:
* @Date 2025-05-31 14:19
* @Created by LJF
*/
public enum FuzzyLevel {
NB, NM, NS, ZO, PS, PM, PB; // 极小,较小,小,零,稍大,较大,极大
}

52
mh-quartz/src/main/java/com/mh/quartz/domain/PIDParams.java

@ -0,0 +1,52 @@
package com.mh.quartz.domain;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description PID参数
* @date 2025-05-30 13:51:22
*/
public class PIDParams {
private volatile double kp; // 比例系数
private volatile double ki; // 积分系数
private volatile double kd; // 微分系数
public PIDParams(double kp, double ki, double kd) {
this.kp = kp;
this.ki = ki;
this.kd = kd;
}
// 动态更新PID参数
public void updateParams(double kp, double ki, double kd) {
this.kp = kp;
this.ki = ki;
this.kd = kd;
}
public double getKp() {
return kp;
}
public void setKp(double kp) {
this.kp = kp;
}
public double getKi() {
return ki;
}
public void setKi(double ki) {
this.ki = ki;
}
public double getKd() {
return kd;
}
public void setKd(double kd) {
this.kd = kd;
}
}

387
mh-quartz/src/main/java/com/mh/quartz/task/AHUTask.java

@ -0,0 +1,387 @@
package com.mh.quartz.task;
import com.mh.common.config.MHConfig;
import com.mh.common.core.domain.entity.CollectionParamsManage;
import com.mh.common.core.domain.entity.CpmSpaceRelation;
import com.mh.common.core.domain.entity.OrderEntity;
import com.mh.common.core.domain.entity.PolicyManage;
import com.mh.common.utils.DateUtils;
import com.mh.framework.mqtt.service.IMqttGatewayService;
import com.mh.quartz.util.AHUPIDControlUtil;
import com.mh.quartz.util.FuzzyPIDControlUtil;
import com.mh.system.service.device.ICollectionParamsManageService;
import com.mh.system.service.operation.IOperationDeviceService;
import com.mh.system.service.policy.IPolicyManageService;
import com.mh.system.service.space.ICpmSpaceRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 风柜系统任务
* @date 2025-05-30 08:36:43
*/
@Slf4j
@Component("ahuTask")
public class AHUTask {
@Value("${control.topic}")
String controlTopic;
@Autowired
private MHConfig mhConfig;
private final ICollectionParamsManageService collectionParamsManageService;
private final IPolicyManageService policyManageService;
private final ICpmSpaceRelationService cpmSpaceRelationService;
private final IOperationDeviceService iOperationService;
private final IMqttGatewayService iMqttGatewayService;
// 在 AHUTask 类中添加一个 PID 控制器成员变量
private final Map<String, FuzzyPIDControlUtil> pidControllers = new HashMap<>();
private final List<String> ahuList = List.of("ddc13_0211385", // 软件2号
"ddc13_0211485", // 软件3号
"ddc14_01185", // 硬件2号
"ddc14_01285", // 硬件3号
"ddc13_1510085", // 远程手自动启停
"ddc13_1510185" // 时间表启停
);
@Autowired
public AHUTask(ICollectionParamsManageService collectionParamsManageService, IPolicyManageService policyManageService, ICpmSpaceRelationService cpmSpaceRelationService, IOperationDeviceService iOperationService, IMqttGatewayService iMqttGatewayService) {
this.collectionParamsManageService = collectionParamsManageService;
this.policyManageService = policyManageService;
this.cpmSpaceRelationService = cpmSpaceRelationService;
this.iOperationService = iOperationService;
this.iMqttGatewayService = iMqttGatewayService;
}
public void ddc13SendDataToDDC14() throws InterruptedException {
HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("systemType", "2");
queryMap.put("isUse", 0);
queryMap.put("mtType", "7");
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageService.selectListByParams(queryMap);
List<CollectionParamsManage> list = collectionParamsManages.stream()
.filter(collectionParamsManage -> ahuList.contains(collectionParamsManage.getMtNum()))
.toList();
if (list.isEmpty()) {
return;
}
// Optional<CollectionParamsManage> twoHardStartStopList = list.stream().filter(val -> val.getMtNum().equals("ddc13_1510085")).findFirst();
// boolean present = twoHardStartStopList.isPresent();
// CollectionParamsManage threeHardStartStop = new CollectionParamsManage();
// if (present) {
// threeHardStartStop = twoHardStartStopList.get();
// }
Optional<CollectionParamsManage> twoHardParamList = list.stream().filter(val -> val.getMtNum().equals("ddc14_01185")).findFirst();
Optional<CollectionParamsManage> threeHardParamList = list.stream().filter(val -> val.getMtNum().equals("ddc14_01285")).findFirst();
CollectionParamsManage twoHardParam = new CollectionParamsManage();
if (twoHardParamList.isPresent()) {
twoHardParam = twoHardParamList.get();
}
CollectionParamsManage threeHardParam = new CollectionParamsManage();
if (threeHardParamList.isPresent()) {
threeHardParam = threeHardParamList.get();
}
int twoSoftValue = 0;
int threeSoftValue = 0;
// 判断远程启停或者时间表启停是否开启来,判断是否存在getCurValue,且当前时间等于今天的时间
if (list.stream().anyMatch(val ->
(val.getMtNum().equals("ddc13_1510085") || val.getMtNum().equals("ddc13_1510185"))
&& val.getCurValue() != null)) {
// 判断curTime是否为今天
Date now = new Date();
boolean isToday = list.stream().anyMatch(val ->
(val.getMtNum().equals("ddc13_1510085") || val.getMtNum().equals("ddc13_1510185"))
&& val.getCurTime() != null && DateUtils.isSameDay(val.getCurTime(), now));
if (isToday) {
// 如果curTime是今天,则执行相关逻辑
// 可以在这里添加需要执行的代码
for (CollectionParamsManage value : list) {
if (value.getMtNum().contains("ddc13_0211385")) {
// 2号软件风阀调节
twoSoftValue = value.getCurValue().intValue();
sendOrderToMqtt(List.of(new OrderEntity(twoHardParam.getId(), String.valueOf(twoSoftValue), 0, twoHardParam.getOtherName())));
} else if (value.getMtNum().contains("ddc13_0211485")) {
// 3号软件风阀调节
threeSoftValue = value.getCurValue().intValue();
sendOrderToMqtt(List.of(new OrderEntity(threeHardParam.getId(), String.valueOf(threeSoftValue), 0, threeHardParam.getOtherName())));
}
Thread.sleep(2000);
}
} else {
for (CollectionParamsManage value : list) {
if (value.getMtNum().contains("ddc13_0211385")) {
if (twoHardParam.getCurValue() != null && twoHardParam.getCurValue().intValue() != 0) {
// 发送值给2号硬件风阀控制点位
sendOrderToMqtt(List.of(new OrderEntity(twoHardParam.getId(), "0", 0, twoHardParam.getOtherName())));
}
} else if (value.getMtNum().contains("ddc13_0211485")) {
if (threeHardParam.getCurValue() != null && threeHardParam.getCurValue().intValue() != 0) {
// 发送值给3号硬件风阀控制点位
sendOrderToMqtt(List.of(new OrderEntity(threeHardParam.getId(), "0", 0, threeHardParam.getOtherName())));
}
}
Thread.sleep(2000);
}
}
}
// else {
// for (CollectionParamsManage value : list) {
// if (value.getMtNum().contains("ddc13_0211385")) {
// if (twoHardParam.getCurValue() != null && twoHardParam.getCurValue().intValue() != 0) {
// // 发送值给2号硬件风阀控制点位
// sendOrderToMqtt(List.of(new OrderEntity(twoHardParam.getId(), "0", 0, twoHardParam.getOtherName())));
// }
// } else if (value.getMtNum().contains("ddc13_0211485")) {
// if (threeHardParam.getCurValue() != null && threeHardParam.getCurValue().intValue() != 0) {
// // 发送值给3号硬件风阀控制点位
// sendOrderToMqtt(List.of(new OrderEntity(threeHardParam.getId(), "0", 0, threeHardParam.getOtherName())));
// }
// }
// Thread.sleep(2000);
// }
// }
}
public void sendOrderToMqtt(List<OrderEntity> changeValues) {
try {
String sendOrder = iOperationService.operationDevice(changeValues);
String name = mhConfig.getName();
// 获取mqtt操作队列(后期通过mqtt队列配置发送主题)
log.info("发送主题:{},消息:{}", name + "/" + controlTopic, sendOrder);
iMqttGatewayService.publish(name + "/" + controlTopic, sendOrder, 1);
} catch (Exception e) {
log.error("设备操作失败", e);
}
}
public void adjustWaterValve(String kp, String ki, String kd) {
// 西餐走廊2、宴会走廊需要调整PID参数,其他的ddc自己已经处理好
String[] deviceLedgerIds = new String[]{"ddc0083b3a898d85f3a1205a2d82071e100", "ddc0133b3a898d85f3a1205a2d82071e100"};
for (String deviceLedgerId : deviceLedgerIds) {
// 获取西餐走廊2的启停控制
HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("systemType", "2");
queryMap.put("deviceLedgerId", deviceLedgerId);
queryMap.put("isUse", 0);
// 得出 systemType =2 的数据
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageService.selectListByParams(queryMap);
CollectionParamsManage collectionParamsManage = new CollectionParamsManage();
// 过滤得出启停状态
Optional<CollectionParamsManage> first = collectionParamsManages.stream().filter(item -> item.getCurValue().intValue() == 1 && item.getParamType().equals("2")).findFirst();
if (first.isEmpty()) {
// 如果设备停止了,则同步关掉水阀
// 过滤获取水阀调节参数
Optional<CollectionParamsManage> fourth = collectionParamsManages
.stream()
.filter(item -> item.getOtherName().contains("水阀调节")
&& item.getParamType().equals("3")).findFirst();
if (fourth.isEmpty()) {
continue;
}
// 得出水阀调节参数
collectionParamsManage = fourth.get();
// 先判断水阀是否已经关闭
if (collectionParamsManage.getCurValue().intValue() == 0) {
continue;
}
// 关闭
List<OrderEntity> changeValues = new ArrayList<>();
changeValues.add(new OrderEntity(collectionParamsManage.getId(), String.valueOf(0), Integer.parseInt(collectionParamsManage.getParamType()), collectionParamsManage.getOtherName()));
sendOrderToMqtt(changeValues);
continue;
}
// 过滤获取回风温度设置值
Optional<CollectionParamsManage> second = collectionParamsManages
.stream()
.filter(item -> item.getOtherName().contains("回风温度")
&& item.getParamType().equals("14")).findFirst();
if (second.isEmpty()) {
continue;
}
// 得出回风温度设置值
double backTempSet = second.get().getCurValue().doubleValue();
// 设定目标温度(夏季制冷24℃)
// ✅ 如果没有该设备的控制器,则创建一个新的并保存起来
FuzzyPIDControlUtil controller = pidControllers.computeIfAbsent(deviceLedgerId, k -> new FuzzyPIDControlUtil(kp, ki, kd));
log.info("开始模糊PID控制循环,查看对象是否有变化:{}", controller);
// 过滤获取当前回风温度
Optional<CollectionParamsManage> third = collectionParamsManages
.stream()
.filter(item -> item.getOtherName().contains("回风温度")
&& item.getParamType().equals("12")).findFirst();
if (third.isEmpty()) {
continue;
}
// 得出当前回风温度
double temp = third.get().getCurValue().doubleValue();
// 2. 计算水阀开度(时间间隔1秒)
double valveOpening1 = controller.calculate(backTempSet, temp, 1);
int valveOpening = new BigDecimal(valveOpening1).intValue();
// 过滤获取水阀调节参数
Optional<CollectionParamsManage> fourth = collectionParamsManages
.stream()
.filter(item -> item.getOtherName().contains("水阀调节")
&& item.getParamType().equals("3")).findFirst();
if (fourth.isEmpty()) {
continue;
}
// 得出水阀调节参数
collectionParamsManage = fourth.get();
// 发送控制指令
if (valveOpening > 0 && valveOpening <= 100) {
// 开启
List<OrderEntity> changeValues = new ArrayList<>();
changeValues.add(new OrderEntity(collectionParamsManage.getId(), String.valueOf(valveOpening), Integer.parseInt(collectionParamsManage.getParamType()), collectionParamsManage.getOtherName()));
sendOrderToMqtt(changeValues);
// 3. 应用水阀开度(实际应用发送给执行机构)
log.info("回风温度: {} ℃ | 水阀开度: {} % ",
temp, valveOpening);
}
}
}
public void startOrStopAHU() {
// 扫描启动了定时开关机的风机,根据当前时间判断是否需要启动或停止
// systemType 2: 风柜系统
HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("systemType", "2");
// 得出 systemType =2 的数据
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageService.selectListByParams(queryMap);
// 判断当前时间是星期几
String dayOfWeekValue = DateUtils.dayOfWeekValue();
// 过滤otherName包含dayOfWeekValue,paramType=29, curValue=1的数据,代表已经启用定时开关机的功能
List<CollectionParamsManage> needStartOrStopDataList = collectionParamsManages
.stream()
.filter(item -> item.getOtherName().contains(dayOfWeekValue)
&& item.getParamType().equals("29")
&& item.getCurValue().intValue() == 1)
.toList();
// 查询得出对应的houseId
List<PolicyManage> policyManageList = policyManageService.selectListByCpmIds(needStartOrStopDataList);
// 开始:根据houseId查询出对应的风机启停id
List<CpmSpaceRelation> cpmSpaceRelationList = cpmSpaceRelationService.selectListByHouseId(policyManageList);
// collectionParamsManages过滤出能够开启风机的点位,paramType=2,isUse=0
List<CollectionParamsManage> startDeviceList = collectionParamsManages
.stream()
.filter(item -> item.getParamType().equals("2")
&& item.getIsUse() == 0)
.toList();
// 结束:根据houseId查询出对应的风机启停id
// 在拼接出启用定时开关机的启动时间、关闭时间
Map<String, List<PolicyManage>> groupedByHouseId = policyManageList.stream()
.collect(Collectors.groupingBy(
PolicyManage::getHouseId,
Collectors.toList()
));
// groupedByHouseId for 循环遍历
for (Map.Entry<String, List<PolicyManage>> entry : groupedByHouseId.entrySet()) {
// 得出houseId
String houseId = entry.getKey();
List<PolicyManage> timeList1 = entry.getValue();
if (timeList1.isEmpty()) {
continue;
}
PolicyManage policyManage1 = timeList1.getFirst();
// 得出policyManageList
List<PolicyManage> timeList = policyManageService.selectPolicyListByHouseId(houseId, policyManage1.getPolicyName());
int isHaveTime = 0;
int startHour = 0;
int startMinute = 0;
int endHour = 0;
int endMinute = 0;
for (PolicyManage policyManage : timeList) {
if (policyManage.getPointName().contains("开_时")) {
startHour = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
if (policyManage.getPointName().contains("开_分")) {
startMinute = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
if (policyManage.getPointName().contains("关_时")) {
endHour = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
if (policyManage.getPointName().contains("关_分")) {
endMinute = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
}
if (isHaveTime == 0) {
continue;
}
LocalTime nowTime = LocalTime.now();
LocalTime startTime = LocalTime.of(startHour, startMinute);
LocalTime endTime = LocalTime.of(endHour, endMinute);
// collectionParamsManages过滤出能够开启风机的点位,paramType=2,isUse=0
Set<String> validCpmIds = cpmSpaceRelationList.stream()
.filter(item -> item.getHouseId().equals(houseId))
.map(CpmSpaceRelation::getCpmId)
.collect(Collectors.toSet());
List<CollectionParamsManage> startDataList = startDeviceList
.stream()
.filter(item -> validCpmIds.contains(item.getId()))
.toList();
// 判断当前风机是否在开启状态了
if (null == startDataList || startDataList.size() == 0) {
return;
}
CollectionParamsManage first = startDataList.getFirst();
// 判断当前时间是否在开启时间范围内
if (DateUtils.isBetween(nowTime, startTime, endTime)) {
// 判断当前风机是否在开启状态了
if (first.getCurValue().intValue() == 1) {
// 当前风机在开启状态,不需要启动
log.info("当前风机在开启状态,不需要启动");
} else {
// 当前风机不在开启状态,需要启动
log.info("当前风机不在开启状态,需要启动");
List<OrderEntity> changeValues = new ArrayList<>();
changeValues.add(new OrderEntity(first.getId(), "1", Integer.parseInt(first.getParamType()), first.getOtherName()));
sendOrderToMqtt(changeValues);
}
;
} else {
// 判断当前风机是否在关闭状态了
if (first.getCurValue().intValue() == 0) {
// 当前风机在关闭状态,不需要停止
log.info("当前风机在关闭状态,不需要停止");
} else {
// 当前风机不在关闭状态,需要停止
log.info("当前风机不在关闭状态,需要停止");
List<OrderEntity> changeValues = new ArrayList<>();
changeValues.add(new OrderEntity(first.getId(), "0", Integer.parseInt(first.getParamType()), first.getOtherName()));
sendOrderToMqtt(changeValues);
}
}
}
}
}

206
mh-quartz/src/main/java/com/mh/quartz/task/ChillersTask.java

@ -0,0 +1,206 @@
package com.mh.quartz.task;
import com.mh.common.config.MHConfig;
import com.mh.common.core.domain.dto.DeviceMonitorDTO;
import com.mh.common.core.domain.entity.CollectionParamsManage;
import com.mh.common.core.domain.entity.CpmSpaceRelation;
import com.mh.common.core.domain.entity.OrderEntity;
import com.mh.common.core.domain.entity.PolicyManage;
import com.mh.common.utils.DateUtils;
import com.mh.common.utils.StringUtils;
import com.mh.framework.mqtt.service.IMqttGatewayService;
import com.mh.system.service.device.ICollectionParamsManageService;
import com.mh.system.service.operation.IOperationDeviceService;
import com.mh.system.service.policy.IPolicyManageService;
import com.mh.system.service.report.IReportSysService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 冷水机组定时任务
* @date 2025-08-13 17:22:09
*/
@Slf4j
@Component("chillersTask")
public class ChillersTask {
@Value("${control.topic}")
String controlTopic;
@Autowired
private MHConfig mhConfig;
private final IReportSysService reportSysService;
private final ICollectionParamsManageService collectionParamsManageService;
private final IPolicyManageService policyManageService;
private final IOperationDeviceService iOperationService;
private final IMqttGatewayService iMqttGatewayService;
public ChillersTask(IReportSysService reportSysService,
ICollectionParamsManageService collectionParamsManageService,
IPolicyManageService policyManageService, IOperationDeviceService iOperationService, IMqttGatewayService iMqttGatewayService) {
this.reportSysService = reportSysService;
this.collectionParamsManageService = collectionParamsManageService;
this.policyManageService = policyManageService;
this.iOperationService = iOperationService;
this.iMqttGatewayService = iMqttGatewayService;
}
/**
* 创建系统运行参数
*/
public void createSysRunParam() {
// 定时执行运行脚本
reportSysService.execProSysRunParamHis();
}
/**
* 偏移值定时设置
*/
public void driftValueSet() {
// 偏移值定时设置
// systemType 0: 主机空调系统
HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("systemType", "0");
// 得出 systemType =0 的数据
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageService.selectListByParams(queryMap);
List<DeviceMonitorDTO> policyManages = (List<DeviceMonitorDTO>) policyManageService.selectPolicyList("0", "4");
// 过滤otherName包含paramType=29, curValue=1,deviceLedgerId不为空的数据,代表已经启用定时开关机的功能
List<CollectionParamsManage> needStartOrStopDataList = collectionParamsManages
.stream()
.filter(item -> item.getParamType().equals("29")
&& StringUtils.isNotEmpty(item.getDeviceLedgerId())
&& item.getCurValue().intValue() == 1)
.toList();
List<PolicyManage> list = policyManageService.selectListByCpmIds(needStartOrStopDataList);
// policyManages匹配policyManageList存在的policyName
List<DeviceMonitorDTO> policyManageList = policyManages.stream()
.filter(item -> list.stream().anyMatch(policy -> policy.getPolicyName().equals(item.getName()))).toList();
// policyManageList根据policy_name进行分组,获取对应的策略数据
// Map<String, List<PolicyManage>> groupedByPolicyName = policyManageList.stream().collect(Collectors.groupingBy(
// PolicyManage::getPolicyName,
// Collectors.toList()
// ));
for (DeviceMonitorDTO value : policyManageList) {
List<PolicyManage> manageList = (List<PolicyManage>) value.getValues();
// 获取当前设置的偏移值
Optional<PolicyManage> tempSet = manageList.stream().filter(item -> item.getPointName().contains("当前偏移值设置")).findFirst();
BigDecimal curTempSetValue = new BigDecimal(0);
BigDecimal offsetValue = new BigDecimal(0);
String otherName = "";
String quality = "";
String cpmId = "";
String paramType = "";
if (tempSet.isPresent()) {
PolicyManage tempSetPolicy = tempSet.get();
// 获取collectionParamsManages中id为tempSetPolicy.getCpmId()的数据
Optional<CollectionParamsManage> tempSetCpm = collectionParamsManages.stream().filter(item -> item.getId().equals(tempSetPolicy.getCpmId())).findFirst();
if (tempSetCpm.isPresent()) {
CollectionParamsManage collectionParamsManage = tempSetCpm.get();
curTempSetValue = collectionParamsManage.getCurValue();
otherName = collectionParamsManage.getOtherName();
quality = collectionParamsManage.getQuality();
cpmId = collectionParamsManage.getId();
paramType = collectionParamsManage.getParamType();
}
}
// 获取设置值
Optional<PolicyManage> offsetValuePolicy = manageList.stream().filter(item -> item.getPointName().contains("目标偏移值")).findFirst();
if (offsetValuePolicy.isPresent()) {
PolicyManage offsetValuePm = offsetValuePolicy.get();
// 获取collectionParamsManages中id为tempSetPolicy.getCpmId()的数据
Optional<CollectionParamsManage> tempSetCpm = collectionParamsManages.stream().filter(item -> item.getId().equals(offsetValuePm.getCpmId())).findFirst();
if (tempSetCpm.isPresent()) {
CollectionParamsManage collectionParamsManage = tempSetCpm.get();
offsetValue = collectionParamsManage.getCurValue();
}
}
int isHaveTime = 0;
int startHour = 0;
int startMinute = 0;
int endHour = 0;
int endMinute = 0;
for (PolicyManage policyManage : manageList) {
if (policyManage.getPointName().contains("开时")) {
startHour = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
if (policyManage.getPointName().contains("开分")) {
startMinute = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
if (policyManage.getPointName().contains("关时")) {
endHour = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
if (policyManage.getPointName().contains("关分")) {
endMinute = collectionParamsManageService.selectCollectionParamsManageById(policyManage.getCpmId()).getCurValue().intValue();
isHaveTime++;
}
}
if (isHaveTime == 0) {
continue;
}
LocalTime nowTime = LocalTime.now();
LocalTime startTime = LocalTime.of(startHour, startMinute);
LocalTime endTime = LocalTime.of(endHour, endMinute);
// 判断当前时间是否在开启时间范围内
if (DateUtils.isBetween(nowTime, startTime, endTime)) {
// 判断当前通信是否正常,并且设置值跟偏移值是否一样
if (quality.equals("0") && curTempSetValue.compareTo(offsetValue) == 0) {
// 当前风机不在开启状态,需要启动
log.info("当前偏移值相等,不需要在设置");
} else if (quality.equals("0") && curTempSetValue.compareTo(offsetValue) != 0) {
if (StringUtils.isNotEmpty(cpmId) && StringUtils.isNotEmpty(otherName)) {
List<OrderEntity> changeValues = new ArrayList<>();
changeValues.add(new OrderEntity(cpmId, String.valueOf(offsetValue.intValue()), Integer.parseInt(paramType), otherName));
sendOrderToMqtt(changeValues);
}
}
} else {
// 判断当前风机是否在关闭状态了
if (curTempSetValue.intValue() == 0) {
// 当前偏移值等于0,不需要在设置
log.info("当前偏移值等于0,不需要在设置");
} else {
// 当前偏移值不等于0,不需要在设置
log.info("当前偏移值不等于0,需要在设置");
List<OrderEntity> changeValues = new ArrayList<>();
changeValues.add(new OrderEntity(cpmId, "0", Integer.parseInt(paramType), otherName));
sendOrderToMqtt(changeValues);
}
}
}
}
public void sendOrderToMqtt(List<OrderEntity> changeValues) {
try {
String sendOrder = iOperationService.operationDevice(changeValues);
String name = mhConfig.getName();
// 获取mqtt操作队列(后期通过mqtt队列配置发送主题)
log.info("发送主题:{},消息:{}", name + "/" + controlTopic, sendOrder);
iMqttGatewayService.publish(name + "/" + controlTopic, sendOrder, 1);
} catch (Exception e) {
log.error("设备操作失败", e);
}
}
}

82
mh-quartz/src/main/java/com/mh/quartz/task/CreateAlarmTask.java

@ -6,18 +6,21 @@ import com.mh.common.core.domain.entity.AlarmRules;
import com.mh.common.core.domain.entity.CollectionParamsManage;
import com.mh.common.utils.BigDecimalUtils;
import com.mh.common.utils.DateUtils;
import com.mh.framework.rabbitmq.producer.SendMsgByTopic;
import com.mh.system.service.device.ICollectionParamsManageService;
import com.mh.system.service.operation.IAlarmCodeService;
import com.mh.system.service.operation.IAlarmRecordsService;
import com.mh.system.service.operation.IAlarmRulesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
@ -31,81 +34,32 @@ import java.util.List;
@Component("createAlarmTask")
public class CreateAlarmTask {
private final IAlarmRulesService alarmRulesService;
private final IAlarmCodeService alarmCodeService;
private final ICollectionParamsManageService collectionParamsManageService;
private final IAlarmRecordsService alarmRecordService;
private final SendMsgByTopic sendMsgByTopic;
@Autowired
public CreateAlarmTask(IAlarmRulesService alarmRulesService, IAlarmCodeService alarmCodeService, ICollectionParamsManageService collectionParamsManageService, IAlarmRecordsService alarmRecordService) {
this.alarmRulesService = alarmRulesService;
this.alarmCodeService = alarmCodeService;
this.collectionParamsManageService = collectionParamsManageService;
public CreateAlarmTask(IAlarmRecordsService alarmRecordService, SendMsgByTopic sendMsgByTopic) {
this.alarmRecordService = alarmRecordService;
this.sendMsgByTopic = sendMsgByTopic;
}
public void createAlarmTask() {
log.info("创建报警记录");
// 查询仪表报警规则记录,查看哪些规则启用了
List<AlarmRules> alarmRules = alarmRulesService.selectAlarmRulesListByStatus(0);
// 循环查询报警规则,判断是否满足报警条件
for (AlarmRules alarmRule : alarmRules) {
// 判断报警类型
if ("0".equals(alarmRule.getAlarmType())) {
// 当前是越限事件
// 查询事件类型查询对应的报警模板内容
AlarmCode alarmCode = alarmCodeService.selectAlarmCodeByAlarmType(alarmRule.getEventType());
// 获取当前采集参数值
CollectionParamsManage collectionParamsManage = collectionParamsManageService.selectCollectionParamsManageById(alarmRule.getCpmId());
// 判断当前值是否是当前事件
AlarmRecords alarmRecords = new AlarmRecords();
BigDecimal curValue = collectionParamsManage.getCurValue();
Date curTime = collectionParamsManage.getCurTime();
// 阈值
String threshold1 = alarmRule.getThreshold1();
if (alarmRule.getTimePeriodSet() == 0 && DateUtils.isSameDay(curTime, new Date())) {
// 执行相关操作
insertOrUpdateRecord(alarmRule, curValue, threshold1, alarmCode, alarmRecords, collectionParamsManage);
} else if (alarmRule.getTimePeriodSet() == 1
&& DateUtils.isSameDay(collectionParamsManage.getCurTime(), new Date())
&& DateUtils.isCurrentTimeInRange(alarmRule.getBeginTime(), alarmRule.getEndTime(), curTime)
) {
// 执行相关操作
insertOrUpdateRecord(alarmRule, curValue, threshold1, alarmCode, alarmRecords, collectionParamsManage);
}
}
// 第一次判断
String alarmTask = alarmRecordService.createAlarmTask();
if (null == alarmTask) {
return;
}
}
private void insertOrUpdateRecord(AlarmRules alarmRule, BigDecimal curValue, String threshold1, AlarmCode alarmCode, AlarmRecords alarmRecords, CollectionParamsManage collectionParamsManage) {
boolean compare = BigDecimalUtils.compare(alarmRule.getCondition1(), curValue, new BigDecimal(threshold1));
if (compare) {
// 创建报警记录
String content = alarmCode.getMsgContent();
content = content.replace("#{curValue}", curValue.setScale(1, RoundingMode.HALF_UP).toString());
content = content.replace("#{setValue}", alarmRule.getCondition1() + threshold1);
alarmRecords.setContent(content);
alarmRecords.setAlarmType(alarmRule.getAlarmType());
alarmRecords.setEventType(alarmRule.getEventType());
alarmRecords.setAlarmLevel(alarmRule.getAlarmLevel());
alarmRecords.setLedgerId(alarmRule.getLedgerId());
alarmRecords.setCpmId(alarmRule.getCpmId());
alarmRecords.setDeviceName(alarmRule.getDeviceName());
alarmRecords.setCpmName(alarmRule.getCpmName());
alarmRecords.setCreateTime(collectionParamsManage.getCurTime());
// 判断报警记录是否已经存在
AlarmRecords isExits = alarmRecordService.selectIsExist(alarmRecords);
if (isExits == null) {
alarmRecordService.insertAlarmRecord(alarmRecords);
} else {
// 更新报警记录
isExits.setContent(content);
isExits.setCreateTime(collectionParamsManage.getCurTime());
alarmRecordService.updateAlarmRecord(isExits);
// 根据","逗号进行分割
String[] alarmTaskArray = alarmTask.split(",");
// 遍历
for (String id : alarmTaskArray) {
if (null == id || id.isEmpty()) {
continue;
}
sendMsgByTopic.sendDelayedAlarm(id, 1);
}
}

42
mh-quartz/src/main/java/com/mh/quartz/task/DealDataTask.java

@ -6,6 +6,7 @@ import com.mh.common.core.domain.entity.DeviceReport;
import com.mh.common.core.redis.RedisCache;
import com.mh.common.enums.ComputeEnum;
import com.mh.common.utils.DateUtils;
import com.mh.common.utils.StringUtils;
import com.mh.framework.dealdata.DataProcessService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -114,7 +115,10 @@ public class DealDataTask {
int ratio = entity.getMtRatio();
if (ObjectUtils.isEmpty(lastData) || ObjectUtils.isEmpty(lastData.getLastValue())) {
//从device_manage取出初始值
String initValue = dataProcessService.queryInitValue(entity.getMtNum());
String initValue = dataProcessService.queryInitValue(entity.getMtNum(), entity.getMtCode(), entity.getRegisterAddr());
if (StringUtils.isEmpty(initValue)) {
initValue = "0";
}
DeviceReport firstEntity = new DeviceReport();
firstEntity.setLastValue(initValue);
firstEntity.setLastTime(entity.getCurTime());
@ -126,7 +130,12 @@ public class DealDataTask {
firstEntity.setRegisterAddr(entity.getRegisterAddr());
firstEntity.setDeviceType(deviceType);
firstEntity.setRatio(ratio);
double usedValue = entity.getCurValue().doubleValue() - Double.parseDouble(initValue);
double usedValue = 0;
try {
usedValue = entity.getCurValue().doubleValue() - Double.parseDouble(initValue);
} catch (NumberFormatException e) {
log.error("数值格式解析异常:{}", e);
}
firstEntity.setUsedValue(String.valueOf(usedValue));
//区分瞬时值
if ((deviceGrade >= 100 && deviceGrade < 200) || (deviceGrade >= 1200 && deviceGrade < 1300) ) {
@ -198,6 +207,7 @@ public class DealDataTask {
}
temp.setDeviceType(deviceType);
temp.setRatio(ratio);
temp.setRegisterAddr(dataI.getRegisterAddr());
dataMinList.add(temp);
i++;
j++;
@ -272,7 +282,7 @@ public class DealDataTask {
.sorted(Comparator.comparing(temMap -> temMap.keySet().iterator().next()))
.collect(Collectors.toList());
//计算上次值,当前值
// log.info("计算小时表数据:{}", sortedList);
log.info("计算小时表数据:{}", sortedList);
hourList = calcListData(hourList, key, "hour", sortedList);
}
//批量插入小时报表
@ -315,7 +325,10 @@ public class DealDataTask {
DeviceReport hourEntity = dataProcessService.queryLastValue(key, tableType);
if (ObjectUtils.isEmpty(hourEntity)) {
//查询设备信息初始值
lastValue = dataProcessService.queryInitValue(key);
lastValue = dataProcessService.queryInitValue(key, null, null);
if (StringUtils.isEmpty(lastValue)) {
lastValue = "0";
}
} else {
lastValue = hourEntity.getLastValue();
lastDate = hourEntity.getLastTime();
@ -493,7 +506,7 @@ public class DealDataTask {
DeviceReport entity = deviceList.get(i);
DeviceReport lastEntity = dataProcessService.queryLastValue(deviceNum, "month");
if (ObjectUtils.isEmpty(lastEntity)) {
lastValue = dataProcessService.queryInitValue(deviceNum);
lastValue = dataProcessService.queryInitValue(deviceNum, null, null);
lastTime = entity.getCurTime();
} else {
lastValue = lastEntity.getLastValue();
@ -631,6 +644,25 @@ public class DealDataTask {
}
}
/**
* 处理锅炉数据获取进入chillers表
*/
public void dealBoilerData() {
List<CollectionParamsManage> cacheList = redisCache.getCacheList(Constants.BOILER, CollectionParamsManage.class);
if (null == cacheList || cacheList.isEmpty()) {
return;
}
//清空redis
redisCache.deleteObject(Constants.BOILER);
//处理chillers数据
try {
//todo 处理没有对象curValue和curTime的异常
dealChillersCollect(cacheList);
} catch (Exception e) {
log.error("处理主机参数异常:{}", e);
}
}
/**
* 处理主机秒级数据再计算主机运行时间
*

38
mh-quartz/src/main/java/com/mh/quartz/task/HomeTask.java

@ -0,0 +1,38 @@
package com.mh.quartz.task;
import com.mh.common.constant.CacheConstants;
import com.mh.common.core.redis.RedisCache;
import com.mh.system.service.overview.IProOverviewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 首页任务
* @date 2025-12-24 09:04:57
*/
@Slf4j
@Component("homeTask")
public class HomeTask {
@Autowired
private IProOverviewService proOverviewService;
@Autowired
private RedisCache redisCache;
public void updateHomeData() {
if (redisCache.hasKey(CacheConstants.PRO_PROFILE)) {
redisCache.deleteObject(CacheConstants.PRO_PROFILE);
}
proOverviewService.getProProfile();
if (redisCache.hasKey(CacheConstants.ENERGY_ANALYSIS)) {
redisCache.deleteObject(CacheConstants.ENERGY_ANALYSIS);
}
proOverviewService.energyAnalysis();
}
}

2
mh-quartz/src/main/java/com/mh/quartz/task/HotWaterTask.java

@ -180,7 +180,7 @@ public class HotWaterTask {
*/
public void calcEnergyDataDetail(String lastHourTime) {
//TODO 1、查询sql获取对应计算的楼层id、楼层名称用来当作楼栋id和楼栋名称
List<Map<String, Object>> floorInfos = energyQueryService.queryFloorInfo();
List<Map<String, Object>> floorInfos = energyQueryService.queryFloorInfo("1");
// 开始遍历
if (StringUtils.isEmpty(lastHourTime)) {
LocalDateTime now = LocalDateTime.now();

77
mh-quartz/src/main/java/com/mh/quartz/task/PushDataToWechatTask.java

@ -52,37 +52,39 @@ public class PushDataToWechatTask {
return;
}
alarmRecords1.forEach(alarmRecords2 -> {
// 查询需要推送的微信用户
List<Map<String, Object>> wechatUserList = wechatService.queryWechatUser(0);
if (null == wechatUserList || wechatUserList.isEmpty()) {
log.info("没有查询到微信用户");
}
// 开始推送数据
for (Map<String, Object> map : wechatUserList) {
PushMsgEntity pushMsgEntity = new PushMsgEntity();
try {
// 判断模板id种类
switch (map.get("template_id").toString()) {
case "fqAXCFXSBCqHLJjBLIjD-Wr_dN8RLsTcsatUQa3Ktx4":
// 设备异常告警提醒
pushDeviceExceptionParams(map, pushMsgEntity, alarmRecords2);
break;
case "SiyBtZeZuF0Qo8V3NlvGwhc95-vX-a6wsvIxpAq3d_Y":
// 设备告警通知
pushDeviceArmParams(map, pushMsgEntity, alarmRecords2);
break;
default:
break;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
if (!pushMsgEntity.getTouser().isEmpty()) {
String result = wechatService.pushMsg(pushMsgEntity);
if (Constants.SUCCESS.equals(result)) {
// 更新数据:已发送通知
alarmRecordsService.updateAlarmRecordById(alarmRecords2.getId(), 1);
// 每个小时推送两次
if (alarmRecords2.getSendNum() <= 3) {
// 查询需要推送的微信用户
List<Map<String, Object>> wechatUserList = wechatService.queryWechatUser(0);
if (null != wechatUserList && !wechatUserList.isEmpty()) {
// 开始推送数据
for (Map<String, Object> map : wechatUserList) {
PushMsgEntity pushMsgEntity = new PushMsgEntity();
try {
// 判断模板id种类
switch (map.get("template_id").toString()) {
case "fqAXCFXSBCqHLJjBLIjD-Wr_dN8RLsTcsatUQa3Ktx4":
// 设备异常告警提醒
pushDeviceExceptionParams(map, pushMsgEntity, alarmRecords2);
break;
case "SiyBtZeZuF0Qo8V3NlvGwhc95-vX-a6wsvIxpAq3d_Y":
// 设备告警通知
pushDeviceArmParams(map, pushMsgEntity, alarmRecords2);
break;
default:
break;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
if (!pushMsgEntity.getTouser().isEmpty()) {
String result = wechatService.pushMsg(pushMsgEntity);
if (Constants.SUCCESS.equals(result)) {
// 更新数据:已发送通知
alarmRecordsService.updateAlarmRecordById(alarmRecords2.getId(), 1);
}
}
}
}
}
@ -92,7 +94,7 @@ public class PushDataToWechatTask {
private void pushDeviceArmParams(Map<String, Object> map, PushMsgEntity pushMsgEntity, AlarmRecords alarmRecords2) {
pushMsgEntity.setTouser(map.get("open_id").toString());
pushMsgEntity.setTemplateId(map.get("template_id").toString());
pushMsgEntity.setUrl("http://bajnd.mhwsh.net:9090/");
// pushMsgEntity.setUrl("http://jnd2.mhwsh.net:8765/");
First first = new First();
first.setValue("设备告警通知");
pushMsgEntity.setFirst(first);
@ -117,7 +119,8 @@ public class PushDataToWechatTask {
// 异常原因
Key4 key4 = new Key4();
key4.setValue(alarmRecords2.getContent().substring(0, 20));
String content = alarmRecords2.getContent();
key4.setValue(content.length() > 20 ? content.substring(0, 20) : content);
pushMsgEntity.setKey4(key4);
// 发生时间
@ -128,6 +131,7 @@ public class PushDataToWechatTask {
/**
* 推送设备异常告警提醒
*
* @param map
* @param pushMsgEntity
* @param alarmRecords2
@ -135,7 +139,7 @@ public class PushDataToWechatTask {
private void pushDeviceExceptionParams(Map<String, Object> map, PushMsgEntity pushMsgEntity, AlarmRecords alarmRecords2) {
pushMsgEntity.setTouser(map.get("open_id").toString());
pushMsgEntity.setTemplateId(map.get("template_id").toString());
pushMsgEntity.setUrl("http://bajnd.mhwsh.net:9090/");
// pushMsgEntity.setUrl("http://jnd2.mhwsh.net:8765/");
First first = new First();
first.setValue("设备异常告警提醒");
pushMsgEntity.setFirst(first);
@ -153,12 +157,13 @@ public class PushDataToWechatTask {
Key3 key3 = new Key3();
// 通过告警类型id得到value值
String alarmType = alarmRecords2.getAlarmType();
String alarmType1 = DictUtils.getDictLabel( "alarm_type", alarmType);
String alarmType1 = DictUtils.getDictLabel("alarm_type", alarmType);
key3.setValue(alarmType1);
pushMsgEntity.setKey3(key3);
Key4 key4 = new Key4();
key4.setValue(alarmRecords2.getContent().substring(0, 20));
String content = alarmRecords2.getContent();
key4.setValue(content.length() > 20 ? content.substring(0, 20) : content);
pushMsgEntity.setKey4(key4);
Key5 key5 = new Key5();

76
mh-quartz/src/main/java/com/mh/quartz/task/ReportTask.java

@ -0,0 +1,76 @@
package com.mh.quartz.task;
import com.mh.common.utils.DateUtils;
import com.mh.common.utils.StringUtils;
import com.mh.system.service.report.IMeterReadingsHisService;
import com.mh.system.service.report.IReportHeatingService;
import com.mh.system.service.report.IReportHotWaterService;
import com.mh.system.service.report.IReportSteamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Calendar;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 报表定时记录生成
* @date 2025-10-22 10:39:00
*/
@Slf4j
@Component("reportTask")
public class ReportTask {
@Autowired
private IMeterReadingsHisService meterReadingsHisService;
@Autowired
private IReportHotWaterService reportHotWaterService;
@Autowired
private IReportSteamService reportSteamService;
@Autowired
private IReportHeatingService reportHeatingService;
/**
* 创建抄表记录查询
*/
public void createMeterReadingHis(String curDate) {
// 获取当前时间的前一天
if (StringUtils.isEmpty(curDate)) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -1);
curDate = DateUtils.dateToString(calendar.getTime(), DateUtils.YYYY_MM_DD);
}
// 定时执行运行脚本
meterReadingsHisService.execProMeterReadingsHis(curDate);
}
/**
* 创建热水热泵运行参数
*/
public void createHotWaterRunParam() {
// 定时执行运行脚本
reportHotWaterService.execProRunParamHis();
}
/**
* 创建蒸汽机运行参数
*/
public void createSteamRunParam() {
// 定时执行运行脚本
reportSteamService.execProRunParamHis();
}
/**
* 创建采暖系统运行参数
*/
public void createHeatingRunParam() {
// 定时执行运行脚本
reportHeatingService.execProRunParamHis();
}
}

84
mh-quartz/src/main/java/com/mh/quartz/util/AHUPIDControlUtil.java

@ -0,0 +1,84 @@
package com.mh.quartz.util;
import com.mh.quartz.domain.FuzzyLevel;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 风柜系统PID调节工具类
* @date 2025-05-30 13:47:40
*/
public class AHUPIDControlUtil {
private double kp = 2.0, ki = 0.1, kd = 0.0;
private double integral = 0;
private double previousError = 0;
private static final double MAX_INTEGRAL = 100;
private static final double MIN_INTEGRAL = -100;
// 模糊增益修正比例
private double deltaKpScale = 0.5;
private double deltaKiScale = 0.01;
private double deltaKdScale = 0.01;
public double compute(double setTemp, double currentTemp, double deltaTime) {
double error = currentTemp - setTemp;
double dError = (error - previousError) / deltaTime;
// 模糊映射
FuzzyLevel eLevel = toFuzzyLevel(error);
FuzzyLevel ecLevel = toFuzzyLevel(dError);
// 获取PID参数调整
FuzzyLevel kpAdjust = FuzzyRuleBase.getKpAdjust(eLevel, ecLevel);
FuzzyLevel kiAdjust = kpAdjust; // 简化处理
FuzzyLevel kdAdjust = kpAdjust;
kp += fuzzyDeltaToValue(kpAdjust, deltaKpScale);
ki += fuzzyDeltaToValue(kiAdjust, deltaKiScale);
kd += fuzzyDeltaToValue(kdAdjust, deltaKdScale);
// 限幅
kp = Math.max(0, Math.min(kp, 10));
ki = Math.max(0, Math.min(ki, 1));
kd = Math.max(0, Math.min(kd, 1));
// PID 计算
// 积分项限幅
integral += error * deltaTime;
integral = Math.max(MIN_INTEGRAL, Math.min(MAX_INTEGRAL, integral));
double output = kp * error + ki * integral + kd * dError;
System.out.println("计算输出值:" + output + ",误差:" + error + ",误差变化:" + dError);
previousError = error;
// 输出冷冻水阀开度,限制在0~100%
return Math.max(0, Math.min(100, Math.abs(output)));
}
// 将数值误差映射为模糊等级
public static FuzzyLevel toFuzzyLevel(double value) {
if (value <= -3) return FuzzyLevel.NB;
else if (value <= -2) return FuzzyLevel.NM;
else if (value <= -1) return FuzzyLevel.NS;
else if (value <= 1) return FuzzyLevel.ZO;
else if (value <= 2) return FuzzyLevel.PS;
else if (value <= 3) return FuzzyLevel.PM;
else return FuzzyLevel.PB;
}
// 将模糊等级转为实际数值调整量
public static double fuzzyDeltaToValue(FuzzyLevel level, double scale) {
switch (level) {
case NB: return -3 * scale;
case NM: return -2 * scale;
case NS: return -1 * scale;
case ZO: return 0;
case PS: return 1 * scale;
case PM: return 2 * scale;
case PB: return 3 * scale;
default: return 0;
}
}
}

152
mh-quartz/src/main/java/com/mh/quartz/util/FuzzyPIDControlUtil.java

@ -0,0 +1,152 @@
package com.mh.quartz.util;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 模糊PID控制算法
* @date 2025-06-04 09:47:16
*/
public class FuzzyPIDControlUtil {
// PID参数
private final double kp; // 比例增益
private final double ki; // 积分增益
private final double kd; // 微分增益
// 控制器状态
private double prevError;
private double integral;
private double derivative;
// 模糊规则参数
private final double[] errorLevels = {-6, -3, -1, 0, 1, 3, 6}; // 温度误差级别(℃)
private final double[] dErrorLevels = {-3, -1, 0, 1, 3}; // 误差变化率级别(℃/min)
private final double[] kpAdjust = {1.5, 2.0, 2.5, 3.0, 4.0}; // Kp调整因子 (增强)
private final double[] kiAdjust = {0.3, 0.7, 1.0, 1.3, 1.7}; // Ki调整因子
// 阀门限制
private static final double MIN_VALVE = 0.0; // 最小开度(0%)
private static final double MAX_VALVE = 100.0; // 最大开度(100%)
public FuzzyPIDControlUtil(String kp, String ki, String kd) {
this.kp = Double.parseDouble(kp);
this.ki = Double.parseDouble(ki);
this.kd = Double.parseDouble(kd);
this.prevError = 0;
this.integral = 0;
this.derivative = 0;
}
// 模糊推理计算PID参数调整因子
private double[] fuzzyInference(double error, double dError) {
// 模糊化:计算误差和误差变化率的隶属度
double[] errorMembership = calculateMembership(error, errorLevels);
double[] dErrorMembership = calculateMembership(dError, dErrorLevels);
// 模糊规则库
double kpAdjustSum = 0.0;
double kiAdjustSum = 0.0;
double weightSum = 0.0;
// 应用模糊规则 (增强大误差时的响应)
for (int i = 0; i < errorMembership.length; i++) {
for (int j = 0; j < dErrorMembership.length; j++) {
double weight = errorMembership[i] * dErrorMembership[j];
if (weight > 0) {
// 增强大误差时的响应
int kpIndex;
if (Math.abs(error) > 3) { // 大误差
kpIndex = Math.min(Math.max(i + j, 0), kpAdjust.length - 1);
} else {
kpIndex = Math.min(Math.max(i + j - 1, 0), kpAdjust.length - 1);
}
// Ki调整:小误差时增强积分作用
int kiIndex;
if (Math.abs(error) < 1) { // 小误差
kiIndex = Math.min(Math.max(3 + j, 0), kiAdjust.length - 1);
} else {
kiIndex = Math.min(Math.max(2 + j, 0), kiAdjust.length - 1);
}
kpAdjustSum += weight * kpAdjust[kpIndex];
kiAdjustSum += weight * kiAdjust[kiIndex];
weightSum += weight;
}
}
}
// 反模糊化 (加权平均)
double kpFactor = weightSum > 0 ? kpAdjustSum / weightSum : 1.0;
double kiFactor = weightSum > 0 ? kiAdjustSum / weightSum : 1.0;
return new double[]{kpFactor, kiFactor, 1.0}; // Kd不调整
}
// 计算隶属度 (三角隶属函数)
private double[] calculateMembership(double value, double[] levels) {
double[] membership = new double[levels.length];
for (int i = 0; i < levels.length; i++) {
if (i == 0) {
membership[i] = (value <= levels[i]) ? 1.0 :
(value < levels[i+1]) ? (levels[i+1] - value) / (levels[i+1] - levels[i]) : 0.0;
} else if (i == levels.length - 1) {
membership[i] = (value >= levels[i]) ? 1.0 :
(value > levels[i-1]) ? (value - levels[i-1]) / (levels[i] - levels[i-1]) : 0.0;
} else {
if (value >= levels[i-1] && value <= levels[i]) {
membership[i] = (value - levels[i-1]) / (levels[i] - levels[i-1]);
} else if (value >= levels[i] && value <= levels[i+1]) {
membership[i] = (levels[i+1] - value) / (levels[i+1] - levels[i]);
} else {
membership[i] = 0.0;
}
}
}
return membership;
}
// 计算控制输出 (阀门开度) - 修复了符号问题
public double calculate(double setpoint, double currentValue, double dt) {
// 计算误差项 - 修复:当前值高于设定值需要冷却,误差应为正
double error = currentValue - setpoint;
// 计算微分项 (基于误差变化率)
if (dt > 0) {
derivative = (error - prevError) / dt;
}
// 模糊调整PID参数
double[] adjustments = fuzzyInference(error, derivative);
double adjKp = kp * adjustments[0];
double adjKi = ki * adjustments[1];
double adjKd = kd * adjustments[2];
// 计算积分项 (带抗饱和)
integral += error * dt;
// 抗饱和限制
double maxIntegral = MAX_VALVE / (adjKi + 1e-5);
if (Math.abs(integral) > maxIntegral) {
integral = Math.signum(integral) * maxIntegral;
}
// PID计算 - 修复:误差为正时需要正输出打开阀门
double output = adjKp * error + adjKi * integral + adjKd * derivative;
// 保存误差用于下次计算
prevError = error;
// 阀门开度限制
return Math.min(Math.max(output, MIN_VALVE), MAX_VALVE);
}
// 重置控制器状态
public void reset() {
integral = 0;
prevError = 0;
derivative = 0;
}
}

29
mh-quartz/src/main/java/com/mh/quartz/util/FuzzyRuleBase.java

@ -0,0 +1,29 @@
package com.mh.quartz.util;
import com.mh.quartz.domain.FuzzyLevel;
/**
* @Classname FuzzyRuleBase
* Todo:
* @Date 2025-05-31 14:20
* @Created by LJF
*/
public class FuzzyRuleBase {
// ΔKp 规则:根据误差 e 与误差变化 ec 得到修正量
private static final FuzzyLevel[][] kpRuleTable = {
{FuzzyLevel.PB, FuzzyLevel.PM, FuzzyLevel.PS, FuzzyLevel.ZO, FuzzyLevel.NS, FuzzyLevel.NM, FuzzyLevel.NB},
{FuzzyLevel.PM, FuzzyLevel.PS, FuzzyLevel.ZO, FuzzyLevel.NS, FuzzyLevel.NM, FuzzyLevel.NB, FuzzyLevel.NB},
{FuzzyLevel.PS, FuzzyLevel.ZO, FuzzyLevel.NS, FuzzyLevel.NM, FuzzyLevel.NB, FuzzyLevel.NB, FuzzyLevel.NB},
{FuzzyLevel.ZO, FuzzyLevel.ZO, FuzzyLevel.ZO, FuzzyLevel.ZO, FuzzyLevel.ZO, FuzzyLevel.ZO, FuzzyLevel.ZO},
{FuzzyLevel.NS, FuzzyLevel.ZO, FuzzyLevel.PS, FuzzyLevel.PM, FuzzyLevel.PB, FuzzyLevel.PB, FuzzyLevel.PB},
{FuzzyLevel.NM, FuzzyLevel.NS, FuzzyLevel.ZO, FuzzyLevel.PS, FuzzyLevel.PM, FuzzyLevel.PB, FuzzyLevel.PB},
{FuzzyLevel.NB, FuzzyLevel.NB, FuzzyLevel.NS, FuzzyLevel.ZO, FuzzyLevel.PS, FuzzyLevel.PM, FuzzyLevel.PB}
};
public static FuzzyLevel getKpAdjust(FuzzyLevel e, FuzzyLevel ec) {
return kpRuleTable[e.ordinal()][ec.ordinal()];
}
// 可扩展为不同规则表:getKiAdjust(), getKdAdjust()
}

14
mh-system/src/main/java/com/mh/system/mapper/WeatherDataMapper.java

@ -1,10 +1,14 @@
package com.mh.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.common.core.domain.dto.WeatherDataDTO;
import com.mh.common.core.domain.entity.WeatherData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author LJF
* @version 1.0
@ -17,4 +21,14 @@ public interface WeatherDataMapper extends BaseMapper<WeatherData> {
@Select("select * from weather_data where report_time::date = #{date}::date order by report_time desc limit 1")
WeatherData selectWeatherDataByDate(@Param("date") String date);
@Select("select " +
" * " +
"from " +
" vw_weather_daily_summary " +
"where " +
" weather_date between date(#{startTime}) and date(#{endTime}) " +
"order by " +
" weather_date ")
List<WeatherDataDTO> getWeatherTemp(@Param("startTime") String startTime, @Param("endTime") String endTime);
}

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

@ -201,7 +201,7 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam
" cpm.device_ledger_id, " +
" dl.device_name, " +
" cpm.other_name, " +
" cpm.cur_value, " +
" COALESCE(cpm.cur_value, 0) as cur_value, " +
" cpm.cur_time, " +
" cpm.param_type," +
" dl.order_num as dl_order_num," +
@ -221,7 +221,7 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam
@Select("<script>" +
"select " +
" hi.house_name || right(cpm.other_name, 3) as name, " +
" hi.house_name || right(cpm.other_name, 4) as name, " +
" cpm.cur_value as value, " +
" cpm.cur_time as \"curTime\" " +
"from " +
@ -250,7 +250,7 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam
@Select("select " +
" dl.id, " +
" dl.device_name, " +
" ROUND(cpm.cur_value, 1) as collectValue, " +
" cpm.cur_value as collectValue, " +
" cpm.cur_time as collectTime, " +
" cpm.param_type as paramType, " +
" cpm.other_name as collectName, " +
@ -335,8 +335,14 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam
List<CollectionParamsManageVO> selectBySystemTypeAndHouseId(@Param("systemType") String systemType,
@Param("houseId") String houseId);
@Update("update collection_params_manage set cur_value = #{curValue}, cur_time = #{curTime} where id = #{id} ")
int updateCurValueById(@Param("id") String id, @Param("curValue") BigDecimal curValue, @Param("curTime") Date curTime);
@Update("update collection_params_manage " +
" set cur_value = #{curValue}, " +
" cur_time = #{curTime}, " +
" quality = #{quality} where id = #{id} ")
int updateCurValueById(@Param("id") String id,
@Param("curValue") BigDecimal curValue,
@Param("curTime") Date curTime,
@Param("quality") String quality);
@Select("select" +
" device_ledger_id " +
@ -360,4 +366,22 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam
" or param_type = '11' " +
" or param_type = '48')")
List<CollectionParamsManage> createOrderList();
@Select("SELECT " +
" dl.device_name, " +
" cpm.mt_num, " +
" dl.order_num, " +
" dl.system_type, " +
" dl.device_type, " +
" cpm.other_name, " +
" cpm.param_type, " +
" cpm.cur_value, " +
" cpm.cur_time, " +
" cpm.grade " +
"FROM collection_params_manage cpm " +
"JOIN device_ledger dl ON cpm.device_ledger_id = dl.id " +
"WHERE dl.system_type = #{systemType}")
List<Map<String, Object>> selectErsDatas(@Param("systemType") String systemType);
}

23
mh-system/src/main/java/com/mh/system/mapper/device/DataProcessMapper.java

@ -75,7 +75,7 @@ public interface DataProcessMapper {
*/
@Select("<script>" +
"<foreach collection='batchList' item='item' index='index' separator=';'>" +
"INSERT INTO ${tableName} (device_num, device_code, device_type, last_value, last_time, cur_value, cur_time, used_value, calc_value, grade, ratio) " +
"INSERT INTO ${tableName} (device_num, device_code, device_type, last_value, last_time, cur_value, cur_time, used_value, calc_value, grade, ratio, register_addr) " +
"SELECT " +
" #{item.deviceNum}, " +
" #{item.deviceCode}, " +
@ -87,7 +87,8 @@ public interface DataProcessMapper {
" cast(#{item.usedValue} as decimal(24,2)), " +
" cast(#{item.calcValue} as numeric(24,2)), " +
" #{item.grade}, " +
" #{item.ratio} " +
" #{item.ratio}," +
" #{item.registerAddr} " +
"WHERE NOT EXISTS (" +
" SELECT 1 FROM ${tableName} WHERE device_num = #{item.deviceNum} AND cur_time = #{item.curTime} " +
")" +
@ -164,6 +165,22 @@ public interface DataProcessMapper {
"</script>")
void batchUpdateGrade(@Param("ids") List<Long> value, @Param("tableName") String tableName, @Param("grade") int grade);
/**
* 查询初始数据
*
* @param deviceNum
* @return
*/
@Select("<script>" +
"select mt_init_value from collection_params_manage where mt_num = #{deviceNum} " +
" and mt_code = #{mtCode} and is_use = '0' " +
"<if test='registerAddr != null and registerAddr != \"\"'>" +
" and register_addr = #{registerAddr} " +
"</if>" +
" limit 1" +
"</script>")
String queryInitValue(@Param("deviceNum") String deviceNum, @Param("mtCode") String mtCode, @Param("registerAddr") String registerAddr);
/**
* 查询初始数据
*
@ -171,7 +188,7 @@ public interface DataProcessMapper {
* @return
*/
@Select("select mt_init_value from collection_params_manage where mt_num = #{deviceNum} and is_use = '0' limit 1 ")
String queryInitValue(@Param("deviceNum") String deviceNum);
String queryInitValue1(@Param("deviceNum") String deviceNum);
@Select("select * from ${tableName} where register_id = #{registerId} and cur_time >= CURRENT_TIMESTAMP - INTERVAL '24 hours' ")
List<ChillersEntity> selectLineDataByCodeAndRegisterAddr(@Param("tableName") String tableName,

4
mh-system/src/main/java/com/mh/system/mapper/device/DeviceLedgerMapper.java

@ -18,8 +18,8 @@ import java.util.List;
@Mapper
public interface DeviceLedgerMapper extends BaseMapper<DeviceLedger> {
@Update("update device_ledger set status = 0, update_time = current_timestamp where id = #{id}")
void updateOnlineStatus(@Param("id") String deviceLedgerId);
@Update("update device_ledger set status = #{status} , update_time = current_timestamp where id = #{id}")
void updateOnlineStatus(@Param("id") String deviceLedgerId, @Param("status") int status);
@Update("update device_ledger set status = #{status}, update_time = current_timestamp where id = #{id}")
void updateOnlineOrOfflineStatus(@Param("id") String deviceLedgerId, @Param("status") int integer);

2
mh-system/src/main/java/com/mh/system/mapper/device/MaintainInfoMapper.java

@ -32,7 +32,7 @@ public interface MaintainInfoMapper extends BaseMapper<MaintainInfo> {
MaintainSum queryMaintainSum(@Param("buildingId") String buildingId, @Param("curDate") String curDate);
//汇总维保量
@Select("exec pro_maintain_sum #{curDate,jdbcType=VARCHAR,mode=IN} ")
@Select("call pro_maintain_sum(#{curDate,jdbcType=VARCHAR,mode=IN})")
@Options(statementType = StatementType.CALLABLE)
void proMaintainSum(@Param("curDate") String curDate);
}

92
mh-system/src/main/java/com/mh/system/mapper/energy/EnergyMapper.java

@ -1,6 +1,7 @@
package com.mh.system.mapper.energy;
import com.mh.common.core.domain.entity.ConsumptionAnalyze;
import com.mh.common.core.domain.entity.CpmSpaceRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -19,10 +20,11 @@ public interface EnergyMapper {
/**
* 跨表查询操作
* @param startTime 开始时间
* @param endTime 结束时间
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param lastTableName 上一个表名
* @param curTableName 当前表名
* @param curTableName 当前表名
* @return
*/
@Select("<script>" +
@ -56,7 +58,8 @@ public interface EnergyMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 and cpm.terminal_device_type = '15' " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 " +
// " and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'>" +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -107,7 +110,8 @@ public interface EnergyMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 and cpm.terminal_device_type = '15' " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 " +
// " and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'>" +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -138,10 +142,11 @@ public interface EnergyMapper {
/**
* 单表查询操作
* @param startTime 开始时间
* @param endTime 结束时间
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param lastTableName 上一个表名
* @param curTableName 当前表名
* @param curTableName 当前表名
* @return
*/
@Select("<script>" +
@ -176,7 +181,7 @@ public interface EnergyMapper {
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.grade = 40 " +
" and cpm.terminal_device_type = '15' " +
// " and cpm.terminal_device_type = '15' " +
"<if test='systemType != null and systemType != \"\"'>" +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -209,6 +214,7 @@ public interface EnergyMapper {
/**
* 查询能耗分析同比
*
* @param startTime
* @param endTime
* @param lastTableName
@ -233,6 +239,7 @@ public interface EnergyMapper {
/**
* 查询能耗分析同比
*
* @param startTime
* @param endTime
* @param lastTableName
@ -257,6 +264,7 @@ public interface EnergyMapper {
/**
* 查询能耗分析环比查询类型是monthyear
*
* @param startTime
* @param endTime
* @param yoyStartTime
@ -279,6 +287,7 @@ public interface EnergyMapper {
/**
* 单表查询能耗分析环比查询类型是hourday
*
* @param startTime
* @param endTime
* @param yoyStartTime
@ -301,12 +310,13 @@ public interface EnergyMapper {
/**
* 多表查询能耗分析环比查询类型是hourday
*
* @param startTime
* @param endTime
* @param yoyStartTime
* @param yoyEndTime
* @param tableName1 上一年的表
* @param tableName2 今年的表
* @param tableName1 上一年的表
* @param tableName2 今年的表
* @param dateLen
* @param paramType
* @param timeType
@ -325,6 +335,7 @@ public interface EnergyMapper {
/**
* 查询各个机房设备的用电量查询月
*
* @param startTime
* @param endTime
* @param lastTableName
@ -340,8 +351,47 @@ public interface EnergyMapper {
@Param("len") String dateLen,
@Param("deviceType") String deviceType);
/**
* 查询各个设备组合的用热量查询月
*
* @param startTime
* @param endTime
* @param lastTableName
* @param curTableName
* @param dateLen
* @param cpmSpaceRelationList
* @return
*/
List<ConsumptionAnalyze> queryDeviceERSOneTable(@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("len") String dateLen,
@Param("cpmSpaceRelationList") List<CpmSpaceRelation> cpmSpaceRelationList,
@Param("systemType") String systemType);
/**
* 查询各个机房设备的用电量查询小时
*
* @param startTime
* @param endTime
* @param lastTableName
* @param curTableName
* @param dateLen
* @param cpmSpaceRelationList
* @return
*/
List<ConsumptionAnalyze> queryDeviceERSManyTable(@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("len") String dateLen,
@Param("cpmSpaceRelationList") List<CpmSpaceRelation> cpmSpaceRelationList,
@Param("systemType") String systemType);
/**
* 查询各个机房设备的用电量查询小时
*
* @param startTime
* @param endTime
* @param lastTableName
@ -360,6 +410,7 @@ public interface EnergyMapper {
/**
* 查询系统分析折线图
*
* @param curTable
* @param curCopTable
* @param startTime
@ -373,6 +424,7 @@ public interface EnergyMapper {
/**
* 查询系统分析折线图
*
* @param lastTable
* @param curTable
* @param lastCopTable
@ -390,6 +442,7 @@ public interface EnergyMapper {
/**
* 查询各个设备的折线图数据
*
* @param startTime
* @param endTime
* @param lastTableName
@ -404,6 +457,23 @@ public interface EnergyMapper {
@Param("deviceType") String deviceType,
@Param("systemType") String systemType);
/**
* 查询各个设备的折线图数据
*
* @param startTime
* @param endTime
* @param lastTableName
* @param curTableName
* @param cpmSpaceRelationList
* @return
*/
List<ConsumptionAnalyze> queryDeviceERSLineManyTable(@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("cpmSpaceRelationList") List<CpmSpaceRelation> cpmSpaceRelationList,
@Param("systemType") String systemType);
@Select("select isnull(sum(calc_value),0) from ${tableName} " +
" where device_type = 'cloud' " +
" and device_code in (select device_code from device_manage where grade >=0 and grade < 10) " +

6
mh-system/src/main/java/com/mh/system/mapper/energy/EnergyQueryMapper.java

@ -56,7 +56,7 @@ public interface EnergyQueryMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.terminal_device_type = '15' " +
" and dl.device_type in ('5', '6') " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -107,7 +107,7 @@ public interface EnergyQueryMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.terminal_device_type = '15' " +
" and dl.device_type in ('5', '6') " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
@ -177,7 +177,7 @@ public interface EnergyQueryMapper {
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('5', '6') and cpm.terminal_device_type = '15' " +
" and dl.device_type in ('5', '6') " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +

222
mh-system/src/main/java/com/mh/system/mapper/energy/HeatEnergyQueryMapper.java

@ -0,0 +1,222 @@
package com.mh.system.mapper.energy;
import com.mh.common.core.domain.entity.ConsumptionAnalyze;
import com.mh.common.core.domain.entity.CpmSpaceRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project gh_ers
* @description 系统热量查询
* @date 2023-12-13 16:00:01
*/
@Mapper
public interface HeatEnergyQueryMapper {
/**
* 跨表查询操作
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param lastTableName 上一个表名
* @param curTableName 当前表名
* @param totalHeat
* @return
*/
@Select("<script>" +
"select " +
" sum(dm.calc_value) as curValue, " +
" dm.device_type, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
" <when test='len == 7'>'YYYY-MM'</when>" +
" <when test='len == 10'>'YYYY-MM-DD'</when>" +
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" +
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" +
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" +
" </choose>" +
" ) AS timeStr " +
"from " +
" ${lastTableName} dm " +
"where " +
" dm.cur_time &gt;= #{startTime}::timestamp " +
" AND dm.cur_time &lt;= #{endTime}::timestamp " +
" and dh.device_num in ( " +
" select " +
" cpm.mt_num " +
" from " +
" collection_params_manage cpm " +
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('6') " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
"<if test='paramType != null and paramType != \"\"'>" +
" and cpm.param_type = #{paramType} " +
"</if>" +
"<if test='list != null and list.size() > 0'>" +
" and cpm.id in " +
" <foreach collection='list' item='item' open='(' separator=',' close=')'>" +
" #{item.cpmId}" +
" </foreach>" +
" </if>" +
") " +
") " +
"group by " +
" device_type, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
" <when test='len == 7'>'YYYY-MM'</when>" +
" <when test='len == 10'>'YYYY-MM-DD'</when>" +
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" +
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" +
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" +
" </choose>" +
" ) " +
"union all " +
"select " +
" sum(dm.calc_value) as curValue, " +
" dm.device_type, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
" <when test='len == 7'>'YYYY-MM'</when>" +
" <when test='len == 10'>'YYYY-MM-DD'</when>" +
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" +
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" +
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" +
" </choose>" +
" ) AS timeStr " +
"from " +
" ${curTableName} dm " +
"where " +
" dm.cur_time &gt;= #{startTime}::timestamp " +
" AND dm.cur_time &lt;= #{endTime}::timestamp " +
" and dm.device_num in ( " +
" select " +
" cpm.mt_num " +
" from " +
" collection_params_manage cpm " +
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('6') " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
"<if test='paramType != null and paramType != \"\"'>" +
" and cpm.param_type = #{paramType} " +
"</if>" +
"<if test='list != null and list.size() > 0'>" +
" and cpm.id in " +
" <foreach collection='list' item='item' open='(' separator=',' close=')'>" +
" #{item.cpmId}" +
" </foreach>" +
" </if>" +
") " +
") " +
"group by " +
" device_type, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
" <when test='len == 7'>'YYYY-MM'</when>" +
" <when test='len == 10'>'YYYY-MM-DD'</when>" +
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" +
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" +
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" +
" </choose>" +
" ) " +
"</script>")
List<ConsumptionAnalyze> queryManyTable(@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("len") String dateLen,
@Param("paramType") String paramType,
@Param("systemType") String systemType,
@Param("list") List<CpmSpaceRelation> totalHeat);
/**
* 单表查询操作
* @param startTime 开始时间
* @param endTime 结束时间
* @param lastTableName 上一个表名
* @param curTableName 当前表名
* @return
*/
@Select("<script>" +
"select " +
" sum(dm.calc_value) as curValue, " +
" dm.device_type, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
" <when test='len == 7'>'YYYY-MM'</when>" +
" <when test='len == 10'>'YYYY-MM-DD'</when>" +
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" +
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" +
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" +
" </choose>" +
" ) AS timeStr " +
"from " +
" ${lastTableName} dm " +
"where " +
" dm.cur_time &gt;= #{startTime}::timestamp " +
" AND dm.cur_time &lt;= #{endTime}::timestamp " +
" and dm.device_num in ( " +
" select " +
" cpm.mt_num " +
" from " +
" collection_params_manage cpm " +
" join device_ledger dl " +
"on " +
" cpm.device_ledger_id = dl.id " +
" and dl.device_type in ('6') " +
"<if test='systemType != null and systemType != \"\"'> " +
" and cpm.system_type = #{systemType} " +
"</if>" +
"<if test='paramType != null and paramType != \"\"'>" +
" and cpm.param_type = #{paramType} " +
"</if>" +
"<if test='list != null and list.size() > 0'>" +
" and cpm.id in " +
" <foreach collection='list' item='item' open='(' separator=',' close=')'>" +
" #{item.cpmId}" +
" </foreach>" +
" </if>" +
") " +
"group by " +
" device_type, " +
" TO_CHAR(dm.cur_time, " +
" <choose>" +
" <when test='len == 4'>'YYYY'</when>" +
" <when test='len == 7'>'YYYY-MM'</when>" +
" <when test='len == 10'>'YYYY-MM-DD'</when>" +
" <when test='len == 13'>'YYYY-MM-DD HH24'</when>" +
" <when test='len == 16'>'YYYY-MM-DD HH24:MI'</when>" +
" <otherwise>'YYYY-MM-DD HH24:MI:SS'</otherwise>" +
" </choose>" +
" ) " +
"order by " +
" timeStr " +
"</script>")
List<ConsumptionAnalyze> queryOneTable(@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("len") String dateLen,
@Param("paramType") String paramType,
@Param("systemType") String systemType,
@Param("list") List<CpmSpaceRelation> list);
}

6
mh-system/src/main/java/com/mh/system/mapper/energy/HotEnergyQueryMapper.java

@ -20,7 +20,7 @@ import java.util.Map;
public interface HotEnergyQueryMapper {
@Select("select " +
" t1.id, t1.floor_name as building_name " +
" t1.id, SUBSTRING(t1.floor_name FROM '(-?\\d+楼)') as building_name " +
"from " +
" ( " +
" select " +
@ -34,7 +34,7 @@ public interface HotEnergyQueryMapper {
" join area_info ai on " +
" bi.area_id = ai.id " +
" where " +
" ai.system_type = '1' " +
" ai.system_type = #{systemType} " +
" ) t1 " +
"join cpm_space_relation csr on " +
" csr.floor_id = t1.id " +
@ -42,7 +42,7 @@ public interface HotEnergyQueryMapper {
" csr.house_id = '' " +
"group by " +
" t1.id,t1.floor_name order by building_name")
List<Map<String, Object>> queryFloorInfo();
List<Map<String, Object>> queryFloorInfo(@Param("systemType") String systemType);
@Select("<script>" +
"select " +

28
mh-system/src/main/java/com/mh/system/mapper/energy/OverviewMapper.java

@ -4,11 +4,13 @@ import com.mh.common.core.domain.ColumnFilter;
import com.mh.common.core.domain.entity.ChillersEntity;
import com.mh.common.core.domain.entity.CollectionParamsManage;
import com.mh.common.core.domain.entity.DataMonth;
import com.mh.common.core.domain.vo.CollectionParamsManageDataVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -22,9 +24,9 @@ import java.util.List;
public interface OverviewMapper {
@Select("<script>" +
"select sum(calc_value) as calc_value from data_year where " +
" cur_time >= DATE_TRUNC('year', CURRENT_DATE)" +
" AND cur_time &lt; DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '1 year'" +
"SELECT SUM(calc_value) AS calc_value FROM data_year WHERE " +
" cur_time >= #{yearStart}::timestamp " +
" AND cur_time &lt;= #{yearEnd}::timestamp " +
" <if test='deviceNums != null and deviceNums.size() > 0'>" +
" AND device_num IN " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
@ -32,7 +34,10 @@ public interface OverviewMapper {
" </foreach>" +
" </if>" +
"</script>")
BigDecimal queryByDeviceNum(@Param("deviceNums") List<CollectionParamsManage> deviceNums);
BigDecimal queryByDeviceNum(@Param("deviceNums") List<CollectionParamsManage> deviceNums,
@Param("yearStart") String yearStart,
@Param("yearEnd") String yearEnd);
@Select("<script>" +
"WITH months AS ( " +
@ -69,4 +74,19 @@ public interface OverviewMapper {
" </foreach>" +
"</script>")
BigDecimal selectEER(@Param("deviceNums") List<CollectionParamsManage> deviceNums);
@Select("<script>" +
"SELECT SUM(calc_value) FROM ${table} " +
"WHERE device_type = '2' " +
" AND cur_time &gt;= concat(#{date}, ' 00:00:00')::timestamp " +
" AND cur_time &lt;= concat(#{date}, ' 23:59:59')::timestamp " +
" AND device_num IN " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
" #{item.mtNum} " +
" </foreach>" +
"</script>")
BigDecimal queryHourData(@Param("deviceNums") List<CollectionParamsManageDataVO> accumulatedHeat,
@Param("table") String table,
@Param("date") String date);
}

2
mh-system/src/main/java/com/mh/system/mapper/operation/AlarmRecordsMapper.java

@ -15,6 +15,6 @@ import org.apache.ibatis.annotations.Update;
@Mapper
public interface AlarmRecordsMapper extends BaseMapper<AlarmRecords> {
@Update("update alarm_records set is_send = #{isSend} where id = #{id} ")
@Update("update alarm_records set is_send = #{isSend}, send_num = send_num + 1 where id = #{id} ")
void updateIsSendById(String id, int isSend);
}

6
mh-system/src/main/java/com/mh/system/mapper/policy/PolicyManageMapper.java

@ -32,11 +32,15 @@ public interface PolicyManageMapper extends BaseMapper<PolicyManage> {
" where pm.system_type = #{systemType} " +
" and pm.fun_policy_type = #{funPolicyType} " +
" and house_id = #{houseId} " +
" order by pm.policy_type:int, pm.order_num ")
" order by pm.policy_type::int, pm.order_num ")
List<PolicyManage> selectPolicyListByParams(@Param("systemType") String systemType,
@Param("funPolicyType") String funPolicyType,
@Param("houseId") String houseId);
@Select("select cpm_id from policy_manage where id = #{policyId} limit 1")
String selectCpmId(String policyId);
@Select("select * from policy_manage pm where pm.house_id = #{houseId} and pm.policy_name = #{policyName} ")
List<PolicyManage> selectPolicyListByHouseId(@Param("houseId") String houseId,
@Param("policyName") String policyName);
}

134
mh-system/src/main/java/com/mh/system/mapper/report/ComprehensiveReportMapper.java

@ -0,0 +1,134 @@
package com.mh.system.mapper.report;
import com.mh.common.core.domain.ColumnFilter;
import com.mh.common.core.domain.entity.CollectionParamsManage;
import com.mh.common.core.domain.entity.WaterLevel;
import org.apache.ibatis.annotations.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author LJF
* @version 1.0
* @project EEMCS
* @description 热水温度记录
* @date 2025-06-19 16:24:31
*/
@Mapper
public interface ComprehensiveReportMapper {
@Select("<script>" +
"select sum(calc_value) as calc_value from data_year where " +
" cur_time >= DATE_TRUNC('year', CURRENT_DATE)" +
" AND cur_time &lt; DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '1 year'" +
" <if test='deviceNums != null and deviceNums.size() > 0'>" +
" AND device_num IN " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
" #{item.mtNum} " +
" </foreach>" +
" </if>" +
"</script>")
BigDecimal queryByDeviceNum(@Param("deviceNums") List<CollectionParamsManage> deviceNums);
@Select("<script>" +
"WITH combined_data AS ( " +
" SELECT " +
" CASE " +
" WHEN #{timeType} = 'year' THEN to_char(date_trunc('year', cur_time), 'YYYY') " +
" WHEN #{timeType} = 'month' THEN to_char(date_trunc('month', cur_time), 'YYYY-MM') " +
" WHEN #{timeType} = 'day' THEN to_char(date_trunc('day', cur_time), 'YYYY-MM-DD') " +
" WHEN #{timeType} = 'hour' THEN to_char(date_trunc('hour', cur_time), 'YYYY-MM-DD HH24') " +
" ELSE to_char(date_trunc('month', cur_time), 'YYYY-MM') " +
" END AS period, " +
" calc_value " +
" FROM ${lastTableName} " +
" WHERE cur_time >= #{startTime}::timestamp AND cur_time &lt;= #{endTime}::timestamp " +
" <if test='deviceNums != null and deviceNums.size() > 0'>" +
" AND device_num IN " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
" #{item.mtNum} " +
" </foreach>" +
" </if>" +
" UNION ALL " +
" SELECT " +
" CASE " +
" WHEN #{timeType} = 'year' THEN to_char(date_trunc('year', cur_time), 'YYYY') " +
" WHEN #{timeType} = 'month' THEN to_char(date_trunc('month', cur_time), 'YYYY-MM') " +
" WHEN #{timeType} = 'day' THEN to_char(date_trunc('day', cur_time), 'YYYY-MM-DD') " +
" WHEN #{timeType} = 'hour' THEN to_char(date_trunc('hour', cur_time), 'YYYY-MM-DD HH24') " +
" ELSE to_char(date_trunc('month', cur_time), 'YYYY-MM') " +
" END AS period, " +
" calc_value " +
" FROM ${curTableName} " +
" WHERE cur_time >= #{startTime}::timestamp AND cur_time &lt;= #{endTime}::timestamp " +
" <if test='deviceNums != null and deviceNums.size() > 0'>" +
" AND device_num IN " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
" #{item.mtNum} " +
" </foreach>" +
" </if>" +
") " +
"SELECT " +
" period AS name, " +
" SUM(calc_value) AS value " +
"FROM combined_data " +
"GROUP BY period " +
"ORDER BY period; " +
"</script>")
List<ColumnFilter> energyAnalysisManyTable(@Param("deviceNums") List<CollectionParamsManage> deviceNums,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("timeType") String timeType);
@Select("<script>" +
"select sum(cur_value) from collect_param_manage where id in " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
" #{item.id} " +
" </foreach>" +
"</script>")
BigDecimal selectEER(@Param("deviceNums") List<CollectionParamsManage> deviceNums);
@Select("<script>" +
"WITH time_bucketed_data AS ( " +
" SELECT " +
" CASE " +
" WHEN #{timeType} = 'year' THEN to_char(date_trunc('year', cur_time), 'YYYY') " +
" WHEN #{timeType} = 'month' THEN to_char(date_trunc('month', cur_time), 'YYYY-MM') " +
" WHEN #{timeType} = 'day' THEN to_char(date_trunc('day', cur_time), 'YYYY-MM-DD') " +
" WHEN #{timeType} = 'hour' THEN to_char(date_trunc('hour', cur_time), 'YYYY-MM-DD HH24') " +
" ELSE to_char(date_trunc('month', cur_time), 'YYYY-MM') " +
" END AS period, " +
" calc_value " +
" FROM ${lastTableName} " +
" WHERE cur_time >= #{startTime}::timestamp AND cur_time &lt;= #{endTime}::timestamp " +
" <if test='deviceNums != null and deviceNums.size() > 0'>" +
" AND device_num IN " +
" <foreach collection='deviceNums' item='item' open='(' separator=',' close=')'>" +
" #{item.mtNum} " +
" </foreach>" +
" </if>" +
") " +
"SELECT " +
" period AS name, " +
" SUM(calc_value) AS value " +
"FROM time_bucketed_data " +
"GROUP BY period " +
"ORDER BY period; " +
"</script>")
List<ColumnFilter> energyAnalysisOneTable(@Param("deviceNums") List<CollectionParamsManage> deviceNums,
@Param("lastTableName") String lastTableName,
@Param("curTableName") String curTableName,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("timeType") String timeType);
}

32
mh-system/src/main/java/com/mh/system/mapper/report/ReportHeatingRunParamHisMapper.java

@ -0,0 +1,32 @@
package com.mh.system.mapper.report;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mh.common.core.domain.entity.ReportHeatingRunParamHis;
import com.mh.common.core.domain.entity.ReportHotWaterParamHis;
import com.mh.common.core.domain.entity.ReportSteamRunParamHis;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.StatementType;
import java.util.List;
/**
* @author LJF
* @version 1.0
* @project NewZhujiang_Server
* @description 采暖系统运行参数服务类
* @date 2024-05-29 11:23:32
*/
@Mapper
public interface ReportHeatingRunParamHisMapper extends BaseMapper<ReportHeatingRunParamHis> {
@Select("call pro_heating_run_param(#{curTime,jdbcType=VARCHAR,mode=IN})")
@Options(statementType = StatementType.CALLABLE)
void execProHeatingRunParam(@Param("curTime") String curTime);
@Select("select * from report_heating_run_param_his where cur_time >= #{beginDate} and cur_time <= #{endDate} order by cur_time desc ")
List<ReportHotWaterParamHis> findPage(@Param("beginDate") String beginDate,
@Param("endDate") String endDate);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save