diff --git a/mh-admin/src/main/java/com/mh/web/controller/report/ReportHotWaterController.java b/mh-admin/src/main/java/com/mh/web/controller/report/ReportHotWaterController.java new file mode 100644 index 0000000..d49229f --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/report/ReportHotWaterController.java @@ -0,0 +1,152 @@ +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 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("主楼")) { + fileName = "主楼热水热泵运行记录表.xlsx"; + headTitle = "主楼热水热泵运行记录表"; + } else { + fileName = "贵宾楼热水热泵运行记录表.xlsx"; + headTitle = "贵宾楼热水热泵运行记录表"; + } + } + // 从数据库获取数据 + List 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("贵宾楼")) { + List 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.setStatusRunHotPumpThreeStr(info.getStatusRunHotPumpThree() == 1 ? "运行" : "不运行"); + deviceInfoDTO.setStatusSwitchHotPumpThreeStr(info.getStatusSwitchHotPumpThree() == 1 ? "开机" : "关机"); + deviceInfoDTO.setStatusRunHotPumpFourStr(info.getStatusRunHotPumpFour() == 1 ? "运行" : "不运行"); + deviceInfoDTO.setStatusSwitchHotPumpFourStr(info.getStatusSwitchHotPumpFour() == 1 ? "开机" : "关机"); + deviceInfoDTO.setStatusRunHotPumpFiveStr(info.getStatusRunHotPumpFive() == 1 ? "运行" : "不运行"); + deviceInfoDTO.setStatusSwitchHotPumpFiveStr(info.getStatusSwitchHotPumpFive() == 1 ? "开机" : "关机"); + deviceInfoDTO.setStatusRunHotPumpSixStr(info.getStatusRunHotPumpSix() == 1 ? "运行" : "不运行"); + deviceInfoDTO.setStatusSwitchHotPumpSixStr(info.getStatusSwitchHotPumpSix() == 1 ? "开机" : "关机"); + deviceInfoDTO.setStatusRunHotPumpSevenStr(info.getStatusRunHotPumpSeven() == 1 ? "运行" : "不运行"); + deviceInfoDTO.setStatusSwitchHotPumpSevenStr(info.getStatusSwitchHotPumpSeven() == 1 ? "开机" : "关机"); + deviceInfoDTO.setStatusRunHotPumpEightStr(info.getStatusRunHotPumpEight() == 1 ? "运行" : "不运行"); + deviceInfoDTO.setStatusSwitchHotPumpEightStr(info.getStatusSwitchHotPumpEight() == 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 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("下载报表异常"); + } + } + +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/BFloorReportHotWaterDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/BFloorReportHotWaterDTO.java new file mode 100644 index 0000000..5c82413 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/dto/BFloorReportHotWaterDTO.java @@ -0,0 +1,338 @@ +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; + + /** + * 设定温度℃ + */ + @ColumnWidth(10) + @ExcelProperty(value = {"${deviceType}", "3号热泵", "设定温度℃"}, index = 9) + private BigDecimal tempSetHotPumpThree; + + /** + * 实际温度℃ + */ + @ExcelProperty(value = {"${deviceType}", "3号热泵", "实际温度℃"}, index = 10) + @ColumnWidth(10) + private BigDecimal tempRealHotPumpThree; + + /** + * 设备开关机 + */ + @ExcelProperty(value = {"${deviceType}", "3号热泵", "设备开关机"}, index = 11) + @ColumnWidth(10) + private String statusSwitchHotPumpThreeStr; + + /** + * 设备运行状态 + */ + @ExcelProperty(value = {"${deviceType}", "3号热泵", "设备运行状态"}, index = 12) + @ColumnWidth(10) + private String statusRunHotPumpThreeStr; + + /** + * 设定温度℃ + */ + @ColumnWidth(10) + @ExcelProperty(value = {"${deviceType}", "4号热泵", "设定温度℃"}, index = 13) + private BigDecimal tempSetHotPumpFour; + + /** + * 实际温度℃ + */ + @ExcelProperty(value = {"${deviceType}", "4号热泵", "实际温度℃"}, index = 14) + @ColumnWidth(10) + private BigDecimal tempRealHotPumpFour; + + /** + * 设备开关机 + */ + @ExcelProperty(value = {"${deviceType}", "4号热泵", "设备开关机"}, index = 15) + @ColumnWidth(10) + private String statusSwitchHotPumpFourStr; + + /** + * 设备运行状态 + */ + @ExcelProperty(value = {"${deviceType}", "4号热泵", "设备运行状态"}, index = 16) + @ColumnWidth(10) + private String statusRunHotPumpFourStr; + + /** + * 设定温度℃ + */ + @ColumnWidth(10) + @ExcelProperty(value = {"${deviceType}", "5号热泵", "设定温度℃"}, index = 17) + private BigDecimal tempSetHotPumpFive; + + /** + * 实际温度℃ + */ + @ExcelProperty(value = {"${deviceType}", "5号热泵", "实际温度℃"}, index = 18) + @ColumnWidth(10) + private BigDecimal tempRealHotPumpFive; + + /** + * 设备开关机 + */ + @ExcelProperty(value = {"${deviceType}", "5号热泵", "设备开关机"}, index = 19) + @ColumnWidth(10) + private String statusSwitchHotPumpFiveStr; + + /** + * 设备运行状态 + */ + @ExcelProperty(value = {"${deviceType}", "5号热泵", "设备运行状态"}, index = 20) + @ColumnWidth(10) + private String statusRunHotPumpFiveStr; + + /** + * 设定温度℃ + */ + @ColumnWidth(10) + @ExcelProperty(value = {"${deviceType}", "6号热泵", "设定温度℃"}, index = 21) + private BigDecimal tempSetHotPumpSix; + + /** + * 实际温度℃ + */ + @ExcelProperty(value = {"${deviceType}", "6号热泵", "实际温度℃"}, index = 22) + @ColumnWidth(10) + private BigDecimal tempRealHotPumpSix; + + /** + * 设备开关机 + */ + @ExcelProperty(value = {"${deviceType}", "6号热泵", "设备开关机"}, index = 23) + @ColumnWidth(10) + private String statusSwitchHotPumpSixStr; + + /** + * 设备运行状态 + */ + @ExcelProperty(value = {"${deviceType}", "6号热泵", "设备运行状态"}, index = 24) + @ColumnWidth(10) + private String statusRunHotPumpSixStr; + + /** + * 设定温度℃ + */ + @ColumnWidth(10) + @ExcelProperty(value = {"${deviceType}", "7号热泵", "设定温度℃"}, index = 25) + private BigDecimal tempSetHotPumpSeven; + + /** + * 实际温度℃ + */ + @ExcelProperty(value = {"${deviceType}", "7号热泵", "实际温度℃"}, index = 26) + @ColumnWidth(10) + private BigDecimal tempRealHotPumpSeven; + + /** + * 设备开关机 + */ + @ExcelProperty(value = {"${deviceType}", "7号热泵", "设备开关机"}, index = 27) + @ColumnWidth(10) + private String statusSwitchHotPumpSevenStr; + + /** + * 设备运行状态 + */ + @ExcelProperty(value = {"${deviceType}", "7号热泵", "设备运行状态"}, index = 28) + @ColumnWidth(10) + private String statusRunHotPumpSevenStr; + + /** + * 设定温度℃ + */ + @ColumnWidth(10) + @ExcelProperty(value = {"${deviceType}", "8号热泵", "设定温度℃"}, index = 29) + private BigDecimal tempSetHotPumpEight; + + /** + * 实际温度℃ + */ + @ExcelProperty(value = {"${deviceType}", "8号热泵", "实际温度℃"}, index = 30) + @ColumnWidth(10) + private BigDecimal tempRealHotPumpEight; + + /** + * 设备开关机 + */ + @ExcelProperty(value = {"${deviceType}", "8号热泵", "设备开关机"}, index = 31) + @ColumnWidth(10) + private String statusSwitchHotPumpEightStr; + + /** + * 设备运行状态 + */ + @ExcelProperty(value = {"${deviceType}", "8号热泵", "设备运行状态"}, index = 32) + @ColumnWidth(10) + private String statusRunHotPumpEightStr; + +// // 高区/裙楼设定压力(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; + + // 主楼液位1(米) + @ExcelProperty(value = {"${deviceType}", "水箱液位", "水箱1液位%"}, index = 33) + @ColumnWidth(10) + private BigDecimal levelWaterTankOne; + + // 主楼液位2(米) + @ExcelProperty(value = {"${deviceType}", "水箱液位", "水箱2液位%"}, index = 34) + @ColumnWidth(10) + private BigDecimal levelWaterTankTwo; + + // 巡查记录人 + @ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 35) + @ColumnWidth(20) + private String recorder; + + // 备注信息 + @ExcelProperty(value = {"${deviceType}", "备注", "备注"}, index = 36) + @ColumnWidth(20) + private String remark; + +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterNowDataDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterNowDataDTO.java index 9d0cb93..4757bca 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterNowDataDTO.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterNowDataDTO.java @@ -20,7 +20,8 @@ public class HotWaterNowDataDTO { private String pumpName; //热泵名称 private String tempSet; //水温设定 private String waterTemp; //水箱水温 - private String runState; //运行状态 + private String runState; //运行状态:0:关机,4:运行,9:待机 + private String openCloseState;// 开关机状态 0:关机,4:制热 private String isFault; //是否故障 private String levelSet; //水位1设置 private String levelSet2; //水位2设置 diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/ThreeFloorReportHotWaterDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/ThreeFloorReportHotWaterDTO.java new file mode 100644 index 0000000..3ec1c1b --- /dev/null +++ b/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; + + // 主楼水箱1 + @ExcelProperty(value = {"${deviceType}", "水箱液位", "水箱1液位%"}, index = 9) + @ColumnWidth(10) + private BigDecimal levelWaterTankOne; + + // 主楼水箱2 + @ExcelProperty(value = {"${deviceType}", "水箱液位", "水箱2液位%"}, index = 10) + @ColumnWidth(10) + private BigDecimal levelWaterTankTwo; + + // 巡查记录人 + @ExcelProperty(value = {"${deviceType}", "巡查记录人", "巡查记录人"}, index = 11) + @ColumnWidth(20) + private String recorder; + + // 备注信息 + @ExcelProperty(value = {"${deviceType}", "备注", "备注"}, index = 12) + @ColumnWidth(20) + private String remark; + +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHotWaterParamHis.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHotWaterParamHis.java new file mode 100644 index 0000000..5a3f01c --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/ReportHotWaterParamHis.java @@ -0,0 +1,280 @@ +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; + + // 5号热泵设定温度(℃) + private BigDecimal tempSetHotPumpFive; + + // 5号热泵实际温度(℃) + private BigDecimal tempRealHotPumpFive; + + // 5号热泵启停状态(0-关闭,1-开启) + private Integer statusSwitchHotPumpFive; + + // 5号热泵运行状态(0-故障,1-正常) + private Integer statusRunHotPumpFive; + + // 6号热泵设定温度(℃) + private BigDecimal tempSetHotPumpSix; + + // 6号热泵实际温度(℃) + private BigDecimal tempRealHotPumpSix; + + // 6号热泵启停状态 + private Integer statusSwitchHotPumpSix; + + // 6号热泵运行状态 + private Integer statusRunHotPumpSix; + + // 7号热泵设定温度(℃) + private BigDecimal tempSetHotPumpSeven; + + // 7号热泵实际温度(℃) + private BigDecimal tempRealHotPumpSeven; + + // 7号热泵启停状态 + private Integer statusSwitchHotPumpSeven; + + // 7号热泵运行状态 + private Integer statusRunHotPumpSeven; + + // 8号热泵设定温度(℃) + private BigDecimal tempSetHotPumpEight; + + // 8号热泵实际温度(℃) + private BigDecimal tempRealHotPumpEight; + + // 8号热泵启停状态 + private Integer statusSwitchHotPumpEight; + + // 8号热泵运行状态 + private Integer statusRunHotPumpEight; + + // 高区/裙楼设定压力(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 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(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/ReportSysRunParamHis.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/ReportSysRunParamHis.java new file mode 100644 index 0000000..16fd752 --- /dev/null +++ b/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 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(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/utils/file/handle/ExcelFillCellMergeHandler.java b/mh-common/src/main/java/com/mh/common/utils/file/handle/ExcelFillCellMergeHandler.java new file mode 100644 index 0000000..5e6ae80 --- /dev/null +++ b/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 mergeInfo = new HashMap<>(); + + public ExcelFillCellMergeHandler() { + } + public ExcelFillCellMergeHandler(Map 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> 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); + } + + + +} diff --git a/mh-common/src/main/java/com/mh/common/utils/file/handle/ReportSysParamHandler.java b/mh-common/src/main/java/com/mh/common/utils/file/handle/ReportSysParamHandler.java new file mode 100644 index 0000000..90396e8 --- /dev/null +++ b/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 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)); + } + } + } + } + +} diff --git a/mh-common/src/main/java/com/mh/common/utils/file/handle/RowHeightStyleHandler.java b/mh-common/src/main/java/com/mh/common/utils/file/handle/RowHeightStyleHandler.java new file mode 100644 index 0000000..dd9c2a1 --- /dev/null +++ b/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) { + + } +} diff --git a/mh-quartz/src/main/java/com/mh/quartz/task/ReportTask.java b/mh-quartz/src/main/java/com/mh/quartz/task/ReportTask.java new file mode 100644 index 0000000..a80f506 --- /dev/null +++ b/mh-quartz/src/main/java/com/mh/quartz/task/ReportTask.java @@ -0,0 +1,30 @@ +package com.mh.quartz.task; + +import com.mh.system.service.report.IReportHotWaterService; +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-10-22 10:39:00 + */ +@Slf4j +@Component("reportTask") +public class ReportTask { + + @Autowired + private IReportHotWaterService reportHotWaterService; + + /** + * 创建热水热泵运行参数 + */ + public void createHotWaterRunParam() { + // 定时执行运行脚本 + reportHotWaterService.execProRunParamHis(); + } + +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/report/ReportHotWaterParamHisMapper.java b/mh-system/src/main/java/com/mh/system/mapper/report/ReportHotWaterParamHisMapper.java new file mode 100644 index 0000000..2e82c3b --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/mapper/report/ReportHotWaterParamHisMapper.java @@ -0,0 +1,35 @@ +package com.mh.system.mapper.report; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mh.common.core.domain.entity.ReportHotWaterParamHis; +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 ReportHotWaterParamHisMapper extends BaseMapper { + + @Select("call pro_hot_water_run_param(#{floorId,jdbcType=VARCHAR,mode=IN}, #{floorId1,jdbcType=VARCHAR,mode=IN}, #{floorId2,jdbcType=VARCHAR,mode=IN}, #{curTime,jdbcType=VARCHAR,mode=IN})") + @Options(statementType = StatementType.CALLABLE) + void execProHotWaterRunParam(@Param("floorId") String floorId, + @Param("floorId1") String floorId1, + @Param("floorId2") String floorId2, + @Param("curTime") String curTime); + + @Select("select * from report_hot_water_param_his where floor_id = #{floorId} " + + " and cur_time >= #{beginDate} and cur_time <= #{endDate} order by cur_time desc ") + List findPage(@Param("floorId") String floorId, + @Param("beginDate") String beginDate, + @Param("endDate") String endDate); +} diff --git a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java index d719bd5..aa339b7 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java @@ -671,6 +671,10 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag dto.setOrderNum(vo.getOrderNum()); switch (vo.getParamType()) { + case "2": + // 热泵启停状态:0-关机,4-制热 + dto.setOpenCloseState(String.valueOf(new BigDecimal(vo.getCollectValue()).intValue())); + break; case "48": // 运行状态:改成使用电流 // 判断电流值大于0,设置运行状态为4,否则设置为0 List list = hotPumps.stream() @@ -697,6 +701,20 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag return dto; }).collect(Collectors.toList()); + // result在进行格式化判断, + // 如果openCloseState=0,则runState=0, + // 如果openCloseState=4,runState=4,则runState=4 + // 如果openCloseState=4,runState=0,则runState=9 + result.forEach(dto -> { + if ("0".equals(dto.getOpenCloseState())) { + dto.setRunState("0"); + } else if ("4".equals(dto.getOpenCloseState()) && "4".equals(dto.getRunState())) { + dto.setRunState("4"); + } else if ("4".equals(dto.getOpenCloseState()) && "0".equals(dto.getRunState())) { + dto.setRunState("9"); + } + }); + // 处理供水泵状态(deviceType=10) List waterPumps = collectionParamsManageMapper.selectHotWaterBySystemTypeAndBuildingIdAndDeviceType(systemType, floorId, "10"); if (!waterPumps.isEmpty()) { diff --git a/mh-system/src/main/java/com/mh/system/service/report/IReportHotWaterService.java b/mh-system/src/main/java/com/mh/system/service/report/IReportHotWaterService.java new file mode 100644 index 0000000..312d0b8 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/report/IReportHotWaterService.java @@ -0,0 +1,22 @@ +package com.mh.system.service.report; + +import com.mh.common.core.domain.entity.ReportHotWaterParamHis; +import com.mh.common.core.domain.entity.ReportSysRunParamHis; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project NewZhujiang_Server + * @description 报表服务类 + * @date 2024-05-29 11:20:30 + */ +public interface IReportHotWaterService { + + void execProRunParamHis(); + + List selectList(ReportHotWaterParamHis reportHotWaterParamHis); + + int updateRunParams(ReportHotWaterParamHis reportHotWaterParamHis); +} diff --git a/mh-system/src/main/java/com/mh/system/service/report/impl/ReportHotWaterServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/report/impl/ReportHotWaterServiceImpl.java new file mode 100644 index 0000000..32e6563 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/report/impl/ReportHotWaterServiceImpl.java @@ -0,0 +1,119 @@ +package com.mh.system.service.report.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mh.common.core.domain.entity.ReportHotWaterParamHis; +import com.mh.common.utils.StringUtils; +import com.mh.system.mapper.report.ReportHotWaterParamHisMapper; +import com.mh.system.service.report.IReportHotWaterService; +import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +/** + * @author LJF + * @version 1.0 + * @project NewZhujiang_Server + * @description 报表服务类 + * @date 2024-05-29 11:20:30 + */ +@Slf4j +@Service +public class ReportHotWaterServiceImpl implements IReportHotWaterService { + + @Resource + ReportHotWaterParamHisMapper reportHotWaterParamHisMapper; + + private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + @Override + public int updateRunParams(ReportHotWaterParamHis reportHotWaterParamHis) { + return reportHotWaterParamHisMapper.updateById(reportHotWaterParamHis); + } + + @Override + public void execProRunParamHis() { + try { + log.info("执行计算系统参数存储过程"); + // 获取当前日期和时间 + LocalDateTime now = LocalDateTime.now(); + // 格式化日期和时间 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String formattedOneHourAgo = now.format(formatter); + String timeParam = formattedOneHourAgo.substring(0, 13); + + // 创建线程池 + ExecutorService executorService = Executors.newFixedThreadPool(2); + + // 提交任务 + Future future1 = executorService.submit(() -> { + reportHotWaterParamHisMapper.execProHotWaterRunParam( + "73138702b71e16d200b458185bb07e59_主楼", + "e3dc9e3d0aa7c07d3b6db9ce8c119f3d", + "", + timeParam + ); + log.info("执行计算系统参数存储过程完成: 主楼"); + }); + + Future future2 = executorService.submit(() -> { + reportHotWaterParamHisMapper.execProHotWaterRunParam( + "73138702b71e16d200b458185bb07e59_贵宾楼", + "24c7538214b5f6e707e27095b37aee46", + "", + timeParam + ); + log.info("执行计算系统参数存储过程完成: 贵宾楼"); + }); + + // 等待任务完成 + try { + future1.get(); + future2.get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException("存储过程执行失败", e); + } finally { + executorService.shutdown(); + } + + log.info("执行计算系统参数执行完成"); + } catch (Exception e) { + log.error("执行计算系统参数存储过程执行失败", e); + throw new RuntimeException(e); + } + } + + + @Override + public List selectList(ReportHotWaterParamHis reportSysRunParamHis) { + String floorId = reportSysRunParamHis.getFloorId(); + if (StringUtils.isEmpty(floorId)) { + // 默认3楼,实际上是buildingId + floorId = "73138702b71e16d200b458185bb07e59_主楼"; + } + if (reportSysRunParamHis.getParams() == null) { + reportSysRunParamHis.setParams(new java.util.HashMap<>()); + } + String startTime = (String) reportSysRunParamHis.getParams().get("startTime"); + String endTime = (String) reportSysRunParamHis.getParams().get("endTime"); + if (StringUtils.isBlank(startTime)) { + LocalDateTime now = LocalDateTime.now(); + startTime = now.format(dateTimeFormatter).substring(0, 10); + endTime = now.format(dateTimeFormatter).substring(0, 10); + } + startTime = startTime + " 00"; + endTime = endTime + " 23"; + return reportHotWaterParamHisMapper.selectList( + new QueryWrapper() + .between("cur_time", startTime, endTime) + .eq("floor_id", floorId) + .orderByDesc("cur_time")); + } +}