|
@@ -11,7 +11,6 @@ import com.usky.demo.domain.EnergyItemTrendPointVO;
|
|
|
import com.usky.demo.domain.EnergyItemTrendQueryVO;
|
|
import com.usky.demo.domain.EnergyItemTrendQueryVO;
|
|
|
import com.usky.demo.domain.EnergyItemTrendResultVO;
|
|
import com.usky.demo.domain.EnergyItemTrendResultVO;
|
|
|
import com.usky.ems.domain.*;
|
|
import com.usky.ems.domain.*;
|
|
|
-import com.usky.ems.enums.EnergyTypeEnum;
|
|
|
|
|
import com.usky.ems.mapper.DmpProductMapper;
|
|
import com.usky.ems.mapper.DmpProductMapper;
|
|
|
import com.usky.ems.mapper.EmsDeviceMapper;
|
|
import com.usky.ems.mapper.EmsDeviceMapper;
|
|
|
import com.usky.ems.mapper.EmsEnergyItemCodeMapper;
|
|
import com.usky.ems.mapper.EmsEnergyItemCodeMapper;
|
|
@@ -834,9 +833,19 @@ public class EmsOverviewServiceImpl implements EmsOverviewService {
|
|
|
|
|
|
|
|
Map<Integer, BigDecimal> map = new HashMap();
|
|
Map<Integer, BigDecimal> map = new HashMap();
|
|
|
|
|
|
|
|
|
|
+ Map<Integer, EmsEnergyItemCode> rootItemByEnergyType = emsEnergyItemCodeMapper.selectList(
|
|
|
|
|
+ Wrappers.<EmsEnergyItemCode>lambdaQuery()
|
|
|
|
|
+ .eq(EmsEnergyItemCode::getParentCode, "0")
|
|
|
|
|
+ ).stream()
|
|
|
|
|
+ .filter(item -> item.getEnergyType() != null)
|
|
|
|
|
+ .collect(Collectors.toMap(EmsEnergyItemCode::getEnergyType, item -> item, (a, b) -> a));
|
|
|
|
|
+
|
|
|
for(Integer energyType : typeIds) {
|
|
for(Integer energyType : typeIds) {
|
|
|
if (energyType != 5) {
|
|
if (energyType != 5) {
|
|
|
- EnergyTypeEnum typeEnum = EnergyTypeEnum.get(energyType);
|
|
|
|
|
|
|
+ EmsEnergyItemCode itemCode = rootItemByEnergyType.get(energyType);
|
|
|
|
|
+ if (itemCode == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> productCodeList = dmpProductMapper.selectProductCodesByEnergyType(
|
|
List<String> productCodeList = dmpProductMapper.selectProductCodesByEnergyType(
|
|
@@ -845,7 +854,7 @@ public class EmsOverviewServiceImpl implements EmsOverviewService {
|
|
|
return resultMap;
|
|
return resultMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- BigDecimal data = sumEnergyByProductCodes(productCodeList, typeEnum.getCode(), startTime, endTime);
|
|
|
|
|
|
|
+ BigDecimal data = sumEnergyByProductCodes(productCodeList, itemCode.getIdentifier(), startTime, endTime);
|
|
|
map.put(energyType, data);
|
|
map.put(energyType, data);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -867,9 +876,13 @@ public class EmsOverviewServiceImpl implements EmsOverviewService {
|
|
|
BigDecimal co2Amount = coalAmount.multiply(new BigDecimal("2.4589")).setScale(2, RoundingMode.UP);
|
|
BigDecimal co2Amount = coalAmount.multiply(new BigDecimal("2.4589")).setScale(2, RoundingMode.UP);
|
|
|
coalTotal = coalTotal.add(coalAmount);
|
|
coalTotal = coalTotal.add(coalAmount);
|
|
|
co2Total = co2Total.add(co2Amount);
|
|
co2Total = co2Total.add(co2Amount);
|
|
|
- EnergyTypeEnum typeEnum = EnergyTypeEnum.get(energyType);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ EmsEnergyItemCode itemCode = rootItemByEnergyType.get(energyType);
|
|
|
|
|
+ if (itemCode == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
Map<String, Object> ratioMap = new HashMap();
|
|
Map<String, Object> ratioMap = new HashMap();
|
|
|
- ratioMap.put("name", typeEnum.getName());
|
|
|
|
|
|
|
+ ratioMap.put("name", itemCode.getName());
|
|
|
ratioMap.put("consume", con.multiply(coal).setScale(2, RoundingMode.UP));
|
|
ratioMap.put("consume", con.multiply(coal).setScale(2, RoundingMode.UP));
|
|
|
ratioMap.put("totalConsume", totalCon.multiply(coal).setScale(2, RoundingMode.UP));
|
|
ratioMap.put("totalConsume", totalCon.multiply(coal).setScale(2, RoundingMode.UP));
|
|
|
ratioList.add(ratioMap);
|
|
ratioList.add(ratioMap);
|