feat(record): 计算指定时间内的蒸汽耗量

- 在 EmsRecordSteamInstant 模型中添加了 expendSunm 字段(已注释)
- 新增了 getExpendSum 方法来计算指定时间内的蒸汽耗量
- 在控制器、服务层和持久层中实现了相关功能
- 新增了 SQL 查询来获取指定时间段内的蒸汽历史数据
master
zch 9 months ago
parent 3e3cc0087a
commit 474bdce3f3

@ -1,6 +1,10 @@
package com.os.ems.record.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
@ -125,4 +129,21 @@ public class EmsRecordSteamInstantController extends BaseController {
return success(list);
}
/* 计算指定时间内的耗量*/
@GetMapping("/getExpendSum")
public BigDecimal getExpendSum(EmsRecordSteamInstant emsRecordSteamInstant) {
BigDecimal expendSum = BigDecimal.ZERO;//默认设为0
List<EmsRecordSteamInstant> list = emsRecordSteamInstantService
.selectEmsRecordSteamInstantListByTime(emsRecordSteamInstant);
/*private Map<String, Object> params;emsRecordSteamInstantparams.beginRecordTimeparams.endRecordTime
emsRecordSteamInstants
last-firstemsRecordSteamInstantexpendSunm(BigDecimal)*/
if (emsRecordSteamInstant.getParams().get("beginRecordTime") != null && emsRecordSteamInstant.getParams().get("endRecordTime") != null) {
EmsRecordSteamInstant last = list.get(0);
EmsRecordSteamInstant first = list.get(list.size() - 1);
expendSum = last.getSteamFlow().subtract(first.getSteamFlow());
}
return expendSum;
}
}

@ -95,6 +95,11 @@ public class EmsRecordSteamInstant extends BaseEntity {
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date recordTime;
/* *//**
*
*//*
private BigDecimal expendSunm;*/
public String getMonitorName() {
return monitorName;
}
@ -199,6 +204,16 @@ public class EmsRecordSteamInstant extends BaseEntity {
return recordTime;
}
/*
public BigDecimal getExpendSunm() {
return expendSunm;
}
public void setExpendSunm(BigDecimal expendSunm) {
this.expendSunm = expendSunm;
}
*/
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@ -214,6 +229,7 @@ public class EmsRecordSteamInstant extends BaseEntity {
.append("density", getDensity())
.append("differencePress", getDifferencePress())
.append("recordTime", getRecordTime())
/* .append("expendSunm", getExpendSunm())*/
.toString();
}
}

@ -67,4 +67,13 @@ public interface EmsRecordSteamInstantMapper {
*/
public List<EmsRecordSteamInstant> selectEmsRecordLatestSteamInstantList(EmsRecordSteamInstant emsRecordSteamInstant);
/**
*
*
* @param emsRecordSteamInstant
* @return
*/
public List<EmsRecordSteamInstant> selectEmsRecordSteamInstantListByTime(EmsRecordSteamInstant emsRecordSteamInstant);
}

@ -66,4 +66,14 @@ public interface IEmsRecordSteamInstantService {
* @return
*/
public List<EmsRecordSteamInstant> selectEmsRecordLatestSteamInstantList(EmsRecordSteamInstant emsRecordSteamInstant);
/**
*
*
* @param emsRecordSteamInstant
* @return
*/
public List<EmsRecordSteamInstant> selectEmsRecordSteamInstantListByTime(EmsRecordSteamInstant emsRecordSteamInstant);
}

@ -1,6 +1,9 @@
package com.os.ems.record.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -99,4 +102,15 @@ public class EmsRecordSteamInstantServiceImpl implements IEmsRecordSteamInstantS
return emsRecordSteamInstantMapper.selectEmsRecordLatestSteamInstantList(emsRecordSteamInstant).subList(0,1);
}
/**
*
*
* @param emsRecordSteamInstant
* @return
*/
public List<EmsRecordSteamInstant> selectEmsRecordSteamInstantListByTime(EmsRecordSteamInstant emsRecordSteamInstant){
return emsRecordSteamInstantMapper.selectEmsRecordSteamInstantListByTime(emsRecordSteamInstant);
}
}

@ -152,4 +152,28 @@
#{objId}
</foreach>
</delete>
<select id="selectEmsRecordSteamInstantListByTime" parameterType="EmsRecordSteamInstant"
resultMap="EmsRecordSteamInstantResult">
<include refid="selectEmsRecordSteamInstantVo"/>
<where>
<if test="monitorCode != null and monitorCode != ''">and ersi.monitor_code = #{monitorCode}</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and ersi.collect_time between #{params.beginCollectTime} and #{params.endCollectTime}
</if>
<if test="fluxFlow != null ">and ersi.flux_flow = #{fluxFlow}</if>
<if test="steamFlow != null ">and ersi.steam_flow = #{steamFlow}</if>
<if test="heatInstantValue != null ">and ersi.heat_instant_value = #{heatInstantValue}</if>
<if test="heatTotalValue != null ">and ersi.heat_total_value = #{heatTotalValue}</if>
<if test="temperature != null ">and ersi.temperature = #{temperature}</if>
<if test="press != null ">and ersi.press = #{press}</if>
<if test="density != null ">and ersi.density = #{density}</if>
<if test="differencePress != null ">and ersi.difference_press = #{differencePress}</if>
<if test="params.beginRecordTime != null and params.beginRecordTime != '' and params.endRecordTime != null and params.endRecordTime != ''">
and ersi.record_time between #{params.beginRecordTime} and #{params.endRecordTime}
</if>
</where>
order by ersi.record_time desc
</select>
</mapper>
Loading…
Cancel
Save