1.单位变电站公共方法

This commit is contained in:
wr
2024-02-27 15:14:37 +08:00
parent b45fe4c040
commit 7c7c66280d
20 changed files with 264 additions and 25 deletions

View File

@@ -126,6 +126,19 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 根据单位获取所有变电站详细信息
* @param deptGetLineParam
* @return
*/
@PostMapping("/deptGetSubStationInfo")
@ApiOperation("根据单位获取所有变电站详细信息")
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
public HttpResult<List<DeptGetSubStationDTO.Info>> deptGetSubStationInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
String methodDescribe = getMethodDescribe("deptGetSubStationInfo");
List<DeptGetSubStationDTO.Info> result = commTerminalService.deptSubStationInfo(deptGetLineParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/**
* 根据单位获取所有母线
* @author cdf

View File

@@ -108,4 +108,11 @@ public interface CommTerminalService {
List<BusBarAndHisMonitorDTO> getBusBarAndHisMonitor();
/**
* 根据部门获取各变电站信息
* @param deptGetLineParam
* @return
*/
List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam);
}

View File

@@ -790,4 +790,68 @@ public class CommTerminalServiceImpl implements CommTerminalService {
return result;
}
@Override
public List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam) {
List<DeptGetSubStationDTO.Info> result = new ArrayList<>();
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
//获取监测点信息
List<PmsStatationStatInfoDTO> statationStatInfo = statationStatMapper.getStatationStatInfo(new PmsStatationStatInfoParam());
Map<String, List<PmsStatationStatInfoDTO>> statationAndMonitorMap = statationStatInfo.stream().collect(Collectors.groupingBy(PmsStatationStatInfoDTO::getOrgId));
// List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0);
// Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
temDept.forEach(item -> {
DeptGetSubStationDTO.Info deptGetSubStationDTO = new DeptGetSubStationDTO.Info();
deptGetSubStationDTO.setUnitId(item.getUnitId());
deptGetSubStationDTO.setUnitName(item.getUnitName());
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
deptGetSubStationDTO.setDeptLevel(item.getDeptLevel());
List<String> deptIds = item.getUnitChildrenList();
if (CollectionUtil.isNotEmpty(deptIds)) {
List<SubGetBase> subList = new ArrayList<>();
List<SubGetBase> subListPw = new ArrayList<>();
SubGetBase subGetBase;
for (String deptId : deptIds) {
if (statationAndMonitorMap.containsKey(deptId)) {
//获取部门下变电信息
List<PmsStatationStatInfoDTO> sub = statationAndMonitorMap.get(deptId);
Map<String, List<PmsStatationStatInfoDTO>> subMap = sub.stream()
.collect(Collectors.groupingBy(x->x.getPowerId()+"_"+x.getPowerName()+"_"+x.getPowerVoltageLevel()));
for (Map.Entry<String, List<PmsStatationStatInfoDTO>> stringListEntry : subMap.entrySet()) {
String[] split = stringListEntry.getKey().split("_");
subGetBase=new SubGetBase();
subGetBase.setId(split[0]);
subGetBase.setName(split[1]);
subGetBase.setVoltageLevel(split[2]);
List<String> monitorIds = stringListEntry.getValue().stream().map(PmsStatationStatInfoDTO::getMonitorId).distinct().collect(Collectors.toList());
subGetBase.setUnitChildrenList(monitorIds);
subList.add(subGetBase);
}
}
// if (mapPms.containsKey(deptId)) {
// //获取部门下变电信息
// List<PmsMonitorBaseDTO> sub = mapPms.get(deptId);
// Map<String, List<PmsMonitorBaseDTO>> subMap = sub.stream()
// .collect(Collectors.groupingBy(x->x.getPowerrId()+"_"+x.getVoltageLevel()));
// for (Map.Entry<String, List<PmsMonitorBaseDTO>> stringListEntry : subMap.entrySet()) {
// String[] split = stringListEntry.getKey().split("_");
// subGetBase=new SubGetBase();
// subGetBase.setId(split[0]);
// subGetBase.setVoltageLevel(split[1]);
// List<String> monitorIds = stringListEntry.getValue().stream().map(PmsMonitorBaseDTO::getMonitorId).distinct().collect(Collectors.toList());
// subGetBase.setUnitChildrenList(monitorIds);
// subListPw.add(subGetBase);
// }
// }
}
deptGetSubStationDTO.setStationIds(subList);
}
result.add(deptGetSubStationDTO);
});
return result;
}
}