Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
770fb09223 | ||
|
|
eb334cc7c7 | ||
|
|
404d11526a | ||
| 7bac805988 | |||
|
|
e4e04fc5db | ||
| f588a0ffc8 | |||
| f8ffe767dc | |||
|
|
68cbad2fdb | ||
|
|
9b9d75e463 | ||
|
|
62c3c09a6b | ||
|
|
b523a24e5b | ||
|
|
075dfc19d6 | ||
|
|
279c5c7642 | ||
|
|
ff1351b107 | ||
|
|
2dd67f9e3a | ||
|
|
b0ef851479 | ||
|
|
be899a262b | ||
| 4339a37268 | |||
|
|
9659aa257a | ||
| 9d32ca05df | |||
|
|
d48cf09119 | ||
|
|
c38b07ec07 | ||
|
|
87f05c6278 | ||
| e9ac024f73 | |||
| b7e3bb9796 | |||
| 4bebf28b76 | |||
|
|
20ec9bc0b4 | ||
| 5e93eb3691 | |||
| b63fab9085 | |||
|
|
aba66aaf4a | ||
|
|
1c7c514691 | ||
| 04fe9bdbbd | |||
|
|
b41347c596 | ||
|
|
4f75deac43 | ||
| 2c68646fc9 | |||
| 02599eeb81 | |||
| 0cec471ce2 |
6
pom.xml
6
pom.xml
@@ -41,9 +41,9 @@
|
||||
<properties>
|
||||
<!--中间件目标地址-->
|
||||
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
||||
<middle.server.url>192.168.1.22</middle.server.url>
|
||||
<middle.server.url>192.168.1.103</middle.server.url>
|
||||
<!--微服务模块发布地址-->
|
||||
<service.server.url>192.168.1.127</service.server.url>
|
||||
<service.server.url>127.0.0.1</service.server.url>
|
||||
<!--docker仓库地址-->
|
||||
<docker.server.url>192.168.1.22</docker.server.url>
|
||||
<!--nacos的ip:port-->
|
||||
@@ -55,7 +55,7 @@
|
||||
<!--服务器发布内容为空-->
|
||||
<!-- <nacos.namespace></nacos.namespace>-->
|
||||
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
|
||||
<nacos.namespace>78588706-e06f-4580-b612-b26d72493fcb</nacos.namespace>
|
||||
<nacos.namespace>6fd2d036-f390-46ee-9c9d-d5a5c00e3314</nacos.namespace>
|
||||
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
|
||||
<!-- sentinel:port-->
|
||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||
|
||||
@@ -67,7 +67,9 @@ public interface QvvrCauseDLL extends Library {
|
||||
|
||||
// 创建临时文件
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||
File tempLibFile = new File(tempDir, libFileName);
|
||||
|
||||
//File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||
|
||||
// 提取库文件到临时目录
|
||||
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.njcn.advance.event.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.advance.event.cause.core.VoltageSagAnalyzer;
|
||||
import com.njcn.advance.event.cause.jna.QvvrCauseDLL;
|
||||
import com.njcn.advance.event.cause.model.AnalysisResult;
|
||||
import com.njcn.advance.event.cause.model.DataFeature;
|
||||
import com.njcn.advance.event.cause.model.QvvrDataStruct;
|
||||
import com.njcn.advance.event.type.jna.*;
|
||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||
import com.njcn.advance.event.service.IEventAdvanceService;
|
||||
import com.njcn.advance.event.type.jna.QvvrDLL;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
@@ -89,8 +86,55 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
}
|
||||
}
|
||||
List<List<Float>> listWaveData = waveDataDTO.getListWaveData();
|
||||
// 暂降类型
|
||||
// 创建数据结构
|
||||
QvvrDLL.QvvrDataStruct typeDataStruct = new QvvrDLL.QvvrDataStruct();
|
||||
System.out.println("初始化qvvrdll成功-----------");
|
||||
typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||
System.out.println("采样率-----------" + typeDataStruct.smp_rate);
|
||||
typeDataStruct.smp_len = listWaveData.size();
|
||||
System.out.println("波形长度-----------" + listWaveData.size());
|
||||
|
||||
// 获取ABC三相的瞬时数据
|
||||
for (int i = 0; i < listWaveData.size(); i++) {
|
||||
typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
|
||||
typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
|
||||
typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
|
||||
}
|
||||
|
||||
|
||||
// 执行算法分析 - 直接调用C DLL
|
||||
try {
|
||||
QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
||||
System.out.println("调用qvvrdll成功-----------");
|
||||
|
||||
if (typeDataStruct.evt_num > 0) {
|
||||
// 全局比较找出最小三相电压特征值
|
||||
float globalMinVoltage = Float.MAX_VALUE;
|
||||
int globalFaultType = 10;
|
||||
for (int i = 0; i < typeDataStruct.evt_num; i++) {
|
||||
QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
|
||||
for (int j = 0; j < evt.u_min_num; j++) {
|
||||
float u3min = evt.u3_min[j];
|
||||
if (u3min < globalMinVoltage) {
|
||||
globalMinVoltage = u3min;
|
||||
globalFaultType = evt.qvvr_cata_type[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
eventAnalysis.setType(globalFaultType);
|
||||
} else {
|
||||
eventAnalysis.setType(DataFeature.TYPE10);
|
||||
}
|
||||
System.out.println("结束qvvrdll方法调用-----------");
|
||||
} catch (Exception e) {
|
||||
eventAnalysis.setType(DataFeature.TYPE10);
|
||||
eventAnalysis.setTypeFlag(0);
|
||||
}
|
||||
|
||||
|
||||
// 暂降原因JNA的方式
|
||||
com.njcn.advance.event.cause.jna.QvvrCauseDLL.QvvrDataStruct causeDataStruct = new com.njcn.advance.event.cause.jna.QvvrCauseDLL.QvvrDataStruct();
|
||||
QvvrCauseDLL.QvvrDataStruct causeDataStruct = new QvvrCauseDLL.QvvrDataStruct();
|
||||
causeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||
causeDataStruct.smp_len = listWaveData.size();
|
||||
// 获取ABC三相的瞬时数据
|
||||
@@ -112,45 +156,6 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
}
|
||||
System.out.println("暂降原因分析完毕===============");
|
||||
System.out.println("cause:" + eventAnalysis);
|
||||
|
||||
// 暂降类型
|
||||
// 创建数据结构
|
||||
// com.njcn.advance.event.type.jna.QvvrDLL.QvvrDataStruct typeDataStruct = new com.njcn.advance.event.type.jna.QvvrDLL.QvvrDataStruct();
|
||||
// typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||
// typeDataStruct.smp_len = listWaveData.size();
|
||||
// // 获取ABC三相的瞬时数据
|
||||
// for (int i = 0; i < listWaveData.size(); i++) {
|
||||
// typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
|
||||
// typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
|
||||
// typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
|
||||
// }
|
||||
// // 执行算法分析 - 直接调用C DLL
|
||||
// try {
|
||||
// QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
||||
// if (typeDataStruct.evt_num > 0) {
|
||||
// // 全局比较找出最小三相电压特征值
|
||||
// float globalMinVoltage = Float.MAX_VALUE;
|
||||
// int globalFaultType = 10;
|
||||
// for (int i = 0; i < typeDataStruct.evt_num; i++) {
|
||||
// QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
|
||||
// for (int j = 0; j < evt.u_min_num; j++) {
|
||||
// float u3min = evt.u3_min[j];
|
||||
// if (u3min < globalMinVoltage) {
|
||||
// globalMinVoltage = u3min;
|
||||
// globalFaultType = evt.qvvr_cata_type[j];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// eventAnalysis.setType(globalFaultType);
|
||||
// } else {
|
||||
// eventAnalysis.setType(DataFeature.TYPE10);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// eventAnalysis.setType(DataFeature.TYPE10);
|
||||
// eventAnalysis.setTypeFlag(0);
|
||||
// }
|
||||
return eventAnalysis;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,9 @@ public interface QvvrDLL extends Library {
|
||||
|
||||
// 创建临时文件
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||
File tempLibFile = new File(tempDir, libFileName);
|
||||
|
||||
// File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||
|
||||
// 提取库文件到临时目录
|
||||
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
||||
@@ -95,6 +97,8 @@ public interface QvvrDLL extends Library {
|
||||
*/
|
||||
void qvvr_fun(QvvrDataStruct data);
|
||||
|
||||
void ping();
|
||||
|
||||
/**
|
||||
* 对应C语言的qvvr_data_struct结构体
|
||||
*/
|
||||
|
||||
@@ -854,6 +854,21 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
/*************************************************************************************
|
||||
* 获取变压器信息并生成矩阵
|
||||
*************************************************************************************/
|
||||
public Map<String, Map<String, Integer>> getNodeBefore(){
|
||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||
|
||||
HandleEvent handleEvent = new HandleEvent();
|
||||
List<EntityLogic> list = relevantLogMapper.getLogic();
|
||||
Map<String, Map<String, Integer>> setNodeSort = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Map<String, List<String>> map = getLogicInfo(list);
|
||||
setNodeSort = nodeSort(map);
|
||||
}
|
||||
|
||||
return setNodeSort;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, EntityMtrans> getNodeInfo( ) {
|
||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -57,6 +57,11 @@
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!--vastbase驱动用postgresql-->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<!--达梦驱动-->
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
|
||||
@@ -47,6 +47,36 @@ public interface BusinessTopic {
|
||||
*/
|
||||
String DEVICE_RUN_FLAG_TOPIC = "Device_Run_Flag_Topic";
|
||||
|
||||
/**
|
||||
* 云前置日志主题
|
||||
*/
|
||||
String LOG_TOPIC = "log_Topic";
|
||||
|
||||
/**
|
||||
* 台账更新下发
|
||||
*/
|
||||
String CONTROL_TOPIC = "control_Topic";
|
||||
|
||||
/**
|
||||
* 台账更新前置端响应
|
||||
*/
|
||||
String REPLY_TOPIC = "Reply_Topic";
|
||||
|
||||
/**
|
||||
* 前置进程控制
|
||||
*/
|
||||
String PROCESS_TOPIC = "process_Topic";
|
||||
|
||||
/**
|
||||
* 补召下发命令
|
||||
*/
|
||||
String ASK_RECALL_TOPIC = "ask_recall_Topic";
|
||||
|
||||
/**
|
||||
* 补召应答命令
|
||||
*/
|
||||
String REPLY_RECALL_TOPIC = "reply_recall_Topic";
|
||||
|
||||
/********************************数据中心*********************************/
|
||||
|
||||
String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic";
|
||||
|
||||
@@ -28,14 +28,14 @@ public class AppFileMessage extends BaseMessage {
|
||||
|
||||
private Integer code;
|
||||
|
||||
private AppFileMessage.Msg msg;
|
||||
private Msg msg;
|
||||
|
||||
@Data
|
||||
public static class Msg{
|
||||
|
||||
private String type;
|
||||
|
||||
private AppFileMessage.FileInfo fileInfo;
|
||||
private FileInfo fileInfo;
|
||||
|
||||
private String data;
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class BZEventMessage extends BaseMessage {
|
||||
|
||||
//补召事件
|
||||
@Data
|
||||
public static class Event{
|
||||
|
||||
@ApiModelProperty("请求的guid")
|
||||
private String guid;
|
||||
|
||||
@ApiModelProperty("终端id")
|
||||
private String terminalId;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private List<String> monitorIdList;
|
||||
|
||||
@ApiModelProperty("数据类型 0 稳态 1 暂态事件 2 暂态波形")
|
||||
private Integer dataType;
|
||||
|
||||
@ApiModelProperty("时间范围")
|
||||
private List<String> timeInterval;
|
||||
|
||||
}
|
||||
|
||||
//补召波形
|
||||
@Data
|
||||
public static class File{
|
||||
|
||||
@ApiModelProperty("请求的guid")
|
||||
private String guid;
|
||||
|
||||
@ApiModelProperty("终端id")
|
||||
private String terminalId;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String monitorId;
|
||||
|
||||
@ApiModelProperty("数据类型 0 稳态 1 暂态事件 2 暂态波形")
|
||||
private Integer dataType;
|
||||
|
||||
@ApiModelProperty("缺失波形时标集合")
|
||||
private List<String> timeList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2025/9/29 15:06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BzMessage extends BaseMessage {
|
||||
|
||||
@ApiModelProperty("唯一标识")
|
||||
private String guid;
|
||||
|
||||
@ApiModelProperty("补召类型")
|
||||
private String dataType;
|
||||
|
||||
@ApiModelProperty("响应码")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty("结果")
|
||||
private String result;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String terminalId;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String monitorId;
|
||||
|
||||
@ApiModelProperty("补召起始时间")
|
||||
private String recallStartDate;
|
||||
|
||||
@ApiModelProperty("补召结束时间")
|
||||
private String recallEndDate;
|
||||
|
||||
@ApiModelProperty("前置服务器id")
|
||||
private String nodeId;
|
||||
|
||||
@ApiModelProperty("前置进程")
|
||||
private String processNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 类的介绍:日志信息
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2025/9/18 15:06
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CldControlMessage {
|
||||
|
||||
@ApiModelProperty("请求的guid")
|
||||
private String guid;
|
||||
|
||||
@ApiModelProperty("功能代号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("前置服务器id")
|
||||
private String nodeId;
|
||||
|
||||
@ApiModelProperty("指定处理的进程号")
|
||||
private Integer processNo;
|
||||
|
||||
@ApiModelProperty("delete用于杀死进程")
|
||||
private String fun;
|
||||
|
||||
@ApiModelProperty("进程数")
|
||||
private Integer processNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 类的介绍:日志信息
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2025/9/18 15:06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CldLogMessage extends BaseMessage {
|
||||
|
||||
@ApiModelProperty("前置id")
|
||||
private String nodeId;
|
||||
|
||||
@ApiModelProperty("进程id")
|
||||
private String processNo;
|
||||
|
||||
@ApiModelProperty("监测点id、装置id")
|
||||
private String businessId;
|
||||
|
||||
@ApiModelProperty("级别(process进程、terminal装置、measurepoint监测点)")
|
||||
private String level;
|
||||
|
||||
@ApiModelProperty("日志等级")
|
||||
private String grade;
|
||||
|
||||
@ApiModelProperty("告警码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("告警时间")
|
||||
private String time;
|
||||
|
||||
@ApiModelProperty("日志信息")
|
||||
private String log;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* cld设备更新台账实体
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class CldUpdateLedgerMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("消息唯一标识")
|
||||
private String guid;
|
||||
|
||||
@ApiModelProperty("add_terminal/delete_terminal/ledger_modify")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty("进程号")
|
||||
private Integer processNo;
|
||||
|
||||
@ApiModelProperty("数据")
|
||||
private List<CldDeviceDto> data;
|
||||
|
||||
@Data
|
||||
public static class CldDeviceDto implements Serializable {
|
||||
|
||||
@ApiModelProperty("最大进程数")
|
||||
private Integer maxProcessNum;
|
||||
|
||||
@ApiModelProperty("进程号")
|
||||
private Integer node;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("设备MAC")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("设备型号")
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty("设备名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("监测点信息集合")
|
||||
private List<CldMonitorDto> monitorData;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class CldMonitorDto implements Serializable {
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("监测点线路号")
|
||||
private String lineNo;
|
||||
|
||||
@ApiModelProperty("电压等级")
|
||||
private String voltageLevel;
|
||||
|
||||
@ApiModelProperty("status")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("接线方式")
|
||||
private String ptType;
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("pt一次变比")
|
||||
private Double pt1;
|
||||
|
||||
@ApiModelProperty("pt二次变比")
|
||||
private Double pt2;
|
||||
|
||||
@ApiModelProperty("ct一次变比")
|
||||
private Double ct1;
|
||||
|
||||
@ApiModelProperty("ct二次变比")
|
||||
private Double ct2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
@@ -39,4 +35,7 @@ public class RealDataMessage {
|
||||
@ApiModelProperty("限制")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty("idx")
|
||||
private Integer idx;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.mq.message;
|
||||
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2025/9/29 15:06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UpdateLedgerMessage extends BaseMessage {
|
||||
|
||||
@ApiModelProperty("唯一标识")
|
||||
private String guid;
|
||||
|
||||
@ApiModelProperty("数据")
|
||||
private List<HandleData> data;
|
||||
|
||||
@Data
|
||||
public static class HandleData implements Serializable {
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("响应码")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty("结果描述")
|
||||
private String result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
import com.njcn.mq.constant.BusinessTopic;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类的介绍:补召事件
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
*/
|
||||
@Component
|
||||
public class BZEventMessageTemplate extends RocketMQEnhanceTemplate {
|
||||
|
||||
public BZEventMessageTemplate(RocketMQTemplate template) {
|
||||
super(template);
|
||||
}
|
||||
|
||||
public SendResult sendMember(Object message, String tag) {
|
||||
BaseMessage baseMessage = new BaseMessage();
|
||||
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||
baseMessage.setMessageBody(new Gson().toJson(message));
|
||||
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
import com.njcn.mq.constant.BusinessTopic;
|
||||
import com.njcn.mq.message.CldControlMessage;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类的介绍:实时数据模板
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/8/11 15:28
|
||||
*/
|
||||
@Component
|
||||
public class CldControlMessageTemplate extends RocketMQEnhanceTemplate {
|
||||
|
||||
public CldControlMessageTemplate(RocketMQTemplate template) {
|
||||
super(template);
|
||||
}
|
||||
|
||||
public SendResult sendMember(CldControlMessage message, String tag) {
|
||||
BaseMessage baseMessage = new BaseMessage();
|
||||
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||
baseMessage.setMessageBody(new Gson().toJson(message));
|
||||
return send(BusinessTopic.PROCESS_TOPIC,tag,baseMessage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.mq.template;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||
import com.njcn.mq.constant.BusinessResource;
|
||||
import com.njcn.mq.constant.BusinessTopic;
|
||||
import com.njcn.mq.message.CldUpdateLedgerMessage;
|
||||
import org.apache.rocketmq.client.producer.SendResult;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类的介绍:实时数据模板
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/8/11 15:28
|
||||
*/
|
||||
@Component
|
||||
public class CldUpdateLedgerMessageTemplate extends RocketMQEnhanceTemplate {
|
||||
|
||||
public CldUpdateLedgerMessageTemplate(RocketMQTemplate template) {
|
||||
super(template);
|
||||
}
|
||||
|
||||
public SendResult sendMember(CldUpdateLedgerMessage cldUpdateLedgerMessage, String tag) {
|
||||
BaseMessage baseMessage = new BaseMessage();
|
||||
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||
baseMessage.setMessageBody(new Gson().toJson(cldUpdateLedgerMessage));
|
||||
return send(BusinessTopic.CONTROL_TOPIC,tag,baseMessage);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.oss.utils;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.huawei.obs.util.OBSUtil;
|
||||
@@ -88,16 +89,23 @@ public class FileStorageUtil {
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
// 确保目录存在
|
||||
Path uploadPath = Paths.get(generalInfo.getLocalStorePath());
|
||||
// 构建完整目录:基准目录 + dir子目录
|
||||
Path basePath = Paths.get(generalInfo.getLocalStorePath());
|
||||
Path uploadPath = basePath.resolve(dir); // 将dir作为子目录添加
|
||||
|
||||
// 确保完整目录存在(包括dir子目录)
|
||||
if (!Files.exists(uploadPath)) {
|
||||
Files.createDirectories(uploadPath);
|
||||
}
|
||||
|
||||
// 生成本地文件名(可以添加时间戳或UUID防止重名)
|
||||
// 生成本地文件名(处理扩展名,防止异常)
|
||||
String originalFilename = multipartFile.getOriginalFilename();
|
||||
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||
String newFilename = UUID.randomUUID().toString() + fileExtension;
|
||||
String fileExtension = "";
|
||||
int extIndex = originalFilename.lastIndexOf(".");
|
||||
if (extIndex > 0 && extIndex < originalFilename.length() - 1) {
|
||||
fileExtension = originalFilename.substring(extIndex);
|
||||
}
|
||||
String newFilename = IdUtil.simpleUUID().toUpperCase() + fileExtension;
|
||||
|
||||
// 构建完整路径
|
||||
Path filePathPath = uploadPath.resolve(newFilename);
|
||||
@@ -105,7 +113,7 @@ public class FileStorageUtil {
|
||||
// 保存文件
|
||||
multipartFile.transferTo(filePathPath.toFile());
|
||||
|
||||
// 返回相对路径或完整路径,根据需求调整
|
||||
// 返回相对路径或完整路径
|
||||
filePath = dir + File.separator + newFilename;
|
||||
} catch (IOException e) {
|
||||
throw new BusinessException("本地文件上传失败: " + e.getMessage());
|
||||
|
||||
@@ -45,7 +45,7 @@ public enum RedisKeyEnum {
|
||||
/**
|
||||
* 云前置心跳
|
||||
*/
|
||||
CLD_HEART_BEAT_KEY("CLD_HEART_BEAT:", 120L);
|
||||
CLD_HEART_BEAT_KEY("CLD_HEART_BEAT:", 180L);
|
||||
|
||||
|
||||
private final String key;
|
||||
|
||||
@@ -81,7 +81,9 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.supervision.controller",
|
||||
"com.njcn.algorithm",
|
||||
"com.njcn.dataProcess",
|
||||
"com.njcn.migration"
|
||||
"com.njcn.migration",
|
||||
"com.njcn.harmonic.rstatlimitrate.controller",
|
||||
"com.njcn.device.device.controller"
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
List<GrantType> grantTypes = new ArrayList<>();
|
||||
|
||||
@@ -32,6 +32,7 @@ public enum DeviceResponseEnum {
|
||||
|
||||
DEVICE_SAME_NAME("A0290","设备名称已存在"),
|
||||
DEVICE_REPETITION("A0291","设备名称重复"),
|
||||
MODEL_NAME_REPEAT("A00350","名称不可重复"),
|
||||
DEVICE_IP_REPETITION("A0292","设备ip端口号重复"),
|
||||
DEVICE_SAME_IP("A0293","当前设备ip端口号已存在"),
|
||||
DEVICE_EMPTY("A0294","设备为空"),
|
||||
|
||||
@@ -74,7 +74,10 @@ public class PollutionLineInfoDTO {
|
||||
* 电压等级
|
||||
*/
|
||||
private String lineVoltage;
|
||||
|
||||
/**
|
||||
* 变电站电压等级
|
||||
*/
|
||||
private String subVoltage;
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<modules>
|
||||
<module>pq-device-api</module>
|
||||
<module>pq-device-boot</module>
|
||||
<module>pq-device-com</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.njcn.device.pq.api.fallback;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -14,11 +14,12 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 告警管理熔断降级
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/9/19
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Component("deviceAlarmClientFallbackFactory")
|
||||
public class AlarmClientFallbackFactory implements FallbackFactory<AlarmClient> {
|
||||
@Override
|
||||
public AlarmClient create(Throwable throwable) {
|
||||
|
||||
@@ -55,7 +55,11 @@ public interface Param {
|
||||
//长时间闪变值
|
||||
String pst = "DataFlicker-pst";
|
||||
|
||||
//电压暂降
|
||||
String Voltage_Dip = "r_mp_event_detail-Voltage_Dip";
|
||||
//电压暂升
|
||||
String Voltage_Rise = "r_mp_event_detail-Voltage_Rise";
|
||||
|
||||
String pf = "DataHarmPowerP-pf";
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.device.pq.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/1/4
|
||||
*/
|
||||
@Getter
|
||||
public enum JbPowerFlagEnum {
|
||||
|
||||
/**
|
||||
* 系统拓扑各层级描述
|
||||
*/
|
||||
GRID_SIDE(0, "电网侧"),
|
||||
NO_GRID_SIDE(1, "非电网侧"),
|
||||
SEND_NETWORK(2, "上送国网"),
|
||||
NOT_NETWORK(3, "非上送国网"),
|
||||
unknown(4, "未知"),
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
JbPowerFlagEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static JbPowerFlagEnum getPowerFlagEnumByCode(Integer code) {
|
||||
return Arrays.stream(JbPowerFlagEnum.values())
|
||||
.filter(x -> x.getCode().equals(code))
|
||||
.findAny()
|
||||
.orElse(unknown);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -124,11 +124,11 @@ public class LineParam {
|
||||
private String objId;
|
||||
|
||||
@ApiModelProperty(name = "bigObjType",value = "对象大类")
|
||||
@NotBlank(message = "对象大类不可为空")
|
||||
// @NotBlank(message = "对象大类不可为空")
|
||||
private String bigObjType;
|
||||
|
||||
@ApiModelProperty(name = "smallObjType",value = "对象小类")
|
||||
@NotBlank(message = "对象小类不可为空")
|
||||
// @NotBlank(message = "对象小类不可为空")
|
||||
private String smallObjType;
|
||||
|
||||
/**
|
||||
|
||||
@@ -137,6 +137,16 @@ public class PqDataVerifyBak {
|
||||
*/
|
||||
private Integer pst;
|
||||
|
||||
/**
|
||||
* 电压暂降(0:正常 1:异常)
|
||||
*/
|
||||
private Integer dip;
|
||||
|
||||
/**
|
||||
* 电压暂升(0:正常 1:异常)
|
||||
*/
|
||||
private Integer rise;
|
||||
|
||||
/**
|
||||
* 判断所有指标 0:无异常 1:有异常
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,9 @@ public class DevDetail {
|
||||
@ApiModelProperty("供电公司")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty("所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String bdzName;
|
||||
|
||||
@@ -37,9 +40,15 @@ public class DevDetail {
|
||||
@ApiModelProperty("终端等级")
|
||||
private String lineGrade;
|
||||
|
||||
@ApiModelProperty("终端厂商")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("通讯状态(0:中断;1:正常)")
|
||||
private Integer comFlag;
|
||||
|
||||
@ApiModelProperty("运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||
private Integer runFlag;
|
||||
|
||||
@ApiModelProperty("定检时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate nextTimeCheck;
|
||||
|
||||
@@ -11,6 +11,15 @@ import lombok.Data;
|
||||
@Data
|
||||
public class DevDetailVO {
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String cit;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点索引")
|
||||
private String lineId;
|
||||
|
||||
@@ -32,4 +41,6 @@ public class DevDetailVO {
|
||||
@ApiModelProperty(name = "subName",value = "对象id(新能源用户)")
|
||||
private String ObjId;
|
||||
|
||||
@ApiModelProperty("终端运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||
private Integer runFlag;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ import java.util.List;
|
||||
@Data
|
||||
public class DeviceRunEvaluateVO {
|
||||
|
||||
@ApiModelProperty("终端id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@@ -26,6 +29,18 @@ public class DeviceRunEvaluateVO {
|
||||
@ApiModelProperty("评价")
|
||||
private BigDecimal evaluate;
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String cit;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||
private String runFlag;
|
||||
|
||||
@ApiModelProperty("完整率")
|
||||
private BigDecimal integrityRate;
|
||||
|
||||
@@ -40,4 +55,29 @@ public class DeviceRunEvaluateVO {
|
||||
@ApiModelProperty("终端id集合")
|
||||
private List<String> devIds;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Detail {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("评价")
|
||||
private BigDecimal score;
|
||||
|
||||
@ApiModelProperty("终端数量")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty("在线率")
|
||||
private BigDecimal online;
|
||||
|
||||
@ApiModelProperty("数据完整性")
|
||||
private BigDecimal integrity;
|
||||
|
||||
@ApiModelProperty("异常率")
|
||||
private BigDecimal qualified;
|
||||
|
||||
@ApiModelProperty("终端信息")
|
||||
List<DeviceRunEvaluateVO> list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class LineDetailVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
@@ -92,6 +95,16 @@ public class LineDetailVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("已用流量占比")
|
||||
private Float flowProportion;
|
||||
|
||||
@ApiModelProperty("电网标志 0-电网侧;1-非电网侧")
|
||||
private Integer powerFlag;
|
||||
|
||||
@ApiModelProperty(name = "监测点运行状态")
|
||||
private String lineRunType;
|
||||
|
||||
@ApiModelProperty(name = "终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.device.pq.pojo.vo;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.njcn.device.pq.pojo.vo.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2025/11/26 11:00
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DeviceOnlineRate {
|
||||
|
||||
@ApiModelProperty("总终端数量")
|
||||
private Integer totalNum;
|
||||
|
||||
@ApiModelProperty("低于90终端数据")
|
||||
private Integer belowNum;
|
||||
|
||||
@ApiModelProperty("总终端在线率")
|
||||
private String totalOnlineRate;
|
||||
|
||||
@ApiModelProperty("统计信息")
|
||||
List<CitDetail> citDetailList;
|
||||
|
||||
@Data
|
||||
public static class CitDetail {
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String citName;
|
||||
|
||||
@ApiModelProperty("总终端数量")
|
||||
private Integer citTotalNum;
|
||||
|
||||
@ApiModelProperty("低于90终端数据")
|
||||
private Integer citBelowNum;
|
||||
|
||||
@ApiModelProperty("总终端在线率")
|
||||
private String citTotalOnlineRate;
|
||||
|
||||
@ApiModelProperty("统计信息")
|
||||
List<?> detailList;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class Detail {
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String cit;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStation;
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端IP")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("终端运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||
private String runFlag;
|
||||
|
||||
@ApiModelProperty("终端通讯状态(0:中断;1:正常)")
|
||||
private String comFlag;
|
||||
|
||||
@ApiModelProperty("最新数据时间")
|
||||
private LocalDateTime timeID;
|
||||
|
||||
@ApiModelProperty("在线率")
|
||||
private String onlineRate;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class LineDetail {
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String cit;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStation;
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端IP")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty("监测点运行状态")
|
||||
private String runFlag;
|
||||
|
||||
@ApiModelProperty("最新数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime latestTime;
|
||||
|
||||
@ApiModelProperty("数据完整性")
|
||||
private Double integrity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,6 +50,8 @@ public class DetailAbnormalVO {
|
||||
private String avg;
|
||||
//CP95
|
||||
private String cp95;
|
||||
//幅值
|
||||
private String featureAmplitude;
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +75,7 @@ public class DetailAbnormalVO {
|
||||
//最大
|
||||
private String val;
|
||||
|
||||
|
||||
//限值
|
||||
private float overLimitValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,14 +9,29 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class JsonBaseVO {
|
||||
|
||||
/**
|
||||
* 超标时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 异常值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
private String phasic;
|
||||
|
||||
/**
|
||||
* 数据类型(最大值:max、最小值:min、平均值:avg、95值:cp95)
|
||||
*/
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
* 限值
|
||||
*/
|
||||
private float overLimitValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<artifactId>pq-device-com</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>system-api</artifactId>
|
||||
@@ -39,26 +38,10 @@
|
||||
<artifactId>common-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>supervision-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@@ -11,14 +11,12 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IOverLimitService;
|
||||
import com.njcn.device.pq.service.IPqsDeviceUnitService;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -57,9 +55,6 @@ public class CommTerminalController extends BaseController {
|
||||
|
||||
private final IPqsDeviceUnitService iPqsDeviceUnitService;
|
||||
|
||||
private final IOverLimitService iOverLimitService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过部门获取所有子集部门所拥有的监测点基本信息
|
||||
@@ -241,34 +236,6 @@ public class CommTerminalController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitData")
|
||||
@ApiOperation("根据监测点id获取越限数值")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitData");
|
||||
Overlimit result = lineService.getOverLimitData(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAllLineOverLimit")
|
||||
@ApiOperation("获取投运在线的监测点的限值")
|
||||
public HttpResult<List<Overlimit>> getAllLineOverLimit() {
|
||||
String methodDescribe = getMethodDescribe("getAllLineOverLimit");
|
||||
List<Overlimit> result = lineService.getAllLineOverLimit("harmonic-boot", null);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitDataByIds")
|
||||
@ApiOperation("根据监测点id集合获取越限数值")
|
||||
@ApiImplicitParam(name = "ids", value = "监测点id集合", required = true)
|
||||
public HttpResult<List<Overlimit>> getOverLimitDataByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitDataByIds");
|
||||
List<Overlimit> result = iOverLimitService.listByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/getLineBySubstationRelation")
|
||||
@ApiOperation("获取变电站和监测点的关系")
|
||||
|
||||
@@ -7,10 +7,10 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.pq.mapper.DeptLineMapper;
|
||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@@ -76,4 +76,14 @@ public class DeviceRunEvaluateController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getRunEvaluateInfo")
|
||||
@ApiOperation("终端评价列表(冀北)")
|
||||
public HttpResult<List<DeviceRunEvaluateVO.Detail>> getRunEvaluateInfo(@RequestBody DeviceInfoParam.BusinessParam businessParam) {
|
||||
String methodDescribe = getMethodDescribe("getRunEvaluateInfo");
|
||||
List<DeviceRunEvaluateVO.Detail> runEvaluate = deviceRunEvaluateService.getRunEvaluate(businessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, runEvaluate, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.common.service.TerminalBaseService;
|
||||
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
|
||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -13,8 +15,6 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.device.pq.service.impl.GeneralDeviceService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -17,6 +16,7 @@ import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
||||
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
|
||||
import com.njcn.device.pq.service.IRStatIntegrityDService;
|
||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||
@@ -148,4 +148,14 @@ public class LineIntegrityDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,flag,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/data")
|
||||
@ApiOperation("监测点数据完整性(冀北)")
|
||||
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
|
||||
public HttpResult<DeviceOnlineRate> getData(@RequestBody DeviceInfoParam.BusinessParam param) {
|
||||
String methodDescribe = getMethodDescribe("getData");
|
||||
DeviceOnlineRate rate = irStatIntegrityDService.getData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,20 +7,18 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.PqsParam;
|
||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.pq.service.AlarmStrategyService;
|
||||
import com.njcn.device.pq.service.IOverLimitService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 监测点限值
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/overLimit")
|
||||
@Api(tags = "监测点限值")
|
||||
@RequiredArgsConstructor
|
||||
public class OverLimitController extends BaseController {
|
||||
|
||||
private final IOverLimitService iOverLimitService;
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitByLineIds")
|
||||
@ApiOperation("监测点集合获取限值")
|
||||
@ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<List<Overlimit>> getOverLimitByLineIds(@RequestBody List<String> lineIds){
|
||||
String methodDescribe = getMethodDescribe("getOverLimitByLineIds");
|
||||
List<Overlimit> overLimitList= iOverLimitService.list(new LambdaQueryWrapper<Overlimit>().in(Overlimit::getId,lineIds));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overLimitList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLimitMapsByLineIds")
|
||||
@ApiOperation("监测点集合获取限值")
|
||||
@ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<List<Map<String, Object>>> getLimitMapsByLineIds(@RequestBody List<String> lineIds){
|
||||
String methodDescribe = getMethodDescribe("getLimitMapsByLineIds");
|
||||
List<Map<String, Object>> overLimitList= iOverLimitService.listMaps(new LambdaQueryWrapper<Overlimit>().in(Overlimit::getId,lineIds));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overLimitList, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,9 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.common.service.TerminalBaseService;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -20,10 +23,6 @@ import com.njcn.device.pq.pojo.dto.PushResultDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.device.pq.service.impl.GeneralDeviceService;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TerminalTreeController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("getTerminalTree");
|
||||
List<TerminalTree> tree;
|
||||
if(isJb){
|
||||
tree= terminalTreeService.getJbTerminalTree();
|
||||
tree= terminalTreeService.getJbNewTerminalTree();
|
||||
}else{
|
||||
tree= terminalTreeService.getTerminalTree();
|
||||
}
|
||||
|
||||
@@ -4,21 +4,13 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.njcn.dataProcess.api.PqsCommunicateFeignClient;
|
||||
import com.njcn.dataProcess.pojo.dto.PqsCommunicateDto;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.NodeMapper;
|
||||
import com.njcn.device.pq.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceInfo;
|
||||
import com.njcn.device.pq.pojo.dto.NodeProcessDeviceTree;
|
||||
import com.njcn.device.device.service.DeviceProcessService;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
import com.njcn.device.node.mapper.NodeMapper;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
import com.njcn.device.pq.pojo.po.Node;
|
||||
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
|
||||
import com.njcn.device.pq.service.DeviceProcessService;
|
||||
import com.njcn.device.pq.service.IDeviceService;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@@ -26,12 +18,9 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunManageVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
public interface DeviceProcessMapper extends BaseMapper<DeviceProcess> {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
public interface OverlimitMapper extends BaseMapper<Overlimit> {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.OverlimitMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -34,4 +34,13 @@ public interface DeviceRunEvaluateService {
|
||||
|
||||
|
||||
TerminalEvaluateAreaVO.lastWeekTrendVO lastWeekTrend(DeviceInfoParam.BusinessParam businessParam);
|
||||
|
||||
/**
|
||||
* @Description: 获取终端列表
|
||||
* @param param
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.vo.DeviceRunEvaluateVO.Detail>
|
||||
* @Author: wr
|
||||
* @Date: 2025/11/27 10:24
|
||||
*/
|
||||
List<DeviceRunEvaluateVO.Detail> getRunEvaluate(DeviceInfoParam.BusinessParam param);
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 越限表实体
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-03-28
|
||||
*/
|
||||
public interface IOverLimitService extends IService<Overlimit> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
|
||||
import com.njcn.device.pq.pojo.dto.MonitorIntegrityDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,4 +35,6 @@ public interface IRStatIntegrityDService extends IMppService<RStatIntegrityD> {
|
||||
List<LineDataQualityDTO> getLineDataQuality(LineDataQualityParam lineDataQualityParam);
|
||||
|
||||
Boolean saveOrUpdateData(List<MonitorIntegrityDTO> monitorIntegrityDTOList);
|
||||
|
||||
DeviceOnlineRate getData(DeviceInfoParam.BusinessParam param);
|
||||
}
|
||||
|
||||
@@ -49,4 +49,7 @@ public interface TerminalTreeService {
|
||||
* @return
|
||||
*/
|
||||
List<TerminalTree> getJbTerminalTree();
|
||||
|
||||
|
||||
List<TerminalTree> getJbNewTerminalTree();
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
|
||||
@@ -3,8 +3,7 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.mapper.OnlineRateMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.param.PulicTimeParam;
|
||||
@@ -12,23 +11,17 @@ import com.njcn.device.pq.pojo.param.PulicTimeStatisParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.CommunicateService;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.device.pq.utils.PublicDateUtil;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.web.enums.DateFlagEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,13 +4,9 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.dataProcess.api.DataLimitRateDetailFeignClient;
|
||||
@@ -21,31 +17,23 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.DataVerifyMapper;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IDataVerifyService;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -58,16 +46,12 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.DateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -525,6 +509,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
||||
vo.setVal(valArr[i]);
|
||||
vo.setPhaseType(phasic);
|
||||
vo.setTargetName(StrUtil.isNotBlank(count) ? count + "次" + targetName : targetName);
|
||||
vo.setOverLimitValue(it.getOverLimitValue());
|
||||
result.add(vo);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,33 +6,41 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.common.mapper.onlinerate.OnLineRateMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DevRunEvaluateParam;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.DeviceRunEvaluateVO;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.pojo.dto.MonitorInfoDTO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalEvaluateAreaVO;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.device.pq.service.DeviceRunEvaluateService;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -61,7 +69,10 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
private final LineMapper lineMapper;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final DeptLineService deptLineService;
|
||||
|
||||
private final GeneralDeviceService deviceService;
|
||||
private final OnLineRateMapper onLineRateMapper;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
/**
|
||||
* 数据完整性:50%
|
||||
*/
|
||||
@@ -106,7 +117,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
|
||||
}
|
||||
|
||||
return info.stream().sorted(Comparator.comparing(DeviceRunEvaluateVO.Info::getEvaluate,Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
return info.stream().sorted(Comparator.comparing(DeviceRunEvaluateVO.Info::getEvaluate, Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void setEvaluate(List<String> devIds, List<String> lineIds, List<RStatIntegrityD> onIntegrityList, DeviceRunEvaluateVO evaluateVO, List<RStatOnlinerateD> onlineRateList, List<RStatLimitRateDPO> limitRateList) {
|
||||
@@ -115,7 +126,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getDueTime).sum();
|
||||
evaluateVO.setIntegrityRate(NumberUtil.round(Math.min(realTime * 100 / dueTime,100), 2));
|
||||
evaluateVO.setIntegrityRate(NumberUtil.round(Math.min(realTime * 100 / dueTime, 100), 2));
|
||||
} else {
|
||||
evaluateVO.setIntegrityRate(new BigDecimal(0));
|
||||
}
|
||||
@@ -124,7 +135,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateD::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateD::getOfflineMin).sum();
|
||||
evaluateVO.setOnLineRate(NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime),100), 2));
|
||||
evaluateVO.setOnLineRate(NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime), 100), 2));
|
||||
} else {
|
||||
evaluateVO.setOnLineRate(new BigDecimal(0));
|
||||
}
|
||||
@@ -142,7 +153,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
if (allTime == 0) {
|
||||
evaluateVO.setPassRate(new BigDecimal(0));
|
||||
} else {
|
||||
evaluateVO.setPassRate(NumberUtil.round(Math.min((1 - (overTime * 1.0 / allTime)) * 100,100), 2));
|
||||
evaluateVO.setPassRate(NumberUtil.round(Math.min((1 - (overTime * 1.0 / allTime)) * 100, 100), 2));
|
||||
}
|
||||
} else {
|
||||
evaluateVO.setPassRate(new BigDecimal(0));
|
||||
@@ -212,7 +223,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(businessParam, Stream.of(RunFlagEnum.RUNNING.getStatus()).collect(Collectors.toList()), Stream.of(PowerFlagEnum.REAL_DEVICE.getCode()).collect(Collectors.toList()));
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
if (generalDeviceDTOList.size() == 1 && generalDeviceDTOList.get(0).getIndex().equals(businessParam.getDeptIndex())) {
|
||||
if(CollUtil.isNotEmpty(generalDeviceDTOList.get(0).getLineIndexes())) {
|
||||
if (CollUtil.isNotEmpty(generalDeviceDTOList.get(0).getLineIndexes())) {
|
||||
//已经最底层,展示电站和用户场站
|
||||
List<MonitorInfoDTO> lineDetailList = lineMapper.getLineListByIds(generalDeviceDTOList.get(0).getLineIndexes());
|
||||
List<String> ids = lineDetailList.stream().map(MonitorInfoDTO::getId).distinct().collect(Collectors.toList());
|
||||
@@ -245,7 +256,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
}
|
||||
} else {
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
if(CollUtil.isEmpty(generalDeviceDTO.getDeviceIndexes())){
|
||||
if (CollUtil.isEmpty(generalDeviceDTO.getDeviceIndexes())) {
|
||||
continue;
|
||||
}
|
||||
List<RStatIntegrityD> rStatIntegrityDList = new ArrayList<>();
|
||||
@@ -333,6 +344,139 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
||||
return lastWeekTrendVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceRunEvaluateVO.Detail> getRunEvaluate(DeviceInfoParam.BusinessParam param) {
|
||||
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_MANUFACTURER.getCode()).getData();
|
||||
Map<String, String> manufacturerMap = manufacturerList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String, String> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
|
||||
List<DeviceRunEvaluateVO.Detail> info = new ArrayList<>();
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, ObjectUtil.isNull(param.getLineRunFlag()) ? null : Arrays.asList(param.getLineRunFlag()), Arrays.asList(1));
|
||||
if (CollUtil.isNotEmpty(deviceInfo)) {
|
||||
List<String> deviceIds = deviceInfo.stream()
|
||||
.flatMap(x -> x.getDeviceIndexes().stream()).collect(Collectors.toList())
|
||||
.stream()
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<String> lineIds = deviceInfo.stream()
|
||||
.flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList())
|
||||
.stream()
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//获取所有监测点信息信息
|
||||
List<DevDetailVO> lineDeviceByDevIds = lineMapper.getLineDeviceByDevIds(param.getPowerFlag(), lineIds, deviceIds);
|
||||
RStatLimitQueryParam rStatLimitQueryParam = new RStatLimitQueryParam();
|
||||
rStatLimitQueryParam.setIds(lineIds);
|
||||
rStatLimitQueryParam.setDate(param.getSearchBeginTime());
|
||||
rStatLimitQueryParam.setEndDate(param.getSearchEndTime());
|
||||
OnlineRateParam onlineRateParam = new OnlineRateParam();
|
||||
onlineRateParam.setIds(deviceIds);
|
||||
onlineRateParam.setStartTime(param.getSearchBeginTime());
|
||||
onlineRateParam.setEndTime(param.getSearchEndTime());
|
||||
DeviceRunEvaluateVO.Detail detail;
|
||||
//完整率
|
||||
List<RStatIntegrityVO> integrityList = integrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime());
|
||||
//超标率
|
||||
List<RStatLimitRateDPO> limitRatePOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(rStatLimitQueryParam).getData();
|
||||
//获取所有终端在线率
|
||||
List<RStatOnlinerateVO> onlineRateByDev = onLineRateMapper.getOnlineRateByDevIds(onlineRateParam);
|
||||
|
||||
for (GeneralDeviceDTO dto : deviceInfo) {
|
||||
detail = new DeviceRunEvaluateVO.Detail();
|
||||
detail.setName(dto.getName());
|
||||
detail.setCount(dto.getDeviceIndexes().size());
|
||||
detail.setOnline(onLineRate(onlineRateByDev, dto.getDeviceIndexes()));
|
||||
detail.setIntegrity(integrity(integrityList, dto.getLineIndexes()));
|
||||
detail.setQualified(limitRate(limitRatePOList, dto.getLineIndexes()));
|
||||
detail.setScore(ONINTEGRITY.multiply(detail.getIntegrity())
|
||||
.add(ONLINERATE.multiply(detail.getOnline())
|
||||
.add(LIMITRATE.multiply(detail.getQualified()))).stripTrailingZeros());
|
||||
Map<String, List<DevDetailVO>> dev = lineDeviceByDevIds
|
||||
.stream()
|
||||
.filter(x -> dto.getDeviceIndexes().contains(x.getDevId()))
|
||||
.collect(Collectors.groupingBy(DevDetailVO::getDevId));
|
||||
List<DeviceRunEvaluateVO> deviceDetail = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(dev)) {
|
||||
dev.forEach((key, value) -> {
|
||||
List<String> ids = value.stream().map(DevDetailVO::getLineId).distinct().collect(Collectors.toList());
|
||||
DeviceRunEvaluateVO evaluateVO = new DeviceRunEvaluateVO();
|
||||
evaluateVO.setId(value.get(0).getDevId());
|
||||
evaluateVO.setName(value.get(0).getDevName());
|
||||
evaluateVO.setSubName(value.get(0).getSubName());
|
||||
evaluateVO.setIp(value.get(0).getIp());
|
||||
//部门
|
||||
if (deptMap.containsKey(value.get(0).getCit())) {
|
||||
evaluateVO.setCit(deptMap.get(value.get(0).getCit()));
|
||||
}
|
||||
//终端厂商
|
||||
if (manufacturerMap.containsKey(value.get(0).getManufacturer())) {
|
||||
evaluateVO.setManufacturer(manufacturerMap.get(value.get(0).getManufacturer()));
|
||||
}
|
||||
evaluateVO.setOnLineRate(onLineRate(onlineRateByDev, Arrays.asList(key)));
|
||||
evaluateVO.setIntegrityRate(integrity(integrityList, ids));
|
||||
evaluateVO.setPassRate(limitRate(limitRatePOList, ids));
|
||||
evaluateVO.setEvaluate(ONINTEGRITY.multiply(evaluateVO.getIntegrityRate())
|
||||
.add(ONLINERATE.multiply(evaluateVO.getOnLineRate())
|
||||
.add(LIMITRATE.multiply(evaluateVO.getPassRate()))).stripTrailingZeros());
|
||||
deviceDetail.add(evaluateVO);
|
||||
});
|
||||
}
|
||||
detail.setList(deviceDetail);
|
||||
info.add(detail);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
private BigDecimal integrity(List<RStatIntegrityVO> integrityList, List<String> lineIds) {
|
||||
//监测完整率
|
||||
List<RStatIntegrityVO> integrityDS = integrityList.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityVO::getDueTime).sum();
|
||||
return NumberUtil.round(Math.min(realTime * 100 / dueTime, 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal onLineRate(List<RStatOnlinerateVO> onlineRateByDev, List<String> devIds) {
|
||||
//终端在线率
|
||||
List<RStatOnlinerateVO> onlineRateDS = onlineRateByDev.stream().filter(x -> devIds.contains(x.getDevIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateVO::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlinerateVO::getOfflineMin).sum();
|
||||
return NumberUtil.round(Math.min(onlineTime * 100.0 / (onlineTime + offlineTime), 100), 2);
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal limitRate(List<RStatLimitRateDPO> limitRatePOList, List<String> lineIds) {
|
||||
//超标信息
|
||||
List<RStatLimitRateDPO> limitRateDPOS = limitRatePOList.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(limitRateDPOS)) {
|
||||
double overTime = limitRateDPOS.stream().mapToDouble(x -> (x.getUaberranceOvertime() +
|
||||
x.getUharm2Overtime() + x.getUharm3Overtime() + x.getUharm4Overtime() + x.getUharm5Overtime() +
|
||||
x.getUharm6Overtime() + x.getUharm7Overtime() + x.getUharm8Overtime() + x.getUharm9Overtime() +
|
||||
x.getUharm10Overtime() + x.getUharm11Overtime() + x.getUharm12Overtime() + x.getUharm13Overtime() + x.getUharm14Overtime() +
|
||||
x.getUharm15Overtime() + x.getUharm16Overtime() + x.getUharm17Overtime() + x.getUharm18Overtime() + x.getUharm19Overtime() +
|
||||
x.getUharm20Overtime() + x.getUharm21Overtime() + x.getUharm22Overtime() + x.getUharm23Overtime() + x.getUharm24Overtime() +
|
||||
x.getUharm25Overtime())).sum();
|
||||
double allTime = limitRateDPOS.stream().mapToDouble(x -> x.getAllTime() * 25.0).sum();
|
||||
if (allTime == 0) {
|
||||
return new BigDecimal(0);
|
||||
} else {
|
||||
return NumberUtil.round(Math.min((1 - (overTime * 1.0 / allTime)) * 100, 100), 2);
|
||||
}
|
||||
} else {
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Map<String, NewUserReportVO> getUserLedgerByObjIds(List<String> objIds) {
|
||||
List<NewUserReportVO> userReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
return userReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -14,8 +13,11 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
@@ -25,12 +27,12 @@ import com.njcn.device.pq.pojo.po.*;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramProVO;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.device.pq.service.*;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
|
||||
import java.time.ZoneId;
|
||||
@@ -39,7 +41,6 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -243,7 +244,6 @@ public class GridDiagramServiceImpl implements GridDiagramService {
|
||||
public GridDiagramVO getGridDiagramDev(GridDiagramParam param) {
|
||||
//获取电压等级
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
|
||||
List<DictData> v = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.PANORAMIC_VOLTAGE.getCode()).getData();
|
||||
List<String> voltageIds;
|
||||
//获取电压等级550 220 110 35
|
||||
@@ -263,7 +263,6 @@ public class GridDiagramServiceImpl implements GridDiagramService {
|
||||
List<Dept> data = deptFeignClient.getDirectSonSelf(param.getOrgId()).getData();
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getOrgId());
|
||||
deptGetLineParam.setLineRunFlag(0);
|
||||
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalService.deptGetLine(deptGetLineParam);
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.pq.mapper.LargeScreenMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
|
||||
@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
@@ -15,7 +16,6 @@ import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineIntegrityDataMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PublicDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
@@ -27,6 +27,7 @@ import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||
import com.njcn.device.pq.utils.DataStatisticsUtil;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMarkMapper;
|
||||
import com.njcn.device.pq.pojo.bo.excel.LineMark;
|
||||
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
|
||||
|
||||
@@ -7,30 +7,20 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.EventPushLogsMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.LogManageMapper;
|
||||
import com.njcn.device.pq.pojo.constant.DeviceValidMessage;
|
||||
import com.njcn.device.pq.pojo.param.DeviceLogParam;
|
||||
import com.njcn.device.pq.pojo.param.EventLogParam;
|
||||
import com.njcn.device.pq.pojo.po.EventPushLogs;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.DeviceLogVO;
|
||||
import com.njcn.device.pq.pojo.vo.EventLogVO;
|
||||
import com.njcn.device.pq.service.LogManageService;
|
||||
import com.njcn.event.api.EventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.NewStationMapper;
|
||||
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
|
||||
import com.njcn.device.pq.pojo.po.NewStation;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.mapper.OverlimitMapper;
|
||||
import com.njcn.device.pq.service.IOverLimitService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OverLimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements IOverLimitService {
|
||||
|
||||
}
|
||||
@@ -17,15 +17,11 @@ import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.biz.enums.LineFlagEnum;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.PqDataVerifyBakMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
@@ -35,8 +31,6 @@ import com.njcn.device.pq.pojo.vo.dataClean.VerifyMonitorVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.VerifyTargetVO;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import com.njcn.harmonic.enums.HarmonicResponseEnum;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
@@ -45,13 +39,10 @@ import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -484,7 +475,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
vo.setTargetKey(targetKey);
|
||||
vo.setPhaseType(phaseKey);
|
||||
|
||||
if ((pqReasonableRangeDto.getInfluxdbTableName() + SEPARATOR + pqReasonableRangeDto.getIndexCode()).equals(targetKey)) {
|
||||
if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
|
||||
} else {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
@@ -502,6 +493,8 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
break;
|
||||
case "CP95":
|
||||
vo.setCp95(ites.getVal());
|
||||
case "Feature_Amplitude":
|
||||
vo.setFeatureAmplitude(ites.getVal());
|
||||
break;
|
||||
}
|
||||
});
|
||||
@@ -527,7 +520,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
queryWrapper.select("line_id as lineId,sum(freq) as freq,sum(freq_Dev) as freqDev,sum(v_Rms) as vRms,sum(v_Pos) as vPos,sum(v_Neg) as vNeg," +
|
||||
"sum(v_Zero) as vZero,sum(v_Unbalance) as vUnbalance,sum(rms_Lvr) as rmsLvr,sum(vu_Dev) as vuDev,sum(vl_Dev) as vlDev," +
|
||||
"sum(v_Thd) as vThd,sum(v) as v,sum(i_Rms) as iRms,sum(plt) as plt,sum(v_Inharm) as vInharm,sum(v_Harm) as vHarm,sum(pf) as pf," +
|
||||
"sum(v_Phasic) as vPhasic,sum(v1_Phasic) as v1Phasic,sum(fluc) as fluc,sum(pst) as pst,sum(state) as state")
|
||||
"sum(v_Phasic) as vPhasic,sum(v1_Phasic) as v1Phasic,sum(fluc) as fluc,sum(pst) as pst,sum(dip) as dip,sum(rise) as rise,sum(state) as state")
|
||||
.lambda().between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorIds)
|
||||
.eq(PqDataVerifyBak::getState, 1)
|
||||
@@ -661,6 +654,14 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
ids = dataVerifyList.stream().filter(it -> it.getPf() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.Voltage_Dip:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getDip() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.Voltage_Rise:
|
||||
ids = dataVerifyList.stream().filter(it -> it.getRise() > 0).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
default:
|
||||
log.error("未匹配到异常数据指标");
|
||||
break;
|
||||
|
||||
@@ -9,18 +9,17 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.bpm.utils.CollectionUtils;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
import com.njcn.device.device.service.PqDevTypeService;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.pq.pojo.dto.PqIcdPathDTO;
|
||||
import com.njcn.device.pq.pojo.param.PqIcdPathParam;
|
||||
import com.njcn.device.pq.pojo.po.*;
|
||||
import com.njcn.device.pq.service.IDeviceService;
|
||||
import com.njcn.device.pq.service.PqDevTypeService;
|
||||
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -59,7 +58,7 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
private final IDeviceService deviceService;
|
||||
private final PqsTerminalLogsMapper pqsTerminalLogsMapper;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final LineMapper lineMapper;
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
@Override
|
||||
public List<PqIcdPathDTO> icdPathList(List<String> devType) {
|
||||
@@ -152,9 +151,9 @@ public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath
|
||||
icdPath.setPath(param.getFilePath());
|
||||
//查询绑定的icd的设备型号
|
||||
List<PqDevType> pqDevTypeList = devTypeService.lambdaQuery().eq(PqDevType::getIcdId, param.getId()).eq(PqDevType::getState, 1).list();
|
||||
if(!CollectionUtil.isEmpty(pqDevTypeList)) {
|
||||
if (!CollectionUtil.isEmpty(pqDevTypeList)) {
|
||||
List<String> collect = pqDevTypeList.stream().map(PqDevType::getId).collect(Collectors.toList());
|
||||
List<Device> list = deviceService.lambdaQuery().in(Device::getDevType,collect).eq(Device::getRunFlag, 0).list();
|
||||
List<Device> list = deviceService.lambdaQuery().in(Device::getDevType, collect).eq(Device::getRunFlag, 0).list();
|
||||
list.forEach(temp -> {
|
||||
//记录日志
|
||||
DictData dataDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.DEV_PARAMETER.getCode(), DicDataTypeEnum.DEV_OPS.getCode()).getData();
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
|
||||
@@ -11,7 +11,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.PqsLineWeightMapper;
|
||||
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
|
||||
import com.njcn.device.pq.pojo.po.PqsLineWeight;
|
||||
@@ -19,7 +19,7 @@ import com.njcn.device.pq.pojo.vo.PqsLineWeightVo;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import com.njcn.device.pq.service.IPqsLineWeightService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.pq.utils.ExcelStyleUtil;
|
||||
import com.njcn.device.utils.ExcelStyleUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -8,10 +8,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.PqsTflgassMapper;
|
||||
import com.njcn.device.pq.mapper.PqsTransformerMapper;
|
||||
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||
@@ -176,9 +177,9 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
|
||||
.eq(PqsTflgass::getLogicNext, param.getDownNode())
|
||||
)
|
||||
);
|
||||
if(ObjectUtil.isNotNull(tflgass)){
|
||||
if (ObjectUtil.isNotNull(tflgass)) {
|
||||
throw new BusinessException(PvDeviceResponseEnum.TRANSFORMER_NAME_REPEAT);
|
||||
}else{
|
||||
} else {
|
||||
fly = iPqsTflgassService.save(ass);
|
||||
}
|
||||
|
||||
@@ -198,59 +199,182 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
|
||||
PqsTflgass one = iPqsTflgassService.getOne(new LambdaQueryWrapper<PqsTflgass>()
|
||||
.eq(PqsTflgass::getTfIndex, id));
|
||||
|
||||
//1.获取当前变电站下,所拥有的母线条数
|
||||
List<TerminalTree> downVoltage = lineMapper.getvoltage(subId, 1);
|
||||
//获取母线id
|
||||
List<String> ids = downVoltage.stream().map(TerminalTree::getId).collect(Collectors.toList());
|
||||
//查询节点是否绑定
|
||||
List<PqsTflgass> pqsTflgasses = pqsTflgassMapper.selectFlgass(subId, ids);
|
||||
|
||||
|
||||
String[][] arr = new String[pqsTflgasses.size()][2];
|
||||
if (CollUtil.isNotEmpty(pqsTflgasses) && ids.size() > 2) {
|
||||
for (int i = 0; i < pqsTflgasses.size(); i++) {
|
||||
arr[i][0] = pqsTflgasses.get(i).getLogicBefore();
|
||||
arr[i][1] = pqsTflgasses.get(i).getLogicNext();
|
||||
}
|
||||
|
||||
List<String> arr = new ArrayList<>();
|
||||
if (Objects.nonNull(one)) {
|
||||
arr.add(one.getLogicBefore());
|
||||
arr.add(one.getLogicNext());
|
||||
}
|
||||
voltage.put("bind", arr);
|
||||
|
||||
Stream<String> beforeStream = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore);
|
||||
Stream<String> nextStream = pqsTflgasses.stream().map(PqsTflgass::getLogicNext);
|
||||
//合并节点,要是母线都存在,说明是跨变电站,反之是本变电站
|
||||
List<String> merge = Stream.concat(beforeStream, nextStream)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//查看已经绑定的母线
|
||||
List<String> bindList = merge.stream().filter(x -> ids.contains(x)).collect(Collectors.toList());
|
||||
|
||||
//绑定母线,如有绑定的母线下不存在这个母线,说明是有跨变电站数据,则新增母线节点,为最底层节点往后,拼接
|
||||
List<String> straddleList = merge.stream().filter(x -> !ids.contains(x)).collect(Collectors.toList());
|
||||
//判断当前母线下是否还存在,没绑定节点
|
||||
List<String> not = ids.stream().filter(x -> !bindList.contains(x)).collect(Collectors.toList());
|
||||
//1.获取当前变电站下,所拥有的母线条数
|
||||
List<TerminalTree> downVoltage = lineMapper.getvoltage(subId, 1);
|
||||
if(CollUtil.isNotEmpty(arr)) {
|
||||
downVoltage.forEach(item->{
|
||||
if(Objects.equals(item.getId(),arr.get(1))){
|
||||
item.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取所有母线层级
|
||||
List<Line> UpBusList = lineMapper.selectList(new LambdaQueryWrapper<Line>().eq(Line::getLevel, LineBaseEnum.SUB_V_LEVEL.getCode()).eq(Line::getState, DataStateEnum.ENABLE.getCode()).orderByAsc(Line::getSort));
|
||||
List<TerminalTree> upTreeList = UpBusList.stream().map(it -> {
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setId(it.getId());
|
||||
terminalTree.setName(it.getName());
|
||||
terminalTree.setPid(it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]);
|
||||
terminalTree.setSort(it.getSort());
|
||||
if(CollUtil.isNotEmpty(arr)) {
|
||||
if (it.getId().equals(arr.get(0))) {
|
||||
terminalTree.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
|
||||
}
|
||||
}
|
||||
return terminalTree;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
//获取母线id
|
||||
//List<String> ids = downVoltage.stream().map(TerminalTree::getId).collect(Collectors.toList());
|
||||
|
||||
List<TerminalTree> upList = TreedChildren(upTreeList, "变压器上节点设备树", subId);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVoltage, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Map<String, Object> getGeneratrixOld(String subId, String id) {
|
||||
Map<String, Object> voltage = new HashMap<>();
|
||||
//先判断当前,变电站是否已添加了节点
|
||||
PqsTflgass one = iPqsTflgassService.getOne(new LambdaQueryWrapper<PqsTflgass>()
|
||||
.eq(PqsTflgass::getTfIndex, id));
|
||||
|
||||
//1.获取当前变电站下,所拥有的母线条数
|
||||
List<TerminalTree> downVoltage = lineMapper.getvoltage(subId, 1);
|
||||
//获取母线id
|
||||
List<String> ids = downVoltage.stream().map(TerminalTree::getId).collect(Collectors.toList());
|
||||
//查询节点是否绑定
|
||||
List<PqsTflgass> pqsTflgasses = pqsTflgassMapper.selectFlgass(subId, ids);
|
||||
|
||||
|
||||
String[][] arr = new String[pqsTflgasses.size()][2];
|
||||
if (CollUtil.isNotEmpty(pqsTflgasses) && ids.size() > 2) {
|
||||
for (int i = 0; i < pqsTflgasses.size(); i++) {
|
||||
arr[i][0] = pqsTflgasses.get(i).getLogicBefore();
|
||||
arr[i][1] = pqsTflgasses.get(i).getLogicNext();
|
||||
}
|
||||
|
||||
}
|
||||
voltage.put("bind", arr);
|
||||
|
||||
Stream<String> beforeStream = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore);
|
||||
Stream<String> nextStream = pqsTflgasses.stream().map(PqsTflgass::getLogicNext);
|
||||
//合并节点,要是母线都存在,说明是跨变电站,反之是本变电站
|
||||
List<String> merge = Stream.concat(beforeStream, nextStream)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//查看已经绑定的母线
|
||||
List<String> bindList = merge.stream().filter(x -> ids.contains(x)).collect(Collectors.toList());
|
||||
|
||||
//绑定母线,如有绑定的母线下不存在这个母线,说明是有跨变电站数据,则新增母线节点,为最底层节点往后,拼接
|
||||
List<String> straddleList = merge.stream().filter(x -> !ids.contains(x)).collect(Collectors.toList());
|
||||
//判断当前母线下是否还存在,没绑定节点
|
||||
List<String> not = ids.stream().filter(x -> !bindList.contains(x)).collect(Collectors.toList());
|
||||
|
||||
|
||||
/**
|
||||
* 当母线节点+1等于去重之后的绑定节点说明,节点已经全部绑定了
|
||||
*
|
||||
* 跨变电站
|
||||
* 1.1当母线小于俩条时为跨
|
||||
* 1.2当都所有节点都绑定时,只有最起始节点为跨
|
||||
* 本变电站
|
||||
* 1.1当有俩条时或者大于俩条时时为本
|
||||
* 1.2当已绑定有跨变电站时,则上节点为最底层节点母线,下节点为没绑定的母线信息
|
||||
*/
|
||||
|
||||
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
List<String> collect = ids.stream().filter(x -> x.equals(one.getLogicBefore())).collect(Collectors.toList());
|
||||
/**
|
||||
* 当母线节点+1等于去重之后的绑定节点说明,节点已经全部绑定了
|
||||
*
|
||||
* 跨变电站
|
||||
* 1.1当母线小于俩条时为跨
|
||||
* 1.2当都所有节点都绑定时,只有最起始节点为跨
|
||||
* 本变电站
|
||||
* 1.1当有俩条时或者大于俩条时时为本
|
||||
* 1.2当已绑定有跨变电站时,则上节点为最底层节点母线,下节点为没绑定的母线信息
|
||||
* 本
|
||||
* 1.当母线大于俩条
|
||||
* 2.当所有母线没有绑定是
|
||||
*/
|
||||
if (collect.size() > 0) {
|
||||
List<TerminalTree> upVOList;
|
||||
if (straddleList.size() > 0 && not.size() > 0) {
|
||||
String s = mostNext(pqsTflgasses);
|
||||
upVOList = downVoltage.stream().filter(x -> s.equals(x.getId())).collect(Collectors.toList());
|
||||
} else {
|
||||
//上节点id
|
||||
List<String> upIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore).collect(Collectors.toList());
|
||||
upVOList = downVoltage.stream().filter(x -> !upIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
//下节点id
|
||||
List<String> downIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
List<TerminalTree> downVOList = downVoltage.stream().filter(x -> !downIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
List<String> collect = ids.stream().filter(x -> x.equals(one.getLogicBefore())).collect(Collectors.toList());
|
||||
/**
|
||||
* 本
|
||||
* 1.当母线大于俩条
|
||||
* 2.当所有母线没有绑定是
|
||||
*/
|
||||
if (collect.size() > 0) {
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
TerminalTree beforeTree = addTree(one.getLogicBefore());
|
||||
TerminalTree nextTree = addTree(one.getLogicNext());
|
||||
upVOList.add(beforeTree);
|
||||
downVOList.add(nextTree);
|
||||
}
|
||||
List<TerminalTree> upList = TreedChildren(upVOList, "变压器上节点设备树", subId);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVOList, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
} else {
|
||||
//查询所有变电站下母线信息
|
||||
List<TerminalTree> upVoltage = lineMapper.getvoltage(subId, 0);
|
||||
if (merge.size() == ids.size()) {
|
||||
String s = mostBefore(pqsTflgasses);
|
||||
downVoltage = downVoltage.stream().filter(x -> x.getId().equals(s)).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
TerminalTree beforeTree = addTree(one.getLogicBefore());
|
||||
TerminalTree nextTree = addTree(one.getLogicNext());
|
||||
upVoltage = upVoltage.stream().filter(x -> !x.getId().equals(beforeTree.getId())).collect(Collectors.toList());
|
||||
upVoltage.add(beforeTree);
|
||||
|
||||
downVoltage.clear();
|
||||
downVoltage.add(nextTree);
|
||||
}
|
||||
List<TerminalTree> upList = TreedChildren(upVoltage, "变压器上节点设备树", null);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVoltage, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
}
|
||||
|
||||
} else {
|
||||
//判断是否已经全部绑定
|
||||
String chain = chain(pqsTflgasses);
|
||||
String chain2 = chain2(pqsTflgasses);
|
||||
if (StrUtil.isNotBlank(chain) && not.size() == 0 && pqsTflgasses.size() + 1 != ids.size() && straddleList.size() == 0
|
||||
|| StrUtil.isNotBlank(chain2) && not.size() == 0 && pqsTflgasses.size() + 1 != ids.size() && straddleList.size() == 0) {
|
||||
List<String> logicBefore = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore).collect(Collectors.toList());
|
||||
List<String> logicNext = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
List<TerminalTree> up = downVoltage.stream().filter(x -> !logicBefore.contains(x.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> upList = TreedChildren(up, "变压器上节点设备树", subId);
|
||||
voltage.put("upNode", upList);
|
||||
|
||||
List<TerminalTree> down = downVoltage.stream().filter(x -> !logicNext.contains(x.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> downList = TreedChildren(down, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
} else {
|
||||
if (downVoltage.size() > 1 && straddleList.size() == 0 && bindList.size() != ids.size()
|
||||
|| straddleList.size() > 0 && not.size() > 0
|
||||
|
||||
) {
|
||||
List<TerminalTree> upVOList;
|
||||
if (straddleList.size() > 0 && not.size() > 0) {
|
||||
String s = mostNext(pqsTflgasses);
|
||||
@@ -263,20 +387,24 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
|
||||
|
||||
//下节点id
|
||||
List<String> downIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
List<TerminalTree> downVOList = downVoltage.stream().filter(x -> !downIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
TerminalTree beforeTree = addTree(one.getLogicBefore());
|
||||
TerminalTree nextTree = addTree(one.getLogicNext());
|
||||
upVOList.add(beforeTree);
|
||||
downVOList.add(nextTree);
|
||||
List<TerminalTree> downVOList = downVoltage.stream().filter(x -> !downIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
if (not.size() == 1) {
|
||||
List<String> logicBefore = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore).collect(Collectors.toList());
|
||||
downVOList = downVOList.stream().filter(x -> !logicBefore.contains(x.getId())).collect(Collectors.toList());
|
||||
}
|
||||
List<TerminalTree> upList = TreedChildren(upVOList, "变压器上节点设备树", subId);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVOList, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
} else {
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨
|
||||
* 1.当母线小于2条跨
|
||||
* 2.当所有母线都绑定为跨
|
||||
*/
|
||||
else {
|
||||
//查询所有变电站下母线信息
|
||||
List<TerminalTree> upVoltage = lineMapper.getvoltage(subId, 0);
|
||||
if (merge.size() == ids.size()) {
|
||||
@@ -284,304 +412,231 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
|
||||
downVoltage = downVoltage.stream().filter(x -> x.getId().equals(s)).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
TerminalTree beforeTree = addTree(one.getLogicBefore());
|
||||
TerminalTree nextTree = addTree(one.getLogicNext());
|
||||
upVoltage = upVoltage.stream().filter(x -> !x.getId().equals(beforeTree.getId())).collect(Collectors.toList());
|
||||
upVoltage.add(beforeTree);
|
||||
//下节点id
|
||||
List<String> downIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
List<TerminalTree> downVOList = downVoltage.stream().filter(x -> !downIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
|
||||
downVoltage.clear();
|
||||
downVoltage.add(nextTree);
|
||||
}
|
||||
List<TerminalTree> upList = TreedChildren(upVoltage, "变压器上节点设备树", null);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVoltage, "变压器下节点设备树", subId);
|
||||
List<TerminalTree> downList = TreedChildren(downVOList, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
}
|
||||
}
|
||||
}
|
||||
return voltage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TerminalTree> getTransformerTree() {
|
||||
List<TerminalTree> terminalTrees = this.baseMapper.listTransformer();
|
||||
return TreedChildren(terminalTrees, "变压器设备树", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityLogicDTO> getLogic() {
|
||||
return pqsTflgassMapper.getLogic();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部子节点
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2021/7/19
|
||||
*/
|
||||
public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) {
|
||||
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化设备树
|
||||
*
|
||||
* @param children 子节点
|
||||
* @param name 节点名称
|
||||
* @param subId 不为空则只展示,当前变电站节点的信息,为空则展示所有信息
|
||||
* @return
|
||||
*/
|
||||
public List<TerminalTree> TreedChildren(List<TerminalTree> children, String name, String subId) {
|
||||
List<TerminalTree> taiZhang = new ArrayList<>();
|
||||
List<TerminalTree> allList = lineMapper.getAllList();
|
||||
|
||||
List<TerminalTree> gdList;
|
||||
List<TerminalTree> subList;
|
||||
List<TerminalTree> provinceList;
|
||||
if (StrUtil.isBlank(subId)) {
|
||||
subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
provinceList = lineMapper.getProvinceList(null, 0);
|
||||
} else {
|
||||
subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())
|
||||
&& item.getId().equals(subId)
|
||||
).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())
|
||||
&& item.getId().equals(subList.get(0).getPid())
|
||||
).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
provinceList = lineMapper.getProvinceList(Arrays.asList(gdList.get(0).getPid()), 1);
|
||||
}
|
||||
List<TerminalTree> terminal = children.stream().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
subList.forEach(sub -> sub.setChildren(getChildren(sub, terminal)));
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
|
||||
if (CollectionUtil.isNotEmpty(allList)) {
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setId("9999999");
|
||||
terminalTree.setLevel(0);
|
||||
terminalTree.setName(name);
|
||||
if (CollectionUtil.isNotEmpty(provinceList)) {
|
||||
terminalTree.setChildren(provinceList);
|
||||
}
|
||||
taiZhang.add(terminalTree);
|
||||
}
|
||||
return taiZhang;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找最顶层节点信息
|
||||
*
|
||||
* @param pqsTflgasses
|
||||
* @return
|
||||
*/
|
||||
private static String mostBefore(List<PqsTflgass> pqsTflgasses) {
|
||||
String logicBefore = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的上节点判断是否存在,这上节点是否是尾节点
|
||||
if (ObjectUtil.isNull(logicBefore)) {
|
||||
logicBefore = pqsTflgass.getLogicBefore();
|
||||
} else {
|
||||
//判断是否已经全部绑定
|
||||
String chain = chain(pqsTflgasses);
|
||||
String chain2 = chain2(pqsTflgasses);
|
||||
if (StrUtil.isNotBlank(chain) && not.size() == 0&& pqsTflgasses.size()+1!=ids.size()&&straddleList.size()==0
|
||||
|| StrUtil.isNotBlank(chain2) && not.size() == 0&& pqsTflgasses.size()+1!=ids.size()&&straddleList.size()==0) {
|
||||
List<String> logicBefore = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore).collect(Collectors.toList());
|
||||
List<String> logicNext = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
List<TerminalTree> up = downVoltage.stream().filter(x -> !logicBefore.contains(x.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> upList = TreedChildren(up, "变压器上节点设备树", subId);
|
||||
voltage.put("upNode", upList);
|
||||
|
||||
List<TerminalTree> down = downVoltage.stream().filter(x -> !logicNext.contains(x.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> downList = TreedChildren(down, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
} else {
|
||||
if (downVoltage.size() > 1 && straddleList.size() == 0 && bindList.size() != ids.size()
|
||||
|| straddleList.size() > 0 && not.size() > 0
|
||||
|
||||
) {
|
||||
List<TerminalTree> upVOList;
|
||||
if (straddleList.size() > 0 && not.size() > 0) {
|
||||
String s = mostNext(pqsTflgasses);
|
||||
upVOList = downVoltage.stream().filter(x -> s.equals(x.getId())).collect(Collectors.toList());
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
if (logicBefore.equals(logicNext)) {
|
||||
logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
break;
|
||||
} else {
|
||||
//上节点id
|
||||
List<String> upIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore).collect(Collectors.toList());
|
||||
upVOList = downVoltage.stream().filter(x -> !upIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
if (i1 == pqsTflgasses.size()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//下节点id
|
||||
List<String> downIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
|
||||
List<TerminalTree> downVOList = downVoltage.stream().filter(x -> !downIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
if(not.size() ==1){
|
||||
List<String> logicBefore = pqsTflgasses.stream().map(PqsTflgass::getLogicBefore).collect(Collectors.toList());
|
||||
downVOList = downVOList.stream().filter(x -> !logicBefore.contains(x.getId())).collect(Collectors.toList());
|
||||
}
|
||||
List<TerminalTree> upList = TreedChildren(upVOList, "变压器上节点设备树", subId);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVOList, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨
|
||||
* 1.当母线小于2条跨
|
||||
* 2.当所有母线都绑定为跨
|
||||
*/
|
||||
else {
|
||||
//查询所有变电站下母线信息
|
||||
List<TerminalTree> upVoltage = lineMapper.getvoltage(subId, 0);
|
||||
if (merge.size() == ids.size()) {
|
||||
String s = mostBefore(pqsTflgasses);
|
||||
downVoltage = downVoltage.stream().filter(x -> x.getId().equals(s)).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
//下节点id
|
||||
List<String> downIDs = pqsTflgasses.stream().map(PqsTflgass::getLogicNext).collect(Collectors.toList());
|
||||
List<TerminalTree> downVOList = downVoltage.stream().filter(x -> !downIDs.contains(x.getId())).collect(Collectors.toList());
|
||||
|
||||
List<TerminalTree> upList = TreedChildren(upVoltage, "变压器上节点设备树", null);
|
||||
voltage.put("upNode", upList);
|
||||
List<TerminalTree> downList = TreedChildren(downVOList, "变压器下节点设备树", subId);
|
||||
voltage.put("downNode", downList);
|
||||
return voltage;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return voltage;
|
||||
}
|
||||
return logicBefore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TerminalTree> getTransformerTree() {
|
||||
List<TerminalTree> terminalTrees = this.baseMapper.listTransformer();
|
||||
return TreedChildren(terminalTrees, "变压器设备树", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityLogicDTO> getLogic() {
|
||||
return pqsTflgassMapper.getLogic();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部子节点
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2021/7/19
|
||||
*/
|
||||
public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) {
|
||||
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化设备树
|
||||
*
|
||||
* @param children 子节点
|
||||
* @param name 节点名称
|
||||
* @param subId 不为空则只展示,当前变电站节点的信息,为空则展示所有信息
|
||||
* @return
|
||||
*/
|
||||
public List<TerminalTree> TreedChildren(List<TerminalTree> children, String name, String subId) {
|
||||
List<TerminalTree> taiZhang = new ArrayList<>();
|
||||
List<TerminalTree> allList = lineMapper.getAllList();
|
||||
|
||||
List<TerminalTree> gdList;
|
||||
List<TerminalTree> subList;
|
||||
List<TerminalTree> provinceList;
|
||||
if (StrUtil.isBlank(subId)) {
|
||||
subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
provinceList = lineMapper.getProvinceList(null, 0);
|
||||
/**
|
||||
* 查找最底层节点信息
|
||||
*
|
||||
* @param pqsTflgasses
|
||||
* @return
|
||||
*/
|
||||
private static String mostNext(List<PqsTflgass> pqsTflgasses) {
|
||||
String logicNext = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的上节点判断是否存在,这上节点是否是尾节点
|
||||
if (ObjectUtil.isNull(logicNext)) {
|
||||
logicNext = pqsTflgass.getLogicNext();
|
||||
} else {
|
||||
subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())
|
||||
&& item.getId().equals(subId)
|
||||
).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())
|
||||
&& item.getId().equals(subList.get(0).getPid())
|
||||
).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
provinceList = lineMapper.getProvinceList(Arrays.asList(gdList.get(0).getPid()), 1);
|
||||
}
|
||||
List<TerminalTree> terminal = children.stream().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
subList.forEach(sub -> sub.setChildren(getChildren(sub, terminal)));
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
|
||||
if (CollectionUtil.isNotEmpty(allList)) {
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setId("9999999");
|
||||
terminalTree.setLevel(0);
|
||||
terminalTree.setName(name);
|
||||
if (CollectionUtil.isNotEmpty(provinceList)) {
|
||||
terminalTree.setChildren(provinceList);
|
||||
}
|
||||
taiZhang.add(terminalTree);
|
||||
}
|
||||
return taiZhang;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找最顶层节点信息
|
||||
*
|
||||
* @param pqsTflgasses
|
||||
* @return
|
||||
*/
|
||||
private static String mostBefore(List<PqsTflgass> pqsTflgasses) {
|
||||
String logicBefore = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的上节点判断是否存在,这上节点是否是尾节点
|
||||
if (ObjectUtil.isNull(logicBefore)) {
|
||||
logicBefore = pqsTflgass.getLogicBefore();
|
||||
} else {
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
if (logicBefore.equals(logicNext)) {
|
||||
logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
if (logicNext.equals(logicBefore)) {
|
||||
logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size()) {
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logicBefore;
|
||||
}
|
||||
return logicNext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找最底层节点信息
|
||||
*
|
||||
* @param pqsTflgasses
|
||||
* @return
|
||||
*/
|
||||
private static String mostNext(List<PqsTflgass> pqsTflgasses) {
|
||||
String logicNext = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的上节点判断是否存在,这上节点是否是尾节点
|
||||
if (ObjectUtil.isNull(logicNext)) {
|
||||
logicNext = pqsTflgass.getLogicNext();
|
||||
} else {
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
if (logicNext.equals(logicBefore)) {
|
||||
logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size()) {
|
||||
break;
|
||||
}
|
||||
/**
|
||||
* 判断是否已经成为链行
|
||||
*
|
||||
* @param pqsTflgasses
|
||||
* @return
|
||||
*/
|
||||
private static String chain(List<PqsTflgass> pqsTflgasses) {
|
||||
if (pqsTflgasses.size() < 2) {
|
||||
return null;
|
||||
}
|
||||
String logicNext = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的下节点判断是否存在,这下节点是否是首节点
|
||||
if (ObjectUtil.isNull(logicNext)) {
|
||||
logicNext = pqsTflgass.getLogicNext();
|
||||
} else {
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
if (logicNext.equals(logicBefore)) {
|
||||
logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size() - 1) {
|
||||
return logicNext;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logicNext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否已经成为链行
|
||||
*
|
||||
* @param pqsTflgasses
|
||||
* @return
|
||||
*/
|
||||
private static String chain(List<PqsTflgass> pqsTflgasses) {
|
||||
if(pqsTflgasses.size()<2){
|
||||
return null;
|
||||
}
|
||||
String logicNext = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的下节点判断是否存在,这下节点是否是首节点
|
||||
if (ObjectUtil.isNull(logicNext)) {
|
||||
logicNext = pqsTflgass.getLogicNext();
|
||||
} else {
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
if (logicNext.equals(logicBefore)) {
|
||||
logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size() - 1) {
|
||||
return logicNext;
|
||||
}
|
||||
}
|
||||
return logicNext;
|
||||
}
|
||||
|
||||
private static String chain2(List<PqsTflgass> pqsTflgasses) {
|
||||
if (pqsTflgasses.size() < 2) {
|
||||
return null;
|
||||
}
|
||||
String logicBefore = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的下节点判断是否存在,这下节点是否是首节点
|
||||
if (ObjectUtil.isNull(logicBefore)) {
|
||||
logicBefore = pqsTflgass.getLogicBefore();
|
||||
} else {
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
if (logicBefore.equals(logicNext)) {
|
||||
logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size() - 1) {
|
||||
return logicBefore;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logicNext;
|
||||
}
|
||||
|
||||
private static String chain2(List<PqsTflgass> pqsTflgasses) {
|
||||
if(pqsTflgasses.size()<2){
|
||||
return null;
|
||||
}
|
||||
String logicBefore = null;
|
||||
for (PqsTflgass pqsTflgass : pqsTflgasses) {
|
||||
//根据获取的的下节点判断是否存在,这下节点是否是首节点
|
||||
if (ObjectUtil.isNull(logicBefore)) {
|
||||
logicBefore = pqsTflgass.getLogicBefore();
|
||||
} else {
|
||||
while (true) {
|
||||
for (int i1 = 0; i1 < pqsTflgasses.size(); i1++) {
|
||||
String logicNext = pqsTflgasses.get(i1).getLogicNext();
|
||||
if (logicBefore.equals(logicNext)) {
|
||||
logicBefore = pqsTflgasses.get(i1).getLogicBefore();
|
||||
break;
|
||||
} else {
|
||||
if (i1 == pqsTflgasses.size() - 1) {
|
||||
return logicBefore;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return logicBefore;
|
||||
}
|
||||
return logicBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据母线获取信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public TerminalTree addTree(String id) {
|
||||
List<TerminalTree> getvoltage = lineMapper.getvoltage(id, 2);
|
||||
getvoltage.get(0).setLevel(5);
|
||||
return getvoltage.get(0);
|
||||
}
|
||||
/**
|
||||
* 根据母线获取信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public TerminalTree addTree(String id) {
|
||||
List<TerminalTree> getvoltage = lineMapper.getvoltage(id, 2);
|
||||
getvoltage.get(0).setLevel(5);
|
||||
return getvoltage.get(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
|
||||
import com.njcn.device.pq.pojo.dto.MonitorIntegrityDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
||||
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
|
||||
import com.njcn.device.pq.service.IRStatIntegrityDService;
|
||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
@@ -44,11 +54,11 @@ import java.util.stream.Collectors;
|
||||
public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMapper, RStatIntegrityD> implements IRStatIntegrityDService {
|
||||
|
||||
private final RStatOnlinerateDMapper onlineRateMapper;
|
||||
|
||||
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
private final GeneralDeviceService deviceService;
|
||||
private final LineService lineService;
|
||||
|
||||
@Override
|
||||
public Float getTotalIntegrityByLineIds(LineBaseQueryParam param) {
|
||||
@@ -125,4 +135,79 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
||||
this.saveOrUpdateBatchByMultiId(collect1,200);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceOnlineRate getData(DeviceInfoParam.BusinessParam param) {
|
||||
DeviceOnlineRate rate = new DeviceOnlineRate();
|
||||
//获取终端台账类信息
|
||||
List<GeneralDeviceDTO> deviceInfo = deviceService.getDeviceInfo(param, null, Collections.singletonList(1));
|
||||
if (CollUtil.isNotEmpty(deviceInfo)) {
|
||||
List<String> lineIds = deviceInfo.stream()
|
||||
.flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList())
|
||||
.stream()
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
rate.setTotalNum(lineIds.size());
|
||||
//获取所有监测点的数据完整性
|
||||
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(lineIds,param.getSearchBeginTime(),param.getSearchEndTime());
|
||||
//获取所有监测点信息信息
|
||||
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(lineIds);
|
||||
|
||||
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo)?calculateIntegrityRate(lineIntegrityRateInfo,90):lineIds.size());
|
||||
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo,lineIds).toString());
|
||||
List<DeviceOnlineRate.CitDetail> citDetailList=new ArrayList<>();
|
||||
DeviceOnlineRate.CitDetail citDetail;
|
||||
DeviceOnlineRate.LineDetail detail;
|
||||
for (GeneralDeviceDTO dto : deviceInfo) {
|
||||
//获取部门终端集合
|
||||
List<RStatIntegrityVO> citDevOnRate = lineIntegrityRateInfo.stream().filter(x -> dto.getLineIndexes().contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
Map<String, Double> onlineRateByDevMap = citDevOnRate.stream()
|
||||
.collect(Collectors.toMap(RStatIntegrityVO::getLineIndex, RStatIntegrityVO::getIntegrityRate));
|
||||
citDetail=new DeviceOnlineRate.CitDetail();
|
||||
citDetail.setCitName(dto.getName());
|
||||
citDetail.setCitTotalNum(dto.getLineIndexes().size());
|
||||
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate)?calculateIntegrityRate(lineIntegrityRateInfo,90):dto.getLineIndexes().size());
|
||||
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo,dto.getLineIndexes()).toString());
|
||||
List<DeviceOnlineRate.LineDetail> detailList = new ArrayList<>();
|
||||
List<LineDetailVO.Detail> lineDetail = LineInfoByIds.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||
for (LineDetailVO.Detail line : lineDetail) {
|
||||
detail = new DeviceOnlineRate.LineDetail();
|
||||
detail.setCit(line.getDeptName());
|
||||
detail.setCompany(line.getGdName());
|
||||
detail.setSubStation(line.getSubName());
|
||||
detail.setDeviceId(line.getDevId());
|
||||
detail.setDeviceName(line.getDevName());
|
||||
detail.setManufacturer(line.getManufacturer());
|
||||
detail.setIp(line.getIp());
|
||||
detail.setRunFlag(RunFlagEnum.getRunFlagRemarkByStatus(Integer.valueOf(line.getLineRunType())));
|
||||
detail.setLineId(line.getLineId());
|
||||
detail.setLineName(line.getLineName());
|
||||
detail.setLatestTime(line.getTimeID());
|
||||
detail.setIntegrity(onlineRateByDevMap.getOrDefault(line.getLineId(), 0.0));
|
||||
detailList.add(detail);
|
||||
}
|
||||
citDetail.setDetailList(detailList);
|
||||
citDetailList.add(citDetail);
|
||||
}
|
||||
rate.setCitDetailList(citDetailList);
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
private Double calculateIntegrityRate(List<RStatIntegrityVO> lineIntegrityRateInfo ,List<String> deviceIds){
|
||||
List<RStatIntegrityVO> list = lineIntegrityRateInfo.stream().filter(x -> deviceIds.contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
BigDecimal onlineMin = BigDecimal.valueOf(list.stream().mapToLong(RStatIntegrityVO::getDueTime).sum());
|
||||
BigDecimal offlineMin =BigDecimal.valueOf( list.stream().mapToLong(RStatIntegrityVO::getRealTime).sum());
|
||||
BigDecimal sumMin= onlineMin.add(offlineMin);
|
||||
return sumMin.doubleValue();
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
private Integer calculateIntegrityRate(List<RStatIntegrityVO> onlineRateByDev,Integer limit){
|
||||
return (int) onlineRateByDev.stream().filter(x -> x.getIntegrityRate() < limit).count();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,11 +8,13 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.common.service.TerminalBaseService;
|
||||
import com.njcn.device.device.mapper.DeviceMapper;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.DeviceMapper;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.RunManageParam;
|
||||
@@ -22,12 +24,9 @@ import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunManageVO;
|
||||
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalLedgerVO;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.device.pq.service.RunManageService;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
@@ -134,11 +133,6 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||
deviceInfoParam.setServerName("pqs-common");
|
||||
if(CollUtil.isNotEmpty(runManageParam.getRunFlag())){
|
||||
if(runManageParam.getRunFlag().get(0)==0){
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
}
|
||||
}
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
||||
if (CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||
throw new BusinessException("当前部门没有装置台账");
|
||||
|
||||
@@ -4,13 +4,14 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.common.service.TerminalBaseService;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.vo.CommunicateVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.pq.service.ISubstationExpendService;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||
|
||||
@@ -5,22 +5,19 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.SubstationMapper;
|
||||
import com.njcn.device.pq.mapper.VoltageMapper;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.pojo.po.Voltage;
|
||||
import com.njcn.device.pq.pojo.vo.LedgerSelectVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
|
||||
@@ -3,16 +3,18 @@ package com.njcn.device.pq.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.pojo.vo.TerminalSelectTreeVO;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.DeptLineMapper;
|
||||
import com.njcn.device.pq.mapper.LineDetailMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.TreeMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
@@ -25,7 +27,6 @@ import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -138,7 +139,12 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){
|
||||
List<TerminalTree> list = new ArrayList<>();
|
||||
|
||||
//电网侧
|
||||
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
|
||||
if(CollectionUtil.isNotEmpty(devTree)){
|
||||
list.addAll(devTree);
|
||||
}
|
||||
//非电网侧
|
||||
if(CollUtil.isNotEmpty(userReportPOList)) {
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
@@ -160,6 +166,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
busCopy.setName(it.getName());
|
||||
busCopy.setId(it.getId());
|
||||
busCopy.setPid(it.getPid());
|
||||
busCopy.setSort(it.getSort());
|
||||
busCopy.setChildren(getChildren(it, lineList));
|
||||
busCopy.setPowerFlag(1);
|
||||
busCopy.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
|
||||
@@ -175,6 +182,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
devCopy.setName(it.getName());
|
||||
devCopy.setId(it.getId());
|
||||
devCopy.setPid(it.getPid());
|
||||
devCopy.setSort(it.getSort());
|
||||
devCopy.setChildren(getChildren(it, temBus));
|
||||
devCopy.setPowerFlag(1);
|
||||
devCopy.setLevel(LineBaseEnum.DEVICE_LEVEL.getCode());
|
||||
@@ -192,18 +200,11 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
terminalTree.setPowerFlag(1);
|
||||
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||
terminalTree.setChildren(temDevList);
|
||||
terminalTree.setSort(0);
|
||||
list.add(terminalTree);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
|
||||
if(CollectionUtil.isNotEmpty(devTree)){
|
||||
list.addAll(devTree);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -521,6 +522,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
sub.setId(collect.get(0).getId());
|
||||
sub.setName(collect.get(0).getName());
|
||||
sub.setPid(collect.get(0).getPid());
|
||||
sub.setSort(0);
|
||||
sub.setChildren(valueList);
|
||||
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
@@ -551,7 +553,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
sub.setId(child.getId());
|
||||
sub.setName(child.getName());
|
||||
sub.setPid(child.getPid());
|
||||
|
||||
sub.setSort(0);
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(child.getId());
|
||||
@@ -581,7 +583,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
sub.setId(child.getId());
|
||||
sub.setName(child.getName());
|
||||
sub.setPid(child.getPid());
|
||||
|
||||
sub.setSort(0);
|
||||
TerminalTree powerTree = new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(child.getId());
|
||||
@@ -620,7 +622,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
sub.setId(notSub.getId());
|
||||
sub.setName(notSub.getName());
|
||||
sub.setPid(notSub.getPid());
|
||||
|
||||
sub.setSort(0);
|
||||
TerminalTree powerTree = new TerminalTree();
|
||||
powerTree.setId(notSub.getId());
|
||||
powerTree.setName("电网侧");
|
||||
@@ -655,6 +657,49 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
return taiZhang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TerminalTree> getJbNewTerminalTree() {
|
||||
List<TerminalTree> allList = lineMapper.getAllList();
|
||||
List<TerminalTree> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> provinceList = lineMapper.getProvinceList(null, 0);
|
||||
|
||||
List<TerminalTree> gdList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> devList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
List<TerminalTree> linepowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() != 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> lineNotPowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() == 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
subvList.forEach(subv ->{
|
||||
if(CollUtil.isEmpty(subv.getChildren())){
|
||||
subv.setChildren(getRecursionChildren(subv, linepowerList));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
subvList.forEach(subv -> {
|
||||
if(CollUtil.isEmpty(subv.getChildren())){
|
||||
subv.setChildren(getRecursionChildren(subv, lineNotPowerList));
|
||||
}
|
||||
}
|
||||
);
|
||||
subvList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
|
||||
devList.forEach(dev -> dev.setChildren(getRecursionChildren(dev, subvList)));
|
||||
devList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
|
||||
|
||||
|
||||
|
||||
subList.forEach(sub -> sub.setChildren(getRecursionChildrenCs(sub, devList)));
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
projectList.forEach(project -> project.setChildren(getChildren(project, provinceList)));
|
||||
|
||||
return projectList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部子节点
|
||||
@@ -663,7 +708,40 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
* @date 2021/7/19
|
||||
*/
|
||||
public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) {
|
||||
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
long sortSize = collect.stream().filter(x->ObjUtil.isNotNull(x.getSort())).filter(x -> x.getSort() == 0).count();
|
||||
if(collect.size()-sortSize/collect.size()>50){
|
||||
collect.sort(Comparator.comparing(x->x.getName()));
|
||||
}
|
||||
}
|
||||
return collect;
|
||||
}
|
||||
|
||||
public List<TerminalTree> getRecursionChildrenCs(TerminalTree item, List<TerminalTree> all){
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> list=new ArrayList<>();
|
||||
TerminalTree power=new TerminalTree();
|
||||
power.setName("电网侧");
|
||||
power.setSort(0);
|
||||
power.setChildren(collect.stream().filter(x -> 1 != x.getPowerFlag()).collect(Collectors.toList()));
|
||||
list.add(power);
|
||||
|
||||
|
||||
|
||||
TerminalTree notPower=new TerminalTree();
|
||||
notPower.setName("非电网侧");
|
||||
notPower.setSort(1);
|
||||
notPower.setChildren(collect.stream().filter(x -> 1 == x.getPowerFlag()).collect(Collectors.toList()));
|
||||
list.add(notPower);
|
||||
return list;
|
||||
}
|
||||
public List<TerminalTree> getRecursionChildren(TerminalTree item, List<TerminalTree> all){
|
||||
List<TerminalTree> list = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
item.setPowerFlag(list.get(0).getPowerFlag());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,13 +5,13 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.biz.pojo.dto.SubGetBase;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.pq.mapper.SubstationMapper;
|
||||
import com.njcn.device.pq.mapper.YwZtSubstationMapper;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.pojo.po.YwZtSubstation;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
import com.njcn.device.pq.service.IYwZtSubstationService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
|
||||
53
pqs-device/pq-device/pq-device-com/pom.xml
Normal file
53
pqs-device/pq-device/pq-device-com/pom.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pq-device-com</artifactId>
|
||||
<name>传统设备通用业务</name>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-web</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>supervision-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
package com.njcn.device.common.mapper;
|
||||
|
||||
|
||||
import com.njcn.device.pq.pojo.param.BaseReamParam;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
package com.njcn.device.common.mapper;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.SuperDataMapper">
|
||||
<mapper namespace="com.njcn.device.common.mapper.SuperDataMapper">
|
||||
|
||||
|
||||
<select id="getPointSuper" resultType="com.njcn.device.pq.pojo.param.SuperDataParam">
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.TopMsgMapper">
|
||||
<mapper namespace="com.njcn.device.common.mapper.TopMsgMapper">
|
||||
|
||||
<select id="dailyDeviceAbnormalStatistics" resultType="com.njcn.device.pq.pojo.po.TopMsgPO">
|
||||
SELECT
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.device.common.mapper.onlinerate;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 在线率日表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-03-28
|
||||
*/
|
||||
public interface OnLineRateMapper extends BaseMapper<RStatOnlinerateD> {
|
||||
|
||||
/***
|
||||
* 获取设备在线率
|
||||
* @author wr
|
||||
* @date 2023-04-03 10:10
|
||||
* @param param
|
||||
* @return List<OnlineRate>
|
||||
*/
|
||||
List<RStatOnlinerateVO> getOnlineRateByDevIds(@Param("param") OnlineRateParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.common.mapper.onlinerate.OnLineRateMapper">
|
||||
<select id="getOnlineRateByDevIds" resultType="com.njcn.device.pq.pojo.vo.RStatOnlinerateVO">
|
||||
select
|
||||
dev_index,
|
||||
sum(online_min) as onlineMin,
|
||||
sum(offline_min) as offlineMin,
|
||||
ROUND( sum(online_min)*1.0/(sum(online_min) + sum(offline_min))*100,2) as onlineRate
|
||||
from r_stat_onlinerate_d
|
||||
<where>
|
||||
<if test="param!=null and param.ids != null and param.ids.size > 0">
|
||||
AND dev_index IN
|
||||
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test=" param.startTime != null and param.startTime !=''">
|
||||
AND time_id >= #{param.startTime}
|
||||
</if>
|
||||
<if test="param.endTime != null and param.endTime != ''">
|
||||
AND time_id <= #{param.endTime}
|
||||
</if>
|
||||
</where>
|
||||
group by dev_index ;
|
||||
</select>
|
||||
<select id="getTotalOnlineRates" resultType="java.lang.Float">
|
||||
select
|
||||
if( sum( online_min )/( sum( online_min ) + sum( offline_min ))* 100 > 100,
|
||||
100,
|
||||
IFNULL( ROUND( sum( online_min )/( sum( online_min ) + sum( offline_min ))* 100, 2 ), 0 ))
|
||||
as online_rate
|
||||
from r_stat_onlinerate_d
|
||||
<where>
|
||||
<if test="param!=null and param.ids != null and param.ids.size > 0">
|
||||
AND dev_index IN
|
||||
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test=" param.startTime != null and param.startTime !=''">
|
||||
AND time_id >= #{param.startTime}
|
||||
</if>
|
||||
<if test="param.endTime != null and param.endTime != ''">
|
||||
AND time_id <= #{param.endTime}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
package com.njcn.device.common.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -9,24 +9,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.device.common.mapper.TopMsgMapper;
|
||||
import com.njcn.device.device.mapper.DeviceMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.enums.JbPowerFlagEnum;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.mapper.DeviceMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.TopMsgMapper;
|
||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.*;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||
import com.njcn.device.pq.pojo.vo.DeptDeviceDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.DeptSubstationDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.ExceptionDeviceInfoVO;
|
||||
import com.njcn.device.pq.service.DeptLineService;
|
||||
import com.njcn.device.pq.service.TerminalBaseService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -34,6 +35,7 @@ import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -66,11 +68,10 @@ public class GeneralDeviceService {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final DeviceMapper deviceMapper;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final TopMsgMapper topMsgMapper;
|
||||
|
||||
|
||||
@@ -320,7 +321,7 @@ public class GeneralDeviceService {
|
||||
} else {
|
||||
deviceType.setRunFlag(runFlag);
|
||||
}
|
||||
if(ObjectUtil.isNotNull(deviceInfoParam.getComFlagStatus())){
|
||||
if (ObjectUtil.isNotNull(deviceInfoParam.getComFlagStatus())) {
|
||||
deviceType.setComFlag(Arrays.asList(deviceInfoParam.getComFlagStatus()));
|
||||
}
|
||||
filterDataType(deviceType, deviceInfoParam.getServerName());
|
||||
@@ -375,6 +376,8 @@ public class GeneralDeviceService {
|
||||
return filterDataByManufacturer(deviceInfos, deviceInfoParam.getManufacturer());
|
||||
case POWER_FLAG:
|
||||
return filterDataByPowerFlag(deviceInfos, deviceInfoParam.getManufacturer());
|
||||
case JB_POWER_FLAG:
|
||||
return filterDataByJbPowerFlag(deviceInfos, deviceInfoParam.getManufacturer());
|
||||
default:
|
||||
return deviceInfos;
|
||||
}
|
||||
@@ -409,7 +412,7 @@ public class GeneralDeviceService {
|
||||
return generalDeviceDTO;
|
||||
}
|
||||
// 提取该部门及其子部门所有监测点id
|
||||
List<String> lineIds = deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList());
|
||||
List<String> lineIds = deptLines.stream().map(DeptLine::getLineId).distinct().collect(Collectors.toList());
|
||||
// 获取line详细数据 :根据监测点id,获取所有监测点 联查 pq_line、pq_line_detail
|
||||
List<Line> lines = terminalBaseService.getLineByCondition(lineIds, deviceInfoParam);
|
||||
// 返回空数据
|
||||
@@ -418,17 +421,17 @@ public class GeneralDeviceService {
|
||||
}
|
||||
|
||||
//1.筛选出母线id,理论上监测点的pids中第六个id为母线id 联查: pq_line t1 ,pq_voltage t2
|
||||
List<String> voltageIds=lines.stream().map(Line::getPid).collect(Collectors.toList());
|
||||
List<String> voltageIds = lines.stream().map(Line::getPid).distinct().collect(Collectors.toList());
|
||||
//再根据电压等级筛选合法母线信息
|
||||
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, deviceInfoParam.getScale());
|
||||
|
||||
//2.筛选出终端id,理论上监测点的pids中第五个id为终端id
|
||||
List<String> devIds=voltages.stream().map(Line::getPid).collect(Collectors.toList());
|
||||
List<String> devIds = voltages.stream().map(Line::getPid).distinct().collect(Collectors.toList());
|
||||
// 再根据终端条件筛选合法终端信息 联查:pq_line t1,pq_device t2
|
||||
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer());
|
||||
|
||||
//3.筛选出变电站id,理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
|
||||
List<String> subIds=devices.stream().map(Line::getPid).collect(Collectors.toList());
|
||||
List<String> subIds = devices.stream().map(Line::getPid).distinct().collect(Collectors.toList());
|
||||
List<Line> sub = terminalBaseService.getSubByCondition(subIds, new ArrayList<>());
|
||||
|
||||
//筛选最终的数据
|
||||
@@ -453,7 +456,7 @@ public class GeneralDeviceService {
|
||||
String[] idsArray = line.getPids().split(",");
|
||||
//监测点同时满足条件筛选后的终端、母线信息,才是最终的结果
|
||||
if (devIds.contains(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]) &&
|
||||
volIds.contains(idsArray[LineBaseEnum.SUB_V_LEVEL.getCode()])&&
|
||||
volIds.contains(idsArray[LineBaseEnum.SUB_V_LEVEL.getCode()]) &&
|
||||
subIds.contains(idsArray[LineBaseEnum.SUB_LEVEL.getCode()])
|
||||
) {
|
||||
gdIndexes.add(idsArray[LineBaseEnum.GD_LEVEL.getCode()]);
|
||||
@@ -557,8 +560,8 @@ public class GeneralDeviceService {
|
||||
|
||||
private List<GeneralDeviceDTO> filterDataByPowerFlag(List<GeneralDeviceDTO> deviceInfos, List<SimpleDTO> manufacturer) {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOS = new ArrayList<>();
|
||||
List<String> deviceIds = deviceInfos.stream().flatMap(x->x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> lineIds = deviceInfos.stream().flatMap(x->x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> deviceIds = deviceInfos.stream().flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> lineIds = deviceInfos.stream().flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
//监测点为空,则返回空的分类数据
|
||||
if (CollectionUtil.isEmpty(lineIds)) {
|
||||
return assembleCommonData(manufacturer);
|
||||
@@ -567,15 +570,36 @@ public class GeneralDeviceService {
|
||||
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
List<String> powerFlagIds = terminalBaseService.getDeviceIdByPowerFlag(deviceIds, i);
|
||||
dto=new SimpleDTO();
|
||||
dto = new SimpleDTO();
|
||||
PowerFlagEnum enumByCode = PowerFlagEnum.getPowerFlagEnumByCode(i);
|
||||
dto.setId(enumByCode.getCode().toString());
|
||||
dto.setName(enumByCode.getMessage());
|
||||
generalDeviceDTOS.add(assembleDataByLine(dto, lines, powerFlagIds, LineBaseEnum.LINE_LEVEL.getCode()));
|
||||
}
|
||||
|
||||
return generalDeviceDTOS;
|
||||
}
|
||||
|
||||
private List<GeneralDeviceDTO> filterDataByJbPowerFlag(List<GeneralDeviceDTO> deviceInfos, List<SimpleDTO> manufacturer) {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOS = new ArrayList<>();
|
||||
List<String> deviceIds = deviceInfos.stream().flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> lineIds = deviceInfos.stream().flatMap(x -> x.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
//监测点为空,则返回空的分类数据
|
||||
if (CollectionUtil.isEmpty(lineIds)) {
|
||||
return assembleCommonData(manufacturer);
|
||||
}
|
||||
SimpleDTO dto;
|
||||
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
List<String> powerFlagIds = terminalBaseService.getDeviceIdByJbPowerFlag(deviceIds, i);
|
||||
dto = new SimpleDTO();
|
||||
JbPowerFlagEnum enumByCode = JbPowerFlagEnum.getPowerFlagEnumByCode(i);
|
||||
dto.setId(enumByCode.getCode().toString());
|
||||
dto.setName(enumByCode.getMessage());
|
||||
generalDeviceDTOS.add(assembleDataByLine(dto, lines, powerFlagIds, LineBaseEnum.LINE_LEVEL.getCode()));
|
||||
}
|
||||
return generalDeviceDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当该部门不存在监测点时,返回空的分类数据
|
||||
*
|
||||
@@ -725,7 +749,7 @@ public class GeneralDeviceService {
|
||||
/*实际运行*/
|
||||
QueryWrapper<Device> query = new QueryWrapper<>();
|
||||
query.in("Id", DeviceIds).
|
||||
eq("Run_Flag", 0).eq("Com_Flag",1);
|
||||
eq("Run_Flag", 0).eq("Com_Flag", 1);
|
||||
Integer runDeviceCount = deviceMapper.selectCount(query);
|
||||
BigDecimal rate = BigDecimal.valueOf(runDeviceCount).divide(BigDecimal.valueOf(deviceCount), 4, BigDecimal.ROUND_HALF_UP);
|
||||
deptDeviceDetailVO.setDeviceCount(deviceCount);
|
||||
@@ -757,17 +781,17 @@ public class GeneralDeviceService {
|
||||
|
||||
|
||||
/**
|
||||
* @param deptId 部门id
|
||||
* @param runFlag 设备运行状态 0:投运 1.热备用 2.停运
|
||||
* @param deptId 部门id
|
||||
* @param runFlag 设备运行状态 0:投运 1.热备用 2.停运
|
||||
* @param dataType 系统 0:暂态系统;1:稳态系统;2:两个系统
|
||||
* @author cdf
|
||||
* @date 2023/7/20
|
||||
*/
|
||||
public List<String> deptGetRunLine(String deptId,List<Integer> runFlag,List<Integer> dataType) {
|
||||
public List<String> deptGetRunLine(String deptId, List<Integer> runFlag, List<Integer> dataType) {
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptId, Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
if (CollUtil.isNotEmpty(deptDTOList)) {
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).distinct().collect(Collectors.toList());
|
||||
return deptLineService.getLineByDeptIds(deptIds,null,runFlag,dataType,null);
|
||||
return deptLineService.getLineByDeptIds(deptIds, null, runFlag, dataType, null);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -779,12 +803,12 @@ public class GeneralDeviceService {
|
||||
* @date 2023/7/20
|
||||
*/
|
||||
public List<String> deptGetRunDev(String deptId) {
|
||||
List<String> runLineIds = this.deptGetRunLine(deptId,Stream.of(0).collect(Collectors.toList()),Stream.of(0,2).collect(Collectors.toList()));
|
||||
List<String> runLineIds = this.deptGetRunLine(deptId, Stream.of(0).collect(Collectors.toList()), Stream.of(0, 2).collect(Collectors.toList()));
|
||||
List<Line> lines = lineMapper.selectList(new LambdaQueryWrapper<Line>()
|
||||
.select(Line::getPids)
|
||||
.in(Line::getId,runLineIds)
|
||||
.select(Line::getPids)
|
||||
.in(Line::getId, runLineIds)
|
||||
);
|
||||
if(CollUtil.isNotEmpty(lines)){
|
||||
if (CollUtil.isNotEmpty(lines)) {
|
||||
return lines.stream().map(line -> {
|
||||
String[] idsArray = line.getPids().split(",");
|
||||
return idsArray[4];
|
||||
@@ -797,12 +821,25 @@ public class GeneralDeviceService {
|
||||
List<DictData> gradeType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_GRADE.getCode()).getData();
|
||||
Map<String, Integer> gradeMap = gradeType.stream().collect(Collectors.toMap(DictData::getId, DictData::getAlgoDescribe));
|
||||
|
||||
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_MANUFACTURER.getCode()).getData();
|
||||
Map<String, String> manufacturerMap = manufacturerList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String, String> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
List<DevDetail> devDetails = deviceMapper.selectDevByIds(devIds);
|
||||
for (DevDetail devDetail : devDetails) {
|
||||
//终端等级
|
||||
if(gradeMap.containsKey(devDetail.getLineGrade())){
|
||||
if (gradeMap.containsKey(devDetail.getLineGrade())) {
|
||||
devDetail.setLineGrade(String.valueOf(gradeMap.get(devDetail.getLineGrade())));
|
||||
}
|
||||
//部门
|
||||
if (deptMap.containsKey(devDetail.getDeptName())) {
|
||||
devDetail.setDeptName(deptMap.get(devDetail.getDeptName()));
|
||||
}
|
||||
//终端厂商
|
||||
if (manufacturerMap.containsKey(devDetail.getManufacturer())) {
|
||||
devDetail.setManufacturer(manufacturerMap.get(devDetail.getManufacturer()));
|
||||
}
|
||||
}
|
||||
return devDetails;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.service;
|
||||
package com.njcn.device.common.service;
|
||||
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
@@ -8,7 +8,6 @@ import com.njcn.device.pq.pojo.dto.PreCommandDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PushResultDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.DevStatusNumVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineWiringDiagramVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalVO;
|
||||
@@ -189,6 +188,8 @@ public interface TerminalBaseService {
|
||||
*/
|
||||
List<String> getDeviceIdByPowerFlag(List<String> lineIds, Integer manufacturer);
|
||||
|
||||
List<String> getDeviceIdByJbPowerFlag(List<String> lineIds, Integer powerFlag);
|
||||
|
||||
|
||||
/**
|
||||
* 根据监测点集合查询基础信息
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
package com.njcn.device.common.service.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
@@ -16,9 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -32,10 +29,22 @@ import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.biz.pojo.po.DeviceBak;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.device.common.mapper.SuperDataMapper;
|
||||
import com.njcn.device.common.service.TerminalBaseService;
|
||||
import com.njcn.device.device.mapper.DevFuctionMapper;
|
||||
import com.njcn.device.device.mapper.DeviceMapper;
|
||||
import com.njcn.device.device.service.DeviceBakService;
|
||||
import com.njcn.device.device.service.DeviceProcessService;
|
||||
import com.njcn.device.device.service.NodeDeviceService;
|
||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.LineBakService;
|
||||
import com.njcn.device.node.service.INodeService;
|
||||
import com.njcn.device.overlimit.mapper.OverlimitMapper;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
|
||||
import com.njcn.device.pq.mapper.*;
|
||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||
import com.njcn.device.pq.pojo.bo.excel.NodeExcel;
|
||||
@@ -47,9 +56,11 @@ import com.njcn.device.pq.pojo.param.*;
|
||||
import com.njcn.device.pq.pojo.param.oracle.*;
|
||||
import com.njcn.device.pq.pojo.po.*;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.*;
|
||||
import com.njcn.device.pq.utils.DeviceUtil;
|
||||
import com.njcn.device.pq.utils.ExcelStyleUtil;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.utils.ExcelStyleUtil;
|
||||
import com.njcn.message.api.ProduceFeignClient;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
import com.njcn.message.constant.RedisKeyPrefix;
|
||||
@@ -63,12 +74,10 @@ import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -92,8 +101,6 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -1659,6 +1666,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
return this.baseMapper.getDeviceIdByPowerFlag(lineIds, manufacturer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDeviceIdByJbPowerFlag(List<String> lineIds, Integer powerFlag) {
|
||||
return this.baseMapper.getDeviceIdByJbPowerFlag(lineIds, powerFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseLineInfo> getBaseLineInfo(List<String> lineIndex) {
|
||||
return this.baseMapper.getBaseLineInfo(lineIndex);
|
||||
@@ -4129,8 +4141,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
pushResultDTO.setCode("2");
|
||||
pushResultDTO.setResult("");
|
||||
}else {
|
||||
|
||||
|
||||
TopicReplyDTO topicReplyDTO =JSONObject.parseObject(stringByKey,TopicReplyDTO.class);
|
||||
pushResultDTO.setCode("1");
|
||||
pushResultDTO.setResult(topicReplyDTO.getResult());
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
package com.njcn.device.device.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
@@ -12,6 +12,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
import com.njcn.device.pq.pojo.dto.DevComFlagDTO;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceDTO;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -19,8 +21,6 @@ import com.njcn.device.pq.pojo.param.ConstantValueParam;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.vo.DevStatusNumVO;
|
||||
import com.njcn.device.pq.service.IDeviceService;
|
||||
import com.njcn.device.pq.service.impl.GeneralDeviceService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
package com.njcn.device.device.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.device.service.TerminalVersionService;
|
||||
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
|
||||
import com.njcn.device.pq.pojo.po.DevVersion;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalVersionVO;
|
||||
import com.njcn.device.pq.service.TerminalVersionService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/version")
|
||||
@RequiredArgsConstructor
|
||||
public class TerminalVersionController extends BaseController {
|
||||
public class DeviceVersionController extends BaseController {
|
||||
|
||||
private final TerminalVersionService terminalVersionService;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
package com.njcn.device.device.controller;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -6,15 +6,13 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.device.service.NodeDeviceService;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceInfo;
|
||||
import com.njcn.device.pq.pojo.dto.NodeProcessDeviceTree;
|
||||
import com.njcn.device.pq.pojo.param.NodeDeviceParam;
|
||||
|
||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||
import com.njcn.device.pq.service.NodeDeviceService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.njcn.device.device.controller;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.device.service.OnLineRateService;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 终端在线率
|
||||
* @Author: wr
|
||||
* @Date: 2025/11/26 10:28
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "终端在线率")
|
||||
@RestController
|
||||
@RequestMapping("/onLineRate")
|
||||
@RequiredArgsConstructor
|
||||
public class OnLineRateController extends BaseController {
|
||||
|
||||
private final OnLineRateService onLineRateService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deviceOnlineRateInfo")
|
||||
@ApiOperation("终端在线率列表(冀北)")
|
||||
public HttpResult<DeviceOnlineRate> deviceOnlineRateInfo(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("deviceOnlineRateInfo");
|
||||
DeviceOnlineRate rate = onLineRateService.deviceOnlineRateInfo(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOnlineRateByDevIds")
|
||||
@ApiOperation("通用终端在线率(冀北)")
|
||||
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("deviceOnlineRateInfo");
|
||||
List<RStatOnlinerateVO> rate = onLineRateService.getOnlineRateByDevIds(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
package com.njcn.device.device.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -10,16 +10,19 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.device.service.PqDevTypeService;
|
||||
import com.njcn.device.pq.pojo.param.PqDevTypeParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.device.pq.service.PqDevTypeService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
package com.njcn.device.device.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -7,9 +7,9 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.device.service.ProgramVersionService;
|
||||
import com.njcn.device.pq.pojo.param.ProgramParam;
|
||||
import com.njcn.device.pq.pojo.vo.VersionVO;
|
||||
import com.njcn.device.pq.service.ProgramVersionService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
package com.njcn.device.device.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
package com.njcn.device.device.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
package com.njcn.device.device.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user