高级算法特征值,暂降事件范围分析代码提交
This commit is contained in:
@@ -33,6 +33,12 @@
|
|||||||
<artifactId>common-microservice</artifactId>
|
<artifactId>common-microservice</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>event-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jna</groupId>
|
<groupId>com.sun.jna</groupId>
|
||||||
<artifactId>jna</artifactId>
|
<artifactId>jna</artifactId>
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ public enum AdvanceResponseEnum {
|
|||||||
|
|
||||||
USER_DATA_P_NODE_PARAMETER_ERROR("A0101","无用采用户或所有用户的完整性均不满足条件"),
|
USER_DATA_P_NODE_PARAMETER_ERROR("A0101","无用采用户或所有用户的完整性均不满足条件"),
|
||||||
|
|
||||||
RESPONSIBILITY_PARAMETER_ERROR("A0101","调用接口程序计算失败,参数非法")
|
RESPONSIBILITY_PARAMETER_ERROR("A0101","调用接口程序计算失败,参数非法"),
|
||||||
|
|
||||||
|
EVENT_EMPTY("A0102","没有查询到未分析事件")
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.njcn.advance.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Sunwei 【sunW2016@163.com】
|
||||||
|
* @Description: 高级分析返回结果
|
||||||
|
* @Date: Create in 9:02 2018/3/6
|
||||||
|
* @Modified By:
|
||||||
|
*/
|
||||||
|
public enum EnumEvt {
|
||||||
|
EVT_NUM("evt_num", "高级算法返回事件个数"), EVT_BUF("evt_buf", "高级算法返回数据"), QVVR_TYPE("qvvr_type", "暂降类型"), POW_A("POW_a",
|
||||||
|
"A相波形起始点"), POW_B("POW_b", "B相波形起始点"), POW_C("POW_c", "C相波形起始点"), SEG_T_IDX("SEG_T_idx",
|
||||||
|
"修正分段位置"), SEG_T_NUM("SEG_T_num", "分段数目"), SEG_RMS_T_NUM("SEG_RMS_T_num", "有效值分段数目"), SEG_RMS_T_IDX(
|
||||||
|
"SEG_RMS_T_idx", "有效值分段位置"), UA_MIN("ua_min", "A相电压特征值"), UB_MIN("ub_min",
|
||||||
|
"B相电压特征值"), UC_MIN("uc_min", "C相电压特征值"), U3_MIN("u3_min",
|
||||||
|
"三相电压特征值"), U_MIN_NUM("u_min_num", "特征值个数"), ORDER_MIN_IDX("order_min_idx",
|
||||||
|
"最小值位置"), HOLD_TIME_RMS("hold_time_rms", "有效值算法持续时间"), HOLD_TIME_DQ(
|
||||||
|
"hold_time_dq",
|
||||||
|
"dq变换算法持续时间"), VOLTAGECHANGE_VA("Voltagechange_Va",
|
||||||
|
"A相跳变段电压变化率"), VOLTAGECHANGE_VB("Voltagechange_Vb",
|
||||||
|
"B相跳变段电压变化率"), VOLTAGECHANGE_VC("Voltagechange_Vc",
|
||||||
|
"C相跳变段电压变化率"), ANGLE_DIFF_AP("angle_diff_ap",
|
||||||
|
"A相相位正跳变"), ANGLE_DIFF_BP("angle_diff_bp",
|
||||||
|
"B相相位正跳变"), ANGLE_DIFF_CP("angle_diff_cp",
|
||||||
|
"C相相位正跳变"), ANGLE_DIFF_AN("angle_diff_an",
|
||||||
|
"A相相位负跳变"), ANGLE_DIFF_BN("angle_diff_bn",
|
||||||
|
"B相相位负跳变"), ANGLE_DIFF_CN("angle_diff_cn",
|
||||||
|
"C相相位负跳变"), BPH_MAX_VALUE("bph_max_value",
|
||||||
|
"不平衡度"), QVVR_CATA_CAUSE("qvvr_cata_cause",
|
||||||
|
"暂降原因"), QVVR_PHASETYPE("qvvr_phasetype",
|
||||||
|
"暂降相别"), QVVR_CATA_TYPE("qvvr_cata_type",
|
||||||
|
"暂降类型"), POWER_QVVR_BEFORE_BUF("power_qvvr_before_buf",
|
||||||
|
"暂态前基波功率参数"),POWER_QVVR_AFTER_BUF("power_qvvr_after_buf",
|
||||||
|
"暂态前基波功率参数"),FUND_P("Fund_P",
|
||||||
|
"基波有功功率"),FUND_Q("Fund_Q",
|
||||||
|
"基波无功功率"),FUND_S("Fund_S",
|
||||||
|
"基波视在功率"),QVVR_DIRECTION_INFO("qvvr_direction_info",
|
||||||
|
"暂降源定位特征参数"),TRIG_TIME("trig_time",
|
||||||
|
"暂降触发时刻"),QVVR_BEFORE_RMS("qvvr_before_rms",
|
||||||
|
"暂降前基波有效值"),QVVR_BEFORE_ZK("qvvr_before_zk",
|
||||||
|
"暂降前基波阻抗值"),QVVR_OCCUR_RMS("qvvr_occur_rms",
|
||||||
|
"暂降发生时基波有效值"),QVVR_OCCUR_ZK("qvvr_occur_zk",
|
||||||
|
"暂降发生时基波阻抗值"),QVVR_POS_INFO("qvvr_pos_info",
|
||||||
|
"暂降源与监测位置关系"),QVVR_UTBL_INFO("qvvr_utbl_info",
|
||||||
|
"突变量参数"),ENTER("\n",
|
||||||
|
"回车换行"), QUOTATION("\"",
|
||||||
|
"双引号"), NEWLINE("\n\t",
|
||||||
|
"换行Tab"), TAB("\t",
|
||||||
|
"tab");
|
||||||
|
/**
|
||||||
|
* 字段描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段值
|
||||||
|
*/
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
EnumEvt(String property, String description) {
|
||||||
|
this.description = description;
|
||||||
|
this.property = property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProperty() {
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String setEvtProperty(String property) {
|
||||||
|
return QUOTATION.getProperty() + property + QUOTATION.getProperty() + ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String setEnter(String s, int lineNumber) {
|
||||||
|
return s += "," + ENTER.getProperty() + setTab(lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String setClose(int lineNumber) {
|
||||||
|
String s = ENTER.getProperty();
|
||||||
|
s += setTab(lineNumber);
|
||||||
|
return s + "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String setTab(int count) {
|
||||||
|
String string = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
string += TAB.getProperty();
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String setNewLine() {
|
||||||
|
return "{" + NEWLINE.getProperty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package com.njcn.advance.pojo.bo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pqs
|
|
||||||
*
|
|
||||||
* @author cdf
|
|
||||||
* @date 2023/6/20
|
|
||||||
*/
|
|
||||||
public interface FinalData {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 暂降事件按开始时间归集门槛10秒
|
|
||||||
*/
|
|
||||||
int TIME_THRESHOLD = 10;
|
|
||||||
//分组的最大组数
|
|
||||||
int MAX_GROUP_NUM = 1000;
|
|
||||||
//类别数
|
|
||||||
int MAX_CATA_NUM = 7;
|
|
||||||
//最大事件个数
|
|
||||||
int MAX_EVT_NUM = 1000;
|
|
||||||
//三相故障
|
|
||||||
int QVVR_TYPE_THREE = 9;
|
|
||||||
//故障类型未知
|
|
||||||
int QVVR_TYPE_UNKNOWN = 10;
|
|
||||||
//节点不在网络拓扑中
|
|
||||||
int QVVR_TYPE_OUTOFRANGE = -1;
|
|
||||||
int DATA_INF = -1;
|
|
||||||
int EVT_TYPE_NUM = 6;//故障类型数
|
|
||||||
int MAX_PATH_NUM = 50;//最大路径数
|
|
||||||
int NODE_NUM = -1;//输入节点数
|
|
||||||
|
|
||||||
// 暂降综合评估算法
|
|
||||||
int CLUSER_NUM = 4; // 系统中各监测点分类后的代表节点
|
|
||||||
int MAX_LINE_NUM = 1000; // 监测点最多个数
|
|
||||||
int MAX_STA_NUM = 120; // 支持的子系统个数
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.advance.pojo.bo;
|
package com.njcn.advance.pojo.bo;
|
||||||
|
|
||||||
import com.njcn.advance.pojo.dto.QtIdx;
|
import com.njcn.advance.pojo.dto.relevent.FinalData;
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.QtIdx;
|
||||||
import com.sun.jna.Structure;
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.advance.pojo.bo;
|
package com.njcn.advance.pojo.bo;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.FinalData;
|
||||||
import com.sun.jna.Structure;
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.advance.pojo.bo;
|
package com.njcn.advance.pojo.bo;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.FinalData;
|
||||||
import com.sun.jna.Structure;
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.advance.pojo.dto;
|
package com.njcn.advance.pojo.dto;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.QtIdx;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EntityGroupData {
|
||||||
|
private int idx[];
|
||||||
|
private int all_evt_num;
|
||||||
|
private int evt_in_num;
|
||||||
|
private int evt_out_num;
|
||||||
|
private int evt_res_num;
|
||||||
|
|
||||||
|
private int Matrixcata[][];
|
||||||
|
|
||||||
|
private EntityGroupEvtData in_buf[];
|
||||||
|
private EntityGroupEvtData out_buf[];
|
||||||
|
private EntityGroupEvtData res_buf[];
|
||||||
|
private EntityGroupEvtData grp_buf[][];
|
||||||
|
|
||||||
|
private int grp_num[];
|
||||||
|
private int grp_all_num;
|
||||||
|
private EntityGroupEvtData grp_cata_buf[][][];
|
||||||
|
private int grp_cata_num[][];
|
||||||
|
|
||||||
|
public EntityGroupData() {
|
||||||
|
idx = new int[FinalData.MAX_EVT_NUM];
|
||||||
|
Matrixcata = new int[FinalData.MAX_CATA_NUM][FinalData.MAX_EVT_NUM];
|
||||||
|
in_buf = new EntityGroupEvtData[FinalData.MAX_EVT_NUM];
|
||||||
|
out_buf = new EntityGroupEvtData[FinalData.MAX_EVT_NUM];
|
||||||
|
res_buf = new EntityGroupEvtData[FinalData.MAX_EVT_NUM];
|
||||||
|
grp_buf = new EntityGroupEvtData[FinalData.MAX_GROUP_NUM][FinalData.MAX_EVT_NUM];
|
||||||
|
grp_num = new int[FinalData.MAX_GROUP_NUM];
|
||||||
|
grp_cata_buf = new EntityGroupEvtData[FinalData.MAX_GROUP_NUM][FinalData.MAX_CATA_NUM
|
||||||
|
+ 2][FinalData.MAX_EVT_NUM];
|
||||||
|
grp_cata_num = new int[FinalData.MAX_GROUP_NUM][FinalData.MAX_CATA_NUM + 2];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.SagEvent;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EntityGroupEvtData implements Cloneable,Comparable<EntityGroupEvtData> {
|
||||||
|
|
||||||
|
//逻辑节点序号
|
||||||
|
private int node;
|
||||||
|
//事件开始时间时标
|
||||||
|
private int start_time;
|
||||||
|
//类别
|
||||||
|
private int cata;
|
||||||
|
//标注类别
|
||||||
|
private int cata2;
|
||||||
|
//物理节点
|
||||||
|
private String nodePhysics;
|
||||||
|
|
||||||
|
private SagEvent sagEvent;
|
||||||
|
|
||||||
|
private String sagReason;
|
||||||
|
|
||||||
|
|
||||||
|
public Object objClone() {
|
||||||
|
try {
|
||||||
|
return clone();
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
return new EntityGroupEvtData(null, -1, -1, -1,null,null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityGroupEvtData(String nodePhysics, int start_time, int cata, int cata2, SagEvent sagEvent, String sagReason) {
|
||||||
|
this.nodePhysics = nodePhysics;
|
||||||
|
this.start_time = start_time;
|
||||||
|
this.cata = cata;
|
||||||
|
this.cata2 = cata2;
|
||||||
|
this.sagEvent = sagEvent;
|
||||||
|
this.sagReason = sagReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(EntityGroupEvtData obj) {
|
||||||
|
if(this.getStart_time() < obj.getStart_time()){
|
||||||
|
return -1;
|
||||||
|
}else if(this.getStart_time() > obj.getStart_time()){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EntityLogic {
|
||||||
|
//物理隔绝变压器策略GUID
|
||||||
|
private String tPIndex;
|
||||||
|
//变压器逻辑上节点
|
||||||
|
private String node_h;
|
||||||
|
//变压器逻辑下节点
|
||||||
|
private String node_l;
|
||||||
|
// 变压器连接方式
|
||||||
|
private Integer type;
|
||||||
|
//变压器物理上节点
|
||||||
|
private String nodeBefore;
|
||||||
|
//变压器物理下节点
|
||||||
|
private String nodeNext;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.FinalData;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class EntityMtrans implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int Matrixcata0[][];
|
||||||
|
private int Matrixcata1[][];
|
||||||
|
private int Mtrans[][];
|
||||||
|
private int possiable_path[][];
|
||||||
|
private int path_num;
|
||||||
|
|
||||||
|
public EntityMtrans() {
|
||||||
|
super();
|
||||||
|
Mtrans = new int[FinalData.NODE_NUM][FinalData.NODE_NUM];
|
||||||
|
Matrixcata0 = new int[FinalData.EVT_TYPE_NUM][FinalData.NODE_NUM];
|
||||||
|
Matrixcata1 = new int[FinalData.EVT_TYPE_NUM][FinalData.NODE_NUM];
|
||||||
|
possiable_path = new int[FinalData.MAX_PATH_NUM][FinalData.NODE_NUM + 1];
|
||||||
|
path_num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getMatrixcata0() {
|
||||||
|
return Matrixcata0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatrixcata0(int[][] matrixcata0) {
|
||||||
|
Matrixcata0 = matrixcata0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getMatrixcata1() {
|
||||||
|
return Matrixcata1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatrixcata1(int[][] matrixcata1) {
|
||||||
|
Matrixcata1 = matrixcata1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getMtrans() {
|
||||||
|
return Mtrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMtrans(int[][] mtrans) {
|
||||||
|
Mtrans = mtrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getPossiable_path() {
|
||||||
|
return possiable_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPossiable_path(int[][] possiable_path) {
|
||||||
|
this.possiable_path = possiable_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPath_num() {
|
||||||
|
return path_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPath_num(int path_num) {
|
||||||
|
this.path_num = path_num;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "EntityMtrans [Matrixcata0=" + Arrays.toString(Matrixcata0) + ", Matrixcata1="
|
||||||
|
+ Arrays.toString(Matrixcata1) + ", Mtrans=" + Arrays.toString(Mtrans) + ", possiable_path="
|
||||||
|
+ Arrays.toString(possiable_path) + ", path_num=" + path_num + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.SagEvent;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*一个归一化事件包含多个事件(一对多)
|
||||||
|
*indexEventAss:事件关联分析表Guid
|
||||||
|
*time:归一化中第一个时间
|
||||||
|
*describe:关联事件描述
|
||||||
|
*bRange:是否进行范围分析
|
||||||
|
*indexUser:用户表Guid
|
||||||
|
*updateTime:更新时间
|
||||||
|
*state:数据状态
|
||||||
|
*name:关联事件名称
|
||||||
|
*list:属于该归一化事件的暂降事件
|
||||||
|
*strTime:字符串时间
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EventAssObj implements Serializable {
|
||||||
|
private String indexEventAss;
|
||||||
|
private LocalDateTime time;
|
||||||
|
private String describe;
|
||||||
|
private int bRange;
|
||||||
|
private String indexUser;
|
||||||
|
private LocalDateTime updateTime = LocalDateTime.now();
|
||||||
|
private int state;
|
||||||
|
private String name;
|
||||||
|
private String strTime;
|
||||||
|
private List<SagEvent> list;
|
||||||
|
|
||||||
|
public String getStrTime() {
|
||||||
|
return strTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrTime(String strTime) {
|
||||||
|
this.strTime = strTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexEventAss() {
|
||||||
|
return indexEventAss;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexEventAss(String indexEventAss) {
|
||||||
|
this.indexEventAss = indexEventAss;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(LocalDateTime time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescribe() {
|
||||||
|
return describe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescribe(String describe) {
|
||||||
|
this.describe = describe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getbRange() {
|
||||||
|
return bRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setbRange(int bRange) {
|
||||||
|
this.bRange = bRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexUser() {
|
||||||
|
return indexUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexUser(String indexUser) {
|
||||||
|
this.indexUser = indexUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(LocalDateTime updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(int state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SagEvent> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<SagEvent> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "EventAssObj [indexEventAss=" + indexEventAss + ", time=" + time + ", describe=" + describe + ", bRange="
|
||||||
|
+ bRange + ", indexUser=" + indexUser + ", updateTime=" + updateTime + ", state=" + state + ", name="
|
||||||
|
+ name + ", strTime=" + strTime + ", list=" + list + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
public class FinalData {
|
||||||
|
public static final int TIME_THRESHOLD = 10;//暂降事件按开始时间归集门槛10秒
|
||||||
|
public static final int MAX_GROUP_NUM = 1000;//分组的最大组数
|
||||||
|
public static final int MAX_CATA_NUM = 7;//类别数
|
||||||
|
public static final int MAX_EVT_NUM = 1000;//最大事件个数
|
||||||
|
|
||||||
|
public static final int QVVR_TYPE_THREE = 9; //三相故障
|
||||||
|
public static final int QVVR_TYPE_UNKNOWN = 10; //故障类型未知
|
||||||
|
public static final int QVVR_TYPE_OUTOFRANGE = -1; //节点不在网络拓扑中
|
||||||
|
public static final int DATA_INF = -1;
|
||||||
|
public static final int EVT_TYPE_NUM = 6;//故障类型数
|
||||||
|
public static final int MAX_PATH_NUM = 50;//最大路径数
|
||||||
|
public static int NODE_NUM;//输入节点数
|
||||||
|
|
||||||
|
// 暂降综合评估算法
|
||||||
|
public static final int CLUSER_NUM = 4; // 系统中各监测点分类后的代表节点
|
||||||
|
public static final int MAX_LINE_NUM = 1000; // 监测点最多个数
|
||||||
|
public static final int MAX_STA_NUM = 120; // 支持的子系统个数
|
||||||
|
|
||||||
|
static {
|
||||||
|
NODE_NUM = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*终端监测点名称信息
|
||||||
|
* nameGD:供电公司名称
|
||||||
|
* nameBD:变电站名称
|
||||||
|
* nameSubV:母线名称
|
||||||
|
* namePoint:监测点名称
|
||||||
|
* indexPoint:监测点的唯一标识
|
||||||
|
*
|
||||||
|
* 新增add
|
||||||
|
* xuyang
|
||||||
|
* 2021.05.11
|
||||||
|
* 监测点电压等级:monitorVoltageLevel
|
||||||
|
* 监测点干扰源类型终:monitorLoadType
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PlantInfo implements Serializable {
|
||||||
|
private String indexPoint;
|
||||||
|
private String nameGD;
|
||||||
|
private String nameBD;
|
||||||
|
private String nameSubV;
|
||||||
|
private String namePoint;
|
||||||
|
private String monitorVoltageLevel;
|
||||||
|
private String monitorLoadType;
|
||||||
|
private String objName;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.advance.pojo.dto;
|
package com.njcn.advance.pojo.dto.relevent;
|
||||||
|
|
||||||
import com.sun.jna.Structure;
|
import com.sun.jna.Structure;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -0,0 +1,423 @@
|
|||||||
|
package com.njcn.advance.pojo.dto;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.PlantInfo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/21
|
||||||
|
*/
|
||||||
|
public class SagEvent implements Comparable<SagEvent>, Serializable {
|
||||||
|
// 事件的唯一标识
|
||||||
|
private String indexEventDetail;
|
||||||
|
|
||||||
|
private Integer waveType;
|
||||||
|
// 暂降事件发生时间
|
||||||
|
private LocalDateTime sagTime;
|
||||||
|
|
||||||
|
// 暂降事件发生时间毫秒
|
||||||
|
private Integer msec;
|
||||||
|
|
||||||
|
// 事件描述
|
||||||
|
private String events;
|
||||||
|
|
||||||
|
// 持续时间
|
||||||
|
private Float persistTime;
|
||||||
|
|
||||||
|
// 发生暂降事件的监测点层级信息
|
||||||
|
private PlantInfo plantInfo;
|
||||||
|
|
||||||
|
// 拼接sagTime和msec
|
||||||
|
private String strTime;
|
||||||
|
|
||||||
|
// 事件发生时刻的毫秒表示
|
||||||
|
private Long time;
|
||||||
|
|
||||||
|
// 监测点的唯一标识
|
||||||
|
private String indexPoint;
|
||||||
|
|
||||||
|
// 归一化事件的GUID
|
||||||
|
private String indexEventAss;
|
||||||
|
|
||||||
|
// 特征幅值
|
||||||
|
private Float eventValue;
|
||||||
|
|
||||||
|
// 暂降原因
|
||||||
|
private String sagReason;
|
||||||
|
|
||||||
|
// 暂降类型
|
||||||
|
private String sagType;
|
||||||
|
|
||||||
|
// 暂降类型描述
|
||||||
|
private String sagTypeDes;
|
||||||
|
|
||||||
|
public String getSagTypeDes() {
|
||||||
|
return sagTypeDes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSagTypeDes(String sagTypeDes) {
|
||||||
|
this.sagTypeDes = sagTypeDes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暂降深度
|
||||||
|
private String strEventValue;
|
||||||
|
private String strPersist;
|
||||||
|
|
||||||
|
// 事件是否经过高级算法处理(0-未处理,1-已处理,默认为0)
|
||||||
|
private Integer dealFlag;
|
||||||
|
|
||||||
|
// 事件是否经过高级算法处理中文描述(已处理、未处理)
|
||||||
|
private String dealFlagDescription;
|
||||||
|
|
||||||
|
// 录波文件是否存在(0-不存在,1-存在,默认为0)
|
||||||
|
private Integer fileFlag;
|
||||||
|
|
||||||
|
// 录波文件是否存在中文描述(存在、不存在)
|
||||||
|
private String fileFlagDescription;
|
||||||
|
|
||||||
|
// 高级算法返回dq持续时间
|
||||||
|
private Float dqTime;
|
||||||
|
|
||||||
|
// 高级算法处理事件个数记录
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
// 归一化处理更新时间
|
||||||
|
private LocalDateTime dealTime;
|
||||||
|
|
||||||
|
// 高级算法的对应关系
|
||||||
|
private int cata;
|
||||||
|
|
||||||
|
// 第一次事件的触发时间
|
||||||
|
private Date firstTime;
|
||||||
|
|
||||||
|
// 第一次事件的暂降类型
|
||||||
|
private String firstType;
|
||||||
|
|
||||||
|
// 第一次事件的触发时间毫秒
|
||||||
|
private Integer firstMs;
|
||||||
|
|
||||||
|
// 第一次事件触发时间date->毫秒
|
||||||
|
private Long firstTimeMills;
|
||||||
|
|
||||||
|
// 暂降严重度
|
||||||
|
private Float severity;
|
||||||
|
|
||||||
|
// 排序方式
|
||||||
|
private int sortType = 0; // 初始化默认为0-按照时间排序 新增1-按暂降严重度排序 2-暂降发生时刻排序 3-先根据电压等级排序,如果相等再按照暂降幅值排序
|
||||||
|
|
||||||
|
//电压等级
|
||||||
|
private Double voltage;
|
||||||
|
|
||||||
|
//监测点对象名称
|
||||||
|
private String objName;
|
||||||
|
|
||||||
|
public String getObjName() {
|
||||||
|
return objName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjName(String objName) {
|
||||||
|
this.objName = objName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getWaveType() {
|
||||||
|
return waveType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWaveType(Integer waveType) {
|
||||||
|
this.waveType = waveType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String strVoltage;
|
||||||
|
|
||||||
|
public Double getVoltage() {
|
||||||
|
return voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoltage(Double voltage) {
|
||||||
|
this.voltage = voltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStrVoltage() {
|
||||||
|
return strVoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrVoltage(String strVoltage) {
|
||||||
|
//转为double
|
||||||
|
strVoltage = strVoltage.toUpperCase();
|
||||||
|
String str = strVoltage.substring(0, strVoltage.indexOf("KV"));
|
||||||
|
this.voltage = Double.parseDouble(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSortType() {
|
||||||
|
return sortType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortType(int sortType) {
|
||||||
|
this.sortType = sortType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getSeverity() {
|
||||||
|
return severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeverity(Float severity) {
|
||||||
|
this.severity = severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getFirstTimeMills() {
|
||||||
|
return firstTimeMills;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstTimeMills(Long firstTimeMills) {
|
||||||
|
this.firstTimeMills = firstTimeMills;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFirstMs() {
|
||||||
|
return firstMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstMs(Integer firstMs) {
|
||||||
|
this.firstMs = firstMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFirstTime() {
|
||||||
|
return firstTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstTime(Date firstTime) {
|
||||||
|
this.firstTime = firstTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstType() {
|
||||||
|
return firstType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstType(String firstType) {
|
||||||
|
this.firstType = firstType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFileFlag() {
|
||||||
|
return fileFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileFlag(Integer fileFlag) {
|
||||||
|
this.fileFlag = fileFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileFlagDescription() {
|
||||||
|
return fileFlagDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileFlagDescription(String fileFlagDescription) {
|
||||||
|
this.fileFlagDescription = fileFlagDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCata() {
|
||||||
|
return cata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCata(int cata) {
|
||||||
|
this.cata = cata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getDealTime() {
|
||||||
|
return dealTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDealTime(LocalDateTime dealTime) {
|
||||||
|
this.dealTime = dealTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getDqTime() {
|
||||||
|
return dqTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDqTime(Float dqTime) {
|
||||||
|
this.dqTime = dqTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(Integer number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDealFlagDescription(String dealFlagDescription) {
|
||||||
|
this.dealFlagDescription = dealFlagDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDealFlagDescription() {
|
||||||
|
return dealFlagDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDealFlag() {
|
||||||
|
return dealFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDealFlag(Integer dealFlag) {
|
||||||
|
this.dealFlag = dealFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexEventDetail() {
|
||||||
|
return indexEventDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexEventDetail(String indexEventDetail) {
|
||||||
|
this.indexEventDetail = indexEventDetail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getSagTime() {
|
||||||
|
return sagTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSagTime(LocalDateTime sagTime) {
|
||||||
|
this.sagTime = sagTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMsec() {
|
||||||
|
return msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsec(Integer msec) {
|
||||||
|
this.msec = msec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEvents() {
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvents(String events) {
|
||||||
|
this.events = events;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getPersistTime() {
|
||||||
|
return persistTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPersistTime(Float persistTime) {
|
||||||
|
if (persistTime == null) {
|
||||||
|
this.persistTime = 0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f1 = (float) (Math.round(persistTime.floatValue() * 1000)) / 1000;
|
||||||
|
this.persistTime = new Float(f1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlantInfo getPlantInfo() {
|
||||||
|
return plantInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlantInfo(PlantInfo plantInfo) {
|
||||||
|
this.plantInfo = plantInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStrTime() {
|
||||||
|
return strTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrTime(String strTime) {
|
||||||
|
this.strTime = strTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(Long time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexPoint() {
|
||||||
|
return indexPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexPoint(String indexPoint) {
|
||||||
|
this.indexPoint = indexPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexEventAss() {
|
||||||
|
return indexEventAss;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexEventAss(String indexEventAss) {
|
||||||
|
this.indexEventAss = indexEventAss;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getEventValue() {
|
||||||
|
return eventValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventValue(Float eventValue) {
|
||||||
|
if (eventValue == null) {
|
||||||
|
this.eventValue = 0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.eventValue = eventValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSagReason() {
|
||||||
|
return sagReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSagReason(String sagReason) {
|
||||||
|
this.sagReason = sagReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSagType() {
|
||||||
|
return sagType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSagType(String sagType) {
|
||||||
|
this.sagType = sagType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStrEventValue() {
|
||||||
|
return strEventValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrEventValue(String strEventValue) {
|
||||||
|
this.strEventValue = strEventValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStrPersist() {
|
||||||
|
return strPersist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStrPersist(String strPersist) {
|
||||||
|
this.strPersist = strPersist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 根据设定规则进行排序
|
||||||
|
@Override
|
||||||
|
public int compareTo(SagEvent obj) {
|
||||||
|
switch (this.getSortType()) {
|
||||||
|
case 1:
|
||||||
|
return obj.getSeverity().compareTo(this.getSeverity());
|
||||||
|
case 2:
|
||||||
|
return this.getTime().compareTo(obj.getTime());
|
||||||
|
case 3: {
|
||||||
|
if (obj.getVoltage().compareTo(this.getVoltage()) != 0) {
|
||||||
|
return obj.getVoltage().compareTo(this.getVoltage());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return this.getEventValue().compareTo(obj.getEventValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.getFirstTimeMills().compareTo(obj.getFirstTimeMills());
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,200 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AnalyWaveModel {
|
||||||
|
|
||||||
|
/********************************
|
||||||
|
* 解析Comtrate文件相关实体类
|
||||||
|
* @author yexb 转ww C#代码
|
||||||
|
**********************************/
|
||||||
|
|
||||||
|
// 模拟量通道记录类
|
||||||
|
public static class tagOneChannleCfg {
|
||||||
|
// 通道序号
|
||||||
|
public int nIndex;
|
||||||
|
// 通道名称
|
||||||
|
public String szChannleName;
|
||||||
|
// 相位名称
|
||||||
|
public String szPhasicName;
|
||||||
|
// 监视的通道名称
|
||||||
|
public String szMonitoredChannleName;
|
||||||
|
// 通道的单位
|
||||||
|
public String szUnitName;
|
||||||
|
// 通道的系数
|
||||||
|
public float fCoefficent;
|
||||||
|
// 通道的便宜量
|
||||||
|
public float fOffset;
|
||||||
|
// 起始采样时间的偏移量
|
||||||
|
public float fTimeOffset;
|
||||||
|
// 采样值的最小值
|
||||||
|
public int nMin;
|
||||||
|
// 采样值的最大值
|
||||||
|
public int nMax;
|
||||||
|
// 一次变比
|
||||||
|
public float fPrimary;
|
||||||
|
// 二次变比
|
||||||
|
public float fSecondary;
|
||||||
|
// 一次值还是二次值标志
|
||||||
|
public String szValueType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数字量通道记录类
|
||||||
|
public static class tagOneChannleCfg_digital {
|
||||||
|
// 通道序号
|
||||||
|
public int nIndex;
|
||||||
|
// 通道名称
|
||||||
|
public String szChannleName;
|
||||||
|
// 相位名称
|
||||||
|
public String szPhasicName;
|
||||||
|
// 监视的通道名称
|
||||||
|
public String szMonitoredChannleName;
|
||||||
|
// 通道的单位
|
||||||
|
public int Initial;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 配置文件总类
|
||||||
|
public static class tagComtradeCfg {
|
||||||
|
public int nChannelNum;
|
||||||
|
public int nPhasic;// 模拟量通道的个数 yexibao 2020-12-15
|
||||||
|
public int nAnalogNum;// 模拟量通道的个数 WW 2013-05-15
|
||||||
|
public int nDigitalNum;// 数字量通道的个数 WW 2013-05-15
|
||||||
|
public List<tagOneChannleCfg> OneChannleCfg;
|
||||||
|
public List<tagOneChannleCfg_digital> OneChannleCfgDig;
|
||||||
|
|
||||||
|
public tagComtradeCfg() {
|
||||||
|
OneChannleCfg = new LinkedList<tagOneChannleCfg>();
|
||||||
|
OneChannleCfgDig = new LinkedList<tagOneChannleCfg_digital>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class tagOneRate{
|
||||||
|
// 1秒钟内的采样点数
|
||||||
|
public long nOneSample;
|
||||||
|
// 总采样点数
|
||||||
|
public long nSampleNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 采样总结构
|
||||||
|
public static class tagRates {
|
||||||
|
public int nRates;
|
||||||
|
public List<tagOneRate> OneRate;
|
||||||
|
|
||||||
|
public tagRates() {
|
||||||
|
OneRate = new LinkedList<tagOneRate>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 采样值结构
|
||||||
|
public static class tagOneValue {
|
||||||
|
// 数据点时间
|
||||||
|
public String szTime;
|
||||||
|
// 数据点序号
|
||||||
|
public int nIndex;
|
||||||
|
// int nValueNum; WW 2013-05-15
|
||||||
|
// 模拟量数据个数
|
||||||
|
public int nAnalogValueNum;
|
||||||
|
// 数字量数据个数
|
||||||
|
public int nDigitalValueNum;
|
||||||
|
// 数据区
|
||||||
|
// float fValue[8];
|
||||||
|
public List<Float> fValue;// WW 2013-05-15 原来的8通道也是仅考虑了单路的情况,如果遇到多路这里会超出
|
||||||
|
public List<Byte> DigitalValue;// WW 2013-05-15
|
||||||
|
|
||||||
|
public tagOneValue() {
|
||||||
|
fValue = new LinkedList<Float>();
|
||||||
|
DigitalValue = new LinkedList<Byte>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 采样值总结构
|
||||||
|
public static class tagValue {
|
||||||
|
// 数据个数
|
||||||
|
public int nValueNum;
|
||||||
|
// 数据区
|
||||||
|
public List<tagOneValue> OneValueList;
|
||||||
|
|
||||||
|
public tagValue() {
|
||||||
|
OneValueList = new LinkedList<tagOneValue>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class tagWave {
|
||||||
|
// 标识 1-二次值的事件波形 2-二次值的RMS 3-一次值的事件波形 4-一次值的RMS
|
||||||
|
//标识 5-二次值的事件波形 6-二次值的RMS 7-一次值的事件波形 8-一次值的RMS
|
||||||
|
private int type;
|
||||||
|
// 相别
|
||||||
|
private int phaseType;// 0:A相;1:B相;2:c相
|
||||||
|
// X坐标值
|
||||||
|
private int xvalue;
|
||||||
|
// y坐标值
|
||||||
|
private float yvalue;
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPhaseType() {
|
||||||
|
return phaseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhaseType(int phaseType) {
|
||||||
|
this.phaseType = phaseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getXvalue() {
|
||||||
|
return xvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXvalue(int xvalue) {
|
||||||
|
this.xvalue = xvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYvalue() {
|
||||||
|
return yvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYvalue(float yvalue) {
|
||||||
|
this.yvalue = yvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//增加返回值描述
|
||||||
|
public static class tagDataValue {
|
||||||
|
//波形对应的标题
|
||||||
|
private List<String> tmpWaveTitle;
|
||||||
|
//波形对应的值
|
||||||
|
private List<List<Float>> listWaveData;
|
||||||
|
//波形对应的相别数量
|
||||||
|
private int iPhasic;
|
||||||
|
|
||||||
|
public List<String> getTmpWaveTitle() {
|
||||||
|
return tmpWaveTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTmpWaveTitle(List<String> tmpWaveTitle) {
|
||||||
|
this.tmpWaveTitle = tmpWaveTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<Float>> getListWaveData() {
|
||||||
|
return listWaveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListWaveData(List<List<Float>> listWaveData) {
|
||||||
|
this.listWaveData = listWaveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getiPhasic() {
|
||||||
|
return iPhasic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setiPhasic(int iPhasic) {
|
||||||
|
this.iPhasic = iPhasic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输出参数
|
||||||
|
* qvvr_cata_cause 暂降原因(目前算法不支持,不填)
|
||||||
|
* qvvr_phasetype 暂降相别 1:一相 2:两相 3:三相
|
||||||
|
* qvvr_cata_type 暂降类型
|
||||||
|
* 持续时间(单位秒)
|
||||||
|
* hold_time_rms 有效值算法持续时间
|
||||||
|
* hold_time_dq dq变换算法持续时间
|
||||||
|
* 波形起始点(单位度)
|
||||||
|
* POW_a A相波形起始点
|
||||||
|
* POW_b B相波形起始点
|
||||||
|
* POW_c C相波形起始点
|
||||||
|
* 跳变段电压变化率(单位V/S)
|
||||||
|
* Voltagechange_Va A相跳变段电压变化率
|
||||||
|
* Voltagechange_Vb B相跳变段电压变化率
|
||||||
|
* Voltagechange_Vc C相跳变段电压变化率
|
||||||
|
* 分段信息
|
||||||
|
* SEG_T_num 分段数目
|
||||||
|
* SEG_T0_idx 原始分段位置
|
||||||
|
* SEG_T_idx 修正分段位置
|
||||||
|
* 有效值分段信息
|
||||||
|
* SEG_RMS_T_num 分段数目
|
||||||
|
* SEG_RMS_T_idx 分段位置
|
||||||
|
* 特征幅值(单位V)
|
||||||
|
* u_min_num 特征值个数
|
||||||
|
* ua_min A相电压特征值
|
||||||
|
* ub_min B相电压特征值
|
||||||
|
* uc_min C相电压特征值
|
||||||
|
* u3_min 三相电压特征值
|
||||||
|
* order_min_idx 最小值位置
|
||||||
|
* 相位跳变(单位度)
|
||||||
|
* angle_diff_ap A相相位正跳变
|
||||||
|
* angle_diff_bp B相相位正跳变
|
||||||
|
* angle_diff_cp C相相位正跳变
|
||||||
|
* angle_diff_an A相相位负跳变
|
||||||
|
* angle_diff_bn B相相位负跳变
|
||||||
|
* angle_diff_cn C相相位负跳变
|
||||||
|
* bph_max_value 不平衡度(单位%)
|
||||||
|
*/
|
||||||
|
public class BackData extends Structure {
|
||||||
|
public int qvvr_cata_cause[] = new int[256];
|
||||||
|
public int qvvr_phasetype[] = new int[256];
|
||||||
|
public int qvvr_cata_type[] = new int[256];
|
||||||
|
public float hold_time_rms;
|
||||||
|
public float hold_time_dq;
|
||||||
|
public float POW_a;
|
||||||
|
public float POW_b;
|
||||||
|
public float POW_c;
|
||||||
|
public float Voltagechange_Va;
|
||||||
|
public float Voltagechange_Vb;
|
||||||
|
public float Voltagechange_Vc;
|
||||||
|
public int SEG_T_num;
|
||||||
|
public int SEG_T0_idx[] = new int[256];
|
||||||
|
public int SEG_T_idx[] = new int[256];
|
||||||
|
public int SEG_RMS_T_num;
|
||||||
|
public int SEG_RMS_T_idx[] = new int[256];
|
||||||
|
public int u_min_num;
|
||||||
|
public float ua_min[] = new float[256];
|
||||||
|
public float ub_min[] = new float[256];
|
||||||
|
public float uc_min[] = new float[256];
|
||||||
|
public float u3_min[] = new float[256];
|
||||||
|
public int order_min_idx[] = new int[256];
|
||||||
|
public float angle_diff_ap[] = new float[256];
|
||||||
|
public float angle_diff_bp[] = new float[256];
|
||||||
|
public float angle_diff_cp[] = new float[256];
|
||||||
|
public float angle_diff_an[] = new float[256];
|
||||||
|
public float angle_diff_bn[] = new float[256];
|
||||||
|
public float angle_diff_cn[] = new float[256];
|
||||||
|
public float bph_max_value[] = new float[256];
|
||||||
|
|
||||||
|
public static class ByReference extends BackData implements Structure.ByReference {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ByValue extends BackData implements Structure.ByValue {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "qvvr_cata_cause", "qvvr_phasetype", "qvvr_cata_type", "hold_time_rms",
|
||||||
|
"hold_time_dq", "POW_a", "POW_b", "POW_c", "Voltagechange_Va", "Voltagechange_Vb", "Voltagechange_Vc",
|
||||||
|
"SEG_T_num", "SEG_T0_idx", "SEG_T_idx","SEG_RMS_T_num","SEG_RMS_T_idx", "u_min_num", "ua_min", "ub_min", "uc_min", "u3_min",
|
||||||
|
"order_min_idx", "angle_diff_ap", "angle_diff_bp", "angle_diff_cp", "angle_diff_an", "angle_diff_bn",
|
||||||
|
"angle_diff_cn", "bph_max_value" });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CauseStruct extends Structure {
|
||||||
|
//最大能容纳的数据
|
||||||
|
public static final int MAX_SMP_DATA_LEN = 128 * 50 * 120;
|
||||||
|
public float smp_va[] = new float[MAX_SMP_DATA_LEN];
|
||||||
|
public float smp_vb[] = new float[MAX_SMP_DATA_LEN];
|
||||||
|
public float smp_vc[] = new float[MAX_SMP_DATA_LEN];
|
||||||
|
public int smp_rate;
|
||||||
|
public int smp_len;
|
||||||
|
public float threshold[] = new float[50];
|
||||||
|
public int cause = 0;
|
||||||
|
public int no_cal = 0;
|
||||||
|
|
||||||
|
public static class ByReference extends CauseStruct implements Structure.ByReference {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ByValue extends CauseStruct implements Structure.ByValue {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getFieldOrder() { // 返回值填入的顺序
|
||||||
|
return Arrays.asList(new String[] { "cause", "no_cal" });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
public class DirectionData{
|
||||||
|
private int trigTime[] = new int[256];
|
||||||
|
private float qvvrBeforeRms[] = new float[256];
|
||||||
|
private float qvvrBeforeZk[] = new float[256];
|
||||||
|
private float qvvrOccurRms[] = new float[256];
|
||||||
|
private float qvvrOccurZk[] = new float[256];
|
||||||
|
private String qvvrPosInfo[] = new String[256];
|
||||||
|
|
||||||
|
public int[] getTrigTime() {
|
||||||
|
return trigTime;
|
||||||
|
}
|
||||||
|
public void setTrigTime(int[] trigTime) {
|
||||||
|
this.trigTime = trigTime;
|
||||||
|
}
|
||||||
|
public float[] getQvvrBeforeRms() {
|
||||||
|
return qvvrBeforeRms;
|
||||||
|
}
|
||||||
|
public void setQvvrBeforeRms(float[] qvvrBeforeRms) {
|
||||||
|
this.qvvrBeforeRms = qvvrBeforeRms;
|
||||||
|
}
|
||||||
|
public float[] getQvvrBeforeZk() {
|
||||||
|
return qvvrBeforeZk;
|
||||||
|
}
|
||||||
|
public void setQvvrBeforeZk(float[] qvvrBeforeZk) {
|
||||||
|
this.qvvrBeforeZk = qvvrBeforeZk;
|
||||||
|
}
|
||||||
|
public float[] getQvvrOccurRms() {
|
||||||
|
return qvvrOccurRms;
|
||||||
|
}
|
||||||
|
public void setQvvrOccurRms(float[] qvvrOccurRms) {
|
||||||
|
this.qvvrOccurRms = qvvrOccurRms;
|
||||||
|
}
|
||||||
|
public float[] getQvvrOccurZk() {
|
||||||
|
return qvvrOccurZk;
|
||||||
|
}
|
||||||
|
public void setQvvrOccurZk(float[] qvvrOccurZk) {
|
||||||
|
this.qvvrOccurZk = qvvrOccurZk;
|
||||||
|
}
|
||||||
|
public String[] getQvvrPosInfo() {
|
||||||
|
return qvvrPosInfo;
|
||||||
|
}
|
||||||
|
public void setQvvrPosInfo(String[] qvvrPosInfo) {
|
||||||
|
this.qvvrPosInfo = qvvrPosInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author njcn
|
||||||
|
* @高级算法返回数据
|
||||||
|
* @包含RMS值
|
||||||
|
* @X轴坐标
|
||||||
|
* @处理返回的结果
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EntityAdvancedData {
|
||||||
|
public float smp_a[];
|
||||||
|
public float smp_b[];
|
||||||
|
public float smp_c[];
|
||||||
|
public float smp_x[];
|
||||||
|
public int smp_len;
|
||||||
|
public String sagReason[]; // 暂降原因描述,数据库获取
|
||||||
|
public String sagType[]; // 暂降类型描述,数据库获取
|
||||||
|
public String sagPhaseType[]; // 暂降相别 1-一相 2-两相 3-三相
|
||||||
|
public int backNumber = -1;
|
||||||
|
public BackData evt_buf[];
|
||||||
|
public PowerData power_before_buf[];
|
||||||
|
public PowerData power_after_buf[];
|
||||||
|
public DirectionData qvvr_direction_info[];
|
||||||
|
public UtblData qvvr_utbl_info[];
|
||||||
|
|
||||||
|
public EntityAdvancedData(int lengthRMS) {
|
||||||
|
super();
|
||||||
|
this.smp_a = new float[lengthRMS];
|
||||||
|
this.smp_b = new float[lengthRMS];
|
||||||
|
this.smp_c = new float[lengthRMS];
|
||||||
|
this.smp_x = new float[lengthRMS];
|
||||||
|
this.sagReason = new String[256];
|
||||||
|
this.sagType = new String[256];
|
||||||
|
this.sagPhaseType = new String[256];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
public class PowerData{
|
||||||
|
private float fundP[] = new float[256];
|
||||||
|
private float fundQ[] = new float[256];
|
||||||
|
private float fundS[] = new float[256];
|
||||||
|
|
||||||
|
public float[] getFundP() {
|
||||||
|
return fundP;
|
||||||
|
}
|
||||||
|
public void setFundP(float[] fundP) {
|
||||||
|
this.fundP = fundP;
|
||||||
|
}
|
||||||
|
public float[] getFundQ() {
|
||||||
|
return fundQ;
|
||||||
|
}
|
||||||
|
public void setFundQ(float[] fundQ) {
|
||||||
|
this.fundQ = fundQ;
|
||||||
|
}
|
||||||
|
public float[] getFundS() {
|
||||||
|
return fundS;
|
||||||
|
}
|
||||||
|
public void setFundS(float[] fundS) {
|
||||||
|
this.fundS = fundS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PubWaveModel {
|
||||||
|
|
||||||
|
/************************
|
||||||
|
* Comtrate文件相关
|
||||||
|
*
|
||||||
|
* @author Yexb
|
||||||
|
*
|
||||||
|
**************************/
|
||||||
|
|
||||||
|
// 模拟量通道记录类
|
||||||
|
public static class tagOneChannleCfg {
|
||||||
|
// 通道序号
|
||||||
|
public int nIndex;
|
||||||
|
// 通道名称
|
||||||
|
public String szChannleName;
|
||||||
|
// 相位名称
|
||||||
|
public String szPhasicName;
|
||||||
|
// 监视的通道名称
|
||||||
|
public String szMonitoredChannleName;
|
||||||
|
// 通道的单位
|
||||||
|
public String szUnitName;
|
||||||
|
// 通道的系数
|
||||||
|
public float fCoefficent;
|
||||||
|
// 通道的便宜量
|
||||||
|
public float fOffset;
|
||||||
|
// 起始采样时间的偏移量
|
||||||
|
public float fTimeOffset;
|
||||||
|
// 采样值的最小值
|
||||||
|
public int nMin;
|
||||||
|
// 采样值的最大值
|
||||||
|
public int nMax;
|
||||||
|
// 一次变比
|
||||||
|
public float fPrimary;
|
||||||
|
// 二次变比
|
||||||
|
public float fSecondary;
|
||||||
|
// 一次值还是二次值标志
|
||||||
|
public String szValueType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数字量通道记录类
|
||||||
|
public static class tagOneChannleCfg_digital {
|
||||||
|
// 通道序号
|
||||||
|
public int nIndex;
|
||||||
|
// 通道名称
|
||||||
|
public String szChannleName;
|
||||||
|
// 相位名称
|
||||||
|
public String szPhasicName;
|
||||||
|
// 监视的通道名称
|
||||||
|
public String szMonitoredChannleName;
|
||||||
|
// 通道的单位
|
||||||
|
public int Initial;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 配置文件总类
|
||||||
|
public static class tagComtradeCfg {
|
||||||
|
public int nChannelNum;
|
||||||
|
public int nAnalogNum;// 模拟量通道的个数 WW 2013-05-15
|
||||||
|
public int nDigitalNum;// 数字量通道的个数 WW 2013-05-15
|
||||||
|
public List<tagOneChannleCfg> OneChannleCfg;
|
||||||
|
public List<tagOneChannleCfg_digital> OneChannleCfgDig;
|
||||||
|
|
||||||
|
public tagComtradeCfg() {
|
||||||
|
OneChannleCfg = new LinkedList<tagOneChannleCfg>();
|
||||||
|
OneChannleCfgDig = new LinkedList<tagOneChannleCfg_digital>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class tagOneRate {
|
||||||
|
// 1秒钟内的采样点数
|
||||||
|
public long nOneSample;
|
||||||
|
// 总采样点数
|
||||||
|
public long nSampleNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 采样总结构
|
||||||
|
public static class tagRates {
|
||||||
|
public int nRates;
|
||||||
|
public List<tagOneRate> OneRate;
|
||||||
|
|
||||||
|
public tagRates() {
|
||||||
|
OneRate = new LinkedList<tagOneRate>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 采样值结构
|
||||||
|
public static class tagOneValue {
|
||||||
|
// 数据点时间
|
||||||
|
public String szTime;
|
||||||
|
// 数据点序号
|
||||||
|
public int nIndex;
|
||||||
|
// int nValueNum; WW 2013-05-15
|
||||||
|
// 模拟量数据个数
|
||||||
|
public int nAnalogValueNum;
|
||||||
|
// 数字量数据个数
|
||||||
|
public int nDigitalValueNum;
|
||||||
|
// 数据区
|
||||||
|
// float fValue[8];
|
||||||
|
public List<Float> fValue;// WW 2013-05-15 原来的8通道也是仅考虑了单路的情况,如果遇到多路这里会超出
|
||||||
|
public List<Byte> DigitalValue;// WW 2013-05-15
|
||||||
|
|
||||||
|
public tagOneValue() {
|
||||||
|
fValue = new LinkedList<Float>();
|
||||||
|
DigitalValue = new LinkedList<Byte>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 采样值总结构
|
||||||
|
public static class tagValue {
|
||||||
|
// 数据个数
|
||||||
|
public int nValueNum;
|
||||||
|
// 数据区
|
||||||
|
public List<tagOneValue> OneValueList;
|
||||||
|
|
||||||
|
public tagValue() {
|
||||||
|
OneValueList = new LinkedList<tagOneValue>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class tagWave {
|
||||||
|
// 标识 1-二次值的事件波形 2-二次值的RMS 3-一次值的事件波形 4-一次值的RMS
|
||||||
|
//标识 5-二次值的事件波形 6-二次值的RMS 7-一次值的事件波形 8-一次值的RMS
|
||||||
|
private int type;
|
||||||
|
// 相别
|
||||||
|
private int phaseType;// 0:A相;1:B相;2:c相
|
||||||
|
// X坐标值
|
||||||
|
private float xvalue;
|
||||||
|
// y坐标值
|
||||||
|
private float yvalue;
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPhaseType() {
|
||||||
|
return phaseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhaseType(int phaseType) {
|
||||||
|
this.phaseType = phaseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getXvalue() {
|
||||||
|
return xvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setXvalue(float xvalue) {
|
||||||
|
this.xvalue = xvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYvalue() {
|
||||||
|
return yvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYvalue(float yvalue) {
|
||||||
|
this.yvalue = yvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
import com.sun.jna.Structure;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author njcn
|
||||||
|
* 传入参数
|
||||||
|
* smp_va A相电压波形数据
|
||||||
|
* smp_vb B相电压波形数据
|
||||||
|
* smp_vc C相电压波形数据
|
||||||
|
* smp_rate 波形采样率
|
||||||
|
* smp_len 每个通道波形数据个数
|
||||||
|
* evt_num 高级算法返回事件个数
|
||||||
|
* evt_buf 高级算法返回数据
|
||||||
|
*/
|
||||||
|
public class Rect extends Structure {
|
||||||
|
public static final int MAX_SMP_DATA_LEN = 128*50*120;
|
||||||
|
public float smp_va[] = new float[MAX_SMP_DATA_LEN];
|
||||||
|
public float smp_vb[] = new float[MAX_SMP_DATA_LEN];
|
||||||
|
public float smp_vc[] = new float[MAX_SMP_DATA_LEN];
|
||||||
|
public int smp_rate;
|
||||||
|
public int smp_len;
|
||||||
|
public int evt_num = -1;
|
||||||
|
public BackData evt_buf[] = new BackData[32];
|
||||||
|
|
||||||
|
public static class ByReference extends Rect implements Structure.ByReference {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ByValue extends Rect implements Structure.ByValue {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getFieldOrder() {
|
||||||
|
return Arrays.asList(new String[] { "evt_num","evt_buf" });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
public class UtblData{
|
||||||
|
private long trigTime[] = new long[1];
|
||||||
|
|
||||||
|
public long[] getTrigTime() {
|
||||||
|
return trigTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrigTime(long[] trigTime) {
|
||||||
|
this.trigTime = trigTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
package com.njcn.advance.pojo.dto.waveAnalysis;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @Date: 2018/12/4 10:03
|
||||||
|
*/
|
||||||
|
public class WaveData implements Serializable {
|
||||||
|
//标题数据
|
||||||
|
private List<String> tmpWaveTitle = new ArrayList<>();
|
||||||
|
|
||||||
|
//瞬时波形的数据
|
||||||
|
List<List<Float>> sunData = new ArrayList<>();
|
||||||
|
|
||||||
|
//RMS波形的数据
|
||||||
|
List<List<Float>> rmsData = new ArrayList<>();
|
||||||
|
|
||||||
|
//相别个数
|
||||||
|
private int iPhasic = 0;
|
||||||
|
|
||||||
|
//PT变比
|
||||||
|
Float pt = 0.0f;
|
||||||
|
|
||||||
|
//CT变比
|
||||||
|
Float ct = 0.0f;
|
||||||
|
|
||||||
|
private String a="A相";
|
||||||
|
|
||||||
|
private String b="B相";
|
||||||
|
|
||||||
|
private String c="C相";
|
||||||
|
|
||||||
|
//波形采样率
|
||||||
|
private long nOneWaveNum = 32;
|
||||||
|
private Date firstTime;//暂降触发第一次
|
||||||
|
private Integer firstMs;
|
||||||
|
|
||||||
|
|
||||||
|
//发生时刻
|
||||||
|
String time;
|
||||||
|
|
||||||
|
//暂降类型
|
||||||
|
String waveType;
|
||||||
|
|
||||||
|
//严重度
|
||||||
|
float yzd;
|
||||||
|
|
||||||
|
//监测点名称
|
||||||
|
String lineName;
|
||||||
|
|
||||||
|
//暂降幅值
|
||||||
|
Float eventValue;
|
||||||
|
|
||||||
|
//持续时间
|
||||||
|
Float persistTime;
|
||||||
|
|
||||||
|
//暂降触发时间
|
||||||
|
private Date trigeTime;
|
||||||
|
|
||||||
|
private boolean openTri=false;
|
||||||
|
|
||||||
|
//最大最小值集合
|
||||||
|
private List<PubWaveModel.tagWave> readComtrade = new ArrayList<>();
|
||||||
|
|
||||||
|
//变电站名称
|
||||||
|
private String subName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public WaveData() {
|
||||||
|
iPhasic = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnalyWaveModel.tagRates getRatesCfg() {
|
||||||
|
return RatesCfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRatesCfg(AnalyWaveModel.tagRates ratesCfg) {
|
||||||
|
RatesCfg = ratesCfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AnalyWaveModel.tagRates RatesCfg;//cfg_采样率实体类
|
||||||
|
|
||||||
|
public List<PubWaveModel.tagWave> getReadComtrade() {
|
||||||
|
return readComtrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReadComtrade(List<PubWaveModel.tagWave> readComtrade) {
|
||||||
|
this.readComtrade = readComtrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<Float>> getSunData() {
|
||||||
|
return sunData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSunData(List<List<Float>> sunData) {
|
||||||
|
this.sunData = sunData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<Float>> getRmsData() {
|
||||||
|
return rmsData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRmsData(List<List<Float>> rmsData) {
|
||||||
|
this.rmsData = rmsData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getPt() {
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPt(Float pt) {
|
||||||
|
this.pt = pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(String time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWaveType() {
|
||||||
|
return waveType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWaveType(String waveType) {
|
||||||
|
this.waveType = waveType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYzd() {
|
||||||
|
return yzd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYzd(float yzd) {
|
||||||
|
this.yzd = yzd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getCt() {
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCt(Float ct) {
|
||||||
|
this.ct = ct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getnOneWaveNum() {
|
||||||
|
return nOneWaveNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setnOneWaveNum(long nOneWaveNum) {
|
||||||
|
this.nOneWaveNum = nOneWaveNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFirstTime() {
|
||||||
|
return firstTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstTime(Date firstTime) {
|
||||||
|
this.firstTime = firstTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getFirstMs() {
|
||||||
|
return firstMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstMs(Integer firstMs) {
|
||||||
|
this.firstMs = firstMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLineName() {
|
||||||
|
return lineName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLineName(String lineName) {
|
||||||
|
this.lineName = lineName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getEventValue() {
|
||||||
|
return eventValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventValue(Float eventValue) {
|
||||||
|
this.eventValue = eventValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float getPersistTime() {
|
||||||
|
return persistTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPersistTime(Float persistTime) {
|
||||||
|
this.persistTime = persistTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Date getTrigeTime() {
|
||||||
|
return trigeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrigeTime(Date trigeTime) {
|
||||||
|
this.trigeTime = trigeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getOpenTri() {
|
||||||
|
return openTri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpen(boolean open) {
|
||||||
|
this.openTri = open;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getTmpWaveTitle() {
|
||||||
|
return tmpWaveTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTmpWaveTitle(List<String> tmpWaveTitle) {
|
||||||
|
this.tmpWaveTitle = tmpWaveTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getA() {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setA(String a) {
|
||||||
|
this.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getB() {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setB(String b) {
|
||||||
|
this.b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getC() {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setC(String c) {
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubName() {
|
||||||
|
return subName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubName(String subName) {
|
||||||
|
this.subName = subName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getiPhasic() {
|
||||||
|
return iPhasic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setiPhasic(int iPhasic) {
|
||||||
|
this.iPhasic = iPhasic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WaveData{" +
|
||||||
|
"tmpWaveTitle=" + tmpWaveTitle +
|
||||||
|
", sunData=" + sunData +
|
||||||
|
", rmsData=" + rmsData +
|
||||||
|
", iPhasic=" + iPhasic +
|
||||||
|
", pt=" + pt +
|
||||||
|
", ct=" + ct +
|
||||||
|
", a='" + a + '\'' +
|
||||||
|
", b='" + b + '\'' +
|
||||||
|
", c='" + c + '\'' +
|
||||||
|
", nOneWaveNum=" + nOneWaveNum +
|
||||||
|
", firstTime=" + firstTime +
|
||||||
|
", firstMs=" + firstMs +
|
||||||
|
", RatesCfg=" + RatesCfg +
|
||||||
|
", time='" + time + '\'' +
|
||||||
|
", waveType='" + waveType + '\'' +
|
||||||
|
", yzd=" + yzd +
|
||||||
|
", lineName='" + lineName + '\'' +
|
||||||
|
", eventValue=" + eventValue +
|
||||||
|
", persistTime=" + persistTime +
|
||||||
|
", trigeTime=" + trigeTime +
|
||||||
|
", openTri=" + openTri +
|
||||||
|
", readComtrade=" + readComtrade +
|
||||||
|
", subName='" + subName + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.advance.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("pqs_relevancy_log")
|
||||||
|
public class PqsRelevanceLog extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归一化算法时间
|
||||||
|
*/
|
||||||
|
@TableId("Time_Id")
|
||||||
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归一化算法描述
|
||||||
|
*/
|
||||||
|
private String contentDes;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||||
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 波形操作工具类
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/1
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class WaveUtils {
|
||||||
|
|
||||||
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取文件服务器波形数据
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/1
|
||||||
|
*/
|
||||||
|
public String getFile(String filePath){
|
||||||
|
String temJson = null;
|
||||||
|
try(InputStream inputStream = fileStorageUtil.getFileStream(filePath)){
|
||||||
|
temJson = IoUtil.read(inputStream, CharsetUtil.UTF_8);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return temJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,21 +42,20 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>pq-device-api</artifactId>
|
<artifactId>pq-device-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>advance-api</artifactId>
|
<artifactId>advance-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>event-api</artifactId>
|
<artifactId>event-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.njcn.advance.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.netflix.ribbon.proxy.annotation.Http;
|
||||||
|
import com.njcn.advance.pojo.dto.BalanceInfo;
|
||||||
|
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
||||||
|
import com.njcn.advance.service.EventRelevantAnalysisService;
|
||||||
|
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.common.utils.PubUtils;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 事件关联分析
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/30
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("process")
|
||||||
|
@Api(tags = "暂降事件关联分析")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class EventRelevantAnalysisController extends BaseController {
|
||||||
|
|
||||||
|
private final EventRelevantAnalysisService eventRelevantAnalysisService;
|
||||||
|
|
||||||
|
@GetMapping("processEvents")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("启动关联分析")
|
||||||
|
public HttpResult<Object> processEvents(@RequestParam("startTime") String startTime, @RequestParam("endTime")String endTime) {
|
||||||
|
String methodDescribe = getMethodDescribe("processEvents");
|
||||||
|
List<LocalDateTime> timeVal = PubUtils.checkLocalDateTime(startTime,endTime);
|
||||||
|
eventRelevantAnalysisService.processEvents(timeVal.get(0),timeVal.get(1));
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级算法-暂降事件关联分析主列表
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/20
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/querySagEventsPage")
|
||||||
|
@ApiOperation("高级算法-暂降事件关联分析主列表")
|
||||||
|
public HttpResult<Page<AdvanceEventDetailVO>> querySagEventsPage(BaseParam baseParam){
|
||||||
|
String methodDescribe = getMethodDescribe("querySagEventsPage");
|
||||||
|
Page<AdvanceEventDetailVO> list = eventRelevantAnalysisService.querySagEventsPage(baseParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.njcn.advance.controller;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||||
|
import com.njcn.advance.service.EventWaveAnalysisService;
|
||||||
|
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.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 波形高级分析
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("waveAnalysis")
|
||||||
|
@Api(tags = "波形高级分析")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class EventWaveAnalysisController extends BaseController {
|
||||||
|
|
||||||
|
private final EventWaveAnalysisService eventWaveAnalysisService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("analysis")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("波形高级分析")
|
||||||
|
@ApiImplicitParam(name = "eventIndex", value = "暂降事件id", required = true)
|
||||||
|
public HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex) {
|
||||||
|
String methodDescribe = getMethodDescribe("analysis");
|
||||||
|
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.advance.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.EntityLogic;
|
||||||
|
import com.njcn.advance.pojo.po.PqsRelevanceLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/19
|
||||||
|
*/
|
||||||
|
public interface RelevantMapper extends BaseMapper<PqsRelevanceLog> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取母线物理隔绝信息
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/21
|
||||||
|
*/
|
||||||
|
List<EntityLogic> getLogic();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.advance.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.advance.pojo.dto.SagEvent;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/19
|
||||||
|
*/
|
||||||
|
public interface RmpEventAdvanceMapper extends BaseMapper<RmpEventDetailPO> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.njcn.advance.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.advance.pojo.dto.SagEvent;
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.EventAssObj;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailAssPO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/9
|
||||||
|
*/
|
||||||
|
public interface RmpEventDetailAssMapper extends BaseMapper<RmpEventDetailAssPO> {
|
||||||
|
|
||||||
|
|
||||||
|
int insertEventAssData(@Param("list") List<EventAssObj> list);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?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.advance.mapper.RelevantMapper">
|
||||||
|
|
||||||
|
<select id="updateCause" resultType="EntityLogic">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?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.advance.mapper.RelevantMapper">
|
||||||
|
|
||||||
|
<select id="getLogic" resultType="EntityLogic">
|
||||||
|
SELECT
|
||||||
|
a.tp_index tPIndex,
|
||||||
|
b.logic_before nodeBefore,
|
||||||
|
b.logic_next nodeNext,
|
||||||
|
d.Algo_Describe type
|
||||||
|
FROM
|
||||||
|
pqs_tflgployass a,
|
||||||
|
pqs_tflgass b,
|
||||||
|
pqs_transformer c,
|
||||||
|
sys_dict_data d
|
||||||
|
WHERE
|
||||||
|
a.tf_index = b.tf_index
|
||||||
|
AND b.tf_index = c.tf_index
|
||||||
|
and c.Wiring = d.id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?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.advance.mapper.RmpEventDetailAssMapper">
|
||||||
|
|
||||||
|
<!-- pqs_eventass批量插入数据 -->
|
||||||
|
<insert id="insertEventAssData" parameterType="java.util.List">
|
||||||
|
insert into r_mp_event_detail_ass values
|
||||||
|
<foreach collection="list" item="eventAssData" index="index"
|
||||||
|
separator=",">
|
||||||
|
(
|
||||||
|
#{eventAssData.indexEventAss},#{eventAssData.time},#{eventAssData.describe},
|
||||||
|
#{eventAssData.bRange},#{eventAssData.indexUser},#{eventAssData.indexUser},#{eventAssData.updateTime},#{eventAssData.updateTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.njcn.advance.service;
|
package com.njcn.advance.service;
|
||||||
|
|
||||||
|
|
||||||
import com.njcn.advance.pojo.dto.BalanceInfo;
|
import com.njcn.advance.pojo.dto.BalanceInfo;
|
||||||
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.advance.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/30
|
||||||
|
*/
|
||||||
|
public interface EventRelevantAnalysisService extends IService<RmpEventDetailPO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/30
|
||||||
|
*/
|
||||||
|
void processEvents(LocalDateTime startTime,LocalDateTime endTime);
|
||||||
|
|
||||||
|
|
||||||
|
Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.njcn.advance.service;
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/1
|
||||||
|
*/
|
||||||
|
public interface EventWaveAnalysisService {
|
||||||
|
|
||||||
|
EntityAdvancedData analysis(String eventIndex);
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.njcn.advance.service.impl;
|
package com.njcn.advance.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
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.advance.mapper.BalanceMapper;
|
import com.njcn.advance.mapper.BalanceMapper;
|
||||||
import com.njcn.advance.pojo.dto.AdvanceBaseDTO;
|
import com.njcn.advance.pojo.dto.AdvanceBaseDTO;
|
||||||
import com.njcn.advance.pojo.dto.BalanceInfo;
|
import com.njcn.advance.pojo.dto.BalanceInfo;
|
||||||
import com.njcn.advance.pojo.dto.QtIdx;
|
import com.njcn.advance.pojo.dto.relevent.QtIdx;
|
||||||
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
import com.njcn.advance.pojo.param.AdvanceBaseParam;
|
||||||
import com.njcn.advance.service.BalanceService;
|
import com.njcn.advance.service.BalanceService;
|
||||||
import com.njcn.advance.utils.GetBalanceUtils;
|
import com.njcn.advance.utils.GetBalanceUtils;
|
||||||
@@ -16,7 +14,6 @@ import com.njcn.common.utils.PubUtils;
|
|||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
|
||||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
@@ -25,7 +22,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +95,9 @@ public class BalanceServiceImpl implements BalanceService {
|
|||||||
balanceInfoList.add(balanceInfo);
|
balanceInfoList.add(balanceInfo);
|
||||||
}
|
}
|
||||||
// 打包数据传入dll/so计算结果
|
// 打包数据传入dll/so计算结果
|
||||||
|
|
||||||
getBalanceUtils.translateData(balanceInfoList);
|
getBalanceUtils.translateData(balanceInfoList);
|
||||||
|
|
||||||
return balanceInfoList;
|
return balanceInfoList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,475 @@
|
|||||||
|
package com.njcn.advance.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||||
|
import com.njcn.advance.mapper.RelevantMapper;
|
||||||
|
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||||
|
import com.njcn.advance.mapper.RmpEventDetailAssMapper;
|
||||||
|
import com.njcn.advance.pojo.dto.SagEvent;
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.*;
|
||||||
|
import com.njcn.advance.pojo.po.PqsRelevanceLog;
|
||||||
|
import com.njcn.advance.service.EventRelevantAnalysisService;
|
||||||
|
|
||||||
|
import com.njcn.advance.utils.UtilNormalization;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
|
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
|
import com.njcn.system.enums.SystemResponseEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanceMapper, RmpEventDetailPO> implements EventRelevantAnalysisService {
|
||||||
|
|
||||||
|
private final RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
||||||
|
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
|
private final RelevantMapper relevantMapper;
|
||||||
|
|
||||||
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||||
|
|
||||||
|
private final RmpEventAdvanceMapper eventAdvanceMapper;
|
||||||
|
|
||||||
|
private final LineFeignClient lineFeignClient;
|
||||||
|
|
||||||
|
private final RmpEventDetailAssMapper rmpEventDetailAssMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void processEvents(LocalDateTime startTime,LocalDateTime endTime) {
|
||||||
|
|
||||||
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
|
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.EVENT_REASON.getName(), DicDataEnum.SHORT_TROUBLE.getName()).getData();
|
||||||
|
if (Objects.isNull(dictData)) {
|
||||||
|
throw new BusinessException(SystemResponseEnum.ADVANCE_REASON);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LocalDateTime date = LocalDateTime.now();
|
||||||
|
HandleEvent handleEvent = new HandleEvent();
|
||||||
|
// 分析的事件进行处理
|
||||||
|
List<EntityGroupEvtData> baseList = handleEvent.getData(generalDeviceInfoClient,startTime,endTime);
|
||||||
|
|
||||||
|
// 传入的处理事件根据物理隔绝进行分组
|
||||||
|
|
||||||
|
List<EntityLogic> strategyList = relevantMapper.getLogic();
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(strategyList)) {
|
||||||
|
List<SagEvent> listSagEvent = new ArrayList<>();
|
||||||
|
List<EventAssObj> listEventAssObj = new ArrayList<>();
|
||||||
|
|
||||||
|
Map<String, List<String>> strategyToBusBarMap = new HashMap<>();
|
||||||
|
|
||||||
|
Map<String, EntityMtrans> mapRedis = new HashMap<>();
|
||||||
|
|
||||||
|
Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||||
|
strategyMap.forEach((key, list) -> {
|
||||||
|
List<String> before = list.stream().map(EntityLogic::getNodeBefore).distinct().collect(Collectors.toList());
|
||||||
|
List<String> after = list.stream().map(EntityLogic::getNodeNext).distinct().collect(Collectors.toList());
|
||||||
|
before.addAll(after);
|
||||||
|
before = before.stream().distinct().collect(Collectors.toList());
|
||||||
|
strategyToBusBarMap.put(key, before);
|
||||||
|
|
||||||
|
FinalData.NODE_NUM = before.size();
|
||||||
|
EntityMtrans entityMtrans = new EntityMtrans();
|
||||||
|
handleEvent.create_matrixcata(list, entityMtrans);
|
||||||
|
|
||||||
|
mapRedis.put(key, entityMtrans);
|
||||||
|
});
|
||||||
|
//TODO 是否要处理排序
|
||||||
|
|
||||||
|
strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
||||||
|
int index = 1;
|
||||||
|
List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
|
||||||
|
for (EntityGroupEvtData entityGroupEvtData : baseList) {
|
||||||
|
if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
|
||||||
|
entityGroupEvtData.setNode(index++);
|
||||||
|
list.add(entityGroupEvtData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
baseList.removeIf(entityGroupEvtData -> lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason()));
|
||||||
|
|
||||||
|
|
||||||
|
EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||||
|
Collections.sort(list);
|
||||||
|
list.toArray(entityGroupEvtData);
|
||||||
|
|
||||||
|
mapRedis.forEach((mKey, mVal) -> {
|
||||||
|
if (mKey.equals(lastKey)) {
|
||||||
|
/********************************************************************
|
||||||
|
* 算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||||
|
*********************************************************************/
|
||||||
|
int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||||
|
? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||||
|
: entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < circulation; i++) {
|
||||||
|
int to = 0;
|
||||||
|
|
||||||
|
if (i == circulation - 1) {
|
||||||
|
to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||||
|
? entityGroupEvtData.length
|
||||||
|
: (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||||
|
} else {
|
||||||
|
to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||||
|
i * FinalData.MAX_EVT_NUM, to);
|
||||||
|
EntityGroupData entityGroupData = handleEvent.translate(arrayObj, mVal);
|
||||||
|
// 处理分析结果
|
||||||
|
handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* 事件ID不在矩阵中,结果集为基础以时标为标准进行归集处理 注意:三相与(单相/两相)互斥
|
||||||
|
*****************************************************************************/
|
||||||
|
disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
|
||||||
|
|
||||||
|
|
||||||
|
int listSize = listEventAssObj.size();
|
||||||
|
int toIndex = 1000;
|
||||||
|
for (int i = 0; i < listSize; i += 1000) {
|
||||||
|
//作用为toIndex最后没有toIndex条数据则剩余几条newList中就装几条
|
||||||
|
if (i + 1000 > listSize) {
|
||||||
|
toIndex = listSize - i;
|
||||||
|
}
|
||||||
|
//分割lst
|
||||||
|
List<EventAssObj> newList = listEventAssObj.subList(i, i + toIndex);
|
||||||
|
//写入添加方法,需要写你的新增方法,把newList分切后的数据新增进入数据库。
|
||||||
|
rmpEventDetailAssMapper.insertEventAssData(newList);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RmpEventDetailPO> eventUpdateList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < listSagEvent.size(); i++) {
|
||||||
|
RmpEventDetailPO rmp = new RmpEventDetailPO();
|
||||||
|
rmp.setEventId(listSagEvent.get(i).getIndexEventDetail());
|
||||||
|
rmp.setEventassIndex(listSagEvent.get(i).getIndexEventAss());
|
||||||
|
rmp.setDealTime(listSagEvent.get(i).getDealTime());
|
||||||
|
eventUpdateList.add(rmp);
|
||||||
|
if ((i + 1) % 1000 == 0) {
|
||||||
|
this.updateBatchById(eventUpdateList);
|
||||||
|
eventUpdateList.clear();
|
||||||
|
} else if (i == listSagEvent.size() - 1) {
|
||||||
|
this.updateBatchById(eventUpdateList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 增加策略记录
|
||||||
|
String describe = "用户" + RequestUtil.getUserNickname() + "进行了关联分析";
|
||||||
|
PqsRelevanceLog entityPqsRelevance = new PqsRelevanceLog();
|
||||||
|
entityPqsRelevance.setContentDes(describe);
|
||||||
|
entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
entityPqsRelevance.setTimeId(date);
|
||||||
|
relevantMapper.insert(entityPqsRelevance);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "秒");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* 归集结果与非矩阵事件进行比对
|
||||||
|
**********************************************************************/
|
||||||
|
public void disposeNonStandardData(HandleEvent handleEvent, List<EntityGroupEvtData> noDealList, List<EventAssObj> list, List<SagEvent> list2, LocalDateTime date) {
|
||||||
|
// 如果还有未归集的数据则单独拎为单一事件处理
|
||||||
|
for (EntityGroupEvtData entityGroupEvtData : noDealList) {
|
||||||
|
String strUUID = IdUtil.simpleUUID();
|
||||||
|
entityGroupEvtData.getSagEvent().setIndexEventAss(strUUID);
|
||||||
|
entityGroupEvtData.getSagEvent().setDealTime(date);
|
||||||
|
|
||||||
|
List<SagEvent> dealList = new ArrayList<>();
|
||||||
|
dealList.add(entityGroupEvtData.getSagEvent());
|
||||||
|
handleEvent.processing(dealList, list, date);
|
||||||
|
list2.add(entityGroupEvtData.getSagEvent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class HandleEvent {
|
||||||
|
public EntityGroupData translate(EntityGroupEvtData entityGroupEvtData[], EntityMtrans entityMtrans) {
|
||||||
|
// 获取测试数据的数组长度
|
||||||
|
int test_log_num = entityGroupEvtData.length;
|
||||||
|
|
||||||
|
// 实例化EntityGroupData,给其中的数组分配空间
|
||||||
|
EntityGroupData group_buf = new EntityGroupData();
|
||||||
|
|
||||||
|
// 填入日志
|
||||||
|
setMatrixcata(group_buf, entityMtrans);
|
||||||
|
create_evt_buf(entityGroupEvtData, group_buf, test_log_num);
|
||||||
|
|
||||||
|
UtilNormalization.sort_Tstart(group_buf); // 根据时标进行划分
|
||||||
|
// 根据暂降类型进行划分
|
||||||
|
for (int i = 0; i < group_buf.getGrp_all_num(); i++) {
|
||||||
|
UtilNormalization.sort_cata(group_buf, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return group_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EntityGroupEvtData> getData(GeneralDeviceInfoClient generalDeviceInfoClient,LocalDateTime startTime,LocalDateTime endTime) {
|
||||||
|
List<EntityGroupEvtData> entityGroupEvtDataList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<DictData> advanceType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
|
Map<String, DictData> advanceMap = advanceType.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||||
|
|
||||||
|
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime,endTime);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < advanceEventDetailVOLsit.size(); i++) { // 获取监测点线路序号
|
||||||
|
//母线id
|
||||||
|
String nodePhysics = advanceEventDetailVOLsit.get(i).getVoltageId();
|
||||||
|
|
||||||
|
// 根据暂降类型获取高级算法对应的编号
|
||||||
|
int cata = 0;
|
||||||
|
long ll = 0L;
|
||||||
|
int start_time = 0;
|
||||||
|
|
||||||
|
if (Objects.isNull(advanceEventDetailVOLsit.get(i).getFirstType())) {
|
||||||
|
cata = advanceMap.get(advanceEventDetailVOLsit.get(i).getAdvanceType()).getAlgoDescribe();
|
||||||
|
ll = (long) (Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getStartTime()).getTime()
|
||||||
|
+ (advanceEventDetailVOLsit.get(i).getDuration() * 1000));
|
||||||
|
start_time = (int) (ll / 1000);
|
||||||
|
} else {
|
||||||
|
cata = advanceMap.get(advanceEventDetailVOLsit.get(i).getAdvanceType()).getAlgoDescribe(); // 获取类型
|
||||||
|
ll = (long) (Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getFirstTime()).getTime()
|
||||||
|
+ (advanceEventDetailVOLsit.get(i).getFirstMs()));
|
||||||
|
start_time = (int) (ll / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填充SagEvent对象数据
|
||||||
|
SagEvent sagEvent = new SagEvent();
|
||||||
|
|
||||||
|
sagEvent.setIndexEventDetail(advanceEventDetailVOLsit.get(i).getEventId());
|
||||||
|
sagEvent.setSagTime(advanceEventDetailVOLsit.get(i).getStartTime());
|
||||||
|
sagEvent.setFirstTime(PubUtils.ms2Date(ll));// 必须增加,否则序列化出错
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
/*String tem = advanceEventDetailVOLsit.get(i).getFirstTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
sagEvent.setStrTime(tem + "."
|
||||||
|
+ advanceEventDetailVOLsit.get(i).getFirstMs());*/
|
||||||
|
sagEvent.setTime(Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getStartTime()).getTime());
|
||||||
|
sagEvent.setFirstTimeMills(ll);
|
||||||
|
sagEvent.setMsec(advanceEventDetailVOLsit.get(i).getDuration().intValue());
|
||||||
|
//sagEvent.setSagTime(PubUtils.ms2Date(Timestamp.valueOf(advanceEventDetailVOLsit.get(i).getFirstTime()).getTime()));
|
||||||
|
PlantInfo plantInfo = new PlantInfo();
|
||||||
|
plantInfo.setNameBD(advanceEventDetailVOLsit.get(i).getSubName());
|
||||||
|
plantInfo.setNameGD(advanceEventDetailVOLsit.get(i).getGdName());
|
||||||
|
plantInfo.setNamePoint(advanceEventDetailVOLsit.get(i).getLineId());
|
||||||
|
sagEvent.setPlantInfo(plantInfo);
|
||||||
|
sagEvent.setIndexPoint(advanceEventDetailVOLsit.get(i).getLineId());
|
||||||
|
sagEvent.setCata(cata);
|
||||||
|
|
||||||
|
|
||||||
|
EntityGroupEvtData entityGroupEvtData = new EntityGroupEvtData(nodePhysics, start_time, cata, -1, sagEvent, advanceEventDetailVOLsit.get(i).getAdvanceReason());
|
||||||
|
entityGroupEvtDataList.add(entityGroupEvtData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entityGroupEvtDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create_evt_buf(EntityGroupEvtData[] arr, EntityGroupData obj, int len) {
|
||||||
|
System.arraycopy(arr, 0, obj.getIn_buf(), 0, arr.length);
|
||||||
|
obj.setEvt_in_num(len);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create_matrixcata(List<EntityLogic> list, EntityMtrans entityMtrans) {
|
||||||
|
EntityLogic[] node_data = new EntityLogic[list.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
node_data[i] = list.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
int len = node_data.length;
|
||||||
|
|
||||||
|
UtilNormalization.matrixcata_pro(node_data, entityMtrans, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatrixcata(EntityGroupData obj, EntityMtrans entityMtrans) {
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < (FinalData.MAX_CATA_NUM - 1); i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||||
|
obj.getMatrixcata()[i][j] = entityMtrans.getMatrixcata1()[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void show_group_info(EntityGroupData obj, List<SagEvent> list, List<EventAssObj> assEvent, LocalDateTime date) {
|
||||||
|
int i, j, k;
|
||||||
|
for (i = 0; i < obj.getGrp_all_num(); i++) {
|
||||||
|
String strUUID = IdUtil.simpleUUID();
|
||||||
|
List<SagEvent> listTem = new ArrayList<SagEvent>();
|
||||||
|
|
||||||
|
for (j = 0; j < FinalData.MAX_CATA_NUM + 2; j++) {
|
||||||
|
if (obj.getGrp_cata_num()[i][j] != 0) {
|
||||||
|
for (k = 0; k < obj.getGrp_cata_num()[i][j]; k++) {
|
||||||
|
obj.getGrp_cata_buf()[i][j][k].getSagEvent().setIndexEventAss(strUUID);
|
||||||
|
obj.getGrp_cata_buf()[i][j][k].getSagEvent().setDealTime(date);
|
||||||
|
listTem.add(obj.getGrp_cata_buf()[i][j][k].getSagEvent());
|
||||||
|
list.add(obj.getGrp_cata_buf()[i][j][k].getSagEvent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listTem.size() > 0) {
|
||||||
|
processing(listTem, assEvent, date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processing(List<SagEvent> list, List<EventAssObj> lists, LocalDateTime date) {
|
||||||
|
// 根据暂降事件发生时间进行排序
|
||||||
|
Collections.sort(list);
|
||||||
|
EventAssObj eventAssObj = new EventAssObj();
|
||||||
|
String strUUID = list.get(0).getIndexEventAss();
|
||||||
|
|
||||||
|
// 归一化处理数据填充
|
||||||
|
eventAssObj.setIndexEventAss(strUUID);
|
||||||
|
|
||||||
|
// 事件发生时间
|
||||||
|
eventAssObj.setTime(list.get(0).getSagTime());
|
||||||
|
|
||||||
|
|
||||||
|
// 获取当前用户GUID
|
||||||
|
eventAssObj.setIndexUser(RequestUtil.getUserIndex());
|
||||||
|
|
||||||
|
// 是否进行范围分析 默认未分析
|
||||||
|
eventAssObj.setbRange(1);
|
||||||
|
|
||||||
|
// 更新时间
|
||||||
|
eventAssObj.setUpdateTime(date);
|
||||||
|
|
||||||
|
|
||||||
|
// 暂降事件描述
|
||||||
|
String codeName = LocalDateTimeUtil.format(eventAssObj.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
|
||||||
|
String describe = "事件关联分析编号" + codeName + "共包含" + list.size() + "个事件";
|
||||||
|
eventAssObj.setDescribe(describe);
|
||||||
|
|
||||||
|
eventAssObj.setList(list);
|
||||||
|
lists.add(eventAssObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************************
|
||||||
|
* 获取变压器信息并生成矩阵
|
||||||
|
*************************************************************************************/
|
||||||
|
public void getNodeInfo(HandleEvent handleEvent) {
|
||||||
|
List<EntityLogic> list = relevantMapper.getLogic();
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
Map<String, List<EntityLogic>> tfMap = list.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||||
|
Map<String, List<String>> tfBusBarMap = new HashMap<>();
|
||||||
|
|
||||||
|
Map<String, EntityMtrans> entityMtranMap = new HashMap<>();
|
||||||
|
|
||||||
|
tfMap.forEach((key, val) -> {
|
||||||
|
List<String> tem = new ArrayList<>();
|
||||||
|
val.forEach(it -> {
|
||||||
|
tem.add(it.getNodeBefore());
|
||||||
|
tem.add(it.getNodeNext());
|
||||||
|
});
|
||||||
|
tfBusBarMap.put(key, tem);
|
||||||
|
|
||||||
|
EntityMtrans entityMtrans = new EntityMtrans();
|
||||||
|
handleEvent.create_matrixcata(val, entityMtrans);
|
||||||
|
entityMtranMap.put(key, entityMtrans);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<AdvanceEventDetailVO> querySagEventsAll(LocalDateTime startTime,LocalDateTime endTime) {
|
||||||
|
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||||
|
if (CollUtil.isNotEmpty(lineIds)) {
|
||||||
|
|
||||||
|
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.and(i -> i.isNull(RmpEventDetailPO::getEventassIndex).or().eq(RmpEventDetailPO::getEventassIndex, ""))
|
||||||
|
.between(RmpEventDetailPO::getStartTime, startTime, endTime);
|
||||||
|
|
||||||
|
|
||||||
|
List<RmpEventDetailPO> rmpEventDetailPOList = eventAdvanceMapper.selectList(lambdaQueryWrapper);
|
||||||
|
if (CollectionUtil.isEmpty(rmpEventDetailPOList)) {
|
||||||
|
throw new BusinessException(AdvanceResponseEnum.EVENT_EMPTY);
|
||||||
|
}
|
||||||
|
List<String> tempLineIds = rmpEventDetailPOList.stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
||||||
|
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||||
|
|
||||||
|
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
|
||||||
|
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||||
|
if (map.containsKey(item.getLineId())) {
|
||||||
|
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
|
||||||
|
item.setGdName(areaLineInfoVO.getGdName());
|
||||||
|
item.setSubName(areaLineInfoVO.getSubName());
|
||||||
|
item.setNum(areaLineInfoVO.getNum());
|
||||||
|
item.setVoltageId(areaLineInfoVO.getVoltageId());
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return advanceEventDetailVOList;
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,828 @@
|
|||||||
|
package com.njcn.advance.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.njcn.advance.enums.EnumEvt;
|
||||||
|
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||||
|
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
||||||
|
|
||||||
|
import com.njcn.advance.service.EventWaveAnalysisService;
|
||||||
|
import com.njcn.advance.utils.*;
|
||||||
|
import com.njcn.common.config.GeneralInfo;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.utils.FileUtil;
|
||||||
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
|
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||||
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.oss.constant.GeneralConstant;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
||||||
|
|
||||||
|
private final int MAXLENGTH = 128 * 3000; //波形最大值计算
|
||||||
|
|
||||||
|
private final RmpEventDetailFeignClient rmpEventDetailFeignClient;
|
||||||
|
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
|
private final LineFeignClient lineFeignClient;
|
||||||
|
|
||||||
|
private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
|
private final WaveUtils waveUtils;
|
||||||
|
|
||||||
|
private final RmpEventAdvanceMapper rmpEventAdvanceMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityAdvancedData analysis(String eventIndex) {
|
||||||
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
|
//调用方法获取暂降事件详情
|
||||||
|
RmpEventDetailPO rmpEventDetailPO = rmpEventAdvanceMapper.selectById(eventIndex);
|
||||||
|
EntityAdvancedData entityAdvancedData = null;
|
||||||
|
|
||||||
|
//获取PT变比
|
||||||
|
LineDetailDataVO lineDetailDataVO = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (rmpEventDetailPO.getFileFlag() == 1) {
|
||||||
|
//获取所有暂态原因
|
||||||
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||||
|
Map<Integer, DictData> eventReasonMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
|
|
||||||
|
InputStream inputStreamCfg = null;
|
||||||
|
InputStream inputStreamDat = null;
|
||||||
|
try {
|
||||||
|
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG);
|
||||||
|
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取
|
||||||
|
BufferedReader bufferedReader = null;
|
||||||
|
InputStreamReader read = null;
|
||||||
|
String strFileLine = null;
|
||||||
|
byte[] array = {};
|
||||||
|
List<String> temCfgList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
// 判断文件是否存在
|
||||||
|
array = IoUtil.readBytes(inputStreamDat);
|
||||||
|
|
||||||
|
read = new InputStreamReader(inputStreamCfg, CharsetUtil.UTF_8);// 考虑到编码格式
|
||||||
|
bufferedReader = new BufferedReader(read);
|
||||||
|
|
||||||
|
while ((strFileLine = bufferedReader.readLine()) != null) {
|
||||||
|
temCfgList.add(strFileLine);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (read != null) {
|
||||||
|
read.close();
|
||||||
|
}
|
||||||
|
if (inputStreamDat != null) {
|
||||||
|
inputStreamDat.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//原始波形
|
||||||
|
WaveData waveOriginalData = getWavedata(rmpEventDetailPO, temCfgList, array, 3);
|
||||||
|
List<List<Float>> originalList = waveOriginalData.getSunData();
|
||||||
|
|
||||||
|
entityAdvancedData = new EntityAdvancedData(originalList.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < originalList.size(); i++) {
|
||||||
|
entityAdvancedData.smp_x[i] = originalList.get(i).get(0).floatValue();//坐标轴
|
||||||
|
entityAdvancedData.smp_a[i] = originalList.get(i).get(1).floatValue();
|
||||||
|
entityAdvancedData.smp_b[i] = originalList.get(i).get(2).floatValue();
|
||||||
|
entityAdvancedData.smp_c[i] = originalList.get(i).get(3).floatValue();
|
||||||
|
}
|
||||||
|
entityAdvancedData.smp_len = originalList.size();
|
||||||
|
|
||||||
|
//抽点方法计算波形
|
||||||
|
WaveData wavePitchData = getWavedata(rmpEventDetailPO, temCfgList, array, 0);
|
||||||
|
List<List<Float>> pitchList = wavePitchData.getSunData();
|
||||||
|
|
||||||
|
// 将获取到的数据填充到结构体内
|
||||||
|
Rect rect = new Rect();
|
||||||
|
CauseStruct causeStruct = new CauseStruct();
|
||||||
|
|
||||||
|
for (int i = 0; i < pitchList.size(); i++) {
|
||||||
|
rect.smp_va[i] = pitchList.get(i).get(1).floatValue();
|
||||||
|
causeStruct.smp_va[i] = pitchList.get(i).get(1).floatValue();
|
||||||
|
|
||||||
|
rect.smp_vb[i] = pitchList.get(i).get(2).floatValue();
|
||||||
|
causeStruct.smp_vb[i] = pitchList.get(i).get(2).floatValue();
|
||||||
|
|
||||||
|
rect.smp_vc[i] = pitchList.get(i).get(3).floatValue();
|
||||||
|
causeStruct.smp_vc[i] = pitchList.get(i).get(3).floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.smp_len = pitchList.size();
|
||||||
|
|
||||||
|
if (rect.smp_len >= MAXLENGTH) { //超过60s的波形直接抛异常给上面处理
|
||||||
|
throw new BusinessException("波形超过60S");
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||||
|
causeStruct.smp_len = pitchList.size();
|
||||||
|
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||||
|
|
||||||
|
|
||||||
|
String hdrStr = waveUtils.getFile(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.HDR);
|
||||||
|
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
||||||
|
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
||||||
|
|
||||||
|
|
||||||
|
if(rmpEventDetailPO.getDealFlag()!=1){
|
||||||
|
//如果存在三个文件但是没有调用dll/so计算
|
||||||
|
|
||||||
|
getDataFromDLL(rmpEventDetailPO,waveOriginalData,rect,entityAdvancedData,causeStruct);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
* 根据返回的结果计算,获取暂降类型描述
|
||||||
|
****************************************************************/
|
||||||
|
if (entityAdvancedData.backNumber > 0) {
|
||||||
|
for (int i = 0; i < entityAdvancedData.backNumber; i++) {
|
||||||
|
entityAdvancedData.sagType[i] = eventReasonMap.get(entityAdvancedData.evt_buf[i].qvvr_cata_type[0]).getName();
|
||||||
|
|
||||||
|
switch (entityAdvancedData.evt_buf[i].qvvr_phasetype[0]) {
|
||||||
|
case 1:
|
||||||
|
entityAdvancedData.sagPhaseType[i] = "单相";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
entityAdvancedData.sagPhaseType[i] = "两相";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
entityAdvancedData.sagPhaseType[i] = "三相";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("高级算法波形计算" + timeInterval.interval());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 1-值调用暂降类型dll 2-两个dll都调用
|
||||||
|
private void judgeEvt(int type, String eventIndex, WaveData waveData, Rect rect, EntityAdvancedData entityAdvancedData) {
|
||||||
|
try {
|
||||||
|
//getDataFromDLL(type, eventIndex, waveData, rect, entityAdvancedData);
|
||||||
|
} catch (Exception e) {
|
||||||
|
//eventDetailMapper.updateDealFlag(3, eventIndex); //计算失败
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void getDataFromDLL(RmpEventDetailPO rmpEventDetailPOQuery,WaveData waveData, Rect rect, EntityAdvancedData entityAdvancedData, CauseStruct causeStruct) {
|
||||||
|
|
||||||
|
if(StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceType())){
|
||||||
|
JnaCallDllOrSo jnaCallDllOrSo = new JnaCallBalance("qvvr_dll");
|
||||||
|
jnaCallDllOrSo.setPath();
|
||||||
|
// 计算暂降类
|
||||||
|
JnaCallBalance.Eventlibrary INSTANTCE = JnaCallBalance.Eventlibrary.INSTANTCE;
|
||||||
|
INSTANTCE.qvvr_fun(rect);
|
||||||
|
|
||||||
|
initBackData(rect.evt_num, entityAdvancedData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @判断是否调用成功
|
||||||
|
* @成功执行更新pqs_eventdetail操作:更新dq持续时间、暂降类型、暂降原因、总分段数目
|
||||||
|
*/
|
||||||
|
if (rect.evt_num > 0) {
|
||||||
|
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||||
|
rmpEventDetailPO.setEventId(rmpEventDetailPOQuery.getEventId());
|
||||||
|
rmpEventDetailPO.setNum(rect.evt_num);
|
||||||
|
rmpEventDetailPO.setDqTime((double) rect.evt_buf[0].hold_time_dq);
|
||||||
|
rmpEventDetailPO.setFirstType((Integer.toString(rect.evt_buf[0].qvvr_cata_type[0])));
|
||||||
|
rmpEventDetailPO.setFirstTime(waveData.getFirstTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
|
rmpEventDetailPO.setFirstMs((double)waveData.getFirstMs());
|
||||||
|
|
||||||
|
|
||||||
|
// 排序并获取多段中最小的数据
|
||||||
|
float[] f = new float[rect.evt_num];
|
||||||
|
|
||||||
|
for (int i = 0; i < rect.evt_num; i++) {
|
||||||
|
Arrays.parallelSort(rect.evt_buf[i].u3_min, 0, Math.max(rect.evt_buf[i].u_min_num - 1, 0));
|
||||||
|
f[i] = rect.evt_buf[i].u3_min[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
float min = f[0];
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
for (int len = 1; len < f.length; len++) {
|
||||||
|
if (min - f[len] > 0) {
|
||||||
|
index = len;
|
||||||
|
min = f[len];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* add by sw 返回的分段位置需根据采样率进行恢复
|
||||||
|
********************************************************************/
|
||||||
|
List<AnalyWaveModel.tagOneRate> list = waveData.getRatesCfg().OneRate;
|
||||||
|
int rate = (int) waveData.getnOneWaveNum();
|
||||||
|
int k = 0;
|
||||||
|
int l = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
for (int j = 0; j < rect.evt_buf[0].SEG_T_num; j++) {
|
||||||
|
if (list.get(i).nOneSample >= rate && rect.evt_buf[0].SEG_T_idx[j] < list.get(i).nSampleNum
|
||||||
|
/ (list.get(i).nOneSample / rate)) {
|
||||||
|
rect.evt_buf[0].SEG_T_idx[j] = (int) (rect.evt_buf[0].SEG_T_idx[j]
|
||||||
|
* (list.get(i).nOneSample / rate));
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < rect.evt_buf[0].u_min_num; j++) {
|
||||||
|
if (list.get(i).nOneSample >= rate && rect.evt_buf[0].order_min_idx[j] < list.get(i).nSampleNum
|
||||||
|
/ (list.get(i).nOneSample / rate)) {
|
||||||
|
rect.evt_buf[0].order_min_idx[j] = (int) (rect.evt_buf[0].order_min_idx[j]
|
||||||
|
* (list.get(i).nOneSample / rate));
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int j = k; j < rect.evt_buf[0].SEG_T_num; j++) {
|
||||||
|
int posb = 0;
|
||||||
|
int pose = 0;
|
||||||
|
int pos = 0;
|
||||||
|
|
||||||
|
for (int kk = 0; kk <= i; kk++) {
|
||||||
|
pose += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||||
|
|
||||||
|
if (kk < i) {
|
||||||
|
posb += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||||
|
pos += list.get(kk).nSampleNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list.get(i).nOneSample >= rate
|
||||||
|
&& rect.evt_buf[0].SEG_T_idx[j] > posb
|
||||||
|
&& rect.evt_buf[0].SEG_T_idx[j] < pose) {
|
||||||
|
rect.evt_buf[0].SEG_T_idx[j] = (int) ((rect.evt_buf[0].SEG_T_idx[j] - posb) * list.get(i).nOneSample / rate) + pos;
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = l; j < rect.evt_buf[0].u_min_num; j++) {
|
||||||
|
int posb = 0;
|
||||||
|
int pose = 0;
|
||||||
|
int pos = 0;
|
||||||
|
|
||||||
|
for (int kk = 0; kk <= i; kk++) {
|
||||||
|
pose += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||||
|
|
||||||
|
if (kk < i) {
|
||||||
|
posb += list.get(kk).nSampleNum / list.get(kk).nOneSample * rate;
|
||||||
|
pos += list.get(kk).nSampleNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list.get(i).nOneSample >= rate
|
||||||
|
&& rect.evt_buf[0].order_min_idx[j] > posb
|
||||||
|
&& rect.evt_buf[0].order_min_idx[j] < pose) {
|
||||||
|
rect.evt_buf[0].order_min_idx[j] = (int) ((rect.evt_buf[0].order_min_idx[j] - posb) * list.get(i).nSampleNum / rate) + pos;
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
|
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
|
|
||||||
|
Integer tem = rect.evt_buf[index].qvvr_cata_type[0];
|
||||||
|
if(eventTypeMap.containsKey(tem)) {
|
||||||
|
rmpEventDetailPO.setAdvanceType(eventTypeMap.get(tem).getId());
|
||||||
|
}
|
||||||
|
rmpEventDetailPO.setDealFlag(1);
|
||||||
|
rmpEventAdvanceMapper.updateById(rmpEventDetailPO);
|
||||||
|
//setEntityAdvanceData();
|
||||||
|
//WriteData2File();
|
||||||
|
//eventDetailMapper.updateDealFlag(1, eventIndex); //计算有结果
|
||||||
|
} else if (rect.evt_num == 0) {
|
||||||
|
//eventDetailMapper.updateDealFlag(2, eventIndex);//已计算无结果
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceReason())) {
|
||||||
|
|
||||||
|
//暂降原因计算
|
||||||
|
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_dll_cause");
|
||||||
|
jnaCallDllReason.setPath();
|
||||||
|
|
||||||
|
JnaCallBalance.Balancelibrary CAUSE = JnaCallBalance.Balancelibrary.INSTANTCE;
|
||||||
|
CAUSE.qvvr_fun_cause(causeStruct);
|
||||||
|
|
||||||
|
if (causeStruct.no_cal == 1) {
|
||||||
|
causeStruct.cause = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取所有暂态原因
|
||||||
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||||
|
Map<Integer, DictData> eventReasonMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
|
|
||||||
|
// 暂降原因的结果更新到数据库
|
||||||
|
if(eventReasonMap.containsKey(causeStruct.cause)) {
|
||||||
|
RmpEventDetailPO updateRmpEventDetailPO = new RmpEventDetailPO();
|
||||||
|
updateRmpEventDetailPO.setEventId(rmpEventDetailPOQuery.getEventId());
|
||||||
|
updateRmpEventDetailPO.setAdvanceReason(eventReasonMap.get(causeStruct.cause).getId());
|
||||||
|
rmpEventAdvanceMapper.updateById(updateRmpEventDetailPO);
|
||||||
|
entityAdvancedData.sagReason[0] = eventReasonMap.get(causeStruct.cause).getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initBackData(int len, EntityAdvancedData entityAdvancedData) {
|
||||||
|
len = (len == 0 ? 1 : len);
|
||||||
|
|
||||||
|
entityAdvancedData.evt_buf = new BackData[len];
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
entityAdvancedData.evt_buf[i] = new BackData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据暂降事件索引获取波形数据
|
||||||
|
* 注:当前只考虑本地的波形文件
|
||||||
|
*
|
||||||
|
* @param rmpEventDetailPO 暂态事件
|
||||||
|
* @param flag 抽点方式 3.全部数据 1.抽点数据
|
||||||
|
*/
|
||||||
|
|
||||||
|
public WaveData getWavedata(RmpEventDetailPO rmpEventDetailPO, List<String> temCfgList, byte[] array, int flag) {
|
||||||
|
WaveData waveData = new WaveData();
|
||||||
|
|
||||||
|
waveData.setEventValue(PubUtils.floatRound(2, rmpEventDetailPO.getFeatureAmplitude().floatValue() * 100));
|
||||||
|
waveData.setPersistTime(PubUtils.floatRound(3, rmpEventDetailPO.getDuration().floatValue() / 1000));
|
||||||
|
waveData.setTrigeTime(AnalyWave.getTimeWave());
|
||||||
|
|
||||||
|
|
||||||
|
// 判断文件是否存在
|
||||||
|
if (StrUtil.isNotBlank(rmpEventDetailPO.getWavePath())) {
|
||||||
|
log.info(OssPath.WAVE_DIR + rmpEventDetailPO.getWavePath() + "路径下,文件找到了");
|
||||||
|
//CFG文件路径 pathTemp
|
||||||
|
//获取波形的瞬时值、RMS值数据
|
||||||
|
AnalyWave analyWave = new AnalyWave();
|
||||||
|
AnalyWaveModel.tagDataValue tagDataValue = analyWave.readComtrade(temCfgList, array, flag);
|
||||||
|
List<List<Float>> shunWave = tagDataValue.getListWaveData();//获取瞬时波形值
|
||||||
|
List<List<Float>> rmsWave = analyWave.showValidData(shunWave);//RMS值波形
|
||||||
|
waveData.setnOneWaveNum(analyWave.getnOneWaveNum());
|
||||||
|
waveData.setSunData(shunWave);
|
||||||
|
waveData.setTmpWaveTitle(tagDataValue.getTmpWaveTitle());
|
||||||
|
waveData.setFirstMs(analyWave.getFirstMs());
|
||||||
|
waveData.setFirstTime(analyWave.getFirstTime());
|
||||||
|
waveData.setRmsData(rmsWave);
|
||||||
|
waveData.setRatesCfg(analyWave.getRatesCfg());
|
||||||
|
/*********** Modify by yexibao ---Start **************/
|
||||||
|
waveData.setiPhasic(tagDataValue.getiPhasic());
|
||||||
|
/*********** Modify by yexibao ---End **************/
|
||||||
|
List<String> tmpWaveTitle = tagDataValue.getTmpWaveTitle();
|
||||||
|
/*********** Modify by yexibao ---Start **************/
|
||||||
|
for (int i = 0; i < tagDataValue.getiPhasic(); i++) {
|
||||||
|
if (tmpWaveTitle.get(i + 1).substring(1).indexOf("A") > -1) {
|
||||||
|
waveData.setA(tmpWaveTitle.get(i + 1).substring(1));
|
||||||
|
}
|
||||||
|
if (tmpWaveTitle.get(i + 1).substring(1).indexOf("B") > -1) {
|
||||||
|
waveData.setB(tmpWaveTitle.get(i + 1).substring(1));
|
||||||
|
}
|
||||||
|
if (tmpWaveTitle.get(i + 1).substring(1).indexOf("C") > -1) {
|
||||||
|
waveData.setC(tmpWaveTitle.get(i + 1).substring(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*********** Modify by yexibao ---End **************/
|
||||||
|
|
||||||
|
} else {
|
||||||
|
log.error(OssPath.WAVE_DIR + rmpEventDetailPO.getWavePath() + "路径下,文件找不到了");
|
||||||
|
}
|
||||||
|
|
||||||
|
return waveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void translateData(JSONObject jsonObject, LocalDateTime trigeTime, EntityAdvancedData entityAdvancedData) {
|
||||||
|
int len = Utils.getIntValue(jsonObject.get(EnumEvt.EVT_NUM.getProperty()).toString(), 0);
|
||||||
|
|
||||||
|
entityAdvancedData.backNumber = len;
|
||||||
|
//初始化EntityAdvancedData的BackData数据
|
||||||
|
len = (len == 0 ? 1 : len);
|
||||||
|
entityAdvancedData.evt_buf = new BackData[len];
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
entityAdvancedData.evt_buf[i] = new BackData();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int offset = 0; offset < len; offset++) {
|
||||||
|
BackData backData = new BackData();
|
||||||
|
/**
|
||||||
|
* @波形起始点(3相)
|
||||||
|
*/
|
||||||
|
backData.POW_a = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.POW_A.getProperty()).toString(), 0.0f);
|
||||||
|
backData.POW_b = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.POW_B.getProperty()).toString(), 0.0f);
|
||||||
|
backData.POW_c = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.POW_C.getProperty()).toString(), 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @跳变段电压变化
|
||||||
|
*/
|
||||||
|
backData.Voltagechange_Va = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.VOLTAGECHANGE_VA.getProperty()).toString(), 0.0f);
|
||||||
|
backData.Voltagechange_Vb = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.VOLTAGECHANGE_VB.getProperty()).toString(), 0.0f);
|
||||||
|
backData.Voltagechange_Vc = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.VOLTAGECHANGE_VC.getProperty()).toString(), 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @持续时间
|
||||||
|
*/
|
||||||
|
backData.hold_time_rms = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.HOLD_TIME_RMS.getProperty()).toString(), 0.0f);
|
||||||
|
backData.hold_time_dq = Utils.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.HOLD_TIME_DQ.getProperty()).toString(), 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @分段信息
|
||||||
|
*/
|
||||||
|
backData.SEG_T_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.SEG_T_NUM.getProperty()).toString(), 0);
|
||||||
|
|
||||||
|
for (int i = 0; i < backData.SEG_T_num; i++) {
|
||||||
|
backData.SEG_T_idx[i] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.SEG_T_IDX.getProperty()).get(Integer.toString(i)).toString(),
|
||||||
|
-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @特征幅值
|
||||||
|
*/
|
||||||
|
backData.u_min_num = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).get(EnumEvt.U_MIN_NUM.getProperty()).toString(), 0);
|
||||||
|
|
||||||
|
for (int j = 0; j < backData.u_min_num; j++) {
|
||||||
|
backData.ua_min[j] = Utils
|
||||||
|
.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.UA_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
||||||
|
backData.ub_min[j] = Utils
|
||||||
|
.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.UB_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
||||||
|
backData.uc_min[j] = Utils
|
||||||
|
.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.UC_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
||||||
|
backData.u3_min[j] = Utils
|
||||||
|
.getFloatValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.U3_MIN.getProperty()).get(Integer.toString(j)).toString(), 0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @相位跳变
|
||||||
|
*/
|
||||||
|
backData.angle_diff_an[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.ANGLE_DIFF_AN.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
backData.angle_diff_bn[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.ANGLE_DIFF_BN.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
backData.angle_diff_cn[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.ANGLE_DIFF_CN.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
backData.angle_diff_ap[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.ANGLE_DIFF_AP.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
backData.angle_diff_bp[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.ANGLE_DIFF_BP.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
backData.angle_diff_cp[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.ANGLE_DIFF_CP.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @不平衡度
|
||||||
|
*/
|
||||||
|
backData.bph_max_value[j] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty()).getJSONObject(offset)
|
||||||
|
.getJSONObject(EnumEvt.BPH_MAX_VALUE.getProperty()).get(Integer.toString(j)).toString(),
|
||||||
|
0.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @暂降原因
|
||||||
|
*/
|
||||||
|
backData.qvvr_cata_cause[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_CAUSE.getProperty())
|
||||||
|
.get(Integer.toString(j)).toString(), -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @暂降类型
|
||||||
|
*/
|
||||||
|
backData.qvvr_cata_type[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_CATA_TYPE.getProperty())
|
||||||
|
.get(Integer.toString(j)).toString(), -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @暂降相别
|
||||||
|
*/
|
||||||
|
backData.qvvr_phasetype[j] = Utils.getIntValue(jsonObject.getJSONArray(EnumEvt.EVT_BUF.getProperty())
|
||||||
|
.getJSONObject(offset).getJSONObject(EnumEvt.QVVR_PHASETYPE.getProperty())
|
||||||
|
.get(Integer.toString(j)).toString(), -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
entityAdvancedData.evt_buf[offset] = backData;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject.containsKey(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty())) {
|
||||||
|
if (!jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).isEmpty()) {
|
||||||
|
entityAdvancedData.power_after_buf = new PowerData[1];
|
||||||
|
PowerData power = new PowerData();
|
||||||
|
float fundP[] = new float[5];
|
||||||
|
fundP[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("A").toString(), 0.0f);
|
||||||
|
fundP[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("B").toString(), 0.0f);
|
||||||
|
fundP[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("C").toString(), 0.0f);
|
||||||
|
fundP[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("total").toString(), 0.0f);
|
||||||
|
fundP[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_P.getProperty()).get("zero").toString(), 0.0f);
|
||||||
|
power.setFundP(fundP);
|
||||||
|
|
||||||
|
float fundQ[] = new float[5];
|
||||||
|
fundQ[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("A").toString(), 0.0f);
|
||||||
|
fundQ[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("B").toString(), 0.0f);
|
||||||
|
fundQ[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("C").toString(), 0.0f);
|
||||||
|
fundQ[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("total").toString(), 0.0f);
|
||||||
|
fundQ[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_Q.getProperty()).get("zero").toString(), 0.0f);
|
||||||
|
power.setFundQ(fundQ);
|
||||||
|
|
||||||
|
float fundS[] = new float[5];
|
||||||
|
fundS[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("A").toString(), 0.0f);
|
||||||
|
fundS[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("B").toString(), 0.0f);
|
||||||
|
fundS[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("C").toString(), 0.0f);
|
||||||
|
fundS[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("total").toString(), 0.0f);
|
||||||
|
fundS[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.POWER_QVVR_AFTER_BUF.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.FUND_S.getProperty()).get("zero").toString(), 0.0f);
|
||||||
|
power.setFundS(fundS);
|
||||||
|
entityAdvancedData.power_after_buf[0] = power;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (jsonObject.containsKey(EnumEvt.QVVR_DIRECTION_INFO.getProperty())) {
|
||||||
|
if (!jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).isEmpty()) {
|
||||||
|
entityAdvancedData.qvvr_direction_info = new DirectionData[1];
|
||||||
|
DirectionData direction = new DirectionData();
|
||||||
|
int trigTime[] = new int[7];
|
||||||
|
trigTime[0] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString(), 0);
|
||||||
|
trigTime[1] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("month").toString(), 0);
|
||||||
|
trigTime[2] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("date").toString(), 0);
|
||||||
|
trigTime[3] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("hour").toString(), 0);
|
||||||
|
trigTime[4] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("minute").toString(), 0);
|
||||||
|
trigTime[5] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("second").toString(), 0);
|
||||||
|
trigTime[6] = Utils.getIntValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("millisecond").toString(), 0);
|
||||||
|
direction.setTrigTime(trigTime);
|
||||||
|
|
||||||
|
float qvvrBeforeRms[] = new float[6];
|
||||||
|
qvvrBeforeRms[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ua").toString(), 0.0f);
|
||||||
|
qvvrBeforeRms[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ub").toString(), 0.0f);
|
||||||
|
qvvrBeforeRms[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Uc").toString(), 0.0f);
|
||||||
|
qvvrBeforeRms[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ia").toString(), 0.0f);
|
||||||
|
qvvrBeforeRms[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ib").toString(), 0.0f);
|
||||||
|
qvvrBeforeRms[5] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_RMS.getProperty()).get("Fund_Ic").toString(), 0.0f);
|
||||||
|
direction.setQvvrBeforeRms(qvvrBeforeRms);
|
||||||
|
|
||||||
|
float qvvrBeforeZk[] = new float[6];
|
||||||
|
qvvrBeforeZk[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Za").toString(), 0.0f);
|
||||||
|
qvvrBeforeZk[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zb").toString(), 0.0f);
|
||||||
|
qvvrBeforeZk[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zc").toString(), 0.0f);
|
||||||
|
qvvrBeforeZk[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zab").toString(), 0.0f);
|
||||||
|
qvvrBeforeZk[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zbc").toString(), 0.0f);
|
||||||
|
qvvrBeforeZk[5] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_BEFORE_ZK.getProperty()).get("Zca").toString(), 0.0f);
|
||||||
|
direction.setQvvrBeforeZk(qvvrBeforeZk);
|
||||||
|
|
||||||
|
float qvvrOccurRms[] = new float[6];
|
||||||
|
qvvrOccurRms[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ua").toString(), 0.0f);
|
||||||
|
qvvrOccurRms[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ub").toString(), 0.0f);
|
||||||
|
qvvrOccurRms[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Uc").toString(), 0.0f);
|
||||||
|
qvvrOccurRms[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ia").toString(), 0.0f);
|
||||||
|
qvvrOccurRms[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ib").toString(), 0.0f);
|
||||||
|
qvvrOccurRms[5] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_RMS.getProperty()).get("Fund_Ic").toString(), 0.0f);
|
||||||
|
direction.setQvvrOccurRms(qvvrOccurRms);
|
||||||
|
|
||||||
|
float qvvrOccurZk[] = new float[6];
|
||||||
|
qvvrOccurZk[0] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Za").toString(), 0.0f);
|
||||||
|
qvvrOccurZk[1] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zb").toString(), 0.0f);
|
||||||
|
qvvrOccurZk[2] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zc").toString(), 0.0f);
|
||||||
|
qvvrOccurZk[3] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zab").toString(), 0.0f);
|
||||||
|
qvvrOccurZk[4] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zbc").toString(), 0.0f);
|
||||||
|
qvvrOccurZk[5] = Utils.getFloatValue(
|
||||||
|
jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_OCCUR_ZK.getProperty()).get("Zca").toString(), 0.0f);
|
||||||
|
direction.setQvvrOccurZk(qvvrOccurZk);
|
||||||
|
|
||||||
|
String qvvrPosInfo[] = new String[1];
|
||||||
|
qvvrPosInfo[0] = jsonObject.getJSONArray(EnumEvt.QVVR_DIRECTION_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.QVVR_POS_INFO.getProperty()).get("direction").toString();
|
||||||
|
direction.setQvvrPosInfo(qvvrPosInfo);
|
||||||
|
|
||||||
|
entityAdvancedData.qvvr_direction_info[0] = direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (jsonObject.containsKey(EnumEvt.QVVR_UTBL_INFO.getProperty())) {
|
||||||
|
if (!jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).isEmpty()) {
|
||||||
|
entityAdvancedData.qvvr_utbl_info = new UtblData[1];
|
||||||
|
UtblData direction = new UtblData();
|
||||||
|
long trigTime[] = new long[1];
|
||||||
|
String year = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("year").toString();
|
||||||
|
String month = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("month").toString();
|
||||||
|
String day = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("date").toString();
|
||||||
|
String hour = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("hour").toString();
|
||||||
|
String min = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("minute").toString();
|
||||||
|
String sec = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("second").toString();
|
||||||
|
String mil = jsonObject.getJSONArray(EnumEvt.QVVR_UTBL_INFO.getProperty()).getJSONObject(0)
|
||||||
|
.getJSONObject(EnumEvt.TRIG_TIME.getProperty()).get("millisecond").toString();
|
||||||
|
SimpleDateFormat dfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
Date utbl = null;
|
||||||
|
try {
|
||||||
|
utbl = dfs.parse(year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec + "." + mil);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
long between = utbl.getTime() - trigeTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
|
||||||
|
trigTime[0] = between;
|
||||||
|
direction.setTrigTime(trigTime);
|
||||||
|
entityAdvancedData.qvvr_utbl_info[0] = direction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,15 +4,11 @@ import cn.hutool.core.date.TimeInterval;
|
|||||||
import com.njcn.advance.pojo.bo.QtIdxArray;
|
import com.njcn.advance.pojo.bo.QtIdxArray;
|
||||||
import com.njcn.advance.pojo.bo.QvvrDataStruct;
|
import com.njcn.advance.pojo.bo.QvvrDataStruct;
|
||||||
import com.njcn.advance.pojo.dto.BalanceInfo;
|
import com.njcn.advance.pojo.dto.BalanceInfo;
|
||||||
import com.njcn.advance.pojo.dto.QtIdx;
|
import com.njcn.advance.pojo.dto.relevent.QtIdx;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.njcn.advance.utils;
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
import com.njcn.advance.pojo.bo.QvvrDataStruct;
|
import com.njcn.advance.pojo.bo.QvvrDataStruct;
|
||||||
|
import com.njcn.advance.pojo.dto.waveAnalysis.CauseStruct;
|
||||||
|
import com.njcn.advance.pojo.dto.waveAnalysis.Rect;
|
||||||
import com.sun.jna.Library;
|
import com.sun.jna.Library;
|
||||||
import com.sun.jna.Native;
|
import com.sun.jna.Native;
|
||||||
|
|
||||||
@@ -33,5 +35,23 @@ public class JnaCallBalance extends JnaCallDllOrSo{
|
|||||||
|
|
||||||
// 定义方法--->与C方法相对应
|
// 定义方法--->与C方法相对应
|
||||||
void qvvr_fun_cause(QvvrDataStruct data);
|
void qvvr_fun_cause(QvvrDataStruct data);
|
||||||
|
|
||||||
|
// 定义方法--->与C方法相对应
|
||||||
|
void qvvr_fun_cause(CauseStruct data);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Eventlibrary extends Library {
|
||||||
|
// 加载Lib库
|
||||||
|
|
||||||
|
|
||||||
|
Eventlibrary INSTANTCE = (Eventlibrary) Native.loadLibrary(JnaCallBalance.strpath, Eventlibrary.class);
|
||||||
|
|
||||||
|
|
||||||
|
// 计算暂降类
|
||||||
|
void qvvr_fun(Rect data);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.net.URLDecoder;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class JnaCallDllOrSo {
|
public class JnaCallDllOrSo {
|
||||||
private String path = "";
|
private String path = "";
|
||||||
private String pathDll = "";
|
|
||||||
private String nameDll;
|
private String nameDll;
|
||||||
|
|
||||||
public static String jarPath = "";
|
public static String jarPath = "";
|
||||||
|
|||||||
@@ -0,0 +1,382 @@
|
|||||||
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.advance.pojo.dto.relevent.*;
|
||||||
|
|
||||||
|
public class UtilNormalization {
|
||||||
|
public static void matrixcata_pro(EntityLogic[] transformer, EntityMtrans entityMtrans, int len) {
|
||||||
|
int i, j, k, con;
|
||||||
|
String node1, node2;
|
||||||
|
int src_node[] = new int[] { 0 };
|
||||||
|
|
||||||
|
// 连接方式转化为矩阵形式,行、列表示所有节点
|
||||||
|
// inf表示两个节点不相连,0表示与自身相连,其他数值表示变压器连接类型
|
||||||
|
// 将初始矩阵的元素设为inf,对角线元素设为0
|
||||||
|
for (i = 0; i < FinalData.NODE_NUM; i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||||
|
entityMtrans.getMtrans()[i][j] = FinalData.DATA_INF;
|
||||||
|
}
|
||||||
|
entityMtrans.getMtrans()[i][i] = 0;
|
||||||
|
}
|
||||||
|
// 根据transformer设置元素
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
node1 = transformer[i].getNode_h();
|
||||||
|
node2 = transformer[i].getNode_l();
|
||||||
|
con = transformer[i].getType();
|
||||||
|
//TODO
|
||||||
|
//entityMtrans.getMtrans()[node1 - 1][node2 - 1] = con;
|
||||||
|
//entityMtrans.getMtrans()[node2 - 1][node1 - 1] = con;
|
||||||
|
}
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (i = 0; i < FinalData.NODE_NUM; i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||||
|
str.append(entityMtrans.getMtrans()[i][j]).append(" ");
|
||||||
|
if (j == (FinalData.NODE_NUM - 1)) {
|
||||||
|
str.append("\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 类型匹配矩阵Matrixcata
|
||||||
|
// Matrixcata模式匹配矩阵,列为节点数,行为总类别数,元素为第一个节点分别是1-6类别情况下其他节点类别情况。
|
||||||
|
// 元素1,2,3,4,5,6 分别对应 Dc,Cb,Da,Cc,Db,Ca
|
||||||
|
// 设置矩阵第一行元素
|
||||||
|
for (i = 0; i < FinalData.NODE_NUM; i++) {
|
||||||
|
entityMtrans.getMatrixcata0()[0][i] = 0;
|
||||||
|
}
|
||||||
|
for (i = 1; i < FinalData.NODE_NUM; i++) {
|
||||||
|
// 路径缓存清空
|
||||||
|
for (j = 0; j < FinalData.MAX_PATH_NUM; j++) {
|
||||||
|
for (k = 0; k < (FinalData.NODE_NUM + 1); k++) {
|
||||||
|
entityMtrans.getPossiable_path()[j][k] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entityMtrans.setPath_num(0);
|
||||||
|
// 寻找路径
|
||||||
|
src_node[0] = 0;
|
||||||
|
findPath(entityMtrans, src_node, i, 0, 1, FinalData.NODE_NUM);
|
||||||
|
if (entityMtrans.getPath_num() != 0) {
|
||||||
|
entityMtrans.getMatrixcata0()[0][i] = entityMtrans.getPossiable_path()[0][FinalData.NODE_NUM]; // 采用第一条路径
|
||||||
|
} else {
|
||||||
|
entityMtrans.getMatrixcata0()[0][i] = FinalData.DATA_INF; // 找不到路径填大值表示不通
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 构造矩阵其他行元素
|
||||||
|
for (i = 1; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++)
|
||||||
|
// EntityGroupData.Matrixcata0[i][j] =
|
||||||
|
// EntityGroupData.Matrixcata0[0][j] + i;
|
||||||
|
{
|
||||||
|
if (entityMtrans.getMatrixcata0()[0][j] == FinalData.DATA_INF) {
|
||||||
|
entityMtrans.getMatrixcata0()[i][j] = FinalData.DATA_INF;
|
||||||
|
} else {
|
||||||
|
entityMtrans.getMatrixcata0()[i][j] = entityMtrans.getMatrixcata0()[0][j] + i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 将数据归类到0-5
|
||||||
|
for (i = 0; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||||
|
entityMtrans.getMatrixcata1()[i][j] = entityMtrans.getMatrixcata0()[i][j] % 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 0换成6,将数据归类到1-6
|
||||||
|
for (i = 0; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||||
|
if (entityMtrans.getMatrixcata1()[i][j] == 0) {
|
||||||
|
entityMtrans.getMatrixcata1()[i][j] = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str.delete(0, str.length());
|
||||||
|
for (i = 0; i < FinalData.EVT_TYPE_NUM; i++) {
|
||||||
|
for (j = 0; j < FinalData.NODE_NUM; j++) {
|
||||||
|
str.append(entityMtrans.getMatrixcata1()[i][j]).append(" ");
|
||||||
|
if (j == (FinalData.NODE_NUM - 1)) {
|
||||||
|
str.append("\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int findPath(EntityMtrans entityMtrans, int[] OriginalNode, int destination, int Weight, int src_num, int node_num) // 深度优先搜索
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
int last_node;
|
||||||
|
int nextNodes[] = new int[FinalData.NODE_NUM];
|
||||||
|
int nextNode_num = 0;
|
||||||
|
int nextNodes0[] = new int[FinalData.NODE_NUM];
|
||||||
|
int nextNode_num0 = 0;
|
||||||
|
int tmpPath[] = new int[FinalData.NODE_NUM + 1];
|
||||||
|
int tmpPath_num;
|
||||||
|
if (src_num < 1) // 源节点个数不对
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
last_node = OriginalNode[src_num - 1];
|
||||||
|
if (last_node > node_num) // 判断最后一个节点号是否在范围内
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
for (i = 0; i < node_num; i++) {
|
||||||
|
// if((Mtrans[last_node][i]>0)&&(Mtrans[last_node][i]<DATA_INF))
|
||||||
|
// //寻找相同的节点
|
||||||
|
if (entityMtrans.getMtrans()[last_node][i] > 0) // 寻找相同的节点
|
||||||
|
{
|
||||||
|
nextNodes[nextNode_num] = i;
|
||||||
|
nextNode_num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果一条路的最后一个节点就是目标节点,说明此路径是所有路径中的一条,可以直接return
|
||||||
|
if (last_node == destination) {
|
||||||
|
if (entityMtrans.getPath_num() >= FinalData.MAX_PATH_NUM) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
for (i = 0; i < src_num; i++) {
|
||||||
|
entityMtrans.getPossiable_path()[entityMtrans.getPath_num()][i] = OriginalNode[i];
|
||||||
|
}
|
||||||
|
entityMtrans.getPossiable_path()[entityMtrans.getPath_num()][FinalData.NODE_NUM] = Weight; // 最后一个节点填入变压器连接
|
||||||
|
entityMtrans.setPath_num(entityMtrans.getPath_num() + 1);
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < src_num; i++) {
|
||||||
|
if (destination == OriginalNode[i]) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 判断下一个节点有没有目的节点
|
||||||
|
for (i = 0; i < nextNode_num; i++) {
|
||||||
|
if (nextNodes[i] == destination) {
|
||||||
|
// 先清零;
|
||||||
|
for (j = 0; j < (FinalData.NODE_NUM + 1); j++) {
|
||||||
|
tmpPath[j] = 0;
|
||||||
|
}
|
||||||
|
// 填入源节点
|
||||||
|
for (j = 0; j < src_num; j++) {
|
||||||
|
tmpPath[j] = OriginalNode[j];
|
||||||
|
}
|
||||||
|
tmpPath[src_num] = destination; // 目的节点加在后面
|
||||||
|
tmpPath[FinalData.NODE_NUM] = Weight + entityMtrans.getMtrans()[last_node][destination]; // 最后一个点填入变压器累计
|
||||||
|
tmpPath_num = src_num + 1;
|
||||||
|
if (entityMtrans.getPath_num() >= FinalData.MAX_PATH_NUM) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
for (j = 0; j < (FinalData.NODE_NUM + 1); j++) {
|
||||||
|
entityMtrans.getPossiable_path()[entityMtrans.getPath_num()][j] = tmpPath[j]; // tmpPath为路径的路阻
|
||||||
|
}
|
||||||
|
entityMtrans.setPath_num(entityMtrans.getPath_num() + 1);
|
||||||
|
nextNodes[i] = 0;
|
||||||
|
if (nextNode_num != 0) // if(nextNode_num)
|
||||||
|
{
|
||||||
|
nextNode_num--;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 判断如果源节点中有下一个节点,不再寻找处理
|
||||||
|
for (j = 0; j < src_num; j++) {
|
||||||
|
if (nextNodes[i] == OriginalNode[j]) {
|
||||||
|
nextNodes[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 不是目的节点的下一节点继续寻找
|
||||||
|
for (i = 0; i < nextNode_num; i++) {
|
||||||
|
if (nextNodes[i] != 0) {
|
||||||
|
nextNodes0[nextNode_num0] = nextNodes[i];
|
||||||
|
nextNode_num0++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0; i < nextNode_num0; i++) {
|
||||||
|
// 填入源节点
|
||||||
|
for (j = 0; j < src_num; j++) {
|
||||||
|
tmpPath[j] = OriginalNode[j];
|
||||||
|
}
|
||||||
|
tmpPath[src_num] = nextNodes0[i]; // 下一个节点加在后面
|
||||||
|
tmpPath_num = src_num + 1;
|
||||||
|
findPath(entityMtrans, tmpPath, destination, (Weight + entityMtrans.getMtrans()[last_node][nextNodes0[i]]), tmpPath_num,
|
||||||
|
node_num);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int sort_Tstart(EntityGroupData buf) {
|
||||||
|
int res_num, out_num;
|
||||||
|
int idx = 0;
|
||||||
|
if ((buf == null) || (buf.getEvt_in_num() == 0)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
res_num = buf.getEvt_in_num();
|
||||||
|
while (res_num > 0) { // while(res_num)
|
||||||
|
out_num = sort_Tstart_single(buf);
|
||||||
|
// 输出缓冲填入归集缓冲
|
||||||
|
// buf.getGrp_buf()[idx] = buf.getOut_buf();
|
||||||
|
System.arraycopy(buf.getOut_buf(), 0, buf.getGrp_buf()[idx], 0, buf.getOut_buf().length);
|
||||||
|
buf.getGrp_num()[idx] = out_num;
|
||||||
|
// 未归集填入输入缓冲
|
||||||
|
// buf.setIn_buf(buf.getRes_buf());
|
||||||
|
System.arraycopy(buf.getRes_buf(), 0, buf.getIn_buf(), 0, buf.getRes_buf().length);
|
||||||
|
buf.setEvt_in_num(buf.getEvt_res_num());
|
||||||
|
idx++;
|
||||||
|
if (idx >= FinalData.MAX_GROUP_NUM) // 分组超限
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (out_num <= res_num) {
|
||||||
|
res_num = res_num - out_num;
|
||||||
|
} else {
|
||||||
|
break; // 分组数目超限
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buf.setGrp_all_num(idx);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int sort_Tstart_single(EntityGroupData buf) {
|
||||||
|
int i;
|
||||||
|
int start_time;
|
||||||
|
int thd_time1, thd_time2;
|
||||||
|
if ((buf == null) || (buf.getEvt_in_num() == 0)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
buf.setEvt_out_num(0);
|
||||||
|
buf.setEvt_res_num(0);
|
||||||
|
// 如果只有一个事件直接赋值返回
|
||||||
|
if (buf.getEvt_in_num() == 1) {
|
||||||
|
buf.setEvt_out_num(1);
|
||||||
|
// buf.getOut_buf()[0] = buf.getIn_buf()[0];
|
||||||
|
// System.arraycopy(buf.getIn_buf()[0], 0, buf.getOut_buf()[0], 0,
|
||||||
|
// 1);
|
||||||
|
buf.getOut_buf()[0] = (EntityGroupEvtData) buf.getIn_buf()[0].objClone();
|
||||||
|
return buf.getEvt_out_num();
|
||||||
|
}
|
||||||
|
start_time = buf.getIn_buf()[0].getStart_time();
|
||||||
|
thd_time1 = start_time - FinalData.TIME_THRESHOLD;
|
||||||
|
thd_time2 = start_time + FinalData.TIME_THRESHOLD;
|
||||||
|
// 判断时标阀值门槛归集
|
||||||
|
for (i = 0; i < buf.getEvt_in_num(); i++) {
|
||||||
|
start_time = buf.getIn_buf()[i].getStart_time();
|
||||||
|
// 在阈值范围内
|
||||||
|
if ((start_time >= thd_time1) && (start_time <= thd_time2)) {
|
||||||
|
// buf.getOut_buf()[buf.getEvt_out_num()] = buf.getIn_buf()[i];
|
||||||
|
// System.arraycopy(buf.getIn_buf()[i], 0,
|
||||||
|
// buf.getOut_buf()[buf.getEvt_out_num()], 0, 1);
|
||||||
|
buf.getOut_buf()[buf.getEvt_out_num()] = (EntityGroupEvtData) buf.getIn_buf()[i].objClone();
|
||||||
|
buf.setEvt_out_num(buf.getEvt_out_num() + 1);
|
||||||
|
} else {
|
||||||
|
// buf.getRes_buf()[buf.getEvt_res_num()] = buf.getIn_buf()[i];
|
||||||
|
// System.arraycopy(buf.getIn_buf()[i], 0,
|
||||||
|
// buf.getRes_buf()[buf.getEvt_res_num()], 0, 1);
|
||||||
|
buf.getRes_buf()[buf.getEvt_res_num()] = (EntityGroupEvtData) buf.getIn_buf()[i].objClone();
|
||||||
|
buf.setEvt_res_num(buf.getEvt_res_num() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.getEvt_out_num();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int sort_cata(EntityGroupData buf, int idx) {
|
||||||
|
int i, j;
|
||||||
|
int cata, node;
|
||||||
|
int odrer[] = new int[FinalData.MAX_CATA_NUM + 2];
|
||||||
|
// 针对类别是1-6的数据进行模式匹配,并标注属于哪一个模式
|
||||||
|
|
||||||
|
for (i = 0; i < (FinalData.MAX_CATA_NUM + 2); i++) {
|
||||||
|
odrer[i] = 0;
|
||||||
|
}
|
||||||
|
// 暂降类型转换
|
||||||
|
// 将类型7,8,9转换为6,2,4
|
||||||
|
// 其中7,8,9分别对应BC两相接地,AC两相接地,AB两相接地,1,2,3,4,5,6分别对应Dc,Cb,Da,Cc,Db,Ca
|
||||||
|
/*
|
||||||
|
* for (i = 0; i < buf.getGrp_num()[idx]; i++) { if
|
||||||
|
* (buf.getGrp_buf()[idx][i].getCata() == 7)
|
||||||
|
* buf.getGrp_buf()[idx][i].setCata(6); if
|
||||||
|
* (buf.getGrp_buf()[idx][i].getCata() == 8)
|
||||||
|
* buf.getGrp_buf()[idx][i].setCata(2); if
|
||||||
|
* (buf.getGrp_buf()[idx][i].getCata() == 9)
|
||||||
|
* buf.getGrp_buf()[idx][i].setCata(4); }
|
||||||
|
*/
|
||||||
|
for (i = 0; i < buf.getGrp_num()[idx]; i++) {
|
||||||
|
/*
|
||||||
|
* if (buf.getGrp_buf()[idx][i].getCata() == 10) //事件类型未知
|
||||||
|
* buf.getGrp_buf()[idx][i].setCata(11); if
|
||||||
|
* (buf.getGrp_buf()[idx][i].getCata() == 9) //三相
|
||||||
|
* buf.getGrp_buf()[idx][i].setCata(10);
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (buf.getGrp_buf()[idx][i].getCata() == 0) {
|
||||||
|
buf.getGrp_buf()[idx][i].setCata(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf.getGrp_buf()[idx][i].getCata() == 6) {
|
||||||
|
buf.getGrp_buf()[idx][i].setCata(6);
|
||||||
|
}
|
||||||
|
if (buf.getGrp_buf()[idx][i].getCata() == 7) {
|
||||||
|
buf.getGrp_buf()[idx][i].setCata(2);
|
||||||
|
}
|
||||||
|
if (buf.getGrp_buf()[idx][i].getCata() == 8) {
|
||||||
|
buf.getGrp_buf()[idx][i].setCata(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将数据进行模式匹配,并标注属于哪一个模式
|
||||||
|
for (i = 0; i < buf.getGrp_num()[idx]; i++) {
|
||||||
|
cata = buf.getGrp_buf()[idx][i].getCata();
|
||||||
|
node = buf.getGrp_buf()[idx][i].getNode();
|
||||||
|
|
||||||
|
if ((node > FinalData.NODE_NUM) || (buf.getMatrixcata()[0][node - 1] == FinalData.DATA_INF)) {
|
||||||
|
buf.getGrp_buf()[idx][i].setCata2(FinalData.QVVR_TYPE_OUTOFRANGE);
|
||||||
|
// buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM +
|
||||||
|
// 1][odrer[FinalData.MAX_CATA_NUM + 1]] =
|
||||||
|
// buf.getGrp_buf()[idx][i];
|
||||||
|
// System.arraycopy(buf.getGrp_buf()[idx][i], 0,
|
||||||
|
// buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM +
|
||||||
|
// 1][odrer[FinalData.MAX_CATA_NUM + 1]], 0, 1);
|
||||||
|
buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM + 1][odrer[FinalData.MAX_CATA_NUM
|
||||||
|
+ 1]] = (EntityGroupEvtData) buf.getGrp_buf()[idx][i].objClone();
|
||||||
|
odrer[FinalData.MAX_CATA_NUM + 1]++;
|
||||||
|
} else if (cata == FinalData.QVVR_TYPE_UNKNOWN) {
|
||||||
|
buf.getGrp_buf()[idx][i].setCata2(FinalData.QVVR_TYPE_UNKNOWN);
|
||||||
|
// buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM][odrer[FinalData.MAX_CATA_NUM]]
|
||||||
|
// = buf.getGrp_buf()[idx][i];
|
||||||
|
// System.arraycopy(buf.getGrp_buf()[idx][i], 0,
|
||||||
|
// buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM][odrer[FinalData.MAX_CATA_NUM]],
|
||||||
|
// 0, 1);
|
||||||
|
buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM][odrer[FinalData.MAX_CATA_NUM]] = (EntityGroupEvtData) buf
|
||||||
|
.getGrp_buf()[idx][i].objClone();
|
||||||
|
odrer[FinalData.MAX_CATA_NUM]++;
|
||||||
|
} else if (cata == FinalData.QVVR_TYPE_THREE) // ÈıÏàÔݽµ¹éÀà
|
||||||
|
{
|
||||||
|
buf.getGrp_buf()[idx][i].setCata2(FinalData.QVVR_TYPE_THREE);
|
||||||
|
// buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM -
|
||||||
|
// 1][odrer[FinalData.MAX_CATA_NUM - 1]] =
|
||||||
|
// buf.getGrp_buf()[idx][i];
|
||||||
|
// System.arraycopy(buf.getGrp_buf()[idx][i], 0,
|
||||||
|
// buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM -
|
||||||
|
// 1][odrer[FinalData.MAX_CATA_NUM - 1]], 0, 1);
|
||||||
|
buf.getGrp_cata_buf()[idx][FinalData.MAX_CATA_NUM - 1][odrer[FinalData.MAX_CATA_NUM
|
||||||
|
- 1]] = (EntityGroupEvtData) buf.getGrp_buf()[idx][i].objClone();
|
||||||
|
odrer[FinalData.MAX_CATA_NUM - 1]++;
|
||||||
|
} else // 1-6类暂降归类
|
||||||
|
{
|
||||||
|
for (j = 0; j < FinalData.MAX_CATA_NUM; j++) {
|
||||||
|
if (cata == buf.getMatrixcata()[j][node - 1])// 判断数据类别属于第几行
|
||||||
|
{
|
||||||
|
buf.getGrp_buf()[idx][i].setCata2(j + 1);
|
||||||
|
// 进行归类
|
||||||
|
// buf.getGrp_cata_buf()[idx][j][odrer[j]] =
|
||||||
|
// buf.getGrp_buf()[idx][i];
|
||||||
|
// System.arraycopy(buf.getGrp_buf()[idx][i], 0,
|
||||||
|
// buf.getGrp_cata_buf()[idx][j][odrer[j]], 0, 1);
|
||||||
|
buf.getGrp_cata_buf()[idx][j][odrer[j]] = (EntityGroupEvtData) buf.getGrp_buf()[idx][i]
|
||||||
|
.objClone();
|
||||||
|
odrer[j]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i = 0; i < FinalData.MAX_CATA_NUM + 2; i++) {
|
||||||
|
buf.getGrp_cata_num()[idx][i] = odrer[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Sunwei 【sunW2016@163.com】
|
||||||
|
* @Description:
|
||||||
|
* @Date: Create in 22:28 2018/3/5
|
||||||
|
* @Modified By:
|
||||||
|
* @author njcn
|
||||||
|
*/
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/*****************************************************************
|
||||||
|
* 字符串转基础类型,可能转换不成功,封装该方法
|
||||||
|
* 第一个参数为需要转换的字符串
|
||||||
|
* 第二个参数为null时,直接抛出异常,为数值则传入一个默认值
|
||||||
|
*****************************************************************/
|
||||||
|
public class Utils {
|
||||||
|
public static int getIntValue(String s,Integer integer) {
|
||||||
|
try {
|
||||||
|
integer = Integer.parseInt(s);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (null == integer) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return integer.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String对象转float
|
||||||
|
*
|
||||||
|
* @param f
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static float getFloatValue(String s,Float f) {
|
||||||
|
try {
|
||||||
|
f = Float.parseFloat(s);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (null == f) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return f.floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String对象转double
|
||||||
|
*
|
||||||
|
* @param d
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static double getDoubleValue(String s,Double d) {
|
||||||
|
try {
|
||||||
|
d = Double.parseDouble(s);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (null == d) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return d.doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* int转String对象
|
||||||
|
*/
|
||||||
|
public static String int2String(int iValue) {
|
||||||
|
return Integer.toString(iValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* float转String
|
||||||
|
*/
|
||||||
|
public static String float2String(float fValue) {
|
||||||
|
return Float.toString(fValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按指定大小,分隔集合,将集合按规定个数分为n个部分
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/10/26
|
||||||
|
*/
|
||||||
|
public static List<List<Integer>> splitList(List<Integer> list, int len){
|
||||||
|
if(CollectionUtil.isEmpty(list) || len<1){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<List<Integer>> result = new ArrayList<>();
|
||||||
|
int size = list.size();
|
||||||
|
int count = (size+len-1)/1000;
|
||||||
|
for(int i=0;i<count;i++){
|
||||||
|
List<Integer> subList= list.subList(i*len,((i+1)*len>size?size:len*(i+1)));
|
||||||
|
result.add(subList);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.common.utils;
|
package com.njcn.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
@@ -11,6 +12,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@@ -217,6 +219,30 @@ public class PubUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字符串起始时间和结束时间并返回时间格式时间
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/10
|
||||||
|
*/
|
||||||
|
public static List<LocalDateTime> checkLocalDateTime(String startTime,String endTime) {
|
||||||
|
List<LocalDateTime> resultList = new ArrayList<>();
|
||||||
|
if(StrUtil.isBlank(startTime) || StrUtil.isBlank(endTime)){
|
||||||
|
throw new BusinessException(CommonResponseEnum.TIME_ERROR);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
startTime = startTime+StrUtil.SPACE+"00:00:00";
|
||||||
|
endTime = endTime+StrUtil.SPACE+"23:59:59";
|
||||||
|
LocalDateTime start = LocalDateTime.parse(startTime,DateTimeFormatter.ofPattern(DATE_TIME));
|
||||||
|
LocalDateTime end = LocalDateTime.parse(endTime,DateTimeFormatter.ofPattern(DATE_TIME));
|
||||||
|
resultList.add(start);
|
||||||
|
resultList.add(end);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.TIME_ERROR);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 仅供pms系统修改单位部门时候调用,同步修改pms台账表里的单位部门
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2023/4/24
|
* @date 2023/4/24
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public interface GeneralDeviceInfoClient {
|
|||||||
HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
|
HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*根据单位获取投运监测点
|
*根据单位获取投运监测点(双系统)
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2023/6/7
|
* @date 2023/6/7
|
||||||
*/
|
*/
|
||||||
@@ -126,7 +126,7 @@ public interface GeneralDeviceInfoClient {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*根据单位获取投运监测点
|
*根据单位获取暂态系统投运监测点
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2023/6/7
|
* @date 2023/6/7
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.device.pq.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.pq.api.fallback.TerminalBaseClientFallbackFactory;
|
||||||
|
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||||
|
import com.njcn.device.pq.pojo.po.Line;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2022年02月14日 14:02
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.DEVICE, path = "/pqsTransformer", fallbackFactory = TerminalBaseClientFallbackFactory.class, contextId = "pqsTransformer")
|
||||||
|
public interface TransformerClient {
|
||||||
|
|
||||||
|
|
||||||
|
HttpResult<List<EntityLogicDTO>> getLogic();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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.TerminalBaseClient;
|
||||||
|
import com.njcn.device.pq.api.TransformerClient;
|
||||||
|
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||||
|
import com.njcn.device.pq.pojo.po.Line;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2022年02月14日 14:03
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class TransformerClientFallbackFactory implements FallbackFactory<TransformerClient> {
|
||||||
|
@Override
|
||||||
|
public TransformerClient create(Throwable throwable) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (throwable.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||||
|
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new TransformerClient()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<EntityLogicDTO>> getLogic() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.device.pq.pojo.dto.transformer;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/8
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EntityLogicDTO {
|
||||||
|
|
||||||
|
// 物理隔绝GUID
|
||||||
|
private String tPIndex;
|
||||||
|
/* 变压器逻辑上节点 */
|
||||||
|
private String node_h;
|
||||||
|
//变压器逻辑下节点
|
||||||
|
private String node_l;
|
||||||
|
// 变压器连接方式
|
||||||
|
private Integer type;
|
||||||
|
//变压器物理上节点
|
||||||
|
private String nodeBefore;
|
||||||
|
//变压器物理下节点
|
||||||
|
private String nodeNext;
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||||
import com.njcn.device.pq.pojo.param.PqsTransformerParam;
|
import com.njcn.device.pq.pojo.param.PqsTransformerParam;
|
||||||
import com.njcn.device.pq.pojo.vo.PqsTflgassVO;
|
import com.njcn.device.pq.pojo.vo.PqsTflgassVO;
|
||||||
import com.njcn.device.pq.pojo.vo.PqsTransformerVO;
|
import com.njcn.device.pq.pojo.vo.PqsTransformerVO;
|
||||||
@@ -112,5 +113,15 @@ public class PqsTransformerController extends BaseController {
|
|||||||
List<TerminalTree> terminalTree = iPqsTransformerService.getTransformerTree();
|
List<TerminalTree> terminalTree = iPqsTransformerService.getTransformerTree();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, terminalTree, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, terminalTree, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getLogic")
|
||||||
|
@ApiOperation(value = "获取变压器策略详情")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
public HttpResult<List<EntityLogicDTO>> getLogic() {
|
||||||
|
String methodDescribe = getMethodDescribe("getLogic");
|
||||||
|
List<EntityLogicDTO> entityLogicDTOList = iPqsTransformerService.getLogic();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityLogicDTOList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.device.pq.mapper;
|
package com.njcn.device.pq.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||||
import com.njcn.device.pq.pojo.po.PqsTflgass;
|
import com.njcn.device.pq.pojo.po.PqsTflgass;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -25,4 +26,9 @@ public interface PqsTflgassMapper extends BaseMapper<PqsTflgass> {
|
|||||||
*/
|
*/
|
||||||
List<PqsTflgass> selectFlgass(@Param("id") String id,@Param("ids") List<String> ids);
|
List<PqsTflgass> selectFlgass(@Param("id") String id,@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取变压器策略物理节点
|
||||||
|
*/
|
||||||
|
List<EntityLogicDTO> getLogic();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,18 @@
|
|||||||
</where>
|
</where>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getLogic" resultType="EntityLogicDTO">
|
||||||
|
select a.tp_index tPIndex,
|
||||||
|
b.logic_before nodeBefore,
|
||||||
|
b.logic_next nodeNext,
|
||||||
|
d.triphase type
|
||||||
|
from pqs_tflgployass a
|
||||||
|
,pqs_tflgass b,
|
||||||
|
pqs_transformer c,
|
||||||
|
pqs_dicdata d
|
||||||
|
where a.tf_index = b.tf_index
|
||||||
|
and b.tf_index = c.tf_index
|
||||||
|
and c.wiring = d.dic_index
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.device.pq.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||||
import com.njcn.device.pq.pojo.param.PqsTransformerParam;
|
import com.njcn.device.pq.pojo.param.PqsTransformerParam;
|
||||||
import com.njcn.device.pq.pojo.po.PqsTransformer;
|
import com.njcn.device.pq.pojo.po.PqsTransformer;
|
||||||
import com.njcn.device.pq.pojo.vo.PqsTflgassVO;
|
import com.njcn.device.pq.pojo.vo.PqsTflgassVO;
|
||||||
@@ -84,4 +85,11 @@ public interface IPqsTransformerService extends IService<PqsTransformer> {
|
|||||||
* @date 2023/7/26
|
* @date 2023/7/26
|
||||||
*/
|
*/
|
||||||
List<TerminalTree> getTransformerTree();
|
List<TerminalTree> getTransformerTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有策略的详情
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/8
|
||||||
|
*/
|
||||||
|
List<EntityLogicDTO> getLogic();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.njcn.device.pq.enums.PvDeviceResponseEnum;
|
|||||||
import com.njcn.device.pq.mapper.LineMapper;
|
import com.njcn.device.pq.mapper.LineMapper;
|
||||||
import com.njcn.device.pq.mapper.PqsTflgassMapper;
|
import com.njcn.device.pq.mapper.PqsTflgassMapper;
|
||||||
import com.njcn.device.pq.mapper.PqsTransformerMapper;
|
import com.njcn.device.pq.mapper.PqsTransformerMapper;
|
||||||
|
import com.njcn.device.pq.pojo.dto.transformer.EntityLogicDTO;
|
||||||
import com.njcn.device.pq.pojo.param.PqsTransformerParam;
|
import com.njcn.device.pq.pojo.param.PqsTransformerParam;
|
||||||
import com.njcn.device.pq.pojo.po.Line;
|
import com.njcn.device.pq.pojo.po.Line;
|
||||||
import com.njcn.device.pq.pojo.po.PqsTflgass;
|
import com.njcn.device.pq.pojo.po.PqsTflgass;
|
||||||
@@ -377,6 +378,11 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
|
|||||||
return TreedChildren(terminalTrees, "变压器设备树", null);
|
return TreedChildren(terminalTrees, "变压器设备树", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EntityLogicDTO> getLogic() {
|
||||||
|
return pqsTflgassMapper.getLogic();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取全部子节点
|
* 获取全部子节点
|
||||||
*
|
*
|
||||||
@@ -576,4 +582,6 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
|
|||||||
return getvoltage.get(0);
|
return getvoltage.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.njcn.event.api;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
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.event.api.fallback.EventDetailFeignClientFallbackFactory;
|
||||||
|
import com.njcn.event.api.fallback.RmpEventDetailFeignClientFallbackFactory;
|
||||||
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
|
import com.njcn.event.pojo.vo.GeneralVO;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author denghuajun
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2022/3/16
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.EVENT,path = "/rmpEventDetail",fallbackFactory = RmpEventDetailFeignClientFallbackFactory.class)
|
||||||
|
public interface RmpEventDetailFeignClient {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取暂降事件详细信息
|
||||||
|
* @param eventId 暂态事件id
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/28
|
||||||
|
*/
|
||||||
|
@GetMapping("/queryEventDetailByEventId")
|
||||||
|
HttpResult<RmpEventDetailPO> queryEventDetailByEventId(@RequestParam("eventId")String eventId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.njcn.event.api.fallback;
|
||||||
|
|
||||||
|
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.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.event.api.EventDetailFeignClient;
|
||||||
|
import com.njcn.event.api.RmpEventDetailFeignClient;
|
||||||
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
|
import com.njcn.event.pojo.vo.GeneralVO;
|
||||||
|
import com.njcn.event.utils.EventlEnumUtil;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @date 2023/07/21
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class RmpEventDetailFeignClientFallbackFactory implements FallbackFactory<RmpEventDetailFeignClient> {
|
||||||
|
@Override
|
||||||
|
public RmpEventDetailFeignClient create(Throwable throwable) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (throwable.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||||
|
exceptionEnum = EventlEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new RmpEventDetailFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<RmpEventDetailPO> queryEventDetailByEventId(String eventId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "查询暂降明细", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.event.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/8/9
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("r_mp_event_detail_ass")
|
||||||
|
public class RmpEventDetailAssPO extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*事件关联分析表uuid
|
||||||
|
*/
|
||||||
|
private String eventAssId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*发生时间(归一化中第一个时间)
|
||||||
|
*/
|
||||||
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*关联事件描述
|
||||||
|
*/
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*是否进行范围分析(0:分析;1:未分析)
|
||||||
|
*/
|
||||||
|
private Integer analyseFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -85,6 +85,7 @@ public class RmpEventDetailPO implements Serializable {
|
|||||||
private String sagsource;
|
private String sagsource;
|
||||||
|
|
||||||
@ApiModelProperty(value = "开始时间")
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "格式化开始时间")
|
@ApiModelProperty(value = "格式化开始时间")
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.njcn.event.pojo.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AdvanceEventDetailVO {
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "暂时事件ID")
|
||||||
|
private String eventId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点ID")
|
||||||
|
private String measurementPointId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点ID(复制)")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "统计类型")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "暂降原因(Event_Reason)")
|
||||||
|
private String advanceReason;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "暂降类型(Event_Type)")
|
||||||
|
private String advanceType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "事件关联分析表Guid")
|
||||||
|
private String eventassIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "dq计算持续时间 ")
|
||||||
|
private Double dqTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "特征值计算更新时间(外键PQS_Relevance的Time字段)")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
private LocalDateTime dealTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "默认事件个数为0")
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "波形文件是否从装置招到本地(0:未招,1:已招)默认值为0")
|
||||||
|
private Integer fileFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "特征值计算标志(0,未处理;1,已处理; 2,已处理,无结果;3,计算失败)默认值为0")
|
||||||
|
private Integer dealFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "处理结果第一条事件发生时间(读comtra文件获取)")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
|
||||||
|
private LocalDateTime firstTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "处理结果第一条事件暂降类型(字典表PQS_Dicdata)")
|
||||||
|
private String firstType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "处理结果第一条事件发生时间毫秒(读comtra文件获取)")
|
||||||
|
private Double firstMs;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "暂降能量")
|
||||||
|
private Double energy;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "暂降严重度")
|
||||||
|
private Double severity;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "暂降源与监测位置关系 Upper:上游;Lower :下游;Unknown :未知;为空则是未计算")
|
||||||
|
private String sagsource;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss.SSS")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "持续时间,单位秒")
|
||||||
|
private Double duration;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "特征幅值")
|
||||||
|
private Double featureAmplitude;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "相别")
|
||||||
|
private String phase;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "事件描述")
|
||||||
|
private String eventDescribe;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "波形路径")
|
||||||
|
private String wavePath;
|
||||||
|
|
||||||
|
private Double transientValue;
|
||||||
|
|
||||||
|
private String gdName;
|
||||||
|
|
||||||
|
private String subName;
|
||||||
|
|
||||||
|
private String voltageId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "特征值是否计算")
|
||||||
|
private String featureAmplitudeFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "录波文件是否存在")
|
||||||
|
private String boFileFlag;
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.njcn.event.controller.majornetwork;
|
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pqs-event
|
|
||||||
*
|
|
||||||
* @author cdf
|
|
||||||
* @date 2022/6/23
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/advance")
|
|
||||||
@Api(tags = "高级分析")
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class AdvancedAnalysisController {
|
|
||||||
}
|
|
||||||
@@ -9,11 +9,13 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||||
import com.njcn.event.pojo.vo.TransientVO;
|
import com.njcn.event.pojo.vo.TransientVO;
|
||||||
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@@ -22,6 +24,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主网-暂态事件明细
|
* 主网-暂态事件明细
|
||||||
@@ -92,4 +95,38 @@ public class RmpEventDetailController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rmpEventDetailVO, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rmpEventDetailVO, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级算法-暂降事件关联分析主列表
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/20
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/querySagEvents")
|
||||||
|
@ApiOperation("高级算法-暂降事件关联分析主列表")
|
||||||
|
public HttpResult<Page<AdvanceEventDetailVO>> querySagEvents(@RequestBody BaseParam baseParam){
|
||||||
|
String methodDescribe = getMethodDescribe("querySagEvents");
|
||||||
|
Page<AdvanceEventDetailVO> page = rmpEventDetailService.querySagEvents(baseParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取暂态事件明细
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/28
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@GetMapping("/queryEventDetailByEventId")
|
||||||
|
@ApiOperation("获取暂态事件明细")
|
||||||
|
public HttpResult<RmpEventDetailPO> queryEventDetailByEventId(@RequestParam("eventId")String eventId){
|
||||||
|
String methodDescribe = getMethodDescribe("queryEventDetailByEventId");
|
||||||
|
RmpEventDetailPO objResult = rmpEventDetailService.queryEventDetailByEventId(eventId);
|
||||||
|
if(Objects.nonNull(objResult)){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, objResult, methodDescribe);
|
||||||
|
}
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.njcn.event.service.majornetwork.Impl;
|
package com.njcn.event.service.majornetwork.Impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -14,11 +17,14 @@ import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
|||||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||||
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
||||||
import com.njcn.device.pms.pojo.po.Monitor;
|
import com.njcn.device.pms.pojo.po.Monitor;
|
||||||
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
|
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||||
import com.njcn.event.pojo.vo.TransientVO;
|
import com.njcn.event.pojo.vo.TransientVO;
|
||||||
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
||||||
@@ -27,16 +33,17 @@ import com.njcn.system.enums.DicDataTypeEnum;
|
|||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.user.api.DeptFeignClient;
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -65,6 +72,8 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|||||||
|
|
||||||
private final DistributionMonitorClient distributionMonitorClient;
|
private final DistributionMonitorClient distributionMonitorClient;
|
||||||
|
|
||||||
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取暂态事件明细
|
* 获取暂态事件明细
|
||||||
*
|
*
|
||||||
@@ -183,6 +192,90 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|||||||
return rmpEventDetailVO;
|
return rmpEventDetailVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<AdvanceEventDetailVO> querySagEvents(BaseParam baseParam) {
|
||||||
|
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
|
||||||
|
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||||
|
if(CollUtil.isNotEmpty(lineIds)){
|
||||||
|
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper =new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.isNull(RmpEventDetailPO::getEventassIndex);
|
||||||
|
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
||||||
|
|
||||||
|
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
||||||
|
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||||
|
|
||||||
|
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(),AdvanceEventDetailVO.class);
|
||||||
|
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item->{
|
||||||
|
if(map.containsKey(item.getLineId())){
|
||||||
|
item.setGdName(map.get(item.getLineId()).getGdName());
|
||||||
|
item.setSubName(map.get(item.getLineId()).getSubName());
|
||||||
|
switch (item.getDealFlag()) {
|
||||||
|
case 0:
|
||||||
|
item.setFeatureAmplitudeFlag(EnumFlag.UNTREATED.getDescription());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSED.getDescription());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
item.setFeatureAmplitudeFlag(EnumFlag.NODATA.getDescription());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSFAIL.getDescription());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
|
||||||
|
}
|
||||||
|
//录波文件
|
||||||
|
if(Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1){
|
||||||
|
item.setBoFileFlag(EnumFlag.EXIST.description);
|
||||||
|
}else {
|
||||||
|
item.setBoFileFlag(EnumFlag.ABSENCE.description);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
pageResult.setRecords(advanceEventDetailVOList);
|
||||||
|
pageResult.setTotal(poPage.getTotal());
|
||||||
|
pageResult.setPages(poPage.getPages());
|
||||||
|
pageResult.setSize(poPage.getSize());
|
||||||
|
pageResult.setCurrent(poPage.getCurrent());
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RmpEventDetailPO queryEventDetailByEventId(String eventId) {
|
||||||
|
return this.getById(eventId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部枚举类:高级算法处理事件的标识描述
|
||||||
|
*/
|
||||||
|
enum EnumFlag {
|
||||||
|
PROCESSED(1, "计算成功"), UNTREATED(0, "未计算"), EXIST(1, "存在"), ABSENCE(0, "不存在"), NODATA(2, "无结果"), PROCESSFAIL(3, "计算失败");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
EnumFlag(Integer code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.njcn.event.service.majornetwork;
|
package com.njcn.event.service.majornetwork;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
|
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||||
import com.njcn.event.pojo.vo.TransientVO;
|
import com.njcn.event.pojo.vo.TransientVO;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -43,4 +46,14 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
|
|||||||
RmpEventDetailVO getTransientDetailById(String eventId,String sysType,Integer smallType);
|
RmpEventDetailVO getTransientDetailById(String eventId,String sysType,Integer smallType);
|
||||||
|
|
||||||
|
|
||||||
|
Page<AdvanceEventDetailVO> querySagEvents(BaseParam baseParam);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/7/28
|
||||||
|
*/
|
||||||
|
RmpEventDetailPO queryEventDetailByEventId(String eventId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public enum SystemResponseEnum {
|
|||||||
TERMINAL_WIRING_EMPTY("A00367","查询字典监测终端接线方式为空"),
|
TERMINAL_WIRING_EMPTY("A00367","查询字典监测终端接线方式为空"),
|
||||||
MONITOR_TYPE_EMPTY("A00368","查询字典监测点类别为空"),
|
MONITOR_TYPE_EMPTY("A00368","查询字典监测点类别为空"),
|
||||||
ACTIVATED_STATE("A00369","必须存在一个已激活的系统类型"),
|
ACTIVATED_STATE("A00369","必须存在一个已激活的系统类型"),
|
||||||
|
ADVANCE_REASON("A00370","查询字典暂降原因为空"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user