|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.google.common.collect.Maps;
|
|
|
import com.hdkj.lt.bf.mapper.*;
|
|
import com.hdkj.lt.bf.mapper.*;
|
|
|
import com.hdkj.lt.core.bizms.modle.po.FeederTopo;
|
|
import com.hdkj.lt.core.bizms.modle.po.FeederTopo;
|
|
|
import com.hdkj.lt.feign.IFaultCreateClient;
|
|
import com.hdkj.lt.feign.IFaultCreateClient;
|
|
@@ -95,11 +96,18 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
List<FhzgFaultPowerCutSectionVO> faultPowerCutSectionList = switchInfoListMapper.querySectionsSwitchByFaultId(idList);
|
|
List<FhzgFaultPowerCutSectionVO> faultPowerCutSectionList = switchInfoListMapper.querySectionsSwitchByFaultId(idList);
|
|
|
//查询计划对应的线路图信息
|
|
//查询计划对应的线路图信息
|
|
|
List<FhzgFaultDistMappingFileDTO> fileList = faultDistMappingFileMapper.getMappingFileByPlanId(idList);
|
|
List<FhzgFaultDistMappingFileDTO> fileList = faultDistMappingFileMapper.getMappingFileByPlanId(idList);
|
|
|
|
|
+ //查询统计,用户数量,重要用户数量,敏感用户数量,用户负荷
|
|
|
|
|
+ List<FhzgFaultAwaitTransferUsersCountDTO> usersCountDTOList = faultAwaitTransferUsersMapper.selectAwaitUserCountByFaultId(idList);
|
|
|
|
|
+ //查询停电计划对应的光伏用户数量
|
|
|
|
|
+ List<FaultPowerCutPvUsers> countCutPvUsers = faultPowerCutPvUsersService.countByFaultId(idList);
|
|
|
|
|
+ Map<Long, List<FhzgFaultDistMappingFileDTO>> fileListMap = fileList.stream().collect(Collectors.groupingBy(FhzgFaultDistMappingFileDTO::getFaultId));
|
|
|
|
|
+ Map<String, List<FhzgFaultPowerCutSectionVO>> sectionMap = Maps.newHashMap();
|
|
|
if (CollUtil.isNotEmpty(faultPowerCutSectionList)) {
|
|
if (CollUtil.isNotEmpty(faultPowerCutSectionList)) {
|
|
|
List<String> allSwitchIdList = faultPowerCutSectionList.stream().flatMap(i -> Stream.of(i.getStartSwitch(), i.getEndSwitch())).filter(f -> f != null && !f.isEmpty()).collect(Collectors.toList());
|
|
List<String> allSwitchIdList = faultPowerCutSectionList.stream().flatMap(i -> Stream.of(i.getStartSwitch(), i.getEndSwitch())).filter(f -> f != null && !f.isEmpty()).collect(Collectors.toList());
|
|
|
//根据开关id获取名称
|
|
//根据开关id获取名称
|
|
|
Map<String, String> switchNameMap = feederTopoMapper.selectList(new LambdaQueryWrapper<FeederTopo>().in(FeederTopo::getPsrId, allSwitchIdList)).stream().collect(Collectors.toMap(FeederTopo::getPsrId, FeederTopo::getName));
|
|
Map<String, String> switchNameMap = feederTopoMapper.selectList(new LambdaQueryWrapper<FeederTopo>().in(FeederTopo::getPsrId, allSwitchIdList)).stream().collect(Collectors.toMap(FeederTopo::getPsrId, FeederTopo::getName));
|
|
|
- Map<String, List<FhzgFaultPowerCutSectionVO>> sectionMap = faultPowerCutSectionList.stream()
|
|
|
|
|
|
|
+ //根据FaultNo,并按SectionStatus,CreateTime倒序排序
|
|
|
|
|
+ sectionMap = faultPowerCutSectionList.stream()
|
|
|
.peek(p->p.setStartSwitchName(switchNameMap.get(p.getStartSwitch())).setEndSwitchName(switchNameMap.get(p.getEndSwitch()))
|
|
.peek(p->p.setStartSwitchName(switchNameMap.get(p.getStartSwitch())).setEndSwitchName(switchNameMap.get(p.getEndSwitch()))
|
|
|
).collect(Collectors.groupingBy(
|
|
).collect(Collectors.groupingBy(
|
|
|
FhzgFaultPowerCutSectionVO::getFaultNo,
|
|
FhzgFaultPowerCutSectionVO::getFaultNo,
|
|
@@ -110,28 +118,21 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
.thenComparing(FhzgFaultPowerCutSectionVO::getCreateTime, Comparator.reverseOrder()))
|
|
.thenComparing(FhzgFaultPowerCutSectionVO::getCreateTime, Comparator.reverseOrder()))
|
|
|
.collect(Collectors.toList())))
|
|
.collect(Collectors.toList())))
|
|
|
);
|
|
);
|
|
|
- Map<Long, List<FhzgFaultDistMappingFileDTO>> fileListMap = fileList.stream().collect(Collectors.groupingBy(FhzgFaultDistMappingFileDTO::getFaultId));
|
|
|
|
|
- list.forEach(e -> {
|
|
|
|
|
- Long id = e.getId();
|
|
|
|
|
- Optional.of(fileListMap).ifPresent(p -> e.setFileList(Objects.nonNull(p.get(id)) ? p.get(id) : Lists.newArrayList()));
|
|
|
|
|
- //故障id
|
|
|
|
|
- String fId = e.getFaultId();
|
|
|
|
|
- List<FhzgFaultPowerCutSectionVO> faultPowerCuts = null != sectionMap.get(fId) ? sectionMap.get(fId) : new ArrayList<>();
|
|
|
|
|
- faultPowerCuts.forEach(section -> Optional.of(fileListMap).ifPresent(f -> section.setFileList(Objects.nonNull(f.get(section.getFaultId())) ? f.get(section.getFaultId()) : Lists.newArrayList())));
|
|
|
|
|
- e.setSectionList(faultPowerCuts);
|
|
|
|
|
- });
|
|
|
|
|
} else {
|
|
} else {
|
|
|
log.info("未查询到故障停电开关信息faultIdList:{}", idList);
|
|
log.info("未查询到故障停电开关信息faultIdList:{}", idList);
|
|
|
}
|
|
}
|
|
|
- //查询统计,用户数量,重要用户数量,敏感用户数量,用户负荷
|
|
|
|
|
- List<FhzgFaultAwaitTransferUsersCountDTO> usersCountDTOList = faultAwaitTransferUsersMapper.selectAwaitUserCountByFaultId(idList);
|
|
|
|
|
- //查询停电计划对应的光伏用户数量
|
|
|
|
|
- List<FaultPowerCutPvUsers> countCutPvUsers = faultPowerCutPvUsersService.countByFaultId(idList);
|
|
|
|
|
- Map<Long, FhzgFaultAwaitTransferUsersCountDTO> fusersCountMap = usersCountDTOList.stream().collect(Collectors.toMap(FhzgFaultAwaitTransferUsersCountDTO::getFaultId, Function.identity(), (k1, k2) -> k2));
|
|
|
|
|
|
|
+ Map<Long, FhzgFaultAwaitTransferUsersCountDTO> fusersCountMap = usersCountDTOList.stream().collect(Collectors.toMap(FhzgFaultAwaitTransferUsersCountDTO::getFaultId, Function.identity(), (k1, k2) -> k2));
|
|
|
Map<Long, FaultPowerCutPvUsers> cutPvUsersMap = countCutPvUsers.stream().collect(Collectors.toMap(FaultPowerCutPvUsers::getFaultId, Function.identity(), (k1, k2) -> k2));
|
|
Map<Long, FaultPowerCutPvUsers> cutPvUsersMap = countCutPvUsers.stream().collect(Collectors.toMap(FaultPowerCutPvUsers::getFaultId, Function.identity(), (k1, k2) -> k2));
|
|
|
|
|
+ final Map<String, List<FhzgFaultPowerCutSectionVO>> sectionMapFinal = sectionMap;
|
|
|
|
|
+
|
|
|
BigDecimal multiplyNumber = new BigDecimal("1000");
|
|
BigDecimal multiplyNumber = new BigDecimal("1000");
|
|
|
list.forEach(e -> {
|
|
list.forEach(e -> {
|
|
|
Long id = e.getId();
|
|
Long id = e.getId();
|
|
|
|
|
+ Optional.of(fileListMap).ifPresent(p -> e.setFileList(Objects.nonNull(p.get(id)) ? p.get(id) : Lists.newArrayList()));
|
|
|
|
|
+ String fId = e.getFaultId();
|
|
|
|
|
+ List<FhzgFaultPowerCutSectionVO> faultPowerCuts = null != sectionMapFinal.get(fId) ? sectionMapFinal.get(fId) : new ArrayList<>();
|
|
|
|
|
+ faultPowerCuts.forEach(section -> Optional.of(fileListMap).ifPresent(f -> section.setFileList(Objects.nonNull(f.get(section.getFaultId())) ? f.get(section.getFaultId()) : Lists.newArrayList())));
|
|
|
|
|
+ e.setSectionList(faultPowerCuts);
|
|
|
FhzgFaultAwaitTransferUsersCountDTO userCountDtoDefault = fusersCountMap.get(id);
|
|
FhzgFaultAwaitTransferUsersCountDTO userCountDtoDefault = fusersCountMap.get(id);
|
|
|
FaultPowerCutPvUsers faultPowerCutPvUsersDefault = cutPvUsersMap.get(id);
|
|
FaultPowerCutPvUsers faultPowerCutPvUsersDefault = cutPvUsersMap.get(id);
|
|
|
fillUserCountInfo(userCountDtoDefault, faultPowerCutPvUsersDefault, e, null, multiplyNumber);
|
|
fillUserCountInfo(userCountDtoDefault, faultPowerCutPvUsersDefault, e, null, multiplyNumber);
|