统计报表-电池温度数据
This commit is contained in:
@ -2,14 +2,20 @@ package com.xzzn.web.controller.ems;
|
|||||||
|
|
||||||
import com.xzzn.common.core.controller.BaseController;
|
import com.xzzn.common.core.controller.BaseController;
|
||||||
import com.xzzn.common.core.domain.AjaxResult;
|
import com.xzzn.common.core.domain.AjaxResult;
|
||||||
|
import com.xzzn.common.core.page.TableDataInfo;
|
||||||
import com.xzzn.common.utils.StringUtils;
|
import com.xzzn.common.utils.StringUtils;
|
||||||
|
import com.xzzn.ems.domain.vo.ClusterStatisListVo;
|
||||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
||||||
|
import com.xzzn.ems.domain.vo.StatisClusterDateRequest;
|
||||||
import com.xzzn.ems.service.IEmsStatsReportService;
|
import com.xzzn.ems.service.IEmsStatsReportService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单站监控-统计报表
|
* 单站监控-统计报表
|
||||||
*
|
*
|
||||||
@ -75,4 +81,21 @@ public class EmsStatisticalReportController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 概率统计-电池温度等数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getClusterData")
|
||||||
|
public TableDataInfo getClusterData(StatisClusterDateRequest requestVo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ClusterStatisListVo> dataList = new ArrayList<>();
|
||||||
|
if (!StringUtils.isEmpty(requestVo.getStackId()) &&
|
||||||
|
!StringUtils.isEmpty(requestVo.getClusterId())) {
|
||||||
|
dataList = ieEmsStatsReportService.getClusterDataResult(requestVo);
|
||||||
|
return getDataTable(dataList);
|
||||||
|
} else {
|
||||||
|
return getDataTable(dataList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,109 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池簇-电池温度等数据入参
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ClusterStatisListVo {
|
||||||
|
|
||||||
|
/** 统计时间 */
|
||||||
|
private String statisDate;
|
||||||
|
|
||||||
|
/** 最高温度 */
|
||||||
|
private BigDecimal maxTemp;
|
||||||
|
|
||||||
|
/** 最高温度单体ID */
|
||||||
|
private String maxTempId;
|
||||||
|
|
||||||
|
/** 最低温度 */
|
||||||
|
private BigDecimal minTemp;
|
||||||
|
|
||||||
|
/** 最低温度单体ID */
|
||||||
|
private String minTempId;
|
||||||
|
|
||||||
|
/** 最高电压 */
|
||||||
|
private BigDecimal maxVoltage;
|
||||||
|
|
||||||
|
/** 最高电压单体ID */
|
||||||
|
private String maxVoltageId;
|
||||||
|
|
||||||
|
/** 最低电压 */
|
||||||
|
private BigDecimal minVoltage;
|
||||||
|
|
||||||
|
/** 最低电压单体ID */
|
||||||
|
private String minVoltageId;
|
||||||
|
|
||||||
|
public String getStatisDate() {
|
||||||
|
return statisDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatisDate(String statisDate) {
|
||||||
|
this.statisDate = statisDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMaxTemp() {
|
||||||
|
return maxTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTemp(BigDecimal maxTemp) {
|
||||||
|
this.maxTemp = maxTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxTempId() {
|
||||||
|
return maxTempId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxTempId(String maxTempId) {
|
||||||
|
this.maxTempId = maxTempId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMinTemp() {
|
||||||
|
return minTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinTemp(BigDecimal minTemp) {
|
||||||
|
this.minTemp = minTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMinTempId() {
|
||||||
|
return minTempId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinTempId(String minTempId) {
|
||||||
|
this.minTempId = minTempId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMaxVoltage() {
|
||||||
|
return maxVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxVoltage(BigDecimal maxVoltage) {
|
||||||
|
this.maxVoltage = maxVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMaxVoltageId() {
|
||||||
|
return maxVoltageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxVoltageId(String maxVoltageId) {
|
||||||
|
this.maxVoltageId = maxVoltageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getMinVoltage() {
|
||||||
|
return minVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinVoltage(BigDecimal minVoltage) {
|
||||||
|
this.minVoltage = minVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMinVoltageId() {
|
||||||
|
return minVoltageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinVoltageId(String minVoltageId) {
|
||||||
|
this.minVoltageId = minVoltageId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电池簇-电池温度等数据入参
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class StatisClusterDateRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 筛选时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date dateTime;
|
||||||
|
|
||||||
|
private String stackId;
|
||||||
|
|
||||||
|
private String clusterId;
|
||||||
|
|
||||||
|
public Date getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateTime(Date dateTime) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStackId() {
|
||||||
|
return stackId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStackId(String stackId) {
|
||||||
|
this.stackId = stackId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClusterId() {
|
||||||
|
return clusterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClusterId(String clusterId) {
|
||||||
|
this.clusterId = clusterId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,9 +3,7 @@ package com.xzzn.ems.mapper;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xzzn.ems.domain.EmsBatteryCluster;
|
import com.xzzn.ems.domain.EmsBatteryCluster;
|
||||||
import com.xzzn.ems.domain.vo.BMSBatteryDataList;
|
import com.xzzn.ems.domain.vo.*;
|
||||||
import com.xzzn.ems.domain.vo.BatteryAveSOCVo;
|
|
||||||
import com.xzzn.ems.domain.vo.BatteryAveTempVo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,4 +81,6 @@ public interface EmsBatteryClusterMapper
|
|||||||
|
|
||||||
public List<BatteryAveTempVo> getBatteryAveTempList(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
public List<BatteryAveTempVo> getBatteryAveTempList(@Param("siteId")String siteId, @Param("startDate")Date startDate, @Param("endDate")Date endDate);
|
||||||
|
|
||||||
|
/** 堆电池温度数据-获取当天每小时簇 */
|
||||||
|
public List<ClusterStatisListVo> getClusterDataByHour(StatisClusterDateRequest requestVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
package com.xzzn.ems.service;
|
package com.xzzn.ems.service;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
import com.xzzn.ems.domain.vo.*;
|
||||||
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;
|
|
||||||
import com.xzzn.ems.domain.vo.PcsStatisListVo;
|
|
||||||
import com.xzzn.ems.domain.vo.StackStatisListVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -21,4 +18,6 @@ public interface IEmsStatsReportService
|
|||||||
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo);
|
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo);
|
||||||
|
|
||||||
public List<StackStatisListVo> getStackDataResult(DateSearchRequest requestVo);
|
public List<StackStatisListVo> getStackDataResult(DateSearchRequest requestVo);
|
||||||
|
|
||||||
|
public List<ClusterStatisListVo> getClusterDataResult(StatisClusterDateRequest requestVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.xzzn.ems.service.impl;
|
|||||||
|
|
||||||
import com.xzzn.common.utils.DateUtils;
|
import com.xzzn.common.utils.DateUtils;
|
||||||
import com.xzzn.ems.domain.vo.*;
|
import com.xzzn.ems.domain.vo.*;
|
||||||
|
import com.xzzn.ems.mapper.EmsBatteryClusterMapper;
|
||||||
import com.xzzn.ems.mapper.EmsBatteryDataMapper;
|
import com.xzzn.ems.mapper.EmsBatteryDataMapper;
|
||||||
import com.xzzn.ems.mapper.EmsBatteryStackMapper;
|
import com.xzzn.ems.mapper.EmsBatteryStackMapper;
|
||||||
import com.xzzn.ems.mapper.EmsPcsDataMapper;
|
import com.xzzn.ems.mapper.EmsPcsDataMapper;
|
||||||
@ -37,6 +38,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
private EmsBatteryDataMapper emsBatteryDataMapper;
|
private EmsBatteryDataMapper emsBatteryDataMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmsBatteryStackMapper emsBatteryStackMapper;
|
private EmsBatteryStackMapper emsBatteryStackMapper;
|
||||||
|
@Autowired
|
||||||
|
private EmsBatteryClusterMapper emsBatteryClusterMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo) {
|
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo) {
|
||||||
@ -151,6 +154,19 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ClusterStatisListVo> getClusterDataResult(StatisClusterDateRequest requestVo) {
|
||||||
|
List<ClusterStatisListVo> dataList = new ArrayList();
|
||||||
|
// 时间不传默认当天
|
||||||
|
if (requestVo.getDateTime() == null) {
|
||||||
|
requestVo.setDateTime(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据时间获取每小时最新数据
|
||||||
|
dataList = emsBatteryClusterMapper.getClusterDataByHour(requestVo);
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
// 统计入参时间处理
|
// 统计入参时间处理
|
||||||
public void dealRequestTime(DateSearchRequest requestVo){
|
public void dealRequestTime(DateSearchRequest requestVo){
|
||||||
|
|
||||||
|
|||||||
@ -346,12 +346,36 @@
|
|||||||
t.avg_cell_temp as batteryTemp,
|
t.avg_cell_temp as batteryTemp,
|
||||||
t.create_time as createDate
|
t.create_time as createDate
|
||||||
from ems_battery_cluster t
|
from ems_battery_cluster t
|
||||||
inner join (select site_id,create_time,MIN(device_id) as device_id
|
inner join (select site_id,create_time,MIN(device_id) as device_id
|
||||||
from ems_battery_cluster
|
from ems_battery_cluster
|
||||||
where site_id = #{siteId}
|
where site_id = #{siteId}
|
||||||
AND create_time >= Date(#{startDate})
|
AND create_time >= Date(#{startDate})
|
||||||
AND create_time <= #{endDate}
|
AND create_time <= #{endDate}
|
||||||
GROUP BY site_id,create_time
|
GROUP BY site_id,create_time
|
||||||
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
|
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getClusterDataByHour" resultType="com.xzzn.ems.domain.vo.ClusterStatisListVo">
|
||||||
|
SELECT latest.statisDate,
|
||||||
|
t.max_cell_temp as maxTemp,
|
||||||
|
t.max_cell_temp_id as maxTempId,
|
||||||
|
t.min_cell_temp as minTemp,
|
||||||
|
t.min_cell_temp_id as minTempId,
|
||||||
|
t.max_cell_voltage as maxVoltage,
|
||||||
|
t.max_cell_voltage_id as maxVoltageId,
|
||||||
|
t.min_cell_voltage as minVoltage,
|
||||||
|
t.min_cell_voltage_id as minVoltageId
|
||||||
|
FROM ( SELECT p.site_id, p.device_id, DATE_FORMAT( p.update_time, '%H' ) AS statisDate, MAX(p.update_time) AS max_update_time
|
||||||
|
FROM ems_battery_cluster p
|
||||||
|
WHERE p.stack_device_id = #{stackId}
|
||||||
|
AND p.device_id = #{clusterId}
|
||||||
|
AND DATE( p.update_time) = DATE(#{dateTime})
|
||||||
|
GROUP BY p.site_id, p.device_id, statisDate
|
||||||
|
) latest
|
||||||
|
INNER JOIN ems_battery_cluster t ON latest.site_id = t.site_id
|
||||||
|
AND latest.device_id = t.device_id
|
||||||
|
AND latest.max_update_time = t.update_time
|
||||||
|
GROUP BY statisDate, maxTemp, maxTempId, minTemp, minTempId, maxVoltage, maxVoltageId, minVoltage, minVoltageId
|
||||||
|
ORDER BY statisDate
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user