|
|
|
@ -204,7 +204,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
return R.data("success"); |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId) { |
|
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String name) { |
|
|
|
|
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser(); |
|
|
|
|
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){ |
|
|
|
|
return R.fail("用户权限查询失败"); |
|
|
|
@ -214,6 +214,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
return R.fail("暂无该机构"); |
|
|
|
|
} |
|
|
|
|
String deptName = deptNameR.getData(); |
|
|
|
|
// 赋值给导出表格名称
|
|
|
|
|
name=deptName; |
|
|
|
|
R<List<Dept>> deptR = sysClient.getDeptByType("200000", deptId, 4); |
|
|
|
|
if (!deptR.isSuccess() || deptR.getData() == null) { |
|
|
|
|
return R.fail("该机构不包含水站信息"); |
|
|
|
@ -227,10 +229,17 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
|
.in(StationEntity::getRefDept, deptIds) |
|
|
|
|
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)); |
|
|
|
|
Integer commissionTime = stationEntityList.stream().map(s -> { |
|
|
|
|
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now()); |
|
|
|
|
return (int) dur.toDays();}).reduce(Integer::max).get(); |
|
|
|
|
List<Long> stationIds = stationEntityList.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(stationEntityList)) { |
|
|
|
|
Integer commissionTime = stationEntityList.stream().map(s -> { |
|
|
|
|
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now()); |
|
|
|
|
return (int) dur.toDays(); |
|
|
|
|
}).reduce(Integer::max).get(); |
|
|
|
|
map.put("commissionTime", commissionTime.toString()); |
|
|
|
|
}else { |
|
|
|
|
map.put("commissionTime", 0); |
|
|
|
|
} |
|
|
|
|
List<Long> stationIds = Optional.ofNullable(stationEntityList) |
|
|
|
|
.orElse(new ArrayList<>()).stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
//其它普通数据
|
|
|
|
|
map.put("year", year); |
|
|
|
|
Integer yearBefore = year - 1; |
|
|
|
@ -239,7 +248,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
Integer monthBefore = month - 1; |
|
|
|
|
map.put("monthBefore", monthBefore); |
|
|
|
|
// map.put("date", date);
|
|
|
|
|
map.put("commissionTime", commissionTime.toString()); |
|
|
|
|
|
|
|
|
|
map.put("stationName", deptName); |
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
|
|
|
|
map.put("writeTime", simpleDateFormat.format(new Date())); |
|
|
|
@ -294,7 +303,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
//装机容量占比图
|
|
|
|
|
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400); |
|
|
|
|
map.put("capacityProportionChart", capacityProportionChart); |
|
|
|
|
//各发电站发电量环比图+表格数据组装
|
|
|
|
|
//各发电站发电量环比图+表格数据组装
|
|
|
|
|
List<MonPowerPercentageVo> powerPercentageVoList = getMonPowerPercentageVos(year, month, deptList, deptIds, stationEntityList, stationIds, yearBefore, monthBefore); |
|
|
|
|
// getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList);
|
|
|
|
|
// 各发电站发电量环比图数据组装
|
|
|
|
@ -384,7 +393,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
checkList.add(temp); |
|
|
|
|
} |
|
|
|
|
map.put("checkList", checkList); |
|
|
|
|
//各电站缺陷统计表
|
|
|
|
|
//各电站缺陷统计表
|
|
|
|
|
//本年缺陷
|
|
|
|
|
LambdaQueryWrapper<OperPhenomenonEntity> wrapperYear = Wrappers.lambdaQuery(); |
|
|
|
|
wrapperYear.ge(OperPhenomenonEntity::getCreateTime, yearStart); |
|
|
|
@ -626,6 +635,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
|
|
|
|
|
String monStart = TimeUtils.getMon(year, month); |
|
|
|
|
String monStartYearBefore = TimeUtils.getMon(yearBefore, month); |
|
|
|
|
String monStartMonBefore = TimeUtils.getMon(year, monthBefore); |
|
|
|
|
// 格式:站点-日期-发电量
|
|
|
|
|
for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) { |
|
|
|
|
String deptNameByKey; |
|
|
|
|
if (stationIds.contains(deviceMap.getKey())) { |
|
|
|
|