|
|
|
@ -1,14 +1,21 @@
|
|
|
|
|
package com.os.ems.report.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.os.common.constant.EmsConstants;
|
|
|
|
|
import com.os.common.utils.DateUtils;
|
|
|
|
|
import com.os.ems.base.domain.EmsBaseCollectDeviceInfo;
|
|
|
|
|
import com.os.ems.base.domain.EmsBaseMonitorInfo;
|
|
|
|
|
import com.os.ems.base.domain.EmsBaseWorkUnit;
|
|
|
|
|
import com.os.ems.base.mapper.EmsBaseCollectDeviceInfoMapper;
|
|
|
|
|
import com.os.ems.base.mapper.EmsBaseMonitorInfoMapper;
|
|
|
|
|
import com.os.ems.base.mapper.EmsBaseMonitorWorkUnitMapper;
|
|
|
|
|
import com.os.ems.base.mapper.EmsBaseWorkUnitMapper;
|
|
|
|
|
import com.os.ems.record.domain.EmsRecordAlarmData;
|
|
|
|
|
import com.os.ems.record.mapper.*;
|
|
|
|
|
import com.os.ems.report.domain.EnergyStatisticalReport;
|
|
|
|
|
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
|
|
|
|
|
import com.os.ems.report.domain.RealTimeDataBo;
|
|
|
|
|
import com.os.ems.report.mapper.EmsReportMapper;
|
|
|
|
|
import com.os.ems.report.mapper.EmsReportPointDnbMapper;
|
|
|
|
|
import com.os.ems.report.service.IEmsBoardService;
|
|
|
|
|
import com.os.ems.report.service.IEmsReportService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -48,9 +55,20 @@ public class EmsBoardServiceImpl implements IEmsBoardService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmsBaseMonitorWorkUnitMapper emsBaseMonitorWorkUnitMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmsReportPointDnbMapper emsReportPointDnbMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmsBaseWorkUnitMapper emsBaseWorkUnitMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmsBaseCollectDeviceInfoMapper emsBaseCollectDeviceInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmsBaseMonitorInfoMapper emsBaseMonitorInfoMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmsRecordAlarmDataMapper emsRecordAlarmDataMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 实时数据接口
|
|
|
|
@ -63,21 +81,179 @@ public class EmsBoardServiceImpl implements IEmsBoardService {
|
|
|
|
|
if (!hashMap.containsKey("monitorType")) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String energyType = String.valueOf(hashMap.get("monitorType"));
|
|
|
|
|
String monitorType = String.valueOf(hashMap.get("monitorType"));
|
|
|
|
|
List<RealTimeDataBo> reportList = new ArrayList<>();
|
|
|
|
|
if (Objects.equals(energyType, EmsConstants.EMS_ENERGY_TYPE_DNB)) {
|
|
|
|
|
if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_DNB)) {
|
|
|
|
|
reportList = emsRecordDnbInstantMapper.realTimeDataList(hashMap);
|
|
|
|
|
} else if (Objects.equals(energyType, EmsConstants.EMS_ENERGY_TYPE_WATER)) {
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_WATER)) {
|
|
|
|
|
reportList = emsRecordWaterInstantMapper.realTimeDataList(hashMap);
|
|
|
|
|
} else if (Objects.equals(energyType, EmsConstants.EMS_ENERGY_TYPE_STEAM)) {
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_STEAM)) {
|
|
|
|
|
reportList = emsRecordSteamInstantMapper.realTimeDataList(hashMap);
|
|
|
|
|
} else if (Objects.equals(energyType, EmsConstants.EMS_ENERGY_TYPE_Air)) {
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_Air)) {
|
|
|
|
|
reportList = emsRecordAirInstantMapper.realTimeDataList(hashMap);
|
|
|
|
|
} else if (Objects.equals(energyType, EmsConstants.EMS_ENERGY_TYPE_NITROGEN)) {
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_NITROGEN)) {
|
|
|
|
|
reportList = emsRecordNitrogenInstantMapper.realTimeDataList(hashMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return reportList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 厂区看板-设备总览接口
|
|
|
|
|
* @param hashMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> deviceOverview(Map hashMap) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
EmsBaseCollectDeviceInfo deviceInfo = new EmsBaseCollectDeviceInfo();
|
|
|
|
|
deviceInfo.setIsFlag(EmsConstants.EMS_IS_FLAG_YES);
|
|
|
|
|
List<EmsBaseCollectDeviceInfo> deviceInfoList = emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoList(deviceInfo);
|
|
|
|
|
EmsBaseMonitorInfo monitorInfo = new EmsBaseMonitorInfo();
|
|
|
|
|
monitorInfo.setIsAmmeter(EmsConstants.EMS_IS_AMMETER_NO);
|
|
|
|
|
List<EmsBaseMonitorInfo> monitorInfoList = emsBaseMonitorInfoMapper.selectEmsBaseMonitorInfoList(monitorInfo);
|
|
|
|
|
Long dnbSum = 0L;
|
|
|
|
|
Long waterSum = 0L;
|
|
|
|
|
Long steamSum = 0L;
|
|
|
|
|
Long airSum = 0L;
|
|
|
|
|
Long nitrogenSum = 0L;
|
|
|
|
|
for (EmsBaseMonitorInfo emsBaseMonitorInfo : monitorInfoList) {
|
|
|
|
|
String monitorType = String.valueOf(emsBaseMonitorInfo.getMonitorType());
|
|
|
|
|
if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_DNB)) {
|
|
|
|
|
dnbSum++;
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_WATER)) {
|
|
|
|
|
waterSum++;
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_STEAM)) {
|
|
|
|
|
steamSum++;
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_Air)) {
|
|
|
|
|
airSum++;
|
|
|
|
|
} else if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_NITROGEN)) {
|
|
|
|
|
nitrogenSum++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.put("deviceSum", deviceInfoList.size());
|
|
|
|
|
result.put("dnbSum", dnbSum);
|
|
|
|
|
result.put("waterSum", waterSum);
|
|
|
|
|
result.put("steamSum", steamSum);
|
|
|
|
|
result.put("airSum", airSum);
|
|
|
|
|
result.put("nitrogenSum", nitrogenSum);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 厂区看板-本月用电排行、用电分项接口
|
|
|
|
|
* @param hashMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> monthConsumptionRanking(Map hashMap) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
if (!hashMap.containsKey("monitorType")) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String monitorType = String.valueOf(hashMap.get("monitorType"));
|
|
|
|
|
List<HashMap<String, String>> reportList = new ArrayList<>();
|
|
|
|
|
Map<String, String> dateTimeRanges = DateUtils.getDateTimeRanges();
|
|
|
|
|
String monthStart = dateTimeRanges.get("monthStart");
|
|
|
|
|
String monthEnd = dateTimeRanges.get("currentTime");
|
|
|
|
|
hashMap.put("beginCollectTime", monthStart);
|
|
|
|
|
hashMap.put("endCollectTime", monthEnd);
|
|
|
|
|
if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_DNB)) {
|
|
|
|
|
reportList = emsReportPointDnbMapper.selectWorkUnitTotalConsumption(hashMap);
|
|
|
|
|
}
|
|
|
|
|
result.put("ranking", reportList);
|
|
|
|
|
result.put("statistics", reportList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 厂区看板-近七天峰平谷耗量
|
|
|
|
|
* @param hashMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> peaksValleysConsumption(Map hashMap) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
List<HashMap<String, String>> reportList = emsReportPointDnbMapper.peaksValleysConsumption(hashMap);
|
|
|
|
|
result.put("reportList", reportList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 厂区看板-五种能耗统计
|
|
|
|
|
* @param hashMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> fiveConsumptionStatistics(Map hashMap) {
|
|
|
|
|
HashMap<String, Object> result = new LinkedHashMap<>();
|
|
|
|
|
result.put("dnbSum", new BigDecimal(String.format("%.2f", Math.random() * Math.round(10000 * Math.random()))));
|
|
|
|
|
result.put("waterSum", new BigDecimal(String.format("%.2f", Math.random() * Math.round(10000 * Math.random()))));
|
|
|
|
|
result.put("steamSum", new BigDecimal(String.format("%.2f", Math.random() * Math.round(10000 * Math.random()))));
|
|
|
|
|
result.put("airSum", new BigDecimal(String.format("%.2f", Math.random() * Math.round(10000 * Math.random()))));
|
|
|
|
|
result.put("nitrogenSum", new BigDecimal(String.format("%.2f", Math.random() * Math.round(10000 * Math.random()))));
|
|
|
|
|
result.put("dnbRate", new BigDecimal(String.format("%.2f", 100 * Math.random())));
|
|
|
|
|
result.put("waterRate", new BigDecimal(String.format("%.2f", 100 * Math.random())));
|
|
|
|
|
result.put("steamRate", new BigDecimal(String.format("%.2f", -100 * Math.random())));
|
|
|
|
|
result.put("airRate", new BigDecimal(String.format("%.2f", 100 * Math.random())));
|
|
|
|
|
result.put("nitrogenRate", new BigDecimal(String.format("%.2f", -100 * Math.random())));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 厂区看板-能耗统计柱状图
|
|
|
|
|
* @param hashMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> energyConsumptionStatistics(Map hashMap) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
if (!hashMap.containsKey("monitorType") || !hashMap.containsKey("dateType")) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String monitorType = String.valueOf(hashMap.get("monitorType"));
|
|
|
|
|
String dateType = String.valueOf(hashMap.get("dateType"));
|
|
|
|
|
List<HashMap<String, String>> reportList = new ArrayList<>();
|
|
|
|
|
Map<String, String> dateTimeRanges = DateUtils.getDateTimeRanges();
|
|
|
|
|
String currentTime = dateTimeRanges.get("currentTime");
|
|
|
|
|
String todayStart = dateTimeRanges.get("todayStart");
|
|
|
|
|
String monthStart = dateTimeRanges.get("monthStart");
|
|
|
|
|
String yearStart = dateTimeRanges.get("yearStart");
|
|
|
|
|
|
|
|
|
|
if (dateType.equals("day")){
|
|
|
|
|
hashMap.put("beginCollectTime", todayStart);
|
|
|
|
|
hashMap.put("endCollectTime", currentTime);
|
|
|
|
|
hashMap.put("timeSub", 19);
|
|
|
|
|
} else if (dateType.equals("month")){
|
|
|
|
|
hashMap.put("beginCollectTime", monthStart);
|
|
|
|
|
hashMap.put("endCollectTime", currentTime);
|
|
|
|
|
hashMap.put("timeSub", 10);
|
|
|
|
|
} else if (dateType.equals("year")){
|
|
|
|
|
hashMap.put("beginCollectTime", yearStart);
|
|
|
|
|
hashMap.put("endCollectTime", currentTime);
|
|
|
|
|
hashMap.put("timeSub", 7);
|
|
|
|
|
}
|
|
|
|
|
if (Objects.equals(monitorType, EmsConstants.EMS_ENERGY_TYPE_DNB)) {
|
|
|
|
|
reportList = emsReportPointDnbMapper.selectWorkUnitDateConsumption(hashMap);
|
|
|
|
|
}
|
|
|
|
|
result.put("reportList", reportList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 厂区看板-实时报警
|
|
|
|
|
* @param hashMap
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public HashMap<String, Object> realTimeAlarm(Map hashMap) {
|
|
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
|
|
EmsRecordAlarmData emsRecordAlarmData = new EmsRecordAlarmData();
|
|
|
|
|
emsRecordAlarmData.setAlarmStatus(0L);
|
|
|
|
|
List<EmsRecordAlarmData> alarmDataList = emsRecordAlarmDataMapper.selectEmsRecordAlarmDataList(emsRecordAlarmData);
|
|
|
|
|
result.put("alarmDataList", alarmDataList);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|