|
|
@ -13,6 +13,8 @@ import jakarta.annotation.Resource; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.CountDownLatch; |
|
|
|
import java.util.concurrent.CountDownLatch; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
@ -157,7 +159,7 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
consumptionAnalyzeEntities = energyMapper.queryManyTable(vo.getStartTime(), vo.getEndTime(), lastTableName.get(), curTableName.get(), getTimeLen(vo.getTimeType()), null); |
|
|
|
consumptionAnalyzeEntities = energyMapper.queryManyTable(vo.getStartTime(), vo.getEndTime(), lastTableName.get(), curTableName.get(), getTimeLen(vo.getTimeType()), null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null == consumptionAnalyzeEntities || consumptionAnalyzeEntities.size() == 0) { |
|
|
|
if (null == consumptionAnalyzeEntities || consumptionAnalyzeEntities.isEmpty()) { |
|
|
|
latch.countDown(); |
|
|
|
latch.countDown(); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -232,24 +234,9 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
.collect(Collectors.groupingBy(ConsumptionAnalyze::getDeviceType, HashMap::new, Collectors |
|
|
|
.collect(Collectors.groupingBy(ConsumptionAnalyze::getDeviceType, HashMap::new, Collectors |
|
|
|
.collectingAndThen(Collectors.toList(), |
|
|
|
.collectingAndThen(Collectors.toList(), |
|
|
|
list -> list.stream().sorted(Comparator.comparing(ConsumptionAnalyze::getTimeStr)).collect(Collectors.toList())))); |
|
|
|
list -> list.stream().sorted(Comparator.comparing(ConsumptionAnalyze::getTimeStr)).collect(Collectors.toList())))); |
|
|
|
// List<ConsumptionAnalyzeEntity> meterLineData = new ArrayList<>();
|
|
|
|
|
|
|
|
// List<ConsumptionAnalyzeEntity> coldLineData = new ArrayList<>();
|
|
|
|
|
|
|
|
// List<ConsumptionAnalyzeEntity> copLineData = new ArrayList<>();
|
|
|
|
|
|
|
|
List<ConsumptionAnalyze> efrColdLineData = new ArrayList<>(); |
|
|
|
List<ConsumptionAnalyze> efrColdLineData = new ArrayList<>(); |
|
|
|
List<ConsumptionAnalyze> efrMeterLineData = new ArrayList<>(); |
|
|
|
List<ConsumptionAnalyze> efrMeterLineData = new ArrayList<>(); |
|
|
|
for (Map.Entry<String, List<ConsumptionAnalyze>> nmap : collectLine.entrySet()) { |
|
|
|
for (Map.Entry<String, List<ConsumptionAnalyze>> nmap : collectLine.entrySet()) { |
|
|
|
// // 获取电表的值
|
|
|
|
|
|
|
|
// if (nmap.getKey().equalsIgnoreCase("meter")) {
|
|
|
|
|
|
|
|
// meterLineData = nmap.getValue();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 获取冷量计的值
|
|
|
|
|
|
|
|
// if (nmap.getKey().equalsIgnoreCase("cloud")) {
|
|
|
|
|
|
|
|
// coldLineData = nmap.getValue();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 获取cop的值
|
|
|
|
|
|
|
|
// if (nmap.getKey().equalsIgnoreCase("cop")) {
|
|
|
|
|
|
|
|
// copLineData = nmap.getValue();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 获取瞬时冷量计的值
|
|
|
|
// 获取瞬时冷量计的值
|
|
|
|
if (nmap.getKey().equalsIgnoreCase("efrCloud")) { |
|
|
|
if (nmap.getKey().equalsIgnoreCase("efrCloud")) { |
|
|
|
efrColdLineData = nmap.getValue(); |
|
|
|
efrColdLineData = nmap.getValue(); |
|
|
@ -262,12 +249,7 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
String[] lineTimeStrArr = efrMeterLineData.stream() |
|
|
|
String[] lineTimeStrArr = efrMeterLineData.stream() |
|
|
|
.map(ConsumptionAnalyze::getTimeStr) |
|
|
|
.map(ConsumptionAnalyze::getTimeStr) |
|
|
|
.toArray(String[]::new); |
|
|
|
.toArray(String[]::new); |
|
|
|
// String[] lineMeterArr = meterLineData.stream()
|
|
|
|
|
|
|
|
// .map(ConsumptionAnalyzeEntity::getCurValue)
|
|
|
|
|
|
|
|
// .toArray(String[]::new);
|
|
|
|
|
|
|
|
String[] lineInstantaneousMeterArr = getArr(efrMeterLineData, lineTimeStrArr); |
|
|
|
String[] lineInstantaneousMeterArr = getArr(efrMeterLineData, lineTimeStrArr); |
|
|
|
// String[] lineColdArr = getArr(coldLineData, lineTimeStrArr);
|
|
|
|
|
|
|
|
// String[] lineCopArr = getArr(copLineData, lineTimeStrArr);
|
|
|
|
|
|
|
|
String[] lineEfrColdArr = getArr(efrColdLineData, lineTimeStrArr); |
|
|
|
String[] lineEfrColdArr = getArr(efrColdLineData, lineTimeStrArr); |
|
|
|
String[] lineCopArr = new String[efrMeterLineData.size()]; |
|
|
|
String[] lineCopArr = new String[efrMeterLineData.size()]; |
|
|
|
// 计算瞬时COP=制冷量/耗电量
|
|
|
|
// 计算瞬时COP=制冷量/耗电量
|
|
|
@ -285,8 +267,6 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
// 折现图数据
|
|
|
|
// 折现图数据
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("lineTimeStrArr", lineTimeStrArr); |
|
|
|
map.put("lineTimeStrArr", lineTimeStrArr); |
|
|
|
// map.put("lineMeterArr", lineMeterArr);
|
|
|
|
|
|
|
|
// map.put("lineColdArr", lineColdArr);
|
|
|
|
|
|
|
|
map.put("lineCopArr", lineCopArr); |
|
|
|
map.put("lineCopArr", lineCopArr); |
|
|
|
map.put("lineInstantaneousColdArr", lineEfrColdArr); |
|
|
|
map.put("lineInstantaneousColdArr", lineEfrColdArr); |
|
|
|
map.put("lineInstantaneousMeterArr", lineInstantaneousMeterArr); |
|
|
|
map.put("lineInstantaneousMeterArr", lineInstantaneousMeterArr); |
|
|
@ -370,9 +350,10 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
String endTime = vo.getEndTime(); |
|
|
|
String endTime = vo.getEndTime(); |
|
|
|
String deviceType = vo.getParamType(); |
|
|
|
String deviceType = vo.getParamType(); |
|
|
|
if ("cop".equalsIgnoreCase(vo.getParamType())) { |
|
|
|
if ("cop".equalsIgnoreCase(vo.getParamType())) { |
|
|
|
lastTableName = "data_min_cop"; |
|
|
|
return calcCopYoyData(vo); |
|
|
|
curTableName = "data_min_cop"; |
|
|
|
// lastTableName = "data_min_cop";
|
|
|
|
deviceType = "system"; |
|
|
|
// curTableName = "data_min_cop";
|
|
|
|
|
|
|
|
// deviceType = "system";
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
lastTableName = lastTableName+startTime.substring(0,4); |
|
|
|
lastTableName = lastTableName+startTime.substring(0,4); |
|
|
|
curTableName = curTableName+endTime.substring(0,4); |
|
|
|
curTableName = curTableName+endTime.substring(0,4); |
|
|
@ -408,6 +389,146 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
return getConsumptionDTOHttpResult(consumptionAnalyzeEntities, "yoy"); |
|
|
|
return getConsumptionDTOHttpResult(consumptionAnalyzeEntities, "yoy"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AjaxResult calcCopYoyData(EnergyConsumptionVO vo) { |
|
|
|
|
|
|
|
// 获取冷量读数
|
|
|
|
|
|
|
|
vo.setParamType("cloud"); |
|
|
|
|
|
|
|
AjaxResult cloudData = yoy(vo); |
|
|
|
|
|
|
|
EnergyConsumptionDTO cloudEnergyData = (EnergyConsumptionDTO) cloudData.get("data"); |
|
|
|
|
|
|
|
if (cloudEnergyData == null) { |
|
|
|
|
|
|
|
return AjaxResult.error(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取电量读数
|
|
|
|
|
|
|
|
vo.setParamType("meter"); |
|
|
|
|
|
|
|
AjaxResult meterData = yoy(vo); |
|
|
|
|
|
|
|
EnergyConsumptionDTO meterEnergyData = (EnergyConsumptionDTO) meterData.get("data");; |
|
|
|
|
|
|
|
if (meterEnergyData == null) { |
|
|
|
|
|
|
|
return AjaxResult.error(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 计算COP值
|
|
|
|
|
|
|
|
return getEnergyConsumptionDTOHttpResult(meterEnergyData, cloudEnergyData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static AjaxResult getEnergyConsumptionDTOHttpResult(EnergyConsumptionDTO meterEnergyData, EnergyConsumptionDTO cloudEnergyData) { |
|
|
|
|
|
|
|
// 计算COP值
|
|
|
|
|
|
|
|
EnergyConsumptionDTO energyConsumptionDTO = new EnergyConsumptionDTO(); |
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// 获取冷量数据
|
|
|
|
|
|
|
|
List<Map<String, Object>> cloudListData = cloudEnergyData.getData(); |
|
|
|
|
|
|
|
String[] cloudCurData = new String[cloudListData.size()]; |
|
|
|
|
|
|
|
String[] cloudLastData = new String[cloudListData.size()]; |
|
|
|
|
|
|
|
for (Map<String, Object> cloudListDatum : cloudListData) { |
|
|
|
|
|
|
|
if (cloudListDatum.get("curValue") != null) { |
|
|
|
|
|
|
|
cloudCurData = (String[]) cloudListDatum.get("curValue"); |
|
|
|
|
|
|
|
if (cloudCurData == null) { |
|
|
|
|
|
|
|
cloudCurData = new String[cloudListData.size()]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (cloudListDatum.get("lastValue") != null) { |
|
|
|
|
|
|
|
cloudLastData = (String[]) cloudListDatum.get("curValue"); |
|
|
|
|
|
|
|
if (cloudLastData == null) { |
|
|
|
|
|
|
|
cloudLastData = new String[cloudListData.size()]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取电量数据
|
|
|
|
|
|
|
|
List<Map<String, Object>> meterListData = meterEnergyData.getData(); |
|
|
|
|
|
|
|
String[] meterCurData = new String[meterListData.size()]; |
|
|
|
|
|
|
|
String[] meterLastData = new String[meterListData.size()]; |
|
|
|
|
|
|
|
for (Map<String, Object> meterListDatum : meterListData) { |
|
|
|
|
|
|
|
if (meterListDatum.get("curValue") != null) { |
|
|
|
|
|
|
|
meterCurData = (String[]) meterListDatum.get("curValue"); |
|
|
|
|
|
|
|
if (meterCurData == null) { |
|
|
|
|
|
|
|
meterCurData = new String[meterListData.size()]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (meterListDatum.get("lastValue") != null) { |
|
|
|
|
|
|
|
meterLastData = (String[]) meterListDatum.get("curValue"); |
|
|
|
|
|
|
|
if (meterLastData == null) { |
|
|
|
|
|
|
|
meterLastData = new String[meterListData.size()]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化数据参数,当其中某个参数为空时,初始化数据为0
|
|
|
|
|
|
|
|
String[] timeA = cloudEnergyData.getTimes(); |
|
|
|
|
|
|
|
String[] timeB = meterEnergyData.getTimes(); |
|
|
|
|
|
|
|
List<String> timeAList = new ArrayList<>(Arrays.asList(timeA)); |
|
|
|
|
|
|
|
List<String> cloudCurDataList = new ArrayList<>(Arrays.asList(cloudCurData)); |
|
|
|
|
|
|
|
List<String> cloudLastDataList = new ArrayList<>(Arrays.asList(cloudLastData)); |
|
|
|
|
|
|
|
List<String> timeBList = new ArrayList<>(Arrays.asList(timeB)); |
|
|
|
|
|
|
|
List<String> meterCurDataList = new ArrayList<>(Arrays.asList(meterCurData)); |
|
|
|
|
|
|
|
List<String> meterLastDataList = new ArrayList<>(Arrays.asList(meterLastData)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (timeAList.size() < timeBList.size()) { |
|
|
|
|
|
|
|
for (String time : timeBList) { |
|
|
|
|
|
|
|
if (!timeAList.contains(time)) { |
|
|
|
|
|
|
|
timeAList.add(time); |
|
|
|
|
|
|
|
cloudCurDataList.add("0"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
meterEnergyData.setTimes(timeAList.toArray(new String[0])); |
|
|
|
|
|
|
|
cloudCurData = cloudCurDataList.toArray(new String[0]); |
|
|
|
|
|
|
|
cloudLastData = cloudLastDataList.toArray(new String[0]); |
|
|
|
|
|
|
|
} else if (timeBList.size() < timeAList.size()) { |
|
|
|
|
|
|
|
for (String time : timeAList) { |
|
|
|
|
|
|
|
if (!timeBList.contains(time)) { |
|
|
|
|
|
|
|
timeBList.add(time); |
|
|
|
|
|
|
|
meterCurDataList.add("0"); |
|
|
|
|
|
|
|
meterLastDataList.add("0"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
meterEnergyData.setTimes(timeBList.toArray(new String[0])); |
|
|
|
|
|
|
|
meterCurData = meterCurDataList.toArray(new String[0]); |
|
|
|
|
|
|
|
meterLastData = meterLastDataList.toArray(new String[0]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
energyConsumptionDTO.setTitles(meterEnergyData.getTitles()); |
|
|
|
|
|
|
|
energyConsumptionDTO.setTimes(meterEnergyData.getTimes()); |
|
|
|
|
|
|
|
energyConsumptionDTO.setLineTimes(meterEnergyData.getLineTimes()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 直接两个相除,保留两位小数
|
|
|
|
|
|
|
|
if (cloudCurData.length == meterCurData.length) { |
|
|
|
|
|
|
|
String[] copMap = new String[meterCurData.length]; |
|
|
|
|
|
|
|
String[] copLastMap = new String[meterCurData.length]; |
|
|
|
|
|
|
|
String[] yoyMap = new String[meterCurData.length]; |
|
|
|
|
|
|
|
for (int i = 0; i < meterCurData.length; i++) { |
|
|
|
|
|
|
|
String curValue = StringUtils.isBlank(cloudCurData[i]) ? "0" : cloudCurData[i]; |
|
|
|
|
|
|
|
String lastValue = cloudLastData == null || StringUtils.isBlank(cloudLastData[i]) ? "0" : cloudLastData[i]; |
|
|
|
|
|
|
|
String curMeterValue = StringUtils.isBlank(meterCurData[i]) ? "0" : meterCurData[i]; |
|
|
|
|
|
|
|
String lastMeterValue = meterLastData == null || StringUtils.isBlank(meterLastData[i]) ? "0" : meterLastData[i]; |
|
|
|
|
|
|
|
String curCop = "0.00"; |
|
|
|
|
|
|
|
if (StringUtils.isBlank(curMeterValue) || new BigDecimal(curMeterValue).compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
|
|
|
|
curCop = "0.00"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
curCop = new BigDecimal(curValue).divide(new BigDecimal(curMeterValue), 2, RoundingMode.HALF_UP).toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String lastCop = "0.00"; |
|
|
|
|
|
|
|
if (StringUtils.isBlank(lastMeterValue) || new BigDecimal(lastMeterValue).compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
|
|
|
|
lastCop = "0.00"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
lastCop = new BigDecimal(lastValue).divide(new BigDecimal(lastMeterValue), 2, RoundingMode.HALF_UP).toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 同比操作
|
|
|
|
|
|
|
|
String yoy = "0.00%"; |
|
|
|
|
|
|
|
if (new BigDecimal(lastCop).compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
|
|
|
|
yoy = "0.00%"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
yoy = new BigDecimal(curCop).subtract(new BigDecimal(lastCop)).divide(new BigDecimal(lastCop), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).toString() + "%"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
copMap[i] = curCop; |
|
|
|
|
|
|
|
copLastMap[i] = lastCop; |
|
|
|
|
|
|
|
yoyMap[i] = yoy; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
energyConsumptionDTO.setData(Arrays.asList( |
|
|
|
|
|
|
|
new HashMap<String, Object>() {{ |
|
|
|
|
|
|
|
put("curValue", copMap); |
|
|
|
|
|
|
|
put("lastValue", copLastMap); |
|
|
|
|
|
|
|
put("yoy", yoyMap); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return AjaxResult.success(energyConsumptionDTO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public AjaxResult mom(EnergyConsumptionVO vo) { |
|
|
|
public AjaxResult mom(EnergyConsumptionVO vo) { |
|
|
|
List<ConsumptionAnalyze> consumptionAnalyzeEntities = null; |
|
|
|
List<ConsumptionAnalyze> consumptionAnalyzeEntities = null; |
|
|
@ -420,8 +541,9 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
String tableName = "data_"+vo.getTimeType(); |
|
|
|
String tableName = "data_"+vo.getTimeType(); |
|
|
|
// 计算COP值(后期有一个表存储)
|
|
|
|
// 计算COP值(后期有一个表存储)
|
|
|
|
if (!StringUtils.isBlank(vo.getParamType()) && vo.getParamType().equalsIgnoreCase("cop")) { |
|
|
|
if (!StringUtils.isBlank(vo.getParamType()) && vo.getParamType().equalsIgnoreCase("cop")) { |
|
|
|
tableName = "data_min_cop"; |
|
|
|
// tableName = "data_min_cop";
|
|
|
|
deviceType = "system"; |
|
|
|
// deviceType = "system";
|
|
|
|
|
|
|
|
return calcCopMomData(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
consumptionAnalyzeEntities = energyMapper.queryMonthAndYearMom(vo.getStartTime(), vo.getEndTime(), startTime, endTime, tableName, getTimeLen(vo.getTimeType()), deviceType, vo.getTimeType()); |
|
|
|
consumptionAnalyzeEntities = energyMapper.queryMonthAndYearMom(vo.getStartTime(), vo.getEndTime(), startTime, endTime, tableName, getTimeLen(vo.getTimeType()), deviceType, vo.getTimeType()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -430,9 +552,10 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
String tableName2 = "data_"+vo.getTimeType()+vo.getEndTime().substring(0, 4); |
|
|
|
String tableName2 = "data_"+vo.getTimeType()+vo.getEndTime().substring(0, 4); |
|
|
|
// 计算COP值(后期有一个表存储)
|
|
|
|
// 计算COP值(后期有一个表存储)
|
|
|
|
if (!StringUtils.isBlank(vo.getParamType()) && vo.getParamType().equalsIgnoreCase("cop")) { |
|
|
|
if (!StringUtils.isBlank(vo.getParamType()) && vo.getParamType().equalsIgnoreCase("cop")) { |
|
|
|
tableName1 = "data_min_cop"; |
|
|
|
// tableName1 = "data_min_cop";
|
|
|
|
tableName2 = "data_min_cop"; |
|
|
|
// tableName2 = "data_min_cop";
|
|
|
|
deviceType = "system"; |
|
|
|
// deviceType = "system";
|
|
|
|
|
|
|
|
return calcCopMomData(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
if (tableName1.equalsIgnoreCase(tableName2)) { |
|
|
|
if (tableName1.equalsIgnoreCase(tableName2)) { |
|
|
|
// 单表查询
|
|
|
|
// 单表查询
|
|
|
@ -445,6 +568,25 @@ public class EnergyServiceImpl implements IEnergyService { |
|
|
|
return getConsumptionDTOHttpResult(consumptionAnalyzeEntities, "mom"); |
|
|
|
return getConsumptionDTOHttpResult(consumptionAnalyzeEntities, "mom"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AjaxResult calcCopMomData(EnergyConsumptionVO vo) { |
|
|
|
|
|
|
|
// 获取冷量读数
|
|
|
|
|
|
|
|
vo.setParamType("cloud"); |
|
|
|
|
|
|
|
AjaxResult cloudData = mom(vo); |
|
|
|
|
|
|
|
EnergyConsumptionDTO cloudEnergyData = (EnergyConsumptionDTO) cloudData.get("data"); |
|
|
|
|
|
|
|
if (cloudEnergyData == null) { |
|
|
|
|
|
|
|
return AjaxResult.error(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取电量读数
|
|
|
|
|
|
|
|
vo.setParamType("meter"); |
|
|
|
|
|
|
|
AjaxResult meterData = mom(vo); |
|
|
|
|
|
|
|
EnergyConsumptionDTO meterEnergyData = (EnergyConsumptionDTO) meterData.get("data"); |
|
|
|
|
|
|
|
if (meterEnergyData == null) { |
|
|
|
|
|
|
|
return AjaxResult.error(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return getEnergyConsumptionDTOHttpResult(meterEnergyData, cloudEnergyData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public AjaxResult yoyMom(EnergyConsumptionVO vo) { |
|
|
|
public AjaxResult yoyMom(EnergyConsumptionVO vo) { |
|
|
|
// 多线程分别求出yoy和mom
|
|
|
|
// 多线程分别求出yoy和mom
|
|
|
|