|
|
|
@@ -2,17 +2,31 @@ package com.njcn.device.pms.service.ledgerManger.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|
|
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|
|
|
|
|
|
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
|
|
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
|
|
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
|
|
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
|
|
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
|
|
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
|
|
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
|
|
|
import com.njcn.device.pms.mapper.majornetwork.PmsRunStatisticMapper;
|
|
|
|
import com.njcn.device.pms.mapper.majornetwork.*;
|
|
|
|
import com.njcn.device.pms.pojo.po.Monitor;
|
|
|
|
import com.njcn.device.pms.pojo.po.*;
|
|
|
|
import com.njcn.device.pms.pojo.po.PmsRunStatistic;
|
|
|
|
|
|
|
|
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
|
|
|
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
|
|
|
import com.njcn.device.pms.service.ledgerManger.IPmsRunStatisticService;
|
|
|
|
import com.njcn.device.pms.service.ledgerManger.IPmsRunStatisticService;
|
|
|
|
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
|
|
|
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
|
|
|
|
|
|
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
|
|
|
|
|
|
|
import com.njcn.system.api.DicDataFeignClient;
|
|
|
|
|
|
|
|
import com.njcn.system.api.DictTreeFeignClient;
|
|
|
|
|
|
|
|
import com.njcn.system.enums.DicDataEnum;
|
|
|
|
|
|
|
|
import com.njcn.system.enums.DicDataTypeEnum;
|
|
|
|
|
|
|
|
import com.njcn.system.enums.DicTreeEnum;
|
|
|
|
|
|
|
|
import com.njcn.system.pojo.po.Dic;
|
|
|
|
|
|
|
|
import com.njcn.system.pojo.po.DictData;
|
|
|
|
|
|
|
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
|
|
|
|
|
|
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
|
|
|
import com.njcn.user.api.DeptFeignClient;
|
|
|
|
import com.njcn.user.api.DeptFeignClient;
|
|
|
|
import com.njcn.user.pojo.po.Dept;
|
|
|
|
import com.njcn.user.pojo.po.Dept;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@@ -22,6 +36,7 @@ import java.time.LocalDate;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <p>
|
|
|
|
* <p>
|
|
|
|
@@ -39,24 +54,130 @@ public class PmsRunStatisticServiceImpl extends MppServiceImpl<PmsRunStatisticMa
|
|
|
|
|
|
|
|
|
|
|
|
private final DeptFeignClient deptFeignClient;
|
|
|
|
private final DeptFeignClient deptFeignClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final PmsMidLedgerMapper pmsMidLedgerMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DicDataFeignClient dicDataFeignClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final MonitorMapper monitorMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DictTreeFeignClient dictTreeFeignClient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final StatationStatMapper statationStatMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void statisticLedgerRunDay(String date) {
|
|
|
|
public void statisticLedgerRunDay(String date) {
|
|
|
|
Dept dept = deptFeignClient.getRootDept().getData();
|
|
|
|
Dept dept = deptFeignClient.getRootDept().getData();
|
|
|
|
|
|
|
|
LocalDate localDate = LocalDate.parse(date);
|
|
|
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
|
|
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
|
|
|
deptGetLineParam.setDeptId(dept.getId());
|
|
|
|
deptGetLineParam.setDeptId(dept.getId());
|
|
|
|
deptGetLineParam.setIsUpToGrid(1);
|
|
|
|
deptGetLineParam.setIsUpToGrid(1);
|
|
|
|
|
|
|
|
|
|
|
|
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOList = commTerminalService.deptGetLine(deptGetLineParam);
|
|
|
|
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOList = commTerminalService.deptGetLine(deptGetLineParam);
|
|
|
|
List<PmsRunStatistic> poList = new ArrayList<>();
|
|
|
|
List<PmsRunStatistic> poList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取在运母线,在运电站数量
|
|
|
|
|
|
|
|
List<PmsMidLedger> midLedgerStationList = this.getBusBarAndStationInfo(0);
|
|
|
|
|
|
|
|
List<PmsMidLedger> midLedgerBusBarList = this.getBusBarAndStationInfo(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取在运,符合上送国网的测点,用于过滤监测母线,监测电站
|
|
|
|
|
|
|
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.RUN.getCode(),DicDataTypeEnum.LINE_STATE.getCode()).getData();
|
|
|
|
|
|
|
|
List<Monitor> monitorList = monitorMapper.selectList(new LambdaQueryWrapper<Monitor>().eq(Monitor::getMonitorState,dictData.getId()).eq(Monitor::getIsUpToGrid,DataStateEnum.ENABLE.getCode()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().isNotNull(StatationStat::getMidStationId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//数据完整性
|
|
|
|
|
|
|
|
List<String> rStatIntegrityIds = rStatIntegrityDMapper.selectList(new LambdaQueryWrapper<RStatIntegrityD>().eq(RStatIntegrityD::getTimeId,localDate).gt(RStatIntegrityD::getRealTime,0)).stream().map(RStatIntegrityD::getLineIndex).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//对象类型
|
|
|
|
|
|
|
|
List<SysDicTreePO> sysdictreepo = dictTreeFeignClient.queryAll().getData();
|
|
|
|
|
|
|
|
List<String> windfarm_user = Stream.of(DicDataEnum.WINDPOWER_STATION.getCode()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> photovoltaicsit_eusers = Stream.of(DicDataEnum.PHOTOVOLTAIC_POWER_STATION.getCode()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> tractionstation = Stream.of(DicDataEnum.ELECTRIFIED_RAILWAY.getCode()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DictTreeVO dictTreeVO = dictTreeFeignClient.queryByCode(DicTreeEnum.Imp_Users.getCode()).getData();
|
|
|
|
|
|
|
|
List<DictTreeVO> dictTreeVOList = dictTreeFeignClient.query(dictTreeVO.getId()).getData();
|
|
|
|
|
|
|
|
List<String> importUser = dictTreeVOList.stream().map(DictTreeVO::getCode).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
importUser.add(dictTreeVO.getCode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> windfarm_user_dict = sysdictreepo.stream().filter(temp -> windfarm_user.contains(temp.getCode())).map(SysDicTreePO::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> photovoltaicsit_eusers_dict = sysdictreepo.stream().filter(temp -> photovoltaicsit_eusers.contains(temp.getCode())).map(SysDicTreePO::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> tractionstation_dict = sysdictreepo.stream().filter(temp -> tractionstation.contains(temp.getCode())).map(SysDicTreePO::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> import_dict = sysdictreepo.stream().filter(temp -> importUser.contains(temp.getCode())).map(SysDicTreePO::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> un_other_interferencesource_users_dict = new ArrayList<>();
|
|
|
|
|
|
|
|
un_other_interferencesource_users_dict.addAll(photovoltaicsit_eusers_dict);
|
|
|
|
|
|
|
|
un_other_interferencesource_users_dict.addAll(tractionstation_dict);
|
|
|
|
|
|
|
|
un_other_interferencesource_users_dict.addAll(windfarm_user_dict);
|
|
|
|
|
|
|
|
un_other_interferencesource_users_dict.addAll(import_dict);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//遍历每个部门
|
|
|
|
for(DeptGetChildrenMoreDTO dto : deptGetChildrenMoreDTOList){
|
|
|
|
for(DeptGetChildrenMoreDTO dto : deptGetChildrenMoreDTOList){
|
|
|
|
|
|
|
|
List<String> childrenDept = dto.getUnitChildrenList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> temPointIds = dto.getLineBaseList().stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> onlinePointIds = temPointIds.stream().filter(rStatIntegrityIds::contains).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
PmsRunStatistic pmsRunStatistic = new PmsRunStatistic();
|
|
|
|
PmsRunStatistic pmsRunStatistic = new PmsRunStatistic();
|
|
|
|
pmsRunStatistic.setStatisticDate(LocalDate.parse(date));
|
|
|
|
pmsRunStatistic.setStatisticDate(localDate);
|
|
|
|
pmsRunStatistic.setDeptId(dto.getUnitId());
|
|
|
|
pmsRunStatistic.setDeptId(dto.getUnitId());
|
|
|
|
pmsRunStatistic.setRunMonitorIds(dto.getLineBaseList().stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.joining(StrUtil.COMMA)));
|
|
|
|
pmsRunStatistic.setRunMonitorIds(String.join(StrUtil.COMMA, temPointIds));
|
|
|
|
|
|
|
|
pmsRunStatistic.setOnlineMonitorIds(String.join(StrUtil.COMMA, onlinePointIds));
|
|
|
|
|
|
|
|
|
|
|
|
pmsRunStatistic.setRunDevIds(dto.getLineBaseList().stream().map(LineDevGetDTO::getDevId).distinct().collect(Collectors.joining(StrUtil.COMMA)));
|
|
|
|
pmsRunStatistic.setRunDevIds(dto.getLineBaseList().stream().map(LineDevGetDTO::getDevId).distinct().collect(Collectors.joining(StrUtil.COMMA)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long stationCount = midLedgerStationList.stream().filter(it->childrenDept.contains(it.getSectionId())).map(PmsMidLedger::getId).distinct().count();
|
|
|
|
|
|
|
|
pmsRunStatistic.setRunStationNum((int) stationCount);
|
|
|
|
|
|
|
|
long busBarCount = midLedgerBusBarList.stream().filter(it->childrenDept.contains(it.getSectionId())).map(PmsMidLedger::getId).distinct().count();
|
|
|
|
|
|
|
|
pmsRunStatistic.setRunBusNum((int) busBarCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> runBusIds = monitorList.stream().filter(it->childrenDept.contains(it.getOrgId())).map(Monitor::getLineId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
pmsRunStatistic.setOnlineBusIds(String.join(StrUtil.COMMA, runBusIds));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> runStationIds = statationStatList.stream().filter(it->childrenDept.contains(it.getOrgId())).map(StatationStat::getPowerId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
pmsRunStatistic.setOnlineStationIds(String.join(StrUtil.COMMA, runStationIds));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//典型统计
|
|
|
|
|
|
|
|
List<String> windPointIds = dto.getLineBaseList().stream().filter(it->windfarm_user_dict.contains(it.getObjType())).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> sunPointIds = dto.getLineBaseList().stream().filter(it->photovoltaicsit_eusers_dict.contains(it.getObjType())).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> tractionPointIds = dto.getLineBaseList().stream().filter(it->tractionstation_dict.contains(it.getObjType())).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> otherPointIds = dto.getLineBaseList().stream().filter(it->!un_other_interferencesource_users_dict.contains(it.getObjType())).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
pmsRunStatistic.setTypicalWindIds(String.join(StrUtil.COMMA, windPointIds));
|
|
|
|
|
|
|
|
pmsRunStatistic.setTypicalSunIds(String.join(StrUtil.COMMA, sunPointIds));
|
|
|
|
|
|
|
|
pmsRunStatistic.setTypicalTractionIds(String.join(StrUtil.COMMA, tractionPointIds));
|
|
|
|
|
|
|
|
pmsRunStatistic.setTypicalOtherIds(String.join(StrUtil.COMMA, otherPointIds));
|
|
|
|
poList.add(pmsRunStatistic);
|
|
|
|
poList.add(pmsRunStatistic);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.saveBatch(poList);
|
|
|
|
this.saveBatch(poList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void statisticLedgerRunMonth(String date) {
|
|
|
|
|
|
|
|
DateTime begin = DateUtil.beginOfMonth(DateUtil.parse(date));
|
|
|
|
|
|
|
|
DateTime end = DateUtil.endOfMonth(DateUtil.parse(date));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void statisticLedgerRunYear(String date) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取中台母线电站信息
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public List<PmsMidLedger> getBusBarAndStationInfo(Integer type) {
|
|
|
|
|
|
|
|
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
lambdaQueryWrapper.eq(PmsMidLedger::getLevel,type)
|
|
|
|
|
|
|
|
.eq(PmsMidLedger::getState, DataStateEnum.ENABLE.getCode());
|
|
|
|
|
|
|
|
return pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|