|
|
|
|
@@ -27,6 +27,8 @@ import com.njcn.harmonic.pojo.vo.hebeinorth.EvaluationVo;
|
|
|
|
|
import com.njcn.harmonic.service.hebeinorth.IGridService;
|
|
|
|
|
import com.njcn.harmonic.util.ComAssesUtil;
|
|
|
|
|
import com.njcn.system.enums.DicDataEnum;
|
|
|
|
|
import com.njcn.user.api.DeptFeignClient;
|
|
|
|
|
import com.njcn.user.pojo.dto.DeptDTO;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
@@ -34,6 +36,8 @@ import java.time.LocalDate;
|
|
|
|
|
import java.time.YearMonth;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.function.Predicate;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
@@ -58,6 +62,7 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
private final RStatDataPltDMapper statDataPltDMapper;
|
|
|
|
|
private final RStatLimitTargetDMapper rStatLimitTargetDMapper;
|
|
|
|
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
|
|
|
|
private final DeptFeignClient deptFeignClient;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<AssessVo> getAssessOverview(AssessParam param) {
|
|
|
|
|
@@ -66,38 +71,43 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点
|
|
|
|
|
List<String> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.map(LineDevGetDTO::getPointId)
|
|
|
|
|
.distinct()
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//上报国网监测点
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)){
|
|
|
|
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> lineList = this.getLineList(list,param.getIsUpToGrid(),null);
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)) {
|
|
|
|
|
List<PqsComasses> comasses = new ArrayList<>();
|
|
|
|
|
//获取监测点详细信息
|
|
|
|
|
List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
Map<String,List<LineDetail>> lineDetailMap = lineDetailList.stream().collect(Collectors.groupingBy(LineDetail::getActualArea));
|
|
|
|
|
//获取综合评估
|
|
|
|
|
List<PQSComAssesPO> list2 = rStatComassesDMapper.getAvgCount(lineList,param.getStartTime(),param.getEndTime());
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
if (Objects.equals(item.getDeptLevel(), 3)) {
|
|
|
|
|
List<PQSComAssesPO> assesList = rStatComassesDMapper.getAvgCount(lineList,param.getStartTime(),param.getEndTime());
|
|
|
|
|
//获取部门
|
|
|
|
|
List<DeptDTO> deptList = deptFeignClient.getDepSonDetailByDeptId(param.getDeptIndex()).getData();
|
|
|
|
|
deptList.forEach(item->{
|
|
|
|
|
if (lineDetailMap.containsKey(item.getArea())) {
|
|
|
|
|
AssessVo assessVo = new AssessVo();
|
|
|
|
|
assessVo.setName(item.getUnitName());
|
|
|
|
|
if (CollUtil.isNotEmpty(item.getLineBaseList())) {
|
|
|
|
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(list2)) {
|
|
|
|
|
List<PQSComAssesPO> list22 = list2.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
List<PqsComasses> communicateList = BeanUtil.copyToList(list22,PqsComasses.class);
|
|
|
|
|
assessVo.setName(item.getName());
|
|
|
|
|
List<String> ll = lineDetailMap.get(item.getArea()).stream().map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
List<PQSComAssesPO> deptAssessList = assesList.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
List<PqsComasses> communicateList = BeanUtil.copyToList(deptAssessList,PqsComasses.class);
|
|
|
|
|
if (CollUtil.isNotEmpty(communicateList)){
|
|
|
|
|
float synData = comAssesUtil.getAllComAss(communicateList);
|
|
|
|
|
assessVo.setScore(PubUtils.floatRound(2,synData));
|
|
|
|
|
assessVo.setLevel(getLevel(synData));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
comasses.addAll(communicateList);
|
|
|
|
|
}
|
|
|
|
|
result.add(assessVo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//计算冀北整体
|
|
|
|
|
AssessVo assessVo = new AssessVo();
|
|
|
|
|
assessVo.setName("冀北");
|
|
|
|
|
if (CollUtil.isNotEmpty(comasses)) {
|
|
|
|
|
float synData = comAssesUtil.getAllComAss(comasses);
|
|
|
|
|
assessVo.setScore(PubUtils.floatRound(2,synData));
|
|
|
|
|
assessVo.setLevel(getLevel(synData));
|
|
|
|
|
}
|
|
|
|
|
result.add(assessVo);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -109,18 +119,14 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点
|
|
|
|
|
List<String> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.map(LineDevGetDTO::getPointId)
|
|
|
|
|
.distinct()
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//上报国网监测点
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)){
|
|
|
|
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> lineList = this.getLineList(list, param.getIsUpToGrid(),null);
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)){
|
|
|
|
|
//获取监测点详细信息
|
|
|
|
|
List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
Map<String,List<LineDetail>> lineDetailMap = lineDetailList.stream().collect(Collectors.groupingBy(LineDetail::getActualArea));
|
|
|
|
|
//获取部门
|
|
|
|
|
List<DeptDTO> deptList = deptFeignClient.getDepSonDetailByDeptId(param.getDeptIndex()).getData();
|
|
|
|
|
//获取所有监测点r_stat_asses_d数据
|
|
|
|
|
List<RStatAssesDPO> list1 = rStatAssesDMapper.getData(param.getStartTime(),param.getEndTime(),lineList);
|
|
|
|
|
//获取所有监测点r_stat_comasses_d数据
|
|
|
|
|
@@ -128,10 +134,12 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
//获取所有监测点r_stat_limit_rate_d数据
|
|
|
|
|
List<RStatLimitRateDPO> list3 = rStatLimitRateDMapper.getAssessTargetRate(lineList,param.getStartTime(),param.getEndTime());
|
|
|
|
|
//数据处理
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
if (Objects.equals(item.getDeptLevel(), 3)) {
|
|
|
|
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
AssessDetailVo comAssess = getAssessData(item.getUnitId(),item.getUnitName(), ll, list1, list2, list3);
|
|
|
|
|
deptList.forEach(item->{
|
|
|
|
|
if (lineDetailMap.containsKey(item.getArea())) {
|
|
|
|
|
AssessVo assessVo = new AssessVo();
|
|
|
|
|
assessVo.setName(item.getName());
|
|
|
|
|
List<String> ll = lineDetailMap.get(item.getArea()).stream().map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
AssessDetailVo comAssess = getAssessData(item.getId(),item.getName(), ll, list1, list2, list3);
|
|
|
|
|
result.add(comAssess);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@@ -148,38 +156,34 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点
|
|
|
|
|
List<String> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.map(LineDevGetDTO::getPointId)
|
|
|
|
|
.distinct()
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//上报国网监测点
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)){
|
|
|
|
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> lineList = this.getLineList(list, param.getIsUpToGrid(),null);
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)){
|
|
|
|
|
//获取监测点详细信息
|
|
|
|
|
List<LineDetail> lineDetailList = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
Map<String,List<LineDetail>> lineDetailMap = lineDetailList.stream().collect(Collectors.groupingBy(LineDetail::getActualArea));
|
|
|
|
|
//获取部门
|
|
|
|
|
List<DeptDTO> deptList = deptFeignClient.getDepSonDetailByDeptId(param.getDeptIndex()).getData();
|
|
|
|
|
//根据传入的参数,获取返回的月份
|
|
|
|
|
List<YearMonth> monthList = this.getLastThreeMonth(3);
|
|
|
|
|
List<String> finalLineList = lineList;
|
|
|
|
|
monthList.forEach(month->{
|
|
|
|
|
String firstDayOfMonth = month.atDay(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
|
String lastDayOfMonth = month.atEndOfMonth().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
|
|
List<PQSComAssesPO> comAssesList = rStatComassesDMapper.getAvgCount(finalLineList,firstDayOfMonth,lastDayOfMonth);
|
|
|
|
|
List<PQSComAssesPO> comAssesList = rStatComassesDMapper.getAvgCount(lineList,firstDayOfMonth,lastDayOfMonth);
|
|
|
|
|
map.put(month.toString(),comAssesList);
|
|
|
|
|
});
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
if (Objects.equals(item.getDeptLevel(), 3)) {
|
|
|
|
|
//数据处理
|
|
|
|
|
deptList.forEach(item->{
|
|
|
|
|
if (lineDetailMap.containsKey(item.getArea())) {
|
|
|
|
|
AssessVo.AssessTrendVo vo = new AssessVo.AssessTrendVo();
|
|
|
|
|
vo.setDeptId(item.getUnitId());
|
|
|
|
|
vo.setDeptName(item.getUnitName());
|
|
|
|
|
vo.setDeptId(item.getId());
|
|
|
|
|
vo.setDeptName(item.getName());
|
|
|
|
|
List<AssessVo> children = new ArrayList<>();
|
|
|
|
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
map.forEach((k,v)->{
|
|
|
|
|
List<String> ll = lineDetailMap.get(item.getArea()).stream().map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
map.forEach((k1,v1)->{
|
|
|
|
|
AssessVo assessVo = new AssessVo();
|
|
|
|
|
assessVo.setDataTime(k);
|
|
|
|
|
List<PQSComAssesPO> poList = v.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
assessVo.setDataTime(k1);
|
|
|
|
|
List<PQSComAssesPO> poList = v1.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(poList)){
|
|
|
|
|
List<PqsComasses> communicateList = BeanUtil.copyToList(poList,PqsComasses.class);
|
|
|
|
|
float synData = comAssesUtil.getAllComAss(communicateList);
|
|
|
|
|
@@ -196,73 +200,49 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据传入的月份数获取时间集合
|
|
|
|
|
* @param month
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<YearMonth> getLastThreeMonth(int month) {
|
|
|
|
|
//按月获取时间集合
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
int currentYear = currentDate.getYear();
|
|
|
|
|
LocalDate beginDay = LocalDate.of(currentYear, 1, 1);
|
|
|
|
|
List<YearMonth> monthList = getMonthsBetween(beginDay,currentDate);
|
|
|
|
|
if (monthList.size() > month) {
|
|
|
|
|
monthList = monthList.subList(monthList.size() - month,monthList.size());
|
|
|
|
|
}
|
|
|
|
|
return monthList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public EvaluationVo getEvaluationOverview(AssessParam param) {
|
|
|
|
|
EvaluationVo result = new EvaluationVo();
|
|
|
|
|
List<EvaluationVo.Children> childrenList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点
|
|
|
|
|
List<String> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.map(LineDevGetDTO::getPointId)
|
|
|
|
|
.distinct()
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//上报国网监测点
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)){
|
|
|
|
|
//获取国网监测点
|
|
|
|
|
List<LineDetail> lineDetails = lineFeignClient.getLineDetail(lineList).getData();
|
|
|
|
|
lineList = lineDetails.stream().filter(o-> Objects.equals(o.getMonitorFlag(), 1)).map(LineDetail::getId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> lineList = this.getLineList(list, param.getIsUpToGrid(),null);
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)) {
|
|
|
|
|
//获取监测点所有指标数据
|
|
|
|
|
List<RStatLimitRateDPO> limitRateList = rStatLimitRateDMapper.getAssessTargetRate(lineList,param.getStartTime(),param.getEndTime());
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
if (Objects.equals(item.getDeptLevel(), 3)) {
|
|
|
|
|
//获取部门
|
|
|
|
|
List<DeptDTO> deptList = deptFeignClient.getDepSonDetailByDeptId(param.getDeptIndex()).getData();
|
|
|
|
|
Map<String, DeptGetChildrenMoreDTO> deptLineMap = list.stream().collect(Collectors.toMap(DeptGetChildrenMoreDTO::getUnitId, Function.identity()));
|
|
|
|
|
deptList.forEach(item->{
|
|
|
|
|
if (deptLineMap.containsKey(item.getId())) {
|
|
|
|
|
EvaluationVo.Children children = new EvaluationVo.Children();
|
|
|
|
|
children.setDeptId(item.getUnitId());
|
|
|
|
|
children.setDeptName(item.getUnitName());
|
|
|
|
|
if (CollUtil.isNotEmpty(item.getLineBaseList())) {
|
|
|
|
|
List<String> ll = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
children.setDeptId(item.getId());
|
|
|
|
|
children.setDeptName(item.getName());
|
|
|
|
|
List<String> ll = deptLineMap.get(item.getId()).getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(limitRateList)) {
|
|
|
|
|
List<RStatLimitRateDPO> l1 = limitRateList.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(l1)){
|
|
|
|
|
this.getDataByTarget(param.getHarmonicType(),l1,children);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
childrenList.add(children);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
result.setChildrenList(childrenList);
|
|
|
|
|
if (CollUtil.isNotEmpty(childrenList)) {
|
|
|
|
|
List<EvaluationVo.Children> newList = childrenList.stream()
|
|
|
|
|
.filter(child -> !Objects.isNull(child.getRatio()) && !Objects.equals(child.getRatio(), 3.14159))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(newList)) {
|
|
|
|
|
double avg = newList.stream().mapToDouble(EvaluationVo.Children::getRatio).average().orElse(0.0);
|
|
|
|
|
OptionalDouble optionalAvg = childrenList.stream()
|
|
|
|
|
.filter(child -> child.getRatio() != null && !child.getRatio().equals(3.14159))
|
|
|
|
|
.mapToDouble(EvaluationVo.Children::getRatio)
|
|
|
|
|
.average();
|
|
|
|
|
if (optionalAvg.isPresent()) {
|
|
|
|
|
double avg = optionalAvg.getAsDouble();
|
|
|
|
|
result.setLineRatio(PubUtils.doubleRound(2, avg));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -273,20 +253,8 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取符合电压等级的监测点
|
|
|
|
|
Set<LineDevGetDTO> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.filter(line -> Objects.equals(line.getVoltageLevel(), param.getVoltageLevel()))
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
//监测点处理
|
|
|
|
|
List<String> line = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)) {
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)) {
|
|
|
|
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> line = this.getLineList(list,param.getIsUpToGrid(),param.getVoltageLevel());
|
|
|
|
|
//获取数据
|
|
|
|
|
EvaluationLevelVo vo1 = new EvaluationLevelVo();
|
|
|
|
|
vo1.setTargetName(DicDataEnum.FREQUENCY_DEV.getName());
|
|
|
|
|
@@ -345,19 +313,8 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点数据
|
|
|
|
|
Set<LineDevGetDTO> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
//筛选监测点
|
|
|
|
|
List<String> line = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)) {
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)) {
|
|
|
|
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> line = this.getLineList(list, param.getIsUpToGrid(),null);
|
|
|
|
|
//按月获取时间集合
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
// 获取当前年份
|
|
|
|
|
@@ -396,32 +353,24 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点数据
|
|
|
|
|
Set<LineDevGetDTO> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
//筛选监测点
|
|
|
|
|
List<String> line = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)) {
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)) {
|
|
|
|
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> line = this.getLineList(list, param.getIsUpToGrid(),null);
|
|
|
|
|
if (CollUtil.isNotEmpty(line)) {
|
|
|
|
|
//获取监测点越限集合
|
|
|
|
|
List<RStatLimitTargetDPO> overLimitList = rStatLimitTargetDMapper.getSumTarget(line,param.getStartTime(),param.getEndTime());
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
if (Objects.equals(item.getDeptLevel(), 3)) {
|
|
|
|
|
//获取部门
|
|
|
|
|
List<DeptDTO> deptList = deptFeignClient.getDepSonDetailByDeptId(param.getDeptIndex()).getData();
|
|
|
|
|
Map<String, DeptGetChildrenMoreDTO> deptLineMap = list.stream().collect(Collectors.toMap(DeptGetChildrenMoreDTO::getUnitId, Function.identity()));
|
|
|
|
|
deptList.forEach(item->{
|
|
|
|
|
if (deptLineMap.containsKey(item.getId())) {
|
|
|
|
|
EvaluationLevelVo.EvaluationDetail detail = new EvaluationLevelVo.EvaluationDetail();
|
|
|
|
|
detail.setDeptId(item.getUnitId());
|
|
|
|
|
detail.setDeptName(item.getUnitName());
|
|
|
|
|
if (CollUtil.isNotEmpty(item.getLineBaseList())) {
|
|
|
|
|
//获取当前部门下监测点
|
|
|
|
|
List<String> list1 = item.getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
detail.setOnlineNum(list1.size());
|
|
|
|
|
detail.setDeptId(item.getId());
|
|
|
|
|
detail.setDeptName(item.getName());
|
|
|
|
|
if (CollUtil.isNotEmpty(deptLineMap.get(item.getId()).getLineBaseList())) {
|
|
|
|
|
List<String> ll = deptLineMap.get(item.getId()).getLineBaseList().stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
detail.setOnlineNum(ll.size());
|
|
|
|
|
//筛选当前部门下监测点的超标数据
|
|
|
|
|
List<RStatLimitTargetDPO> list2 = overLimitList.stream().filter(it->list1.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
List<RStatLimitTargetDPO> list2 = overLimitList.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList());
|
|
|
|
|
EvaluationLevelVo.TargetDetail detail1 = new EvaluationLevelVo.TargetDetail();
|
|
|
|
|
detail1.setTargetName(DicDataEnum.FREQUENCY_DEV.getName());
|
|
|
|
|
EvaluationLevelVo.TargetDetail detail2 = new EvaluationLevelVo.TargetDetail();
|
|
|
|
|
@@ -478,6 +427,7 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
result.add(detail);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -488,30 +438,20 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
deptGetLineParam.setDeptId(param.getDeptIndex());
|
|
|
|
|
deptGetLineParam.setServerName("harmonic-boot");
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
//获取所有监测点数据
|
|
|
|
|
Set<LineDevGetDTO> lineList = list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
//筛选监测点
|
|
|
|
|
List<String> line = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(lineList)) {
|
|
|
|
|
if (Objects.equals(param.getIsUpToGrid(), 1)) {
|
|
|
|
|
line = lineList.stream().filter(o->Objects.equals(o.getIsUpToGrid(), 1)).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
line = lineList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//获取监测点集合
|
|
|
|
|
List<String> line = this.getLineList(list, param.getIsUpToGrid(),null);
|
|
|
|
|
//获取基础台账信息
|
|
|
|
|
List<BaseLineInfo> baseLineInfos = generalDeviceInfoClient.getBaseLineInfo(line).getData();
|
|
|
|
|
//获取越限详情
|
|
|
|
|
List<RStatLimitRateDPO> overLimitList = rStatLimitRateDMapper.getAssessTargetRate(line,param.getStartTime(),param.getEndTime());
|
|
|
|
|
Map<String, List<RStatLimitRateDPO>> map = overLimitList.stream().collect(Collectors.groupingBy(RStatLimitRateDPO::getLineId));
|
|
|
|
|
Map<String, RStatLimitRateDPO> map = overLimitList.stream().collect(Collectors.toMap(RStatLimitRateDPO::getLineId,Function.identity()));
|
|
|
|
|
baseLineInfos.forEach(item->{
|
|
|
|
|
EvaluationLevelVo.QualifiedDetail qualifiedDetail = new EvaluationLevelVo.QualifiedDetail();
|
|
|
|
|
qualifiedDetail.setAreaName(item.getGdName());
|
|
|
|
|
qualifiedDetail.setLineName(item.getLineName());
|
|
|
|
|
qualifiedDetail.setSubstationName(item.getSubName());
|
|
|
|
|
if(CollUtil.isNotEmpty(map.get(item.getId()))) {
|
|
|
|
|
RStatLimitRateDPO item2 = map.get(item.getId()).get(0);
|
|
|
|
|
if (map.containsKey(item.getId())) {
|
|
|
|
|
RStatLimitRateDPO item2 = map.get(item.getId());
|
|
|
|
|
if (!Objects.isNull(item2) && item2.getAllTime() > 0) {
|
|
|
|
|
qualifiedDetail.setFreqDev(PubUtils.doubleRound(2,100.0-(item2.getFreqDevOvertime()*100.0/item2.getAllTime())));
|
|
|
|
|
qualifiedDetail.setVDev(PubUtils.doubleRound(2,100.0-(item2.getVoltageDevOvertime()*100.0/item2.getAllTime())));
|
|
|
|
|
@@ -522,6 +462,11 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
}
|
|
|
|
|
result.add(qualifiedDetail);
|
|
|
|
|
});
|
|
|
|
|
if (CollUtil.isNotEmpty(result)) {
|
|
|
|
|
return result.stream().sorted(Comparator.comparing(EvaluationLevelVo.QualifiedDetail::getAreaName)
|
|
|
|
|
.thenComparing(EvaluationLevelVo.QualifiedDetail::getSubstationName))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -615,7 +560,6 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AssessDetailVo getAssessData(String deptId, String deptName, List<String> lineList, List<RStatAssesDPO> list1, List<PQSComAssesPO> list2, List<RStatLimitRateDPO> list3) {
|
|
|
|
|
AssessDetailVo comAssess = new AssessDetailVo();
|
|
|
|
|
comAssess.setDeptId(deptId);
|
|
|
|
|
@@ -764,4 +708,49 @@ public class GridServiceImpl implements IGridService {
|
|
|
|
|
}
|
|
|
|
|
return months;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 过滤监测点
|
|
|
|
|
* @param list
|
|
|
|
|
* @param type
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<String> getLineList(List<DeptGetChildrenMoreDTO> list, Integer type, String voltage) {
|
|
|
|
|
// 默认不过滤
|
|
|
|
|
Predicate<LineDevGetDTO> uploadFilter = item -> true;
|
|
|
|
|
if (Objects.equals(type, 1)) {
|
|
|
|
|
uploadFilter = item -> Objects.equals(item.getIsUpToGrid(), 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Predicate<LineDevGetDTO> voltageFilter = item -> true;
|
|
|
|
|
if (!Objects.isNull(voltage) && !Objects.equals(voltage,"")) {
|
|
|
|
|
voltageFilter = item -> Objects.equals(item.getVoltageLevel(), voltage);
|
|
|
|
|
}
|
|
|
|
|
// 组合两个过滤条件
|
|
|
|
|
Predicate<LineDevGetDTO> combinedFilter = uploadFilter.and(voltageFilter);
|
|
|
|
|
return list.stream()
|
|
|
|
|
.flatMap(item -> item.getLineBaseList().stream())
|
|
|
|
|
.filter(combinedFilter)
|
|
|
|
|
.map(LineDevGetDTO::getPointId)
|
|
|
|
|
.distinct()
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据传入的月份数获取时间集合
|
|
|
|
|
* @param month
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<YearMonth> getLastThreeMonth(int month) {
|
|
|
|
|
//按月获取时间集合
|
|
|
|
|
LocalDate currentDate = LocalDate.now();
|
|
|
|
|
int currentYear = currentDate.getYear();
|
|
|
|
|
LocalDate beginDay = LocalDate.of(currentYear, 1, 1);
|
|
|
|
|
List<YearMonth> monthList = getMonthsBetween(beginDay,currentDate);
|
|
|
|
|
if (monthList.size() > month) {
|
|
|
|
|
monthList = monthList.subList(monthList.size() - month,monthList.size());
|
|
|
|
|
}
|
|
|
|
|
return monthList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|