添加暂态事件波形图后台绘图并保存文件服务器

This commit is contained in:
2023-09-21 16:19:25 +08:00
parent 7de4f8f551
commit 2d3d21504b
25 changed files with 183 additions and 1644 deletions

View File

@@ -1,6 +1,5 @@
package com.njcn.echarts.json; package com.njcn.echarts.json;
import cn.hutool.core.lang.Console;
import com.njcn.echarts.pojo.bo.TolerateData; import com.njcn.echarts.pojo.bo.TolerateData;
import com.njcn.echarts.pojo.constant.PicCommonData; import com.njcn.echarts.pojo.constant.PicCommonData;
import org.icepear.echarts.Option; import org.icepear.echarts.Option;
@@ -8,8 +7,6 @@ import org.icepear.echarts.charts.bar.BarItemStyle;
import org.icepear.echarts.charts.bar.BarLabel; import org.icepear.echarts.charts.bar.BarLabel;
import org.icepear.echarts.charts.bar.BarSeries; import org.icepear.echarts.charts.bar.BarSeries;
import org.icepear.echarts.charts.line.LineSeries; import org.icepear.echarts.charts.line.LineSeries;
import org.icepear.echarts.charts.pie.PieLabel;
import org.icepear.echarts.charts.pie.PieSeries;
import org.icepear.echarts.charts.scatter.ScatterSeries; import org.icepear.echarts.charts.scatter.ScatterSeries;
import org.icepear.echarts.components.coord.*; import org.icepear.echarts.components.coord.*;
import org.icepear.echarts.components.coord.cartesian.CategoryAxis; import org.icepear.echarts.components.coord.cartesian.CategoryAxis;
@@ -17,17 +14,14 @@ import org.icepear.echarts.components.coord.cartesian.LogAxis;
import org.icepear.echarts.components.coord.cartesian.ValueAxis; import org.icepear.echarts.components.coord.cartesian.ValueAxis;
import org.icepear.echarts.components.grid.Grid; import org.icepear.echarts.components.grid.Grid;
import org.icepear.echarts.components.legend.Legend; import org.icepear.echarts.components.legend.Legend;
import org.icepear.echarts.components.text.Label;
import org.icepear.echarts.components.title.Title; import org.icepear.echarts.components.title.Title;
import org.icepear.echarts.components.tooltip.Tooltip; import org.icepear.echarts.components.tooltip.Tooltip;
import org.icepear.echarts.components.visualMap.ContinousVisualMap;
import org.icepear.echarts.origin.chart.bar.BarItemStyleOption;
import org.icepear.echarts.origin.coord.AxisLabelBaseOption;
import org.icepear.echarts.origin.util.SeriesOption; import org.icepear.echarts.origin.util.SeriesOption;
import org.icepear.echarts.render.Engine; import org.icepear.echarts.render.Engine;
import java.util.Arrays; import java.text.DecimalFormat;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@@ -252,7 +246,7 @@ public class LineGenerator {
persistentTimeOption.setYAxis(new ValueAxis() persistentTimeOption.setYAxis(new ValueAxis()
.setName("(次)") .setName("(次)")
.setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px"))
); );
//配置占比 //配置占比
@@ -264,6 +258,7 @@ public class LineGenerator {
persistentTimeOption.setSeries(new SeriesOption[]{proportion}); persistentTimeOption.setSeries(new SeriesOption[]{proportion});
return ENGINE.renderJsonOption(persistentTimeOption); return ENGINE.renderJsonOption(persistentTimeOption);
} }
/*** /***
* 生成电压暂降,已关联未关联得次数 * 生成电压暂降,已关联未关联得次数
* @author hongawen * @author hongawen
@@ -307,7 +302,7 @@ public class LineGenerator {
.setItemStyle(new BarItemStyle().setColor("#ccc").setBorderColor("#ccc").setBorderWidth(2).setBorderRadius(0)) .setItemStyle(new BarItemStyle().setColor("#ccc").setBorderColor("#ccc").setBorderWidth(2).setBorderRadius(0))
.setLabel(new BarLabel().setShow(true).setColor("#8B008B")) .setLabel(new BarLabel().setShow(true).setColor("#8B008B"))
.setData(pereventValue1); .setData(pereventValue1);
persistentTimeOption.setSeries(new SeriesOption[]{proportion,proportion2}); persistentTimeOption.setSeries(new SeriesOption[]{proportion, proportion2});
return ENGINE.renderJsonOption(persistentTimeOption); return ENGINE.renderJsonOption(persistentTimeOption);
} }
@@ -358,7 +353,7 @@ public class LineGenerator {
* @author hongawen * @author hongawen
* @date 2023/6/21 10:06 * @date 2023/6/21 10:06
*/ */
public static String generateRegionDeviceOption(List<String> xData, List<Integer> onlineData,List<Integer> offlineData,String subtext,String xName) { public static String generateRegionDeviceOption(List<String> xData, List<Integer> onlineData, List<Integer> offlineData, String subtext, String xName) {
Option persistentTimeOption = new Option(); Option persistentTimeOption = new Option();
//取消渲染动画 //取消渲染动画
persistentTimeOption.setAnimation(false); persistentTimeOption.setAnimation(false);
@@ -398,7 +393,7 @@ public class LineGenerator {
.setItemStyle(new BarItemStyle().setColor("orange").setBorderColor("orange").setBorderWidth(2).setBorderRadius(0)) .setItemStyle(new BarItemStyle().setColor("orange").setBorderColor("orange").setBorderWidth(2).setBorderRadius(0))
.setLabel(new BarLabel().setShow(true).setColor("#8B008B")) .setLabel(new BarLabel().setShow(true).setColor("#8B008B"))
.setData(offlineData); .setData(offlineData);
persistentTimeOption.setSeries(new SeriesOption[]{proportion,proportion2}); persistentTimeOption.setSeries(new SeriesOption[]{proportion, proportion2});
return ENGINE.renderJsonOption(persistentTimeOption); return ENGINE.renderJsonOption(persistentTimeOption);
} }
@@ -407,7 +402,7 @@ public class LineGenerator {
* @author hongawen * @author hongawen
* @date 2023/6/21 10:06 * @date 2023/6/21 10:06
*/ */
public static String generateFrequencyOption(List<String> xData, List<Integer> dip,List<Integer> interruptions,List<Integer> rise,String subtext,String xName) { public static String generateFrequencyOption(List<String> xData, List<Integer> dip, List<Integer> interruptions, List<Integer> rise, String subtext, String xName) {
Option persistentTimeOption = new Option(); Option persistentTimeOption = new Option();
//取消渲染动画 //取消渲染动画
persistentTimeOption.setAnimation(false); persistentTimeOption.setAnimation(false);
@@ -418,7 +413,7 @@ public class LineGenerator {
.setSubtext(subtext) .setSubtext(subtext)
); );
//设置图例 //设置图例
persistentTimeOption.setLegend(new Legend().setData(new String[]{"暂降次数", "中断次数","暂升次数"}).setLeft(10).setShow(true)); persistentTimeOption.setLegend(new Legend().setData(new String[]{"暂降次数", "中断次数", "暂升次数"}).setLeft(10).setShow(true));
//横坐标 //横坐标
persistentTimeOption.setXAxis(new CategoryAxis() persistentTimeOption.setXAxis(new CategoryAxis()
.setBoundaryGap(true) .setBoundaryGap(true)
@@ -453,7 +448,73 @@ public class LineGenerator {
.setItemStyle(new BarItemStyle().setColor("#0066ff").setBorderColor("#0066ff").setBorderWidth(2).setBorderRadius(0)) .setItemStyle(new BarItemStyle().setColor("#0066ff").setBorderColor("#0066ff").setBorderWidth(2).setBorderRadius(0))
.setLabel(new BarLabel().setShow(true).setColor("#8B008B")) .setLabel(new BarLabel().setShow(true).setColor("#8B008B"))
.setData(rise); .setData(rise);
persistentTimeOption.setSeries(new SeriesOption[]{proportion,proportion2,proportion3}); persistentTimeOption.setSeries(new SeriesOption[]{proportion, proportion2, proportion3});
return ENGINE.renderJsonOption(persistentTimeOption); return ENGINE.renderJsonOption(persistentTimeOption);
} }
/***
* 准备波形json
* @author hongawen
* @date 2023/9/21 9:41
* @return String
*/
public static String generateWaveOption(String title, List<List<Float>> aValue, List<List<Float>> bValue, List<List<Float>> cValue, String unit, Float max, Float min, String a, String b, String c, List<String> colors, Boolean isOpen) {
DecimalFormat df1 = new DecimalFormat("#.00");
DecimalFormat df2 = new DecimalFormat("#");
Option instantOption = new Option();
//取消渲染动画
instantOption.setAnimation(false);
//背景色
instantOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
//标题
instantOption.setTitle(new Title()
.setText(title)
.setLeft(PicCommonData.CENTER)
.setTextStyle(new Label().setFontSize(14))
);
//配置颜色
instantOption.setColor(colors.toArray(new String[colors.size()]));
//配置图例
if (isOpen) {
instantOption.setLegend(new Legend().setData(new String[]{a, b}).setLeft("10px"));
} else {
instantOption.setLegend(new Legend().setData(new String[]{a, b, c}).setLeft("10px"));
}
//上下左右的图内间距
instantOption.setGrid(new Grid().setTop("60px").setLeft("55px").setRight("40px").setBottom("10%"));
//横坐标
instantOption.setXAxis(new ValueAxis().setName("ms")
.setMax(df2.format(aValue.get(0).get(0)))
.setMin(df2.format(aValue.get(aValue.size() - 1).get(0)))
.setSplitLine(new SplitLine().setShow(false))
.setAxisLine(new AxisLine().setOnZero(false))
.setMinInterval(1)
);
//纵坐标
instantOption.setYAxis(new ValueAxis()
.setName(unit)
.setMax(df1.format(max * 1.1))
.setMin(df1.format(min * 1.1))
.setPosition(PicCommonData.LEFT)
.setAxisLine(new AxisLine().setShow(false).setOnZero(false))
);
//数据信息
LineSeries aSeries = new LineSeries()
.setName(a)
.setSmooth(true)
.setSymbol("none")
.setData(aValue);
LineSeries bSeries = new LineSeries()
.setName(b)
.setSmooth(true)
.setSymbol("none")
.setData(bValue);
LineSeries cSeries = new LineSeries()
.setName(c)
.setSmooth(true)
.setSymbol("none")
.setData(cValue);
instantOption.setSeries(new LineSeries[]{aSeries, bSeries, cSeries});
return ENGINE.renderJsonOption(instantOption);
}
} }

View File

@@ -44,6 +44,11 @@ public interface PicCommonData {
*/ */
String CENTER = "center"; String CENTER = "center";
/**
* 绘图定位
*/
String LEFT = "left";
/*** /***
* png base64固定前缀 * png base64固定前缀

View File

@@ -11,6 +11,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -56,6 +57,28 @@ public class DrawPicUtil {
} }
/***
* 绘制波形图
* @author hongawen
* @date 2023/6/21 11:01
* @return String base64数据
*/
public String drawWavePic(String title, List<List<Float>> aValue, List<List<Float>> bValue, List<List<Float>> cValue, String unit, Float max, Float min, String a, String b, String c, List<String> colors, Boolean isOpen) {
return drawWavePic(title, aValue, bValue, cValue, unit, max, min, a, b, c, colors, isOpen, 0, 0);
}
/***
* 绘制波形图
* @author hongawen
* @date 2023/6/21 11:01
* @return String base64数据
*/
public String drawWavePic(String title, List<List<Float>> aValue, List<List<Float>> bValue, List<List<Float>> cValue, String unit, Float max, Float min, String a, String b, String c, List<String> colors, Boolean isOpen, int width, int height) {
String instantJson = LineGenerator.generateWaveOption(title, aValue, bValue, cValue, unit, max, min, a, b, c, colors, isOpen);
return drawPic(instantJson, width, height);
}
/*** /***
* 绘制itic曲线图 * 绘制itic曲线图
* @author hongawen * @author hongawen
@@ -152,7 +175,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawMonth(List<String> xName, List<Integer> times, String year, Integer flag) { public String drawMonth(List<String> xName, List<Integer> times, String year, Integer flag) {
return drawMonth(xName, times, year, flag, 0, 0); return drawMonth(xName, times, year, flag, 0, 0);
} }
/*** /***
@@ -162,7 +185,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawMonth(List<String> xName, List<Integer> times, String year, Integer flag, int width, int height) { public String drawMonth(List<String> xName, List<Integer> times, String year, Integer flag, int width, int height) {
String monthJson = BarGenerator.generateMonthOption( xName, times, year, flag); String monthJson = BarGenerator.generateMonthOption(xName, times, year, flag);
return drawPic(monthJson, width, height); return drawPic(monthJson, width, height);
} }
@@ -172,8 +195,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawReason(List<String> xname, List<Map<String,Object>> map2) { public String drawReason(List<String> xname, List<Map<String, Object>> map2) {
return drawReason(xname, map2, 0, 0); return drawReason(xname, map2, 0, 0);
} }
/*** /***
@@ -182,8 +205,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawReason(List<String> xname, List<Map<String,Object>> map2, int width, int height) { public String drawReason(List<String> xname, List<Map<String, Object>> map2, int width, int height) {
String monthJson = PieGenerator.generateReasonOption(xname, map2); String monthJson = PieGenerator.generateReasonOption(xname, map2);
return drawPic(monthJson, width, height); return drawPic(monthJson, width, height);
} }
@@ -193,8 +216,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawType(List<String> xname, List<Map<String,Object>> map2) { public String drawType(List<String> xname, List<Map<String, Object>> map2) {
return drawType(xname, map2, 0, 0); return drawType(xname, map2, 0, 0);
} }
/*** /***
@@ -203,8 +226,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawType(List<String> xname, List<Map<String,Object>> map2, int width, int height) { public String drawType(List<String> xname, List<Map<String, Object>> map2, int width, int height) {
String monthJson = PieGenerator.generateTypeOption(xname, map2); String monthJson = PieGenerator.generateTypeOption(xname, map2);
return drawPic(monthJson, width, height); return drawPic(monthJson, width, height);
} }
@@ -237,7 +260,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventRegion(List<String> xData, List<Integer> yData) { public String drawEventRegion(List<String> xData, List<Integer> yData) {
return drawEventRegion(xData,yData, 0, 0); return drawEventRegion(xData, yData, 0, 0);
} }
/*** /***
@@ -247,7 +270,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventRegion(List<String> xData, List<Integer> yData, int width, int height) { public String drawEventRegion(List<String> xData, List<Integer> yData, int width, int height) {
String eventDensityJson = LineGenerator.generateRegionOption(xData,yData); String eventDensityJson = LineGenerator.generateRegionOption(xData, yData);
return drawPic(eventDensityJson, width, height); return drawPic(eventDensityJson, width, height);
} }
@@ -258,7 +281,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventAssociatedUnassociated(List<String> eventValue, List<Integer> pereventValue, List<Integer> pereventValue1, String xName) { public String drawEventAssociatedUnassociated(List<String> eventValue, List<Integer> pereventValue, List<Integer> pereventValue1, String xName) {
return drawEventAssociatedUnassociated(eventValue,pereventValue,pereventValue1,xName, 0, 0); return drawEventAssociatedUnassociated(eventValue, pereventValue, pereventValue1, xName, 0, 0);
} }
/*** /***
@@ -268,7 +291,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventAssociatedUnassociated(List<String> eventValue, List<Integer> pereventValue, List<Integer> pereventValue1, String xName, int width, int height) { public String drawEventAssociatedUnassociated(List<String> eventValue, List<Integer> pereventValue, List<Integer> pereventValue1, String xName, int width, int height) {
String eventDensityJson = LineGenerator.generateAssociatedUnassociatedOption(eventValue,pereventValue,pereventValue1,xName); String eventDensityJson = LineGenerator.generateAssociatedUnassociatedOption(eventValue, pereventValue, pereventValue1, xName);
return drawPic(eventDensityJson, width, height); return drawPic(eventDensityJson, width, height);
} }
@@ -279,7 +302,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventVoltageLevel(List<String> xData, List<Integer> yData) { public String drawEventVoltageLevel(List<String> xData, List<Integer> yData) {
return drawEventVoltageLevel(xData,yData, 0, 0); return drawEventVoltageLevel(xData, yData, 0, 0);
} }
/*** /***
@@ -289,7 +312,7 @@ public class DrawPicUtil {
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventVoltageLevel(List<String> xData, List<Integer> yData, int width, int height) { public String drawEventVoltageLevel(List<String> xData, List<Integer> yData, int width, int height) {
String eventDensityJson = LineGenerator.generateVoltageLevelOption(xData,yData); String eventDensityJson = LineGenerator.generateVoltageLevelOption(xData, yData);
return drawPic(eventDensityJson, width, height); return drawPic(eventDensityJson, width, height);
} }
@@ -299,8 +322,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventRegionDevice(List<String> xData, List<Integer> onlineData,List<Integer> offlineData,String subtext,String xName) { public String drawEventRegionDevice(List<String> xData, List<Integer> onlineData, List<Integer> offlineData, String subtext, String xName) {
return drawEventRegionDevice(xData,onlineData,offlineData,subtext,xName, 0, 0); return drawEventRegionDevice(xData, onlineData, offlineData, subtext, xName, 0, 0);
} }
/*** /***
@@ -309,8 +332,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventRegionDevice(List<String> xData, List<Integer> onlineData,List<Integer> offlineData,String subtext,String xName, int width, int height) { public String drawEventRegionDevice(List<String> xData, List<Integer> onlineData, List<Integer> offlineData, String subtext, String xName, int width, int height) {
String eventDensityJson = LineGenerator.generateRegionDeviceOption(xData,onlineData,offlineData,subtext,xName); String eventDensityJson = LineGenerator.generateRegionDeviceOption(xData, onlineData, offlineData, subtext, xName);
return drawPic(eventDensityJson, width, height); return drawPic(eventDensityJson, width, height);
} }
@@ -320,8 +343,8 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventFrequency(List<String> xData, List<Integer> dip,List<Integer> interruptions,List<Integer> rise,String subtext,String xName) { public String drawEventFrequency(List<String> xData, List<Integer> dip, List<Integer> interruptions, List<Integer> rise, String subtext, String xName) {
return drawEventFrequency(xData,dip,interruptions,rise,subtext,xName, 0, 0); return drawEventFrequency(xData, dip, interruptions, rise, subtext, xName, 0, 0);
} }
/*** /***
@@ -330,8 +353,10 @@ public class DrawPicUtil {
* @date 2023/6/21 11:01 * @date 2023/6/21 11:01
* @return String base64数据 * @return String base64数据
*/ */
public String drawEventFrequency(List<String> xData, List<Integer> dip,List<Integer> interruptions,List<Integer> rise,String subtext,String xName, int width, int height) { public String drawEventFrequency(List<String> xData, List<Integer> dip, List<Integer> interruptions, List<Integer> rise, String subtext, String xName, int width, int height) {
String eventDensityJson = LineGenerator.generateFrequencyOption(xData,dip,interruptions,rise,subtext,xName); String eventDensityJson = LineGenerator.generateFrequencyOption(xData, dip, interruptions, rise, subtext, xName);
return drawPic(eventDensityJson, width, height); return drawPic(eventDensityJson, width, height);
} }
} }

View File

@@ -108,5 +108,10 @@ public interface OssPath {
*/ */
String RESPONSIBILITY_USER_RESULT_DATA="advance/responsibility/userData/result/"; String RESPONSIBILITY_USER_RESULT_DATA="advance/responsibility/userData/result/";
/***
* 事件的波形图片
*/
String EVENT_WAVE_PIC="event/wave/";
} }

View File

@@ -25,6 +25,7 @@
<module>common-huawei</module> <module>common-huawei</module>
<module>common-oss</module> <module>common-oss</module>
<module>common-mq</module> <module>common-mq</module>
<module>common-event</module>
</modules> </modules>
<properties> <properties>

View File

@@ -32,6 +32,11 @@
<artifactId>common-microservice</artifactId> <artifactId>common-microservice</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-event</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pq-device-api</artifactId> <artifactId>pq-device-api</artifactId>

View File

@@ -16,10 +16,6 @@ public enum EventResponseEnum {
*/ */
EVENT_COMMON_ERROR("A00650","暂降模块异常"), EVENT_COMMON_ERROR("A00650","暂降模块异常"),
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"), EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到"),
WAVE_DATA_INVALID("A00654","波形文件数据缺失"),
DAT_DATA_ERROR("A00653","dat文件数据读取失败"),
RMS_DATA_ERROR("A00653","rms数据读取失败"),
/** /**

View File

@@ -1,46 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* 模拟量通道记录类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AnalogDTO implements Serializable {
// 通道序号
private Integer nIndex;
// 通道名称
private String szChannleName;
// 相位名称
private String szPhasicName;
// 监视的通道名称
private String szMonitoredChannleName;
// 通道的单位
private String szUnitName;
// 通道的系数
private Float fCoefficent;
// 通道的便宜量
private Float fOffset;
// 起始采样时间的偏移量
private Float fTimeOffset;
// 采样值的最小值
private Integer nMin;
// 采样值的最大值
private Integer nMax;
// 一次变比
private Float fPrimary;
// 二次变比
private Float fSecondary;
// 一次值还是二次值标志
private String szValueType;
}

View File

@@ -1,50 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* CFG配置文件总类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ComtradeCfgDTO implements Serializable {
private Integer nChannelNum;
private Integer nPhasic;// 模拟量通道的个数 yxb 2020-12-15
private Integer nAnalogNum;// 模拟量通道的个数 WW 2013-05-15
private Integer nDigitalNum;// 数字量通道的个数 WW 2013-05-15
private Date timeStart;// 暂态记录时间 yxb 2022-06-06
private Date timeTrige;// 暂态触发时间 yxb 2022-06-06
private List<AnalogDTO> lstAnalogDTO;//模拟量通道记录
private List<DigitalDTO> lstDigitalDTO;//数字量通道记录
public Integer nRates;//对应采样次数
public List<RateDTO> lstRate;//采样率合集
// add by sw 暂降触发时间
private Date firstTime; // 暂降触发第一次
private Integer firstMs; // 暂降触发第一次毫秒
// 波形前推周波束
private Integer nPush = 0;
// 最终采样率,计算的时候只用一个采样率
private Long finalSampleRate;
// 整个波形大小
private Long nAllWaveNum = 0L;
/***
* 赋值编码格式(二进制)
*/
private String strBinType;
}

View File

@@ -1,30 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* 数字量通道记录类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DigitalDTO implements Serializable {
// 通道序号
private Integer nIndex;
// 通道名称
private String szChannleName;
// 相位名称
private String szPhasicName;
// 监视的通道名称
private String szMonitoredChannleName;
// 通道的单位
private Integer Initial;
}

View File

@@ -1,28 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* 特征值计算类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EigenvalueDTO implements Serializable {
//是特征幅值(残余电压百分比)
private float amplitude;
//是特征幅值(残余电压)
private float residualVoltage;
//额定定压(动态电压)
private float ratedVoltage;
//持续时间
private float durationTime;
}

View File

@@ -1,27 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* 突变量计算类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MutationDTO implements Serializable {
private List<List<Float>> listRms_Offline = new ArrayList<>();//离线数据RMS有效值数据
private List<List<Float>> listTBL_Offline = new ArrayList<>();//离线数据突变量数据
private double fMinMagA = 99999d;
private double fMinMagB = 99999d;
private double fMinMagC = 99999d;
}

View File

@@ -1,24 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* 采样率类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RateDTO implements Serializable {
// 1秒钟内的采样点数
private Long nOneSample;
// 总采样点数
private Long nSampleNum;
}

View File

@@ -1,39 +0,0 @@
package com.njcn.event.pojo.dto.wave;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author yxb
* @version 1.0.0
* @date 2022年06月02日 20:03
* 返回波形数据类
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WaveDataDTO implements Serializable {
private ComtradeCfgDTO comtradeCfgDTO;//CFG实体类
//波形对应的标题
private List<String> waveTitle;
//波形对应的值
private List<List<Float>> listWaveData;
//波形RMS值
private List<List<Float>> listRmsData;
//RMS最小值
private List<List<Float>> listRmsMinData;
//波形对应的相别数量
private Integer iPhasic;
//接线方式(0.星型接法;1.三角型接法;2.开口三角型接法)
private Integer ptType;
//PT变比
private Double pt;
//CT变比"
private Double ct;
}

View File

@@ -35,7 +35,7 @@
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>system-api</artifactId> <artifactId>system-api</artifactId>
<version>${project.version}</version> <version>1.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>

View File

@@ -5,24 +5,18 @@ 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.param.LargeScreenParam; import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.device.pq.pojo.vo.*;
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
import com.njcn.event.service.majornetwork.AutonomeWaveService; import com.njcn.event.service.majornetwork.AutonomeWaveService;
import com.njcn.event.service.majornetwork.LargeScreenService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.List;
/** /**
* @version 1.0.0 * @version 1.0.0
@@ -45,7 +39,7 @@ public class AutonomeWaveController extends BaseController {
@PostMapping("/uploadFileAndViewWave") @PostMapping("/uploadFileAndViewWave")
@ApiOperation("上传文件并且展示波形") @ApiOperation("上传文件并且展示波形")
public HttpResult<WaveDataDTO> uploadFileAndViewWave(@ApiParam(value = "文件1", required = true) @RequestPart("file1") MultipartFile file1, public HttpResult<WaveDataDTO> uploadFileAndViewWave(@ApiParam(value = "文件1", required = true) @RequestPart("file1") MultipartFile file1,
@ApiParam(value = "文件2", required = true) @RequestPart("file2") MultipartFile file2) throws IOException { @ApiParam(value = "文件2", required = true) @RequestPart("file2") MultipartFile file2) throws IOException {
String methodDescribe = getMethodDescribe("uploadFileAndViewWave"); String methodDescribe = getMethodDescribe("uploadFileAndViewWave");
WaveDataDTO result = autonomeWaveService.uploadFileAndViewWave(file1, file2); WaveDataDTO result = autonomeWaveService.uploadFileAndViewWave(file1, file2);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);

View File

@@ -8,16 +8,14 @@ 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.pms.pojo.param.MonitorTerminalParam; import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.event.pojo.dto.wave.WaveDataDTO; import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.event.pojo.param.TransientParam; import com.njcn.event.pojo.param.TransientParam;
import com.njcn.event.pojo.param.WaveFileParam;
import com.njcn.event.pojo.po.EventDetailNew; import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.TransientVO; import com.njcn.event.pojo.vo.TransientVO;
import com.njcn.event.service.majornetwork.TransientService; import com.njcn.event.service.majornetwork.TransientService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
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.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -1,6 +1,6 @@
package com.njcn.event.service.majornetwork; package com.njcn.event.service.majornetwork;
import com.njcn.event.pojo.dto.wave.WaveDataDTO; import com.njcn.event.file.pojo.dto.WaveDataDTO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;

View File

@@ -1,12 +1,9 @@
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.plugins.pagination.Page;
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
import com.njcn.event.pojo.param.*; import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.vo.*; import com.njcn.event.pojo.vo.*;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException; import java.text.ParseException;
import java.util.List; import java.util.List;

View File

@@ -1,10 +1,10 @@
package com.njcn.event.service.majornetwork.Impl; package com.njcn.event.service.majornetwork.Impl;
import com.njcn.common.config.GeneralInfo; import com.njcn.common.config.GeneralInfo;
import com.njcn.event.pojo.dto.wave.AnalogDTO; import com.njcn.event.file.pojo.dto.AnalogDTO;
import com.njcn.event.pojo.dto.wave.WaveDataDTO; import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.event.file.component.WaveFileComponent;
import com.njcn.event.service.majornetwork.AutonomeWaveService; import com.njcn.event.service.majornetwork.AutonomeWaveService;
import com.njcn.event.utils.WaveUtil;
import com.njcn.oss.constant.GeneralConstant; import com.njcn.oss.constant.GeneralConstant;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -32,7 +32,7 @@ public class AutonomeWaveServiceImpl implements AutonomeWaveService {
private final GeneralInfo generalInfo; private final GeneralInfo generalInfo;
private final WaveUtil waveUtil; private final WaveFileComponent waveFileComponent;
@Override @Override
public WaveDataDTO uploadFileAndViewWave(MultipartFile file1, MultipartFile file2) throws IOException { public WaveDataDTO uploadFileAndViewWave(MultipartFile file1, MultipartFile file2) throws IOException {
@@ -59,8 +59,8 @@ public class AutonomeWaveServiceImpl implements AutonomeWaveService {
datPath = dir + File.separator + fileName2; datPath = dir + File.separator + fileName2;
InputStream cfgInputStream = Files.newInputStream(Paths.get(cfgPath)); InputStream cfgInputStream = Files.newInputStream(Paths.get(cfgPath));
InputStream datInputStream = Files.newInputStream(Paths.get(datPath)); InputStream datInputStream = Files.newInputStream(Paths.get(datPath));
WaveDataDTO comtrade = waveUtil.getComtrade(cfgInputStream, datInputStream, 1); WaveDataDTO comtrade = waveFileComponent.getComtrade(cfgInputStream, datInputStream, 1);
WaveDataDTO validData = waveUtil.getValidData(comtrade); WaveDataDTO validData = waveFileComponent.getValidData(comtrade);
return countPtCt(validData); return countPtCt(validData);
} else { } else {
//使用本地的波形文件进行测试 //使用本地的波形文件进行测试
@@ -72,8 +72,8 @@ public class AutonomeWaveServiceImpl implements AutonomeWaveService {
datPath = dir + File.separator + fileName1; datPath = dir + File.separator + fileName1;
InputStream cfgInputStream = Files.newInputStream(Paths.get(cfgPath)); InputStream cfgInputStream = Files.newInputStream(Paths.get(cfgPath));
InputStream datInputStream = Files.newInputStream(Paths.get(datPath)); InputStream datInputStream = Files.newInputStream(Paths.get(datPath));
WaveDataDTO comtrade = waveUtil.getComtrade(cfgInputStream, datInputStream, 1); WaveDataDTO comtrade = waveFileComponent.getComtrade(cfgInputStream, datInputStream, 1);
WaveDataDTO validData = waveUtil.getValidData(comtrade); WaveDataDTO validData = waveFileComponent.getValidData(comtrade);
return countPtCt(validData); return countPtCt(validData);
} }
} }

View File

@@ -14,6 +14,7 @@ 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.device.pq.pojo.vo.LineDetailDataVO; import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.event.enums.EventResponseEnum; import com.njcn.event.enums.EventResponseEnum;
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
import com.njcn.event.pojo.constant.Param; import com.njcn.event.pojo.constant.Param;
import com.njcn.event.pojo.param.*; import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.po.EventDetail; import com.njcn.event.pojo.po.EventDetail;
@@ -1953,7 +1954,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
// TODO 1 // TODO 1
if (!srcCFGFile.exists() && !srcDATFile.exists()) { if (!srcCFGFile.exists() && !srcDATFile.exists()) {
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
// TODO 1 // TODO 1

View File

@@ -3,7 +3,6 @@ package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,13 +12,13 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.PubUtils;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam; import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO; import com.njcn.device.pms.pojo.vo.MonitorVO;
import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.event.file.component.WaveFileComponent;
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper; import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper; import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
import com.njcn.event.pojo.po.RmpEventDetailPO; import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.RmpEventDetailVO;
import com.njcn.event.service.majornetwork.RmpEventDetailService;
import com.njcn.oss.constant.GeneralConstant; import com.njcn.oss.constant.GeneralConstant;
import com.njcn.oss.constant.OssPath; import com.njcn.oss.constant.OssPath;
import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.GeneralDeviceInfoClient;
@@ -29,18 +28,13 @@ import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO; import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.event.enums.EventResponseEnum; import com.njcn.event.enums.EventResponseEnum;
import com.njcn.event.mapper.majornetwork.TransientMapper; import com.njcn.event.mapper.majornetwork.TransientMapper;
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
import com.njcn.event.pojo.param.TransientParam; import com.njcn.event.pojo.param.TransientParam;
import com.njcn.event.pojo.param.WaveFileParam;
import com.njcn.event.pojo.po.EventDetail; import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew; import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.TransientVO; import com.njcn.event.pojo.vo.TransientVO;
import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.event.service.majornetwork.TransientService; import com.njcn.event.service.majornetwork.TransientService;
import com.njcn.event.utils.WaveUtil;
import com.njcn.huawei.obs.util.OBSUtil;
import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.enums.DicDataTypeEnum;
@@ -48,18 +42,14 @@ import com.njcn.system.pojo.po.DictData;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.influxdb.dto.QueryResult;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -90,7 +80,7 @@ public class TransientServiceImpl implements TransientService {
private final GeneralInfo generalInfo; private final GeneralInfo generalInfo;
private final WaveUtil waveUtil; private final WaveFileComponent waveFileComponent;
private final MonitorClient monitorClient; private final MonitorClient monitorClient;
@@ -184,9 +174,6 @@ public class TransientServiceImpl implements TransientService {
@Override @Override
public WaveDataDTO getTransientAnalyseWave(MonitorTerminalParam param) { public WaveDataDTO getTransientAnalyseWave(MonitorTerminalParam param) {
WaveDataDTO waveDataDTO; WaveDataDTO waveDataDTO;
//原始数据
WaveDataDTO originalData;
//获取暂降事件 //获取暂降事件
RmpEventDetailPO eventDetail = rmpEventDetailMapper.getByEventId(param.getId()); RmpEventDetailPO eventDetail = rmpEventDetailMapper.getByEventId(param.getId());
LineDetailDataVO lineDetailData = new LineDetailDataVO(); LineDetailDataVO lineDetailData = new LineDetailDataVO();
@@ -200,39 +187,34 @@ public class TransientServiceImpl implements TransientService {
monitorVO = monitorClient.getMonitorTerminal(param).getData(); monitorVO = monitorClient.getMonitorTerminal(param).getData();
ip = monitorVO.getIp(); ip = monitorVO.getIp();
} }
System.out.println(eventDetail.getEventId());
String waveName = eventDetail.getWavePath(); String waveName = eventDetail.getWavePath();
String cfgPath, datPath; String cfgPath, datPath;
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) { if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG; cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT; datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
InputStream cfgStream = waveUtil.getFileInputStreamByFilePath(cfgPath); InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
InputStream datStream = waveUtil.getFileInputStreamByFilePath(datPath); InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) { if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
originalData = waveUtil.getComtrade(cfgStream, datStream, 1); waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
// } else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
} else { } else {
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG; cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT; datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
System.out.println("波形路径-------------------" + cfgPath); System.out.println("波形路径-------------------" + cfgPath);
try ( try (
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath); InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
InputStream datStream = fileStorageUtil.getFileStream(datPath) InputStream datStream = fileStorageUtil.getFileStream(datPath)
) { ) {
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) { if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
originalData = waveUtil.getComtrade(cfgStream, datStream, 1); waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(EventResponseEnum.WAVE_DATA_INVALID); throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
} }
} }
waveDataDTO = waveUtil.getValidData(originalData); waveDataDTO = waveFileComponent.getValidData(waveDataDTO);
if (param.getSystemType() == 0) { if (param.getSystemType() == 0) {
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType())); waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
double pt1 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[0]); double pt1 = Double.parseDouble(lineDetailData.getPt().split(StrUtil.SLASH)[0]);
@@ -435,10 +417,10 @@ public class TransientServiceImpl implements TransientService {
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) { if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG; cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT; datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
cfgStream = waveUtil.getFileInputStreamByFilePath(cfgPath); cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
datStream = waveUtil.getFileInputStreamByFilePath(datPath); datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) { if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
} else { } else {
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG; cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
@@ -449,7 +431,7 @@ public class TransientServiceImpl implements TransientService {
datStream = fileStorageUtil.downloadStream(datPath); datStream = fileStorageUtil.downloadStream(datPath);
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) { if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
} }
@@ -468,7 +450,7 @@ public class TransientServiceImpl implements TransientService {
writeFile(datStream, fileDat); writeFile(datStream, fileDat);
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(EventResponseEnum.WAVE_DATA_INVALID); throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
} finally { } finally {
try { try {
if (cfgStream != null) { if (cfgStream != null) {

View File

@@ -2,10 +2,8 @@ package com.njcn.event.service.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam; import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.event.pojo.dto.wave.WaveDataDTO; import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.event.pojo.param.TransientParam; import com.njcn.event.pojo.param.TransientParam;
import com.njcn.event.pojo.param.WaveFileParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew; import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.vo.TransientVO; import com.njcn.event.pojo.vo.TransientVO;

View File

@@ -1,12 +1,13 @@
package com.njcn.event; package com.njcn.event;
import com.njcn.event.enums.EventResponseEnum; import com.njcn.event.enums.EventResponseEnum;
import com.njcn.event.file.component.WaveFileComponent;
import com.njcn.event.file.pojo.dto.EigenvalueDTO;
import com.njcn.event.file.pojo.dto.WaveDataDTO;
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
import com.njcn.event.pojo.PqsEventDetail; import com.njcn.event.pojo.PqsEventDetail;
import com.njcn.event.pojo.PqsOnlinerateAggregate; import com.njcn.event.pojo.PqsOnlinerateAggregate;
import com.njcn.event.pojo.PqsEventDetailCount; import com.njcn.event.pojo.PqsEventDetailCount;
import com.njcn.event.pojo.dto.wave.EigenvalueDTO;
import com.njcn.event.pojo.dto.wave.WaveDataDTO;
import com.njcn.event.utils.WaveUtil;
import com.njcn.huawei.obs.util.OBSUtil; import com.njcn.huawei.obs.util.OBSUtil;
import com.njcn.influxdb.config.InfluxDbConfig; import com.njcn.influxdb.config.InfluxDbConfig;
import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.influxdb.utils.InfluxDbUtils;
@@ -50,7 +51,7 @@ public class EventBootApplicationTest {
private InfluxDbUtils influxDbUtils; private InfluxDbUtils influxDbUtils;
@Autowired @Autowired
private WaveUtil waveUtil; private WaveFileComponent waveFileComponent;
@Autowired @Autowired
private OBSUtil obsUtil; private OBSUtil obsUtil;
@@ -145,17 +146,17 @@ public class EventBootApplicationTest {
InputStream datStream =obsUtil.downloadStream(datPath); InputStream datStream =obsUtil.downloadStream(datPath);
if(Objects.isNull(cfgStream) || Objects.isNull(datStream)){ if(Objects.isNull(cfgStream) || Objects.isNull(datStream)){
throw new FileNotFoundException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND.getMessage()); throw new FileNotFoundException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND.getMessage());
} }
// 获取瞬时波形 //获取原始波形值 // 获取瞬时波形 //获取原始波形值
WaveDataDTO waveDataDTO = waveUtil.getComtrade(cfgStream,datStream, 1); WaveDataDTO waveDataDTO = waveFileComponent.getComtrade(cfgStream,datStream, 1);
// 获取RMS波形 // 获取RMS波形
WaveDataDTO waveDataDTO1 = waveUtil.getValidData(waveDataDTO); WaveDataDTO waveDataDTO1 = waveFileComponent.getValidData(waveDataDTO);
// 获取特征值 // 获取特征值
List<EigenvalueDTO> lstEigenvalueDTO = waveUtil.getEigenvalue(waveDataDTO, true); List<EigenvalueDTO> lstEigenvalueDTO = waveFileComponent.getEigenvalue(waveDataDTO, true);
System.out.println(1); System.out.println(1);
} }