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