统计报表-电池堆曲线
This commit is contained in:
@ -60,4 +60,19 @@ public class EmsStatisticalReportController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 概率统计-电池堆曲线
|
||||||
|
*/
|
||||||
|
@GetMapping("/getStackData")
|
||||||
|
public AjaxResult getStackData(DateSearchRequest requestVo)
|
||||||
|
{
|
||||||
|
if (!StringUtils.isEmpty(requestVo.getSiteId()) &&
|
||||||
|
!StringUtils.isEmpty(requestVo.getDeviceId()) &&
|
||||||
|
requestVo.getDataType() != 0) {
|
||||||
|
return success(ieEmsStatsReportService.getStackDataResult(requestVo));
|
||||||
|
} else {
|
||||||
|
return error("缺少必传项");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,86 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计-pcs曲线-通用对象
|
||||||
|
*/
|
||||||
|
public class PcsStatisListVo {
|
||||||
|
/**
|
||||||
|
* 数据日期
|
||||||
|
*/
|
||||||
|
private String statisDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有功
|
||||||
|
*/
|
||||||
|
private BigDecimal activePower;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无功
|
||||||
|
*/
|
||||||
|
private BigDecimal reactivePower;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* u电流
|
||||||
|
*/
|
||||||
|
private BigDecimal uCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* v电流
|
||||||
|
*/
|
||||||
|
private BigDecimal vCurrent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* w电流
|
||||||
|
*/
|
||||||
|
private BigDecimal wCurrent;
|
||||||
|
|
||||||
|
public String getStatisDate() {
|
||||||
|
return statisDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatisDate(String statisDate) {
|
||||||
|
this.statisDate = statisDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getActivePower() {
|
||||||
|
return activePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivePower(BigDecimal activePower) {
|
||||||
|
this.activePower = activePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getReactivePower() {
|
||||||
|
return reactivePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReactivePower(BigDecimal reactivePower) {
|
||||||
|
this.reactivePower = reactivePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getuCurrent() {
|
||||||
|
return uCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setuCurrent(BigDecimal uCurrent) {
|
||||||
|
this.uCurrent = uCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getvCurrent() {
|
||||||
|
return vCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setvCurrent(BigDecimal vCurrent) {
|
||||||
|
this.vCurrent = vCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getwCurrent() {
|
||||||
|
return wCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setwCurrent(BigDecimal wCurrent) {
|
||||||
|
this.wCurrent = wCurrent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计-堆曲线-通用对象
|
||||||
|
*/
|
||||||
|
public class StackStatisListVo {
|
||||||
|
/**
|
||||||
|
* 数据日期
|
||||||
|
*/
|
||||||
|
private String statisDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有功
|
||||||
|
*/
|
||||||
|
private BigDecimal temp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无功
|
||||||
|
*/
|
||||||
|
private BigDecimal voltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* u电流
|
||||||
|
*/
|
||||||
|
private BigDecimal current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* v电流
|
||||||
|
*/
|
||||||
|
private BigDecimal soc;
|
||||||
|
|
||||||
|
public String getStatisDate() {
|
||||||
|
return statisDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatisDate(String statisDate) {
|
||||||
|
this.statisDate = statisDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTemp() {
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTemp(BigDecimal temp) {
|
||||||
|
this.temp = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getVoltage() {
|
||||||
|
return voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoltage(BigDecimal voltage) {
|
||||||
|
this.voltage = voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrent(BigDecimal current) {
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSoc() {
|
||||||
|
return soc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoc(BigDecimal soc) {
|
||||||
|
this.soc = soc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,9 @@ 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.EmsBatteryStack;
|
import com.xzzn.ems.domain.EmsBatteryStack;
|
||||||
|
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
||||||
import com.xzzn.ems.domain.vo.StackAveTempVo;
|
import com.xzzn.ems.domain.vo.StackAveTempVo;
|
||||||
|
import com.xzzn.ems.domain.vo.StackStatisListVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,4 +72,15 @@ public interface EmsBatteryStackMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<StackAveTempVo> getStackAveTempList(@Param("siteId")String siteId, @Param("startDate") Date startDate, @Param("endDate")Date endDate);
|
public List<StackAveTempVo> getStackAveTempList(@Param("siteId")String siteId, @Param("startDate") Date startDate, @Param("endDate")Date endDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 堆曲线数据-按小时区分
|
||||||
|
* @param requestVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<StackStatisListVo> getStackDataByHour(DateSearchRequest requestVo);
|
||||||
|
|
||||||
|
public List<StackStatisListVo> getStackDataByDay(DateSearchRequest requestVo);
|
||||||
|
|
||||||
|
public List<StackStatisListVo> getStackDataByMonth(DateSearchRequest requestVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.xzzn.ems.service;
|
|||||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
||||||
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;
|
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;
|
||||||
import com.xzzn.ems.domain.vo.PcsStatisListVo;
|
import com.xzzn.ems.domain.vo.PcsStatisListVo;
|
||||||
|
import com.xzzn.ems.domain.vo.StackStatisListVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -18,4 +19,6 @@ public interface IEmsStatsReportService
|
|||||||
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo);
|
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo);
|
||||||
|
|
||||||
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo);
|
public List<PcsStatisListVo> getPCSDataResult(DateSearchRequest requestVo);
|
||||||
|
|
||||||
|
public List<StackStatisListVo> getStackDataResult(DateSearchRequest requestVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
package com.xzzn.ems.service.impl;
|
package com.xzzn.ems.service.impl;
|
||||||
|
|
||||||
import com.xzzn.common.utils.DateUtils;
|
import com.xzzn.common.utils.DateUtils;
|
||||||
import com.xzzn.ems.domain.vo.DateSearchRequest;
|
import com.xzzn.ems.domain.vo.*;
|
||||||
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;
|
import com.xzzn.ems.mapper.EmsBatteryDataMapper;
|
||||||
import com.xzzn.ems.domain.vo.PcsStatisListVo;
|
import com.xzzn.ems.mapper.EmsBatteryStackMapper;
|
||||||
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
|
|
||||||
import com.xzzn.ems.mapper.EmsPcsDataMapper;
|
import com.xzzn.ems.mapper.EmsPcsDataMapper;
|
||||||
import com.xzzn.ems.service.IEmsStatsReportService;
|
import com.xzzn.ems.service.IEmsStatsReportService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -34,6 +33,10 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmsPcsDataMapper emsPcsDataMapper;
|
private EmsPcsDataMapper emsPcsDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private EmsBatteryDataMapper emsBatteryDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private EmsBatteryStackMapper emsBatteryStackMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo) {
|
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo) {
|
||||||
@ -120,6 +123,34 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
|||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StackStatisListVo> getStackDataResult(DateSearchRequest requestVo) {
|
||||||
|
List<StackStatisListVo> dataList = new ArrayList();
|
||||||
|
// 默认时间-7天
|
||||||
|
dealRequestTime(requestVo);
|
||||||
|
Date startDate = requestVo.getStartDate();
|
||||||
|
Date endDate = requestVo.getEndDate();
|
||||||
|
|
||||||
|
// 开始日期和结束日期同一天,展示 0-24 小时数据
|
||||||
|
if (DateUtils.isSameDay(startDate, endDate)){
|
||||||
|
endDate = DateUtils.addDays(endDate, 1);
|
||||||
|
requestVo.setEndDate(endDate);
|
||||||
|
dataList = emsBatteryStackMapper.getStackDataByHour(requestVo);
|
||||||
|
} else if (DateUtils.differentDaysByMillisecond(endDate, startDate) >= 1
|
||||||
|
&& DateUtils.differentDaysByMillisecond(endDate, startDate) < 30){
|
||||||
|
endDate = DateUtils.addDays(endDate, 1);
|
||||||
|
requestVo.setEndDate(endDate);
|
||||||
|
// 开始日期-结束日期大于 1 天,小于30 天,按天展示数据
|
||||||
|
dataList = emsBatteryStackMapper.getStackDataByDay(requestVo);
|
||||||
|
} else if (DateUtils.differentDaysByMillisecond(endDate, startDate) >= 30){
|
||||||
|
endDate = DateUtils.addDays(endDate, 1);
|
||||||
|
requestVo.setEndDate(endDate);
|
||||||
|
// 开始日期-结束日期大于 1 个月,按月展示数据
|
||||||
|
dataList = emsBatteryStackMapper.getStackDataByMonth(requestVo);
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
// 统计入参时间处理
|
// 统计入参时间处理
|
||||||
public void dealRequestTime(DateSearchRequest requestVo){
|
public void dealRequestTime(DateSearchRequest requestVo){
|
||||||
|
|
||||||
|
|||||||
@ -288,4 +288,93 @@
|
|||||||
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>
|
||||||
|
|
||||||
|
<sql id="statisCommonFilter">
|
||||||
|
WHERE p.site_id = #{siteId}
|
||||||
|
and p.device_id = #{deviceId}
|
||||||
|
<if test="startDate != null">
|
||||||
|
AND p.update_time >= DATE(#{startDate})
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null">
|
||||||
|
AND p.update_time < DATE(#{endDate})
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="dataTypeChooseFilter">
|
||||||
|
<choose>
|
||||||
|
<when test="dataType == 1">
|
||||||
|
t.operating_temp AS temp
|
||||||
|
</when>
|
||||||
|
<when test="dataType == 2">
|
||||||
|
t.stack_voltage as voltage
|
||||||
|
</when>
|
||||||
|
<when test="dataType == 3">
|
||||||
|
t.stack_current as current
|
||||||
|
</when>
|
||||||
|
<when test="dataType == 4">
|
||||||
|
t.stack_soc as soc
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="groupChooseFilter">
|
||||||
|
<choose>
|
||||||
|
<when test="dataType == 1">
|
||||||
|
,temp
|
||||||
|
</when>
|
||||||
|
<when test="dataType == 2">
|
||||||
|
,voltage
|
||||||
|
</when>
|
||||||
|
<when test="dataType == 3">
|
||||||
|
,current
|
||||||
|
</when>
|
||||||
|
<when test="dataType == 4">
|
||||||
|
,soc
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</sql>
|
||||||
|
<select id="getStackDataByHour" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
|
||||||
|
select latest.dateHour as statisDate,
|
||||||
|
<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
|
||||||
|
<include refid="statisCommonFilter"/>
|
||||||
|
GROUP BY p.site_id,p.device_id,dateHour
|
||||||
|
) latest inner join ems_battery_stack 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
|
||||||
|
<include refid="groupChooseFilter"/>
|
||||||
|
order by statisDate desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getStackDataByDay" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
|
||||||
|
select latest.dateDay as statisDate,
|
||||||
|
<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
|
||||||
|
<include refid="statisCommonFilter"/>
|
||||||
|
GROUP BY p.site_id,p.device_id,dateDay
|
||||||
|
) latest inner join ems_battery_stack 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
|
||||||
|
<include refid="groupChooseFilter"/>
|
||||||
|
order by statisDate desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getStackDataByMonth" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.StackStatisListVo">
|
||||||
|
select latest.dateMonth as statisDate,
|
||||||
|
<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
|
||||||
|
<include refid="statisCommonFilter"/>
|
||||||
|
GROUP BY p.site_id,p.device_id,dateMonth
|
||||||
|
) latest inner join ems_battery_stack 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
|
||||||
|
<include refid="groupChooseFilter"/>
|
||||||
|
order by statisDate desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user