Browse Source

修正:统计月报发电量格式

zhongwei
ty 6 months ago
parent
commit
8281f30cdd
  1. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java
  2. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java

@ -1360,6 +1360,7 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer
String currentMon = TimeUtils.getMon(year, mon);
Integer count=0;
Map<Long, Map<String, Float>> powerMapThree = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
log.info("Redis近三年发电量数据查询:"+powerMapThree);
for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) {
for (StationEntity stationEntity : stationEntityList) {
if (stationEntity.getId().equals(deviceMap.getKey())) {

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java

@ -344,16 +344,19 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
Integer currentYear = calendar.get(Calendar.YEAR);
if (year>currentYear-3) {
mainSystemMonitoringService.getElectricSituationByRedis(yearAndMonth, reportVOS, stationEntityList);
log.info("电站发电情况"+reportVOS.toString());
}else {
stationEntityList.forEach(stationEntity -> {
List<StationRunReportVO> stationReportVOList = mainSystemMonitoringService.getElectricSituationV2(yearAndMonth, stationEntity.getCode());
reportVOS.addAll(stationReportVOList);
});
log.info("电站发电情况"+reportVOS.toString());
}
getSumStationRunReport(reportVOS);
stationReportAllVo.setStationReportVOList(reportVOS);
log.info("电站发电量总览"+reportVOS.toString());
}catch (Exception e){
log.error("", e);
log.error("getStationMonthReportV2电站发电量报错", e);
System.out.println(e);
}finally {
countDownLatch.countDown();
@ -523,11 +526,12 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
stationRunReportVO.setStationName("合计");
if (CollectionUtil.isNotEmpty(reportVOS)){
double sumPowerMonPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerMonPlan).sum();
stationRunReportVO.setPowerMonPlan(sumPowerMonPlan);
stationRunReportVO.setPowerMonPlan(new BigDecimal(sumPowerMonPlan).setScale(2,BigDecimal.ROUND_UP).doubleValue());
double sumFinishPowerMon = reportVOS.stream().map(StationRunReportVO::getFinishPowerMon).mapToDouble(s -> Double.valueOf(s)).sum();
stationRunReportVO.setFinishPowerMon(String.valueOf(sumFinishPowerMon));
stationRunReportVO.setFinishPowerMon(new BigDecimal(sumFinishPowerMon).setScale(2,BigDecimal.ROUND_UP).toString());
if (!ObjectUtils.isEmpty(sumPowerMonPlan)) {
BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan)).setScale(2, BigDecimal.ROUND_UP);
BigDecimal powerMonRate = new BigDecimal(sumFinishPowerMon).divide(new BigDecimal(sumPowerMonPlan),4,BigDecimal.ROUND_UP)
.multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_UP);
stationRunReportVO.setPowerMonRate(String.valueOf(powerMonRate));
}else {
stationRunReportVO.setPowerMonRate("0.0");
@ -537,7 +541,8 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)).sum();
stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear));
if (!ObjectUtils.isEmpty(sumPowerYearPlan)){
BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan)).setScale(2, BigDecimal.ROUND_UP);
BigDecimal powerYearRate = new BigDecimal(sumFinishPowerYear).divide(new BigDecimal(sumPowerYearPlan),4,BigDecimal.ROUND_UP)
.multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_UP);
stationRunReportVO.setPowerYearRate(String.valueOf(powerYearRate));
}else {
stationRunReportVO.setPowerYearRate("0.0");

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/ObjectUtils.java

@ -85,7 +85,7 @@ public class ObjectUtils {
public static BigDecimal objDivide(String s){
BigDecimal bigDecimal = new BigDecimal(s);
BigDecimal res = bigDecimal.divide(new BigDecimal(10000)).setScale(2, BigDecimal.ROUND_UP);
BigDecimal res = bigDecimal.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2, BigDecimal.ROUND_UP);
return res;
}
}

Loading…
Cancel
Save