|
|
|
|
@@ -9,14 +9,14 @@ import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
|
|
|
|
import com.njcn.device.biz.pojo.dto.DeptGetBase;
|
|
|
|
|
import com.njcn.device.biz.pojo.dto.DeptGetBusBarDTO;
|
|
|
|
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
|
|
|
|
import com.njcn.device.biz.pojo.dto.DeptGetDeviceDTO;
|
|
|
|
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
|
|
|
|
import com.njcn.device.pms.pojo.po.GeneratrixWire;
|
|
|
|
|
import com.njcn.device.pms.pojo.po.Monitor;
|
|
|
|
|
import com.njcn.harmonic.pojo.po.dim.RDimVoltageD;
|
|
|
|
|
import com.njcn.device.pms.pojo.po.PmsMidLedger;
|
|
|
|
|
import com.njcn.harmonic.pojo.po.upload.RUploadEvaluationDataD;
|
|
|
|
|
import com.njcn.prepare.harmonic.enums.UploadEnum;
|
|
|
|
|
import com.njcn.prepare.harmonic.mapper.mysql.dim.GeneratrixWireMapper;
|
|
|
|
|
import com.njcn.prepare.harmonic.mapper.mysql.dim.PmsMidLedgerMapper;
|
|
|
|
|
import com.njcn.prepare.harmonic.mapper.mysql.dim.RDimVoltageDMapper;
|
|
|
|
|
import com.njcn.prepare.harmonic.mapper.mysql.line.PmsMonitorMapper;
|
|
|
|
|
import com.njcn.prepare.harmonic.mapper.mysql.upload.RUploadEvaluationDataDMapper;
|
|
|
|
|
@@ -53,79 +53,91 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
private final RDimVoltageDMapper rDimVoltageDMapper;
|
|
|
|
|
private final DeptFeignClient deptFeignClient;
|
|
|
|
|
private final PmsMonitorMapper pmsMonitorMapper;
|
|
|
|
|
private final GeneratrixWireMapper generatrixWireMapper;
|
|
|
|
|
private final PmsMidLedgerMapper pmsMidLedgerMapper;
|
|
|
|
|
private final DicDataFeignClient dicDataFeignClient;
|
|
|
|
|
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
|
|
|
|
private final GeneratrixWireMapper generatrixWireMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void insertEvaluationDataDay(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam) {
|
|
|
|
|
List<RUploadEvaluationDataD> result = new ArrayList<>();
|
|
|
|
|
final Double defaultValue = 3.1415926;
|
|
|
|
|
//获取监测点信息
|
|
|
|
|
List<Monitor> list1 = getPmsMonitor();
|
|
|
|
|
//获取母线信息
|
|
|
|
|
List<GeneratrixWire> list2 = getBusBarInfo();
|
|
|
|
|
//获取【在运】字典id
|
|
|
|
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
|
|
|
|
DictData dictData = dicDataList.stream().filter(o->Objects.equals(o.getCode(), DicDataEnum.RUN.getCode())).findFirst().orElse(null);
|
|
|
|
|
List<Monitor> list1 = this.getPmsMonitor();
|
|
|
|
|
//获取中台母线信息
|
|
|
|
|
List<PmsMidLedger> list2 = this.getBusBarInfo();
|
|
|
|
|
//获取灿能母线信息
|
|
|
|
|
List<GeneratrixWire> list3 = this.getCnBusBarInfo(list1);
|
|
|
|
|
//获取单位下各电压等级数据
|
|
|
|
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
|
|
|
|
Dept data = deptFeignClient.getRootDept().getData();
|
|
|
|
|
deptGetLineParam.setDeptId(data.getId());
|
|
|
|
|
List<DeptGetBusBarDTO> barDto = commTerminalGeneralClient.deptBusBar(deptGetLineParam).getData();
|
|
|
|
|
List<BusBarDto> busBarList = getBusBarNum(list1,list2,barDto,dictData.getId());
|
|
|
|
|
List<BusBarDto> allDept = getAllDeptLineNum(busBarList);
|
|
|
|
|
List<BusBarDto> busBarList = this.getBusBarNum(list3,list2,barDto);
|
|
|
|
|
List<BusBarDto> allDept = this.getAllDeptLineNum(busBarList,deptGetLineParam);
|
|
|
|
|
//获取省级单位id
|
|
|
|
|
String provinceId = deptFeignClient.getDepSonIdByDeptId(data.getId()).getData().get(0);
|
|
|
|
|
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
|
|
|
|
//获取所有单位
|
|
|
|
|
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
|
|
|
|
Map<String,List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
|
|
|
|
|
|
|
|
|
List<DeptGetChildrenMoreDTO> list = calculatedParam.getIdList();
|
|
|
|
|
//获取母线相关数据
|
|
|
|
|
Map<String,List<RDimVoltageD>> dimMap = getDimVoltageData(calculatedParam.getDataDate());
|
|
|
|
|
//数据处理
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
if (Objects.equals(Integer.parseInt(UploadEnum.NJCN_DEPT_LEVEL_1.getCode()),item.getDeptLevel())){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<RDimVoltageD> l1 = dimMap.get(item.getUnitId());
|
|
|
|
|
if (CollUtil.isNotEmpty(l1)){
|
|
|
|
|
l1.forEach(item2->{
|
|
|
|
|
RUploadEvaluationDataD dto = getLineNum(allDept,item2.getVoltageType(),item.getUnitId());
|
|
|
|
|
RUploadEvaluationDataD rUploadEvaluationDataD = new RUploadEvaluationDataD();
|
|
|
|
|
rUploadEvaluationDataD.setProvinceId(dept.getCode());
|
|
|
|
|
rUploadEvaluationDataD.setProvinceName(dept.getName());
|
|
|
|
|
rUploadEvaluationDataD.setDataSources(UploadEnum.DATA_SOURCES_01.getCode());
|
|
|
|
|
rUploadEvaluationDataD.setStatisticalDate(calculatedParam.getDataDate());
|
|
|
|
|
rUploadEvaluationDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
|
|
|
|
rUploadEvaluationDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
|
|
|
|
judgeLevel(item.getDeptLevel(),rUploadEvaluationDataD,item.getUnitId(),item.getUnitName(),deptList,deptMap);
|
|
|
|
|
RUploadEvaluationDataD rUploadEvaluationDataD = new RUploadEvaluationDataD();
|
|
|
|
|
rUploadEvaluationDataD.setProvinceId(dept.getCode());
|
|
|
|
|
rUploadEvaluationDataD.setProvinceName(dept.getName());
|
|
|
|
|
rUploadEvaluationDataD.setDataSources(UploadEnum.DATA_SOURCES_01.getCode());
|
|
|
|
|
rUploadEvaluationDataD.setStatisticalDate(calculatedParam.getDataDate());
|
|
|
|
|
rUploadEvaluationDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_03.getCode());
|
|
|
|
|
rUploadEvaluationDataD.setUploadStatus(Integer.parseInt(UploadEnum.UPLOAD_STATUS_0.getCode()));
|
|
|
|
|
this.judgeLevel(item.getDeptLevel(),rUploadEvaluationDataD,item.getUnitId(),item.getUnitName(),deptList,deptMap);
|
|
|
|
|
|
|
|
|
|
BusBarDto busBarDto = allDept.stream().filter(o->Objects.equals(o.getOrgId(),item.getUnitId())).findFirst().orElse(null);
|
|
|
|
|
//fixme 这边均值和标准差算法较为复杂,同时国网不要求上送,暂不计算
|
|
|
|
|
/*** 计算无电压等级的数据*/
|
|
|
|
|
RUploadEvaluationDataD dto = this.getLineNum(busBarDto,"0");
|
|
|
|
|
//电压
|
|
|
|
|
RUploadEvaluationDataD dto1 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_01.getCode(),0,"0",dto);
|
|
|
|
|
result.add(dto1);
|
|
|
|
|
//长时间闪变
|
|
|
|
|
RUploadEvaluationDataD dto2 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_02.getCode(),0,"0",dto);
|
|
|
|
|
result.add(dto2);
|
|
|
|
|
//三相电压不平衡
|
|
|
|
|
RUploadEvaluationDataD dto3 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_03.getCode(),0,"0",dto);
|
|
|
|
|
result.add(dto3);
|
|
|
|
|
//电压总谐波畸变率
|
|
|
|
|
RUploadEvaluationDataD dto4 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_04.getCode(),0,"0",dto);
|
|
|
|
|
result.add(dto4);
|
|
|
|
|
//各次谐波电压
|
|
|
|
|
this.channelHarmonicData(rUploadEvaluationDataD,result,null,UploadEnum.INDEX_TYPE_05.getCode(),"0",dto);
|
|
|
|
|
//负序电流
|
|
|
|
|
RUploadEvaluationDataD dto6 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_06.getCode(),0,"0",dto);
|
|
|
|
|
result.add(dto6);
|
|
|
|
|
/*** 计算分电压等级的数据*/
|
|
|
|
|
if (CollUtil.isNotEmpty(busBarDto.getVoltageChild())){
|
|
|
|
|
busBarDto.getVoltageChild().forEach(item2->{
|
|
|
|
|
RUploadEvaluationDataD dto0 = this.getLineNum(busBarDto,item2.getVoltageLevel());
|
|
|
|
|
//电压
|
|
|
|
|
RUploadEvaluationDataD dto1 = channelData(rUploadEvaluationDataD,item2.getV(),UploadEnum.INDEX_TYPE_01.getCode(),0,item2.getVoltageType(),dto);
|
|
|
|
|
result.add(dto1);
|
|
|
|
|
RUploadEvaluationDataD dto11 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_01.getCode(),0,item2.getVoltageLevel(),dto0);
|
|
|
|
|
result.add(dto11);
|
|
|
|
|
//长时间闪变
|
|
|
|
|
RUploadEvaluationDataD dto2 = channelData(rUploadEvaluationDataD,item2.getPst(),UploadEnum.INDEX_TYPE_02.getCode(),0,item2.getVoltageType(),dto);
|
|
|
|
|
result.add(dto2);
|
|
|
|
|
RUploadEvaluationDataD dto22 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_02.getCode(),0,item2.getVoltageLevel(),dto0);
|
|
|
|
|
result.add(dto22);
|
|
|
|
|
//三相电压不平衡
|
|
|
|
|
RUploadEvaluationDataD dto3 = channelData(rUploadEvaluationDataD,item2.getVUnbalance(),UploadEnum.INDEX_TYPE_03.getCode(),0,item2.getVoltageType(),dto);
|
|
|
|
|
result.add(dto3);
|
|
|
|
|
RUploadEvaluationDataD dto33 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_03.getCode(),0,item2.getVoltageLevel(),dto0);
|
|
|
|
|
result.add(dto33);
|
|
|
|
|
//电压总谐波畸变率
|
|
|
|
|
RUploadEvaluationDataD dto4 = channelData(rUploadEvaluationDataD,item2.getVThd(),UploadEnum.INDEX_TYPE_04.getCode(),0,item2.getVoltageType(),dto);
|
|
|
|
|
result.add(dto4);
|
|
|
|
|
RUploadEvaluationDataD dto44 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_04.getCode(),0,item2.getVoltageLevel(),dto0);
|
|
|
|
|
result.add(dto44);
|
|
|
|
|
//各次谐波电压
|
|
|
|
|
List<Double> harmonic = Arrays.asList(item2.getV2(),item2.getV3(),item2.getV4(),item2.getV5()
|
|
|
|
|
,item2.getV6(),item2.getV7(),item2.getV8(),item2.getV9(),item2.getV10(),item2.getV11()
|
|
|
|
|
,item2.getV12(),item2.getV13(),item2.getV14(),item2.getV15(),item2.getV16(),item2.getV17()
|
|
|
|
|
,item2.getV18(),item2.getV19(),item2.getV20(),item2.getV21(),item2.getV22(),item2.getV23()
|
|
|
|
|
,item2.getV24(),item2.getV25(),item2.getV26(),item2.getV27(),item2.getV28(),item2.getV29()
|
|
|
|
|
,item2.getV30(),item2.getV31(),item2.getV32(),item2.getV33(),item2.getV34(),item2.getV35()
|
|
|
|
|
,item2.getV36(),item2.getV37(),item2.getV38(),item2.getV39(),item2.getV40(),item2.getV41()
|
|
|
|
|
,item2.getV42(),item2.getV43(),item2.getV44(),item2.getV45(),item2.getV46(),item2.getV47()
|
|
|
|
|
,item2.getV48(),item2.getV49(),item2.getV50());
|
|
|
|
|
channelHarmonicData(rUploadEvaluationDataD,result,harmonic,UploadEnum.INDEX_TYPE_05.getCode(),item2.getVoltageType(),dto);
|
|
|
|
|
this.channelHarmonicData(rUploadEvaluationDataD,result,null,UploadEnum.INDEX_TYPE_05.getCode(),item2.getVoltageLevel(),dto0);
|
|
|
|
|
//负序电流
|
|
|
|
|
RUploadEvaluationDataD dto6 = channelData(rUploadEvaluationDataD,item2.getINeg(),UploadEnum.INDEX_TYPE_06.getCode(),0,item2.getVoltageType(),dto);
|
|
|
|
|
result.add(dto6);
|
|
|
|
|
RUploadEvaluationDataD dto66 = this.channelData(rUploadEvaluationDataD,defaultValue,UploadEnum.INDEX_TYPE_06.getCode(),0,item2.getVoltageLevel(),dto0);
|
|
|
|
|
result.add(dto66);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@@ -134,97 +146,95 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取区域母线不同电压等级指标数据日表
|
|
|
|
|
*/
|
|
|
|
|
public Map<String,List<RDimVoltageD>> getDimVoltageData(String time) {
|
|
|
|
|
Map<String,List<RDimVoltageD>> map = new HashMap<>();
|
|
|
|
|
LambdaQueryWrapper<RDimVoltageD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(RDimVoltageD::getStatisDate,time);
|
|
|
|
|
List<RDimVoltageD> list = rDimVoltageDMapper.selectList(lambdaQueryWrapper);
|
|
|
|
|
if (CollUtil.isNotEmpty(list)){
|
|
|
|
|
map = list.stream().collect(Collectors.groupingBy(RDimVoltageD::getOrgId));
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取监测点信息
|
|
|
|
|
* 获取 在运 && 正常 && 国网上送 的监测点信息
|
|
|
|
|
*/
|
|
|
|
|
public List<Monitor> getPmsMonitor() {
|
|
|
|
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
|
|
|
|
DictData dictData = dicDataList.stream().filter(o->Objects.equals(o.getCode(), DicDataEnum.RUN.getCode())).findFirst().orElse(null);
|
|
|
|
|
LambdaQueryWrapper<Monitor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(Monitor::getStatus, DataStateEnum.ENABLE.getCode());
|
|
|
|
|
lambdaQueryWrapper.eq(Monitor::getStatus, DataStateEnum.ENABLE.getCode())
|
|
|
|
|
.eq(Monitor::getIsUpToGrid,DataStateEnum.ENABLE.getCode())
|
|
|
|
|
.eq(Monitor::getMonitorState,dictData.getId());
|
|
|
|
|
return pmsMonitorMapper.selectList(lambdaQueryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取母线信息
|
|
|
|
|
* 获取中台母线信息
|
|
|
|
|
* 筛选系统已有的电压等级母线
|
|
|
|
|
*/
|
|
|
|
|
public List<GeneratrixWire> getBusBarInfo() {
|
|
|
|
|
public List<PmsMidLedger> getBusBarInfo() {
|
|
|
|
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
|
|
|
|
List<String> list = dicDataList.stream().map(DictData::getId).collect(Collectors.toList());
|
|
|
|
|
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(PmsMidLedger::getLevel, DataStateEnum.ENABLE.getCode())
|
|
|
|
|
.eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode())
|
|
|
|
|
.in(PmsMidLedger::getVoltageLevel, list);
|
|
|
|
|
return pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取灿能母线信息
|
|
|
|
|
*/
|
|
|
|
|
public List<GeneratrixWire> getCnBusBarInfo(List<Monitor> list) {
|
|
|
|
|
List<String> lineList = list.stream().map(Monitor::getLineId).collect(Collectors.toList());
|
|
|
|
|
LambdaQueryWrapper<GeneratrixWire> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.eq(GeneratrixWire::getStatus, DataStateEnum.ENABLE.getCode());
|
|
|
|
|
lambdaQueryWrapper.eq(GeneratrixWire::getStatus, DataStateEnum.ENABLE.getCode())
|
|
|
|
|
.in(GeneratrixWire::getId,lineList);
|
|
|
|
|
return generatrixWireMapper.selectList(lambdaQueryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取已知单位母线数量
|
|
|
|
|
*/
|
|
|
|
|
public List<BusBarDto> getBusBarNum(List<Monitor> list1, List<GeneratrixWire> list2, List<DeptGetBusBarDTO> dto, String code) {
|
|
|
|
|
public List<BusBarDto> getBusBarNum(List<GeneratrixWire> list1, List<PmsMidLedger> list2, List<DeptGetBusBarDTO> dto) {
|
|
|
|
|
List<BusBarDto> result = new ArrayList<>();
|
|
|
|
|
Map<String,List<DeptGetBusBarDTO>> unitMap = dto.stream().collect(Collectors.groupingBy(DeptGetBusBarDTO::getUnitId));
|
|
|
|
|
Map<String, List<Monitor>> map = list1.stream().collect(Collectors.groupingBy(Monitor::getOrgId));
|
|
|
|
|
unitMap.forEach((k,v)->{
|
|
|
|
|
//获取监测的母线
|
|
|
|
|
List<Monitor> l3 = map.get(k);
|
|
|
|
|
//组装数据
|
|
|
|
|
List<BusBarDto.VoltageChild> children = new ArrayList<>();
|
|
|
|
|
BusBarDto busBarDto = new BusBarDto();
|
|
|
|
|
busBarDto.setOrgId(k);
|
|
|
|
|
//当前单位下所有母线数量
|
|
|
|
|
List<String> l1 = v.get(0).getBusBarIds();
|
|
|
|
|
//中台母线
|
|
|
|
|
Map<String,List<PmsMidLedger>> midMap = list2.stream().collect(Collectors.groupingBy(PmsMidLedger::getSectionId));
|
|
|
|
|
for (DeptGetBusBarDTO item : dto) {
|
|
|
|
|
int count = 0;
|
|
|
|
|
List<BusBarDto.VoltageChild> childList = new ArrayList<>();
|
|
|
|
|
BusBarDto dto1 = new BusBarDto();
|
|
|
|
|
dto1.setOrgId(item.getUnitId());
|
|
|
|
|
//处理中台母线
|
|
|
|
|
List<PmsMidLedger> l1 = midMap.get(item.getUnitId());
|
|
|
|
|
if (CollUtil.isNotEmpty(l1)){
|
|
|
|
|
//获取所有母线的基本信息,用于电压等级分类
|
|
|
|
|
List<GeneratrixWire> l2 = list2.stream().filter(o->l1.contains(o.getId())).collect(Collectors.toList());
|
|
|
|
|
//根据电压等级分组
|
|
|
|
|
Map<String, List<GeneratrixWire>> map2 = l2.stream().collect(Collectors.groupingBy(GeneratrixWire::getScale));
|
|
|
|
|
map2.forEach((k1,v1)->{
|
|
|
|
|
dto1.setAllOnlineBusNum(l1.size());
|
|
|
|
|
Map<String,List<PmsMidLedger>> voltageMap = l1.stream().collect(Collectors.groupingBy(PmsMidLedger::getVoltageLevel));
|
|
|
|
|
for (String key : voltageMap.keySet()) {
|
|
|
|
|
BusBarDto.VoltageChild voltageChild = new BusBarDto.VoltageChild();
|
|
|
|
|
voltageChild.setVoltageLevel(k1);
|
|
|
|
|
voltageChild.setOnlineBusNum(v1.size());
|
|
|
|
|
List<String> l2 = voltageMap.get(key).stream().map(PmsMidLedger::getId).collect(Collectors.toList());
|
|
|
|
|
voltageChild.setVoltageLevel(key);
|
|
|
|
|
voltageChild.setOnlineBusNum(l2.size());
|
|
|
|
|
//这边没法直接通过电压等级来关联灿能母线,只能通过 Mid_Bus_Id 来关联
|
|
|
|
|
List<GeneratrixWire> l3 = list1.stream().filter(o->l2.contains(o.getMidBusId())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(l3)){
|
|
|
|
|
List<String> online = l3.stream().filter(o->Objects.equals(o.getMonitorState(),code)).map(Monitor::getLineId).collect(Collectors.toList());
|
|
|
|
|
List<GeneratrixWire> l4 = list2.stream().filter(o->online.contains(o.getId())).collect(Collectors.toList());
|
|
|
|
|
Map<String, List<GeneratrixWire>> map3 = l4.stream().collect(Collectors.groupingBy(GeneratrixWire::getScale));
|
|
|
|
|
int num = Objects.isNull(map3.get(k1))?0:map3.get(k1).size();
|
|
|
|
|
voltageChild.setMonitorBusNum(num);
|
|
|
|
|
voltageChild.setMonitorRate(num*100.0/v1.size());
|
|
|
|
|
voltageChild.setMonitorBusNum(l3.size());
|
|
|
|
|
} else {
|
|
|
|
|
voltageChild.setMonitorBusNum(0);
|
|
|
|
|
voltageChild.setMonitorRate(0.0);
|
|
|
|
|
}
|
|
|
|
|
children.add(voltageChild);
|
|
|
|
|
});
|
|
|
|
|
busBarDto.setVoltageChild(children);
|
|
|
|
|
result.add(busBarDto);
|
|
|
|
|
voltageChild.setMonitorRate(voltageChild.getMonitorBusNum()*100.0/voltageChild.getOnlineBusNum());
|
|
|
|
|
childList.add(voltageChild);
|
|
|
|
|
count = count + voltageChild.getMonitorBusNum();
|
|
|
|
|
}
|
|
|
|
|
dto1.setAllMonitorBusNum(count);
|
|
|
|
|
dto1.setVoltageChild(childList);
|
|
|
|
|
dto1.setAllMonitorRate(dto1.getAllMonitorRate()*100/l1.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
result.add(dto1);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 组装所有单位下各个电压等级的母线数量
|
|
|
|
|
*/
|
|
|
|
|
public List<BusBarDto> getAllDeptLineNum(List<BusBarDto> list) {
|
|
|
|
|
public List<BusBarDto> getAllDeptLineNum(List<BusBarDto> list, DeptGetLineParam deptGetLineParam) {
|
|
|
|
|
List<BusBarDto> result = new ArrayList<>();
|
|
|
|
|
//获取所有部门信息
|
|
|
|
|
Dept data = deptFeignClient.getRootDept().getData();
|
|
|
|
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
|
|
|
|
deptGetLineParam.setDeptId(data.getId());
|
|
|
|
|
List<DeptGetBase> deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
|
|
|
|
|
|
|
|
|
|
deptList.forEach(item->{
|
|
|
|
|
int count1 = 0,count2 = 0;
|
|
|
|
|
List<BusBarDto.VoltageChild> children = new ArrayList<>();
|
|
|
|
|
List<BusBarDto.VoltageChild> child = new ArrayList<>();
|
|
|
|
|
BusBarDto busBarDto = new BusBarDto();
|
|
|
|
|
@@ -232,21 +242,30 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
//获取当前部门下 包含母线数量的部门
|
|
|
|
|
List<BusBarDto> newList = list.stream().filter(o->item.getUnitChildrenList().contains(o.getOrgId())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(newList)){
|
|
|
|
|
newList.forEach(item2->{
|
|
|
|
|
child.addAll(item2.getVoltageChild());
|
|
|
|
|
});
|
|
|
|
|
Map<String,List<BusBarDto.VoltageChild>> map = child.stream().collect(Collectors.groupingBy(BusBarDto.VoltageChild::getVoltageLevel));
|
|
|
|
|
map.forEach((k,v)->{
|
|
|
|
|
BusBarDto.VoltageChild c1 = new BusBarDto.VoltageChild();
|
|
|
|
|
c1.setVoltageLevel(k);
|
|
|
|
|
int monitorBusNum = v.stream().mapToInt(BusBarDto.VoltageChild::getMonitorBusNum).sum();
|
|
|
|
|
c1.setMonitorBusNum(monitorBusNum);
|
|
|
|
|
int online = v.stream().mapToInt(BusBarDto.VoltageChild::getOnlineBusNum).sum()/3;
|
|
|
|
|
c1.setOnlineBusNum(online);
|
|
|
|
|
c1.setMonitorRate(online==0?0:monitorBusNum*100.0/online);
|
|
|
|
|
children.add(c1);
|
|
|
|
|
});
|
|
|
|
|
busBarDto.setVoltageChild(children);
|
|
|
|
|
for (BusBarDto it : newList) {
|
|
|
|
|
count1 = count1 + it.getAllMonitorBusNum();
|
|
|
|
|
count2 = count2 + it.getAllOnlineBusNum();
|
|
|
|
|
if (CollUtil.isNotEmpty(it.getVoltageChild())){
|
|
|
|
|
child.addAll(it.getVoltageChild());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
busBarDto.setAllMonitorBusNum(count1);
|
|
|
|
|
busBarDto.setAllOnlineBusNum(count2);
|
|
|
|
|
busBarDto.setAllMonitorRate(count2==0?0.0:count1*100/count2);
|
|
|
|
|
if (CollUtil.isNotEmpty(child)){
|
|
|
|
|
Map<String,List<BusBarDto.VoltageChild>> map = child.stream().collect(Collectors.groupingBy(BusBarDto.VoltageChild::getVoltageLevel));
|
|
|
|
|
map.forEach((k,v)->{
|
|
|
|
|
BusBarDto.VoltageChild c1 = new BusBarDto.VoltageChild();
|
|
|
|
|
c1.setVoltageLevel(k);
|
|
|
|
|
int monitorBusNum = v.stream().mapToInt(BusBarDto.VoltageChild::getMonitorBusNum).sum();
|
|
|
|
|
c1.setMonitorBusNum(monitorBusNum);
|
|
|
|
|
int online = v.stream().mapToInt(BusBarDto.VoltageChild::getOnlineBusNum).sum();
|
|
|
|
|
c1.setOnlineBusNum(online);
|
|
|
|
|
c1.setMonitorRate(online==0.0?0:monitorBusNum*100.0/online);
|
|
|
|
|
children.add(c1);
|
|
|
|
|
});
|
|
|
|
|
busBarDto.setVoltageChild(children);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.add(busBarDto);
|
|
|
|
|
});
|
|
|
|
|
@@ -256,9 +275,8 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
/**
|
|
|
|
|
* 生成母线数量
|
|
|
|
|
*/
|
|
|
|
|
public RUploadEvaluationDataD getLineNum(List<BusBarDto> allDept, String voltage, String deptId) {
|
|
|
|
|
public RUploadEvaluationDataD getLineNum(BusBarDto dto2, String voltage) {
|
|
|
|
|
RUploadEvaluationDataD dto = new RUploadEvaluationDataD();
|
|
|
|
|
BusBarDto dto2 = allDept.stream().filter(o->Objects.equals(o.getOrgId(),deptId)).findFirst().orElse(null);
|
|
|
|
|
if (!Objects.isNull(dto2)){
|
|
|
|
|
List<BusBarDto.VoltageChild> list = dto2.getVoltageChild();
|
|
|
|
|
if (CollUtil.isNotEmpty(list)){
|
|
|
|
|
@@ -267,6 +285,10 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
dto.setMonitorBusNum(item.getMonitorBusNum());
|
|
|
|
|
dto.setOnlineBusNum(item.getOnlineBusNum());
|
|
|
|
|
dto.setMonitorBusRate(item.getMonitorRate());
|
|
|
|
|
} else if (Objects.equals(voltage, "0")){
|
|
|
|
|
dto.setMonitorBusNum(dto2.getAllMonitorBusNum());
|
|
|
|
|
dto.setOnlineBusNum(dto2.getAllOnlineBusNum());
|
|
|
|
|
dto.setMonitorBusRate(dto2.getAllMonitorBusNum()*100.0d/dto2.getAllOnlineBusNum());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@@ -323,14 +345,21 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
* 各次谐波电压数据处理
|
|
|
|
|
*/
|
|
|
|
|
public void channelHarmonicData(RUploadEvaluationDataD rUploadEvaluationDataD,List<RUploadEvaluationDataD> result,List<Double> valueList, String indexType, String voltage,RUploadEvaluationDataD rUploadEvaluationDataD2) {
|
|
|
|
|
for (int i = 0; i < valueList.size(); i++) {
|
|
|
|
|
final Double defaultValue = 3.1415926;
|
|
|
|
|
int length;
|
|
|
|
|
if (!Objects.isNull(valueList)){
|
|
|
|
|
length = valueList.size();
|
|
|
|
|
} else {
|
|
|
|
|
length = 49;
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
RUploadEvaluationDataD dto = new RUploadEvaluationDataD();
|
|
|
|
|
BeanUtils.copyProperties(rUploadEvaluationDataD,dto);
|
|
|
|
|
dto.setId(IdUtil.simpleUUID());
|
|
|
|
|
dto.setAvgValue(valueList.get(i));
|
|
|
|
|
dto.setAvgValue(CollUtil.isNotEmpty(valueList)?valueList.get(i):defaultValue);
|
|
|
|
|
dto.setIndexType(indexType);
|
|
|
|
|
dto.setHarmonicNum(i+2);
|
|
|
|
|
dto.setStandardDeviation(valueList.get(i)==3.1415926?3.1415926:0d);
|
|
|
|
|
dto.setStandardDeviation(CollUtil.isNotEmpty(valueList)?Objects.equals(valueList.get(i),defaultValue)?defaultValue:0d:defaultValue);
|
|
|
|
|
dto.setVoltageLevel(voltage);
|
|
|
|
|
dto.setMonitorBusNum(rUploadEvaluationDataD2.getMonitorBusNum());
|
|
|
|
|
dto.setOnlineBusNum(rUploadEvaluationDataD2.getOnlineBusNum());
|
|
|
|
|
@@ -338,4 +367,4 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
|
|
|
|
result.add(dto);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|