bug修改

This commit is contained in:
2023-05-22 20:23:06 +08:00
parent 8e57a6cb20
commit f840ab9774
4 changed files with 34 additions and 23 deletions

View File

@@ -88,11 +88,12 @@ public class HarmonicServiceImpl implements IHarmonicService {
List<RStatLimitTargetDPO> finalAllData = allData;
deptList.forEach(dept->{
List<PollutionVO> childrenList = new ArrayList<>();
PollutionVO pollutionVO = new PollutionVO();
pollutionVO.setId(dept.getIndex());
pollutionVO.setName(dept.getName());
if (!CollectionUtils.isEmpty(dept.getSubIndexes())){
List<PollutionVO> childrenList = new ArrayList<>();
PollutionVO pollutionVO = new PollutionVO();
pollutionVO.setId(dept.getIndex());
pollutionVO.setName(dept.getName());
dept.getSubIndexes().forEach(sub->{
List<PollutionLineDTO> l1 = map.get(sub);
PollutionVO children = new PollutionVO();
@@ -108,15 +109,17 @@ public class HarmonicServiceImpl implements IHarmonicService {
children.setData(handleDataNew(collect,sumList,harmonicPublicParam.getStatisticalType().getCode()).getRatio());
childrenList.add(children);
});
}
if (!CollectionUtils.isEmpty(childrenList)){
pollutionVO.setChildren(childrenList.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList()));
}
if (!CollectionUtils.isEmpty(dept.getLineIndexes())){
if (!CollectionUtils.isEmpty(childrenList)){
pollutionVO.setChildren(childrenList.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList()));
}
if (!CollectionUtils.isEmpty(dept.getLineIndexes())){
// pollutionVO.setData(handleData(getLimitTarget(lineList, harmonicPublicParam.getSearchBeginTime(),harmonicPublicParam.getSearchEndTime()),harmonicPublicParam.getStatisticalType().getCode(),lineList, harmonicPublicParam.getSearchBeginTime(),harmonicPublicParam.getSearchEndTime()).getRatio());
pollutionVO.setData(NumberUtil.round(childrenList.stream().mapToDouble(PollutionVO::getData).average().orElse(3.14159),2).doubleValue());
pollutionVO.setData(NumberUtil.round(childrenList.stream().mapToDouble(PollutionVO::getData).average().orElse(3.14159),2).doubleValue());
}
list.add(pollutionVO);
}
list.add(pollutionVO);
});
if (!CollectionUtils.isEmpty(list)){
return list.stream().sorted(Comparator.comparing(PollutionVO::getData).reversed().thenComparing(PollutionVO::getName)).collect(Collectors.toList());
@@ -145,10 +148,9 @@ public class HarmonicServiceImpl implements IHarmonicService {
List<RStatLimitTargetDPO> finalAllData = allData;
deptList.forEach(item->{
List<String> lineList = item.getLineIndexes();
HarmonicDeptVO harmonicDeptVO = new HarmonicDeptVO();
if (!CollectionUtils.isEmpty(lineList)){
HarmonicDeptVO harmonicDeptVO = new HarmonicDeptVO();
List<RStatLimitTargetDPO> collect = limitTargetNew.stream().filter(x -> lineList.contains(x.getLineId())).collect(Collectors.toList());
List<RStatLimitTargetDPO> sumList = finalAllData.stream().filter(x -> lineList.contains(x.getLineId())).collect(Collectors.toList());
@@ -156,10 +158,11 @@ public class HarmonicServiceImpl implements IHarmonicService {
AreaDTO areaDTO = handleDataNew(collect, sumList, param.getStatisticalType().getCode());
BeanUtil.copyProperties(areaDTO,harmonicDeptVO);
harmonicDeptVO.setId(item.getIndex());
harmonicDeptVO.setName(item.getName());
list.add(harmonicDeptVO);
}
harmonicDeptVO.setId(item.getIndex());
harmonicDeptVO.setName(item.getName());
list.add(harmonicDeptVO);
});
if (!CollectionUtils.isEmpty(list)){
return list.stream().sorted(Comparator.comparing(HarmonicDeptVO::getRatio).reversed().thenComparing(HarmonicDeptVO::getOnlineCount).thenComparing(HarmonicDeptVO::getOverLineCount)).collect(Collectors.toList());
@@ -586,7 +589,7 @@ public class HarmonicServiceImpl implements IHarmonicService {
sum = targetDMapper.getSumV(lineList, startTime, endTime);
} else if (Objects.equals(type, DicDataEnum.XBDL_ENUM.getCode())){
sum = targetDMapper.getSumV(lineList, startTime, endTime);
sum = targetDMapper.getSumI(lineList, startTime, endTime);
}
if(CollUtil.isNotEmpty(sum)){

View File

@@ -232,10 +232,14 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
harmonicPublicParam.setServerName(generalInfo.getMicroServiceName());
List<GeneralDeviceDTO> sub = generalDeviceInfoClient.getPracticalRunDeviceInfo(harmonicPublicParam).getData();
for (GeneralDeviceDTO temp : sub) {
List<String> subIndexes = temp.getSubIndexes();
if(CollectionUtil.isEmpty(subIndexes)){
continue;
}
PollutionVO pollutionVO = new PollutionVO();
String detpid = temp.getIndex();
String name = temp.getName();
List<String> subIndexes = temp.getSubIndexes();
pollutionVO.setId(detpid);
pollutionVO.setName(name);
pollutionVO.setData(-1.0);