|
|
@ -1,27 +1,45 @@ |
|
|
|
package com.hnac.hzims.operational.main.service.impl; |
|
|
|
package com.hnac.hzims.operational.main.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.entity.ImageEntity; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.message.dto.MailPushDto; |
|
|
|
import com.hnac.hzims.message.dto.MailPushDto; |
|
|
|
import com.hnac.hzims.message.fegin.IPushMsgClient; |
|
|
|
import com.hnac.hzims.message.fegin.IPushMsgClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.service.IAreaMonthReportService; |
|
|
|
import com.hnac.hzims.operational.main.service.IAreaMonthReportService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; |
|
|
|
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService; |
|
|
|
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService; |
|
|
|
import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.MaintainVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.MaintainVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.OverhaulVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.OverhaulVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.report.vo.CheckChartVo; |
|
|
|
import com.hnac.hzims.operational.report.vo.DutyDefectVO; |
|
|
|
import com.hnac.hzims.operational.report.vo.DutyDefectVO; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.report.vo.MonPowerPercentageVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.report.vo.TicketChartCell; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.util.JFreeUtil; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.util.TimeUtils; |
|
|
|
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; |
|
|
|
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; |
|
|
|
import com.hnac.hzims.safeproduct.feign.ISafeCheckClient; |
|
|
|
import com.hnac.hzims.safeproduct.feign.ISafeCheckClient; |
|
|
|
import com.hnac.hzims.safeproduct.feign.ISafeEquipmentTrialClient; |
|
|
|
import com.hnac.hzims.safeproduct.feign.ISafeEquipmentTrialClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
|
|
|
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient; |
|
|
|
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient; |
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; |
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient; |
|
|
|
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.poi.hssf.usermodel.*; |
|
|
|
import org.apache.poi.hssf.usermodel.*; |
|
|
|
import org.apache.poi.hssf.util.HSSFColor; |
|
|
|
import org.apache.poi.hssf.util.HSSFColor; |
|
|
@ -78,6 +96,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
|
|
|
|
private final SideHustleServiceImpl sideHustleService; |
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
|
|
|
private final AnalyseDataServiceImpl analyseDataService; |
|
|
|
|
|
|
|
@NotNull |
|
|
|
|
|
|
|
private final IMainSystemMonitoringService mainSystemMonitoringService; |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private final ISysClient sysClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private final IUserClient userClient; |
|
|
|
private final IUserClient userClient; |
|
|
@ -93,10 +117,15 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
private final ISafeCheckClient safeCheckClient; |
|
|
|
private final ISafeCheckClient safeCheckClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.area.report}") |
|
|
|
@Value("${hzims.operation.area.report}") |
|
|
|
private String area_month_report_key; |
|
|
|
private String area_month_report_key; |
|
|
|
|
|
|
|
|
|
|
|
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data"; |
|
|
|
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data"; |
|
|
|
|
|
|
|
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; |
|
|
|
|
|
|
|
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; |
|
|
|
|
|
|
|
private final static String recent_year_power_data = "hzims:operation:key:power:data"; |
|
|
|
|
|
|
|
|
|
|
|
// 线程数量
|
|
|
|
// 线程数量
|
|
|
|
private final static int POOL_QUANTITY = 4; |
|
|
|
private final static int POOL_QUANTITY = 4; |
|
|
@ -172,6 +201,449 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
return R.data("success"); |
|
|
|
return R.data("success"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Integer date, Long deptId) { |
|
|
|
|
|
|
|
R<String> deptNameR = sysClient.getDeptName(deptId); |
|
|
|
|
|
|
|
if (!deptNameR.isSuccess()) { |
|
|
|
|
|
|
|
return R.fail("暂无该机构"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String deptName = deptNameR.getData(); |
|
|
|
|
|
|
|
R<List<Dept>> deptR = sysClient.getDeptByType("200000", deptId, 4); |
|
|
|
|
|
|
|
if (!deptR.isSuccess()||deptR.getData()==null) { |
|
|
|
|
|
|
|
return R.fail("该机构不包含水站信息"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Dept> deptList = deptR.getData().stream().filter(s -> s.getStationId() != null).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (deptList==null) { |
|
|
|
|
|
|
|
return R.fail("该机构不包含水站信息"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Long> deptIds = deptList.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//其它普通数据
|
|
|
|
|
|
|
|
map.put("year", year); |
|
|
|
|
|
|
|
Integer yearBefore = year - 1; |
|
|
|
|
|
|
|
map.put("yearBefore", yearBefore); |
|
|
|
|
|
|
|
map.put("month", month); |
|
|
|
|
|
|
|
Integer monthBefore = month - 1; |
|
|
|
|
|
|
|
map.put("monthBefore", monthBefore); |
|
|
|
|
|
|
|
map.put("date", date); |
|
|
|
|
|
|
|
map.put("commissionTime", "commissionTime"); |
|
|
|
|
|
|
|
map.put("stationName", deptName); |
|
|
|
|
|
|
|
// 今年年度
|
|
|
|
|
|
|
|
String yearStart = TimeUtils.getYear(year); |
|
|
|
|
|
|
|
String yearEnd = TimeUtils.getYearEnd(year); |
|
|
|
|
|
|
|
String yearEndV2 = TimeUtils.getYearEndV2(year); |
|
|
|
|
|
|
|
//去年年度
|
|
|
|
|
|
|
|
String yearBeforeStart = TimeUtils.getYear(yearBefore); |
|
|
|
|
|
|
|
String yearBeforeEnd = TimeUtils.getYearEnd(yearBefore); |
|
|
|
|
|
|
|
// 今年当月
|
|
|
|
|
|
|
|
String monthStart = TimeUtils.getMonthStart(year,month); |
|
|
|
|
|
|
|
String monthEnd = TimeUtils.getMonthEnd(year,month); |
|
|
|
|
|
|
|
String monthEndV2 = TimeUtils.getMonthEndV2(year,month); |
|
|
|
|
|
|
|
// 今年上个月
|
|
|
|
|
|
|
|
String beforeMonthStart = TimeUtils.getMonthStart(year,monthBefore); |
|
|
|
|
|
|
|
String beforeMonthEnd = TimeUtils.getMonthEnd(year,monthBefore); |
|
|
|
|
|
|
|
// 去年当月
|
|
|
|
|
|
|
|
String monthStartBeforeYear = TimeUtils.getMonthStart(yearBefore,month); |
|
|
|
|
|
|
|
String monthEndBeforeYear = TimeUtils.getMonthEnd(yearBefore,month); |
|
|
|
|
|
|
|
// 所有设备信息
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> devices = mainSystemMonitoringService.getEmInfoList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
|
|
|
|
List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 装机容量占比数据组装
|
|
|
|
|
|
|
|
//总容量
|
|
|
|
|
|
|
|
double sum = Optional.ofNullable(realsByDept) |
|
|
|
|
|
|
|
.orElse(new ArrayList<>()).stream() |
|
|
|
|
|
|
|
.filter(s -> s.getInstalledCapacity() != null) |
|
|
|
|
|
|
|
.mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum(); |
|
|
|
|
|
|
|
map.put("installedCapacity", sum); |
|
|
|
|
|
|
|
//各站点分组
|
|
|
|
|
|
|
|
Map<Long, List<HydropowerUnitRealVo>> listMap = Optional.ofNullable(realsByDept) |
|
|
|
|
|
|
|
.orElse(new ArrayList<>()).stream() |
|
|
|
|
|
|
|
.filter(s -> s.getInstalledCapacity() != null) |
|
|
|
|
|
|
|
.collect(Collectors.groupingBy(HydropowerUnitRealVo::getDeptId)); |
|
|
|
|
|
|
|
Map<String, Double> capacityProportionMap = new HashMap<>(); |
|
|
|
|
|
|
|
for ( |
|
|
|
|
|
|
|
Map.Entry<Long, List<HydropowerUnitRealVo>> longListEntry : listMap.entrySet()) { |
|
|
|
|
|
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(0); |
|
|
|
|
|
|
|
for (HydropowerUnitRealVo hydropowerUnitRealVo : longListEntry.getValue()) { |
|
|
|
|
|
|
|
bigDecimal = BigDecimal.valueOf(hydropowerUnitRealVo.getInstalledCapacity()).add(bigDecimal); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Dept dept : deptList) { |
|
|
|
|
|
|
|
if (dept.getDeptCode().equals(longListEntry.getKey())) { |
|
|
|
|
|
|
|
capacityProportionMap.put(dept.getDeptName(), bigDecimal.doubleValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//装机容量占比图
|
|
|
|
|
|
|
|
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 1260, 60600); |
|
|
|
|
|
|
|
map.put("capacityProportionChart", capacityProportionChart); |
|
|
|
|
|
|
|
//各发电站发电量环比图+表格数据组装
|
|
|
|
|
|
|
|
List<MonPowerPercentageVo> powerPercentageVoList=new ArrayList<>(); |
|
|
|
|
|
|
|
for (Dept dept : deptList) { |
|
|
|
|
|
|
|
MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); |
|
|
|
|
|
|
|
powerVo.setDeptId(dept.getId()); |
|
|
|
|
|
|
|
powerVo.setDeptName(dept.getDeptName()); |
|
|
|
|
|
|
|
BigDecimal powerYear = new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal powerYearBefore = new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal powerMonth = new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal powerMonthBefore = new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal powerMonthYearBefore = new BigDecimal(0); |
|
|
|
|
|
|
|
Float planGeneration=0f; |
|
|
|
|
|
|
|
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, Arrays.asList(dept.getId().toString()), year.toString()); |
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(planYearData)){ |
|
|
|
|
|
|
|
planGeneration = planYearData.get(0).getPlanGeneration(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 站点设备集合
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(dept.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
for (EminfoAndEmParamVo device : stationDevices) { |
|
|
|
|
|
|
|
//今年发电量
|
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseData = analyseDataService.periodTargetData(yearStart, yearEnd, 3, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseData)) { |
|
|
|
|
|
|
|
BigDecimal yearPower = analyseData.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerYear = powerYear.add(yearPower); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//去年发电量
|
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataYearBefore = analyseDataService.periodTargetData(yearBeforeStart, yearBeforeEnd, 3, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataYearBefore)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataYearBefore.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerYearBefore = powerYearBefore.add(powerBefore); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//今年当月发电量
|
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataMonth= analyseDataService.periodTargetData(monthStart, monthEnd, 3, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataMonth)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataMonth.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerMonth = powerMonth.add(powerBefore); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//上个月发电量
|
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataMonthBefore = analyseDataService.periodTargetData(beforeMonthStart, beforeMonthEnd, 3, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataMonthBefore)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataMonthBefore.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerMonthBefore = powerMonthBefore.add(powerBefore); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//去年当月发电量
|
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataMonthBeforeYear = analyseDataService.periodTargetData(monthStartBeforeYear, monthEndBeforeYear, 3, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataMonthBeforeYear)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataMonthBeforeYear.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerMonthYearBefore = powerMonthYearBefore.add(powerBefore); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerYear(powerYear.floatValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMonYearBefore(powerYearBefore.floatValue()); |
|
|
|
|
|
|
|
BigDecimal yearPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal planPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
if (!powerYearBefore.equals(0)){ |
|
|
|
|
|
|
|
yearPercentage= powerYearBefore.divide(powerYear, 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
planPercentage= powerYearBefore.divide(BigDecimal.valueOf(planGeneration), 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPlanPercentage(planPercentage.floatValue()); |
|
|
|
|
|
|
|
powerVo.setPowerYearPercentage(yearPercentage.floatValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMon(powerMonth.floatValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMonBefore(powerMonthBefore.floatValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.floatValue()); |
|
|
|
|
|
|
|
BigDecimal monPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
if (!powerMonthYearBefore.equals(0)){ |
|
|
|
|
|
|
|
monPercentage= powerMonthYearBefore.divide(powerMonth, 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerMonPercentage(monPercentage.floatValue()); |
|
|
|
|
|
|
|
powerPercentageVoList.add(powerVo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 各发电站发电量环比图数据组装
|
|
|
|
|
|
|
|
//表格总计
|
|
|
|
|
|
|
|
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null,Arrays.asList(deptId.toString()), year.toString()); |
|
|
|
|
|
|
|
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null,Arrays.asList(deptId.toString()), year+"-"+month); |
|
|
|
|
|
|
|
getTabelSum(deptId, powerPercentageVoList,planYearAll,planMonAll,map); |
|
|
|
|
|
|
|
//柱状图图数据
|
|
|
|
|
|
|
|
// todo 把柱状重新写一个方法展示
|
|
|
|
|
|
|
|
String[] monthArray = {"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月"}; |
|
|
|
|
|
|
|
double[] value = {20, 30, 25, 50, 40, 25, 50, 40}; |
|
|
|
|
|
|
|
ImageEntity powerChainHistogram = JFreeUtil.lineChart("测试111", monthArray, value, 300, 200); |
|
|
|
|
|
|
|
map.put("powerChainHistogram", powerChainHistogram); |
|
|
|
|
|
|
|
//发电情况统计表数据
|
|
|
|
|
|
|
|
if(powerPercentageVoList!=null){ |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size()); |
|
|
|
|
|
|
|
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) { |
|
|
|
|
|
|
|
HashMap<String, String> temp = new HashMap<>(8); |
|
|
|
|
|
|
|
temp.put("name", monPowerPercentageVo.getDeptName()); |
|
|
|
|
|
|
|
temp.put("powerMonBefore", monPowerPercentageVo.getPowerMonYearBefore().toString()); |
|
|
|
|
|
|
|
temp.put("powerYearBefore", monPowerPercentageVo.getPowerYearBefore().toString()); |
|
|
|
|
|
|
|
temp.put("mon", monPowerPercentageVo.getPowerMon().toString()); |
|
|
|
|
|
|
|
temp.put("year", monPowerPercentageVo.getPowerYear().toString()); |
|
|
|
|
|
|
|
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage().toString()); |
|
|
|
|
|
|
|
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage().toString()); |
|
|
|
|
|
|
|
temp.put("plan", monPowerPercentageVo.getPlanPercentage().toString()); |
|
|
|
|
|
|
|
list.add(temp); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("powerGeneration", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//本月缺陷
|
|
|
|
|
|
|
|
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.lambdaQuery(); |
|
|
|
|
|
|
|
wrapper.ge(OperPhenomenonEntity::getCreateTime, monthStart); |
|
|
|
|
|
|
|
wrapper.le(OperPhenomenonEntity::getCreateTime,monthEndV2); |
|
|
|
|
|
|
|
wrapper.eq(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.IS_DEFECT); |
|
|
|
|
|
|
|
wrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); |
|
|
|
|
|
|
|
wrapper.in(OperPhenomenonEntity::getCreateDept, deptIds); |
|
|
|
|
|
|
|
List<OperPhenomenonEntity> monPhenomenonList = operPhenomenonService.list(wrapper); |
|
|
|
|
|
|
|
List<OperPhenomenonEntity> monConclusionList = monPhenomenonList.stream().filter(s -> s.getConclusionStatus().equals(1)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 各电站缺陷处理统计表
|
|
|
|
|
|
|
|
monConclusionList.stream().sorted(Comparator.comparing(OperPhenomenonEntity::getDefectGrading).reversed().thenComparing(OperPhenomenonEntity::getCreateTime)); |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> checkList = new ArrayList<>(monConclusionList.size()); |
|
|
|
|
|
|
|
for (OperPhenomenonEntity operPhenomenonEntity : monConclusionList) { |
|
|
|
|
|
|
|
Long createDept = operPhenomenonEntity.getCreateDept(); |
|
|
|
|
|
|
|
R<String> createDeptName= sysClient.getDeptName(createDept); |
|
|
|
|
|
|
|
if (!createDeptName.isSuccess()&&createDeptName.getData()!=null){ |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//表格数据
|
|
|
|
|
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
|
|
|
|
temp.put("name", "name1"); |
|
|
|
|
|
|
|
temp.put("name",createDeptName.getData()); |
|
|
|
|
|
|
|
temp.put("level",operPhenomenonEntity.getDefectGrading()); |
|
|
|
|
|
|
|
temp.put("createTime",operPhenomenonEntity.getCreateTime().toString()); |
|
|
|
|
|
|
|
temp.put("findTime",operPhenomenonEntity.getFindTime().toString()); |
|
|
|
|
|
|
|
temp.put("descripiton",operPhenomenonEntity.getDescripiton()); |
|
|
|
|
|
|
|
temp.put("disposeDesc",operPhenomenonEntity.getDisposeDesc()); |
|
|
|
|
|
|
|
checkList.add(temp); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("checkList",checkList); |
|
|
|
|
|
|
|
//各电站缺陷统计表
|
|
|
|
|
|
|
|
//本年缺陷
|
|
|
|
|
|
|
|
LambdaQueryWrapper<OperPhenomenonEntity> wrapperYear= Wrappers.lambdaQuery(); |
|
|
|
|
|
|
|
wrapper.ge(OperPhenomenonEntity::getCreateTime, yearStart); |
|
|
|
|
|
|
|
wrapper.le(OperPhenomenonEntity::getCreateTime,yearEndV2); |
|
|
|
|
|
|
|
wrapper.eq(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.IS_DEFECT); |
|
|
|
|
|
|
|
wrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); |
|
|
|
|
|
|
|
wrapper.in(OperPhenomenonEntity::getCreateDept, deptIds); |
|
|
|
|
|
|
|
List<OperPhenomenonEntity> yearPhenomenonEntities = operPhenomenonService.list(wrapperYear); |
|
|
|
|
|
|
|
List<OperPhenomenonEntity> yearConclusionList = yearPhenomenonEntities.stream().filter(s -> s.getConclusionStatus().equals(1)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(yearPhenomenonEntities)) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> checkStatistics = new ArrayList<>(1); |
|
|
|
|
|
|
|
//表格数据
|
|
|
|
|
|
|
|
HashMap<String, String> temp = new HashMap<>(7); |
|
|
|
|
|
|
|
temp.put("deptName", "总计"); |
|
|
|
|
|
|
|
temp.put("checkLevel","0"); |
|
|
|
|
|
|
|
temp.put("findShortagesMon","0"); |
|
|
|
|
|
|
|
temp.put("shortagesMon","0"); |
|
|
|
|
|
|
|
temp.put("findShortagesYear","0"); |
|
|
|
|
|
|
|
temp.put("shortagesYear","0"); |
|
|
|
|
|
|
|
temp.put("shortagesRate","0"); |
|
|
|
|
|
|
|
checkList.add(temp); |
|
|
|
|
|
|
|
map.put("checkStatistics",checkStatistics); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
List<CheckChartVo> checkChartRes=new ArrayList<>(); |
|
|
|
|
|
|
|
Map<Long, Map<String, List<OperPhenomenonEntity>>> phenomenonMap = yearPhenomenonEntities.stream().collect( |
|
|
|
|
|
|
|
Collectors.groupingBy(OperPhenomenonEntity::getCreateDept, |
|
|
|
|
|
|
|
Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading))); |
|
|
|
|
|
|
|
for (Map.Entry<Long, Map<String, List<OperPhenomenonEntity>>> deptMapEntry : phenomenonMap.entrySet()) { |
|
|
|
|
|
|
|
R<String> deptName1 = sysClient.getDeptName(deptMapEntry.getKey()); |
|
|
|
|
|
|
|
for (Map.Entry<String, List<OperPhenomenonEntity>> levelList : deptMapEntry.getValue().entrySet()) { |
|
|
|
|
|
|
|
Integer findShortagesYear = levelList.getValue().size(); |
|
|
|
|
|
|
|
Integer shortagesYear = yearConclusionList.stream().filter(s -> s.getDefectLevel().equals(deptMapEntry)).filter(s -> s.getDefectLevel().equals(deptMapEntry)).collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
Double shortagesRate=0d; |
|
|
|
|
|
|
|
if (findShortagesYear!=0&&shortagesYear!=0){ |
|
|
|
|
|
|
|
shortagesRate=BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear),2,BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Integer findShortagesMon=Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()) .stream().filter(s -> s.getDefectLevel().equals(deptMapEntry)).filter(s -> s.getDefectLevel().equals(deptMapEntry)).collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
Integer shortagesMon=Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(deptMapEntry)).filter(s -> s.getDefectLevel().equals(deptMapEntry)).collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
CheckChartVo checkChartVo=new CheckChartVo(deptName1.getData(),levelList.getKey(),findShortagesMon,shortagesMon,findShortagesYear,shortagesYear,shortagesRate); |
|
|
|
|
|
|
|
checkChartRes.add(checkChartVo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 总计
|
|
|
|
|
|
|
|
Map<String, List<OperPhenomenonEntity>> levelPhenomenonList = yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading)); |
|
|
|
|
|
|
|
for (Map.Entry<String, List<OperPhenomenonEntity>> levelPhenomenon : levelPhenomenonList.entrySet()) { |
|
|
|
|
|
|
|
Integer findShortagesYear = levelPhenomenon.getValue().size(); |
|
|
|
|
|
|
|
Integer shortagesYear = Optional.ofNullable(yearConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelPhenomenon)).collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
Double shortagesRate=0d; |
|
|
|
|
|
|
|
if (findShortagesYear!=0&&shortagesYear!=0){ |
|
|
|
|
|
|
|
shortagesRate=BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear),2,BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Integer findShortagesMon= Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelPhenomenon)).collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
Integer shortagesMon= Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelPhenomenon)).collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
CheckChartVo checkChartVo=new CheckChartVo("总计",levelPhenomenon.getKey(),findShortagesMon,shortagesMon,findShortagesYear,shortagesYear,shortagesRate); |
|
|
|
|
|
|
|
checkChartRes.add(checkChartVo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(ticketNumbers)) {
|
|
|
|
|
|
|
|
// String percent = PercentCountUtils.getPercent(evaluateEntities.size(), ticketNumbers.size());
|
|
|
|
|
|
|
|
// ticketCount.setPercentPassTicket(percent);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 两票执行情况
|
|
|
|
|
|
|
|
R<List<WorkTicketInfoEntity>> yearTicket = ticketInfoClient.getWorkTicketByTime(yearStart, yearEndV2); |
|
|
|
|
|
|
|
R<List<StandardTicketInfoEntity>> yearOperateTicket = ticketInfoClient.getOperateTicketByTime(yearStart, yearEndV2); |
|
|
|
|
|
|
|
R<List<WorkTicketInfoEntity>> monthTicket = ticketInfoClient.getWorkTicketByTime(monthStart, monthEndV2); |
|
|
|
|
|
|
|
R<List<StandardTicketInfoEntity>> monthOperateTicket = ticketInfoClient.getOperateTicketByTime(monthStart, monthEndV2); |
|
|
|
|
|
|
|
if (!monthTicket.isSuccess()||!yearTicket.isSuccess()){ |
|
|
|
|
|
|
|
return R.fail("两票查询异常,请稍后重试"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//年工作票分组统计
|
|
|
|
|
|
|
|
Map<String, Map<String, List<WorkTicketInfoEntity>>> yearTicketCollect = Optional.ofNullable(yearTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
|
|
|
|
.filter(s->s.getSignageCode()!=null) |
|
|
|
|
|
|
|
.collect(Collectors.groupingBy(WorkTicketInfoEntity::getSignageCode, |
|
|
|
|
|
|
|
Collectors.groupingBy(WorkTicketInfoEntity::getType))); |
|
|
|
|
|
|
|
// 合格率计算
|
|
|
|
|
|
|
|
// Optional.ofNullable(yearTicket.getData()).orElse(new ArrayList<>()).stream()
|
|
|
|
|
|
|
|
// .filter(s->s.getSignageCode()!=null)
|
|
|
|
|
|
|
|
//年操作票分组统计
|
|
|
|
|
|
|
|
Map<String, Map<String, List<StandardTicketInfoEntity>>> yearOperateTicketCollect = Optional.ofNullable(yearOperateTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
|
|
|
|
.filter(s->s.getSignageCode()!=null) |
|
|
|
|
|
|
|
.collect(Collectors.groupingBy(StandardTicketInfoEntity::getSignageCode, |
|
|
|
|
|
|
|
Collectors.groupingBy(StandardTicketInfoEntity::getTicketType))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, Map<String, List<WorkTicketInfoEntity>>> deptTicketCollect : yearTicketCollect.entrySet()) { |
|
|
|
|
|
|
|
List<TicketChartCell> cellList=new ArrayList<>(); |
|
|
|
|
|
|
|
for (Map.Entry<String, List<WorkTicketInfoEntity>> ticketCollect : deptTicketCollect.getValue().entrySet()) { |
|
|
|
|
|
|
|
TicketChartCell ticketChartCell = new TicketChartCell(); |
|
|
|
|
|
|
|
//年合格率和数量
|
|
|
|
|
|
|
|
Integer count = ticketCollect.getValue().size(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long passCount =ticketCollect.getValue().stream().filter(s->s.getStatus()==1).count(); |
|
|
|
|
|
|
|
Double ticketYearPerc=BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(count),2,BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
|
|
|
|
ticketChartCell.setTicketYear(count); |
|
|
|
|
|
|
|
ticketChartCell.setTicketYeaPercr(ticketYearPerc); |
|
|
|
|
|
|
|
if (monthTicket.getData()!=null){ |
|
|
|
|
|
|
|
ticketChartCell.setTicketMon(0); |
|
|
|
|
|
|
|
ticketChartCell.setTicketMonPerc(0d); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
// 月合格率和数量
|
|
|
|
|
|
|
|
List<WorkTicketInfoEntity> monthTicketCollect = monthTicket.getData().stream() |
|
|
|
|
|
|
|
.filter(s -> s.getCreateDept().equals(deptTicketCollect.getKey())) |
|
|
|
|
|
|
|
.filter(s -> s.getType().equals(ticketCollect.getKey())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
ticketChartCell.setTicketMon(monthTicketCollect.size()); |
|
|
|
|
|
|
|
Integer passCountMon =(int) monthTicketCollect.stream().filter(s->s.getStatus()==1).count(); |
|
|
|
|
|
|
|
Double ticketMonPerc=BigDecimal.valueOf(passCountMon).divide(BigDecimal.valueOf(monthTicketCollect.size()),2,BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
|
|
|
|
ticketChartCell.setTicketMonPerc(ticketMonPerc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cellList.add(ticketChartCell); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 拿到对应的厂站进行分组展示
|
|
|
|
|
|
|
|
Map<String, List<StandardTicketInfoEntity>> deptOperateTicketCollect = yearOperateTicketCollect.get(deptTicketCollect.getKey()); |
|
|
|
|
|
|
|
if (deptOperateTicketCollect==null){ |
|
|
|
|
|
|
|
TicketChartCell ticketChartCell = new TicketChartCell(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (Map.Entry<String, List<StandardTicketInfoEntity>> operateTicketCollect : deptOperateTicketCollect.entrySet()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//模拟表格数据
|
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> list = new ArrayList<>(2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> temp = new HashMap<>(3); |
|
|
|
|
|
|
|
temp.put("name", "name1"); |
|
|
|
|
|
|
|
// temp.put("name", "第一个人");
|
|
|
|
|
|
|
|
// temp.put("age", "23");
|
|
|
|
|
|
|
|
list.add(temp); |
|
|
|
|
|
|
|
temp = new HashMap<>(3); |
|
|
|
|
|
|
|
temp.put("name", "2"); |
|
|
|
|
|
|
|
// temp.put("name", "第二个人");
|
|
|
|
|
|
|
|
// temp.put("age", "24");
|
|
|
|
|
|
|
|
list.add(temp); |
|
|
|
|
|
|
|
map.put("safelist", list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //模拟柱状图图数据
|
|
|
|
|
|
|
|
// String[] monthArray = {"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月"};
|
|
|
|
|
|
|
|
// double[] value = {20, 30, 25, 50, 40, 25, 50, 40};
|
|
|
|
|
|
|
|
// ImageEntity lineEntity = JFreeUtil.lineChart("测试111", monthArray, value, 300, 200);
|
|
|
|
|
|
|
|
// map.put("lineEntity", lineEntity);
|
|
|
|
|
|
|
|
return R.success("成功"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //todo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll,HashMap<String, Object> map) { |
|
|
|
|
|
|
|
Float planGeneration=0f; |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(planYearAll)){ |
|
|
|
|
|
|
|
planGeneration = planYearAll.get(0).getPlanGeneration(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Float planMonGeneration=0f; |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(planYearAll)){ |
|
|
|
|
|
|
|
planMonGeneration = planMonAll.get(0).getPlanGeneration(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); |
|
|
|
|
|
|
|
powerVo.setDeptId(deptId); |
|
|
|
|
|
|
|
powerVo.setDeptName("总计"); |
|
|
|
|
|
|
|
BigDecimal powerYear= powerPercentageVoList.stream().filter(s->s.getPowerYear()!=null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getPowerYear()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerVo.setPowerYear(powerYear.floatValue()); |
|
|
|
|
|
|
|
map.put("powerYear",powerYear.toString()); |
|
|
|
|
|
|
|
BigDecimal powerYearBefore= powerPercentageVoList.stream().filter(s->s.getPowerYearBefore()!=null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getPowerYearBefore()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerVo.setPowerMonYearBefore(powerYearBefore.floatValue()); |
|
|
|
|
|
|
|
BigDecimal yearPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal planPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
if (!powerYearBefore.equals(0)){ |
|
|
|
|
|
|
|
// 年累计环比
|
|
|
|
|
|
|
|
yearPercentage= powerYearBefore.divide(powerYear, 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
planPercentage= powerYearBefore.divide(BigDecimal.valueOf(planGeneration), 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
// 年计划完成率
|
|
|
|
|
|
|
|
map.put("yearCompletionRate",planPercentage.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerYearPercentage(yearPercentage.floatValue()); |
|
|
|
|
|
|
|
powerVo.setPlanPercentage(planPercentage.floatValue()); |
|
|
|
|
|
|
|
BigDecimal powerMonth= powerPercentageVoList.stream().filter(s->s.getPowerMon()!=null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getPowerMon()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
// 项目月发电量
|
|
|
|
|
|
|
|
powerVo.setPowerMon(powerMonth.floatValue()); |
|
|
|
|
|
|
|
map.put("powerMon",powerMonth.toString()); |
|
|
|
|
|
|
|
// 项目月计划完成量
|
|
|
|
|
|
|
|
BigDecimal planMonPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
if (!powerMonth.equals(0)&&planMonGeneration!=0){ |
|
|
|
|
|
|
|
planMonPercentage= powerMonth.divide(BigDecimal.valueOf(planMonGeneration), 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("monCompletionRate",planMonPercentage); |
|
|
|
|
|
|
|
BigDecimal powerMonthBefore= powerPercentageVoList.stream().filter(s->s.getPowerMonBefore()!=null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getPowerMonBefore()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerVo.setPowerMonBefore(powerMonthBefore.floatValue()); |
|
|
|
|
|
|
|
BigDecimal powerMonthYearBefore= powerPercentageVoList.stream().filter(s->s.getPowerMonYearBefore()!=null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Float.valueOf(ktv.getPowerMonYearBefore()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.floatValue()); |
|
|
|
|
|
|
|
BigDecimal monPercentage =new BigDecimal(0); |
|
|
|
|
|
|
|
if (!powerMonthYearBefore.equals(0)){ |
|
|
|
|
|
|
|
monPercentage= powerMonthYearBefore.divide(powerMonth, 4, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//发电量环比增加
|
|
|
|
|
|
|
|
BigDecimal monAdd=powerMonth.subtract(powerMonthBefore); |
|
|
|
|
|
|
|
if (monAdd.equals(0)){ |
|
|
|
|
|
|
|
map.put("percentageAdd",0); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
map.put("percentageAdd", monAdd.divide(powerMonth, 4, BigDecimal.ROUND_UP).toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerMonPercentage(monPercentage.floatValue()); |
|
|
|
|
|
|
|
powerPercentageVoList.add(powerVo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 首行表头样式 |
|
|
|
* 首行表头样式 |
|
|
|
* |
|
|
|
* |
|
|
@ -547,6 +1019,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 预测发电量 |
|
|
|
* 预测发电量 |
|
|
|
|
|
|
|
* |
|
|
|
* @param oldActualMap |
|
|
|
* @param oldActualMap |
|
|
|
* @param oldOldActualMap |
|
|
|
* @param oldOldActualMap |
|
|
|
* @param areaStationList |
|
|
|
* @param areaStationList |
|
|
@ -854,6 +1327,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 安全检查 |
|
|
|
* 安全检查 |
|
|
|
|
|
|
|
* |
|
|
|
* @param areas |
|
|
|
* @param areas |
|
|
|
* @param areaMonthReport |
|
|
|
* @param areaMonthReport |
|
|
|
* @param startTime |
|
|
|
* @param startTime |
|
|
@ -886,6 +1360,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取设备试验数据 |
|
|
|
* 获取设备试验数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param startTime |
|
|
|
* @param startTime |
|
|
|
* @param endTime |
|
|
|
* @param endTime |
|
|
|
* @param areas |
|
|
|
* @param areas |
|
|
|