数据20250904优化-PCS曲线和电池堆曲线返回修改
This commit is contained in:
@ -58,8 +58,7 @@ public class EmsStatisticalReportController extends BaseController
|
||||
@GetMapping("/getPCSData")
|
||||
public AjaxResult getPCSData(DateSearchRequest requestVo)
|
||||
{
|
||||
if (!StringUtils.isEmpty(requestVo.getSiteId()) &&
|
||||
!StringUtils.isEmpty(requestVo.getDeviceId()) &&
|
||||
if (!StringUtils.isEmpty(requestVo.getSiteId())&&
|
||||
!StringUtils.isEmpty(requestVo.getDataType())) {
|
||||
return success(ieEmsStatsReportService.getPCSDataResult(requestVo));
|
||||
} else {
|
||||
@ -74,7 +73,6 @@ public class EmsStatisticalReportController extends BaseController
|
||||
public AjaxResult getStackData(DateSearchRequest requestVo)
|
||||
{
|
||||
if (!StringUtils.isEmpty(requestVo.getSiteId()) &&
|
||||
!StringUtils.isEmpty(requestVo.getDeviceId()) &&
|
||||
!StringUtils.isEmpty(requestVo.getDataType())) {
|
||||
return success(ieEmsStatsReportService.getStackDataResult(requestVo));
|
||||
} else {
|
||||
@ -131,9 +129,7 @@ public class EmsStatisticalReportController extends BaseController
|
||||
@GetMapping("/getPowerData")
|
||||
public AjaxResult getPowerData(DateSearchRequest requestVo)
|
||||
{
|
||||
if (!StringUtils.isEmpty(requestVo.getSiteId())
|
||||
&& !StringUtils.isEmpty(requestVo.getDeviceId())
|
||||
&& !StringUtils.isEmpty(requestVo.getDataType())) {
|
||||
if (!StringUtils.isEmpty(requestVo.getSiteId())) {
|
||||
return success(ieEmsStatsReportService.getPowerDataList(requestVo));
|
||||
} else {
|
||||
return error("缺少必传项");
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单数据统计-pcs曲线-返回对象
|
||||
*
|
||||
*/
|
||||
public class PCSCurveResponse {
|
||||
/** pcs设备id */
|
||||
private String deviceId;
|
||||
/** 数据对象 */
|
||||
private List<PcsStatisListVo> dataList;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public List<PcsStatisListVo> getDataList() {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public void setDataList(List<PcsStatisListVo> dataList) {
|
||||
this.dataList = dataList;
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ package com.xzzn.ems.domain.vo;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 数据统计-pcs曲线-通用对象
|
||||
* 数据统计-pcs曲线-数据list对象
|
||||
*/
|
||||
public class PcsStatisListVo {
|
||||
/**
|
||||
@ -36,6 +36,9 @@ public class PcsStatisListVo {
|
||||
*/
|
||||
private BigDecimal wCurrent;
|
||||
|
||||
/** pcs设备id */
|
||||
private String deviceId;
|
||||
|
||||
public String getStatisDate() {
|
||||
return statisDate;
|
||||
}
|
||||
@ -83,4 +86,12 @@ public class PcsStatisListVo {
|
||||
public void setwCurrent(BigDecimal wCurrent) {
|
||||
this.wCurrent = wCurrent;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据统计-堆曲线-返回对象
|
||||
*
|
||||
*/
|
||||
public class StackCurveResponse {
|
||||
/** pcs设备id */
|
||||
private String deviceId;
|
||||
/** 数据对象 */
|
||||
private List<StackStatisListVo> dataList;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public List<StackStatisListVo> getDataList() {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public void setDataList(List<StackStatisListVo> dataList) {
|
||||
this.dataList = dataList;
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ package com.xzzn.ems.domain.vo;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 数据统计-堆曲线-通用对象
|
||||
* 数据统计-堆曲线-数据list对象
|
||||
*/
|
||||
public class StackStatisListVo {
|
||||
/**
|
||||
@ -31,6 +31,9 @@ public class StackStatisListVo {
|
||||
*/
|
||||
private BigDecimal soc;
|
||||
|
||||
/** pcs设备id */
|
||||
private String deviceId;
|
||||
|
||||
public String getStatisDate() {
|
||||
return statisDate;
|
||||
}
|
||||
@ -70,4 +73,12 @@ public class StackStatisListVo {
|
||||
public void setSoc(BigDecimal soc) {
|
||||
this.soc = soc;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,9 +16,9 @@ public interface IEmsStatsReportService
|
||||
|
||||
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo);
|
||||
|
||||
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo);
|
||||
public List<PCSCurveResponse> getPCSDataResult(DateSearchRequest requestVo);
|
||||
|
||||
public List<StackStatisListVo> getStackDataResult(DateSearchRequest requestVo);
|
||||
public List<StackCurveResponse> getStackDataResult(DateSearchRequest requestVo);
|
||||
|
||||
public List<ClusterStatisListVo> getClusterDataResult(StatisClusterDateRequest requestVo);
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 统计报表数据Service业务层处理
|
||||
@ -139,7 +140,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
||||
|
||||
// pcs曲线数据
|
||||
@Override
|
||||
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo) {
|
||||
public List<PCSCurveResponse> getPCSDataResult(DateSearchRequest requestVo) {
|
||||
List<PCSCurveResponse> responseList = new ArrayList<>();
|
||||
List<PcsStatisListVo> dataList = new ArrayList();
|
||||
|
||||
// 默认时间-7天
|
||||
@ -164,12 +166,30 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
||||
// 开始日期-结束日期大于 1 个月,按月展示数据
|
||||
dataList = emsPcsDataMapper.getPcsActivePowerByMonth(requestVo);
|
||||
}
|
||||
return dataList;
|
||||
|
||||
// 数据格式转换 按deviceId分组
|
||||
if (dataList != null && dataList.size()>0){
|
||||
responseList = dataList.stream()
|
||||
.collect(Collectors.groupingBy(PcsStatisListVo::getDeviceId))
|
||||
// 将Map转换为Set<Entry>后流转
|
||||
.entrySet().stream()
|
||||
// 映射为PCSCurveResponse对象
|
||||
.map(entry -> {
|
||||
PCSCurveResponse response = new PCSCurveResponse();
|
||||
response.setDeviceId(entry.getKey());
|
||||
response.setDataList(entry.getValue());
|
||||
return response;
|
||||
})
|
||||
// 收集为List
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return responseList;
|
||||
}
|
||||
|
||||
// 电池堆曲线
|
||||
@Override
|
||||
public List<StackStatisListVo> getStackDataResult(DateSearchRequest requestVo) {
|
||||
public List<StackCurveResponse> getStackDataResult(DateSearchRequest requestVo) {
|
||||
List<StackCurveResponse> responseList = new ArrayList<>();
|
||||
List<StackStatisListVo> dataList = new ArrayList();
|
||||
// 默认时间-7天
|
||||
dealRequestTime(requestVo);
|
||||
@ -193,7 +213,24 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
||||
// 开始日期-结束日期大于 1 个月,按月展示数据
|
||||
dataList = emsBatteryStackMapper.getStackDataByMonth(requestVo);
|
||||
}
|
||||
return dataList;
|
||||
|
||||
// 数据格式转换 按deviceId分组
|
||||
if (dataList != null && dataList.size()>0){
|
||||
responseList = dataList.stream()
|
||||
.collect(Collectors.groupingBy(StackStatisListVo::getDeviceId))
|
||||
// 将Map转换为Set<Entry>后流转
|
||||
.entrySet().stream()
|
||||
// 映射为PCSCurveResponse对象
|
||||
.map(entry -> {
|
||||
StackCurveResponse response = new StackCurveResponse();
|
||||
response.setDeviceId(entry.getKey());
|
||||
response.setDataList(entry.getValue());
|
||||
return response;
|
||||
})
|
||||
// 收集为List
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return responseList;
|
||||
}
|
||||
|
||||
// 电池温度
|
||||
|
||||
@ -359,7 +359,6 @@
|
||||
|
||||
<sql id="statisCommonFilter">
|
||||
WHERE p.site_id = #{siteId}
|
||||
and p.device_id = #{deviceId}
|
||||
<if test="startDate != null">
|
||||
AND p.update_time >= #{startDate}
|
||||
</if>
|
||||
@ -390,6 +389,7 @@
|
||||
|
||||
<select id="getStackDataByHour" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
|
||||
select latest.dateHour as statisDate,
|
||||
t.device_id as deviceId,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.update_time, '%H')+1 AS dateHour,MAX(p.update_time) as max_update_time
|
||||
FROM ems_battery_stack p
|
||||
@ -403,6 +403,7 @@
|
||||
|
||||
<select id="getStackDataByDay" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
|
||||
select latest.dateDay as statisDate,
|
||||
t.device_id as deviceId,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.update_time, '%Y-%m-%d') AS dateDay,MAX(p.update_time) as max_update_time
|
||||
FROM ems_battery_stack p
|
||||
@ -416,6 +417,7 @@
|
||||
|
||||
<select id="getStackDataByMonth" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
|
||||
select latest.dateMonth as statisDate,
|
||||
t.device_id as deviceId,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.update_time, '%Y-%m') AS dateMonth,MAX(p.update_time) as max_update_time
|
||||
FROM ems_battery_stack p
|
||||
|
||||
@ -469,7 +469,6 @@
|
||||
|
||||
<sql id="statisCommonFilter">
|
||||
WHERE p.site_id = #{siteId}
|
||||
and p.device_id = #{deviceId}
|
||||
<if test="startDate != null">
|
||||
AND p.data_update_time >= #{startDate}
|
||||
</if>
|
||||
@ -500,6 +499,7 @@
|
||||
|
||||
<select id="getPcsActivePowerByDay" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select latest.dateDay as statisDate,
|
||||
t.device_id as deviceId,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,DATE(p.data_update_time ) AS dateDay,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
@ -513,6 +513,7 @@
|
||||
|
||||
<select id="getPcsActivePowerByMonth" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select DATE_FORMAT(latest.max_update_time, '%Y-%m') as statisDate,
|
||||
t.device_id as deviceId,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,p.date_month,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
@ -527,6 +528,7 @@
|
||||
|
||||
<select id="getPcsActivePowerByHour" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select latest.dateHour as statisDate,
|
||||
t.device_id as deviceId,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
from ( SELECT p.site_id, p.device_id,DATE_FORMAT(p.data_update_time, '%H')+1 AS dateHour,MAX(p.data_update_time) as max_update_time
|
||||
FROM ems_pcs_data p
|
||||
|
||||
Reference in New Issue
Block a user