河北超高压算法调整
This commit is contained in:
@@ -124,20 +124,30 @@ public class REvaluationDataServiceImpl extends ServiceImpl<RUploadEvaluationDat
|
||||
if (Objects.equals(item.getHarmonicNum(),0)){
|
||||
item.setHarmonicNum(null);
|
||||
}
|
||||
if (Objects.equals(item.getVoltageLevel(),"0")){
|
||||
item.setVoltageLevel(null);
|
||||
}
|
||||
if (Objects.equals(item.getCityId(),"")){
|
||||
item.setCityId(null);
|
||||
}
|
||||
if (Objects.equals(item.getCountyId(),"")){
|
||||
item.setCountyId(null);
|
||||
}
|
||||
BigDecimal four = BigDecimal.valueOf(item.getMonitorBusRate());
|
||||
double value = four.setScale(4,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
item.setMonitorBusRate(value);
|
||||
item.setVoltageLevel(getVoltage(item.getVoltageLevel()));
|
||||
}).collect(Collectors.toList());
|
||||
//组装数据
|
||||
SendParam sp = new SendParam();
|
||||
sp.setStats(l1);
|
||||
sp.setStatisticalDate(param.getTime());
|
||||
//上送数据
|
||||
Map<String, String> send = GwSendUtil.send(sp, GWSendEnum.EVALUATION);
|
||||
//获取返回结果
|
||||
List<String> l = pendingIds.get(i).stream().map(PqEvaluationCreateDTO::getId).collect(Collectors.toList());
|
||||
returnInformation(i,l,send);
|
||||
log.info(JSON.toJSONString(l1));
|
||||
// //组装数据
|
||||
// SendParam sp = new SendParam();
|
||||
// sp.setStats(l1);
|
||||
// sp.setStatisticalDate(param.getTime());
|
||||
// //上送数据
|
||||
// Map<String, String> send = GwSendUtil.send(sp, GWSendEnum.EVALUATION);
|
||||
// //获取返回结果
|
||||
// List<String> l = pendingIds.get(i).stream().map(PqEvaluationCreateDTO::getId).collect(Collectors.toList());
|
||||
// returnInformation(i,l,send);
|
||||
}
|
||||
return "上送成功:成功数据" + list.size() + "条";
|
||||
}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.upload.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
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;
|
||||
@@ -66,11 +68,13 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
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<BusBarDto> busBarList = getBusBarNum(list1,list2,dictData.getId());
|
||||
List<BusBarDto> allDept = getAllDeptLineNum(busBarList);
|
||||
|
||||
//获取省级单位id
|
||||
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);
|
||||
//获取省级单位id
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(data.getId()).getData().get(0);
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
//获取所有单位
|
||||
@@ -85,10 +89,9 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
return;
|
||||
}
|
||||
List<RDimVoltageD> l1 = dimMap.get(item.getUnitId());
|
||||
if (CollectionUtil.isNotEmpty(l1)){
|
||||
if (CollUtil.isNotEmpty(l1)){
|
||||
l1.forEach(item2->{
|
||||
RUploadEvaluationDataD dto = getLineNum(allDept,item2.getVoltageType(),item.getUnitId());
|
||||
if (dto.getMonitorBusNum() !=0 ){
|
||||
RUploadEvaluationDataD rUploadEvaluationDataD = new RUploadEvaluationDataD();
|
||||
rUploadEvaluationDataD.setProvinceId(dept.getCode());
|
||||
rUploadEvaluationDataD.setProvinceName(dept.getName());
|
||||
@@ -123,11 +126,10 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
//负序电流
|
||||
RUploadEvaluationDataD dto6 = channelData(rUploadEvaluationDataD,item2.getINeg(),UploadEnum.INDEX_TYPE_06.getCode(),0,item2.getVoltageType(),dto);
|
||||
result.add(dto6);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(result)){
|
||||
if (CollUtil.isNotEmpty(result)){
|
||||
this.saveOrUpdateBatchByMultiId(result,1000);
|
||||
}
|
||||
}
|
||||
@@ -141,7 +143,7 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
LambdaQueryWrapper<RDimVoltageD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RDimVoltageD::getStatisDate,time);
|
||||
List<RDimVoltageD> list = rDimVoltageDMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
map = list.stream().collect(Collectors.groupingBy(RDimVoltageD::getOrgId));
|
||||
}
|
||||
return map;
|
||||
@@ -168,30 +170,45 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
/**
|
||||
* 获取已知单位母线数量
|
||||
*/
|
||||
public List<BusBarDto> getBusBarNum(List<Monitor> list1, List<GeneratrixWire> list2, String code) {
|
||||
public List<BusBarDto> getBusBarNum(List<Monitor> list1, List<GeneratrixWire> list2, List<DeptGetBusBarDTO> dto, String code) {
|
||||
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));
|
||||
map.forEach((k,v)->{
|
||||
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> allLine = v.stream().map(Monitor::getLineId).collect(Collectors.toList());
|
||||
//在运母线集合
|
||||
List<String> online = v.stream().filter(o->Objects.equals(o.getMonitorState(),code)).map(Monitor::getLineId).collect(Collectors.toList());
|
||||
List<GeneratrixWire> list3 = list2.stream().filter(o->allLine.contains(o.getId())).collect(Collectors.toList());
|
||||
Map<String, List<GeneratrixWire>> map2 = list3.stream().collect(Collectors.groupingBy(GeneratrixWire::getScale));
|
||||
//当前单位下所有母线数量
|
||||
List<String> l1 = v.get(0).getBusBarIds();
|
||||
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)->{
|
||||
BusBarDto.VoltageChild voltageChild = new BusBarDto.VoltageChild();
|
||||
voltageChild.setVoltageLevel(k1);
|
||||
voltageChild.setMonitorBusNum(v1.size());
|
||||
List<GeneratrixWire> list4 = v1.stream().filter(o->online.contains(o.getId())).collect(Collectors.toList());
|
||||
voltageChild.setOnlineBusNum(list4.size());
|
||||
voltageChild.setMonitorRate(list4.size()*100.0/v1.size());
|
||||
voltageChild.setOnlineBusNum(v1.size());
|
||||
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());
|
||||
} else {
|
||||
voltageChild.setMonitorBusNum(0);
|
||||
voltageChild.setMonitorRate(0.0);
|
||||
}
|
||||
children.add(voltageChild);
|
||||
});
|
||||
busBarDto.setVoltageChild(children);
|
||||
result.add(busBarDto);
|
||||
}
|
||||
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@@ -214,7 +231,7 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
busBarDto.setOrgId(item.getUnitId());
|
||||
//获取当前部门下 包含母线数量的部门
|
||||
List<BusBarDto> newList = list.stream().filter(o->item.getUnitChildrenList().contains(o.getOrgId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(newList)){
|
||||
if (CollUtil.isNotEmpty(newList)){
|
||||
newList.forEach(item2->{
|
||||
child.addAll(item2.getVoltageChild());
|
||||
});
|
||||
@@ -224,9 +241,9 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
c1.setVoltageLevel(k);
|
||||
int monitorBusNum = v.stream().mapToInt(BusBarDto.VoltageChild::getMonitorBusNum).sum();
|
||||
c1.setMonitorBusNum(monitorBusNum);
|
||||
int online = v.stream().mapToInt(BusBarDto.VoltageChild::getOnlineBusNum).sum();
|
||||
int online = v.stream().mapToInt(BusBarDto.VoltageChild::getOnlineBusNum).sum()/3;
|
||||
c1.setOnlineBusNum(online);
|
||||
c1.setMonitorRate(monitorBusNum==0?0:online*100.0/monitorBusNum);
|
||||
c1.setMonitorRate(online==0?0:monitorBusNum*100.0/online);
|
||||
children.add(c1);
|
||||
});
|
||||
busBarDto.setVoltageChild(children);
|
||||
@@ -244,7 +261,7 @@ public class RUploadEvaluationDataDServiceImpl extends MppServiceImpl<RUploadEva
|
||||
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 (CollectionUtil.isNotEmpty(list)){
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
list.forEach(item->{
|
||||
if (Objects.equals(item.getVoltageLevel(),voltage)){
|
||||
dto.setMonitorBusNum(item.getMonitorBusNum());
|
||||
|
||||
Reference in New Issue
Block a user