8 changed files with 661 additions and 1 deletions
@ -0,0 +1,153 @@ |
|||||||
|
package com.mh.web.controller.report; |
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
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) { |
||||||
|
startPage(); |
||||||
|
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("下载报表异常"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -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 String 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; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,162 @@ |
|||||||
|
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; |
||||||
|
|
||||||
|
@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(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
package com.mh.system.mapper.report; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
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 ReportSteamRunParamHisMapper extends BaseMapper<ReportSteamRunParamHis> { |
||||||
|
|
||||||
|
@Select("call pro_hot_water_run_param(#{curTime,jdbcType=VARCHAR,mode=IN})") |
||||||
|
@Options(statementType = StatementType.CALLABLE) |
||||||
|
void execProHotWaterRunParam(@Param("curTime") String curTime); |
||||||
|
|
||||||
|
@Select("select * from report_steam_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); |
||||||
|
} |
||||||
@ -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.ReportSteamRunParamHis; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project NewZhujiang_Server |
||||||
|
* @description 报表服务类 |
||||||
|
* @date 2024-05-29 11:20:30 |
||||||
|
*/ |
||||||
|
public interface IReportSteamService { |
||||||
|
|
||||||
|
void execProRunParamHis(); |
||||||
|
|
||||||
|
List<ReportSteamRunParamHis> selectList(ReportSteamRunParamHis reportSteamRunParamHis); |
||||||
|
|
||||||
|
int updateRunParams(ReportSteamRunParamHis reportSteamRunParamHis); |
||||||
|
} |
||||||
@ -0,0 +1,145 @@ |
|||||||
|
package com.mh.system.service.report.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.mh.common.core.domain.entity.ReportSteamRunParamHis; |
||||||
|
import com.mh.common.utils.StringUtils; |
||||||
|
import com.mh.system.mapper.report.ReportSteamRunParamHisMapper; |
||||||
|
import com.mh.system.service.report.IReportSteamService; |
||||||
|
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; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LJF |
||||||
|
* @version 1.0 |
||||||
|
* @project NewZhujiang_Server |
||||||
|
* @description 报表服务类 |
||||||
|
* @date 2024-05-29 11:20:30 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class ReportSteamServiceImpl implements IReportSteamService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
ReportSteamRunParamHisMapper reportSteamRunParamHisMapper; |
||||||
|
|
||||||
|
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||||
|
|
||||||
|
@Override |
||||||
|
public int updateRunParams(ReportSteamRunParamHis reportHotWaterParamHis) { |
||||||
|
return reportSteamRunParamHisMapper.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); |
||||||
|
reportSteamRunParamHisMapper.execProHotWaterRunParam(timeParam); |
||||||
|
log.info("执行计算系统参数执行完成"); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("执行计算系统参数存储过程执行失败", e); |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public List<ReportSteamRunParamHis> selectList(ReportSteamRunParamHis reportSteamRunParamHis) { |
||||||
|
if (reportSteamRunParamHis.getParams() == null) { |
||||||
|
reportSteamRunParamHis.setParams(new java.util.HashMap<>()); |
||||||
|
} |
||||||
|
String startTime = (String) reportSteamRunParamHis.getParams().get("startTime"); |
||||||
|
String endTime = (String) reportSteamRunParamHis.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"; |
||||||
|
List<ReportSteamRunParamHis> reportSteamRunParamHis1 = reportSteamRunParamHisMapper.selectList( |
||||||
|
new QueryWrapper<ReportSteamRunParamHis>() |
||||||
|
.between("cur_time", startTime, endTime) |
||||||
|
.orderByDesc("cur_time")); |
||||||
|
// 在通过遍历,根据curStatus的值
|
||||||
|
// 0:上电延时
|
||||||
|
// 1:关机
|
||||||
|
// 2:待机
|
||||||
|
// 3:前清扫
|
||||||
|
// 4:预点火
|
||||||
|
// 5:点火
|
||||||
|
// 6:传火
|
||||||
|
// 7:工作
|
||||||
|
// 8:后清扫
|
||||||
|
// 9:故障
|
||||||
|
// 10:小火保持
|
||||||
|
// 11:自检
|
||||||
|
// 12:检漏
|
||||||
|
// 13:开点火器
|
||||||
|
// 14:启动等待中
|
||||||
|
// 赋值运行参数runStatus
|
||||||
|
for (ReportSteamRunParamHis info : reportSteamRunParamHis1) { |
||||||
|
switch (info.getCurStatus()) { |
||||||
|
case 0: |
||||||
|
info.setRunStatus("上电延时"); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
info.setRunStatus("关机"); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
info.setRunStatus("待机"); |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
info.setRunStatus("前清扫"); |
||||||
|
break; |
||||||
|
case 4: |
||||||
|
info.setRunStatus("预点火"); |
||||||
|
break; |
||||||
|
case 5: |
||||||
|
info.setRunStatus("点火"); |
||||||
|
break; |
||||||
|
case 6: |
||||||
|
info.setRunStatus("传火"); |
||||||
|
break; |
||||||
|
case 7: |
||||||
|
info.setRunStatus("工作"); |
||||||
|
break; |
||||||
|
case 8: |
||||||
|
info.setRunStatus("后清扫"); |
||||||
|
break; |
||||||
|
case 9: |
||||||
|
info.setRunStatus("故障"); |
||||||
|
break; |
||||||
|
case 10: |
||||||
|
info.setRunStatus("小火保持"); |
||||||
|
break; |
||||||
|
case 11: |
||||||
|
info.setRunStatus("自检"); |
||||||
|
break; |
||||||
|
case 12: |
||||||
|
info.setRunStatus("检漏"); |
||||||
|
break; |
||||||
|
case 13: |
||||||
|
info.setRunStatus("开点火器"); |
||||||
|
break; |
||||||
|
case 14: |
||||||
|
info.setRunStatus("启动等待中"); |
||||||
|
break; |
||||||
|
default: |
||||||
|
info.setRunStatus("未知"); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return reportSteamRunParamHis1; |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue