合并暂降模块代码

This commit is contained in:
2022-07-14 09:43:29 +08:00
parent 014c766806
commit 638f5b8f93
56 changed files with 3133 additions and 86 deletions

View File

@@ -11,10 +11,12 @@ import lombok.Getter;
public enum EventResponseEnum {
/**
* 谐波模块异常响应码的范围:
* 暂降模块异常响应码的范围:
* A00650 ~ A00749
*/
HARMONIC_COMMON_ERROR("A00550","谐波模块异常")
EVENT_COMMON_ERROR("A00650","暂降模块异常"),
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到")
;
private final String code;

View File

@@ -0,0 +1,10 @@
package com.njcn.event.pojo.constant;
/**
* @author xy
* @date 2021/12/29 15:10
*/
public interface HarmonicValidMessage {
String DATA_NOT_BLANK = "参数不能为空";
}

View File

@@ -0,0 +1,32 @@
package com.njcn.event.pojo.constant;
/**
* @author 徐扬
*/
public interface Param {
/**
* 表名
*/
String EVENT_DETAIL = "pqs_eventdetail";
/**
* 公共字段
*/
String SELECT = "SELECT * FROM ";
String WHERE = " WHERE ";
String TZ_ASIA_SHANGHAI = " tz('Asia/Shanghai')";
/**
* 时间字段
*/
String BEGIN =" 00:00:00";
String END =" 23:59:59";
}

View File

@@ -0,0 +1,31 @@
package com.njcn.event.pojo.param;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* pqs-event
*
* @author cdf
* @date 2022/6/23
*/
@Data
@ApiModel
public class EventBaseParam extends BaseParam implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank(message = "监测点索引不可为空")
@ApiModelProperty(name = "lineId", value = "监测点索引")
private String lineId;
}

View File

@@ -0,0 +1,25 @@
package com.njcn.event.pojo.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @version 1.0.0
* @author: chenchao
* @date: 2022/07/07 12:41
*/
@Data
public class WaveFileParam {
@ApiModelProperty("lineId集合")
@NotNull(message = "lineId不可为空")
private List<String> lineId;
@ApiModelProperty("timeId集合")
@NotNull(message = "timeId不可为空")
private List<String> timeId;
}

View File

@@ -0,0 +1,110 @@
package com.njcn.event.pojo.po;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 装置信息表
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2020年07月07日 9:38
*/
@Data
public class PqDevice implements Serializable {
private static final long serialVersionUID = -85938859401219960L;
/**
* 装置序号
*/
private String id;
/**
* 装置模型0虚拟设备1实际设备2离线设备默认是实际设备
*/
private Integer devModel;
/**
* 数据类型0暂态系统1稳态系统2两个系统
*/
private Integer devDataType;
/**
* 终端运行状态0投运1热备用2停运
*/
private Integer runFlag;
/**
* 通讯状态0中断1正常
*/
private Integer comFlag;
/**
* 设备制造商,字典表
*/
private String manufacturer;
/**
* 定检状态0未检 1已检
*/
private Integer checkFlag;
/**
* 前置类型MMS、CLD字典表
*/
private String frontType;
/**
* 终端型号570、580……字典表
*/
private String devType;
/**
* 网络参数
*/
private String ip;
/**
* 召唤标志0周期触发1变为触发
*/
private Integer callFlag;
/**
* 端口
*/
private Integer port;
/**
* 装置识别码3ds加密
*/
private String series;
/**
* 装置秘钥3ds加密
*/
private String devKey;
/**
* 前置序号Id,前置表
*/
private String nodeId;
/**
* 投运时间
*/
private Date loginTime;
/**
* 数据更新时间
*/
private Date updateTime;
/**
* 本次定检时间,默认等于投运时间
*/
private Date thisTimeCheck;
/**
* 下次定检时间,默认为投运时间后推3年假如时间小于3个月则为待检
*/
private Date nextTimeCheck;
/**
* 电镀功能 0关闭 1开启 默认关闭
*/
private Integer electroplate;
/**
* 对时功能标识符0关闭1开启默认开启
*/
private Integer onTime;
/**
* 合同号
*/
private String contract;
/**
* 装置SIM卡号
*/
private String sim;
}

View File

@@ -0,0 +1,31 @@
package com.njcn.event.pojo.po;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;
import java.time.Instant;
/**
* 装置在线率表
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2020年07月07日 9:37
*/
@Data
@Measurement(name = "pqs_onlinerate")
public class PqsOnlinerate {
@Column(name = "time")
private Instant time;
@Column(name = "dev_id")
private String devId;
@Column(name = "offlinemin")
private Integer offlinemin;
@Column(name = "onlinemin")
private Integer onlinemin;
}

View File

@@ -0,0 +1,21 @@
package com.njcn.event.pojo.po;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @version 1.0.0
* @author: chenchao
* @date: 2022/06/28 19:41
*/
@Data
@Component
public class WavePath {
@Value("${business.wavePath}")
private String wavePath;
}

View File

@@ -0,0 +1,32 @@
package com.njcn.event.pojo.vo;
import lombok.Data;
import java.util.List;
/**
* pqs-event
* 区域分析
* @author cdf
* @date 2022/6/24
*/
@Data
public class AreaAnalysisVO {
private List<Children> reason;
private List<Children> type;
@Data
public static class Children {
private String name;
private Integer value;
}
}

View File

@@ -0,0 +1,57 @@
package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
/**
* 区域统计
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年07月08日 8:55
*/
@Data
public class AreaCalculationVO implements Serializable {
private static final long serialVersionUID = 1289723908309235565L;
@ApiModelProperty(name = "areaName", value = "区域名称")
private String areaName;
@ApiModelProperty(name = "monitoringPoints", value = "监测点数")
private Integer monitoringPoints;
@ApiModelProperty(name = "frequency", value = "暂降次数")
private Long frequency;
@ApiModelProperty(name = "sarfi90", value = "SARFI-90")
private Double sarfi9;
/**
* 计算SARFI-90数值
*/
public void computeSarfi90() {
BigDecimal b1 = new BigDecimal(frequency);
BigDecimal b2 = new BigDecimal(monitoringPoints);
if (b1.compareTo(BigDecimal.ZERO) == 0) {
this.sarfi9 = 0.00D;
return;
}
this.sarfi9 = b1.divide(b2, 2, RoundingMode.HALF_UP).doubleValue();
}
public static Comparator<AreaCalculationVO> sortAscAreaName() {
return (o1, o2) -> {
Collator collator = Collator.getInstance(Locale.CHINA);
return collator.compare(o1.getAreaName(), o2.getAreaName());
};
}
}

View File

@@ -0,0 +1,147 @@
package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
/**
* 暂降区域统计信息
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年06月24日 11:02
*/
@Data
@Builder
public class AreaStatisticalVO implements Serializable {
private static final long serialVersionUID = -1761181131122017671L;
@ApiModelProperty(name = "areaStatistics", value = "区域统计")
private AreaStatisticsVO areaStatistics;
@ApiModelProperty(name = "voltageStatistics", value = "电压统计")
private VoltageStatisticsVO voltageStatistics;
@ApiModelProperty(name = "monthlyStatistics", value = "月统计")
private MonthlyStatisticsVO monthlyStatistics;
public static AreaStatisticalVO empty() {
return buildVO(AreaStatisticsVO.empty(), VoltageStatisticsVO.empty(), MonthlyStatisticsVO.empty());
}
public static AreaStatisticalVO buildVO(AreaStatisticsVO areaStatistics, VoltageStatisticsVO voltageStatistics,
MonthlyStatisticsVO monthlyStatistics) {
return AreaStatisticalVO.builder()
.areaStatistics(areaStatistics)
.voltageStatistics(voltageStatistics)
.monthlyStatistics(monthlyStatistics)
.build();
}
/**
* 区域统计
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年07月08日 8:56
*/
@Data
@Builder
public static class AreaStatisticsVO implements Serializable {
private static final long serialVersionUID = 5966376367805740029L;
@ApiModelProperty(name = "areaCalculation", value = "图表数据")
private List<AreaCalculationVO> areaCalculation;
@ApiModelProperty(name = "frequencySum", value = "总暂降次数")
private Long frequencySum;
@ApiModelProperty(name = "monitoringPointSum", value = "总监测点数")
private Integer monitoringPointSum;
public static AreaStatisticsVO empty() {
return buildVO(0L, 0, Collections.emptyList());
}
public static AreaStatisticsVO buildVO(Long frequencySum, Integer monitoringPointSum,
List<AreaCalculationVO> areaCalculation) {
return AreaStatisticsVO.builder()
.frequencySum(frequencySum)
.monitoringPointSum(monitoringPointSum)
.areaCalculation(areaCalculation)
.build();
}
}
/**
* 电压等级
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年07月08日 8:56
*/
@Data
@Builder
public static class VoltageStatisticsVO implements Serializable {
private static final long serialVersionUID = -1529419462716002278L;
@ApiModelProperty(name = "voltageLevelCalculation", value = "图表数据")
private List<VoltageLevelCalculationVO> voltageLevelCalculation;
@ApiModelProperty(name = "frequencySum", value = "总暂降次数")
private Long frequencySum;
@ApiModelProperty(name = "monitoringPointSum", value = "总监测点数")
private Integer monitoringPointSum;
public static VoltageStatisticsVO empty() {
return buildVO(0L, 0, Collections.emptyList());
}
public static VoltageStatisticsVO buildVO(Long frequencySum, Integer monitoringPointSum,
List<VoltageLevelCalculationVO> voltageLevelCalculation) {
return VoltageStatisticsVO.builder()
.frequencySum(frequencySum)
.monitoringPointSum(monitoringPointSum)
.voltageLevelCalculation(voltageLevelCalculation)
.build();
}
}
/**
* 月统计
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年07月08日 8:56
*/
@Data
@Builder
public static class MonthlyStatisticsVO implements Serializable {
private static final long serialVersionUID = -1373543779591652398L;
@ApiModelProperty(name = "monthCalculation", value = "图表数据")
private List<MonthCalculationVO> monthCalculation;
@ApiModelProperty(name = "frequencySum", value = "总暂降次数")
private Long frequencySum;
public static MonthlyStatisticsVO empty() {
return buildVO(0L, Collections.emptyList());
}
public static MonthlyStatisticsVO buildVO(Long frequencySum, List<MonthCalculationVO> monthCalculation) {
return MonthlyStatisticsVO.builder()
.frequencySum(frequencySum)
.monthCalculation(monthCalculation)
.build();
}
}
}

View File

@@ -0,0 +1,28 @@
package com.njcn.event.pojo.vo;
import com.njcn.device.pojo.vo.AreaLineInfoVO;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* pqs-event
*
* @author cdf
* @date 2022/7/1
*/
@Data
public class AreaSubLineVO {
private String subName;
private String subId;
private BigDecimal lng;
private BigDecimal lat;
private List<AreaLineInfoVO> children;
}

View File

@@ -0,0 +1,46 @@
package com.njcn.event.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;
import java.time.LocalDateTime;
/**
* pqs-event
*
* @author cdf
* @date 2022/6/23
*/
@Data
@ApiModel
@Measurement(name = "pqs_eventdetail")
public class EventAnalyseVO {
@ApiModelProperty(name = "time",value = "暂降发生时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime time;
@ApiModelProperty(name = "eventValue",value = "特征幅值")
@Column(name = "event_value")
private Float eventValue;
@ApiModelProperty(name = "persistTime",value = "持续时间ms")
@Column(name = "persist_time")
private Integer persistTime;
@ApiModelProperty(name = "eventType",value = "暂降类型")
@Column(name = "event_type")
private Integer eventType;
@ApiModelProperty(name = "eventReason",value = "暂降原因")
@Column(name = "event_reason")
private Integer eventReason;
@ApiModelProperty(name = "waveType",value = "触发类型")
@Column(name = "wave_type")
private Integer waveType;
}

View File

@@ -0,0 +1,20 @@
package com.njcn.event.pojo.vo;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;
import java.io.Serializable;
@Data
@Measurement(name = "pqs_eventdetail")
public class EventDetailCount implements Serializable {
private static final long serialVersionUID = 8972007649569639702L;
@Column(name = "time")
private String timeId;
@Column(name = "count")
private Integer count;
}

View File

@@ -0,0 +1,19 @@
package com.njcn.event.pojo.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @version 1.0.0
* @author: chenchao
* @date: 2022/06/27 15:29
*/
@Data
public class EventDetailVO implements Serializable {
private String id;
private String time;
}

View File

@@ -0,0 +1,28 @@
package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 获取暂降月统计
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年06月24日 11:02
*/
@Data
public class MonthCalculationVO implements Serializable {
private static final long serialVersionUID = -4620564906261989598L;
@ApiModelProperty(name = "month", value = "月份")
private String month;
@ApiModelProperty(name = "notAssociated", value = "未关联暂降次数")
private Long notAssociated;
@ApiModelProperty(name = "linked", value = "已关联处理事件")
private Long linked;
}

View File

@@ -0,0 +1,101 @@
package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.text.Collator;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
/**
* 终端运行统计
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年07月07日 9:34
*/
@Data
@Builder
public class TerminalRunningStatisticsVO implements Serializable {
private static final long serialVersionUID = 9145043242953094855L;
@ApiModelProperty("区域数据")
private TerminalRunningVO area;
@ApiModelProperty("厂家数据")
private TerminalRunningVO factory;
public static TerminalRunningStatisticsVO empty() {
return TerminalRunningStatisticsVO.buildVO(TerminalRunningVO.empty(), TerminalRunningVO.empty());
}
public static TerminalRunningStatisticsVO buildVO(TerminalRunningVO area, TerminalRunningVO factory) {
return TerminalRunningStatisticsVO.builder().area(area).factory(factory).build();
}
@Data
public static class TerminalRunningInfoVO implements Serializable {
private static final long serialVersionUID = -8715455283910823072L;
@ApiModelProperty("区域名称")
private String areaName;
@ApiModelProperty("终端个数")
private Integer numberOfTerminals;
@ApiModelProperty("投运")
private Long normal;
@ApiModelProperty("热备用")
private Long breaks;
@ApiModelProperty("停运")
private Long shutdown;
@ApiModelProperty("在线率")
private Double onlineRate;
public static Comparator<TerminalRunningInfoVO> sortAscAreaName() {
return (o1, o2) -> {
Collator collator = Collator.getInstance(Locale.CHINA);
return collator.compare(o1.getAreaName(), o2.getAreaName());
};
}
}
@Data
@Builder
public static class TerminalRunningVO implements Serializable {
private static final long serialVersionUID = 8990224131248734699L;
@ApiModelProperty("总计-终端个数")
private Integer numberOfTerminals;
@ApiModelProperty("总计-投运")
private Long normal;
@ApiModelProperty("总计-热备用")
private Long breaks;
@ApiModelProperty("总计-停运")
private Long shutdown;
@ApiModelProperty("总计-在线率")
private Double onlineRate;
@ApiModelProperty("列表数据")
private List<TerminalRunningInfoVO> areaInfo;
public static TerminalRunningVO empty() {
return TerminalRunningVO.buildVO(0, 0L, 0L, 0L, 0.00D, Collections.emptyList());
}
public static TerminalRunningVO buildVO(Integer numberOfTerminals, Long normal, Long breaks, Long shutdown, Double onlineRate, List<TerminalRunningInfoVO> areaInfo) {
return TerminalRunningVO.builder().numberOfTerminals(numberOfTerminals).normal(normal).breaks(breaks).shutdown(shutdown).onlineRate(onlineRate).areaInfo(areaInfo).build();
}
}
}

View File

@@ -20,6 +20,11 @@ public class TransientVO implements Serializable {
*/
@ApiModelProperty("id")
private String id;
/**
* 序号
*/
@ApiModelProperty("序号")
private Integer number;
/**
* 暂态发生时刻
*/
@@ -68,8 +73,15 @@ public class TransientVO implements Serializable {
/**
* 暂态持续时间
*/
@ApiModelProperty("暂态持续时间")
@ApiModelProperty("暂态持续时间(s)")
private Float persistTime;
/**
* 实际波形名称
*/
@ApiModelProperty(name = "实际波形名称")
private String waveName;
/**
* 暂态严重度
*/

View File

@@ -0,0 +1,44 @@
package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Comparator;
/**
* 暂降电压等级统计
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年06月24日 11:02
*/
@Data
public class VoltageLevelCalculationVO implements Serializable {
private static final long serialVersionUID = 3801801245395998386L;
@ApiModelProperty(name = "voltageLevel", value = "电压等级")
private String voltageLevel;
@ApiModelProperty(name = "monitoringPoints", value = "监测点数")
private Integer monitoringPoints;
@ApiModelProperty(name = "frequency", value = "暂降次数")
private Long frequency;
/**
* 电压等级升序排序,取KV单位前的数值
*
* @return 排序结果
*/
public static Comparator<VoltageLevelCalculationVO> sortAscVoltageLevel() {
return (o1, o2) -> {
String l1 = o1.getVoltageLevel();
String l2 = o2.getVoltageLevel();
String sub1 = l1.substring(0, l1.length() - 2);
String sub2 = l2.substring(0, l2.length() - 2);
return Double.valueOf(sub1).compareTo(Double.valueOf(sub2));
};
}
}

View File

@@ -0,0 +1,83 @@
package com.njcn.event.pojo.vo;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* 电压容忍度曲线兼容性统计
*
* @author : zhaojun
* @version : 1.0.0
* @date : 2022年06月24日 11:02
*/
@Data
@Builder
public class VoltageToleranceCurveVO implements Serializable {
private static final long serialVersionUID = -2659670722467310785L;
@ApiModelProperty(name = "totalNumberOfEvents", value = "事件总数")
private Integer totalNumberOfEvents;
@ApiModelProperty(name = "VoltageToleranceCurveDataList", value = "图表数据")
private List<VoltageToleranceCurveDataList> voltageToleranceCurveDataList;
/**
* 构建默认对象
*
* @return 默认对象
*/
public static VoltageToleranceCurveVO empty() {
return VoltageToleranceCurveVO.buildVO(0, Collections.emptyList());
}
/**
* 构建默认对象
*
* @param numberEvents 事件总数
* @param dataList 图表数据
* @return 默认对象
*/
public static VoltageToleranceCurveVO buildVO(int numberEvents, List<VoltageToleranceCurveDataList> dataList) {
return VoltageToleranceCurveVO.builder().totalNumberOfEvents(numberEvents).voltageToleranceCurveDataList(dataList).build();
}
@Data
public static class VoltageToleranceCurveDataList implements Serializable {
private static final long serialVersionUID = 2693688079727369565L;
@ApiModelProperty(name = "lineId", value = "LineId")
private String lineId;
@ApiModelProperty(name = "persistTime", value = "持续时间ms")
private Double persistTime;
@ApiModelProperty(name = "eventValue", value = "特征幅值")
private Double eventValue;
@ApiModelProperty(name = "subName", value = "变电站名称")
private String subName;
@ApiModelProperty(name = "gdName", value = "供电公司名称")
private String gdName;
@ApiModelProperty(name = "time", value = "发生时刻")
private String time;
public static Comparator<VoltageToleranceCurveDataList> sortAscTime() {
return (o1, o2) -> {
DateTime time1 = DateUtil.parseDateTime(o1.getTime());
DateTime time2 = DateUtil.parseDateTime(o2.getTime());
return time1.compareTo(time2);
};
}
}
}

View File

@@ -27,7 +27,7 @@ public class EventlEnumUtil {
value = message.substring(message.indexOf(StrUtil.C_COMMA)+1);
}
eventDetailResponseEnum = EnumUtils.valueOf(EventResponseEnum.class, value, EventResponseEnum.class.getMethod(BusinessException.GET_MESSAGE_METHOD));
return Objects.isNull(eventDetailResponseEnum) ? EventResponseEnum.HARMONIC_COMMON_ERROR : eventDetailResponseEnum;
return Objects.isNull(eventDetailResponseEnum) ? EventResponseEnum.EVENT_COMMON_ERROR : eventDetailResponseEnum;
} catch (NoSuchMethodException e) {
throw new BusinessException(CommonResponseEnum.INTERNAL_ERROR);
}