|
|
@ -1,5 +1,10 @@
|
|
|
|
package com.os.ems.report.service.impl;
|
|
|
|
package com.os.ems.report.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.os.common.utils.StringUtils;
|
|
|
|
|
|
|
|
import com.os.ems.base.domain.EmsBaseMonitorWorkUnit;
|
|
|
|
|
|
|
|
import com.os.ems.base.domain.EmsBaseWorkUnit;
|
|
|
|
|
|
|
|
import com.os.ems.base.mapper.EmsBaseMonitorWorkUnitMapper;
|
|
|
|
|
|
|
|
import com.os.ems.base.mapper.EmsBaseWorkUnitMapper;
|
|
|
|
import com.os.ems.report.domain.EnergyStatisticalReport;
|
|
|
|
import com.os.ems.report.domain.EnergyStatisticalReport;
|
|
|
|
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
|
|
|
|
import com.os.ems.report.domain.PeaksValleysConsumptionReport;
|
|
|
|
import com.os.ems.report.mapper.EmsReportMapper;
|
|
|
|
import com.os.ems.report.mapper.EmsReportMapper;
|
|
|
@ -7,8 +12,9 @@ import com.os.ems.report.service.IEmsReportService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -22,28 +28,84 @@ public class EmsReportServiceImpl implements IEmsReportService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private EmsReportMapper emsReportMapper;
|
|
|
|
private EmsReportMapper emsReportMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private EmsBaseMonitorWorkUnitMapper emsBaseMonitorWorkUnitMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private EmsBaseWorkUnitMapper emsBaseWorkUnitMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 统计能耗报表
|
|
|
|
* 统计能耗报表
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param hashMap
|
|
|
|
* @param hashMap
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap) {
|
|
|
|
public List<EnergyStatisticalReport> energyStatisticalReportList(Map hashMap) {
|
|
|
|
if (!hashMap.containsKey("dateType")){
|
|
|
|
if (!hashMap.containsKey("dateType") && !hashMap.containsKey("energyType")) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType"))));
|
|
|
|
hashMap.put("timeSub", Integer.parseInt(String.valueOf(hashMap.get("dateType"))));
|
|
|
|
return emsReportMapper.energyStatisticalReportList(hashMap);
|
|
|
|
List<EnergyStatisticalReport> reportList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Objects.equals(String.valueOf(hashMap.get("energyType")), "2")){
|
|
|
|
|
|
|
|
reportList = emsReportMapper.energyStatisticalDnbReportList(hashMap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return reportList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 峰平谷耗量报表
|
|
|
|
* 峰平谷耗量报表
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param hashMap
|
|
|
|
* @param hashMap
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<PeaksValleysConsumptionReport> peaksValleysConsumptionReportList(Map hashMap) {
|
|
|
|
public List<PeaksValleysConsumptionReport> peaksValleysConsumptionReportList(Map hashMap) {
|
|
|
|
|
|
|
|
if (!hashMap.containsKey("dateType")) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
return emsReportMapper.peaksValleysConsumptionReportList(hashMap);
|
|
|
|
return emsReportMapper.peaksValleysConsumptionReportList(hashMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 能源预览接口
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param hashMap
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<Map<String, Object>> energyPreviewReportList(Map hashMap) {
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (!hashMap.containsKey("startTime") || !hashMap.containsKey("endTime")) {
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EmsBaseWorkUnit workUnit = new EmsBaseWorkUnit();
|
|
|
|
|
|
|
|
List<EmsBaseWorkUnit> workUnits = emsBaseWorkUnitMapper.selectEmsBaseWorkUnitList(workUnit);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> selectMap = new HashMap<>();
|
|
|
|
|
|
|
|
selectMap.put("dateType", String.valueOf(hashMap.get("dateType")));
|
|
|
|
|
|
|
|
selectMap.put("energyType", String.valueOf(hashMap.get("energyType")));
|
|
|
|
|
|
|
|
selectMap.put("beginCollectTime", String.valueOf(hashMap.get("startTime")));
|
|
|
|
|
|
|
|
selectMap.put("endCollectTime", String.valueOf(hashMap.get("endTime")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (EmsBaseWorkUnit unit : workUnits) {
|
|
|
|
|
|
|
|
HashMap<String, Object> typeResultMap = new HashMap<>();
|
|
|
|
|
|
|
|
typeResultMap.put("unitName", unit.getWorkUnitName());
|
|
|
|
|
|
|
|
selectMap.put("workUnitCode", unit.getWorkUnitCode());
|
|
|
|
|
|
|
|
List<EnergyStatisticalReport> reportList = this.energyStatisticalReportList(selectMap);
|
|
|
|
|
|
|
|
BigDecimal expendSum = new BigDecimal(0);
|
|
|
|
|
|
|
|
for (EnergyStatisticalReport report : reportList) {
|
|
|
|
|
|
|
|
typeResultMap.put("expend" + report.getBeginTime(), report.getExpend());
|
|
|
|
|
|
|
|
expendSum = expendSum.add(report.getExpend());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
typeResultMap.put("expendSum", expendSum.toPlainString());
|
|
|
|
|
|
|
|
resultList.add(typeResultMap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|