|
|
@@ -7,16 +7,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.hdkj.lt.bf.mapper.*;
|
|
|
+import com.hdkj.lt.core.bizms.modle.po.FeederTopo;
|
|
|
import com.hdkj.lt.feign.IFaultCreateClient;
|
|
|
import com.hdkj.lt.modle.dto.fault.RegenerateFaultRequest;
|
|
|
import com.hdkj.lt.base.exception.BusinessException;
|
|
|
import com.hdkj.lt.bf.entity.dto.HasDataTagDTO;
|
|
|
import com.hdkj.lt.bf.entity.vo.FhzgFaultPowerCutSectionVO;
|
|
|
import com.hdkj.lt.bf.entity.vo.FhzgFaultPowerCutVO;
|
|
|
-import com.hdkj.lt.bf.mapper.FaultAwaitTransferUsersMapper;
|
|
|
-import com.hdkj.lt.bf.mapper.FaultDistMappingFileMapper;
|
|
|
-import com.hdkj.lt.bf.mapper.FaultPowerCutMapper;
|
|
|
-import com.hdkj.lt.bf.mapper.FhzgFaultSwitchInfoListMapper;
|
|
|
import com.hdkj.lt.bf.service.*;
|
|
|
import com.hdkj.lt.bf.service.aspect.UserCountyCodeAuto;
|
|
|
import com.hdkj.lt.core.bizms.modle.dto.FhzgFaultAwaitTransferUsersCountDTO;
|
|
|
@@ -37,6 +35,7 @@ import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -74,6 +73,8 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
|
|
|
@Autowired
|
|
|
IFaultCreateClient faultCreateClient;
|
|
|
+ @Autowired
|
|
|
+ private FeederTopoMapper feederTopoMapper;
|
|
|
|
|
|
@Override
|
|
|
@UserCountyCodeAuto(sourceFiled = "countyCode", targetFiled = "countyCodeList")
|
|
|
@@ -92,18 +93,23 @@ public class FaultPowerCutServiceImpl extends ServiceImpl<FaultPowerCutMapper, F
|
|
|
List<Long> idList = faultList.stream().map(FaultPowerCut::getId).collect(Collectors.toList());
|
|
|
//获取开关信息
|
|
|
List<FhzgFaultPowerCutSectionVO> faultPowerCutSectionList = switchInfoListMapper.querySectionsSwitchByFaultId(idList);
|
|
|
- Map<String, List<FhzgFaultPowerCutSectionVO>> sectionMap = faultPowerCutSectionList.stream().collect(Collectors.groupingBy(
|
|
|
- FhzgFaultPowerCutSectionVO::getFaultNo,
|
|
|
- Collectors.collectingAndThen(
|
|
|
- Collectors.toList(),
|
|
|
- ls -> ls.stream().sorted(
|
|
|
- Comparator.comparing(FhzgFaultPowerCutSectionVO::getSectionStatus, Comparator.reverseOrder())
|
|
|
- .thenComparing(FhzgFaultPowerCutSectionVO::getCreateTime, Comparator.reverseOrder()))
|
|
|
- .collect(Collectors.toList())))
|
|
|
- );
|
|
|
//查询计划对应的线路图信息
|
|
|
List<FhzgFaultDistMappingFileDTO> fileList = faultDistMappingFileMapper.getMappingFileByPlanId(idList);
|
|
|
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());
|
|
|
+ //根据开关id获取名称
|
|
|
+ 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()
|
|
|
+ .peek(p->p.setStartSwitchName(switchNameMap.get(p.getStartSwitch())).setEndSwitchName(switchNameMap.get(p.getEndSwitch()))
|
|
|
+ ).collect(Collectors.groupingBy(
|
|
|
+ FhzgFaultPowerCutSectionVO::getFaultNo,
|
|
|
+ Collectors.collectingAndThen(
|
|
|
+ Collectors.toList(),
|
|
|
+ ls -> ls.stream().sorted(
|
|
|
+ Comparator.comparing(FhzgFaultPowerCutSectionVO::getSectionStatus, Comparator.reverseOrder())
|
|
|
+ .thenComparing(FhzgFaultPowerCutSectionVO::getCreateTime, Comparator.reverseOrder()))
|
|
|
+ .collect(Collectors.toList())))
|
|
|
+ );
|
|
|
Map<Long, List<FhzgFaultDistMappingFileDTO>> fileListMap = fileList.stream().collect(Collectors.groupingBy(FhzgFaultDistMappingFileDTO::getFaultId));
|
|
|
list.forEach(e -> {
|
|
|
Long id = e.getId();
|