1.谐波统计bug修改

This commit is contained in:
wr
2023-09-19 11:01:48 +08:00
parent e0ac80822a
commit 7da60259b6
3 changed files with 159 additions and 154 deletions

View File

@@ -25,15 +25,16 @@ public class AreaDTO {
/** /**
* 平均超标天数 * 平均超标天数
*/ */
private Double averageOverDay = 0.0; private Double averageOverDay = 3.14159;
/** /**
* 符合性占比 * 符合性占比
*/ */
private Double ratio = 0.0; private Double ratio = 3.14159;
/** /**
* 监测点超标占比 * 监测点超标占比
*/ */
private Double lineRatio = 0.0; private Double lineRatio = 3.14159;
} }

View File

@@ -33,17 +33,17 @@ public class HarmonicDeptVO implements Serializable {
private Integer overLineCount = 0; private Integer overLineCount = 0;
@ApiModelProperty("符合性占比") @ApiModelProperty("符合性占比")
private Double ratio = -1.0; private Double ratio = 3.14159;
/** /**
* 监测点超标占比 * 监测点超标占比
*/ */
@ApiModelProperty("监测点超标占比") @ApiModelProperty("监测点超标占比")
private Double lineRatio; private Double lineRatio = 3.14159;
/** /**
* 平均超标天数 * 平均超标天数
*/ */
@ApiModelProperty("平均超标天数") @ApiModelProperty("平均超标天数")
private Double averageOverDay = -1.0; private Double averageOverDay = 3.14159;
} }

View File

@@ -57,6 +57,7 @@ public class HarmonicServiceImpl implements IHarmonicService {
private final LineFeignClient lineFeignClient; private final LineFeignClient lineFeignClient;
private final RStatLimitTargetDMapper targetDMapper; private final RStatLimitTargetDMapper targetDMapper;
@Override @Override
public List<PollutionVO> getDeptSubstationRelations(HarmonicPublicParam harmonicPublicParam) { public List<PollutionVO> getDeptSubstationRelations(HarmonicPublicParam harmonicPublicParam) {
harmonicPublicParam.setServerName(generalInfo.getMicroServiceName()); harmonicPublicParam.setServerName(generalInfo.getMicroServiceName());
@@ -104,13 +105,10 @@ public class HarmonicServiceImpl implements IHarmonicService {
//监测点id //监测点id
List<String> lineIds = l1.stream().map(PollutionLineDTO::getId).collect(Collectors.toList()); List<String> lineIds = l1.stream().map(PollutionLineDTO::getId).collect(Collectors.toList());
List<RStatLimitTargetDPO> collect = limitTargetNew.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList()); List<RStatLimitTargetDPO> collect = limitTargetNew.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
List<RStatLimitTargetDPO> sumList = finalAllData.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList()); List<RStatLimitTargetDPO> sumList = finalAllData.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
children.setData(handleDataNew(collect, sumList, harmonicPublicParam.getStatisticalType().getCode()).getRatio()); children.setData(handleDataNew(collect, sumList, harmonicPublicParam.getStatisticalType().getCode()).getRatio());
childrenList.add(children); childrenList.add(children);
}); });
if (!CollectionUtils.isEmpty(childrenList)) { if (!CollectionUtils.isEmpty(childrenList)) {
pollutionVO.setChildren(childrenList.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList())); pollutionVO.setChildren(childrenList.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList()));
} }
@@ -120,7 +118,6 @@ public class HarmonicServiceImpl implements IHarmonicService {
} }
list.add(pollutionVO); list.add(pollutionVO);
} }
}); });
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
return list.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList()); return list.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList());
@@ -161,7 +158,12 @@ public class HarmonicServiceImpl implements IHarmonicService {
} }
}); });
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
return list.stream().sorted(Comparator.comparing(HarmonicDeptVO::getRatio).reversed().thenComparing(HarmonicDeptVO::getOnlineCount).thenComparing(HarmonicDeptVO::getOverLineCount)).collect(Collectors.toList()); List<HarmonicDeptVO> collect = list.stream().filter(x->x.getRatio()!=3.14159&&x.getOnlineCount()!=0&&x.getOverLineCount()!=0)
.sorted(Comparator.comparing(HarmonicDeptVO::getRatio).reversed().thenComparing(HarmonicDeptVO::getOnlineCount).thenComparing(HarmonicDeptVO::getOverLineCount)).collect(Collectors.toList());
List<String> ids = collect.stream().map(HarmonicDeptVO::getId).collect(Collectors.toList());
collect.addAll(list.stream().filter(x->!ids.contains(x.getId()))
.collect(Collectors.toList()));
return collect;
} }
return list; return list;
} }
@@ -284,8 +286,10 @@ public class HarmonicServiceImpl implements IHarmonicService {
); );
return limitRates; return limitRates;
} }
/** /**
* 功能描述: 获取limitTarget数据 * 功能描述: 获取limitTarget数据
*
* @param lineList 部门列表 * @param lineList 部门列表
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
@@ -435,26 +439,23 @@ public class HarmonicServiceImpl implements IHarmonicService {
avgOverDay = overLineCount == 0?0.0:BigDecimal.valueOf(overCountByDay*1.0/overLineCount).setScale(2, RoundingMode.HALF_UP).doubleValue(); avgOverDay = overLineCount == 0?0.0:BigDecimal.valueOf(overCountByDay*1.0/overLineCount).setScale(2, RoundingMode.HALF_UP).doubleValue();
} }
//月监测点符合性超标占比 //月监测点符合性超标占比
ratio = map.size() == 0?0:BigDecimal.valueOf(ratio*100/map.size()).setScale(2, RoundingMode.HALF_UP).doubleValue(); ratio = map.size() == 0?0:BigDecimal.valueOf(ratio*100.0/map.size()).setScale(2, RoundingMode.HALF_UP).doubleValue();
areaDTO.setOnlineCount(onlineCount); areaDTO.setOnlineCount(onlineCount);
areaDTO.setOverLineCount(overLineCount); areaDTO.setOverLineCount(overLineCount);
//平均超标天数 //平均超标天数
areaDTO.setAverageOverDay(avgOverDay); areaDTO.setAverageOverDay(avgOverDay);
areaDTO.setRatio(Math.min(ratio,100.0)); areaDTO.setRatio(Math.min(ratio,100.0));
//月监测点超标占比 //月监测点超标占比
double lineRatio = onlineCount==0?0:BigDecimal.valueOf(overLineCount*100/onlineCount).setScale(2, RoundingMode.HALF_UP).doubleValue(); double lineRatio = onlineCount==0?0:BigDecimal.valueOf(overLineCount*100.0/onlineCount).setScale(2, RoundingMode.HALF_UP).doubleValue();
areaDTO.setLineRatio(Math.min(lineRatio,100.0)); areaDTO.setLineRatio(Math.min(lineRatio,100.0));
return areaDTO; return areaDTO;
} }
/**
* todo
/** todo
* 功能描述: 处理区域(变电站)在线监测点数、超标监测点数、平均超标天数、占比 * 功能描述: 处理区域(变电站)在线监测点数、超标监测点数、平均超标天数、占比
*
* @param list 集合 * @param list 集合
* type 类型 * type 类型
* @return * @return
@@ -529,6 +530,7 @@ public class HarmonicServiceImpl implements IHarmonicService {
/** /**
* 功能描述: 处理区域在线监测点数、超标监测点数 * 功能描述: 处理区域在线监测点数、超标监测点数
*
* @param list 集合 * @param list 集合
* @return * @return
* @author xy * @author xy
@@ -537,6 +539,7 @@ public class HarmonicServiceImpl implements IHarmonicService {
private List<RStatLimitTargetDPO> getAllDataV(List<String> list, String startTime, String endTime) { private List<RStatLimitTargetDPO> getAllDataV(List<String> list, String startTime, String endTime) {
return targetDMapper.getSumV(list, startTime, endTime); return targetDMapper.getSumV(list, startTime, endTime);
} }
private List<RStatLimitTargetDPO> getAllDataI(List<String> list, String startTime, String endTime) { private List<RStatLimitTargetDPO> getAllDataI(List<String> list, String startTime, String endTime) {
return targetDMapper.getSumI(list, startTime, endTime); return targetDMapper.getSumI(list, startTime, endTime);
} }
@@ -544,13 +547,14 @@ public class HarmonicServiceImpl implements IHarmonicService {
/** /**
* 功能描述: 获取告警频次 * 功能描述: 获取告警频次
* @author xy *
* @param lineList 监测点id * @param lineList 监测点id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param type 类型 * @param type 类型
* @date 2022/4/24 16:47
* @return * @return
* @author xy
* @date 2022/4/24 16:47
*/ */
private Integer getWarningInfo(List<String> lineList, String startTime, String endTime, String type) { private Integer getWarningInfo(List<String> lineList, String startTime, String endTime, String type) {
Integer result = 0; Integer result = 0;
@@ -575,16 +579,16 @@ public class HarmonicServiceImpl implements IHarmonicService {
} }
/** /**
* 功能描述: 获取监测点超标天数 * 功能描述: 获取监测点超标天数
* @author xy *
* @param lineList 监测点id * @param lineList 监测点id
* @param startTime 开始时间 * @param startTime 开始时间
* @param endTime 结束时间 * @param endTime 结束时间
* @param type 类型 * @param type 类型
* @date 2022/4/24 16:47
* @return * @return
* @author xy
* @date 2022/4/24 16:47
*/ */
private List<LimitTarget> getLineOverDays(List<String> lineList, String startTime, String endTime, String type) { private List<LimitTarget> getLineOverDays(List<String> lineList, String startTime, String endTime, String type) {
List<LimitTarget> listInfo = new ArrayList<>(); List<LimitTarget> listInfo = new ArrayList<>();