首页-数据概览
This commit is contained in:
@ -34,9 +34,13 @@ public class EmsHomePageController extends BaseController{
|
||||
* 首页看板数据
|
||||
*/
|
||||
@GetMapping("/dataList")
|
||||
public AjaxResult list()
|
||||
public AjaxResult list() throws Exception
|
||||
{
|
||||
try {
|
||||
return success(homePageService.getHomePageDataList());
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.xzzn.ems.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 首页看板数据概览-告警等级分布
|
||||
*/
|
||||
@ -7,39 +9,39 @@ public class AlarmGradeList {
|
||||
/**
|
||||
* 告警等级
|
||||
*/
|
||||
private String grade;
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 数据一
|
||||
*/
|
||||
private int num1;
|
||||
private int dataNum;
|
||||
|
||||
/**
|
||||
* 数据三
|
||||
* 数据占比
|
||||
*/
|
||||
private int num2;
|
||||
private BigDecimal percent;
|
||||
|
||||
public String getGrade() {
|
||||
return grade;
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setGrade(String grade) {
|
||||
this.grade = grade;
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getNum1() {
|
||||
return num1;
|
||||
public int getDataNum() {
|
||||
return dataNum;
|
||||
}
|
||||
|
||||
public void setNum1(int num1) {
|
||||
this.num1 = num1;
|
||||
public void setDataNum(int dataNum) {
|
||||
this.dataNum = dataNum;
|
||||
}
|
||||
|
||||
public int getNum2() {
|
||||
return num2;
|
||||
public BigDecimal getPercent() {
|
||||
return percent;
|
||||
}
|
||||
|
||||
public void setNum2(int num2) {
|
||||
this.num2 = num2;
|
||||
public void setPercent(BigDecimal percent) {
|
||||
this.percent = percent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class ElectricIndexList {
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private int dateMonth;
|
||||
private String dateMonth;
|
||||
|
||||
/**
|
||||
* 充电量
|
||||
@ -21,11 +21,11 @@ public class ElectricIndexList {
|
||||
*/
|
||||
private BigDecimal disChargeEnergy;
|
||||
|
||||
public int getDateMonth() {
|
||||
public String getDateMonth() {
|
||||
return dateMonth;
|
||||
}
|
||||
|
||||
public void setDateMonth(int dateMonth) {
|
||||
public void setDateMonth(String dateMonth) {
|
||||
this.dateMonth = dateMonth;
|
||||
}
|
||||
|
||||
|
||||
@ -9,18 +9,18 @@ public class SystemEfficiencyList {
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private int dateMonth;
|
||||
private String dateMonth;
|
||||
|
||||
/**
|
||||
* 系统效率
|
||||
*/
|
||||
private BigDecimal systemEfficiency;
|
||||
|
||||
public int getDateMonth() {
|
||||
public String getDateMonth() {
|
||||
return dateMonth;
|
||||
}
|
||||
|
||||
public void setDateMonth(int dateMonth) {
|
||||
public void setDateMonth(String dateMonth) {
|
||||
this.dateMonth = dateMonth;
|
||||
}
|
||||
|
||||
|
||||
@ -78,5 +78,12 @@ public interface EmsAlarmRecordsMapper
|
||||
*/
|
||||
public List<DeviceAlarmProportionList> getDeviceAlarmPropList();
|
||||
|
||||
/**
|
||||
* 获取设备等级分布
|
||||
*
|
||||
*/
|
||||
public List<AlarmGradeList> getAlarmGradeList();
|
||||
|
||||
|
||||
public List<AlarmRecordListResponseVo> getAlarmRecordDetailList(AlarmRecordListRequestVo requestVo);
|
||||
}
|
||||
|
||||
@ -81,13 +81,15 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
|
||||
|
||||
// 计算单天的效率
|
||||
BigDecimal dailyEfficiency = new BigDecimal(0);
|
||||
if ( siteMonitorDataVo.getDisChargedCap().compareTo(BigDecimal.ZERO)>0){
|
||||
if ( siteMonitorDataVo.getChargedCap().compareTo(BigDecimal.ZERO)>0){
|
||||
dailyEfficiency = siteMonitorDataVo.getDisChargedCap().divide(siteMonitorDataVo.getChargedCap(), 2, RoundingMode.HALF_UP);
|
||||
dailyEfficiency = dailyEfficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
siteMonitorDataVo.setDailyEfficiency(dailyEfficiency);
|
||||
}
|
||||
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
|
||||
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP);
|
||||
efficiency = efficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
electricDataInfoVo.setSevenDayDisChargeStats(dataList);
|
||||
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
|
||||
|
||||
@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -122,6 +123,26 @@ public class HomePageServiceImpl implements IHomePageService
|
||||
List<ElectricIndexList> electricDataList = emsPcsDataMapper.getElectDataList();
|
||||
homePageDataViewVo.setElecDataList(electricDataList);
|
||||
// 系统效率
|
||||
List<SystemEfficiencyList> systemEfficiencyLists = new ArrayList<>();
|
||||
if (electricDataList != null && !electricDataList.isEmpty()) {
|
||||
for (ElectricIndexList electricIndexList : electricDataList) {
|
||||
SystemEfficiencyList systemEfficiency = new SystemEfficiencyList();
|
||||
systemEfficiency.setDateMonth(electricIndexList.getDateMonth());
|
||||
|
||||
BigDecimal dailyEfficiency = new BigDecimal(0);
|
||||
BigDecimal chargeEnergy = electricIndexList.getChargeEnergy();
|
||||
BigDecimal disChargeEnergy = electricIndexList.getDisChargeEnergy();
|
||||
if (chargeEnergy != null && disChargeEnergy != null
|
||||
&& chargeEnergy.compareTo(BigDecimal.ZERO) > 0
|
||||
&& disChargeEnergy.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
dailyEfficiency = electricIndexList.getDisChargeEnergy().divide(electricIndexList.getChargeEnergy(), 2, RoundingMode.HALF_UP);
|
||||
dailyEfficiency = dailyEfficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
systemEfficiency.setSystemEfficiency(dailyEfficiency);
|
||||
systemEfficiencyLists.add(systemEfficiency);
|
||||
}
|
||||
}
|
||||
homePageDataViewVo.setSysEfficList(systemEfficiencyLists);
|
||||
// 告警趋势
|
||||
List<AlarmTrendList> alarmTrendList = alarmRecordsMapper.getAlarmTrendList();
|
||||
homePageDataViewVo.setAlarmDataList(alarmTrendList);
|
||||
@ -129,6 +150,19 @@ public class HomePageServiceImpl implements IHomePageService
|
||||
List<DeviceAlarmProportionList> deviceAlarmPropList = alarmRecordsMapper.getDeviceAlarmPropList();
|
||||
homePageDataViewVo.setDeviceAlarmList(deviceAlarmPropList);
|
||||
// 告警等级分布
|
||||
List<AlarmGradeList> alarmLevelList = alarmRecordsMapper.getAlarmGradeList();
|
||||
if (alarmLevelList != null && !alarmLevelList.isEmpty()) {
|
||||
BigDecimal total = new BigDecimal(alarmLevelList.size());
|
||||
for (AlarmGradeList alarmGradeList : alarmLevelList) {
|
||||
if (alarmGradeList.getDataNum() != 0
|
||||
&& total.compareTo(BigDecimal.ZERO) > 0) {
|
||||
BigDecimal percent = new BigDecimal(alarmGradeList.getDataNum()).divide(total, 2, RoundingMode.HALF_UP)
|
||||
.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
|
||||
alarmGradeList.setPercent(percent);
|
||||
}
|
||||
}
|
||||
}
|
||||
homePageDataViewVo.setAlarmLevelList(alarmLevelList);
|
||||
return homePageDataViewVo;
|
||||
}
|
||||
|
||||
|
||||
@ -133,6 +133,10 @@
|
||||
group by device_type
|
||||
</select>
|
||||
|
||||
<select id="getAlarmGradeList" resultType="com.xzzn.ems.domain.vo.AlarmGradeList">
|
||||
select alarm_level as level,COUNT(1) as dataNum from ems_alarm_records group by alarm_level;
|
||||
</select>
|
||||
|
||||
<select id="getAlarmRecordDetailList" parameterType="AlarmRecordListRequestVo" resultType="com.xzzn.ems.domain.vo.AlarmRecordListResponseVo">
|
||||
select t.device_name as deviceName,t.alarm_level as alarmLevel,
|
||||
t.alarm_content as alarmContent,t.status as status,
|
||||
|
||||
@ -348,17 +348,19 @@
|
||||
</select>
|
||||
|
||||
<select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
|
||||
select tmp.date_month as dateMonth,
|
||||
SUM(tmp.daily_ac_charge_energy) as chargeEnergy,
|
||||
SUM(tmp.daily_ac_discharge_energy) as disChargeEnergy
|
||||
from (
|
||||
select date_month,date_day,t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.create_time
|
||||
from ems_pcs_data t
|
||||
where t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id
|
||||
and device_id = t.device_id and date_day = t.date_day and date_month = t.date_month)
|
||||
|
||||
) as tmp
|
||||
group by dateMonth
|
||||
SELECT DATE_FORMAT(t.data_update_time, '%Y-%m') AS dateMonth,
|
||||
SUM(t.daily_ac_charge_energy) AS chargeEnergy,
|
||||
SUM(t.daily_ac_discharge_energy) AS disChargeEnergy
|
||||
FROM ems_pcs_data t
|
||||
INNER JOIN ( SELECT site_id, device_id, date_month, date_day, MAX(data_update_time) AS max_update_time
|
||||
FROM ems_pcs_data GROUP BY site_id, device_id, date_month, date_day
|
||||
) max_dates ON t.site_id = max_dates.site_id
|
||||
AND t.device_id = max_dates.device_id
|
||||
AND t.date_month = max_dates.date_month
|
||||
AND t.date_day = max_dates.date_day
|
||||
AND t.data_update_time = max_dates.max_update_time
|
||||
GROUP BY dateMonth
|
||||
ORDER BY dateMonth;
|
||||
</select>
|
||||
|
||||
<select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
|
||||
@ -487,6 +489,7 @@
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getPcsActivePowerByDay" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.PcsStatisListVo">
|
||||
select CONCAT(t.date_month,'/',t.date_day) as statisDate,
|
||||
<include refid="dataTypeChooseFilter"/>
|
||||
|
||||
Reference in New Issue
Block a user