Browse Source

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

zhongwei
ty 7 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); String currentMon = TimeUtils.getMon(year, mon);
Integer count=0; Integer count=0;
Map<Long, Map<String, Float>> powerMapThree = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); 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 (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) {
for (StationEntity stationEntity : stationEntityList) { for (StationEntity stationEntity : stationEntityList) {
if (stationEntity.getId().equals(deviceMap.getKey())) { 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); Integer currentYear = calendar.get(Calendar.YEAR);
if (year>currentYear-3) { if (year>currentYear-3) {
mainSystemMonitoringService.getElectricSituationByRedis(yearAndMonth, reportVOS, stationEntityList); mainSystemMonitoringService.getElectricSituationByRedis(yearAndMonth, reportVOS, stationEntityList);
log.info("电站发电情况"+reportVOS.toString());
}else { }else {
stationEntityList.forEach(stationEntity -> { stationEntityList.forEach(stationEntity -> {
List<StationRunReportVO> stationReportVOList = mainSystemMonitoringService.getElectricSituationV2(yearAndMonth, stationEntity.getCode()); List<StationRunReportVO> stationReportVOList = mainSystemMonitoringService.getElectricSituationV2(yearAndMonth, stationEntity.getCode());
reportVOS.addAll(stationReportVOList); reportVOS.addAll(stationReportVOList);
}); });
log.info("电站发电情况"+reportVOS.toString());
} }
getSumStationRunReport(reportVOS); getSumStationRunReport(reportVOS);
stationReportAllVo.setStationReportVOList(reportVOS); stationReportAllVo.setStationReportVOList(reportVOS);
log.info("电站发电量总览"+reportVOS.toString());
}catch (Exception e){ }catch (Exception e){
log.error("", e); log.error("getStationMonthReportV2电站发电量报错", e);
System.out.println(e); System.out.println(e);
}finally { }finally {
countDownLatch.countDown(); countDownLatch.countDown();
@ -523,11 +526,12 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
stationRunReportVO.setStationName("合计"); stationRunReportVO.setStationName("合计");
if (CollectionUtil.isNotEmpty(reportVOS)){ if (CollectionUtil.isNotEmpty(reportVOS)){
double sumPowerMonPlan = reportVOS.stream().mapToDouble(StationRunReportVO::getPowerMonPlan).sum(); 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(); 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)) { 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)); stationRunReportVO.setPowerMonRate(String.valueOf(powerMonRate));
}else { }else {
stationRunReportVO.setPowerMonRate("0.0"); 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(); double sumFinishPowerYear = reportVOS.stream().map(StationRunReportVO::getFinishPowerYear).mapToDouble(s -> Double.valueOf(s)).sum();
stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear)); stationRunReportVO.setFinishPowerYear(String.valueOf(sumFinishPowerYear));
if (!ObjectUtils.isEmpty(sumPowerYearPlan)){ 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)); stationRunReportVO.setPowerYearRate(String.valueOf(powerYearRate));
}else { }else {
stationRunReportVO.setPowerYearRate("0.0"); 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){ public static BigDecimal objDivide(String s){
BigDecimal bigDecimal = new BigDecimal(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; return res;
} }
} }

Loading…
Cancel
Save