监测点按运行状态、前置机统计数据

This commit is contained in:
xy
2024-07-26 14:18:47 +08:00
parent 500b6c66bb
commit 2caeb0c264
14 changed files with 843 additions and 24 deletions

View File

@@ -14,6 +14,6 @@ public interface LineDetailMapper extends Mapper<LineDetail> {
List<LineDetailExcelBody> selectAllExcelData();
}

View File

@@ -1,6 +1,7 @@
package com.njcn.mapper.data;
import com.njcn.pojo.commons.SimpleValue;
import com.njcn.pojo.commons.device.LineInfo;
import com.njcn.pojo.commons.runmanage.IntergralityTable;
import com.njcn.pojo.data.Integrity;
import org.apache.ibatis.annotations.Param;
@@ -27,4 +28,6 @@ public interface IntegrityMapper extends Mapper<Integrity> {
List<IntergralityTable> selectIntegrityData(@Param("list") List<Integer> tempIndexs,@Param("startTime")Date startTime,@Param("endTime") Date endTime);
List<IntergralityTable> selectGWIntegrityData(@Param("list") List<Integer> tempIndexs,@Param("startTime")Date startTime,@Param("endTime") Date endTime);
List<LineInfo> getLineInfo(@Param("list") List<Integer> tempIndexs,@Param("postType") Integer postType, @Param("powerId") Integer powerId);
}

View File

@@ -0,0 +1,141 @@
package com.njcn.pojo.commons.runmanage;
import java.io.Serializable;
import java.util.List;
/**
* @author hongawen
* @date: 2024/07/25
*/
public class IntegrityAnalysisData implements Serializable {
private String deptIndex;
private String deptName;
private List<TypeList> typeLists;
private Integer sort;
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public static class TypeList {
private String name;
List<DataList> dataLists;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<DataList> getDataLists() {
return dataLists;
}
public void setDataLists(List<DataList> dataLists) {
this.dataLists = dataLists;
}
}
public static class DataList {
//分类型名称
private String name;
//总监测点个数
private Integer allLineCount;
//投运监测点个数
private Integer runLineCount;
//检修监测点个数
private Integer checkLineCount;
//退运监测点个数
private Integer backLineCount;
public Integer getAllLineCount() {
return allLineCount;
}
public void setAllLineCount(Integer allLineCount) {
this.allLineCount = allLineCount;
}
public Integer getRunLineCount() {
return runLineCount;
}
public void setRunLineCount(Integer runLineCount) {
this.runLineCount = runLineCount;
}
public Integer getCheckLineCount() {
return checkLineCount;
}
public void setCheckLineCount(Integer checkLineCount) {
this.checkLineCount = checkLineCount;
}
public Integer getBackLineCount() {
return backLineCount;
}
public void setBackLineCount(Integer backLineCount) {
this.backLineCount = backLineCount;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public String getDeptIndex() {
return deptIndex;
}
public void setDeptIndex(String deptIndex) {
this.deptIndex = deptIndex;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public List<TypeList> getTypeLists() {
return typeLists;
}
public void setTypeLists(List<TypeList> typeLists) {
this.typeLists = typeLists;
}
@Override
public String toString() {
return "IntegrityAnalysisData{" +
"deptIndex='" + deptIndex + '\'' +
", deptName='" + deptName + '\'' +
", typeLists=" + typeLists +
'}';
}
}

View File

@@ -10,6 +10,14 @@ import java.util.List;
*/
public class IntergralityData implements Serializable {
private Integer allOnlineNum;
private Integer allOfflineNum;
private Integer countryOnlineNum;
private Integer countryOfflineNum;
//全网数据完整性数据
private List<IntergralityTable> allNets= new ArrayList<>();
@@ -32,10 +40,46 @@ public class IntergralityData implements Serializable {
this.countryNets = countryNets;
}
public Integer getAllOnlineNum() {
return allOnlineNum;
}
public void setAllOnlineNum(Integer allOnlineNum) {
this.allOnlineNum = allOnlineNum;
}
public Integer getAllOfflineNum() {
return allOfflineNum;
}
public void setAllOfflineNum(Integer allOfflineNum) {
this.allOfflineNum = allOfflineNum;
}
public Integer getCountryOnlineNum() {
return countryOnlineNum;
}
public void setCountryOnlineNum(Integer countryOnlineNum) {
this.countryOnlineNum = countryOnlineNum;
}
public Integer getCountryOfflineNum() {
return countryOfflineNum;
}
public void setCountryOfflineNum(Integer countryOfflineNum) {
this.countryOfflineNum = countryOfflineNum;
}
@Override
public String toString() {
return "IntergralityData{" +
"allNets=" + allNets +
"allOnlineNum=" + allOnlineNum +
", allOfflineNum=" + allOfflineNum +
", countryOnlineNum=" + countryOnlineNum +
", countryOfflineNum=" + countryOfflineNum +
", allNets=" + allNets +
", countryNets=" + countryNets +
'}';
}

View File

@@ -24,6 +24,9 @@ public class IntergralityTable extends OnlineRateData{
private Integer devId;
//所属前置机
private String frontDev;
public Integer getDevId() {
return devId;
}
@@ -96,6 +99,14 @@ public class IntergralityTable extends OnlineRateData{
this.lineId = lineId;
}
public String getFrontDev() {
return frontDev;
}
public void setFrontDev(String frontDev) {
this.frontDev = frontDev;
}
@Override
public String toString() {
return "IntergralityTable{" +
@@ -106,6 +117,9 @@ public class IntergralityTable extends OnlineRateData{
", devFlag='" + devFlag + '\'' +
", status='" + status + '\'' +
", updateTime='" + updateTime + '\'' +
", devType='" + devType + '\'' +
", devId=" + devId +
", frontDev='" + frontDev + '\'' +
'}';
}
}

View File

@@ -29,6 +29,7 @@ import com.njcn.pojo.commons.device.LineInfo;
import com.njcn.pojo.commons.device.SubInfo;
import com.njcn.pojo.commons.device.Tree;
import com.njcn.pojo.commons.device.ValueOfTargetanaly;
import com.njcn.pojo.commons.runmanage.IntegrityAnalysisData;
import com.njcn.pojo.commons.runmanage.IntergralityData;
import com.njcn.pojo.commons.runmanage.IntergralityTable;
import com.njcn.pojo.commons.runmanage.OnlineRateData;
@@ -82,7 +83,7 @@ public interface DeviceService {
List<OnlineRateData> getOnlineRate(Date startTime, Date endTime, String area);
//运行管理--》监测点数据完整性
IntergralityData getDataIntegralityTable(Date startTime, Date endTime, String area,Integer devflag,Integer powerId);
IntergralityData getDataIntegralityTable(Date startTime, Date endTime, String area,Integer devflag,Integer powerId,Integer runFlag);
String getDeviceOnline(Date startTime, Date endTime, Long lineIndex);
@@ -279,5 +280,5 @@ public interface DeviceService {
int updatEventPushLog(String eventDetailIndex,Integer lineId);
List<IntegrityAnalysisData> getStatisticalAnalysis(String startTime, String endTime, String area, Integer postType, Integer powerId);
}

View File

@@ -1,15 +1,18 @@
package com.njcn.serviceimpl.configuration;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.enums.TerminalLogsEnum;
import com.njcn.mapper.configuration.*;
import com.njcn.mapper.data.*;
import com.njcn.mapper.user.DeptsGdMapper;
import com.njcn.mapper.user.DeptsMapper;
import com.njcn.mapper.user.TransFormerMapper;
import com.njcn.mapper.user.UserMapper;
import com.njcn.pojo.commons.*;
import com.njcn.pojo.commons.area.*;
import com.njcn.pojo.commons.device.*;
import com.njcn.pojo.commons.runmanage.IntegrityAnalysisData;
import com.njcn.pojo.commons.runmanage.IntergralityData;
import com.njcn.pojo.commons.runmanage.IntergralityTable;
import com.njcn.pojo.commons.runmanage.OnlineRateData;
@@ -28,7 +31,6 @@ import com.njcn.utils.*;
import com.njcn.utils.redis.JedisManager;
import com.njcn.utils.redis.RedisCacheUtil;
import net.sf.json.JSONArray;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,7 +48,6 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -156,7 +157,6 @@ public class DeviceServiceImpl implements DeviceService {
@Resource
private EventPushLogsDetailMapper eventPushLogsDetailMapper;
/**
* 概览--》终端运行状态
*/
@@ -319,7 +319,7 @@ public class DeviceServiceImpl implements DeviceService {
* @param area 区域
*/
@Override
public IntergralityData getDataIntegralityTable(Date startTime, Date endTime, String area,Integer devflag,Integer powerId) {
public IntergralityData getDataIntegralityTable(Date startTime, Date endTime, String area,Integer devflag,Integer powerId,Integer runFlag) {
IntergralityData intergralityData = new IntergralityData();
List<AreaGeneralData> areaGeneralDataList = userUtil.getAreaGeneralRun(devflag,area,powerId);
@@ -328,11 +328,31 @@ public class DeviceServiceImpl implements DeviceService {
return null;
}
//全网监测点的数据完整性
intergralityData.setAllNets(getIntegralityTable(startTime, endTime, lineIndexs));
List<IntergralityTable> list1 = getIntegralityTable(startTime, endTime, lineIndexs);
if (CollUtil.isNotEmpty(list1)){
List<IntergralityTable> offline = list1.stream().filter(item->Objects.equals(Integer.parseInt(item.getStatus()),0)).collect(Collectors.toList());
List<IntergralityTable> online = list1.stream().filter(item->Objects.equals(Integer.parseInt(item.getStatus()),1)).collect(Collectors.toList());
intergralityData.setAllOfflineNum(CollUtil.isNotEmpty(offline)?offline.size():0);
intergralityData.setAllOnlineNum(CollUtil.isNotEmpty(online)?online.size():0);
if (!Objects.isNull(runFlag)){
list1 = Objects.equals(runFlag,0) ? offline : online;
}
}
intergralityData.setAllNets(list1);
//国网监测点
List<Integer> countryLineIndexs = getGwLine(lineIndexs);
if (!CollectionUtils.isEmpty(countryLineIndexs)) {
intergralityData.setCountryNets(getGWIntegralityTable(startTime, endTime, countryLineIndexs));
List<IntergralityTable> list2 = getGWIntegralityTable(startTime, endTime, countryLineIndexs);
if (CollUtil.isNotEmpty(list2)){
List<IntergralityTable> offline = list2.stream().filter(item->Objects.equals(Integer.parseInt(item.getStatus()),0)).collect(Collectors.toList());
List<IntergralityTable> online = list2.stream().filter(item->Objects.equals(Integer.parseInt(item.getStatus()),1)).collect(Collectors.toList());
intergralityData.setCountryOfflineNum(CollUtil.isNotEmpty(offline)?offline.size():0);
intergralityData.setCountryOnlineNum(CollUtil.isNotEmpty(online)?online.size():0);
if (!Objects.isNull(runFlag)){
list2 = Objects.equals(runFlag,0) ? offline : online;
}
}
intergralityData.setCountryNets(list2);
}
return intergralityData;
}
@@ -7035,6 +7055,96 @@ public class DeviceServiceImpl implements DeviceService {
return eventPushLogsDetailMapper.updatEventPushLog(eventDetailIndex, lineId, new Date());
}
@Override
public List<IntegrityAnalysisData> getStatisticalAnalysis(String startTime, String endTime, String area, Integer postType, Integer powerId) {
List<IntegrityAnalysisData> list = new ArrayList<>();
List<LineInfo> allArea = new ArrayList<>();
List<AreaGeneralData> ag = userUtil.getAreaDataByInfo(area);
for (AreaGeneralData item : ag) {
IntegrityAnalysisData data = new IntegrityAnalysisData();
data.setDeptName(item.getName());
data.setDeptIndex(item.getDeptIndex());
data.setSort(1);
if (CollUtil.isNotEmpty(item.getLineIndexs())) {
List<LineInfo> lineInfos = integrityMapper.getLineInfo(item.getLineIndexs(),postType,powerId);
allArea.addAll(lineInfos);
List<IntegrityAnalysisData.TypeList> typeList = new ArrayList<>();
IntegrityAnalysisData.TypeList type = new IntegrityAnalysisData.TypeList();
type.setName("所属前置机");
type.setDataLists(getFrontList(lineInfos));
IntegrityAnalysisData.TypeList type2 = new IntegrityAnalysisData.TypeList();
type2.setName("监测点状态");
type2.setDataLists(getLineStatusList(lineInfos));
typeList.add(type);
typeList.add(type2);
data.setTypeLists(typeList);
}
list.add(data);
}
//新增冀北省
Depts depts = userUtil.getDeptsByIndex(area);
if (Objects.equals(depts.getParentNodeId(),"10001")) {
IntegrityAnalysisData data = new IntegrityAnalysisData();
data.setDeptName("冀北省");
data.setDeptIndex(area);
List<IntegrityAnalysisData.TypeList> typeList = new ArrayList<>();
IntegrityAnalysisData.TypeList type = new IntegrityAnalysisData.TypeList();
type.setName("所属前置机");
type.setDataLists(getFrontList(allArea));
IntegrityAnalysisData.TypeList type2 = new IntegrityAnalysisData.TypeList();
type2.setName("监测点状态");
type2.setDataLists(getLineStatusList(allArea));
typeList.add(type);
typeList.add(type2);
data.setTypeLists(typeList);
data.setSort(0);
list.add(data);
}
return list.stream().sorted(Comparator.comparing(IntegrityAnalysisData::getSort)).collect(Collectors.toList());
}
public List<IntegrityAnalysisData.DataList> getFrontList(List<LineInfo> lineInfos) {
List<IntegrityAnalysisData.DataList> result = new ArrayList<>();
Map<String,List<LineInfo>> frontMap = lineInfos.stream().collect(Collectors.groupingBy(LineInfo::getDevName));
if (CollectionUtils.isEmpty(frontMap)) {
IntegrityAnalysisData.DataList dataList = new IntegrityAnalysisData.DataList();
dataList.setName("/");
dataList.setAllLineCount(0);
dataList.setRunLineCount(0);
dataList.setCheckLineCount(0);
dataList.setBackLineCount(0);
result.add(dataList);
} else {
frontMap.forEach((k,v)->{
IntegrityAnalysisData.DataList dataList = new IntegrityAnalysisData.DataList();
dataList.setName(k);
Map<Long,List<LineInfo>> statusMap = v.stream().collect(Collectors.groupingBy(LineInfo::getStatus));
dataList.setAllLineCount(v.size());
dataList.setRunLineCount(CollUtil.isNotEmpty(statusMap.get(0L))?statusMap.get(0L).size():0);
dataList.setCheckLineCount(CollUtil.isNotEmpty(statusMap.get(1L))?statusMap.get(1L).size():0);
dataList.setBackLineCount(CollUtil.isNotEmpty(statusMap.get(2L))?statusMap.get(2L).size():0);
result.add(dataList);
});
}
return result;
}
public List<IntegrityAnalysisData.DataList> getLineStatusList(List<LineInfo> lineInfos) {
List<IntegrityAnalysisData.DataList> result = new ArrayList<>();
Map<Long,List<LineInfo>> statusMap = lineInfos.stream().collect(Collectors.groupingBy(LineInfo::getStatus));
IntegrityAnalysisData.DataList dataList = new IntegrityAnalysisData.DataList();
dataList.setName("/");
dataList.setAllLineCount(lineInfos.size());
dataList.setRunLineCount(CollUtil.isNotEmpty(statusMap.get(0L))?statusMap.get(0L).size():0);
dataList.setCheckLineCount(CollUtil.isNotEmpty(statusMap.get(1L))?statusMap.get(1L).size():0);
dataList.setBackLineCount(CollUtil.isNotEmpty(statusMap.get(2L))?statusMap.get(2L).size():0);
result.add(dataList);
return result;
}
/**
* 根据电压等级返回基准容量
*