|
|
@ -3,6 +3,7 @@ package com.hnac.hzims.operational.main.service.impl; |
|
|
|
import cn.afterturn.easypoi.entity.ImageEntity; |
|
|
|
import cn.afterturn.easypoi.entity.ImageEntity; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
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.IEmParamClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmParamClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
@ -25,7 +26,6 @@ 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.JFreeUtil; |
|
|
|
import com.hnac.hzims.operational.util.TimeUtils; |
|
|
|
import com.hnac.hzims.operational.util.TimeUtils; |
|
|
|
import com.hnac.hzims.operational.util.WordUtils; |
|
|
|
|
|
|
|
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; |
|
|
@ -69,6 +69,7 @@ import java.math.BigDecimal; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.time.Duration; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.ZoneId; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
@ -119,8 +120,6 @@ 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; |
|
|
|
|
|
|
|
|
|
|
@ -202,9 +201,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
} |
|
|
|
} |
|
|
|
return R.data("success"); |
|
|
|
return R.data("success"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Integer date, Long deptId) { |
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Integer date, Long deptId) { |
|
|
|
|
|
|
|
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser(); |
|
|
|
|
|
|
|
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()!=null){ |
|
|
|
|
|
|
|
return R.fail("用户权限查询失败"); |
|
|
|
|
|
|
|
} |
|
|
|
R<String> deptNameR = sysClient.getDeptName(deptId); |
|
|
|
R<String> deptNameR = sysClient.getDeptName(deptId); |
|
|
|
if (!deptNameR.isSuccess()) { |
|
|
|
if (!deptNameR.isSuccess()) { |
|
|
|
return R.fail("暂无该机构"); |
|
|
|
return R.fail("暂无该机构"); |
|
|
@ -218,7 +220,18 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
if (deptList == null) { |
|
|
|
if (deptList == null) { |
|
|
|
return R.fail("该机构不包含水站信息"); |
|
|
|
return R.fail("该机构不包含水站信息"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<Long> deptByUser = deptByCurrentUser.getData().stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (!deptByUser.contains(deptId)){ |
|
|
|
|
|
|
|
return R.fail("该用户不包含该机构权限,请申请权限再试"); |
|
|
|
|
|
|
|
} |
|
|
|
List<Long> deptIds = deptList.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> deptIds = deptList.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
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(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
//其它普通数据
|
|
|
|
//其它普通数据
|
|
|
|
map.put("year", year); |
|
|
|
map.put("year", year); |
|
|
|
Integer yearBefore = year - 1; |
|
|
|
Integer yearBefore = year - 1; |
|
|
@ -227,48 +240,40 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
Integer monthBefore = month - 1; |
|
|
|
Integer monthBefore = month - 1; |
|
|
|
map.put("monthBefore", monthBefore); |
|
|
|
map.put("monthBefore", monthBefore); |
|
|
|
map.put("date", date); |
|
|
|
map.put("date", date); |
|
|
|
map.put("commissionTime", "commissionTime"); |
|
|
|
map.put("commissionTime", commissionTime.toString()); |
|
|
|
map.put("stationName", deptName); |
|
|
|
map.put("stationName", deptName); |
|
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); |
|
|
|
|
|
|
|
map.put("writeTime", simpleDateFormat.format(new Date())); |
|
|
|
|
|
|
|
List<HashMap<String, String>> safelist=new ArrayList<>(); |
|
|
|
|
|
|
|
List<HashMap<String, String>> form=new ArrayList<>(); |
|
|
|
|
|
|
|
for (Dept dept : deptList) { |
|
|
|
|
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
|
|
|
|
HashMap<String, String> temp2 = new HashMap<>(); |
|
|
|
|
|
|
|
temp.put("name", dept.getDeptName()); |
|
|
|
|
|
|
|
temp2.put("name", dept.getDeptName()); |
|
|
|
|
|
|
|
safelist.add(temp); |
|
|
|
|
|
|
|
form.add(temp2); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("safelist",safelist); |
|
|
|
|
|
|
|
map.put("form",form); |
|
|
|
|
|
|
|
map.put("form2",form); |
|
|
|
// 今年年度
|
|
|
|
// 今年年度
|
|
|
|
String yearStart = TimeUtils.getYear(year); |
|
|
|
String yearStart = TimeUtils.getYear(year); |
|
|
|
String yearEnd = TimeUtils.getYearEnd(year); |
|
|
|
|
|
|
|
String yearEndV2 = TimeUtils.getYearEndV2(year); |
|
|
|
String yearEndV2 = TimeUtils.getYearEndV2(year); |
|
|
|
//去年年度
|
|
|
|
|
|
|
|
String yearBeforeStart = TimeUtils.getYear(yearBefore); |
|
|
|
|
|
|
|
String yearBeforeEnd = TimeUtils.getYearEnd(yearBefore); |
|
|
|
|
|
|
|
// 今年当月
|
|
|
|
// 今年当月
|
|
|
|
String monthStart = TimeUtils.getMonthStart(year, month); |
|
|
|
String monthStart = TimeUtils.getMonthStart(year, month); |
|
|
|
String monthEnd = TimeUtils.getMonthEnd(year, month); |
|
|
|
|
|
|
|
String monthEndV2 = TimeUtils.getMonthEndV2(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> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); |
|
|
|
// R<Integer> installedCapacityCountByDepts = emParamClient.getInstalledCapacityCountByDepts(deptIds);
|
|
|
|
List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).collect(Collectors.toList()); |
|
|
|
// if (installedCapacityCountByDepts.isSuccess()){
|
|
|
|
|
|
|
|
// double sum = Optional.ofNullable(installedCapacityCountByDepts.getData())
|
|
|
|
|
|
|
|
// .orElse(new ArrayList<>()).stream()
|
|
|
|
|
|
|
|
// .filter(s -> s.getInstalledCapacity() != null)
|
|
|
|
|
|
|
|
// .mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum();
|
|
|
|
|
|
|
|
// map.put("installedCapacity", 0);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
// TODO 伪造数据
|
|
|
|
|
|
|
|
List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).map(s->{s.setInstalledCapacity(3.2);return s;}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 装机容量占比数据组装
|
|
|
|
// 装机容量占比数据组装
|
|
|
|
//总容量
|
|
|
|
//总容量
|
|
|
|
double sum = Optional.ofNullable(realsByDept) |
|
|
|
double sum = Optional.ofNullable(realsByDept) |
|
|
|
.orElse(new ArrayList<>()).stream() |
|
|
|
.orElse(new ArrayList<>()).stream() |
|
|
|
.filter(s -> s.getInstalledCapacity() != null) |
|
|
|
.filter(s -> s.getInstalledCapacity() != null) |
|
|
|
.mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum(); |
|
|
|
.mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum(); |
|
|
|
map.put("installedCapacity", sum); |
|
|
|
BigDecimal sumData=new BigDecimal(sum).divide(new BigDecimal(1000),2,BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
map.put("installedCapacity", sumData); |
|
|
|
//各站点分组
|
|
|
|
//各站点分组
|
|
|
|
Map<Long, List<HydropowerUnitRealVo>> listMap = Optional.ofNullable(realsByDept) |
|
|
|
Map<Long, List<HydropowerUnitRealVo>> listMap = Optional.ofNullable(realsByDept) |
|
|
|
.orElse(new ArrayList<>()).stream() |
|
|
|
.orElse(new ArrayList<>()).stream() |
|
|
@ -290,103 +295,60 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400); |
|
|
|
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400); |
|
|
|
map.put("capacityProportionChart", capacityProportionChart); |
|
|
|
map.put("capacityProportionChart", capacityProportionChart); |
|
|
|
//各发电站发电量环比图+表格数据组装
|
|
|
|
//各发电站发电量环比图+表格数据组装
|
|
|
|
|
|
|
|
List<String> deptIdsString = deptIds.stream().map(s -> String.valueOf(s)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString()); |
|
|
|
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>(); |
|
|
|
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>(); |
|
|
|
for (Dept dept : deptList) { |
|
|
|
//水电站,光伏站和带代运维数据近三年数据
|
|
|
|
|
|
|
|
Map<Long, Map<String, Float>> powerMapThree = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); |
|
|
|
|
|
|
|
List<String> listByYear = TimeUtils.getListByYear(year); |
|
|
|
|
|
|
|
List<String> listByYearBefore = TimeUtils.getListByYear(yearBefore); |
|
|
|
|
|
|
|
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())) { |
|
|
|
MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); |
|
|
|
MonPowerPercentageVo powerVo = new MonPowerPercentageVo(); |
|
|
|
powerVo.setDeptId(dept.getId()); |
|
|
|
powerVo.setDeptId(deviceMap.getKey()); |
|
|
|
powerVo.setDeptName(dept.getDeptName()); |
|
|
|
List<StationEntity> collect = stationEntityList.stream().filter(s -> deviceMap.getKey().equals(s.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (collect!=null) { |
|
|
|
|
|
|
|
Long dept = collect.get(0).getRefDept(); |
|
|
|
|
|
|
|
List<Dept> dep = deptList.stream().filter(s -> dept.equals(s.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
deptNameByKey=dep.get(0).getDeptName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setDeptName(deptNameByKey); |
|
|
|
BigDecimal powerYear = new BigDecimal(0); |
|
|
|
BigDecimal powerYear = new BigDecimal(0); |
|
|
|
BigDecimal powerYearBefore = new BigDecimal(0); |
|
|
|
BigDecimal powerYearBefore = new BigDecimal(0); |
|
|
|
BigDecimal powerMonth = new BigDecimal(0); |
|
|
|
BigDecimal powerMonth = new BigDecimal(0); |
|
|
|
BigDecimal powerMonthBefore = new BigDecimal(0); |
|
|
|
BigDecimal powerMonthBefore = new BigDecimal(0); |
|
|
|
BigDecimal powerMonthYearBefore = new BigDecimal(0); |
|
|
|
BigDecimal powerMonthYearBefore = new BigDecimal(0); |
|
|
|
Double planGeneration = 0d; |
|
|
|
Double planGeneration = 0d; |
|
|
|
// todo shuju
|
|
|
|
List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList()); |
|
|
|
// List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, Arrays.asList(dept.getId().toString()), year.toString());
|
|
|
|
if (CollectionUtils.isNotEmpty(planGenerationById)) { |
|
|
|
PlanGenerationEntity planGenerationEntity=new PlanGenerationEntity(); |
|
|
|
planGeneration = Double.valueOf(planGenerationById.get(0).getPlanGeneration()); |
|
|
|
planGenerationEntity.setPlanGeneration(2f); |
|
|
|
|
|
|
|
List<PlanGenerationEntity> planYearData =new ArrayList<>(); |
|
|
|
|
|
|
|
planYearData.add(planGenerationEntity); |
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(planYearData)) { |
|
|
|
|
|
|
|
planGeneration = Double.valueOf(planYearData.get(0).getPlanGeneration()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 站点设备集合
|
|
|
|
//当前机构近三年的数据
|
|
|
|
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(dept.getId())).collect(Collectors.toList()); |
|
|
|
Map<String, Float> value = deviceMap.getValue(); |
|
|
|
for (EminfoAndEmParamVo device : stationDevices) { |
|
|
|
|
|
|
|
//今年发电量
|
|
|
|
//今年发电量
|
|
|
|
// List<AnalyseDataTaosVO> analyseData = analyseDataService.periodTargetData(yearStart, yearEnd, 3, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
|
|
|
|
powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
AnalyseDataTaosVO analyseData1=new AnalyseDataTaosVO(); |
|
|
|
//转换单位kwh-》万Kwh
|
|
|
|
analyseData1.setVal("2"); |
|
|
|
powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); |
|
|
|
List<AnalyseDataTaosVO> analyseData =new ArrayList<>(); |
|
|
|
powerYearBefore=value.entrySet().stream().filter(s->listByYearBefore.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
analyseData.add(analyseData1); |
|
|
|
powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); |
|
|
|
// todo 数据还原
|
|
|
|
powerMonth=value.entrySet().stream().filter(s->monStart.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
if (CollectionUtil.isNotEmpty(analyseData)) { |
|
|
|
powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); |
|
|
|
BigDecimal yearPower = analyseData.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
powerMonthBefore=value.entrySet().stream().filter(s->monStartMonBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal()))) |
|
|
|
powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
powerMonthYearBefore=value.entrySet().stream().filter(s->monStartYearBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
powerYear = powerYear.add(yearPower); |
|
|
|
powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
|
|
|
|
//去年发电量
|
|
|
|
|
|
|
|
// List<AnalyseDataTaosVO> analyseDataYearBefore = analyseDataService.periodTargetData(yearBeforeStart, yearBeforeEnd, 3, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), device.getEmCode(), HomePageConstant.ELECTRICITY_CONSUMPTION);
|
|
|
|
|
|
|
|
AnalyseDataTaosVO analyseDataYearBefore1=new AnalyseDataTaosVO(); |
|
|
|
|
|
|
|
analyseDataYearBefore1.setVal("16"); |
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataYearBefore =new ArrayList<>(); |
|
|
|
|
|
|
|
analyseDataYearBefore.add(analyseDataYearBefore1); |
|
|
|
|
|
|
|
// todo 数据还原
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataYearBefore)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataYearBefore.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Double.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);
|
|
|
|
|
|
|
|
AnalyseDataTaosVO analyseDataMonth1=new AnalyseDataTaosVO(); |
|
|
|
|
|
|
|
analyseDataMonth1.setVal("0.66"); |
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataMonth =new ArrayList<>(); |
|
|
|
|
|
|
|
analyseDataMonth.add(analyseDataMonth1); |
|
|
|
|
|
|
|
// todo 数据还原
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataMonth)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataMonth.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Double.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);
|
|
|
|
|
|
|
|
AnalyseDataTaosVO analyseDataMonthBefore1=new AnalyseDataTaosVO(); |
|
|
|
|
|
|
|
analyseDataMonthBefore1.setVal("0.56"); |
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataMonthBefore =new ArrayList<>(); |
|
|
|
|
|
|
|
analyseDataMonthBefore.add(analyseDataMonthBefore1); |
|
|
|
|
|
|
|
// todo 数据还原
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataMonthBefore)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataMonthBefore.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Double.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);
|
|
|
|
|
|
|
|
AnalyseDataTaosVO analyseDataMonthBeforeYear1=new AnalyseDataTaosVO(); |
|
|
|
|
|
|
|
analyseDataMonthBeforeYear1.setVal("0.3"); |
|
|
|
|
|
|
|
List<AnalyseDataTaosVO> analyseDataMonthBeforeYear =new ArrayList<>(); |
|
|
|
|
|
|
|
analyseDataMonthBeforeYear.add(analyseDataMonthBeforeYear1); |
|
|
|
|
|
|
|
// todo 数据还原
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(analyseDataMonthBeforeYear)) { |
|
|
|
|
|
|
|
BigDecimal powerBefore = analyseDataMonthBeforeYear.stream().filter(ktv -> ktv.getVal() != null) |
|
|
|
|
|
|
|
.map(ktv -> BigDecimal.valueOf(Double.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerMonthYearBefore = powerMonthYearBefore.add(powerBefore); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerYear(powerYear.doubleValue()); |
|
|
|
powerVo.setPowerYear(powerYear.doubleValue()); |
|
|
|
powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); |
|
|
|
powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); |
|
|
|
BigDecimal yearPercentage = new BigDecimal(0); |
|
|
|
BigDecimal yearPercentage = new BigDecimal(0); |
|
|
|
BigDecimal planPercentage = new BigDecimal(0); |
|
|
|
BigDecimal planPercentage = new BigDecimal(0); |
|
|
|
if (powerYearBefore.compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
} |
|
|
|
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
} |
|
|
|
powerVo.setPlanPercentage(planPercentage.doubleValue()); |
|
|
|
powerVo.setPlanPercentage(planPercentage.doubleValue()); |
|
|
@ -395,35 +357,35 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
powerVo.setPowerMonBefore(powerMonthBefore.doubleValue()); |
|
|
|
powerVo.setPowerMonBefore(powerMonthBefore.doubleValue()); |
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); |
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); |
|
|
|
BigDecimal monPercentage = new BigDecimal(0); |
|
|
|
BigDecimal monPercentage = new BigDecimal(0); |
|
|
|
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
} |
|
|
|
powerVo.setPowerMonPercentage(monPercentage.doubleValue()); |
|
|
|
powerVo.setPowerMonPercentage(monPercentage.doubleValue()); |
|
|
|
powerPercentageVoList.add(powerVo); |
|
|
|
powerPercentageVoList.add(powerVo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList);
|
|
|
|
// 各发电站发电量环比图数据组装
|
|
|
|
// 各发电站发电量环比图数据组装
|
|
|
|
|
|
|
|
|
|
|
|
//柱状图图数据
|
|
|
|
//柱状图图数据
|
|
|
|
// 创建数据
|
|
|
|
// 创建数据
|
|
|
|
DefaultCategoryDataset powerDataset = new DefaultCategoryDataset(); |
|
|
|
DefaultCategoryDataset powerDataset = new DefaultCategoryDataset(); |
|
|
|
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) { |
|
|
|
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) { |
|
|
|
powerDataset.addValue(monPowerPercentageVo.getPowerMonYearBefore(),monthBefore +"月", monPowerPercentageVo.getDeptName()); |
|
|
|
powerDataset.addValue(monPowerPercentageVo.getPowerMonBefore(),monthBefore +"月", monPowerPercentageVo.getDeptName()); |
|
|
|
powerDataset.addValue(monPowerPercentageVo.getPowerMon(), month +"月", monPowerPercentageVo.getDeptName()); |
|
|
|
powerDataset.addValue(monPowerPercentageVo.getPowerMon(), month +"月", monPowerPercentageVo.getDeptName()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
String powerTitle=deptName+"水电运维项目各电站发电量环比对比图(万kWh)"; |
|
|
|
String powerTitle = deptName + "水电运维项目各电站发电量环比对比图(万kWh)"; |
|
|
|
String powerDomainAxis="发电量"; |
|
|
|
String powerDomainAxis = "发电量"; |
|
|
|
String powerRangeAxis="站点名称"; |
|
|
|
String powerRangeAxis = "站点名称"; |
|
|
|
ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart( powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 400); |
|
|
|
ImageEntity powerChainHistogram = JFreeUtil.iCreateBarChart(powerTitle, powerDomainAxis, powerRangeAxis, powerDataset, 500, 400); |
|
|
|
map.put("powerChainHistogram", powerChainHistogram); |
|
|
|
map.put("powerChainHistogram", powerChainHistogram); |
|
|
|
//柱状图下的表格
|
|
|
|
//柱状图下添加的表格
|
|
|
|
if (powerPercentageVoList != null) { |
|
|
|
if (powerPercentageVoList != null) { |
|
|
|
ArrayList<HashMap<String, String>> powerMap = new ArrayList<>(powerPercentageVoList.size()); |
|
|
|
ArrayList<HashMap<String, String>> powerMap = new ArrayList<>(powerPercentageVoList.size()); |
|
|
|
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) { |
|
|
|
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) { |
|
|
|
HashMap<String, String> power = new HashMap<>(); |
|
|
|
HashMap<String, String> power = new HashMap<>(); |
|
|
|
power.put("name", monPowerPercentageVo.getDeptName()); |
|
|
|
power.put("name", monPowerPercentageVo.getDeptName()); |
|
|
|
power.put("monthBefore", String.valueOf(monPowerPercentageVo.getPowerMonBefore())); |
|
|
|
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MW"); |
|
|
|
power.put("month", String.valueOf(monPowerPercentageVo.getPowerMon())); |
|
|
|
power.put("month",monPowerPercentageVo.getPowerMon()+"MW"); |
|
|
|
powerMap.add(power); |
|
|
|
powerMap.add(power); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("power", powerMap); |
|
|
|
map.put("power", powerMap); |
|
|
@ -440,11 +402,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
temp.put("name", monPowerPercentageVo.getDeptName()); |
|
|
|
temp.put("name", monPowerPercentageVo.getDeptName()); |
|
|
|
temp.put("powerMonBefore", String.valueOf(monPowerPercentageVo.getPowerMonYearBefore())); |
|
|
|
temp.put("powerMonBefore", String.valueOf(monPowerPercentageVo.getPowerMonYearBefore())); |
|
|
|
temp.put("powerYearBefore", String.valueOf(monPowerPercentageVo.getPowerYearBefore())); |
|
|
|
temp.put("powerYearBefore", String.valueOf(monPowerPercentageVo.getPowerYearBefore())); |
|
|
|
temp.put("mon",String.valueOf(monPowerPercentageVo.getPowerMon())); |
|
|
|
temp.put("mon", String.valueOf(monPowerPercentageVo.getPowerMon())); |
|
|
|
temp.put("year",String.valueOf(monPowerPercentageVo.getPowerYear())); |
|
|
|
temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear())); |
|
|
|
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage()*100+"%"); |
|
|
|
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%"); |
|
|
|
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage()*100+"%"); |
|
|
|
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%"); |
|
|
|
temp.put("plan",monPowerPercentageVo.getPlanPercentage()*100+"%"); |
|
|
|
temp.put("plan", monPowerPercentageVo.getPlanPercentage() * 100 + "%"); |
|
|
|
list.add(temp); |
|
|
|
list.add(temp); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("powerGeneration", list); |
|
|
|
map.put("powerGeneration", list); |
|
|
@ -459,12 +421,14 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
wrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); |
|
|
|
wrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); |
|
|
|
wrapper.in(OperPhenomenonEntity::getCreateDept, deptIds); |
|
|
|
wrapper.in(OperPhenomenonEntity::getCreateDept, deptIds); |
|
|
|
List<OperPhenomenonEntity> monPhenomenonList = operPhenomenonService.list(wrapper); |
|
|
|
List<OperPhenomenonEntity> monPhenomenonList = operPhenomenonService.list(wrapper); |
|
|
|
monPhenomenonList= monPhenomenonList.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.toList()); |
|
|
|
monPhenomenonList = monPhenomenonList.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.toList()); |
|
|
|
List<OperPhenomenonEntity> monConclusionList = monPhenomenonList.stream().filter(s -> s.getConclusionStatus().equals(1)).collect(Collectors.toList()); |
|
|
|
List<OperPhenomenonEntity> monConclusionList = monPhenomenonList.stream().filter(s -> s.getConclusionStatus().equals("1")).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 只填写二类及以上缺陷
|
|
|
|
|
|
|
|
List<OperPhenomenonEntity> monConclusionListBy = monConclusionList.stream().filter(s -> !s.getDefectGrading().equals("1")).collect(Collectors.toList()); |
|
|
|
// 各电站缺陷处理统计表
|
|
|
|
// 各电站缺陷处理统计表
|
|
|
|
monConclusionList.stream().sorted(Comparator.comparing(OperPhenomenonEntity::getDefectGrading).reversed().thenComparing(OperPhenomenonEntity::getCreateTime)); |
|
|
|
monConclusionListBy.stream().sorted(Comparator.comparing(OperPhenomenonEntity::getCreateDept).reversed().thenComparing(OperPhenomenonEntity::getDefectGrading)); |
|
|
|
ArrayList<HashMap<String, String>> checkList = new ArrayList<>(monConclusionList.size()); |
|
|
|
ArrayList<HashMap<String, String>> checkList = new ArrayList<>(); |
|
|
|
for (OperPhenomenonEntity operPhenomenonEntity : monConclusionList) { |
|
|
|
for (OperPhenomenonEntity operPhenomenonEntity : monConclusionListBy) { |
|
|
|
Long createDept = operPhenomenonEntity.getCreateDept(); |
|
|
|
Long createDept = operPhenomenonEntity.getCreateDept(); |
|
|
|
R<String> createDeptName = sysClient.getDeptName(createDept); |
|
|
|
R<String> createDeptName = sysClient.getDeptName(createDept); |
|
|
|
if (!createDeptName.isSuccess() && createDeptName.getData() != null) { |
|
|
|
if (!createDeptName.isSuccess() && createDeptName.getData() != null) { |
|
|
@ -473,9 +437,21 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
//表格数据
|
|
|
|
//表格数据
|
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
temp.put("name", createDeptName.getData()); |
|
|
|
temp.put("name", createDeptName.getData()); |
|
|
|
temp.put("level", operPhenomenonEntity.getDefectGrading()); |
|
|
|
String checkLevel=""; |
|
|
|
temp.put("createTime", operPhenomenonEntity.getCreateTime().toString()); |
|
|
|
if(operPhenomenonEntity.getDefectGrading().equals("1")) { |
|
|
|
temp.put("findTime", operPhenomenonEntity.getFindTime().toString()); |
|
|
|
checkLevel="Ⅰ级缺陷"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(operPhenomenonEntity.getDefectGrading().equals("2") ){ |
|
|
|
|
|
|
|
checkLevel="Ⅱ级缺陷"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(operPhenomenonEntity.getDefectGrading().equals("3") ){ |
|
|
|
|
|
|
|
checkLevel="Ⅲ级缺陷"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
temp.put("level", checkLevel); |
|
|
|
|
|
|
|
String createTime= simpleDateFormat.format(operPhenomenonEntity.getCreateTime()); |
|
|
|
|
|
|
|
temp.put("createTime", createTime); |
|
|
|
|
|
|
|
String findTime= simpleDateFormat.format(operPhenomenonEntity.getFindTime()); |
|
|
|
|
|
|
|
temp.put("findTime", findTime); |
|
|
|
temp.put("descripiton", operPhenomenonEntity.getDescripiton()); |
|
|
|
temp.put("descripiton", operPhenomenonEntity.getDescripiton()); |
|
|
|
temp.put("disposeDesc", operPhenomenonEntity.getDisposeDesc()); |
|
|
|
temp.put("disposeDesc", operPhenomenonEntity.getDisposeDesc()); |
|
|
|
checkList.add(temp); |
|
|
|
checkList.add(temp); |
|
|
@ -490,8 +466,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
wrapperYear.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); |
|
|
|
wrapperYear.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); |
|
|
|
wrapperYear.in(OperPhenomenonEntity::getCreateDept, deptIds); |
|
|
|
wrapperYear.in(OperPhenomenonEntity::getCreateDept, deptIds); |
|
|
|
List<OperPhenomenonEntity> yearPhenomenonEntities = operPhenomenonService.list(wrapperYear); |
|
|
|
List<OperPhenomenonEntity> yearPhenomenonEntities = operPhenomenonService.list(wrapperYear); |
|
|
|
yearPhenomenonEntities= yearPhenomenonEntities.stream().filter(s ->StringUtil.isNotBlank(s.getDefectGrading())).filter(s -> ObjectUtil.isNotEmpty(s.getCreateDept())).collect(Collectors.toList()); |
|
|
|
yearPhenomenonEntities = yearPhenomenonEntities.stream().filter(s -> StringUtil.isNotBlank(s.getDefectGrading())).filter(s -> ObjectUtil.isNotEmpty(s.getCreateDept())).collect(Collectors.toList()); |
|
|
|
List<OperPhenomenonEntity> yearConclusionList = yearPhenomenonEntities.stream().filter(s -> s.getConclusionStatus().equals(1)).collect(Collectors.toList()); |
|
|
|
List<OperPhenomenonEntity> yearConclusionList = yearPhenomenonEntities.stream().filter(s -> s.getConclusionStatus().equals("1")).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> checkStatistics = new ArrayList<>(); |
|
|
|
ArrayList<HashMap<String, String>> checkStatistics = new ArrayList<>(); |
|
|
|
List<CheckChartVo> checkChartRes = new ArrayList<>(); |
|
|
|
List<CheckChartVo> checkChartRes = new ArrayList<>(); |
|
|
@ -499,13 +475,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
//表格数据
|
|
|
|
//表格数据
|
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
temp.put("deptName", "总计"); |
|
|
|
temp.put("deptName", "总计"); |
|
|
|
temp.put("checkLevel", "0"); |
|
|
|
temp.put("checkLevel", "无等级"); |
|
|
|
temp.put("findShortagesMon", "0"); |
|
|
|
temp.put("findShortagesMon", "0"); |
|
|
|
temp.put("shortagesMon", "0"); |
|
|
|
temp.put("shortagesMon", "0"); |
|
|
|
temp.put("findShortagesYear", "0"); |
|
|
|
temp.put("findShortagesYear", "0"); |
|
|
|
temp.put("shortagesYear", "0"); |
|
|
|
temp.put("shortagesYear", "0"); |
|
|
|
temp.put("shortagesRate", "0"); |
|
|
|
temp.put("shortagesRate", "0%"); |
|
|
|
checkList.add(temp); |
|
|
|
checkStatistics.add(temp); |
|
|
|
map.put("checkStatistics", checkStatistics); |
|
|
|
map.put("checkStatistics", checkStatistics); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Map<Long, Map<String, List<OperPhenomenonEntity>>> phenomenonMap = yearPhenomenonEntities.stream().collect( |
|
|
|
Map<Long, Map<String, List<OperPhenomenonEntity>>> phenomenonMap = yearPhenomenonEntities.stream().collect( |
|
|
@ -515,13 +491,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
R<String> deptName1 = sysClient.getDeptName(deptMapEntry.getKey()); |
|
|
|
R<String> deptName1 = sysClient.getDeptName(deptMapEntry.getKey()); |
|
|
|
for (Map.Entry<String, List<OperPhenomenonEntity>> levelList : deptMapEntry.getValue().entrySet()) { |
|
|
|
for (Map.Entry<String, List<OperPhenomenonEntity>> levelList : deptMapEntry.getValue().entrySet()) { |
|
|
|
Integer findShortagesYear = levelList.getValue().size(); |
|
|
|
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(); |
|
|
|
Integer shortagesYear = yearConclusionList.stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).collect(Collectors.toList()).size(); |
|
|
|
Double shortagesRate = 0d; |
|
|
|
Double shortagesRate = 0d; |
|
|
|
if (findShortagesYear != 0 && shortagesYear != 0) { |
|
|
|
if (findShortagesYear != 0 && shortagesYear != 0) { |
|
|
|
shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
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 findShortagesMon = Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).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(); |
|
|
|
Integer shortagesMon = Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).collect(Collectors.toList()).size(); |
|
|
|
CheckChartVo checkChartVo = new CheckChartVo(deptName1.getData(), levelList.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate); |
|
|
|
CheckChartVo checkChartVo = new CheckChartVo(deptName1.getData(), levelList.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate); |
|
|
|
checkChartRes.add(checkChartVo); |
|
|
|
checkChartRes.add(checkChartVo); |
|
|
|
} |
|
|
|
} |
|
|
@ -530,37 +506,41 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
Map<String, List<OperPhenomenonEntity>> levelPhenomenonList = yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading)); |
|
|
|
Map<String, List<OperPhenomenonEntity>> levelPhenomenonList = yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading)); |
|
|
|
for (Map.Entry<String, List<OperPhenomenonEntity>> levelPhenomenon : levelPhenomenonList.entrySet()) { |
|
|
|
for (Map.Entry<String, List<OperPhenomenonEntity>> levelPhenomenon : levelPhenomenonList.entrySet()) { |
|
|
|
Integer findShortagesYear = levelPhenomenon.getValue().size(); |
|
|
|
Integer findShortagesYear = levelPhenomenon.getValue().size(); |
|
|
|
Integer shortagesYear = Optional.ofNullable(yearConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelPhenomenon)).collect(Collectors.toList()).size(); |
|
|
|
Integer shortagesYear = Optional.ofNullable(yearConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).collect(Collectors.toList()).size(); |
|
|
|
Double shortagesRate = 0d; |
|
|
|
Double shortagesRate = 0d; |
|
|
|
if (findShortagesYear != 0 && shortagesYear != 0) { |
|
|
|
if (findShortagesYear != 0 && shortagesYear != 0) { |
|
|
|
shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
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 findShortagesMon = Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).collect(Collectors.toList()).size(); |
|
|
|
Integer shortagesMon = Optional.ofNullable(monConclusionList).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.getDefectGrading().equals(levelPhenomenon.getKey())).collect(Collectors.toList()).size(); |
|
|
|
CheckChartVo checkChartVo = new CheckChartVo("总计", levelPhenomenon.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate); |
|
|
|
CheckChartVo checkChartVo = new CheckChartVo("总计", levelPhenomenon.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate); |
|
|
|
checkChartRes.add(checkChartVo); |
|
|
|
checkChartRes.add(checkChartVo); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (CheckChartVo checkChartRe : checkChartRes) { |
|
|
|
for (CheckChartVo checkChartRe : checkChartRes) { |
|
|
|
//表格数据
|
|
|
|
//表格数据
|
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
HashMap<String, String> temp = new HashMap<>(); |
|
|
|
temp.put("deptName", checkChartRe.getDeptName()); |
|
|
|
temp.put("deptName", checkChartRe.getDeptName()); |
|
|
|
temp.put("checkLevel", checkChartRe.getCheckLevel()); |
|
|
|
String checkLevel=null; |
|
|
|
temp.put("findShortagesMon",checkChartRe.getFindShortagesMon().toString()); |
|
|
|
if(checkChartRe.getCheckLevel().equals("1")) { |
|
|
|
temp.put("shortagesMon",checkChartRe.getShortagesMon().toString()); |
|
|
|
checkLevel="Ⅰ级缺陷"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(checkChartRe.getCheckLevel().equals("2")) { |
|
|
|
|
|
|
|
checkLevel="Ⅱ级缺陷"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(checkChartRe.getCheckLevel().equals("3")) { |
|
|
|
|
|
|
|
checkLevel="Ⅲ级缺陷"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
temp.put("checkLevel", checkLevel); |
|
|
|
|
|
|
|
temp.put("findShortagesMon", checkChartRe.getFindShortagesMon().toString()); |
|
|
|
|
|
|
|
temp.put("shortagesMon", checkChartRe.getShortagesMon().toString()); |
|
|
|
temp.put("findShortagesYear", checkChartRe.getShortagesYear().toString()); |
|
|
|
temp.put("findShortagesYear", checkChartRe.getShortagesYear().toString()); |
|
|
|
temp.put("shortagesYear", checkChartRe.getFindShortagesYear().toString()); |
|
|
|
temp.put("shortagesYear", checkChartRe.getFindShortagesYear().toString()); |
|
|
|
temp.put("shortagesRate", checkChartRe.getShortagesRate().toString()); |
|
|
|
temp.put("shortagesRate", checkChartRe.getShortagesRate()* 100 + "%"); |
|
|
|
checkList.add(temp); |
|
|
|
checkStatistics.add(temp); |
|
|
|
map.put("checkStatistics", checkStatistics); |
|
|
|
map.put("checkStatistics", checkStatistics); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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<WorkTicketInfoEntity>> yearTicket = ticketInfoClient.getWorkTicketByTime(yearStart, yearEndV2); |
|
|
|
R<List<StandardTicketInfoEntity>> yearOperateTicket = ticketInfoClient.getOperateTicketByTime(yearStart, yearEndV2); |
|
|
|
R<List<StandardTicketInfoEntity>> yearOperateTicket = ticketInfoClient.getOperateTicketByTime(yearStart, yearEndV2); |
|
|
@ -572,7 +552,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
List<TicketChartVo> ticketList = new ArrayList<>(); |
|
|
|
List<TicketChartVo> ticketList = new ArrayList<>(); |
|
|
|
for (Dept dept : deptList) { |
|
|
|
for (Dept dept : deptList) { |
|
|
|
String stationId = dept.getStationId(); |
|
|
|
String stationId = dept.getStationId(); |
|
|
|
if (stationId==null){ |
|
|
|
if (stationId == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
TicketChartVo chartVo = new TicketChartVo(); |
|
|
|
TicketChartVo chartVo = new TicketChartVo(); |
|
|
@ -582,61 +562,61 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
TicketChartCell ticketChartCell = new TicketChartCell(); |
|
|
|
TicketChartCell ticketChartCell = new TicketChartCell(); |
|
|
|
ticketChartCell.setTicketType(value.getType()); |
|
|
|
ticketChartCell.setTicketType(value.getType()); |
|
|
|
ticketChartCell.setTicketName(value.getFileName()); |
|
|
|
ticketChartCell.setTicketName(value.getFileName()); |
|
|
|
if (value.getTicketType()==2){ |
|
|
|
if (value.getTicketType() == 2) { |
|
|
|
List<WorkTicketInfoEntity> yearTicketCollect = Optional.ofNullable(yearTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
List<WorkTicketInfoEntity> yearTicketCollect = Optional.ofNullable(yearTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
.filter(s ->stationId.equals(s.getSignageCode())) |
|
|
|
.filter(s -> stationId.equals(s.getSignageCode())) |
|
|
|
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
List<WorkTicketInfoEntity> monthTicketCollect = Optional.ofNullable(monthTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
List<WorkTicketInfoEntity> monthTicketCollect = Optional.ofNullable(monthTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
.filter(s -> s.getSignageCode().equals(stationId)) |
|
|
|
.filter(s -> s.getSignageCode().equals(stationId)) |
|
|
|
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
.filter(s -> s.getType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(yearTicketCollect)){ |
|
|
|
if (CollectionUtils.isNotEmpty(yearTicketCollect)) { |
|
|
|
//年合格率和数量
|
|
|
|
//年合格率和数量
|
|
|
|
Integer count = yearTicketCollect.size(); |
|
|
|
Integer count = yearTicketCollect.size(); |
|
|
|
ticketChartCell.setTicketYear(count); |
|
|
|
ticketChartCell.setTicketYear(count); |
|
|
|
List<Long> ticketIds = yearTicketCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> ticketIds = yearTicketCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds); |
|
|
|
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds); |
|
|
|
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null&&count!=0) { |
|
|
|
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) { |
|
|
|
Double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
Double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
ticketChartCell.setTicketYeaPercr(ticketYearPerc); |
|
|
|
ticketChartCell.setTicketYeaPercr(ticketYearPerc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(monthTicketCollect)){ |
|
|
|
if (CollectionUtils.isNotEmpty(monthTicketCollect)) { |
|
|
|
//月合格率和数量
|
|
|
|
//月合格率和数量
|
|
|
|
Integer count = monthTicketCollect.size(); |
|
|
|
Integer count = monthTicketCollect.size(); |
|
|
|
ticketChartCell.setTicketMon(count); |
|
|
|
ticketChartCell.setTicketMon(count); |
|
|
|
List<Long> monthTicketIds = monthTicketCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> monthTicketIds = monthTicketCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds); |
|
|
|
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds); |
|
|
|
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null&&count!=0) { |
|
|
|
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) { |
|
|
|
Double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
Double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
ticketChartCell.setTicketMonPerc(ticketMonthPerc); |
|
|
|
ticketChartCell.setTicketMonPerc(ticketMonthPerc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (value.getTicketType()==1){ |
|
|
|
if (value.getTicketType() == 1) { |
|
|
|
List<StandardTicketInfoEntity> yearOperateCollect = Optional.ofNullable(yearOperateTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
List<StandardTicketInfoEntity> yearOperateCollect = Optional.ofNullable(yearOperateTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
.filter(s ->stationId.equals(s.getSignageCode())) |
|
|
|
.filter(s -> stationId.equals(s.getSignageCode())) |
|
|
|
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
List<StandardTicketInfoEntity> monthOperateCollect = Optional.ofNullable(monthOperateTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
List<StandardTicketInfoEntity> monthOperateCollect = Optional.ofNullable(monthOperateTicket.getData()).orElse(new ArrayList<>()).stream() |
|
|
|
.filter(s -> s.getSignageCode().equals(stationId)) |
|
|
|
.filter(s -> s.getSignageCode().equals(stationId)) |
|
|
|
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
.filter(s -> s.getTicketType().equals(value.getType())).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(yearOperateCollect)){ |
|
|
|
if (CollectionUtils.isNotEmpty(yearOperateCollect)) { |
|
|
|
//年合格率和数量
|
|
|
|
//年合格率和数量
|
|
|
|
Integer count = yearOperateCollect.size(); |
|
|
|
Integer count = yearOperateCollect.size(); |
|
|
|
ticketChartCell.setTicketYear(count); |
|
|
|
ticketChartCell.setTicketYear(count); |
|
|
|
List<Long> ticketIds = yearOperateCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> ticketIds = yearOperateCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds); |
|
|
|
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds); |
|
|
|
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null&&count!=0) { |
|
|
|
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) { |
|
|
|
Double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
Double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
ticketChartCell.setTicketYeaPercr(ticketYearPerc); |
|
|
|
ticketChartCell.setTicketYeaPercr(ticketYearPerc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(monthOperateCollect)){ |
|
|
|
if (CollectionUtils.isNotEmpty(monthOperateCollect)) { |
|
|
|
//月合格率和数量
|
|
|
|
//月合格率和数量
|
|
|
|
Integer count = monthOperateCollect.size(); |
|
|
|
Integer count = monthOperateCollect.size(); |
|
|
|
ticketChartCell.setTicketMon(count); |
|
|
|
ticketChartCell.setTicketMon(count); |
|
|
|
List<Long> monthTicketIds = monthOperateCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
List<Long> monthTicketIds = monthOperateCollect.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds); |
|
|
|
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds); |
|
|
|
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null&&count!=0) { |
|
|
|
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) { |
|
|
|
Double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
Double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue(); |
|
|
|
ticketChartCell.setTicketMonPerc(ticketMonthPerc); |
|
|
|
ticketChartCell.setTicketMonPerc(ticketMonthPerc); |
|
|
|
} |
|
|
|
} |
|
|
@ -647,11 +627,14 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
chartVo.setChartCells(cellList); |
|
|
|
chartVo.setChartCells(cellList); |
|
|
|
ticketList.add(chartVo); |
|
|
|
ticketList.add(chartVo); |
|
|
|
} |
|
|
|
} |
|
|
|
List<TicketChartCell> sumCollect=new ArrayList<>(); |
|
|
|
List<TicketChartCell> allCollect = new ArrayList<>(); |
|
|
|
ticketList.stream().map(s -> sumCollect.addAll(s.getChartCells())); |
|
|
|
List<TicketChartCell> sumCollect = new ArrayList<>(); |
|
|
|
Map<String, List<TicketChartCell>> groupingCollect = sumCollect.stream().collect(Collectors.groupingBy(TicketChartCell::getTicketType)); |
|
|
|
for (TicketChartVo ticketChartVo : ticketList) { |
|
|
|
|
|
|
|
allCollect.addAll( ticketChartVo.getChartCells()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<String, List<TicketChartCell>> groupingCollect = allCollect.stream().collect(Collectors.groupingBy(TicketChartCell::getTicketType)); |
|
|
|
for (Map.Entry<String, List<TicketChartCell>> mapTicketChart : groupingCollect.entrySet()) { |
|
|
|
for (Map.Entry<String, List<TicketChartCell>> mapTicketChart : groupingCollect.entrySet()) { |
|
|
|
TicketChartCell sumCell=new TicketChartCell(); |
|
|
|
TicketChartCell sumCell = new TicketChartCell(); |
|
|
|
sumCell.setTicketType(mapTicketChart.getKey()); |
|
|
|
sumCell.setTicketType(mapTicketChart.getKey()); |
|
|
|
sumCell.setTicketName(TicketConstants.TicketTypeNameEnum.getTicketNameByType(mapTicketChart.getKey())); |
|
|
|
sumCell.setTicketName(TicketConstants.TicketTypeNameEnum.getTicketNameByType(mapTicketChart.getKey())); |
|
|
|
List<TicketChartCell> ticketChartValue = mapTicketChart.getValue(); |
|
|
|
List<TicketChartCell> ticketChartValue = mapTicketChart.getValue(); |
|
|
@ -661,72 +644,132 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
sumCell.setTicketYeaPercr(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketYeaPercr).sum()); |
|
|
|
sumCell.setTicketYeaPercr(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketYeaPercr).sum()); |
|
|
|
sumCollect.add(sumCell); |
|
|
|
sumCollect.add(sumCell); |
|
|
|
} |
|
|
|
} |
|
|
|
TicketChartVo ticketChartVo=new TicketChartVo(); |
|
|
|
TicketChartVo ticketChartVo = new TicketChartVo(); |
|
|
|
ticketChartVo.setDeptName("总计"); |
|
|
|
ticketChartVo.setDeptName("总计"); |
|
|
|
ticketChartVo.setChartCells(sumCollect); |
|
|
|
ticketChartVo.setChartCells(sumCollect); |
|
|
|
|
|
|
|
ticketList.add(ticketChartVo); |
|
|
|
|
|
|
|
// 两票排序
|
|
|
|
|
|
|
|
ticketList.sort(Comparator.comparing(TicketChartVo::getDeptName,Comparator.reverseOrder())); |
|
|
|
//两票表格数据
|
|
|
|
//两票表格数据
|
|
|
|
ArrayList<HashMap<String, String>> ticketListRes = new ArrayList<>(); |
|
|
|
ArrayList<HashMap<String, String>> ticketListRes = new ArrayList<>(); |
|
|
|
for (TicketChartVo chartVo : ticketList) { |
|
|
|
for (TicketChartVo chartVo : ticketList) { |
|
|
|
HashMap<String, String> ticketMap = new HashMap<>(); |
|
|
|
HashMap<String, String> ticketMap = new HashMap<>(); |
|
|
|
|
|
|
|
HashMap<String, String> ticketMap2 = new HashMap<>(); |
|
|
|
for (TicketChartCell chartCell : chartVo.getChartCells()) { |
|
|
|
for (TicketChartCell chartCell : chartVo.getChartCells()) { |
|
|
|
String ticketType = chartCell.getTicketType(); |
|
|
|
String ticketType = chartCell.getTicketType(); |
|
|
|
ticketMap.put("deptName",chartVo.getDeptName()); |
|
|
|
ticketMap.put("deptName", chartVo.getDeptName()); |
|
|
|
ticketMap.put("info","执行"); |
|
|
|
ticketMap2.put("deptName", chartVo.getDeptName()); |
|
|
|
ticketMap.put("infoPass","合格率"); |
|
|
|
ticketMap.put("info", "执行"); |
|
|
|
ticketMap.put("ticketMon"+ticketType,String.valueOf(chartCell.getTicketMon())); |
|
|
|
ticketMap2.put("info", "合格率"); |
|
|
|
ticketMap.put("ticketYear"+ticketType,String.valueOf(chartCell.getTicketYear())); |
|
|
|
ticketMap.put("ticketMon" + ticketType, String.valueOf(chartCell.getTicketMon())); |
|
|
|
ticketMap.put("ticketMonPerc"+ticketType,String.valueOf(chartCell.getTicketMonPerc())); |
|
|
|
ticketMap.put("ticketYear" + ticketType, String.valueOf(chartCell.getTicketYear())); |
|
|
|
ticketMap.put("ticketYeaPercr"+ticketType,String.valueOf(chartCell.getTicketYeaPercr())); |
|
|
|
ticketMap2.put("ticketMon" + ticketType, chartCell.getTicketMonPerc()* 100 + "%"); |
|
|
|
|
|
|
|
ticketMap2.put("ticketYear" + ticketType, chartCell.getTicketYeaPercr()* 100 + "%"); |
|
|
|
} |
|
|
|
} |
|
|
|
ticketListRes.add(ticketMap); |
|
|
|
ticketListRes.add(ticketMap); |
|
|
|
|
|
|
|
ticketListRes.add(ticketMap2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ticketListRes.sort(Comparator.comparing(o -> o.get("deptName"))); |
|
|
|
map.put("ticketList", ticketListRes); |
|
|
|
map.put("ticketList", ticketListRes); |
|
|
|
//两票柱状图数据
|
|
|
|
//两票柱状图数据
|
|
|
|
// 创建数据
|
|
|
|
// 创建柱状和折线数据库
|
|
|
|
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); |
|
|
|
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); |
|
|
|
for (TicketChartVo chartVo : ticketList) { |
|
|
|
for (TicketChartCell sumTicket : sumCollect) { |
|
|
|
for (int i = 0; i < chartVo.getChartCells().size(); i++) { |
|
|
|
dataset.addValue(sumTicket.getTicketMon(), "数量", sumTicket.getTicketName()); |
|
|
|
TicketChartCell ticketChartCell = chartVo.getChartCells().get(i); |
|
|
|
|
|
|
|
dataset.addValue(ticketChartCell.getTicketMon(), String.valueOf(i), ticketChartCell.getTicketName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
DefaultCategoryDataset datasetLine = new DefaultCategoryDataset(); |
|
|
|
DefaultCategoryDataset datasetLine = new DefaultCategoryDataset(); |
|
|
|
for (TicketChartVo chartVo : ticketList) { |
|
|
|
for (TicketChartCell sumTicket : sumCollect) { |
|
|
|
for (int i = 0; i < chartVo.getChartCells().size(); i++) { |
|
|
|
datasetLine.addValue(sumTicket.getTicketMonPerc(), "合格率", sumTicket.getTicketName()); |
|
|
|
TicketChartCell ticketChartCell = chartVo.getChartCells().get(i); |
|
|
|
|
|
|
|
datasetLine.addValue(ticketChartCell.getTicketMonPerc(), ticketChartCell.getTicketName(), ticketChartCell.getTicketName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
String title=deptName+"水电运维项目两票统计表"; |
|
|
|
String title = deptName + "水电运维项目两票统计表"; |
|
|
|
String domainAxis="数量"; |
|
|
|
String rangeAxis = "数量"; |
|
|
|
String rangeAxis="票据类型"; |
|
|
|
ImageEntity ticketImage = JFreeUtil.iCreateBarLineChart(true, title, null, rangeAxis, dataset, datasetLine, 662, 378); |
|
|
|
ImageEntity ticketImage = JFreeUtil.iCreateBarLineChart(true, title, domainAxis, rangeAxis, dataset, datasetLine,662, 378); |
|
|
|
|
|
|
|
map.put("ticketImage", ticketImage); |
|
|
|
map.put("ticketImage", ticketImage); |
|
|
|
|
|
|
|
|
|
|
|
// //模拟表格数据
|
|
|
|
|
|
|
|
// 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("成功"); |
|
|
|
return R.success("成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getPowerData(List<Dept> deptList, String yearStart, String yearEnd, String yearBeforeStart, String yearBeforeEnd, String monthStart, String monthEnd, String beforeMonthStart, String beforeMonthEnd, String monthStartBeforeYear, String monthEndBeforeYear, List<EminfoAndEmParamVo> devices, List<PlanGenerationEntity> planYearData, List<MonPowerPercentageVo> powerPercentageVoList) { |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
Double planGeneration = 0d; |
|
|
|
|
|
|
|
List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> dept.getId().equals(s.getCreateDept())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(planGenerationById)) { |
|
|
|
|
|
|
|
planGeneration = Double.valueOf(planGenerationById.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(Double.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(Double.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(Double.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(Double.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(Double.valueOf(ktv.getVal()))) |
|
|
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
|
|
|
powerMonthYearBefore = powerMonthYearBefore.add(powerBefore); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerYear(powerYear.doubleValue()); |
|
|
|
|
|
|
|
powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); |
|
|
|
|
|
|
|
BigDecimal yearPercentage = new BigDecimal(0); |
|
|
|
|
|
|
|
BigDecimal planPercentage = new BigDecimal(0); |
|
|
|
|
|
|
|
if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
|
|
|
|
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
|
|
|
|
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPlanPercentage(planPercentage.doubleValue()); |
|
|
|
|
|
|
|
powerVo.setPowerYearPercentage(yearPercentage.doubleValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMon(powerMonth.doubleValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMonBefore(powerMonthBefore.doubleValue()); |
|
|
|
|
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); |
|
|
|
|
|
|
|
BigDecimal monPercentage = new BigDecimal(0); |
|
|
|
|
|
|
|
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
|
|
|
|
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
powerVo.setPowerMonPercentage(monPercentage.doubleValue()); |
|
|
|
|
|
|
|
powerPercentageVoList.add(powerVo); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll, HashMap<String, Object> map) { |
|
|
|
private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll, HashMap<String, Object> map) { |
|
|
@ -752,15 +795,15 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); |
|
|
|
powerVo.setPowerYearBefore(powerYearBefore.doubleValue()); |
|
|
|
BigDecimal yearPercentage = new BigDecimal(0); |
|
|
|
BigDecimal yearPercentage = new BigDecimal(0); |
|
|
|
BigDecimal planPercentage = new BigDecimal(0); |
|
|
|
BigDecimal planPercentage = new BigDecimal(0); |
|
|
|
if (powerYearBefore.compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
// 年累计环比
|
|
|
|
// 年累计环比
|
|
|
|
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
} |
|
|
|
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
// 年计划完成率
|
|
|
|
// 年计划完成率
|
|
|
|
map.put("yearCompletionRate", planPercentage.toString()); |
|
|
|
map.put("yearCompletionRate", planPercentage.toString()); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
map.put("yearCompletionRate", 0); |
|
|
|
map.put("yearCompletionRate", 0); |
|
|
|
} |
|
|
|
} |
|
|
|
powerVo.setPowerYearPercentage(yearPercentage.doubleValue()); |
|
|
|
powerVo.setPowerYearPercentage(yearPercentage.doubleValue()); |
|
|
@ -773,7 +816,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
map.put("powerMon", powerMonth.toString()); |
|
|
|
map.put("powerMon", powerMonth.toString()); |
|
|
|
// 项目月计划完成量
|
|
|
|
// 项目月计划完成量
|
|
|
|
BigDecimal planMonPercentage = new BigDecimal(0); |
|
|
|
BigDecimal planMonPercentage = new BigDecimal(0); |
|
|
|
if (powerMonth.compareTo(BigDecimal.ZERO)!=0 &&BigDecimal.valueOf(planMonGeneration).compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (powerMonth.compareTo(BigDecimal.ZERO) != 0 && BigDecimal.valueOf(planMonGeneration).compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
planMonPercentage = powerMonth.divide(BigDecimal.valueOf(planMonGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
planMonPercentage = powerMonth.divide(BigDecimal.valueOf(planMonGeneration), 2, BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
} |
|
|
|
map.put("monCompletionRate", planMonPercentage); |
|
|
|
map.put("monCompletionRate", planMonPercentage); |
|
|
@ -786,12 +829,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); |
|
|
|
powerVo.setPowerMonYearBefore(powerMonthYearBefore.doubleValue()); |
|
|
|
BigDecimal monPercentage = new BigDecimal(0); |
|
|
|
BigDecimal monPercentage = new BigDecimal(0); |
|
|
|
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO)!=0) { |
|
|
|
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) { |
|
|
|
monPercentage =(powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP); |
|
|
|
} |
|
|
|
} |
|
|
|
//发电量环比增加
|
|
|
|
//发电量环比增加
|
|
|
|
BigDecimal monAdd = powerMonth.subtract(powerMonthBefore); |
|
|
|
BigDecimal monAdd = powerMonth.subtract(powerMonthBefore); |
|
|
|
if (powerMonthBefore.compareTo(BigDecimal.ZERO)==0) { |
|
|
|
if (powerMonthBefore.compareTo(BigDecimal.ZERO) == 0) { |
|
|
|
map.put("percentageAdd", 0); |
|
|
|
map.put("percentageAdd", 0); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
map.put("percentageAdd", monAdd.divide(powerMonthBefore, 2, BigDecimal.ROUND_UP).toString()); |
|
|
|
map.put("percentageAdd", monAdd.divide(powerMonthBefore, 2, BigDecimal.ROUND_UP).toString()); |
|
|
|