|
|
@@ -82,11 +82,11 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
page.setCurrent(obj.getPageNum());
|
|
|
page.setSize(obj.getPageSize());
|
|
|
// List<FhzgFaultPowerCutVO> list = baseMapper.selectSchemeList(page, obj);
|
|
|
- List<FhzgFaultPowerCutVO> list2 = baseMapper.selectSchemeList2(page, obj);
|
|
|
+ List<FhzgFaultPowerCutVO> list = baseMapper.selectSchemeList2(page, obj);
|
|
|
|
|
|
- if (CollUtil.isNotEmpty(list2)) {
|
|
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
//获取故障停电主键id,grid_pd_outage_event_base.id
|
|
|
- List<String> faultNoList = list2.stream().map(FhzgFaultPowerCutVO::getFaultId).collect(Collectors.toList());
|
|
|
+ List<String> faultNoList = list.stream().map(FhzgFaultPowerCutVO::getFaultId).collect(Collectors.toList());
|
|
|
//根据faultId获取idList,fhzg_fault_power_cut.id
|
|
|
List<FaultPowerCut> faultList = this.list(new LambdaQueryWrapper<FaultPowerCut>().in(FaultPowerCut::getFaultNo, faultNoList));
|
|
|
List<Long> idList = faultList.stream().map(FaultPowerCut::getId).collect(Collectors.toList());
|
|
|
@@ -96,7 +96,7 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
FhzgFaultPowerCutSectionVO::getFaultNo,
|
|
|
Collectors.collectingAndThen(
|
|
|
Collectors.toList(),
|
|
|
- list->list.stream().sorted(
|
|
|
+ ls->ls.stream().sorted(
|
|
|
Comparator.comparing(FhzgFaultPowerCutSectionVO::getSectionStatus,Comparator.reverseOrder())
|
|
|
.thenComparing(FhzgFaultPowerCutSectionVO::getCreateTime,Comparator.reverseOrder()))
|
|
|
.collect(Collectors.toList())))
|
|
|
@@ -105,7 +105,7 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
List<FhzgFaultDistMappingFileDTO> fileList = faultDistMappingFileMapper.getMappingFileByPlanId(idList);
|
|
|
if (CollUtil.isNotEmpty(faultPowerCutSectionList)) {
|
|
|
Map<Long, List<FhzgFaultDistMappingFileDTO>> fileListMap = fileList.stream().collect(Collectors.groupingBy(FhzgFaultDistMappingFileDTO::getFaultId));
|
|
|
- list2.forEach(e -> {
|
|
|
+ list.forEach(e -> {
|
|
|
//故障id
|
|
|
String fId = e.getFaultId();
|
|
|
List<FhzgFaultPowerCutSectionVO> faultPowerCuts = null != sectionMap.get(fId) ? sectionMap.get(fId) : new ArrayList<>();
|
|
|
@@ -119,42 +119,68 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
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, FaultPowerCutPvUsers> cutPvUsersMap = countCutPvUsers.stream().collect(Collectors.toMap(FaultPowerCutPvUsers::getFaultId, Function.identity(), (k1, k2) -> k2));
|
|
|
-
|
|
|
- list2.forEach(e -> {
|
|
|
- // FhzgFaultAwaitTransferUsersCountDTO userCountDTO = fusersCountMap.get(e.getId());
|
|
|
- // if (!Objects.isNull(userCountDTO)) {
|
|
|
- // e.setTransferCriticalUsers(userCountDTO.getTransferCriticalUsers());//重要用户数量
|
|
|
- // e.setTransferSensitiveUsers(userCountDTO.getTransferSensitiveUsers());//敏感用户
|
|
|
- // e.setUserCount(userCountDTO.getUserCount());//用户数量
|
|
|
- // e.setUserLoads(userCountDTO.getUserLoads());//用户负荷
|
|
|
- // e.setProtectUsers(userCountDTO.getProtectUsers());//保电用户数量
|
|
|
- // }
|
|
|
+ BigDecimal multiplyNumber = new BigDecimal("1000");
|
|
|
+ list.forEach(e -> {
|
|
|
+ Long id = e.getId();
|
|
|
+ FhzgFaultAwaitTransferUsersCountDTO userCountDtoDefault = fusersCountMap.get(id);
|
|
|
+ FaultPowerCutPvUsers faultPowerCutPvUsersDefault = cutPvUsersMap.get(id);
|
|
|
+ fillUserCountInfo(userCountDtoDefault,faultPowerCutPvUsersDefault,e,null,multiplyNumber);
|
|
|
List<FhzgFaultPowerCutSectionVO> sectionList = e.getSectionList();
|
|
|
- BigDecimal multiplyNumber = new BigDecimal("1000");
|
|
|
sectionList.forEach(section->{
|
|
|
- FhzgFaultAwaitTransferUsersCountDTO userCountDTO = fusersCountMap.get(section.getFaultId());
|
|
|
- FaultPowerCutPvUsers faultPowerCutPvUsers = cutPvUsersMap.get(section.getFaultId());
|
|
|
- Integer count = Objects.isNull(faultPowerCutPvUsers) ? 0 : Objects.isNull(faultPowerCutPvUsers.getCount()) ? 0 : faultPowerCutPvUsers.getCount();
|
|
|
- section.setPvUsers(count);
|
|
|
- if (Objects.nonNull(userCountDTO)) {
|
|
|
- section.setTransferCriticalUsers(userCountDTO.getTransferCriticalUsers());//重要用户数量
|
|
|
- section.setTransferSensitiveUsers(userCountDTO.getTransferSensitiveUsers());//敏感用户
|
|
|
- section.setUserCount(userCountDTO.getUserCount());//用户数量
|
|
|
- section.setUserLoads(Objects.isNull(userCountDTO.getUserLoads())?BigDecimal.ZERO:userCountDTO.getUserLoads().multiply(multiplyNumber));//用户负荷
|
|
|
- section.setProtectUsers(userCountDTO.getProtectUsers());//保电用户数量
|
|
|
- }
|
|
|
+ Long faultId = section.getFaultId();
|
|
|
+ FhzgFaultAwaitTransferUsersCountDTO userCountDTO = fusersCountMap.get(faultId);
|
|
|
+ FaultPowerCutPvUsers faultPowerCutPvUsers = cutPvUsersMap.get(faultId);
|
|
|
+ fillUserCountInfo(userCountDTO,faultPowerCutPvUsers,e,section,multiplyNumber);
|
|
|
});
|
|
|
});
|
|
|
-
|
|
|
} else {
|
|
|
log.info("查询故障停电数据为空condition:{}", obj);
|
|
|
}
|
|
|
- return page.setRecords(list2);
|
|
|
+ return page.setRecords(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 填充用户数量信息
|
|
|
+ */
|
|
|
+ private void fillUserCountInfo(FhzgFaultAwaitTransferUsersCountDTO userCountDto, FaultPowerCutPvUsers powerCutPvUsers,
|
|
|
+ FhzgFaultPowerCutVO vo, FhzgFaultPowerCutSectionVO sectionVO,
|
|
|
+ BigDecimal multiplyNumber){
|
|
|
+ Integer pvCount = Objects.isNull(powerCutPvUsers) ? 0 : Objects.isNull(powerCutPvUsers.getCount()) ? 0 : powerCutPvUsers.getCount();
|
|
|
+ if(Objects.isNull(sectionVO)){
|
|
|
+ vo.setPvUsers(pvCount);
|
|
|
+ if (Objects.nonNull(userCountDto)) {
|
|
|
+ //重要用户数量
|
|
|
+ vo.setTransferCriticalUsers(userCountDto.getTransferCriticalUsers());
|
|
|
+ //敏感用户
|
|
|
+ vo.setTransferSensitiveUsers(userCountDto.getTransferSensitiveUsers());
|
|
|
+ //用户数量
|
|
|
+ vo.setUserCount(userCountDto.getUserCount());
|
|
|
+ //用户负荷,空则0
|
|
|
+ vo.setUserLoads(Objects.isNull(userCountDto.getUserLoads())
|
|
|
+ ? BigDecimal.ZERO : userCountDto.getUserLoads().multiply(multiplyNumber));
|
|
|
+ //保电用户数量
|
|
|
+ vo.setProtectUsers(userCountDto.getProtectUsers());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ sectionVO.setPvUsers(pvCount);
|
|
|
+ if (Objects.nonNull(userCountDto)) {
|
|
|
+ //重要用户数量
|
|
|
+ sectionVO.setTransferCriticalUsers(userCountDto.getTransferCriticalUsers());
|
|
|
+ //敏感用户
|
|
|
+ sectionVO.setTransferSensitiveUsers(userCountDto.getTransferSensitiveUsers());
|
|
|
+ //用户数量
|
|
|
+ sectionVO.setUserCount(userCountDto.getUserCount());
|
|
|
+ //用户负荷,空则0
|
|
|
+ sectionVO.setUserLoads(Objects.isNull(userCountDto.getUserLoads())
|
|
|
+ ? BigDecimal.ZERO : userCountDto.getUserLoads().multiply(multiplyNumber));
|
|
|
+ //保电用户数量
|
|
|
+ sectionVO.setProtectUsers(userCountDto.getProtectUsers());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
@Override
|
|
|
public HasDataTagDTO getHasDataTag(FhzgFaultDistCustomerDTO dto) {
|
|
|
Long faultId = dto.getFaultId();
|