Compare commits
83 Commits
2026-02
...
c1dfcb9236
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1dfcb9236 | ||
|
|
f5eb2c7af6 | ||
|
|
d36c30973d | ||
|
|
148e834f9c | ||
|
|
9a9a8151d9 | ||
|
|
ca8bd9fea2 | ||
|
|
770b707b84 | ||
| 0196277eb2 | |||
|
|
6e4a294b00 | ||
| 1e5acdd214 | |||
|
|
2754969dfc | ||
|
|
4c083c84e5 | ||
|
|
6e26c81ff9 | ||
|
|
ba7ae8da9e | ||
|
|
ef6c464897 | ||
|
|
743cbfbdcb | ||
|
|
48cddd92b0 | ||
| ee5526b0f7 | |||
| 11306f1d00 | |||
|
|
85ab4de719 | ||
| 552573df00 | |||
| 50181459bf | |||
| 748fd62afb | |||
|
|
749c1d954c | ||
| 6089be6b4a | |||
| eb89472670 | |||
| 56cd9a05c3 | |||
| aafd32c7fc | |||
| 46969f7e02 | |||
| 79cec4e21b | |||
|
|
615fe78d61 | ||
|
|
5fff0890e8 | ||
|
|
f5e134b194 | ||
|
|
291a20649e | ||
| fdd6ff574f | |||
|
|
7eef16599f | ||
| 11750a4f3a | |||
| e5ffa2ec29 | |||
|
|
e6332f1c51 | ||
| 23d87aecc8 | |||
| eff784e94e | |||
|
|
eed647d3d1 | ||
|
|
4a5fde6a47 | ||
|
|
82ab1de5b9 | ||
|
|
ecc56dd2f6 | ||
| 39ae7412a8 | |||
| 52677f84dc | |||
| abdb855919 | |||
| 64bcbfff91 | |||
|
|
499eee6784 | ||
|
|
c58bd87a78 | ||
|
|
0902f92838 | ||
| 87818db6f3 | |||
|
|
850b3174a2 | ||
| aad5943d64 | |||
| 9c467310d5 | |||
| ca3b125424 | |||
|
|
0c5c9bf067 | ||
|
|
c692282ea4 | ||
| 232e84aad3 | |||
| 59f2588488 | |||
|
|
46f521c7a7 | ||
|
|
6d69027e16 | ||
|
|
1afed2c9a4 | ||
|
|
9bb250bdb9 | ||
|
|
d33b3637a5 | ||
|
|
f50f11b159 | ||
| 30984aa908 | |||
|
|
39cfffbf7e | ||
|
|
1aad1aa86b | ||
| fa500ca600 | |||
| 7b9fb1628b | |||
| fcddc064f6 | |||
| 37c5e9cbf8 | |||
| a08c7db24d | |||
| 9225e82edb | |||
| e8cd6da8a0 | |||
| 559620ab66 | |||
| f0b3b81e65 | |||
| 475ca820c8 | |||
|
|
c0db2cf961 | ||
|
|
4e95159e01 | ||
|
|
eec2560fd2 |
3
pom.xml
3
pom.xml
@@ -39,6 +39,7 @@
|
|||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<properties>
|
<properties>
|
||||||
|
<spring.profiles.active>sjzx</spring.profiles.active>
|
||||||
<!--中间件目标地址-->
|
<!--中间件目标地址-->
|
||||||
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
||||||
<middle.server.url>192.168.1.103</middle.server.url>
|
<middle.server.url>192.168.1.103</middle.server.url>
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
<!--nacos开启鉴权后的用户名-->
|
<!--nacos开启鉴权后的用户名-->
|
||||||
<nacos.username>nacos</nacos.username>
|
<nacos.username>nacos</nacos.username>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
<nacos.password>nacos</nacos.password>
|
<nacos.password>njcnpqs</nacos.password>
|
||||||
<!--服务器发布内容为空-->
|
<!--服务器发布内容为空-->
|
||||||
<nacos.namespace>hswbpm</nacos.namespace>
|
<nacos.namespace>hswbpm</nacos.namespace>
|
||||||
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
|
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
|
||||||
|
|||||||
@@ -2,8 +2,14 @@ package com.njcn.advance.api;
|
|||||||
|
|
||||||
import com.njcn.advance.api.fallback.EventWaveAnalysisFeignClientFallbackFactory;
|
import com.njcn.advance.api.fallback.EventWaveAnalysisFeignClientFallbackFactory;
|
||||||
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
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.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -27,4 +33,7 @@ public interface EventWaveAnalysisFeignClient {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("analysis")
|
@PostMapping("analysis")
|
||||||
HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex);
|
HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex);
|
||||||
|
|
||||||
|
@PostMapping("analysisWlEvent")
|
||||||
|
HttpResult<EntityAdvancedData> analysisWlEvent(@RequestParam("eventIndex") String eventIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ public class EventWaveAnalysisFeignClientFallbackFactory implements FallbackFact
|
|||||||
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "波形高级分析", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<EntityAdvancedData> analysisWlEvent(String eventIndex) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "物联测点波形高级分析异常", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,4 +73,10 @@ public class EventAnalysisDTO {
|
|||||||
* 1 正常计算
|
* 1 正常计算
|
||||||
*/
|
*/
|
||||||
private Integer typeFlag = 1;
|
private Integer typeFlag = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件全路径
|
||||||
|
* 适配物联的暂态事件解析 物联那边事件的路径是全路径,不需要拼接,这个参数可为空
|
||||||
|
*/
|
||||||
|
private String wlFilePath;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import java.util.*;
|
|||||||
public class AnalyWave {
|
public class AnalyWave {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
* 解析comtrate文件工具类
|
* 解析comtrate文件工具类
|
||||||
* author yexb根据Ww算法装换
|
* author yexb根据Ww算法装换
|
||||||
@@ -94,7 +92,7 @@ public class AnalyWave {
|
|||||||
** ** strFilePath *** cfg文件路径
|
** ** strFilePath *** cfg文件路径
|
||||||
* *** auth *** 读取方式 null则使用本地读取方式读取
|
* *** auth *** 读取方式 null则使用本地读取方式读取
|
||||||
******************************************/
|
******************************************/
|
||||||
public AnalyWaveModel.tagDataValue readComtrade(List<String> temCfgList,byte[] array, int iFlag) {
|
public AnalyWaveModel.tagDataValue readComtrade(List<String> temCfgList, byte[] array, int iFlag) {
|
||||||
//初始化参数
|
//初始化参数
|
||||||
ComtradeCfg = new AnalyWaveModel.tagComtradeCfg();
|
ComtradeCfg = new AnalyWaveModel.tagComtradeCfg();
|
||||||
RatesCfg = new AnalyWaveModel.tagRates();
|
RatesCfg = new AnalyWaveModel.tagRates();
|
||||||
@@ -163,148 +161,145 @@ public class AnalyWave {
|
|||||||
iterable.next();
|
iterable.next();
|
||||||
String[] strTempArray;// 读取cfg文件
|
String[] strTempArray;// 读取cfg文件
|
||||||
try {
|
try {
|
||||||
nFreq = 0f;//WW 2019-11-14
|
nFreq = 0f;//WW 2019-11-14
|
||||||
String strFileLine = iterable.next();
|
String strFileLine = iterable.next();
|
||||||
|
strTempArray = strFileLine.split(",");
|
||||||
|
|
||||||
|
for (int i = 0; i < strTempArray.length; i++) {
|
||||||
|
switch (i) {
|
||||||
|
case 0:// 总个数
|
||||||
|
ComtradeCfg.nChannelNum = Integer.parseInt(strTempArray[i]);
|
||||||
|
break;
|
||||||
|
case 1:// 模拟量的个数
|
||||||
|
{
|
||||||
|
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||||
|
ComtradeCfg.nAnalogNum = Integer.parseInt(str);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:// 开关量的个数
|
||||||
|
{
|
||||||
|
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||||
|
ComtradeCfg.nDigitalNum = Integer.parseInt(str);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从第三行到第ComtradeCfg.nChannelNum+3行是模拟量通道和数字量通道
|
||||||
|
for (int i = 0; i < ComtradeCfg.nChannelNum; i++) {
|
||||||
|
AnalyWaveModel.tagOneChannleCfg OneChannlecfg = new AnalyWaveModel.tagOneChannleCfg();
|
||||||
|
ComtradeCfg.OneChannleCfg.add(OneChannlecfg);
|
||||||
|
|
||||||
|
strFileLine = iterable.next();
|
||||||
|
strTempArray = strFileLine.split(",");
|
||||||
|
// 配置总共13项
|
||||||
|
for (int j = 0; j < strTempArray.length; j++) {
|
||||||
|
switch (j) {
|
||||||
|
case 0:// 通道序号
|
||||||
|
OneChannlecfg.nIndex = Integer.parseInt(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 1:// 通道名称
|
||||||
|
OneChannlecfg.szChannleName = strTempArray[j];
|
||||||
|
break;
|
||||||
|
case 2:// 相位名称
|
||||||
|
OneChannlecfg.szPhasicName = strTempArray[j];
|
||||||
|
break;
|
||||||
|
case 3:// 监视的通道名称
|
||||||
|
OneChannlecfg.szMonitoredChannleName = strTempArray[j];
|
||||||
|
break;
|
||||||
|
case 4:// 通道的单位
|
||||||
|
OneChannlecfg.szUnitName = strTempArray[j];
|
||||||
|
break;
|
||||||
|
case 5:// 通道的系数
|
||||||
|
OneChannlecfg.fCoefficent = Float.parseFloat(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 6:// 通道的偏移量
|
||||||
|
OneChannlecfg.fOffset = Float.parseFloat(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 7:// 起始采样时间的偏移量
|
||||||
|
OneChannlecfg.fTimeOffset = Float.parseFloat(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 8:// 采样值的最小值
|
||||||
|
OneChannlecfg.nMin = Integer.parseInt(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 9:// 采样值的最大值
|
||||||
|
OneChannlecfg.nMax = Integer.parseInt(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 10:// 一次变比
|
||||||
|
OneChannlecfg.fPrimary = Float.parseFloat(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 11:// 二次变比
|
||||||
|
OneChannlecfg.fSecondary = Float.parseFloat(strTempArray[j]);
|
||||||
|
break;
|
||||||
|
case 12:// 一次值还是二次值标志
|
||||||
|
OneChannlecfg.szValueType = strTempArray[j];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 采样频率
|
||||||
|
strFileLine = iterable.next();
|
||||||
|
float fFreq = Float.parseFloat(strFileLine);
|
||||||
|
nFreq = (float) fFreq;//WW 2019-11-14
|
||||||
|
// 采样段数
|
||||||
|
strFileLine = iterable.next();
|
||||||
|
int nRates = Integer.parseInt(strFileLine);
|
||||||
|
RatesCfg.nRates = nRates;
|
||||||
|
// 获得每段的采样率
|
||||||
|
long nOffset = 0;
|
||||||
|
for (int i = 0; i < nRates; i++) {
|
||||||
|
strFileLine = iterable.next();
|
||||||
strTempArray = strFileLine.split(",");
|
strTempArray = strFileLine.split(",");
|
||||||
|
|
||||||
for (int i = 0; i < strTempArray.length; i++) {
|
AnalyWaveModel.tagOneRate OneRate = new AnalyWaveModel.tagOneRate();
|
||||||
switch (i) {
|
RatesCfg.OneRate.add(OneRate);
|
||||||
case 0:// 总个数
|
|
||||||
ComtradeCfg.nChannelNum = Integer.parseInt(strTempArray[i]);
|
for (int j = 0; j < strTempArray.length; j++) {
|
||||||
|
|
||||||
|
switch (j) {
|
||||||
|
case 0:// 单周波采样点数
|
||||||
|
OneRate.nOneSample = (int) (Float.parseFloat(strTempArray[j]) / nFreq);//WW 2019-11-14
|
||||||
|
break;
|
||||||
|
case 1:// 总点数 //这里的strTemp是一个偏移量
|
||||||
|
OneRate.nSampleNum = (long) (Float.parseFloat(strTempArray[j]) - nOffset);
|
||||||
|
nOffset += OneRate.nSampleNum;
|
||||||
break;
|
break;
|
||||||
case 1:// 模拟量的个数
|
|
||||||
{
|
|
||||||
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
|
||||||
ComtradeCfg.nAnalogNum = Integer.parseInt(str);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:// 开关量的个数
|
|
||||||
{
|
|
||||||
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
|
||||||
ComtradeCfg.nDigitalNum = Integer.parseInt(str);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 从第三行到第ComtradeCfg.nChannelNum+3行是模拟量通道和数字量通道
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.SSS");
|
||||||
for (int i = 0; i < ComtradeCfg.nChannelNum; i++) {
|
// 波形起始时间
|
||||||
AnalyWaveModel.tagOneChannleCfg OneChannlecfg = new AnalyWaveModel.tagOneChannleCfg();
|
strFileLine = iterable.next();
|
||||||
ComtradeCfg.OneChannleCfg.add(OneChannlecfg);
|
strFileLine = strFileLine.substring(0, strFileLine.length() - 3).replace(",", " ");
|
||||||
|
TimeTrige = sdf.parse(strFileLine);
|
||||||
strFileLine = iterable.next();
|
// 暂态触发时间
|
||||||
strTempArray = strFileLine.split(",");
|
strFileLine = iterable.next();
|
||||||
// 配置总共13项
|
strFileLine = strFileLine.substring(0, strFileLine.length() - 3).replace(",", " ");
|
||||||
for (int j = 0; j < strTempArray.length; j++) {
|
TimeWave = sdf.parse(strFileLine);
|
||||||
switch (j) {
|
|
||||||
case 0:// 通道序号
|
|
||||||
OneChannlecfg.nIndex = Integer.parseInt(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 1:// 通道名称
|
|
||||||
OneChannlecfg.szChannleName = strTempArray[j];
|
|
||||||
break;
|
|
||||||
case 2:// 相位名称
|
|
||||||
OneChannlecfg.szPhasicName = strTempArray[j];
|
|
||||||
break;
|
|
||||||
case 3:// 监视的通道名称
|
|
||||||
OneChannlecfg.szMonitoredChannleName = strTempArray[j];
|
|
||||||
break;
|
|
||||||
case 4:// 通道的单位
|
|
||||||
OneChannlecfg.szUnitName = strTempArray[j];
|
|
||||||
break;
|
|
||||||
case 5:// 通道的系数
|
|
||||||
OneChannlecfg.fCoefficent = Float.parseFloat(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 6:// 通道的偏移量
|
|
||||||
OneChannlecfg.fOffset = Float.parseFloat(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 7:// 起始采样时间的偏移量
|
|
||||||
OneChannlecfg.fTimeOffset = Float.parseFloat(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 8:// 采样值的最小值
|
|
||||||
OneChannlecfg.nMin = Integer.parseInt(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 9:// 采样值的最大值
|
|
||||||
OneChannlecfg.nMax = Integer.parseInt(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 10:// 一次变比
|
|
||||||
OneChannlecfg.fPrimary = Float.parseFloat(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 11:// 二次变比
|
|
||||||
OneChannlecfg.fSecondary = Float.parseFloat(strTempArray[j]);
|
|
||||||
break;
|
|
||||||
case 12:// 一次值还是二次值标志
|
|
||||||
OneChannlecfg.szValueType = strTempArray[j];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 采样频率
|
|
||||||
strFileLine = iterable.next();
|
|
||||||
float fFreq = Float.parseFloat(strFileLine);
|
|
||||||
nFreq = (float) fFreq;//WW 2019-11-14
|
|
||||||
// 采样段数
|
|
||||||
strFileLine = iterable.next();
|
|
||||||
int nRates = Integer.parseInt(strFileLine);
|
|
||||||
RatesCfg.nRates = nRates;
|
|
||||||
// 获得每段的采样率
|
|
||||||
long nOffset = 0;
|
|
||||||
for (int i = 0; i < nRates; i++) {
|
|
||||||
strFileLine = iterable.next();
|
|
||||||
strTempArray = strFileLine.split(",");
|
|
||||||
|
|
||||||
AnalyWaveModel.tagOneRate OneRate = new AnalyWaveModel.tagOneRate();
|
|
||||||
RatesCfg.OneRate.add(OneRate);
|
|
||||||
|
|
||||||
for (int j = 0; j < strTempArray.length; j++) {
|
|
||||||
|
|
||||||
switch (j) {
|
|
||||||
case 0:// 单周波采样点数
|
|
||||||
OneRate.nOneSample = (int) (Float.parseFloat(strTempArray[j]) / nFreq);//WW 2019-11-14
|
|
||||||
break;
|
|
||||||
case 1:// 总点数 //这里的strTemp是一个偏移量
|
|
||||||
OneRate.nSampleNum = (long) (Float.parseFloat(strTempArray[j]) - nOffset);
|
|
||||||
nOffset += OneRate.nSampleNum;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss.SSS");
|
|
||||||
// 波形起始时间
|
|
||||||
strFileLine = iterable.next();
|
|
||||||
strFileLine = strFileLine.substring(0, strFileLine.length() - 3).replace(",", " ");
|
|
||||||
TimeTrige = sdf.parse(strFileLine);
|
|
||||||
// 暂态触发时间
|
|
||||||
strFileLine = iterable.next();
|
|
||||||
strFileLine = strFileLine.substring(0, strFileLine.length() - 3).replace(",", " ");
|
|
||||||
TimeWave = sdf.parse(strFileLine);
|
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(TimeWave);
|
|
||||||
firstMs = calendar.get(Calendar.MILLISECOND);
|
|
||||||
firstTime = calendar.getTime();
|
|
||||||
|
|
||||||
long a = TimeWave.getTime();
|
|
||||||
long b = TimeTrige.getTime();
|
|
||||||
int c = (int) (a - b);
|
|
||||||
if (c >= 90 && c <= 110) {
|
|
||||||
iPush = 100;
|
|
||||||
} else if (c >= 190 && c <= 210) {
|
|
||||||
iPush = 200;
|
|
||||||
}
|
|
||||||
// 赋值编码格式(二进制)
|
|
||||||
strBinType = iterable.next().toUpperCase();
|
|
||||||
|
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(TimeWave);
|
||||||
|
firstMs = calendar.get(Calendar.MILLISECOND);
|
||||||
|
firstTime = calendar.getTime();
|
||||||
|
|
||||||
|
long a = TimeWave.getTime();
|
||||||
|
long b = TimeTrige.getTime();
|
||||||
|
int c = (int) (a - b);
|
||||||
|
if (c >= 90 && c <= 110) {
|
||||||
|
iPush = 100;
|
||||||
|
} else if (c >= 190 && c <= 210) {
|
||||||
|
iPush = 200;
|
||||||
|
}
|
||||||
|
// 赋值编码格式(二进制)
|
||||||
|
strBinType = iterable.next().toUpperCase();
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("读取文件内容出错"+e.getMessage());
|
logger.error("读取文件内容出错" + e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}finally {
|
} finally {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -319,15 +314,8 @@ public class AnalyWave {
|
|||||||
private List<List<Float>> AnalyseComtradeDat(byte[] array, int iFlag) {
|
private List<List<Float>> AnalyseComtradeDat(byte[] array, int iFlag) {
|
||||||
float xValueAll = 0;//初始化xValue的值
|
float xValueAll = 0;//初始化xValue的值
|
||||||
boolean blxValue = false;//判断是否首次登陆
|
boolean blxValue = false;//判断是否首次登陆
|
||||||
|
|
||||||
List<List<Float>> listWaveData = new ArrayList<>();//返回数据
|
List<List<Float>> listWaveData = new ArrayList<>();//返回数据
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 计算每个单独的数据块的大小 4字节的序号 4字节的时间 2字节的值
|
// 计算每个单独的数据块的大小 4字节的序号 4字节的时间 2字节的值
|
||||||
// 示例中的排布是 4字节的序号 4字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节)
|
// 示例中的排布是 4字节的序号 4字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节)
|
||||||
// IC(2字节)
|
// IC(2字节)
|
||||||
@@ -470,7 +458,7 @@ public class AnalyWave {
|
|||||||
{
|
{
|
||||||
if (ComtradeCfg.OneChannleCfg.get(j).fPrimary != 0.0f)//根据cfg内的变比,将一次值转换成二次值
|
if (ComtradeCfg.OneChannleCfg.get(j).fPrimary != 0.0f)//根据cfg内的变比,将一次值转换成二次值
|
||||||
{
|
{
|
||||||
fValue = ComtradeCfg.OneChannleCfg.get(j).fSecondary / ComtradeCfg.OneChannleCfg.get(j).fPrimary;
|
fValue = fValue * ComtradeCfg.OneChannleCfg.get(j).fSecondary / ComtradeCfg.OneChannleCfg.get(j).fPrimary;
|
||||||
} else {
|
} else {
|
||||||
fValue = fValue;
|
fValue = fValue;
|
||||||
}
|
}
|
||||||
@@ -500,7 +488,7 @@ public class AnalyWave {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("读取文件出错:" + e.getMessage());
|
logger.error("读取文件出错:" + e.getMessage());
|
||||||
return listWaveData;
|
return listWaveData;
|
||||||
}finally {
|
} finally {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,13 @@ public class CauseStruct extends Structure {
|
|||||||
public static class ByValue extends CauseStruct implements Structure.ByValue {
|
public static class ByValue extends CauseStruct implements Structure.ByValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected List<String> getFieldOrder() { // 返回值填入的顺序
|
||||||
|
// return Arrays.asList(new String[] { "cause", "no_cal" });
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> getFieldOrder() { // 返回值填入的顺序
|
protected List<String> getFieldOrder() {
|
||||||
return Arrays.asList(new String[] { "cause", "no_cal" });
|
return Arrays.asList("smp_va", "smp_vb", "smp_vc", "smp_rate", "smp_len", "threshold", "cause", "no_cal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,13 @@ public class Rect extends Structure {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected List<String> getFieldOrder() {
|
||||||
|
// return Arrays.asList(new String[] { "evt_num","evt_buf" });
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> getFieldOrder() {
|
protected List<String> getFieldOrder() {
|
||||||
return Arrays.asList(new String[] { "evt_num","evt_buf" });
|
return Arrays.asList("smp_va", "smp_vb", "smp_vc", "smp_rate", "smp_len", "evt_num", "evt_buf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public class EventWaveAnalysisController extends BaseController {
|
|||||||
|
|
||||||
private final EventWaveAnalysisService eventWaveAnalysisService;
|
private final EventWaveAnalysisService eventWaveAnalysisService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("analysis")
|
@PostMapping("analysis")
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@ApiOperation("波形高级分析")
|
@ApiOperation("波形高级分析")
|
||||||
@@ -43,6 +42,15 @@ public class EventWaveAnalysisController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("analysis");
|
String methodDescribe = getMethodDescribe("analysis");
|
||||||
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
|
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("analysisWlEvent")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("物联事件波形高级分析")
|
||||||
|
@ApiImplicitParam(name = "eventIndex", value = "暂降事件id", required = true)
|
||||||
|
public HttpResult<EntityAdvancedData> analysisWlEvent(@RequestParam("eventIndex") String eventIndex) {
|
||||||
|
String methodDescribe = getMethodDescribe("analysisWlEvent");
|
||||||
|
EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysisWlEvent(eventIndex);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.njcn.advance.event.service.impl;
|
package com.njcn.advance.event.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.njcn.advance.enums.EnumEvt;
|
||||||
import com.njcn.advance.event.cause.jna.QvvrCauseDLL;
|
import com.njcn.advance.event.cause.jna.QvvrCauseDLL;
|
||||||
import com.njcn.advance.event.cause.model.DataFeature;
|
import com.njcn.advance.event.cause.model.DataFeature;
|
||||||
import com.njcn.advance.event.type.jna.*;
|
import com.njcn.advance.event.type.jna.*;
|
||||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.advance.event.service.IEventAdvanceService;
|
import com.njcn.advance.event.service.IEventAdvanceService;
|
||||||
|
import com.njcn.advance.utils.Utils;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.event.file.component.WaveFileComponent;
|
import com.njcn.event.file.component.WaveFileComponent;
|
||||||
@@ -18,6 +20,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -44,11 +47,12 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
|
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
|
||||||
WaveDataDTO waveDataDTO;
|
WaveDataDTO waveDataDTO;
|
||||||
String waveName = eventAnalysis.getWaveName();
|
String waveName = eventAnalysis.getWaveName();
|
||||||
|
String wlFilePath = eventAnalysis.getWlFilePath();
|
||||||
String cfgPath, datPath, cfgPath2, datPath2;
|
String cfgPath, datPath, cfgPath2, datPath2;
|
||||||
String ip = eventAnalysis.getIp();
|
String ip = eventAnalysis.getIp();
|
||||||
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||||
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
|
cfgPath = Objects.isNull(wlFilePath) ? generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG : wlFilePath + GeneralConstant.CFG;
|
||||||
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
|
datPath = Objects.isNull(wlFilePath) ? generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT : wlFilePath + GeneralConstant.DAT;
|
||||||
log.info("本地磁盘波形文件路径----" + cfgPath);
|
log.info("本地磁盘波形文件路径----" + cfgPath);
|
||||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||||
@@ -57,11 +61,11 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
||||||
} else {
|
} else {
|
||||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
cfgPath = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG : wlFilePath + GeneralConstant.CFG;
|
||||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
datPath = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT : wlFilePath + GeneralConstant.DAT;
|
||||||
//适配文件后缀小写
|
//适配文件后缀小写
|
||||||
cfgPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase();
|
cfgPath2 = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase() : wlFilePath + GeneralConstant.CFG.toLowerCase();
|
||||||
datPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase();
|
datPath2 = Objects.isNull(wlFilePath) ? OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase() : wlFilePath + GeneralConstant.DAT.toLowerCase();
|
||||||
log.info("文件服务器波形文件路径----" + cfgPath);
|
log.info("文件服务器波形文件路径----" + cfgPath);
|
||||||
try (
|
try (
|
||||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
||||||
@@ -70,7 +74,7 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
waveDataDTO = waveFileComponent.getComtradeNoAddPoints(cfgStream, datStream, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath2);
|
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath2);
|
||||||
@@ -107,7 +111,6 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
try {
|
try {
|
||||||
QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
||||||
System.out.println("调用qvvrdll成功-----------");
|
System.out.println("调用qvvrdll成功-----------");
|
||||||
|
|
||||||
if (typeDataStruct.evt_num > 0) {
|
if (typeDataStruct.evt_num > 0) {
|
||||||
// 全局比较找出最小三相电压特征值
|
// 全局比较找出最小三相电压特征值
|
||||||
float globalMinVoltage = Float.MAX_VALUE;
|
float globalMinVoltage = Float.MAX_VALUE;
|
||||||
@@ -122,10 +125,14 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//上传HR
|
||||||
eventAnalysis.setType(globalFaultType);
|
eventAnalysis.setType(globalFaultType);
|
||||||
} else {
|
} else {
|
||||||
eventAnalysis.setType(DataFeature.TYPE10);
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("结束qvvrdll方法调用-----------");
|
System.out.println("结束qvvrdll方法调用-----------");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
eventAnalysis.setType(DataFeature.TYPE10);
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
@@ -154,8 +161,332 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
eventAnalysis.setCause(DataFeature.CAUSE_TYPE0);
|
eventAnalysis.setCause(DataFeature.CAUSE_TYPE0);
|
||||||
eventAnalysis.setCauseFlag(0);
|
eventAnalysis.setCauseFlag(0);
|
||||||
}
|
}
|
||||||
|
String str = null;
|
||||||
|
try {
|
||||||
|
str = WriteData2File(typeDataStruct,causeDataStruct);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (Objects.isNull(wlFilePath)) {
|
||||||
|
String hdrPath = OssPath.WAVE_DIR + ip+StrUtil.SLASH;
|
||||||
|
String hdrName = waveName + GeneralConstant.HDR_LOWER;
|
||||||
|
fileStorageUtil.uploadStreamSpecifyName(new ByteArrayInputStream(str.getBytes()),hdrPath,hdrName);
|
||||||
|
} else {
|
||||||
|
// comtrade/00:B7:8D:00:A8:7A/PQMonitor_PQM1_00100_20260204_162453_071_WAV.hdr
|
||||||
|
String fullPath = wlFilePath + GeneralConstant.HDR_LOWER;
|
||||||
|
int lastSlashIndex = fullPath.lastIndexOf('/');
|
||||||
|
String hdrPath = fullPath.substring(0, lastSlashIndex + 1);
|
||||||
|
String hdrName = fullPath.substring(lastSlashIndex + 1);
|
||||||
|
fileStorageUtil.uploadStreamSpecifyName(new ByteArrayInputStream(str.getBytes()),hdrPath,hdrName);
|
||||||
|
}
|
||||||
System.out.println("暂降原因分析完毕===============");
|
System.out.println("暂降原因分析完毕===============");
|
||||||
System.out.println("cause:" + eventAnalysis);
|
System.out.println("cause:" + eventAnalysis);
|
||||||
return eventAnalysis;
|
return eventAnalysis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String WriteData2File(QvvrDLL.QvvrDataStruct rect, QvvrCauseDLL.QvvrDataStruct causeDataStruct) throws Exception {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder("{" + EnumEvt.NEWLINE.getProperty());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @写入返回事件总数
|
||||||
|
*/
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.EVT_NUM.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_num), 1));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.EVT_BUF.getProperty()) + "[");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @写入返回事件参数
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < rect.evt_num; i++) {
|
||||||
|
stringBuilder.append(EnumEvt.setNewLine() + EnumEvt.setTab(2));
|
||||||
|
/**
|
||||||
|
* @波形起始点
|
||||||
|
*/
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.POW_A.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].POW_a), 3));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.POW_B.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].POW_b), 3));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.POW_C.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].POW_c), 3));
|
||||||
|
/**
|
||||||
|
* @跳变段电压变化率
|
||||||
|
*/
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.VOLTAGECHANGE_VA.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].Voltagechange_Va), 3));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.VOLTAGECHANGE_VB.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].Voltagechange_Vb), 3));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.VOLTAGECHANGE_VC.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].Voltagechange_Vc), 3));
|
||||||
|
/**
|
||||||
|
* @持续时间
|
||||||
|
*/
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.HOLD_TIME_RMS.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].hold_time_rms), 3));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.HOLD_TIME_DQ.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(rect.evt_buf[i].hold_time_dq), 3));
|
||||||
|
/**
|
||||||
|
* @分段数目
|
||||||
|
*/
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.SEG_T_NUM.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_buf[i].SEG_T_num), 3));
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.SEG_T_IDX.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setNewLine() + EnumEvt.setTab(3));
|
||||||
|
|
||||||
|
for (int j = 0; j < rect.evt_buf[i].SEG_T_num; j++) {
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(Utils.int2String(j)));
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].SEG_T_num - 1 == j) {
|
||||||
|
stringBuilder.append(Utils.int2String(rect.evt_buf[i].SEG_T_idx[j]));
|
||||||
|
} else {
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_buf[i].SEG_T_idx[j]), 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @特征幅值
|
||||||
|
*/
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(EnumEvt.U_MIN_NUM.getProperty()));
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(rect.evt_buf[i].u_min_num), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @最小值位置
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ORDER_MIN_IDX.getProperty(), null,
|
||||||
|
rect.evt_buf[i].order_min_idx[k]);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @A相电压特征值
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.UA_MIN.getProperty(), rect.evt_buf[i].ua_min[k], null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @B相电压特征值
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.UB_MIN.getProperty(), rect.evt_buf[i].ub_min[k], null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @C相电压特征值
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.UC_MIN.getProperty(), rect.evt_buf[i].uc_min[k], null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @三相电压特征值
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.U3_MIN.getProperty(), rect.evt_buf[i].u3_min[k], null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @A相相位正跳变
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_AP.getProperty(), rect.evt_buf[i].angle_diff_ap[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @B相相位正跳变
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_BP.getProperty(), rect.evt_buf[i].angle_diff_bp[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @C相相位正跳变
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_CP.getProperty(), rect.evt_buf[i].angle_diff_cp[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @A相相位负跳变
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_AN.getProperty(), rect.evt_buf[i].angle_diff_an[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @B相相位负跳变
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_BN.getProperty(), rect.evt_buf[i].angle_diff_bn[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @C相相位负跳变
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.ANGLE_DIFF_CN.getProperty(), rect.evt_buf[i].angle_diff_cn[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @不平衡度
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.BPH_MAX_VALUE.getProperty(), rect.evt_buf[i].bph_max_value[k],
|
||||||
|
null);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @暂降原因
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.QVVR_CATA_CAUSE.getProperty(), null,
|
||||||
|
causeDataStruct.cause);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @暂降类型
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.QVVR_CATA_TYPE.getProperty(), null,
|
||||||
|
rect.evt_buf[i].qvvr_cata_type[k]);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(3), 3));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @暂降相别
|
||||||
|
*/
|
||||||
|
for (int k = 0; k < rect.evt_buf[i].u_min_num; k++) {
|
||||||
|
setEigenVlaue(k, stringBuilder, EnumEvt.QVVR_PHASETYPE.getProperty(), null,
|
||||||
|
rect.evt_buf[i].qvvr_phasetype[k]);
|
||||||
|
|
||||||
|
if (rect.evt_buf[i].u_min_num - 1 == k) {
|
||||||
|
stringBuilder.delete(stringBuilder.lastIndexOf(","), stringBuilder.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setClose(3));
|
||||||
|
|
||||||
|
if (rect.evt_num - 1 == i) {
|
||||||
|
stringBuilder.append(EnumEvt.setClose(2));
|
||||||
|
stringBuilder.append("]" + EnumEvt.ENTER.getProperty());
|
||||||
|
} else {
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(EnumEvt.setClose(2), 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(rect.evt_num==0){
|
||||||
|
stringBuilder.append("]");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append("}");
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @特征值处理
|
||||||
|
*/
|
||||||
|
public void setEigenVlaue(int len, StringBuilder stringBuilder, String string, Float f, Integer integer) {
|
||||||
|
if (0 == len) {
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(string));
|
||||||
|
stringBuilder.append(EnumEvt.setNewLine() + EnumEvt.setTab(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
stringBuilder.append(EnumEvt.setEvtProperty(Integer.toString(len)));
|
||||||
|
|
||||||
|
if (null == f) {
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.int2String(integer.intValue()), 4));
|
||||||
|
} else {
|
||||||
|
stringBuilder.append(EnumEvt.setEnter(Utils.float2String(f.floatValue()), 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,6 @@ import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
|
|||||||
public interface EventWaveAnalysisService {
|
public interface EventWaveAnalysisService {
|
||||||
|
|
||||||
EntityAdvancedData analysis(String eventIndex);
|
EntityAdvancedData analysis(String eventIndex);
|
||||||
|
|
||||||
|
EntityAdvancedData analysisWlEvent(String eventIndex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,16 @@ package com.njcn.advance.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.TimeInterval;
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.advance.enums.EnumEvt;
|
import com.njcn.advance.enums.EnumEvt;
|
||||||
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
import com.njcn.advance.mapper.RmpEventAdvanceMapper;
|
||||||
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
import com.njcn.advance.pojo.dto.waveAnalysis.*;
|
||||||
|
|
||||||
import com.njcn.advance.service.EventWaveAnalysisService;
|
import com.njcn.advance.service.EventWaveAnalysisService;
|
||||||
import com.njcn.advance.utils.*;
|
import com.njcn.advance.utils.JnaCallBalance;
|
||||||
|
import com.njcn.advance.utils.JnaCallDllOrSo;
|
||||||
|
import com.njcn.advance.utils.Utils;
|
||||||
|
import com.njcn.advance.utils.WaveUtils;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
@@ -26,7 +29,10 @@ import net.sf.json.JSONObject;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -75,6 +81,8 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
//获取所有暂态原因
|
//获取所有暂态原因
|
||||||
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
|
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||||
|
Map<Integer, DictData> eventReasonMap = reasonList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
InputStream inputStreamCfg;
|
InputStream inputStreamCfg;
|
||||||
InputStream inputStreamDat;
|
InputStream inputStreamDat;
|
||||||
try {
|
try {
|
||||||
@@ -170,17 +178,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
causeStruct.smp_len = pitchList.size();
|
causeStruct.smp_len = pitchList.size();
|
||||||
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||||
|
|
||||||
|
String hdrStr = waveUtils.getFile(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.HDR_LOWER);
|
||||||
String hdrStr = waveUtils.getFile(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.HDR);
|
|
||||||
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
JSONObject jsonObject = JSONObject.fromObject(hdrStr);
|
||||||
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
translateData(jsonObject, rmpEventDetailPO.getStartTime(), entityAdvancedData);
|
||||||
|
|
||||||
|
if (!Objects.equals(rmpEventDetailPO.getDealFlag(),1) ) {
|
||||||
if (rmpEventDetailPO.getDealFlag() != 1) {
|
|
||||||
//如果存在三个文件但是没有调用dll/so计算
|
//如果存在三个文件但是没有调用dll/so计算
|
||||||
|
|
||||||
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -190,7 +194,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
if (entityAdvancedData.backNumber > 0) {
|
if (entityAdvancedData.backNumber > 0) {
|
||||||
for (int i = 0; i < entityAdvancedData.backNumber; i++) {
|
for (int i = 0; i < entityAdvancedData.backNumber; i++) {
|
||||||
entityAdvancedData.sagType[i] = eventTypeMap.get(entityAdvancedData.evt_buf[i].qvvr_cata_type[0]).getName();
|
entityAdvancedData.sagType[i] = eventTypeMap.get(entityAdvancedData.evt_buf[i].qvvr_cata_type[0]).getName();
|
||||||
|
entityAdvancedData.sagReason[i]= eventReasonMap.get(entityAdvancedData.evt_buf[i].qvvr_cata_cause[0]).getName();
|
||||||
switch (entityAdvancedData.evt_buf[i].qvvr_phasetype[0]) {
|
switch (entityAdvancedData.evt_buf[i].qvvr_phasetype[0]) {
|
||||||
case 1:
|
case 1:
|
||||||
entityAdvancedData.sagPhaseType[i] = "单相";
|
entityAdvancedData.sagPhaseType[i] = "单相";
|
||||||
@@ -214,6 +218,171 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
return entityAdvancedData;
|
return entityAdvancedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityAdvancedData analysisWlEvent(String eventIndex) {
|
||||||
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
|
//调用方法获取暂降事件详情
|
||||||
|
RmpEventDetailPO rmpEventDetailPO = rmpEventAdvanceMapper.selectById(eventIndex);
|
||||||
|
EntityAdvancedData entityAdvancedData;
|
||||||
|
|
||||||
|
if (Objects.isNull(rmpEventDetailPO.getFileFlag())) {
|
||||||
|
throw new BusinessException("系统检测到波形文件未从装置招到本地,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rmpEventDetailPO.getFileFlag() == 1) {
|
||||||
|
//获取所有暂态原因
|
||||||
|
List<DictData> dicDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_TYPE.getCode()).getData();
|
||||||
|
Map<Integer, DictData> eventTypeMap = dicDataList.stream().collect(Collectors.toMap(DictData::getAlgoDescribe, Function.identity()));
|
||||||
|
InputStream inputStreamCfg;
|
||||||
|
InputStream inputStreamDat;
|
||||||
|
try {
|
||||||
|
inputStreamCfg = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath()+ GeneralConstant.CFG);
|
||||||
|
inputStreamDat = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
inputStreamCfg = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath() + GeneralConstant.CFG.toLowerCase());
|
||||||
|
inputStreamDat = fileStorageUtil.getFileStream(rmpEventDetailPO.getWavePath() + GeneralConstant.DAT.toLowerCase());
|
||||||
|
} catch (Exception e1) {
|
||||||
|
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取
|
||||||
|
BufferedReader bufferedReader;
|
||||||
|
InputStreamReader read = null;
|
||||||
|
String strFileLine;
|
||||||
|
byte[] array = {};
|
||||||
|
List<String> temCfgList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
// 判断文件是否存在
|
||||||
|
array = IoUtil.readBytes(inputStreamDat);
|
||||||
|
// 考虑到编码格式
|
||||||
|
read = new InputStreamReader(inputStreamCfg, StandardCharsets.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);
|
||||||
|
entityAdvancedData.smp_a[i] = originalList.get(i).get(1);
|
||||||
|
entityAdvancedData.smp_b[i] = originalList.get(i).get(2);
|
||||||
|
entityAdvancedData.smp_c[i] = originalList.get(i).get(3);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
causeStruct.smp_va[i] = pitchList.get(i).get(1);
|
||||||
|
|
||||||
|
rect.smp_vb[i] = pitchList.get(i).get(2);
|
||||||
|
causeStruct.smp_vb[i] = pitchList.get(i).get(2);
|
||||||
|
|
||||||
|
rect.smp_vc[i] = pitchList.get(i).get(3);
|
||||||
|
causeStruct.smp_vc[i] = pitchList.get(i).get(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.smp_len = pitchList.size();
|
||||||
|
|
||||||
|
//超过60s的波形直接抛异常给上面处理
|
||||||
|
/*
|
||||||
|
* 波形最大值计算
|
||||||
|
*/
|
||||||
|
int MAX_LENGTH = 128 * 3000;
|
||||||
|
if (rect.smp_len >= MAX_LENGTH) {
|
||||||
|
throw new BusinessException("波形超过60S");
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||||
|
causeStruct.smp_len = pitchList.size();
|
||||||
|
causeStruct.smp_rate = (int) wavePitchData.getnOneWaveNum();
|
||||||
|
|
||||||
|
if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||||
|
//如果存在三个文件但是没有调用dll/so计算
|
||||||
|
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||||
|
} else {
|
||||||
|
//已经处理过了,那就根据id获取暂降原因
|
||||||
|
String reason = rmpEventDetailPO.getAdvanceReason();
|
||||||
|
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_REASON.getCode()).getData();
|
||||||
|
Map<String, DictData> eventReasonMap = reasonList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||||
|
if (ObjectUtil.isNotNull(eventReasonMap.get(reason))) {
|
||||||
|
entityAdvancedData.sagReason[0] = eventReasonMap.get(reason).getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String hdrStr = null;
|
||||||
|
try {
|
||||||
|
hdrStr = waveUtils.getFile(rmpEventDetailPO.getWavePath() + GeneralConstant.HDR.toLowerCase());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("读取文件服务器波形数据异常:{}",e.getMessage());
|
||||||
|
}
|
||||||
|
if (hdrStr != null) {
|
||||||
|
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] = eventTypeMap.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:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||||
|
}
|
||||||
|
log.info("高级算法波形计算" + timeInterval.interval());
|
||||||
|
return entityAdvancedData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件未进行高级算法处理:系统调用dll处理并保存结果
|
* 事件未进行高级算法处理:系统调用dll处理并保存结果
|
||||||
@@ -358,7 +527,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceReason())) {
|
if (StrUtil.isBlank(rmpEventDetailPOQuery.getAdvanceReason())) {
|
||||||
|
|
||||||
//暂降原因计算
|
//暂降原因计算
|
||||||
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_dll_cause");
|
JnaCallDllOrSo jnaCallDllReason = new JnaCallBalance("qvvr_cause_dll");
|
||||||
jnaCallDllReason.setPath();
|
jnaCallDllReason.setPath();
|
||||||
|
|
||||||
JnaCallBalance.Balancelibrary CAUSE = JnaCallBalance.Balancelibrary.INSTANTCE;
|
JnaCallBalance.Balancelibrary CAUSE = JnaCallBalance.Balancelibrary.INSTANTCE;
|
||||||
@@ -461,7 +630,7 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
|
|
||||||
entityAdvancedData.backNumber = len;
|
entityAdvancedData.backNumber = len;
|
||||||
//初始化EntityAdvancedData的BackData数据
|
//初始化EntityAdvancedData的BackData数据
|
||||||
len = (len == 0 ? 1 : len);
|
// len = (len == 0 ? 1 : len);
|
||||||
entityAdvancedData.evt_buf = new BackData[len];
|
entityAdvancedData.evt_buf = new BackData[len];
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
entityAdvancedData.evt_buf[i] = new BackData();
|
entityAdvancedData.evt_buf[i] = new BackData();
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.njcn.advance.utils;
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
import cn.hutool.core.io.resource.ClassPathResource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
import java.net.URLDecoder;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
@@ -20,21 +20,20 @@ public class JnaCallDllOrSo {
|
|||||||
|
|
||||||
public JnaCallDllOrSo(String name) {
|
public JnaCallDllOrSo(String name) {
|
||||||
super();
|
super();
|
||||||
String suffix = ".dll";
|
|
||||||
try {
|
try {
|
||||||
String os = System.getProperty("os.name");
|
String os = System.getProperty("os.name");
|
||||||
// windows操作系统为1 否则为0
|
|
||||||
int beginIndex = os != null && os.startsWith("Windows") ? 1 : 0;
|
int beginIndex = os != null && os.startsWith("Windows") ? 1 : 0;
|
||||||
String nameDll;
|
String nameDll;
|
||||||
if (beginIndex == 0) {
|
if (beginIndex == 0) {
|
||||||
//linux操作系统
|
nameDll = "lib" + name + ".so";
|
||||||
nameDll = "lib" + name + "_dll";
|
|
||||||
suffix = ".so";
|
|
||||||
} else {
|
} else {
|
||||||
nameDll = name;
|
nameDll = name;
|
||||||
|
if (!name.endsWith(".dll")) {
|
||||||
|
nameDll = name + ".dll";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String tem = "/usr/local/dllFile/"+ nameDll.concat(suffix);
|
String tem = "/usr/local/dllFile/"+ nameDll;
|
||||||
File dockerFile = new File(tem);
|
File dockerFile = new File(tem);
|
||||||
if(!dockerFile.exists()){
|
if(!dockerFile.exists()){
|
||||||
boolean f = dockerFile.getParentFile().mkdirs();
|
boolean f = dockerFile.getParentFile().mkdirs();
|
||||||
@@ -42,7 +41,11 @@ public class JnaCallDllOrSo {
|
|||||||
System.out.println("文件夹创建:"+f);
|
System.out.println("文件夹创建:"+f);
|
||||||
System.out.println("文件创建:"+d);
|
System.out.println("文件创建:"+d);
|
||||||
|
|
||||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(nameDll.concat(suffix))) {
|
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(nameDll)) {
|
||||||
|
if (inputStream == null) {
|
||||||
|
log.error("找不到资源文件: {}", nameDll);
|
||||||
|
throw new FileNotFoundException("找不到资源文件: " + nameDll);
|
||||||
|
}
|
||||||
try (FileOutputStream outputStream = new FileOutputStream(dockerFile)) {
|
try (FileOutputStream outputStream = new FileOutputStream(dockerFile)) {
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
@@ -53,9 +56,11 @@ public class JnaCallDllOrSo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.path = dockerFile.getAbsolutePath();
|
this.path = dockerFile.getAbsolutePath();
|
||||||
|
System.out.println("动态库路径: " + this.path);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("调用高级算法文件异常,异常信息如下:");
|
log.error("调用高级算法文件异常,异常信息如下:");
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage(), e);
|
||||||
|
throw new RuntimeException("加载动态库失败: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
56
pqs-advance/advance-boot/src/main/resources/bootstrap-jb.yml
Normal file
56
pqs-advance/advance-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10211
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.advance.pojo
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10211
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
ip: @service.server.url@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.advance.pojo
|
||||||
|
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
@@ -1,57 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10211
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#nacos注册中心以及配置中心的指定
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
ip: @service.server.url@
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
config:
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
file-extension: yaml
|
|
||||||
shared-configs:
|
|
||||||
- data-id: share-config.yaml
|
|
||||||
refresh: true
|
|
||||||
- data-Id: share-config-datasource-db.yaml
|
|
||||||
refresh: true
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
max-file-size: 100MB
|
|
||||||
max-request-size: 100MB
|
|
||||||
main:
|
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#项目日志的配置
|
|
||||||
logging:
|
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
|
||||||
level:
|
|
||||||
root: info
|
|
||||||
|
|
||||||
#mybatis配置信息
|
|
||||||
mybatis-plus:
|
|
||||||
#别名扫描
|
|
||||||
type-aliases-package: com.njcn.advance.pojo
|
|
||||||
|
|
||||||
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
52
pqs-auth/src/main/resources/bootstrap-jb.yml
Normal file
52
pqs-auth/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10214
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.user.pojo
|
||||||
|
|
||||||
57
pqs-auth/src/main/resources/bootstrap-sjzx.yml
Normal file
57
pqs-auth/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10214
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
ip: @service.server.url@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.user.pojo
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
@@ -1,53 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10214
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#nacos注册中心以及配置中心的指定
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
ip: @service.server.url@
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
config:
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
file-extension: yaml
|
|
||||||
shared-configs:
|
|
||||||
- data-id: share-config.yaml
|
|
||||||
refresh: true
|
|
||||||
- data-Id: share-config-datasource-db.yaml
|
|
||||||
refresh: true
|
|
||||||
main:
|
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
|
|
||||||
|
|
||||||
#项目日志的配置
|
|
||||||
logging:
|
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
|
||||||
level:
|
|
||||||
root: info
|
|
||||||
|
|
||||||
|
|
||||||
#mybatis配置信息
|
|
||||||
mybatis-plus:
|
|
||||||
#别名扫描
|
|
||||||
type-aliases-package: com.njcn.user.pojo
|
|
||||||
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
71
pqs-bpm/bpm-boot/src/main/resources/bootstrap-jb.yml
Normal file
71
pqs-bpm/bpm-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10321
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: Asia/Shanghai
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
|
||||||
|
flowable:
|
||||||
|
database-schema-update: false
|
||||||
|
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
||||||
|
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||||
|
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||||
|
async-executor-activate: false
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
type-aliases-package: com.njcn.bpm.pojo
|
||||||
|
|
||||||
|
gw:
|
||||||
|
url: dwzyywzt-pms3-proxy.com
|
||||||
|
code: 13B9B47F1E483324E05338297A0A0595
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
76
pqs-bpm/bpm-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
76
pqs-bpm/bpm-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10321
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: Asia/Shanghai
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
ip: @service.server.url@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: bpm-config.yaml
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
|
||||||
|
flowable:
|
||||||
|
database-schema-update: false
|
||||||
|
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
||||||
|
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
||||||
|
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
||||||
|
async-executor-activate: false
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
type-aliases-package: com.njcn.bpm.pojo
|
||||||
|
|
||||||
|
gw:
|
||||||
|
url: dwzyywzt-pms3-proxy.com
|
||||||
|
code: 13B9B47F1E483324E05338297A0A0595
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,72 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10321
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: Asia/Shanghai
|
|
||||||
#nacos注册中心以及配置中心的指定
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
ip: @service.server.url@
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
config:
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
file-extension: yaml
|
|
||||||
shared-configs:
|
|
||||||
- data-id: share-config.yaml
|
|
||||||
refresh: true
|
|
||||||
- data-Id: bpm-config.yaml
|
|
||||||
refresh: true
|
|
||||||
main:
|
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
max-file-size: 100MB
|
|
||||||
max-request-size: 100MB
|
|
||||||
|
|
||||||
flowable:
|
|
||||||
database-schema-update: false
|
|
||||||
db-history-used: true # flowable6 默认 true 生成信息表,无需手动设置
|
|
||||||
check-process-definitions: false # 设置为 false,禁用 /resources/processes 自动部署 BPMN XML 流程
|
|
||||||
history-level: full # full:保存历史数据的最高级别,可保存全部流程相关细节,包括流程流转各节点参数
|
|
||||||
async-executor-activate: false
|
|
||||||
|
|
||||||
#项目日志的配置
|
|
||||||
logging:
|
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
|
||||||
level:
|
|
||||||
root: info
|
|
||||||
|
|
||||||
|
|
||||||
#mybatis配置信息
|
|
||||||
mybatis-plus:
|
|
||||||
type-aliases-package: com.njcn.bpm.pojo
|
|
||||||
|
|
||||||
gw:
|
|
||||||
url: dwzyywzt-pms3-proxy.com
|
|
||||||
code: 13B9B47F1E483324E05338297A0A0595
|
|
||||||
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ public class GenerateCode {
|
|||||||
|
|
||||||
private static final String TARGET_DIR = "D://code";
|
private static final String TARGET_DIR = "D://code";
|
||||||
|
|
||||||
private static final String DB_URL = "jdbc:mysql://192.168.1.24:13306/pqsinfo_ln";
|
private static final String DB_URL = "jdbc:mysql://192.168.1.103:13306/pqsinfo_zl";
|
||||||
// private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase";
|
// private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase";
|
||||||
|
|
||||||
private static final String USERNAME = "root";
|
private static final String USERNAME = "root";
|
||||||
@@ -30,8 +30,8 @@ public class GenerateCode {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
List<Module> modules = Stream.of(
|
List<Module> modules = Stream.of(
|
||||||
new Module("cdf", "com.njcn.device", "", Stream.of(
|
new Module("xy", "com.njcn.csdevice", "", Stream.of(
|
||||||
"pq_icd_path"
|
"cs_alarm_set"
|
||||||
).collect(Collectors.toList()), "")
|
).collect(Collectors.toList()), "")
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
generateJavaFile(modules);
|
generateJavaFile(modules);
|
||||||
|
|||||||
@@ -97,11 +97,11 @@
|
|||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--mqtt相关依赖-->
|
<!-- <!–mqtt相关依赖–>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.github.tocrhz</groupId>
|
<!-- <groupId>com.github.tocrhz</groupId>-->
|
||||||
<artifactId>mqtt-spring-boot-starter</artifactId>
|
<!-- <artifactId>mqtt-spring-boot-starter</artifactId>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -32,6 +33,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static java.lang.Integer.parseInt;
|
import static java.lang.Integer.parseInt;
|
||||||
|
|
||||||
@@ -281,6 +283,30 @@ public class PubUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于获取对象中,前缀一样,后缀为2~50的属性值
|
||||||
|
*
|
||||||
|
* @param methodPrefix 方法前缀
|
||||||
|
* @param number 方法后缀
|
||||||
|
* @return 对象属性值
|
||||||
|
*/
|
||||||
|
public static Double getValueByMethodDouble(List data ,Class clazz, String methodPrefix, Integer number) {
|
||||||
|
try {
|
||||||
|
Method method = clazz.getMethod(methodPrefix + number);
|
||||||
|
OptionalDouble average = data.stream().mapToDouble(temp -> {
|
||||||
|
try {
|
||||||
|
return (Double) method.invoke(temp);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.REFLECT_METHOD_EXCEPTION);
|
||||||
|
}
|
||||||
|
}).average();
|
||||||
|
return average.orElse(0.0);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.REFLECT_METHOD_EXCEPTION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<String> getStartTimeEndTime(String beginDate, String endDate) throws Exception {
|
public static List<String> getStartTimeEndTime(String beginDate, String endDate) throws Exception {
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.njcn.echarts.json;
|
package com.njcn.echarts.json;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.hutool.json.ObjectMapper;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
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;
|
||||||
@@ -29,7 +25,6 @@ import org.icepear.echarts.render.Engine;
|
|||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -43,6 +38,17 @@ import java.util.stream.Collectors;
|
|||||||
public class LineGenerator {
|
public class LineGenerator {
|
||||||
|
|
||||||
private final static Engine ENGINE = new Engine();
|
private final static Engine ENGINE = new Engine();
|
||||||
|
// null段在图表上的固定视觉宽度(数据点数量)
|
||||||
|
private static final int NULL_PLACEHOLDER_COUNT = 90;
|
||||||
|
// 压缩结果
|
||||||
|
private static class CompressedResult {
|
||||||
|
// 压缩后的数据
|
||||||
|
List<List<Float>> data;
|
||||||
|
// 每个null段的[起始索引, 结束索引](占位点范围)
|
||||||
|
List<int[]> nullRegionIndices;
|
||||||
|
// null段边界处的真实x值(entry, exit交替)
|
||||||
|
List<Float> nullBoundaryRealXValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -529,6 +535,478 @@ public class LineGenerator {
|
|||||||
return ENGINE.renderJsonOption(instantOption);
|
return ENGINE.renderJsonOption(instantOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, Double lastTime, List<Float> sharedNullBoundaryXValues, Integer nPush) {
|
||||||
|
DecimalFormat df1 = new DecimalFormat("#.00");
|
||||||
|
// 压缩null数据:如果有共享边界则用共享边界,否则独立压缩
|
||||||
|
CompressedResult aCompressed;
|
||||||
|
CompressedResult bCompressed;
|
||||||
|
CompressedResult cCompressed;
|
||||||
|
if (sharedNullBoundaryXValues != null && !sharedNullBoundaryXValues.isEmpty()) {
|
||||||
|
aCompressed = compressNullDataWithSharedBoundaries(aValue, sharedNullBoundaryXValues);
|
||||||
|
bCompressed = compressNullDataWithSharedBoundaries(bValue, sharedNullBoundaryXValues);
|
||||||
|
cCompressed = compressNullDataWithSharedBoundaries(cValue, sharedNullBoundaryXValues);
|
||||||
|
} else {
|
||||||
|
aCompressed = compressNullData(aValue);
|
||||||
|
bCompressed = compressNullData(bValue);
|
||||||
|
cCompressed = compressNullData(cValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
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("70px").setRight("40px").setBottom("10%"));
|
||||||
|
//横坐标(使用压缩后的数据)
|
||||||
|
instantOption.setXAxis(new ValueAxis().setName("ms")
|
||||||
|
.setSplitLine(new SplitLine().setShow(false))
|
||||||
|
.setAxisLine(new AxisLine().setOnZero(false))
|
||||||
|
.setType("category")
|
||||||
|
.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")
|
||||||
|
.setConnectNulls(false)
|
||||||
|
.setData(aCompressed.data);
|
||||||
|
LineSeries bSeries = new LineSeries()
|
||||||
|
.setName(b)
|
||||||
|
.setSmooth(true)
|
||||||
|
.setSymbol("none")
|
||||||
|
.setConnectNulls(false)
|
||||||
|
.setData(bCompressed.data);
|
||||||
|
LineSeries cSeries = new LineSeries()
|
||||||
|
.setName(c)
|
||||||
|
.setSmooth(true)
|
||||||
|
.setSymbol("none")
|
||||||
|
.setConnectNulls(false)
|
||||||
|
.setData(cCompressed.data);
|
||||||
|
instantOption.setSeries(new LineSeries[]{aSeries, bSeries, cSeries});
|
||||||
|
|
||||||
|
// 渲染基础JSON
|
||||||
|
String jsonStr = ENGINE.renderJsonOption(instantOption);
|
||||||
|
cn.hutool.json.JSONObject optionJson = JSONUtil.parseObj(jsonStr);
|
||||||
|
cn.hutool.json.JSONArray seriesArray = optionJson.getJSONArray("series");
|
||||||
|
|
||||||
|
// 隐藏x轴默认标签,设置boundaryGap=false,只通过markLine显示关键节点
|
||||||
|
Object xAxisRaw = optionJson.get("xAxis");
|
||||||
|
cn.hutool.json.JSONObject xAxisJson;
|
||||||
|
if (xAxisRaw instanceof cn.hutool.json.JSONArray) {
|
||||||
|
xAxisJson = ((cn.hutool.json.JSONArray) xAxisRaw).getJSONObject(0);
|
||||||
|
} else {
|
||||||
|
xAxisJson = (cn.hutool.json.JSONObject) xAxisRaw;
|
||||||
|
}
|
||||||
|
cn.hutool.json.JSONObject axisLabelJson = new cn.hutool.json.JSONObject();
|
||||||
|
axisLabelJson.set("show", false);
|
||||||
|
xAxisJson.set("axisLabel", axisLabelJson);
|
||||||
|
xAxisJson.set("boundaryGap", false);
|
||||||
|
|
||||||
|
// 添加null markLine/markArea(基于压缩后的数据)
|
||||||
|
addNullMarkLinesForCategoryAxis(seriesArray.getJSONObject(0), aCompressed, lastTime);
|
||||||
|
addNullMarkLinesForCategoryAxis(seriesArray.getJSONObject(1), bCompressed, lastTime);
|
||||||
|
addNullMarkLinesForCategoryAxis(seriesArray.getJSONObject(2), cCompressed, lastTime);
|
||||||
|
// 在第一个series追加自定义横坐标标签markLine
|
||||||
|
addAxisLabelMarkLines(seriesArray.getJSONObject(0), aCompressed, lastTime, nPush);
|
||||||
|
return optionJson.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提取null边界的真实x值,供其他数据集共享使用 */
|
||||||
|
public static List<Float> extractNullBoundaryXValues(List<List<Float>> data) {
|
||||||
|
List<Integer> boundaries = findNullSegmentBoundaryIndices(data);
|
||||||
|
List<Float> xValues = new ArrayList<>();
|
||||||
|
for (int idx : boundaries) {
|
||||||
|
xValues.add(data.get(idx).get(0));
|
||||||
|
}
|
||||||
|
return xValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 使用共享的null边界x值来压缩数据,确保不同数据集压缩结果结构一致 */
|
||||||
|
private static CompressedResult compressNullDataWithSharedBoundaries(List<List<Float>> originalData, List<Float> sharedBoundaryXValues) {
|
||||||
|
if (sharedBoundaryXValues == null || sharedBoundaryXValues.isEmpty()) {
|
||||||
|
return compressNullData(originalData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用共享的x值找到本数据集中对应的索引
|
||||||
|
List<Integer> boundaries = new ArrayList<>();
|
||||||
|
for (Float x : sharedBoundaryXValues) {
|
||||||
|
boundaries.add(findClosestValidIndex(originalData, x));
|
||||||
|
}
|
||||||
|
|
||||||
|
CompressedResult result = new CompressedResult();
|
||||||
|
result.data = new ArrayList<>();
|
||||||
|
result.nullRegionIndices = new ArrayList<>();
|
||||||
|
result.nullBoundaryRealXValues = new ArrayList<>(sharedBoundaryXValues);
|
||||||
|
|
||||||
|
int srcIdx = 0;
|
||||||
|
for (int b = 0; b < boundaries.size(); b += 2) {
|
||||||
|
int entryBoundary = boundaries.get(b);
|
||||||
|
int exitBoundary = boundaries.get(b + 1);
|
||||||
|
|
||||||
|
while (srcIdx <= entryBoundary) {
|
||||||
|
result.data.add(originalData.get(srcIdx));
|
||||||
|
srcIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nullStartIdx = result.data.size();
|
||||||
|
float entryX = sharedBoundaryXValues.get(b);
|
||||||
|
float exitX = sharedBoundaryXValues.get(b + 1);
|
||||||
|
|
||||||
|
for (int p = 0; p < NULL_PLACEHOLDER_COUNT; p++) {
|
||||||
|
List<Float> point = new ArrayList<>();
|
||||||
|
point.add(entryX + (exitX - entryX) * p / NULL_PLACEHOLDER_COUNT);
|
||||||
|
point.add(null);
|
||||||
|
result.data.add(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nullEndIdx = result.data.size() - 1;
|
||||||
|
result.nullRegionIndices.add(new int[]{nullStartIdx, nullEndIdx});
|
||||||
|
|
||||||
|
srcIdx = exitBoundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (srcIdx < originalData.size()) {
|
||||||
|
result.data.add(originalData.get(srcIdx));
|
||||||
|
srcIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压缩null数据:删除所有null数据点,替换为固定NULL_PLACEHOLDER_COUNT个占位点
|
||||||
|
* 这样null段在图表上永远只占固定视觉宽度,前后有效数据正常展开
|
||||||
|
*/
|
||||||
|
private static CompressedResult compressNullData(List<List<Float>> originalData) {
|
||||||
|
List<Integer> boundaries = findNullSegmentBoundaryIndices(originalData);
|
||||||
|
|
||||||
|
CompressedResult result = new CompressedResult();
|
||||||
|
result.data = new ArrayList<>();
|
||||||
|
result.nullRegionIndices = new ArrayList<>();
|
||||||
|
result.nullBoundaryRealXValues = new ArrayList<>();
|
||||||
|
|
||||||
|
if (boundaries.isEmpty()) {
|
||||||
|
result.data.addAll(originalData);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int srcIdx = 0;
|
||||||
|
for (int b = 0; b < boundaries.size(); b += 2) {
|
||||||
|
// 最后一个有效点的索引(null段入口边界)
|
||||||
|
int entryBoundary = boundaries.get(b);
|
||||||
|
// 第一个恢复有效点的索引(null段出口边界)
|
||||||
|
int exitBoundary = boundaries.get(b + 1);
|
||||||
|
|
||||||
|
// 复制有效数据:从srcIdx到entryBoundary
|
||||||
|
while (srcIdx <= entryBoundary) {
|
||||||
|
result.data.add(originalData.get(srcIdx));
|
||||||
|
srcIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录边界真实x值
|
||||||
|
result.nullBoundaryRealXValues.add(originalData.get(entryBoundary).get(0));
|
||||||
|
result.nullBoundaryRealXValues.add(originalData.get(exitBoundary).get(0));
|
||||||
|
|
||||||
|
// 插入固定数量的null占位点
|
||||||
|
int nullStartIdx = result.data.size();
|
||||||
|
float entryX = originalData.get(entryBoundary).get(0);
|
||||||
|
float exitX = originalData.get(exitBoundary).get(0);
|
||||||
|
|
||||||
|
for (int p = 0; p < NULL_PLACEHOLDER_COUNT; p++) {
|
||||||
|
List<Float> point = new ArrayList<>();
|
||||||
|
point.add(entryX + (exitX - entryX) * p / NULL_PLACEHOLDER_COUNT);
|
||||||
|
point.add(null);
|
||||||
|
result.data.add(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nullEndIdx = result.data.size() - 1;
|
||||||
|
result.nullRegionIndices.add(new int[]{nullStartIdx, nullEndIdx});
|
||||||
|
|
||||||
|
// 跳过原始null数据点,srcIdx跳到exitBoundary
|
||||||
|
srcIdx = exitBoundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复制最后一个null段之后的剩余有效数据
|
||||||
|
while (srcIdx < originalData.size()) {
|
||||||
|
result.data.add(originalData.get(srcIdx));
|
||||||
|
srcIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在压缩数据中查找最接近目标x值的有效数据点索引(跳过null点)
|
||||||
|
*/
|
||||||
|
private static int findClosestValidIndex(List<List<Float>> data, float targetX) {
|
||||||
|
int closestIdx = -1;
|
||||||
|
float minDiff = Float.MAX_VALUE;
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
Float y = data.get(i).get(1);
|
||||||
|
if (y == null) continue;
|
||||||
|
float diff = Math.abs(data.get(i).get(0) - targetX);
|
||||||
|
if (diff < minDiff) {
|
||||||
|
minDiff = diff;
|
||||||
|
closestIdx = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return closestIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addAxisLabelMarkLines(cn.hutool.json.JSONObject seriesObj, CompressedResult compressed, Double lastTime, Integer nPush) {
|
||||||
|
boolean hasNull = !compressed.nullRegionIndices.isEmpty();
|
||||||
|
|
||||||
|
// 收集需要标注的横坐标位置:[数据索引, 显示的时间值]
|
||||||
|
List<int[]> labelPositions = new ArrayList<>();
|
||||||
|
// 开头ms(始终显示)
|
||||||
|
labelPositions.add(new int[]{findClosestValidIndex(compressed.data, -nPush), -nPush});
|
||||||
|
// 0ms(始终显示)
|
||||||
|
labelPositions.add(new int[]{findClosestValidIndex(compressed.data, 0f), 0});
|
||||||
|
// npush ms(仅在有null时显示)
|
||||||
|
if (hasNull) {
|
||||||
|
labelPositions.add(new int[]{findClosestValidIndex(compressed.data, nPush), nPush});
|
||||||
|
}
|
||||||
|
// null段边界真实时间值(仅在有null时显示)
|
||||||
|
if (hasNull) {
|
||||||
|
for (Float realX : compressed.nullBoundaryRealXValues) {
|
||||||
|
int idx = findClosestValidIndex(compressed.data, realX);
|
||||||
|
if (idx >= 0) {
|
||||||
|
labelPositions.add(new int[]{idx, (int) Math.round(realX)});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// lastTime(始终显示)
|
||||||
|
if (lastTime != null) {
|
||||||
|
labelPositions.add(new int[]{findClosestValidIndex(compressed.data, lastTime.floatValue()), lastTime.intValue()});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 最后一组数据(始终显示,数据结束位置横坐标)
|
||||||
|
if (lastTime != null) {
|
||||||
|
float lastTime20 = lastTime.floatValue() + nPush;
|
||||||
|
int lastTime20Idx = findClosestValidIndex(compressed.data, lastTime20);
|
||||||
|
if (lastTime20Idx >= 0) {
|
||||||
|
labelPositions.add(new int[]{(lastTime20Idx-2), (int) Math.round(lastTime20)});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取或创建markLine
|
||||||
|
cn.hutool.json.JSONObject existingMarkLine = seriesObj.getJSONObject("markLine");
|
||||||
|
cn.hutool.json.JSONArray markLineData;
|
||||||
|
|
||||||
|
if (existingMarkLine == null) {
|
||||||
|
// 无null的情况:自己创建markLine,包含虚线和横坐标标签
|
||||||
|
markLineData = new cn.hutool.json.JSONArray();
|
||||||
|
|
||||||
|
// x=0 虚线
|
||||||
|
int zeroIdx = findClosestValidIndex(compressed.data, 0f);
|
||||||
|
if (zeroIdx >= 0) {
|
||||||
|
cn.hutool.json.JSONObject zeroLine = new cn.hutool.json.JSONObject();
|
||||||
|
zeroLine.set("xAxis", zeroIdx);
|
||||||
|
cn.hutool.json.JSONObject zeroLabel = new cn.hutool.json.JSONObject();
|
||||||
|
zeroLabel.set("show", false);
|
||||||
|
zeroLine.set("label", zeroLabel);
|
||||||
|
markLineData.add(zeroLine);
|
||||||
|
}
|
||||||
|
// lastTime 虚线
|
||||||
|
if (lastTime != null) {
|
||||||
|
int lastTimeIdx = findClosestValidIndex(compressed.data, lastTime.floatValue());
|
||||||
|
if (lastTimeIdx >= 0) {
|
||||||
|
cn.hutool.json.JSONObject lastTimeLine = new cn.hutool.json.JSONObject();
|
||||||
|
lastTimeLine.set("xAxis", lastTimeIdx);
|
||||||
|
cn.hutool.json.JSONObject lastTimeLabelObj = new cn.hutool.json.JSONObject();
|
||||||
|
lastTimeLabelObj.set("show", false);
|
||||||
|
lastTimeLine.set("label", lastTimeLabelObj);
|
||||||
|
markLineData.add(lastTimeLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先收集所有标签到markLineData
|
||||||
|
for (int[] pos : labelPositions) {
|
||||||
|
cn.hutool.json.JSONObject line = new cn.hutool.json.JSONObject();
|
||||||
|
line.set("xAxis", pos[0]);
|
||||||
|
cn.hutool.json.JSONObject lineLineStyle = new cn.hutool.json.JSONObject();
|
||||||
|
lineLineStyle.set("width", 0);
|
||||||
|
line.set("lineStyle", lineLineStyle);
|
||||||
|
cn.hutool.json.JSONObject lineLabel = new cn.hutool.json.JSONObject();
|
||||||
|
lineLabel.set("show", true);
|
||||||
|
lineLabel.set("formatter", String.valueOf(pos[1]));
|
||||||
|
lineLabel.set("position", "start");
|
||||||
|
lineLabel.set("color", "#333");
|
||||||
|
lineLabel.set("fontSize", 10);
|
||||||
|
line.set("label", lineLabel);
|
||||||
|
markLineData.add(line);
|
||||||
|
}
|
||||||
|
// 最后一次性设置到markLine和series
|
||||||
|
existingMarkLine = new cn.hutool.json.JSONObject();
|
||||||
|
existingMarkLine.set("symbol", new String[]{"none", "none"});
|
||||||
|
cn.hutool.json.JSONObject lineStyle = new cn.hutool.json.JSONObject();
|
||||||
|
lineStyle.set("type", "dashed");
|
||||||
|
lineStyle.set("color", "#999");
|
||||||
|
lineStyle.set("width", 1);
|
||||||
|
existingMarkLine.set("lineStyle", lineStyle);
|
||||||
|
cn.hutool.json.JSONObject globalLabel = new cn.hutool.json.JSONObject();
|
||||||
|
globalLabel.set("show", false);
|
||||||
|
existingMarkLine.set("label", globalLabel);
|
||||||
|
existingMarkLine.set("data", markLineData);
|
||||||
|
seriesObj.set("markLine", existingMarkLine);
|
||||||
|
} else {
|
||||||
|
// 有null的情况:追加标签到已有的markLine
|
||||||
|
markLineData = existingMarkLine.getJSONArray("data");
|
||||||
|
for (int[] pos : labelPositions) {
|
||||||
|
cn.hutool.json.JSONObject line = new cn.hutool.json.JSONObject();
|
||||||
|
line.set("xAxis", pos[0]);
|
||||||
|
cn.hutool.json.JSONObject lineLineStyle = new cn.hutool.json.JSONObject();
|
||||||
|
lineLineStyle.set("width", 0);
|
||||||
|
line.set("lineStyle", lineLineStyle);
|
||||||
|
cn.hutool.json.JSONObject lineLabel = new cn.hutool.json.JSONObject();
|
||||||
|
lineLabel.set("show", true);
|
||||||
|
lineLabel.set("formatter", String.valueOf(pos[1]));
|
||||||
|
lineLabel.set("position", "start");
|
||||||
|
lineLabel.set("color", "#333");
|
||||||
|
lineLabel.set("fontSize", 10);
|
||||||
|
line.set("label", lineLabel);
|
||||||
|
markLineData.add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Integer> findNullSegmentBoundaryIndices(List<List<Float>> data) {
|
||||||
|
List<Integer> indices = new ArrayList<>();
|
||||||
|
boolean inNullSegment = false;
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
Float y = data.get(i).get(1);
|
||||||
|
if (y == null) {
|
||||||
|
if (!inNullSegment) {
|
||||||
|
indices.add(i > 0 ? i - 1 : i);
|
||||||
|
inNullSegment = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (inNullSegment) {
|
||||||
|
indices.add(i);
|
||||||
|
inNullSegment = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inNullSegment) {
|
||||||
|
indices.add(data.size() - 1);
|
||||||
|
}
|
||||||
|
return indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addNullMarkLinesForCategoryAxis(cn.hutool.json.JSONObject seriesObj, CompressedResult compressed, Double lastTime) {
|
||||||
|
if (compressed.nullRegionIndices.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cn.hutool.json.JSONArray markLineData = new cn.hutool.json.JSONArray();
|
||||||
|
// x=0 虚线
|
||||||
|
int zeroIdx = findClosestValidIndex(compressed.data, 0f);
|
||||||
|
if (zeroIdx >= 0) {
|
||||||
|
cn.hutool.json.JSONObject zeroLine = new cn.hutool.json.JSONObject();
|
||||||
|
zeroLine.set("xAxis", zeroIdx);
|
||||||
|
cn.hutool.json.JSONObject zeroLabel = new cn.hutool.json.JSONObject();
|
||||||
|
zeroLabel.set("show", false);
|
||||||
|
zeroLine.set("label", zeroLabel);
|
||||||
|
markLineData.add(zeroLine);
|
||||||
|
}
|
||||||
|
// null段边界的垂直虚线
|
||||||
|
for (int r = 0; r < compressed.nullRegionIndices.size(); r++) {
|
||||||
|
int[] region = compressed.nullRegionIndices.get(r);
|
||||||
|
int nullStartIdx = region[0]; // 第一个占位点索引
|
||||||
|
int nullEndIdx = region[1]; // 最后一个占位点索引
|
||||||
|
|
||||||
|
// 入口虚线:nullStartIdx - 1(null前最后一个有效数据点)
|
||||||
|
cn.hutool.json.JSONObject entryLine = new cn.hutool.json.JSONObject();
|
||||||
|
entryLine.set("xAxis", nullStartIdx - 1);
|
||||||
|
cn.hutool.json.JSONObject entryLabel = new cn.hutool.json.JSONObject();
|
||||||
|
entryLabel.set("show", false);
|
||||||
|
entryLine.set("label", entryLabel);
|
||||||
|
markLineData.add(entryLine);
|
||||||
|
|
||||||
|
// 出口虚线:nullEndIdx(null后第一个有效数据点)
|
||||||
|
cn.hutool.json.JSONObject exitLine = new cn.hutool.json.JSONObject();
|
||||||
|
exitLine.set("xAxis", nullEndIdx);
|
||||||
|
cn.hutool.json.JSONObject exitLabel = new cn.hutool.json.JSONObject();
|
||||||
|
exitLabel.set("show", false);
|
||||||
|
exitLine.set("label", exitLabel);
|
||||||
|
markLineData.add(exitLine);
|
||||||
|
}
|
||||||
|
// 时间持续时间结束的数据点
|
||||||
|
if (lastTime != null) {
|
||||||
|
int lastTimeIdx = findClosestValidIndex(compressed.data, lastTime.floatValue());
|
||||||
|
if (lastTimeIdx >= 0) {
|
||||||
|
cn.hutool.json.JSONObject lastTimeLine = new cn.hutool.json.JSONObject();
|
||||||
|
lastTimeLine.set("xAxis", lastTimeIdx);
|
||||||
|
cn.hutool.json.JSONObject lastTimeLabel = new cn.hutool.json.JSONObject();
|
||||||
|
lastTimeLabel.set("show", false);
|
||||||
|
lastTimeLine.set("label", lastTimeLabel);
|
||||||
|
markLineData.add(lastTimeLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cn.hutool.json.JSONObject markLine = new cn.hutool.json.JSONObject();
|
||||||
|
markLine.set("symbol", new String[]{"none", "none"});
|
||||||
|
cn.hutool.json.JSONObject lineStyle = new cn.hutool.json.JSONObject();
|
||||||
|
lineStyle.set("type", "dashed");
|
||||||
|
lineStyle.set("color", "#999");
|
||||||
|
lineStyle.set("width", 1);
|
||||||
|
markLine.set("lineStyle", lineStyle);
|
||||||
|
cn.hutool.json.JSONObject globalLabel = new cn.hutool.json.JSONObject();
|
||||||
|
globalLabel.set("show", false);
|
||||||
|
markLine.set("label", globalLabel);
|
||||||
|
markLine.set("data", markLineData);
|
||||||
|
seriesObj.set("markLine", markLine);
|
||||||
|
|
||||||
|
// markArea - 灰色背景覆盖null区域(从入口边界到出口边界)
|
||||||
|
cn.hutool.json.JSONArray markAreaData = new cn.hutool.json.JSONArray();
|
||||||
|
for (int r = 0; r < compressed.nullRegionIndices.size(); r++) {
|
||||||
|
int[] region = compressed.nullRegionIndices.get(r);
|
||||||
|
int nullStartIdx = region[0];
|
||||||
|
int nullEndIdx = region[1];
|
||||||
|
|
||||||
|
cn.hutool.json.JSONArray areaPair = new cn.hutool.json.JSONArray();
|
||||||
|
cn.hutool.json.JSONObject start = new cn.hutool.json.JSONObject();
|
||||||
|
start.set("xAxis", nullStartIdx - 1); // 从入口边界有效数据点
|
||||||
|
cn.hutool.json.JSONObject end = new cn.hutool.json.JSONObject();
|
||||||
|
end.set("xAxis", nullEndIdx); // 到出口边界有效数据点
|
||||||
|
areaPair.add(start);
|
||||||
|
areaPair.add(end);
|
||||||
|
markAreaData.add(areaPair);
|
||||||
|
}
|
||||||
|
cn.hutool.json.JSONObject markArea = new cn.hutool.json.JSONObject();
|
||||||
|
cn.hutool.json.JSONObject itemStyle = new cn.hutool.json.JSONObject();
|
||||||
|
itemStyle.set("color", "rgba(180, 180, 180, 0.2)");
|
||||||
|
itemStyle.set("borderWidth", 0);
|
||||||
|
markArea.set("itemStyle", itemStyle);
|
||||||
|
markArea.set("data", markAreaData);
|
||||||
|
seriesObj.set("markArea", markArea);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param title 标题
|
* @param title 标题
|
||||||
* @param values 数据值
|
* @param values 数据值
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -55,10 +56,9 @@ public class DrawPicUtil {
|
|||||||
return Objects.requireNonNull(picResult.getBody()).indexOf("image/png") > 0 ? picResult.getBody() : "";
|
return Objects.requireNonNull(picResult.getBody()).indexOf("image/png") > 0 ? picResult.getBody() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 绘制波形图
|
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
|
* 绘制波形图
|
||||||
* @date 2023/6/21 11:01
|
* @date 2023/6/21 11:01
|
||||||
* @return String base64数据
|
* @return String base64数据
|
||||||
*/
|
*/
|
||||||
@@ -77,6 +77,11 @@ public class DrawPicUtil {
|
|||||||
return drawPic(instantJson, width, height);
|
return drawPic(instantJson, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, Double lastTime, List<Float> sharedNullBoundaryXValues,Integer nPush) {
|
||||||
|
String instantJson = LineGenerator.generateWaveOption(title, aValue, bValue, cValue, unit, max, min, a, b, c, colors, isOpen, lastTime, sharedNullBoundaryXValues,nPush);
|
||||||
|
return drawPic(instantJson, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 绘制itic曲线图
|
* 绘制itic曲线图
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ package com.njcn.event.file.component;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.text.StrPool;
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.wave.BitConverter;
|
import com.njcn.common.utils.wave.BitConverter;
|
||||||
import com.njcn.event.file.pojo.dto.*;
|
import com.njcn.event.file.pojo.dto.*;
|
||||||
@@ -16,11 +14,13 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -81,6 +81,46 @@ public class WaveFileComponent {
|
|||||||
return waveDataDTO;
|
return waveDataDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WaveDataDTO getComtradeNoAddPoints(InputStream cfgStream, InputStream datStream, int iType) {
|
||||||
|
WaveDataDTO waveDataDTO = new WaveDataDTO();
|
||||||
|
// 首先判断文件路径是否为空
|
||||||
|
// 读取cfg文件
|
||||||
|
ComtradeCfgDTO comtradeCfgDTO = getComtradeCfgNoAddPoints(cfgStream);
|
||||||
|
// 为空或者未找到结束符号
|
||||||
|
if (comtradeCfgDTO == null || !"BINARY".equalsIgnoreCase(comtradeCfgDTO.getStrBinType())) {
|
||||||
|
throw new BusinessException(WaveFileResponseEnum.CFG_DATA_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****根据通道号计算相别** add by yexb -----Start****
|
||||||
|
* 1、判断是否是3的倍数,是3的倍数则是3相
|
||||||
|
* 2、假如不是3的倍数 ,是1的倍数则是单相
|
||||||
|
********************************************************/
|
||||||
|
if (comtradeCfgDTO.getNAnalogNum() % 3 == 0) {
|
||||||
|
comtradeCfgDTO.setNPhasic(3);
|
||||||
|
} else {
|
||||||
|
comtradeCfgDTO.setNPhasic(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 给相别数量赋值
|
||||||
|
waveDataDTO.setIPhasic(comtradeCfgDTO.getNPhasic());
|
||||||
|
|
||||||
|
// 组装解析抬头
|
||||||
|
getWaveTitle(waveDataDTO, comtradeCfgDTO);
|
||||||
|
|
||||||
|
// 解析.dat文件
|
||||||
|
List<List<Float>> listWaveData = getComtradeDatNoAddPoints(comtradeCfgDTO, datStream, iType);
|
||||||
|
|
||||||
|
waveDataDTO.setComtradeCfgDTO(comtradeCfgDTO);
|
||||||
|
|
||||||
|
waveDataDTO.setListWaveData(listWaveData);
|
||||||
|
|
||||||
|
//add by hongawen,将暂态触发起始时间记录下来
|
||||||
|
waveDataDTO.setTime(DateUtil.format(comtradeCfgDTO.getTimeTrige(), DatePattern.NORM_DATETIME_MS_PATTERN));
|
||||||
|
/*****根据通道号计算相别** add by yexb -----end****/
|
||||||
|
|
||||||
|
return waveDataDTO;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
* 根据波形数据算出rms值数据
|
* 根据波形数据算出rms值数据
|
||||||
* param waveDataDTO 瞬时波形(包含了CFG配置文件)
|
* param waveDataDTO 瞬时波形(包含了CFG配置文件)
|
||||||
@@ -472,6 +512,127 @@ public class WaveFileComponent {
|
|||||||
return comtradeCfgDTO;
|
return comtradeCfgDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ComtradeCfgDTO getComtradeCfgNoAddPoints(InputStream cfgStream) {
|
||||||
|
ComtradeCfgDTO comtradeCfgDTO = new ComtradeCfgDTO();
|
||||||
|
try (InputStreamReader read = new InputStreamReader(cfgStream, CharsetUtil.CHARSET_GBK); BufferedReader bufferedReader = new BufferedReader(read);) {
|
||||||
|
// 第一行不关心仅仅是一些描述类的信息
|
||||||
|
String strFileLine = bufferedReader.readLine();
|
||||||
|
|
||||||
|
// 第二行需要关心第二个(模拟量的个数)和第三个参数(开关量的个数)
|
||||||
|
strFileLine = bufferedReader.readLine();
|
||||||
|
// 按“,”进行分割
|
||||||
|
String[] strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||||
|
// 总个数
|
||||||
|
comtradeCfgDTO.setNChannelNum(Integer.parseInt(strTempArray[0]));
|
||||||
|
// 模拟量的个数
|
||||||
|
comtradeCfgDTO.setNAnalogNum(Integer.parseInt(strTempArray[1].substring(0, strTempArray[1].length() - 1)));
|
||||||
|
// 开关量的个数
|
||||||
|
comtradeCfgDTO.setNDigitalNum(Integer.parseInt(strTempArray[2].substring(0, strTempArray[2].length() - 1)));
|
||||||
|
|
||||||
|
// 从第三行开始的ComtradeCfg.nChannelNum行是模拟量通道和数字量通道
|
||||||
|
List<AnalogDTO> lstAnalogDTO = new ArrayList<>();
|
||||||
|
comtradeCfgDTO.setLstAnalogDTO(lstAnalogDTO);
|
||||||
|
for (int i = 0; i < comtradeCfgDTO.getNChannelNum(); i++) {
|
||||||
|
AnalogDTO analogDTO = new AnalogDTO();
|
||||||
|
lstAnalogDTO.add(analogDTO);
|
||||||
|
strFileLine = bufferedReader.readLine();
|
||||||
|
strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||||
|
//通道序号
|
||||||
|
analogDTO.setNIndex(Integer.parseInt(strTempArray[0]));
|
||||||
|
// 通道名称
|
||||||
|
analogDTO.setSzChannleName(strTempArray[1]);
|
||||||
|
// 相位名称
|
||||||
|
analogDTO.setSzPhasicName(strTempArray[2]);
|
||||||
|
// 监视的通道名称
|
||||||
|
analogDTO.setSzMonitoredChannleName(strTempArray[3]);
|
||||||
|
// 通道的单位
|
||||||
|
analogDTO.setSzUnitName(strTempArray[4]);
|
||||||
|
// 通道的系数
|
||||||
|
analogDTO.setFCoefficent(Float.parseFloat(strTempArray[5]));
|
||||||
|
// 通道的偏移量
|
||||||
|
analogDTO.setFOffset(Float.parseFloat(strTempArray[6]));
|
||||||
|
// 起始采样时间的偏移量
|
||||||
|
analogDTO.setFTimeOffset(Float.parseFloat(strTempArray[7]));
|
||||||
|
// 采样值的最小值
|
||||||
|
analogDTO.setNMin(Integer.parseInt(strTempArray[8]));
|
||||||
|
// 采样值的最大值
|
||||||
|
analogDTO.setNMax(Integer.parseInt(strTempArray[9]));
|
||||||
|
// 一次变比
|
||||||
|
analogDTO.setFPrimary(Float.parseFloat(strTempArray[10]));
|
||||||
|
// 二次变比
|
||||||
|
analogDTO.setFSecondary(Float.parseFloat(strTempArray[11]));
|
||||||
|
// 一次值还是二次值标志
|
||||||
|
analogDTO.setSzValueType(strTempArray[12]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//WW 2019-11-14 // 采样频率
|
||||||
|
String freqLine = bufferedReader.readLine();
|
||||||
|
int nFreq;
|
||||||
|
try {
|
||||||
|
// 先尝试解析为double再四舍五入为整数,以兼容"50.00"这样的格式
|
||||||
|
nFreq = (int) Math.round(Double.parseDouble(freqLine));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 如果失败则使用原来的整数解析方式
|
||||||
|
nFreq = Integer.parseInt(freqLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取采样段数
|
||||||
|
strFileLine = bufferedReader.readLine();
|
||||||
|
int nRates = Integer.parseInt(strFileLine);
|
||||||
|
comtradeCfgDTO.setNRates(nRates);
|
||||||
|
// 获得每段的采样率 //采样率
|
||||||
|
List<RateDTO> lstRate = new ArrayList<>();
|
||||||
|
int nOffset = 0;
|
||||||
|
for (int i = 0; i < nRates; i++) {
|
||||||
|
strFileLine = bufferedReader.readLine();
|
||||||
|
strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||||
|
RateDTO rateDTO = new RateDTO();
|
||||||
|
// 单周波采样点数 //WW 2019-11-14
|
||||||
|
double doubleValue = Double.parseDouble(strTempArray[0]); // 解析为 double
|
||||||
|
int result = (int) (doubleValue / nFreq); // 强制转换为 int
|
||||||
|
rateDTO.setNOneSample(result);
|
||||||
|
// 总点数 //这里的strTemp是一个偏移量
|
||||||
|
rateDTO.setNSampleNum((Integer.parseInt(strTempArray[1]) - nOffset));
|
||||||
|
nOffset = rateDTO.getNSampleNum();
|
||||||
|
lstRate.add(rateDTO);
|
||||||
|
}
|
||||||
|
comtradeCfgDTO.setLstRate(lstRate);
|
||||||
|
// 增加读取波形起始时间个结束时间
|
||||||
|
String timeFormat = "dd/MM/yyyy,HH:mm:ss.SSS";
|
||||||
|
// 波形起始时间
|
||||||
|
strFileLine = bufferedReader.readLine();
|
||||||
|
strFileLine = strFileLine.substring(0, strFileLine.length() - 3);
|
||||||
|
comtradeCfgDTO.setTimeStart(DateUtil.parse(strFileLine, timeFormat));
|
||||||
|
|
||||||
|
// 暂态触发时间
|
||||||
|
strFileLine = bufferedReader.readLine();
|
||||||
|
strFileLine = strFileLine.substring(0, strFileLine.length() - 3);
|
||||||
|
comtradeCfgDTO.setTimeTrige(DateUtil.parse(strFileLine, timeFormat));
|
||||||
|
|
||||||
|
// 获取触发时间的时间 + 毫秒
|
||||||
|
Calendar calendar = DateUtil.calendar(comtradeCfgDTO.getTimeTrige());
|
||||||
|
comtradeCfgDTO.setFirstMs(calendar.get(Calendar.MILLISECOND));
|
||||||
|
comtradeCfgDTO.setFirstTime(calendar.getTime());
|
||||||
|
|
||||||
|
|
||||||
|
long a = comtradeCfgDTO.getTimeStart().getTime();
|
||||||
|
long b = comtradeCfgDTO.getTimeTrige().getTime();
|
||||||
|
|
||||||
|
int c = (int) (b - a);
|
||||||
|
if (c >= 90 && c <= 110) {
|
||||||
|
comtradeCfgDTO.setNPush(100);
|
||||||
|
} else if (c >= 190 && c <= 210) {
|
||||||
|
comtradeCfgDTO.setNPush(200);
|
||||||
|
}
|
||||||
|
// 赋值编码格式(二进制)
|
||||||
|
comtradeCfgDTO.setStrBinType(bufferedReader.readLine().toUpperCase());
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 解析.cfg文件出错
|
||||||
|
comtradeCfgDTO = null;
|
||||||
|
}
|
||||||
|
return comtradeCfgDTO;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
* 读取dat方法
|
* 读取dat方法
|
||||||
* param strFilePath .dat访问路径
|
* param strFilePath .dat访问路径
|
||||||
@@ -511,13 +672,14 @@ public class WaveFileComponent {
|
|||||||
//抽点后新的的采样率
|
//抽点后新的的采样率
|
||||||
List<RateDTO> newLstRate = new ArrayList<>();
|
List<RateDTO> newLstRate = new ArrayList<>();
|
||||||
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
||||||
// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
|
||||||
// 计算本段录波总共有多少波形
|
// 计算本段录波总共有多少波形
|
||||||
nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
||||||
//设置总波形大小
|
//设置总波形大小
|
||||||
comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
||||||
// 将最低采样率替换到本段录波内
|
// 将最低采样率替换到本段录波内
|
||||||
RateDTO tmpRateDTO = new RateDTO();
|
RateDTO tmpRateDTO = new RateDTO();
|
||||||
|
// C# 原实现中 bool 默认是 false,16~31 点/周波段也应按普通抽点处理
|
||||||
|
tmpRateDTO.bRMSFlag = false;
|
||||||
// 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
// 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
||||||
if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||||
//YXB 2025-08-27
|
//YXB 2025-08-27
|
||||||
@@ -547,12 +709,299 @@ public class WaveFileComponent {
|
|||||||
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nnInd++;
|
||||||
|
}
|
||||||
|
// 偏移量,采样间隔
|
||||||
|
long nOffSet = 0, nWaveSpan;
|
||||||
|
//两个点之间的时间差
|
||||||
|
float fValue, dfValue;
|
||||||
|
// 计算不同块的采样率
|
||||||
|
int nIndex = 0;
|
||||||
|
// .CFG中采样率
|
||||||
|
RateDTO tmpRateDTO;
|
||||||
|
// nBlockNum 总循环次数
|
||||||
|
for (int i = 0; i < nBlockNum; i++) {
|
||||||
|
tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||||
|
// 判断是否进入下一段
|
||||||
|
if (i == tmpRateDTO.getNSampleNum() + nOffSet) {
|
||||||
|
nOffSet += tmpRateDTO.getNSampleNum();
|
||||||
|
nIndex++;
|
||||||
|
if (nIndex == nnInd) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||||
|
dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
||||||
|
// C# 原实现中 RMS 段与普通抽点是两条独立控制流,不能挂在同一个取模条件下
|
||||||
|
if (Boolean.TRUE.equals(newLstRate.get(nIndex).bRMSFlag)) {
|
||||||
|
//计算本段补点采样间隔
|
||||||
|
nWaveSpan = newLstRate.get(nIndex).getNOneSample() / tmpRateDTO.getNOneSample();
|
||||||
|
// 计算有多少个周波
|
||||||
|
long allWaveTemp = newLstRate.get(nIndex).getNSampleNum() / newLstRate.get(nIndex).getNOneSample();
|
||||||
|
// 本段需要补多少点
|
||||||
|
long allempSample = newLstRate.get(nIndex).getNOneSample();
|
||||||
|
int segmentEndIndex = (int) (nOffSet + tmpRateDTO.getNSampleNum() - 1);
|
||||||
|
for (int iWaveTemp = 0; iWaveTemp < allWaveTemp; iWaveTemp++) {
|
||||||
|
for (int mTempSample = 0; mTempSample < allempSample; mTempSample++) {
|
||||||
|
// 2 点/周波时,半周波位置需要切换到该周波的第二个原始采样点
|
||||||
|
if (mTempSample / nWaveSpan == 1 && mTempSample % nWaveSpan == 0) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
//存储局部数据集合,包含了时间,A,B,C三相
|
||||||
|
List<Float> tmpWaveData = new ArrayList<>();
|
||||||
|
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||||
|
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||||
|
//WW 2019-11-14
|
||||||
|
/*************************
|
||||||
|
* 1、接口返回的默认是二次值
|
||||||
|
* 2、P是一次值 S是二次值
|
||||||
|
* 3、S(二次值)情况下:
|
||||||
|
* ①、单位为"V"时候则直接等于;
|
||||||
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
|
* 4、P(一次值)情况下:
|
||||||
|
* ①、单位为"V"时候则直接等于;
|
||||||
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
|
*************************/
|
||||||
|
//P是一次值 S是二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||||
|
//判断单位是V还是kV
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
|
fValue = fValue * 1000.0f;
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//P是一次值 S是二次值
|
||||||
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||||
|
//判断单位是V还是kV
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||||
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//判断单位是V还是kV
|
||||||
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
} else //还有可能是 电流,单位是A
|
||||||
|
{
|
||||||
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//xValue前移量,假如是第一次时候则需要前移
|
||||||
|
if (!blxValue && j == 0) {
|
||||||
|
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||||
|
blxValue = true;
|
||||||
|
//只增加一个xValue的值 //增加时间值
|
||||||
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
|
} else if (j == 0) {
|
||||||
|
xValueAll += (float) dfValue / nWaveSpan;
|
||||||
|
//只增加一个xValue的值 //增加时间值
|
||||||
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||||
|
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||||
|
}
|
||||||
|
//把每个单独的值赋予到整体里面去
|
||||||
|
listWaveData.add(tmpWaveData);
|
||||||
|
}
|
||||||
|
// 本周波处理完成后,推进到下一周波的原始采样点
|
||||||
|
if (iWaveTemp < (allWaveTemp - 1)) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 某些文件的段点数并不是原始每周波点数的整倍数。
|
||||||
|
// RMS 段处理完成后,强制把原始游标对齐到当前段末尾,
|
||||||
|
// 这样外层 for 的下一次自增才能稳定落到下一段起点,避免重复进入同一 RMS 段。
|
||||||
|
i = segmentEndIndex;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算本段抽点采样间隔
|
||||||
|
nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||||
|
// 判断是否到了需要抽的采样点
|
||||||
|
if (i % nWaveSpan == 0) {
|
||||||
|
// 计算每个通道的值
|
||||||
|
//存储局部数据集合,包含了时间,A,B,C三相
|
||||||
|
List<Float> tmpWaveData = new ArrayList<>();
|
||||||
|
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||||
|
//数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||||
|
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||||
|
|
||||||
|
//WW 2019-11-14
|
||||||
|
/**************************
|
||||||
|
* 1、接口返回的默认是二次值
|
||||||
|
* 2、P是一次值 S是二次值
|
||||||
|
* 3、S(二次值)情况下:
|
||||||
|
* ①、单位为"V"时候则直接等于;
|
||||||
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
|
* 4、P(一次值)情况下:
|
||||||
|
* ①、单位为"V"时候则直接等于;
|
||||||
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
|
**************************/
|
||||||
|
//P是一次值 S是二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||||
|
//判断单位是V还是kV
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
|
fValue = fValue * 1000.0f;
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//P是一次值 S是二次值
|
||||||
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||||
|
//判断单位是V还是kV
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||||
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//判断单位是V还是kV
|
||||||
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
} else //还有可能是 电流,单位是A
|
||||||
|
{
|
||||||
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
|
} else {
|
||||||
|
fValue = fValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//xValue前移量,假如是第一次时候则需要前移
|
||||||
|
if (!blxValue && j == 0) {
|
||||||
|
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||||
|
blxValue = true;
|
||||||
|
//只增加一个xValue的值 //增加时间值
|
||||||
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
|
} else if (j == 0) {
|
||||||
|
xValueAll += (float) nWaveSpan * dfValue;
|
||||||
|
//只增加一个xValue的值 //增加时间值
|
||||||
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||||
|
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||||
|
}
|
||||||
|
//把每个单独的值赋予到整体里面去
|
||||||
|
listWaveData.add(tmpWaveData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return listWaveData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<List<Float>> getComtradeDatNoAddPoints(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
||||||
|
//返回数据,如果仅仅做展示后期考虑换String类型,降低内存开销
|
||||||
|
List<List<Float>> listWaveData = new ArrayList<>();
|
||||||
|
//初始化xValue的值
|
||||||
|
float xValueAll = 0;
|
||||||
|
//判断是否首次登陆
|
||||||
|
boolean blxValue = false;
|
||||||
|
byte[] datArray;
|
||||||
|
try {
|
||||||
|
datArray = IoUtil.readBytes(datStream);
|
||||||
|
if (ArrayUtil.isEmpty(datArray)) {
|
||||||
|
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||||
|
}
|
||||||
|
// 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
||||||
|
// 示例中的排布是 4个字节的序号 4个字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节) IC(2字节)
|
||||||
|
int nDigSize = (comtradeCfgDTO.getNDigitalNum() % 16) > 0 ? (comtradeCfgDTO.getNDigitalNum() / 16 + 1) * 2 : comtradeCfgDTO.getNDigitalNum() / 16 * 2;
|
||||||
|
int nBlockSize = 2 * Integer.SIZE / 8 + comtradeCfgDTO.getNAnalogNum() * 2 + nDigSize;
|
||||||
|
// 总长度除以每个块的大小
|
||||||
|
int nBlockNum = (int)Math.floor(datArray.length / nBlockSize);
|
||||||
|
|
||||||
|
// 获取采样率
|
||||||
|
int finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
||||||
|
if (finalSampleRate != -1) {
|
||||||
|
//设置最终采样率
|
||||||
|
comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
||||||
|
// 计算转换后的采样率
|
||||||
|
int nnInd = 0;
|
||||||
|
// 抽点后总共多少点数据
|
||||||
|
int nWaveNum;
|
||||||
|
//抽点后新的的采样率
|
||||||
|
List<RateDTO> newLstRate = new ArrayList<>();
|
||||||
|
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
||||||
|
if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||||
|
// 计算本段录波总共有多少波形
|
||||||
|
nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
||||||
|
//设置总波形大小
|
||||||
|
comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
||||||
|
// 将最低采样率替换到本段录波内
|
||||||
|
RateDTO tmpRateDTO = new RateDTO();
|
||||||
|
// 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
||||||
|
// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||||
|
// //YXB 2025-08-27
|
||||||
|
// tmpRateDTO.bRMSFlag = false;
|
||||||
|
// }
|
||||||
|
// //如果采样是全波有效值或者半波有效值,需要去补足周波点数 YXB 2025-08-27
|
||||||
|
// else if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() <= 2) {
|
||||||
|
// //YXB 2025-08-27
|
||||||
|
// tmpRateDTO.bRMSFlag = true;
|
||||||
|
// }
|
||||||
|
newLstRate.add(tmpRateDTO);
|
||||||
|
//iFlag =3 一定不进行抽点算法
|
||||||
|
if (iType != 3) {
|
||||||
|
//true 抽点算法(当前采样率跟统一采样率不一样则是抽点,否则是未抽点)
|
||||||
|
if (!Objects.equals(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample(), comtradeCfgDTO.getFinalSampleRate())) {
|
||||||
|
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getFinalSampleRate());
|
||||||
|
// 计算本段录波按照最低采样点应该有多少录波
|
||||||
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getFinalSampleRate() * nWaveNum);
|
||||||
|
} else {
|
||||||
|
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||||
|
// 计算本段录波按照最低采样点应该有多少录波
|
||||||
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||||
|
// 计算本段录波按照最低采样点应该有多少录波
|
||||||
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||||
|
}
|
||||||
|
|
||||||
// 正常的配置中采样率
|
// 正常的配置中采样率
|
||||||
/* comtradeCfgDTO.getLstRate().get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
comtradeCfgDTO.getLstRate().get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||||
comtradeCfgDTO.getLstRate().get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum());*/
|
comtradeCfgDTO.getLstRate().get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum());
|
||||||
|
|
||||||
nnInd++;
|
nnInd++;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
// 偏移量,采样间隔
|
// 偏移量,采样间隔
|
||||||
long nOffSet = 0, nWaveSpan;
|
long nOffSet = 0, nWaveSpan;
|
||||||
@@ -574,15 +1023,16 @@ public class WaveFileComponent {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||||
//YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
// tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||||
if (newLstRate.get(nIndex).bRMSFlag == true) {
|
// //YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
||||||
//计算本段补点采样间隔
|
// if (newLstRate.get(nIndex).bRMSFlag == true) {
|
||||||
nWaveSpan = newLstRate.get(nIndex).getNOneSample() / tmpRateDTO.getNOneSample();
|
// //计算本段补点采样间隔
|
||||||
} else {
|
// nWaveSpan = newLstRate.get(nIndex).getNOneSample() / tmpRateDTO.getNOneSample();
|
||||||
// 计算本段抽点采样间隔
|
// } else {
|
||||||
nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
// // 计算本段抽点采样间隔
|
||||||
}
|
// nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||||
|
// }
|
||||||
|
|
||||||
dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
||||||
// 判断是否到了需要抽的采样点
|
// 判断是否到了需要抽的采样点
|
||||||
@@ -590,182 +1040,82 @@ public class WaveFileComponent {
|
|||||||
// 计算每个通道的值
|
// 计算每个通道的值
|
||||||
//存储局部数据集合,包含了时间,A,B,C三相
|
//存储局部数据集合,包含了时间,A,B,C三相
|
||||||
List<Float> tmpWaveData = new ArrayList<>();
|
List<Float> tmpWaveData = new ArrayList<>();
|
||||||
//YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||||
if (newLstRate.get(nIndex).bRMSFlag == true) {
|
//数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
||||||
// 计算有多少个周波
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||||
long allWaveTemp = newLstRate.get(nIndex).getNSampleNum() / newLstRate.get(nIndex).getNOneSample();
|
break;
|
||||||
// 本段需要补多少点
|
}
|
||||||
long allempSample = newLstRate.get(nIndex).getNOneSample();
|
|
||||||
//int iStartWaveTemp = i ;// 开始补点的起点
|
|
||||||
for (int iWaveTemp = 0; iWaveTemp < allWaveTemp; iWaveTemp++) {
|
|
||||||
for (int mTempSample = 0; mTempSample < allempSample; mTempSample++) {
|
|
||||||
//最多只有半波有效值,也就是每周波是1个或者2个点,然后去补最少16个点
|
|
||||||
if (mTempSample / nWaveSpan == 1 && mTempSample % nWaveSpan == 0) {
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
//存储局部数据集合,包含了时间,A,B,C三相
|
|
||||||
tmpWaveData = new ArrayList<>();
|
|
||||||
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
|
||||||
//数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
|
||||||
|
|
||||||
if((i * nBlockSize + 2 * 4 + j * 2) == 2437568){
|
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||||
System.out.println(55);
|
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||||
}
|
|
||||||
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
|
||||||
//WW 2019-11-14
|
|
||||||
/*************************
|
|
||||||
* 1、接口返回的默认是二次值
|
|
||||||
* 2、P是一次值 S是二次值
|
|
||||||
* 3、S(二次值)情况下:
|
|
||||||
* ①、单位为"V"时候则直接等于;
|
|
||||||
* ②、单位为"kV"时候需要乘以1000
|
|
||||||
* 4、P(一次值)情况下:
|
|
||||||
* ①、单位为"V"时候则直接等于;
|
|
||||||
* ②、单位为"kV"时候需要乘以1000
|
|
||||||
*************************/
|
|
||||||
//P是一次值 S是二次值
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
|
||||||
//判断单位是V还是kV
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
|
||||||
fValue = fValue * 1000.0f;
|
|
||||||
} else {
|
|
||||||
fValue = fValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//P是一次值 S是二次值
|
|
||||||
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
|
||||||
//判断单位是V还是kV
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
|
||||||
//根据cfg内的变比,将一次值转换成二次值
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
|
||||||
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
|
||||||
} else {
|
|
||||||
fValue = fValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//判断单位是V还是kV
|
|
||||||
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
|
||||||
//根据cfg内的变比,将一次值转换成二次值
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
|
||||||
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
|
||||||
} else {
|
|
||||||
fValue = fValue;
|
|
||||||
}
|
|
||||||
} else //还有可能是 电流,单位是A
|
|
||||||
{
|
|
||||||
//根据cfg内的变比,将一次值转换成二次值
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
|
||||||
fValue = comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
|
||||||
} else {
|
|
||||||
fValue = fValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//xValue前移量,假如是第一次时候则需要前移
|
//WW 2019-11-14
|
||||||
if (!blxValue && j == 0) {
|
/**************************
|
||||||
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
* 1、接口返回的默认是二次值
|
||||||
blxValue = true;
|
* 2、P是一次值 S是二次值
|
||||||
//只增加一个xValue的值 //增加时间值
|
* 3、S(二次值)情况下:
|
||||||
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
* ①、单位为"V"时候则直接等于;
|
||||||
} else if (j == 0) {
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
xValueAll += (float) dfValue / nWaveSpan;
|
* 4、P(一次值)情况下:
|
||||||
//只增加一个xValue的值 //增加时间值
|
* ①、单位为"V"时候则直接等于;
|
||||||
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
}
|
**************************/
|
||||||
|
//P是一次值 S是二次值
|
||||||
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||||
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
//判断单位是V还是kV
|
||||||
}
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
//把每个单独的值赋予到整体里面去
|
fValue = fValue * 1000.0f;
|
||||||
listWaveData.add(tmpWaveData);
|
} else {
|
||||||
}
|
fValue = fValue;
|
||||||
// 把每个单独的值赋予到整体里面去
|
|
||||||
if (iWaveTemp < (allWaveTemp - 1)) {
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
//P是一次值 S是二次值
|
||||||
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||||
//数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
//判断单位是V还是kV
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||||
break;
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
}
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
|
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
|
||||||
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
|
||||||
|
|
||||||
//WW 2019-11-14
|
|
||||||
/**************************
|
|
||||||
* 1、接口返回的默认是二次值
|
|
||||||
* 2、P是一次值 S是二次值
|
|
||||||
* 3、S(二次值)情况下:
|
|
||||||
* ①、单位为"V"时候则直接等于;
|
|
||||||
* ②、单位为"kV"时候需要乘以1000
|
|
||||||
* 4、P(一次值)情况下:
|
|
||||||
* ①、单位为"V"时候则直接等于;
|
|
||||||
* ②、单位为"kV"时候需要乘以1000
|
|
||||||
**************************/
|
|
||||||
//P是一次值 S是二次值
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
|
||||||
//判断单位是V还是kV
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
|
||||||
fValue = fValue * 1000.0f;
|
|
||||||
} else {
|
} else {
|
||||||
fValue = fValue;
|
fValue = fValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//P是一次值 S是二次值
|
//判断单位是V还是kV
|
||||||
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
//判断单位是V还是kV
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
//根据cfg内的变比,将一次值转换成二次值
|
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
} else {
|
||||||
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
fValue = fValue;
|
||||||
} else {
|
|
||||||
fValue = fValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//判断单位是V还是kV
|
} else //还有可能是 电流,单位是A
|
||||||
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
{
|
||||||
//根据cfg内的变比,将一次值转换成二次值
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
fValue = fValue *comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
} else {
|
} else {
|
||||||
fValue = fValue;
|
fValue = fValue;
|
||||||
}
|
|
||||||
} else //还有可能是 电流,单位是A
|
|
||||||
{
|
|
||||||
//根据cfg内的变比,将一次值转换成二次值
|
|
||||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
|
||||||
fValue = comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
|
||||||
} else {
|
|
||||||
fValue = fValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//xValue前移量,假如是第一次时候则需要前移
|
|
||||||
if (!blxValue && j == 0) {
|
|
||||||
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
|
||||||
blxValue = true;
|
|
||||||
//只增加一个xValue的值 //增加时间值
|
|
||||||
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
|
||||||
} else if (j == 0) {
|
|
||||||
xValueAll += (float) nWaveSpan * dfValue;
|
|
||||||
//只增加一个xValue的值 //增加时间值
|
|
||||||
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
|
||||||
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
|
||||||
}
|
}
|
||||||
//把每个单独的值赋予到整体里面去
|
//xValue前移量,假如是第一次时候则需要前移
|
||||||
listWaveData.add(tmpWaveData);
|
if (!blxValue && j == 0) {
|
||||||
|
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||||
|
blxValue = true;
|
||||||
|
//只增加一个xValue的值 //增加时间值
|
||||||
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
|
} else if (j == 0) {
|
||||||
|
xValueAll += (float) nWaveSpan * dfValue;
|
||||||
|
//只增加一个xValue的值 //增加时间值
|
||||||
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||||
|
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||||
}
|
}
|
||||||
|
//把每个单独的值赋予到整体里面去
|
||||||
|
listWaveData.add(tmpWaveData);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1370,10 +1720,10 @@ public class WaveFileComponent {
|
|||||||
s = sdf.format(d);
|
s = sdf.format(d);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
WaveFileComponent waveFileComponent = new WaveFileComponent();
|
WaveFileComponent waveFileComponent = new WaveFileComponent();
|
||||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("F:\\PQ_PQLD3_9_20250821_081038_640.cfg");
|
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\无名\\Desktop\\月报\\2026\\202603\\文档\\暂态事件及波形\\新建文件夹 (3)\\Comtrade\\Comtrade\\10.95.0.201\\PQMonitor_PQM1_001183_20260320_175042_316.CFG");
|
||||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("F:\\PQ_PQLD3_9_20250821_081038_640.dat");
|
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\无名\\Desktop\\月报\\2026\\202603\\文档\\暂态事件及波形\\新建文件夹 (3)\\Comtrade\\Comtrade\\10.95.0.201\\PQMonitor_PQM1_001183_20260320_175042_316.DAT");
|
||||||
// 获取瞬时波形 //获取原始波形值
|
// 获取瞬时波形 //获取原始波形值
|
||||||
WaveDataDTO waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
WaveDataDTO waveDataDTO = waveFileComponent.getComtradeNoAddPoints(cfgStream, datStream, 0);
|
||||||
d = new Date();
|
d = new Date();
|
||||||
s = sdf.format(d);
|
s = sdf.format(d);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.njcn.event.file.component;
|
package com.njcn.event.file.component;
|
||||||
|
|
||||||
import cn.hutool.core.img.ImgUtil;
|
import cn.hutool.core.img.ImgUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.FileUtil;
|
import com.njcn.common.utils.FileUtil;
|
||||||
|
import com.njcn.echarts.json.LineGenerator;
|
||||||
import com.njcn.echarts.pojo.constant.PicCommonData;
|
import com.njcn.echarts.pojo.constant.PicCommonData;
|
||||||
import com.njcn.echarts.util.DrawPicUtil;
|
import com.njcn.echarts.util.DrawPicUtil;
|
||||||
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
||||||
@@ -12,21 +11,17 @@ import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
|||||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import sun.awt.image.BufferedImageGraphicsConfig;
|
import sun.awt.image.BufferedImageGraphicsConfig;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.util.Base64;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -49,36 +44,39 @@ public class WavePicComponent {
|
|||||||
* @date 2023/9/21 15:32
|
* @date 2023/9/21 15:32
|
||||||
* @return String 文件地址
|
* @return String 文件地址
|
||||||
*/
|
*/
|
||||||
public String generateInstantImageZl(List<WaveDataDetail> waveDataDetails) {
|
public String generateInstantImageZl(Integer nPush, List<WaveDataDetail> waveDataDetails, Double lastTime) {
|
||||||
String firstPic = null, secondPic = null, thirdPic = null, forthPic = null;
|
String firstPic = null, secondPic = null, thirdPic = null, forthPic = null;
|
||||||
|
WaveDataDetail waveDataDetail0 = waveDataDetails.get(0);
|
||||||
|
// 从instantData提取null边界x值,作为共享参考(与Shun图保持一致)
|
||||||
|
List<Float> sharedNullBoundaries = LineGenerator.extractNullBoundaryXValues(waveDataDetail0.getInstantData().getAValue());
|
||||||
for (WaveDataDetail waveDataDetail : waveDataDetails) {
|
for (WaveDataDetail waveDataDetail : waveDataDetails) {
|
||||||
if (waveDataDetail.getChannelName().toUpperCase().startsWith("SU")) {
|
if (waveDataDetail.getChannelName().toUpperCase().startsWith("SU")) {
|
||||||
firstPic = drawPicUtil.drawWavePic("电压-电网侧", waveDataDetail.getInstantData().getAValue(),
|
firstPic = drawPicUtil.drawWavePic("电压-电网侧", waveDataDetail.getInstantData().getAValue(),
|
||||||
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("SI")) {
|
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("SI")) {
|
||||||
thirdPic = drawPicUtil.drawWavePic("电流-电网侧", waveDataDetail.getInstantData().getAValue(),
|
thirdPic = drawPicUtil.drawWavePic("电流-电网侧", waveDataDetail.getInstantData().getAValue(),
|
||||||
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("LU")) {
|
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("LU")) {
|
||||||
secondPic = drawPicUtil.drawWavePic("电压-负载侧", waveDataDetail.getInstantData().getAValue(),
|
secondPic = drawPicUtil.drawWavePic("电压-负载侧", waveDataDetail.getInstantData().getAValue(),
|
||||||
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
forthPic = drawPicUtil.drawWavePic("电流-负载侧", waveDataDetail.getInstantData().getAValue(),
|
forthPic = drawPicUtil.drawWavePic("电流-负载侧", waveDataDetail.getInstantData().getAValue(),
|
||||||
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,36 +89,39 @@ public class WavePicComponent {
|
|||||||
* @date 2023/9/21 15:32
|
* @date 2023/9/21 15:32
|
||||||
* @return String 文件地址
|
* @return String 文件地址
|
||||||
*/
|
*/
|
||||||
public String generateRmsImageZl(List<WaveDataDetail> waveDataDetails) {
|
public String generateRmsImageZl(Integer nPush, List<WaveDataDetail> waveDataDetails, Double lastTime) {
|
||||||
String firstPic = null, secondPic = null, thirdPic = null, forthPic = null;
|
String firstPic = null, secondPic = null, thirdPic = null, forthPic = null;
|
||||||
|
WaveDataDetail waveDataDetail0 = waveDataDetails.get(0);
|
||||||
|
// 从instantData提取null边界x值,作为共享参考(与Shun图保持一致)
|
||||||
|
List<Float> sharedNullBoundaries = LineGenerator.extractNullBoundaryXValues(waveDataDetail0.getInstantData().getAValue());
|
||||||
for (WaveDataDetail waveDataDetail : waveDataDetails) {
|
for (WaveDataDetail waveDataDetail : waveDataDetails) {
|
||||||
if (waveDataDetail.getChannelName().toUpperCase().startsWith("SU")) {
|
if (waveDataDetail.getChannelName().toUpperCase().startsWith("SU")) {
|
||||||
firstPic = drawPicUtil.drawWavePic("电压-电网侧", waveDataDetail.getRmsData().getAValue(),
|
firstPic = drawPicUtil.drawWavePic("电压-电网侧", waveDataDetail.getRmsData().getAValue(),
|
||||||
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("SI")) {
|
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("SI")) {
|
||||||
thirdPic = drawPicUtil.drawWavePic("电流-电网侧", waveDataDetail.getRmsData().getAValue(),
|
thirdPic = drawPicUtil.drawWavePic("电流-电网侧", waveDataDetail.getRmsData().getAValue(),
|
||||||
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("LU")) {
|
} else if (waveDataDetail.getChannelName().toUpperCase().startsWith("LU")) {
|
||||||
secondPic = drawPicUtil.drawWavePic("电压-负载侧", waveDataDetail.getRmsData().getAValue(),
|
secondPic = drawPicUtil.drawWavePic("电压-负载侧", waveDataDetail.getRmsData().getAValue(),
|
||||||
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
forthPic = drawPicUtil.drawWavePic("电流-负载侧", waveDataDetail.getRmsData().getAValue(),
|
forthPic = drawPicUtil.drawWavePic("电流-负载侧", waveDataDetail.getRmsData().getAValue(),
|
||||||
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
||||||
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
||||||
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
waveDataDetail.getColors(), waveDataDetail.getIsOpen()
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(),lastTime,sharedNullBoundaries,nPush
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,6 +210,47 @@ public class WavePicComponent {
|
|||||||
return picPath;
|
return picPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 绘制瞬时波形图 App端用来绘制图片,会去掉部分数据,只保留开始数据 结束数据
|
||||||
|
* @author xy
|
||||||
|
* @return String 文件地址
|
||||||
|
*/
|
||||||
|
public String generateImageShun(Integer nPush, List<WaveDataDetail> waveDataDetails, Double lastTime) {
|
||||||
|
String picPath = null;
|
||||||
|
WaveDataDetail waveDataDetail = waveDataDetails.get(0);
|
||||||
|
// 从instantData提取null边界x值,作为共享参考
|
||||||
|
List<Float> sharedNullBoundaries = LineGenerator.extractNullBoundaryXValues(waveDataDetail.getInstantData().getAValue());
|
||||||
|
|
||||||
|
String firstPic = drawPicUtil.drawWavePic(getTitle(waveDataDetail.getChannelName()), waveDataDetail.getInstantData().getAValue(),
|
||||||
|
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
||||||
|
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
||||||
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(), lastTime, sharedNullBoundaries,nPush
|
||||||
|
);
|
||||||
|
String secondPic;
|
||||||
|
if (waveDataDetails.size() == 1) {
|
||||||
|
if (firstPic.contains(PicCommonData.PNG_PREFIX)) {
|
||||||
|
firstPic = firstPic.replace(PicCommonData.PNG_PREFIX, "");
|
||||||
|
}
|
||||||
|
byte[] bytes = Base64.getDecoder().decode(firstPic);
|
||||||
|
picPath = fileStorageUtil.uploadStream(new ByteArrayInputStream(bytes), OssPath.EVENT_WAVE_PIC, FileUtil.generateFileName("png"));
|
||||||
|
} else if (waveDataDetails.size() == 2) {
|
||||||
|
waveDataDetail = waveDataDetails.get(1);
|
||||||
|
secondPic = drawPicUtil.drawWavePic(getTitle(waveDataDetail.getChannelName()), waveDataDetail.getInstantData().getAValue(),
|
||||||
|
waveDataDetail.getInstantData().getBValue(), waveDataDetail.getInstantData().getCValue(),
|
||||||
|
waveDataDetail.getUnit(), waveDataDetail.getInstantData().getMax(), waveDataDetail.getInstantData().getMin(),
|
||||||
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(), lastTime, sharedNullBoundaries,nPush
|
||||||
|
);
|
||||||
|
picPath = composeImage(firstPic, secondPic);
|
||||||
|
}
|
||||||
|
return picPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle(String channelName) {
|
||||||
|
return channelName.toUpperCase().startsWith("U1") ? "电压" : "电流";
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 绘制RMS波形图
|
* 绘制RMS波形图
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -248,6 +290,44 @@ public class WavePicComponent {
|
|||||||
return picPath;
|
return picPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 绘制RMS波形图 App端用来绘制图片,会去掉部分数据,只保留开始数据 结束数据
|
||||||
|
* @author xy
|
||||||
|
* @return String 文件地址
|
||||||
|
*/
|
||||||
|
public String generateImageRms(Integer nPush, List<WaveDataDetail> waveDataDetails, Double lastTime) {
|
||||||
|
String picPath = null;
|
||||||
|
WaveDataDetail waveDataDetail = waveDataDetails.get(0);
|
||||||
|
|
||||||
|
// 从instantData提取null边界x值,作为共享参考(与Shun图保持一致)
|
||||||
|
List<Float> sharedNullBoundaries = LineGenerator.extractNullBoundaryXValues(waveDataDetail.getInstantData().getAValue());
|
||||||
|
|
||||||
|
String firstPic = drawPicUtil.drawWavePic(getTitle(waveDataDetail.getChannelName()), waveDataDetail.getRmsData().getAValue(),
|
||||||
|
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
||||||
|
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
||||||
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(), lastTime, sharedNullBoundaries,nPush
|
||||||
|
);
|
||||||
|
String secondPic;
|
||||||
|
if (waveDataDetails.size() == 1) {
|
||||||
|
if (firstPic.contains(PicCommonData.PNG_PREFIX)) {
|
||||||
|
firstPic = firstPic.replace(PicCommonData.PNG_PREFIX, "");
|
||||||
|
}
|
||||||
|
byte[] bytes = Base64.getDecoder().decode(firstPic);
|
||||||
|
picPath = fileStorageUtil.uploadStream(new ByteArrayInputStream(bytes), OssPath.EVENT_WAVE_PIC, FileUtil.generateFileName("png"));
|
||||||
|
} else if (waveDataDetails.size() == 2) {
|
||||||
|
waveDataDetail = waveDataDetails.get(1);
|
||||||
|
secondPic = drawPicUtil.drawWavePic(getTitle(waveDataDetail.getChannelName()), waveDataDetail.getRmsData().getAValue(),
|
||||||
|
waveDataDetail.getRmsData().getBValue(), waveDataDetail.getRmsData().getCValue(),
|
||||||
|
waveDataDetail.getUnit(), waveDataDetail.getRmsData().getMax(), waveDataDetail.getRmsData().getMin(),
|
||||||
|
waveDataDetail.getA(), waveDataDetail.getB(), waveDataDetail.getC(),
|
||||||
|
waveDataDetail.getColors(), waveDataDetail.getIsOpen(), lastTime, sharedNullBoundaries,nPush
|
||||||
|
);
|
||||||
|
picPath = composeImage(firstPic, secondPic);
|
||||||
|
}
|
||||||
|
return picPath;
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 合成图片
|
* 合成图片
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -80,28 +81,49 @@ public class WaveUtil {
|
|||||||
//根据相别来确认标题的名称
|
//根据相别来确认标题的名称
|
||||||
for (int m = 0; m < iPhase; m++) {
|
for (int m = 0; m < iPhase; m++) {
|
||||||
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("A")) {
|
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("A")) {
|
||||||
float tmpShunFirstA = sunData.get(j).get(iPhase * i + m + 1) * xishu;
|
if (Objects.isNull(sunData.get(j).get(iPhase * i + m + 1))) {
|
||||||
shunFirstA = tmpShunFirstA;
|
sAValue.add(new ArrayList<Float>() {{
|
||||||
sAValue.add(new ArrayList<Float>() {{
|
add(x);
|
||||||
add(x);
|
add(null);
|
||||||
add(tmpShunFirstA);
|
}});
|
||||||
}});
|
} else {
|
||||||
|
float tmpShunFirstA = sunData.get(j).get(iPhase * i + m + 1) * xishu;
|
||||||
|
shunFirstA = tmpShunFirstA;
|
||||||
|
sAValue.add(new ArrayList<Float>() {{
|
||||||
|
add(x);
|
||||||
|
add(tmpShunFirstA);
|
||||||
|
}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("B")) {
|
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("B")) {
|
||||||
float tmpShunFirstB = sunData.get(j).get(iPhase * i + m + 1) * xishu;
|
if (Objects.isNull(sunData.get(j).get(iPhase * i + m + 1))) {
|
||||||
shunFirstB = tmpShunFirstB;
|
sBValue.add(new ArrayList<Float>() {{
|
||||||
sBValue.add(new ArrayList<Float>() {{
|
add(x);
|
||||||
add(x);
|
add(null);
|
||||||
add(tmpShunFirstB);
|
}});
|
||||||
}});
|
} else {
|
||||||
|
float tmpShunFirstB = sunData.get(j).get(iPhase * i + m + 1) * xishu;
|
||||||
|
shunFirstB = tmpShunFirstB;
|
||||||
|
sBValue.add(new ArrayList<Float>() {{
|
||||||
|
add(x);
|
||||||
|
add(tmpShunFirstB);
|
||||||
|
}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("C")) {
|
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("C")) {
|
||||||
float tmpShunFirstC = sunData.get(j).get(iPhase * i + m + 1) * xishu;
|
if (Objects.isNull(sunData.get(j).get(iPhase * i + m + 1))) {
|
||||||
shunFirstC = tmpShunFirstC;
|
sCValue.add(new ArrayList<Float>() {{
|
||||||
sCValue.add(new ArrayList<Float>() {{
|
add(x);
|
||||||
add(x);
|
add(null);
|
||||||
add(tmpShunFirstC);
|
}});
|
||||||
}});
|
} else {
|
||||||
|
float tmpShunFirstC = sunData.get(j).get(iPhase * i + m + 1) * xishu;
|
||||||
|
shunFirstC = tmpShunFirstC;
|
||||||
|
sCValue.add(new ArrayList<Float>() {{
|
||||||
|
add(x);
|
||||||
|
add(tmpShunFirstC);
|
||||||
|
}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sfMax = getMax(sfMax, shunFirstA, shunFirstB, shunFirstC);
|
sfMax = getMax(sfMax, shunFirstA, shunFirstB, shunFirstC);
|
||||||
@@ -124,28 +146,50 @@ public class WaveUtil {
|
|||||||
//根据相别来确认标题的名称
|
//根据相别来确认标题的名称
|
||||||
for (int m = 0; m < iPhase; m++) {
|
for (int m = 0; m < iPhase; m++) {
|
||||||
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("A")) {
|
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("A")) {
|
||||||
float tmpRmsFirstA = rmsData.get(k).get(iPhase * i + m + 1) * xishu;
|
if (Objects.isNull(rmsData.get(k).get(iPhase * i + m + 1))) {
|
||||||
rmsFirstA = tmpRmsFirstA;
|
rAValue.add(new ArrayList<Float>() {{
|
||||||
rAValue.add(new ArrayList<Float>() {{
|
add(x);
|
||||||
add(x);
|
add(null);
|
||||||
add(tmpRmsFirstA);
|
}});
|
||||||
}});
|
} else {
|
||||||
|
float tmpRmsFirstA = rmsData.get(k).get(iPhase * i + m + 1) * xishu;
|
||||||
|
rmsFirstA = tmpRmsFirstA;
|
||||||
|
rAValue.add(new ArrayList<Float>() {{
|
||||||
|
add(x);
|
||||||
|
add(tmpRmsFirstA);
|
||||||
|
}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("B")) {
|
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("B")) {
|
||||||
float tmpRmsFirstB = rmsData.get(k).get(iPhase * i + m + 1) * xishu;
|
if (Objects.isNull(rmsData.get(k).get(iPhase * i + m + 1))) {
|
||||||
rmsFirstB = tmpRmsFirstB;
|
rBValue.add(new ArrayList<Float>() {{
|
||||||
rBValue.add(new ArrayList<Float>() {{
|
add(x);
|
||||||
add(x);
|
add(null);
|
||||||
add(tmpRmsFirstB);
|
}});
|
||||||
}});
|
} else {
|
||||||
|
float tmpRmsFirstB = rmsData.get(k).get(iPhase * i + m + 1) * xishu;
|
||||||
|
rmsFirstB = tmpRmsFirstB;
|
||||||
|
rBValue.add(new ArrayList<Float>() {{
|
||||||
|
add(x);
|
||||||
|
add(tmpRmsFirstB);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("C")) {
|
if (waveTitle.get(iPhase * i + m + 1).substring(1).contains("C")) {
|
||||||
float tmpRmsFirstC = rmsData.get(k).get(iPhase * i + m + 1) * xishu;
|
if (Objects.isNull(rmsData.get(k).get(iPhase * i + m + 1))) {
|
||||||
rmsFirstC = tmpRmsFirstC;
|
rCValue.add(new ArrayList<Float>() {{
|
||||||
rCValue.add(new ArrayList<Float>() {{
|
add(x);
|
||||||
add(x);
|
add(null);
|
||||||
add(tmpRmsFirstC);
|
}});
|
||||||
}});
|
} else {
|
||||||
|
float tmpRmsFirstC = rmsData.get(k).get(iPhase * i + m + 1) * xishu;
|
||||||
|
rmsFirstC = tmpRmsFirstC;
|
||||||
|
rCValue.add(new ArrayList<Float>() {{
|
||||||
|
add(x);
|
||||||
|
add(tmpRmsFirstC);
|
||||||
|
}});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rfMax = getMax(sfMax, rmsFirstA, rmsFirstB, rmsFirstC);
|
rfMax = getMax(sfMax, rmsFirstA, rmsFirstB, rmsFirstC);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.njcn.microservice.listener;
|
package com.njcn.microservice.listener;
|
||||||
|
|
||||||
|
import ch.qos.logback.classic.Level;
|
||||||
|
import ch.qos.logback.classic.Logger;
|
||||||
import ch.qos.logback.classic.LoggerContext;
|
import ch.qos.logback.classic.LoggerContext;
|
||||||
import ch.qos.logback.classic.joran.JoranConfigurator;
|
import ch.qos.logback.classic.joran.JoranConfigurator;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -34,33 +36,46 @@ public class NacosLogbackConfigLoader implements SpringApplicationRunListener, A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void environmentPrepared(ConfigurableEnvironment environment) {
|
public void environmentPrepared(ConfigurableEnvironment environment) {
|
||||||
/* String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
String active = environment.getProperty("spring.profiles.active");
|
||||||
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
if(!"jb".equalsIgnoreCase(active)){
|
||||||
String projectName = environment.getProperty("microservice.ename");
|
String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||||
String logLevel = environment.getProperty("logging.level.root");
|
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||||
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
String projectName = environment.getProperty("microservice.ename");
|
||||||
HttpHeaders headers = new HttpHeaders();
|
String logLevel = environment.getProperty("logging.level.root");
|
||||||
headers.set("cndl408125hawen", "lanxia201");
|
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
HttpHeaders headers = new HttpHeaders();
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
headers.set("cndl408125hawen", "lanxia201");
|
||||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||||
if (response.getStatusCode().is2xxSuccessful()) {
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
String logbackConfigContent = response.getBody();
|
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||||
//替换项目名称
|
if (response.getStatusCode().is2xxSuccessful()) {
|
||||||
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
String logbackConfigContent = response.getBody();
|
||||||
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
//替换项目名称
|
||||||
// 应用获取到的Logback配置
|
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||||
applyLogbackConfig(logbackConfigContent);
|
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
||||||
}*/
|
// 应用获取到的Logback配置
|
||||||
|
applyLogbackConfig(logbackConfigContent,logLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyLogbackConfig(String logbackConfigContent) {
|
private void applyLogbackConfig(String logbackConfigContent,String logLevel) {
|
||||||
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||||
JoranConfigurator configurator = new JoranConfigurator();
|
JoranConfigurator configurator = new JoranConfigurator();
|
||||||
configurator.setContext(context);
|
configurator.setContext(context);
|
||||||
context.reset();
|
context.reset();
|
||||||
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(logbackConfigContent.getBytes(StandardCharsets.UTF_8))) {
|
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(logbackConfigContent.getBytes(StandardCharsets.UTF_8))) {
|
||||||
configurator.doConfigure(inputStream);
|
configurator.doConfigure(inputStream);
|
||||||
|
Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
|
||||||
|
if("debug".equalsIgnoreCase(logLevel)){
|
||||||
|
root.setLevel(Level.DEBUG);
|
||||||
|
}
|
||||||
|
if("info".equalsIgnoreCase(logLevel)){
|
||||||
|
root.setLevel(Level.INFO);
|
||||||
|
}
|
||||||
|
if("error".equalsIgnoreCase(logLevel)){
|
||||||
|
root.setLevel(Level.ERROR);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,10 +77,41 @@ public interface BusinessTopic {
|
|||||||
*/
|
*/
|
||||||
String REPLY_RECALL_TOPIC = "reply_recall_Topic";
|
String REPLY_RECALL_TOPIC = "reply_recall_Topic";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理心跳过期处理主题
|
||||||
|
*/
|
||||||
|
String HEARTBEAT_TIMEOUT_TOPIC = "heartbeat_timeout_topic";
|
||||||
|
|
||||||
|
|
||||||
/********************************数据中心*********************************/
|
/********************************数据中心*********************************/
|
||||||
|
|
||||||
String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic";
|
String RMP_EVENT_DETAIL_TOPIC = "rmpEventDetailTopic";
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 云前置文件信息请求主题
|
||||||
|
// */
|
||||||
|
// String FILE_INFO_REQUEST_TOPIC = "fileInfoRequestTopic";
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 云前置文件信息响应主题
|
||||||
|
// */
|
||||||
|
// String FILE_INFO_RESPONSE_TOPIC = "fileInfoResponseTopic";
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 云前置文件下载请求主题
|
||||||
|
// */
|
||||||
|
// String FILE_DOWNLOAD_REQUEST_TOPIC = "fileDownloadRequestTopic";
|
||||||
|
// /**
|
||||||
|
// * 云前置文件下载响应主题
|
||||||
|
// */
|
||||||
|
// String FILE_DOWNLOAD_RESPONSE_TOPIC = "fileDownloadResponseTopic";
|
||||||
|
|
||||||
|
String CLOUD_TOPIC = "Cloud_Topic";
|
||||||
|
|
||||||
|
String CLOUD_REPLY_TOPIC = "Cloud_Reply_Topic";
|
||||||
|
|
||||||
|
String ZL_LOG_TOPIC = "ZL_LOG_Topic";
|
||||||
|
|
||||||
|
|
||||||
interface AppDataTag {
|
interface AppDataTag {
|
||||||
|
|
||||||
@@ -124,4 +155,23 @@ public interface BusinessTopic {
|
|||||||
String STREAM_TAG = "streamInfo";
|
String STREAM_TAG = "streamInfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface HeartTag {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apf 心跳
|
||||||
|
*/
|
||||||
|
String APF_TAG = "apf";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cld 心跳
|
||||||
|
*/
|
||||||
|
String CLD_TAG = "cld";
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LogTag {
|
||||||
|
|
||||||
|
//日志
|
||||||
|
String LOG_TAG = "log";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.njcn.mq.message;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class HeartbeatTimeoutMessage extends BaseMessage implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String nDid;
|
||||||
|
|
||||||
|
private Long timestamp;
|
||||||
|
|
||||||
|
private Integer delayLevel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.njcn.mq.message;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2025/9/29 15:06
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class LogMessage extends BaseMessage {
|
||||||
|
|
||||||
|
@ApiModelProperty("唯一标识")
|
||||||
|
private String guid;
|
||||||
|
|
||||||
|
@ApiModelProperty("日志类型 0:设备接入日志")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
@ApiModelProperty("操作人员")
|
||||||
|
private String userIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户登录名")
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
@ApiModelProperty("当前操作")
|
||||||
|
private String operate;
|
||||||
|
|
||||||
|
@ApiModelProperty("结果")
|
||||||
|
private Integer result;
|
||||||
|
|
||||||
|
@ApiModelProperty("失败原因")
|
||||||
|
private String failReason;
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
@@ -25,7 +25,7 @@ public class BZEventMessageTemplate extends RocketMQEnhanceTemplate {
|
|||||||
public SendResult sendMember(Object message, String tag) {
|
public SendResult sendMember(Object message, String tag) {
|
||||||
BaseMessage baseMessage = new BaseMessage();
|
BaseMessage baseMessage = new BaseMessage();
|
||||||
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||||
baseMessage.setMessageBody(new Gson().toJson(message));
|
baseMessage.setMessageBody(JSON.toJSONString(message));
|
||||||
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
|
return send(BusinessTopic.ASK_RECALL_TOPIC,tag,baseMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
import com.njcn.mq.constant.BusinessTopic;
|
||||||
|
import com.njcn.mq.message.HeartbeatTimeoutMessage;
|
||||||
|
import org.apache.rocketmq.client.producer.SendResult;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/8/11 15:28
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class HeartbeatTimeoutMessageTemplate extends RocketMQEnhanceTemplate {
|
||||||
|
|
||||||
|
public HeartbeatTimeoutMessageTemplate(RocketMQTemplate template) {
|
||||||
|
super(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SendResult sendMember(HeartbeatTimeoutMessage heartbeatTimeoutMessage) {
|
||||||
|
heartbeatTimeoutMessage.setSource(BusinessResource.WEB_RESOURCE);
|
||||||
|
return send(BusinessTopic.HEARTBEAT_TIMEOUT_TOPIC, BusinessTopic.HeartTag.APF_TAG, heartbeatTimeoutMessage, heartbeatTimeoutMessage.getDelayLevel());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
import com.njcn.mq.constant.BusinessTopic;
|
||||||
|
import com.njcn.mq.message.LogMessage;
|
||||||
|
import org.apache.rocketmq.client.producer.SendResult;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:记录日志
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class LogMessageTemplate extends RocketMQEnhanceTemplate {
|
||||||
|
|
||||||
|
public LogMessageTemplate(RocketMQTemplate template) {
|
||||||
|
super(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SendResult sendMember(LogMessage logMessage) {
|
||||||
|
logMessage.setSource(BusinessResource.APP_RESOURCE);
|
||||||
|
return send(BusinessTopic.ZL_LOG_TOPIC, BusinessTopic.LogTag.LOG_TAG, logMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.mq.template;
|
package com.njcn.mq.template;
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
|
||||||
import com.njcn.mq.constant.BusinessResource;
|
import com.njcn.mq.constant.BusinessResource;
|
||||||
|
|||||||
@@ -169,4 +169,14 @@ public interface OssPath {
|
|||||||
*/
|
*/
|
||||||
String CONFIGURATIONNAME = "configuration.json";
|
String CONFIGURATIONNAME = "configuration.json";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP 稳态报告路径
|
||||||
|
*/
|
||||||
|
String APP_HARMONIC_REPORT = "app/report/harmonic/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP 暂态报告路径
|
||||||
|
*/
|
||||||
|
String APP_EVENT_REPORT = "app/report/event/";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ package com.njcn.oss.utils;
|
|||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.aliyun.oss.OSS;
|
||||||
|
import com.njcn.ali.oss.config.AliYunOssConfig;
|
||||||
import com.njcn.ali.oss.util.AliYunOssUtils;
|
import com.njcn.ali.oss.util.AliYunOssUtils;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.huawei.obs.config.HuaweiObsProperties;
|
||||||
import com.njcn.huawei.obs.util.OBSUtil;
|
import com.njcn.huawei.obs.util.OBSUtil;
|
||||||
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
import com.njcn.minioss.bo.MinIoUploadResDTO;
|
||||||
import com.njcn.minioss.config.MinIossProperties;
|
import com.njcn.minioss.config.MinIossProperties;
|
||||||
@@ -12,6 +15,8 @@ import com.njcn.minioss.util.MinIoUtils;
|
|||||||
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.oss.enums.OssResponseEnum;
|
import com.njcn.oss.enums.OssResponseEnum;
|
||||||
|
import com.obs.services.ObsClient;
|
||||||
|
import com.obs.services.model.PutObjectRequest;
|
||||||
import io.minio.*;
|
import io.minio.*;
|
||||||
import io.minio.messages.Item;
|
import io.minio.messages.Item;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -70,6 +75,11 @@ public class FileStorageUtil {
|
|||||||
*/
|
*/
|
||||||
private final AliYunOssUtils aliYunOssUtils;
|
private final AliYunOssUtils aliYunOssUtils;
|
||||||
|
|
||||||
|
private final HuaweiObsProperties huaweiObsProperties;
|
||||||
|
|
||||||
|
private final OSS ossClient;
|
||||||
|
private final AliYunOssConfig ossConfig;
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 上传MultipartFile文件,
|
* 上传MultipartFile文件,
|
||||||
@@ -92,8 +102,11 @@ public class FileStorageUtil {
|
|||||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||||
}
|
}
|
||||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
filePath = dir;
|
filePath = dir.endsWith("/")?dir+getFileNameWithoutPath(multipartFile):dir+"/"+getFileNameWithoutPath(multipartFile);
|
||||||
aliYunOssUtils.uploadFile(dir, multipartFile);
|
if (filePath.charAt(0) == '/') {
|
||||||
|
filePath= filePath.substring(1);
|
||||||
|
}
|
||||||
|
aliYunOssUtils.uploadFile(filePath, multipartFile);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// 构建完整目录:基准目录 + dir子目录
|
// 构建完整目录:基准目录 + dir子目录
|
||||||
@@ -144,8 +157,11 @@ public class FileStorageUtil {
|
|||||||
filePath = dir + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
filePath = dir + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
||||||
obsUtil.uploadMultipart(multipartFile, filePath);
|
obsUtil.uploadMultipart(multipartFile, filePath);
|
||||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
filePath = dir;
|
filePath = dir.endsWith("/")?dir+getFileNameWithoutPath(multipartFile):dir+"/"+getFileNameWithoutPath(multipartFile);
|
||||||
aliYunOssUtils.uploadFile(dir, multipartFile);
|
if (filePath.charAt(0) == '/') {
|
||||||
|
filePath= filePath.substring(1);
|
||||||
|
}
|
||||||
|
aliYunOssUtils.uploadFile(filePath, multipartFile);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
//把名称存入数据
|
//把名称存入数据
|
||||||
@@ -157,6 +173,15 @@ public class FileStorageUtil {
|
|||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
public static String getFileNameWithoutPath(MultipartFile file) {
|
||||||
|
String originalFilename = file.getOriginalFilename();
|
||||||
|
if (originalFilename == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 统一分隔符为 '/',再取最后一部分
|
||||||
|
String normalized = originalFilename.replace('\\', '/');
|
||||||
|
return normalized.substring(normalized.lastIndexOf('/') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 上传InputStream流,
|
* 上传InputStream流,
|
||||||
@@ -442,4 +467,62 @@ public class FileStorageUtil {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void mkdir(String directoryPath) {
|
||||||
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
|
this.createDirectoryHW(directoryPath);
|
||||||
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||||
|
minIoUtils.createDirectory(minIossProperties.getBucket(), directoryPath);
|
||||||
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
this.createDirectoryAli(directoryPath);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 华为文件服务器创建空目录
|
||||||
|
*
|
||||||
|
* @param dirPath
|
||||||
|
*/
|
||||||
|
private void createDirectoryHW(String dirPath) {
|
||||||
|
ObsClient obsClient = null;
|
||||||
|
try {
|
||||||
|
obsClient = this.huaweiObsProperties.getInstance();
|
||||||
|
String bucketName = this.huaweiObsProperties.getObs().getBucket();
|
||||||
|
|
||||||
|
// 确保路径以 / 结尾
|
||||||
|
String directoryKey = dirPath.endsWith("/") ? dirPath : dirPath + "/";
|
||||||
|
|
||||||
|
// 创建空对象作为目录占位符
|
||||||
|
InputStream emptyStream = new ByteArrayInputStream(new byte[0]);
|
||||||
|
PutObjectRequest request = new PutObjectRequest(bucketName, directoryKey, emptyStream);
|
||||||
|
obsClient.putObject(request);
|
||||||
|
|
||||||
|
log.info("已创建目录占位符:" + directoryKey);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("创建目录失败" + dirPath, e);
|
||||||
|
} finally {
|
||||||
|
this.huaweiObsProperties.destroy(obsClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云文件服务器创建空目录
|
||||||
|
*
|
||||||
|
* @param dirPath
|
||||||
|
*/
|
||||||
|
public void createDirectoryAli(String dirPath) {
|
||||||
|
try {
|
||||||
|
// 确保路径以 / 结尾,表示目录
|
||||||
|
String directoryKey = dirPath.endsWith("/") ? dirPath : dirPath + "/";
|
||||||
|
|
||||||
|
// 创建空输入流作为目录占位符
|
||||||
|
ByteArrayInputStream emptyStream = new ByteArrayInputStream(new byte[0]);
|
||||||
|
|
||||||
|
this.ossClient.putObject(this.ossConfig.getBucket(), directoryKey, emptyStream);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("创建目录失败:" + dirPath, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,18 +239,47 @@ public class ExcelUtil {
|
|||||||
* @param strings 下拉内容
|
* @param strings 下拉内容
|
||||||
*/
|
*/
|
||||||
public static void selectList(Workbook workbook, int firstCol, int lastCol, String[] strings) {
|
public static void selectList(Workbook workbook, int firstCol, int lastCol, String[] strings) {
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
// Sheet sheet = workbook.getSheetAt(0);
|
||||||
// 生成下拉列表
|
// // 生成下拉列表
|
||||||
// 只对(x,x)单元格有效
|
// // 只对(x,x)单元格有效
|
||||||
CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(2, 65535, firstCol, lastCol);
|
// CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(2, 65535, firstCol, lastCol);
|
||||||
// 生成下拉框内容
|
// // 生成下拉框内容
|
||||||
DataValidationHelper dvHelper = sheet.getDataValidationHelper();
|
// DataValidationHelper dvHelper = sheet.getDataValidationHelper();
|
||||||
XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)
|
// XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)
|
||||||
dvHelper.createExplicitListConstraint(strings);
|
// dvHelper.createExplicitListConstraint(strings);
|
||||||
XSSFDataValidation validation = (XSSFDataValidation) dvHelper.createValidation(
|
// XSSFDataValidation validation = (XSSFDataValidation) dvHelper.createValidation(
|
||||||
dvConstraint, cellRangeAddressList);
|
// dvConstraint, cellRangeAddressList);
|
||||||
// 对sheet页生效
|
// // 对sheet页生效
|
||||||
sheet.addValidationData(validation);
|
// sheet.addValidationData(validation);
|
||||||
|
|
||||||
|
Sheet targetSheet = workbook.getSheetAt(0);
|
||||||
|
|
||||||
|
// ===================== 关键:每个下拉用唯一名称的隐藏Sheet =====================
|
||||||
|
String uniqueHiddenName = "dropdown_" + firstCol + "_" + lastCol + "_" + System.currentTimeMillis();
|
||||||
|
Sheet hiddenSheet = workbook.createSheet(uniqueHiddenName);
|
||||||
|
// 隐藏数据源Sheet
|
||||||
|
workbook.setSheetHidden(workbook.getSheetIndex(hiddenSheet), true);
|
||||||
|
|
||||||
|
// 写入选项到隐藏Sheet
|
||||||
|
for (int i = 0; i < strings.length; i++) {
|
||||||
|
Row row = hiddenSheet.createRow(i);
|
||||||
|
Cell cell = row.createCell(0);
|
||||||
|
cell.setCellValue(strings[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造引用公式(无长度限制)
|
||||||
|
String formula = uniqueHiddenName + "!$A$1:$A$" + strings.length;
|
||||||
|
|
||||||
|
// 下拉作用范围:第3行 ~ 65536行
|
||||||
|
CellRangeAddressList range = new CellRangeAddressList(2, 65535, firstCol, lastCol);
|
||||||
|
DataValidationHelper helper = targetSheet.getDataValidationHelper();
|
||||||
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(formula);
|
||||||
|
DataValidation validation = helper.createValidation(constraint, range);
|
||||||
|
|
||||||
|
// 必加:防止下拉冲突、不显示
|
||||||
|
validation.setShowErrorBox(true);
|
||||||
|
validation.setShowPromptBox(true);
|
||||||
|
targetSheet.addValidationData(validation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,13 +4,15 @@ import cn.hutool.core.io.FileUtil;
|
|||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
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 org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -76,6 +78,59 @@ public class PoiUtil {
|
|||||||
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
||||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||||
response.setContentType("application/octet-stream;charset=" + CharsetUtil.UTF_8);
|
response.setContentType("application/octet-stream;charset=" + CharsetUtil.UTF_8);
|
||||||
|
//将带*号的列变成红色
|
||||||
|
Sheet sheetAt = workbook.getSheetAt(0);
|
||||||
|
//获取列数
|
||||||
|
int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells();
|
||||||
|
//没有表格标题,只有表格头
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
//获取行
|
||||||
|
Row row = sheetAt.getRow(i);
|
||||||
|
if (Objects.isNull(row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int j = 0; j < physicalNumberOfCells; j++) {
|
||||||
|
//获取单元格对象
|
||||||
|
Cell cell = row.getCell(j);
|
||||||
|
//获取单元格样式对象
|
||||||
|
CellStyle cellStyle = workbook.createCellStyle();
|
||||||
|
//获取单元格内容对象
|
||||||
|
Font font = workbook.createFont();
|
||||||
|
font.setFontHeightInPoints((short) 12);
|
||||||
|
//一定要装入 样式中才会生效
|
||||||
|
cellStyle.setFont(font);
|
||||||
|
//设置居中对齐
|
||||||
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||||
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
//设置单元格字体颜色
|
||||||
|
cell.setCellStyle(cellStyle);
|
||||||
|
//获取当前值
|
||||||
|
String stringCellValue = cell.getStringCellValue();
|
||||||
|
if (stringCellValue.contains("*")) {
|
||||||
|
// 创建一个富文本
|
||||||
|
XSSFRichTextString xssfRichTextString = new XSSFRichTextString(stringCellValue);
|
||||||
|
int startIndex = stringCellValue.indexOf("*");
|
||||||
|
int entIndex = stringCellValue.lastIndexOf("*");
|
||||||
|
if (entIndex != 0) {
|
||||||
|
Font font3 = workbook.createFont();
|
||||||
|
font3.setFontHeightInPoints((short) 12);
|
||||||
|
font3.setColor(Font.COLOR_NORMAL);
|
||||||
|
xssfRichTextString.applyFont(0, entIndex, font3);
|
||||||
|
}
|
||||||
|
//设置带*样式
|
||||||
|
Font font1 = workbook.createFont();
|
||||||
|
font1.setFontHeightInPoints((short) 12);
|
||||||
|
font1.setColor(Font.COLOR_RED);
|
||||||
|
xssfRichTextString.applyFont(startIndex, entIndex + 1, font1);
|
||||||
|
//其他样式
|
||||||
|
Font font2 = workbook.createFont();
|
||||||
|
font2.setFontHeightInPoints((short) 12);
|
||||||
|
font2.setColor(Font.COLOR_NORMAL);
|
||||||
|
xssfRichTextString.applyFont(entIndex + 1, stringCellValue.length(), font2);
|
||||||
|
cell.setCellValue(xssfRichTextString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
workbook.write(outputStream);
|
workbook.write(outputStream);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -115,4 +115,8 @@ public interface AppRedisKey {
|
|||||||
* 补召文件
|
* 补召文件
|
||||||
*/
|
*/
|
||||||
String MAKE_UP_FILES = "makeUpFilesKey:";
|
String MAKE_UP_FILES = "makeUpFilesKey:";
|
||||||
|
|
||||||
|
String COMMON_REQUEST = "commonRequestKey:";
|
||||||
|
|
||||||
|
String COMMON_RESOPNSE = "commonResponseKey:";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package com.njcn.redis.utils;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.data.redis.core.RedisCallback;
|
import org.springframework.data.redis.core.*;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -325,13 +323,54 @@ public class RedisUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<?> getLikeListAllValues(String key) {
|
public List<?> getLikeListAllValues(String key) {
|
||||||
List<Object> info=new ArrayList<>();
|
List<Object> info = new ArrayList<>();
|
||||||
for (String s : redisTemplate.keys(key + "*")) {
|
// 使用 SCAN 替代 keys,解决 Tair 禁用 KEYS 命令的问题
|
||||||
|
Set<String> keys = redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||||
|
Set<String> keySet = new HashSet<>();
|
||||||
|
ScanOptions options = ScanOptions.scanOptions()
|
||||||
|
.match(key + "*")
|
||||||
|
.count(1000)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (Cursor<byte[]> cursor = connection.scan(options)) {
|
||||||
|
while (cursor.hasNext()) {
|
||||||
|
keySet.add(new String(cursor.next()));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Redis SCAN 模糊查询失败", e);
|
||||||
|
}
|
||||||
|
return keySet;
|
||||||
|
});
|
||||||
|
for (String s : keys) {
|
||||||
info.add(redisTemplate.opsForValue().get(s));
|
info.add(redisTemplate.opsForValue().get(s));
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据key模糊查询,并取出所有符合条件的key集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Set<String> scanKeysByPattern(String pattern, int count) {
|
||||||
|
Set<String> keys = new HashSet<>();
|
||||||
|
ScanOptions options = ScanOptions.scanOptions()
|
||||||
|
.match(pattern)
|
||||||
|
.count(count)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (Cursor<byte[]> cursor = redisTemplate.getConnectionFactory()
|
||||||
|
.getConnection()
|
||||||
|
.scan(options)) {
|
||||||
|
while (cursor.hasNext()) {
|
||||||
|
keys.add(new String(cursor.next()));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("扫描Redis keys失败", e);
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据切库
|
* 数据切库
|
||||||
* @param dbIndex
|
* @param dbIndex
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class Knife4jSwaggerConfig {
|
|||||||
"com.njcn.prepare.harmonic.controller",
|
"com.njcn.prepare.harmonic.controller",
|
||||||
"com.njcn.prepare.event.controller",
|
"com.njcn.prepare.event.controller",
|
||||||
"com.njcn.device.pq.controller",
|
"com.njcn.device.pq.controller",
|
||||||
|
"com.njcn.device.terminal.controller",
|
||||||
"com.njcn.device.pms.controller",
|
"com.njcn.device.pms.controller",
|
||||||
"com.njcn.auth.controller",
|
"com.njcn.auth.controller",
|
||||||
"com.njcn.system.controller",
|
"com.njcn.system.controller",
|
||||||
@@ -74,6 +75,7 @@ public class Knife4jSwaggerConfig {
|
|||||||
"com.njcn.cswarn.controller",
|
"com.njcn.cswarn.controller",
|
||||||
"com.njcn.csharmonic.controller",
|
"com.njcn.csharmonic.controller",
|
||||||
"com.njcn.cssystem.controller",
|
"com.njcn.cssystem.controller",
|
||||||
|
"com.njcn.csreport.controller",
|
||||||
"com.njcn.advance.controller",
|
"com.njcn.advance.controller",
|
||||||
"com.njcn.stat.controller",
|
"com.njcn.stat.controller",
|
||||||
"com.njcn.rt.controller",
|
"com.njcn.rt.controller",
|
||||||
@@ -86,7 +88,9 @@ public class Knife4jSwaggerConfig {
|
|||||||
"com.njcn.dataProcess",
|
"com.njcn.dataProcess",
|
||||||
"com.njcn.migration",
|
"com.njcn.migration",
|
||||||
"com.njcn.harmonic.rstatlimitrate.controller",
|
"com.njcn.harmonic.rstatlimitrate.controller",
|
||||||
"com.njcn.device.device.controller"
|
"com.njcn.device.device.controller",
|
||||||
|
"com.njcn.device.userledger.controller",
|
||||||
|
"com.njcn.migration.read.controller"
|
||||||
)
|
)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
List<GrantType> grantTypes = new ArrayList<>();
|
List<GrantType> grantTypes = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.njcn.web.utils;
|
package com.njcn.web.utils;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.*;
|
import org.springframework.http.*;
|
||||||
@@ -149,7 +152,8 @@ public class RestTemplateUtil {
|
|||||||
* @return ResponseEntity 响应对象封装类
|
* @return ResponseEntity 响应对象封装类
|
||||||
*/
|
*/
|
||||||
public static <T> ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType) {
|
public static <T> ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType) {
|
||||||
return restTemplate.postForEntity(url, requestBody, responseType);
|
Object actualBody = convertHutoolJsonToStandard(requestBody);
|
||||||
|
return restTemplate.postForEntity(url, actualBody, responseType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,7 +166,8 @@ public class RestTemplateUtil {
|
|||||||
* @return ResponseEntity 响应对象封装类
|
* @return ResponseEntity 响应对象封装类
|
||||||
*/
|
*/
|
||||||
public static <T> ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType, Object... uriVariables) {
|
public static <T> ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType, Object... uriVariables) {
|
||||||
return restTemplate.postForEntity(url, requestBody, responseType, uriVariables);
|
Object actualBody = convertHutoolJsonToStandard(requestBody);
|
||||||
|
return restTemplate.postForEntity(url, actualBody, responseType, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -175,7 +180,21 @@ public class RestTemplateUtil {
|
|||||||
* @return ResponseEntity 响应对象封装类
|
* @return ResponseEntity 响应对象封装类
|
||||||
*/
|
*/
|
||||||
public static <T> ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) {
|
public static <T> ResponseEntity<T> post(String url, Object requestBody, Class<T> responseType, Map<String, ?> uriVariables) {
|
||||||
return restTemplate.postForEntity(url, requestBody, responseType, uriVariables);
|
Object actualBody = convertHutoolJsonToStandard(requestBody);
|
||||||
|
return restTemplate.postForEntity(url, actualBody, responseType, uriVariables);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object convertHutoolJsonToStandard(Object requestBody) {
|
||||||
|
if (requestBody instanceof JSONObject || requestBody instanceof JSONArray) {
|
||||||
|
try {
|
||||||
|
com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
|
||||||
|
return objectMapper.readValue(JSONUtil.toJsonStr(requestBody), Object.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Hutool JSON转标准结构失败,尝试直接使用字符串", e);
|
||||||
|
return requestBody;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return requestBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,14 +19,16 @@ public enum RunFlagEnum {
|
|||||||
QUIT(4, "退运"),
|
QUIT(4, "退运"),
|
||||||
|
|
||||||
|
|
||||||
|
POWER_FLAG(0,"电网侧"),
|
||||||
|
NO_POWER_FLAG(1,"非电网侧"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GW_FLAG(0,"主网"),
|
GW_FLAG(0,"主网"),
|
||||||
PW_FLAG(1,"配网"),
|
PW_FLAG(1,"配网"),
|
||||||
|
|
||||||
|
I_SORT(1,"I类测点"),
|
||||||
|
II_SORT(2,"II类测点"),
|
||||||
|
III_SORT(3,"III类测点"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ public class LineALLInfoDTO {
|
|||||||
private Integer num;
|
private Integer num;
|
||||||
@ApiModelProperty(name = "objName",value = "监测点对象名称")
|
@ApiModelProperty(name = "objName",value = "监测点对象名称")
|
||||||
private String objName;
|
private String objName;
|
||||||
|
@ApiModelProperty(name = "objName",value = "电网侧监测点对象名称Id")
|
||||||
|
private String objId;
|
||||||
|
@ApiModelProperty(name = "objName",value = "电网侧监测点对象名称")
|
||||||
|
private String objName2;
|
||||||
|
|
||||||
@ApiModelProperty(name = "loadType",value = "监测对象类型")
|
@ApiModelProperty(name = "loadType",value = "监测对象类型")
|
||||||
private String loadType;
|
private String loadType;
|
||||||
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
|
@ApiModelProperty(name = "voltageLevel",value = "电压等级")
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ public class MonitorCommLedgerInfoDTO implements Serializable {
|
|||||||
|
|
||||||
private String busBarName;
|
private String busBarName;
|
||||||
|
|
||||||
|
private String objName;
|
||||||
|
|
||||||
|
|
||||||
private String voltageLevel;
|
private String voltageLevel;
|
||||||
|
|
||||||
private String shortCapacity;
|
private String shortCapacity;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.njcn.device.biz.pojo.po;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.njcn.device.biz.utils.COverlimit;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import java.util.Objects;
|
|||||||
*/
|
*/
|
||||||
public class COverlimitUtil {
|
public class COverlimitUtil {
|
||||||
|
|
||||||
|
/** 配网占位默认值 */
|
||||||
|
private static final float PLACEHOLDER = -3.14159f;
|
||||||
/**
|
/**
|
||||||
* 谐波电流系数
|
* 谐波电流系数
|
||||||
*/
|
*/
|
||||||
@@ -34,38 +35,76 @@ public class COverlimitUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算监测点限值
|
* 计算监测点限值
|
||||||
* @param voltageLevel 电压等级(10kV = 10 220kV = 220 )
|
* @param voltageLevel 电压等级(kV)
|
||||||
* @param protocolCapacity 协议容量
|
* @param protocolCapacity 协议容量(MVA)
|
||||||
* @param devCapacity 设备容量
|
* @param devCapacity 供电设备容量(MVA),为空/0自动取对应电压默认值
|
||||||
* @param shortCapacity 短路容量
|
* @param shortCapacity 实际最小短路容量(MVA)
|
||||||
* @param powerFlag 0.用户侧 1.电网侧
|
* @param powerFlag 0=电网侧(不执行两步计算) 1=非电网侧/用户侧(执行两步计算)
|
||||||
* @param lineType 0.主网 1.配网 需要注意配网目前没有四种容量,谐波电流幅值限值,负序电流限值无法计算默认-3.14159
|
* @param pointClass 配网点类型 0=Ⅱ类 1=Ⅲ类光伏;主网该字段传0即可
|
||||||
*/
|
*/
|
||||||
public static Overlimit globalAssemble(Float voltageLevel, Float protocolCapacity, Float devCapacity,
|
public static Overlimit globalAssemble(Float voltageLevel, Float protocolCapacity, Float devCapacity,
|
||||||
Float shortCapacity, Integer powerFlag, Integer lineType) {
|
Float shortCapacity, Integer powerFlag,Integer pointClass) {
|
||||||
Overlimit overlimit = new Overlimit();
|
Overlimit overlimit = new Overlimit();
|
||||||
voltageDeviation(overlimit,voltageLevel);
|
voltageDeviation(overlimit, voltageLevel);
|
||||||
frequency(overlimit);
|
frequency(overlimit);
|
||||||
voltageFluctuation(overlimit,voltageLevel);
|
voltageFluctuation(overlimit, voltageLevel);
|
||||||
voltageFlicker(overlimit,voltageLevel);
|
voltageFlicker(overlimit, voltageLevel);
|
||||||
totalHarmonicDistortion(overlimit,voltageLevel);
|
totalHarmonicDistortion(overlimit, voltageLevel);
|
||||||
uHarm(overlimit,voltageLevel);
|
uHarm(overlimit, voltageLevel);
|
||||||
threeVoltageUnbalance(overlimit);
|
threeVoltageUnbalance(overlimit);
|
||||||
interharmonicCurrent(overlimit,voltageLevel);
|
interharmonicCurrent(overlimit, voltageLevel);
|
||||||
|
|
||||||
if(Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
|
//谐波电流限值
|
||||||
//配网
|
int lineType;
|
||||||
|
if (voltageLevel >= DicDataEnum.KV220.getValue()) {
|
||||||
|
lineType = 0; // 主网
|
||||||
|
} else {
|
||||||
|
lineType = 1; // 配网(110、66、35、10kV)
|
||||||
|
}
|
||||||
|
float sc = Objects.isNull(shortCapacity) ? 0f : shortCapacity;
|
||||||
|
float pc = Objects.isNull(protocolCapacity) ? 0f : protocolCapacity;
|
||||||
|
|
||||||
|
float dc;
|
||||||
|
if (Objects.isNull(devCapacity) || devCapacity <= 0) {
|
||||||
|
dc = getDefaultDevCapacity(voltageLevel);
|
||||||
|
} else {
|
||||||
|
dc = devCapacity;
|
||||||
|
}
|
||||||
|
// 1. 配网 lineType = 1
|
||||||
|
if (Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
|
||||||
|
overlimit.setINeg(PLACEHOLDER);
|
||||||
Float[] iHarmTem = new Float[49];
|
Float[] iHarmTem = new Float[49];
|
||||||
for (int i = 0; i <= 48; i++) {
|
|
||||||
//目前只处理了配网II类测点,III类测点暂未处理,III类测点参考主网
|
// 配网-电网侧(powerFlag=0) / 配网Ⅱ类:直接基准限值,不折算
|
||||||
iHarmTem[i] = getHarmTag(i+2,voltageLevel).floatValue();
|
if (Objects.equals(powerFlag,RunFlagEnum.POWER_FLAG.getStatus()) || Objects.equals(pointClass, 0)) {
|
||||||
|
for (int i = 0; i <= 48; i++) {
|
||||||
|
iHarmTem[i] = getHarmTag(i + 2, voltageLevel).floatValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 配网-非电网侧 且 Ⅲ类光伏:两步计算,折算系数固定为1
|
||||||
|
else {
|
||||||
|
float calCap = 1.0f;
|
||||||
|
for (int i = 0; i <= 48; i++) {
|
||||||
|
float inHarm = iHarmCalculate(i + 2, voltageLevel, pc, dc, calCap);
|
||||||
|
iHarmTem[i] = inHarm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
overlimit.buildIHarm(iHarmTem);
|
overlimit.buildIHarm(iHarmTem);
|
||||||
overlimit.setINeg(-3.14159f);
|
} else {
|
||||||
}else {
|
// 主网-电网侧(powerFlag=0):直接基准限值
|
||||||
//主网
|
if (Objects.equals(powerFlag, RunFlagEnum.POWER_FLAG.getStatus())) {
|
||||||
iHarm(overlimit, voltageLevel, protocolCapacity, devCapacity, shortCapacity);
|
Float[] iHarmTem = new Float[49];
|
||||||
negativeSequenceCurrent(overlimit, voltageLevel, shortCapacity);
|
for (int i = 0; i <= 48; i++) {
|
||||||
|
iHarmTem[i] = getHarmTag(i + 2, voltageLevel).floatValue();
|
||||||
|
}
|
||||||
|
overlimit.buildIHarm(iHarmTem);
|
||||||
|
}
|
||||||
|
// 主网-非电网侧/用户侧(风光场站):完整两步计算
|
||||||
|
else {
|
||||||
|
iHarm(overlimit, voltageLevel, pc, dc, sc);
|
||||||
|
}
|
||||||
|
// 主网统一计算负序电流
|
||||||
|
negativeSequenceCurrent(overlimit, voltageLevel, sc);
|
||||||
}
|
}
|
||||||
return overlimit;
|
return overlimit;
|
||||||
}
|
}
|
||||||
@@ -304,6 +343,30 @@ public class COverlimitUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据电压等级获取【默认公共连接点供电设备容量】St(MVA)
|
||||||
|
* 无实际台账容量时兜底使用
|
||||||
|
*/
|
||||||
|
public static float getDefaultDevCapacity(Float voltageLevel) {
|
||||||
|
if (voltageLevel < 0.4f) {
|
||||||
|
return 1.0f;
|
||||||
|
} else if (voltageLevel < 6f) {
|
||||||
|
return 100f;
|
||||||
|
} else if (voltageLevel < 20f) {
|
||||||
|
return 200f;
|
||||||
|
} else if (voltageLevel < 35f) {
|
||||||
|
return 500f;
|
||||||
|
} else if (voltageLevel < 66f) {
|
||||||
|
return 800f;
|
||||||
|
} else if (voltageLevel < 110f) {
|
||||||
|
return 1000f;
|
||||||
|
} else if (voltageLevel < 220f) {
|
||||||
|
return 2000f;
|
||||||
|
} else {
|
||||||
|
return 3000f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------谐波电流限值end-----------------------------------*/
|
/*---------------------------------谐波电流限值end-----------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
@@ -376,8 +439,9 @@ public class COverlimitUtil {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("sss");
|
System.out.println("sss");
|
||||||
float aa = iHarmCalculate(9,500f,10,10,0.002222222222f);
|
Overlimit overlimit = new Overlimit();
|
||||||
|
iHarm(overlimit, 220f, 100f, 100f, 2000f);
|
||||||
|
|
||||||
System.out.println(aa);
|
System.out.println(overlimit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
67
pqs-device/device-boot/src/main/resources/bootstrap-jb.yml
Normal file
67
pqs-device/device-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10202
|
||||||
|
max-http-header-size: 1048576
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-Id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
#上传文件总的最大值
|
||||||
|
max-request-size: 200MB
|
||||||
|
#上传文件的最大值
|
||||||
|
max-file-size: 200MB
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
||||||
|
|
||||||
|
#是否是冀北设备台账树
|
||||||
|
isJb: false
|
||||||
|
|
||||||
|
oracle:
|
||||||
|
isSync: false
|
||||||
|
syncLedgerLineUrl: http://localhost:8082/export/syncLedgerLine
|
||||||
|
syncLedgerUpdateLine: http://localhost:8082/export/syncLedgerUpdateLine
|
||||||
|
syncLedgerDeleteLine: http://localhost:8082/export/syncLedgerDeleteLine
|
||||||
72
pqs-device/device-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
72
pqs-device/device-boot/src/main/resources/bootstrap-sjzx.yml
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10202
|
||||||
|
max-http-header-size: 1048576
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
ip: @service.server.url@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
file-extension: yaml
|
||||||
|
shared-configs:
|
||||||
|
- data-id: share-config.yaml
|
||||||
|
refresh: true
|
||||||
|
- data-id: share-config-datasource-db.yaml
|
||||||
|
refresh: true
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
#上传文件总的最大值
|
||||||
|
max-request-size: 200MB
|
||||||
|
#上传文件的最大值
|
||||||
|
max-file-size: 200MB
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
||||||
|
|
||||||
|
#是否是冀北设备台账树
|
||||||
|
isJb: false
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
|
oracle:
|
||||||
|
isSync: false
|
||||||
|
syncLedgerLineUrl: http://localhost:8082/export/syncLedgerLine
|
||||||
|
syncLedgerUpdateLine: http://localhost:8082/export/syncLedgerUpdateLine
|
||||||
|
syncLedgerDeleteLine: http://localhost:8082/export/syncLedgerDeleteLine
|
||||||
@@ -1,68 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10202
|
|
||||||
max-http-header-size: 1048576
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#nacos注册中心以及配置中心的指定
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
ip: @service.server.url@
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
config:
|
|
||||||
server-addr: @nacos.url@
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
file-extension: yaml
|
|
||||||
shared-configs:
|
|
||||||
- data-id: share-config.yaml
|
|
||||||
refresh: true
|
|
||||||
- data-Id: share-config-datasource-db.yaml
|
|
||||||
refresh: true
|
|
||||||
main:
|
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
#上传文件总的最大值
|
|
||||||
max-request-size: 200MB
|
|
||||||
#上传文件的最大值
|
|
||||||
max-file-size: 200MB
|
|
||||||
|
|
||||||
#项目日志的配置
|
|
||||||
#项目日志的配置
|
|
||||||
logging:
|
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
|
||||||
level:
|
|
||||||
root: info
|
|
||||||
|
|
||||||
|
|
||||||
#mybatis配置信息
|
|
||||||
mybatis-plus:
|
|
||||||
#别名扫描
|
|
||||||
type-aliases-package: com.njcn.device.pq.pojo,com.njcn.device.pms.pojo,com.njcn.device.biz.pojo.dto
|
|
||||||
|
|
||||||
#是否是冀北设备台账树
|
|
||||||
isJb: false
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
|
|
||||||
oracle:
|
|
||||||
isSync: false
|
|
||||||
syncLedgerLineUrl: http://localhost:8082/export/syncLedgerLine
|
|
||||||
syncLedgerUpdateLine: http://localhost:8082/export/syncLedgerUpdateLine
|
|
||||||
syncLedgerDeleteLine: http://localhost:8082/export/syncLedgerDeleteLine
|
|
||||||
@@ -27,6 +27,12 @@
|
|||||||
<artifactId>pqs-influx</artifactId>
|
<artifactId>pqs-influx</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>supervision-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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.UserLedgerFeignClientFallbackFactory;
|
||||||
|
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||||
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
|
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||||
|
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||||
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程实例 Api 接口
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.DEVICE, path = "/userReport", fallbackFactory = UserLedgerFeignClientFallbackFactory.class)
|
||||||
|
public interface UserLedgerFeignClient {
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/selectUserList")
|
||||||
|
HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam);
|
||||||
|
|
||||||
|
@GetMapping("/selectUserInfo")
|
||||||
|
HttpResult<UserLedgerVO> selectUserInfo(@RequestParam("id") String id);
|
||||||
|
|
||||||
|
@PostMapping(value = "/bindUserStation")
|
||||||
|
HttpResult<List<UserLedgerVO>> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId);
|
||||||
|
|
||||||
|
@PostMapping("/getUserReportByIds")
|
||||||
|
HttpResult<List<NewUserReportVO>> getUserReportByIds(@RequestBody List<String> ids);
|
||||||
|
|
||||||
|
@PostMapping("/getSensitiveUserByDept")
|
||||||
|
@ApiOperation("根据部门获取敏感用户信息")
|
||||||
|
HttpResult<List<UserReportPO>> getSensitiveUserByDept(@RequestBody @Validated SensitiveUserParam param) ;
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.njcn.supervision.api.fallback;
|
package com.njcn.device.pq.api.fallback;
|
||||||
|
|
||||||
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 com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
import com.njcn.device.pq.api.UserLedgerFeignClient;
|
||||||
|
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
|
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
import com.njcn.supervision.utils.SupervisionEnumUtil;
|
||||||
@@ -52,6 +54,12 @@ public class UserLedgerFeignClientFallbackFactory implements FallbackFactory<Use
|
|||||||
log.error("{}异常,降级处理,异常为:{}", "根据ids获取非电网侧用户信息", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "根据ids获取非电网侧用户信息", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<UserReportPO>> getSensitiveUserByDept(SensitiveUserParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "根据部门获取敏感用户信息异常", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,65 +22,65 @@ import java.math.BigDecimal;
|
|||||||
public class TerminalBaseExcel implements Serializable {
|
public class TerminalBaseExcel implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "项目", width = 15)
|
@Excel(name = "*项目", width = 15)
|
||||||
@NotBlank(message = DeviceValidMessage.PROJECT_NAME_NOT)
|
@NotBlank(message = DeviceValidMessage.PROJECT_NAME_NOT)
|
||||||
@Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = DeviceValidMessage.PROJECT_NAME_RULE)
|
@Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = DeviceValidMessage.PROJECT_NAME_RULE)
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
@Excel(name = "工程", width = 15)
|
@Excel(name = "*省份", width = 15)
|
||||||
@NotBlank(message = DeviceValidMessage.PROVINCE_NAME_NOT)
|
@NotBlank(message = DeviceValidMessage.PROVINCE_NAME_NOT)
|
||||||
private String provinceName;
|
private String provinceName;
|
||||||
|
|
||||||
@Excel(name = "单位", width = 15)
|
@Excel(name = "*供电公司", width = 15)
|
||||||
@NotBlank(message = "供电公司名称")
|
@NotBlank(message = "供电公司名称")
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "供电公司名称违规")
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "供电公司名称违规")
|
||||||
private String gdName;
|
private String gdName;
|
||||||
|
|
||||||
@Excel(name = "部门", width = 15)
|
@Excel(name = "*变电站", width = 15)
|
||||||
@NotBlank(message = "变电站名称不可为空")
|
@NotBlank(message = "变电站名称不可为空")
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "变电站名称违规")
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "变电站名称违规")
|
||||||
private String substationName;
|
private String substationName;
|
||||||
|
|
||||||
@Excel(name = "部门电压等级", width = 15)
|
@Excel(name = "*变电站电压等级", width = 15)
|
||||||
@NotBlank(message = "电压等级不可为空")
|
@NotBlank(message = "变电站电压等级不可为空")
|
||||||
private String subStationScale;
|
private String subStationScale;
|
||||||
|
|
||||||
@Excel(name = "经度", width = 15)
|
@Excel(name = "*经度", width = 15)
|
||||||
private BigDecimal lng;
|
private BigDecimal lng;
|
||||||
|
|
||||||
@Excel(name = "纬度", width = 15)
|
@Excel(name = "*纬度", width = 15)
|
||||||
private BigDecimal lat;
|
private BigDecimal lat;
|
||||||
|
|
||||||
@Excel(name = "终端", width = 15)
|
@Excel(name = "*装置名称", width = 15)
|
||||||
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "设备名称违规")
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "装置名称违规")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
@Excel(name = "终端模型", replace = {"虚拟设备_0", "实际设备_1", "离线设备_2"}, width = 15)
|
@Excel(name = "*终端模型", replace = {"虚拟设备_0", "实际设备_1", "离线设备_2"}, width = 15)
|
||||||
@NotNull(message = "设备模型不能为空")
|
@NotNull(message = "设备模型不能为空")
|
||||||
private Integer devModel;
|
private Integer devModel;
|
||||||
|
|
||||||
@Excel(name = "数据类型", replace = {"暂态系统_0", "稳态系统_1", "双系统_2"}, width = 15)
|
@Excel(name = "*数据类型", replace = {"暂态系统_0", "稳态系统_1", "双系统_2"}, width = 15)
|
||||||
@NotNull(message = "数据类型不能为空")
|
@NotNull(message = "数据类型不能为空")
|
||||||
private Integer devDataType;
|
private Integer devDataType;
|
||||||
|
|
||||||
@Excel(name = "运行状态", replace = {"投运_0", "热备用_1", "停运_2"}, width = 15)
|
@Excel(name = "*运行状态", replace = {"投运_0", "热备用_1", "停运_2"}, width = 15)
|
||||||
@NotNull(message = "运行状态不能为空")
|
@NotNull(message = "运行状态不能为空")
|
||||||
private Integer runFlag;
|
private Integer runFlag;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "终端厂家", width = 15)
|
@Excel(name = "*终端厂家", width = 15)
|
||||||
@NotBlank(message = "终端厂家不能为空")
|
@NotBlank(message = "终端厂家不能为空")
|
||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|
||||||
@Excel(name = "设备型号", width = 15)
|
@Excel(name = "*设备型号", width = 15)
|
||||||
@NotBlank(message = "设备型号不能为空")
|
@NotBlank(message = "设备型号不能为空")
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
@Excel(name = "网络参数", width = 15)
|
@Excel(name = "*网络参数", width = 15)
|
||||||
@NotBlank(message = "设备网络参数不能为空")
|
@NotBlank(message = "设备网络参数不能为空")
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
@Excel(name = "端口", width = 15)
|
@Excel(name = "*端口", width = 15)
|
||||||
@Range(min = 1, max = 100000, message = "端口号违规")
|
@Range(min = 1, max = 100000, message = "端口号违规")
|
||||||
@NotNull(message = "设备端口号不能为空")
|
@NotNull(message = "设备端口号不能为空")
|
||||||
private Integer port;
|
private Integer port;
|
||||||
@@ -91,15 +91,15 @@ public class TerminalBaseExcel implements Serializable {
|
|||||||
@Excel(name = "终端秘钥", width = 15)
|
@Excel(name = "终端秘钥", width = 15)
|
||||||
private String devKey;
|
private String devKey;
|
||||||
|
|
||||||
@Excel(name = "召唤标志",replace = {"周期触发_0", "变为触发_1"}, width = 15)
|
@Excel(name = "*召唤标志",replace = {"周期触发_0", "变为触发_1"}, width = 15)
|
||||||
@NotNull(message = "召唤标志不为空")
|
@NotNull(message = "召唤标志不为空")
|
||||||
private Integer callFlag;
|
private Integer callFlag;
|
||||||
|
|
||||||
@Excel(name = "前置名称", width = 15)
|
@Excel(name = "*前置名称", width = 15)
|
||||||
@NotBlank(message = "前置名称不能为空")
|
@NotBlank(message = "前置名称不能为空")
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
|
|
||||||
@Excel(name = "前置类型", width = 15)
|
@Excel(name = "*前置类型", width = 15)
|
||||||
@NotBlank(message = "前置类型不能为空")
|
@NotBlank(message = "前置类型不能为空")
|
||||||
private String frontType;
|
private String frontType;
|
||||||
|
|
||||||
@@ -109,71 +109,71 @@ public class TerminalBaseExcel implements Serializable {
|
|||||||
@Excel(name = "SIM卡号", width = 15)
|
@Excel(name = "SIM卡号", width = 15)
|
||||||
private String sim;
|
private String sim;
|
||||||
|
|
||||||
@Excel(name = "母线", width = 15)
|
@Excel(name = "*母线", width = 15)
|
||||||
@NotBlank(message = "母线名称不能为空")
|
@NotBlank(message = "母线名称不能为空")
|
||||||
private String subvName;
|
private String subvName;
|
||||||
|
|
||||||
@Excel(name = "母线号", width = 15)
|
@Excel(name = "*母线号", width = 15)
|
||||||
@NotNull(message = "母线号不为空")
|
@NotNull(message = "母线号不为空")
|
||||||
private Integer subvNum;
|
private Integer subvNum;
|
||||||
|
|
||||||
@Excel(name = "母线电压等级", width = 15)
|
@Excel(name = "*母线电压等级", width = 15)
|
||||||
@NotBlank(message = "母线电压等级不能为空")
|
@NotBlank(message = "母线电压等级不能为空")
|
||||||
private String subvScale;
|
private String subvScale;
|
||||||
|
|
||||||
@Excel(name = "母线模型", replace = {"虚拟母线_0", "实际母线_1"}, width = 15)
|
@Excel(name = "*母线模型", replace = {"虚拟母线_0", "实际母线_1"}, width = 15)
|
||||||
@NotNull(message = "母线模型不为空")
|
@NotNull(message = "母线模型不为空")
|
||||||
private Integer subvModel;
|
private Integer subvModel;
|
||||||
|
|
||||||
|
|
||||||
@Excel(name = "监测点名称", width = 15)
|
@Excel(name = "*监测点名称", width = 15)
|
||||||
@NotBlank(message = "监测点名称不能为空")
|
@NotBlank(message = "监测点名称不能为空")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
@Excel(name = "监测点线路号", width = 15)
|
@Excel(name = "*监测点线路号", width = 15)
|
||||||
@NotNull(message = "监测点线路号不为空")
|
@NotNull(message = "监测点线路号不为空")
|
||||||
private Integer lineNum;
|
private Integer lineNum;
|
||||||
|
|
||||||
@Excel(name = "监测点等级", width = 15)
|
@Excel(name = "*监测点等级", width = 15)
|
||||||
private String lineGrade;
|
private String lineGrade;
|
||||||
|
|
||||||
@Excel(name = "pt", width = 20)
|
@Excel(name = "*pt(格式pt1/pt2)", width = 20)
|
||||||
@NotBlank(message = "pt不能为空")
|
@NotBlank(message = "pt不能为空")
|
||||||
private String pt;
|
private String pt;
|
||||||
|
|
||||||
@Excel(name = "ct", width = 20)
|
@Excel(name = "*ct(格式ct1/ct2)", width = 20)
|
||||||
@NotBlank(message = "ct不能为空")
|
@NotBlank(message = "ct不能为空")
|
||||||
private String ct;
|
private String ct;
|
||||||
|
|
||||||
@Excel(name = "设备容量", width = 15)
|
@Excel(name = "*设备容量", width = 15)
|
||||||
@NotNull(message = "设备容量不为空")
|
@NotNull(message = "设备容量不为空")
|
||||||
private Float devCapacity;
|
private Float devCapacity;
|
||||||
|
|
||||||
@Excel(name = "短路容量", width = 15)
|
@Excel(name = "*短路容量", width = 15)
|
||||||
@NotNull(message = "短路容量不为空")
|
@NotNull(message = "短路容量不为空")
|
||||||
private Float shortCapacity;
|
private Float shortCapacity;
|
||||||
|
|
||||||
@Excel(name = "基准容量", width = 15)
|
@Excel(name = "*基准容量", width = 15)
|
||||||
@NotNull(message = "基准容量不为空")
|
@NotNull(message = "基准容量不为空")
|
||||||
private Float standardCapacity;
|
private Float standardCapacity;
|
||||||
|
|
||||||
@Excel(name = "协议容量", width = 15)
|
@Excel(name = "*协议容量", width = 15)
|
||||||
@NotNull(message = "协议容量不为空")
|
@NotNull(message = "协议容量不为空")
|
||||||
private Float dealCapacity;
|
private Float dealCapacity;
|
||||||
|
|
||||||
@Excel(name = "接线方式", replace = {"星型接法_0", "三角型接法_1", "开口三角型接法_2"}, width = 15)
|
@Excel(name = "*接线方式", replace = {"星型接法_0", "三角型接法_1", "开口三角型接法_2"}, width = 15)
|
||||||
@NotNull(message = "接线方式不为空")
|
@NotNull(message = "接线方式不为空")
|
||||||
private Integer ptType;
|
private Integer ptType;
|
||||||
|
|
||||||
@Excel(name = "测量间隔", width = 15)
|
@Excel(name = "*测量间隔", width = 15)
|
||||||
@NotNull(message = "测量间隔不为空")
|
@NotNull(message = "测量间隔不为空")
|
||||||
private Integer timeInterval;
|
private Integer timeInterval;
|
||||||
|
|
||||||
@Excel(name = "干扰源类型", width = 15)
|
@Excel(name = "*干扰源类型", width = 15)
|
||||||
@NotBlank(message = "干扰源类型不为空")
|
@NotBlank(message = "干扰源类型不为空")
|
||||||
private String loadType;
|
private String loadType;
|
||||||
|
|
||||||
@Excel(name = "行业类型", width = 15)
|
@Excel(name = "*行业类型", width = 15)
|
||||||
@NotBlank(message = "行业类型不为空")
|
@NotBlank(message = "行业类型不为空")
|
||||||
private String businessType;
|
private String businessType;
|
||||||
|
|
||||||
@@ -183,11 +183,11 @@ public class TerminalBaseExcel implements Serializable {
|
|||||||
@Excel(name = "监测点对象名称", width = 15)
|
@Excel(name = "监测点对象名称", width = 15)
|
||||||
private String objName;
|
private String objName;
|
||||||
|
|
||||||
@Excel(name = "电网侧标志", replace = {"电网侧_0", "非电网侧_1"}, width = 15)
|
@Excel(name = "*电网侧标志", replace = {"电网侧_0", "非电网侧_1"}, width = 15)
|
||||||
@NotNull(message = "电网侧标志不为空")
|
@NotNull(message = "电网侧标志不为空")
|
||||||
private Integer powerFlag;
|
private Integer powerFlag;
|
||||||
|
|
||||||
@Excel(name = "人为干预统计", replace = {"不参与统计_0", "参与统计_1"}, width = 15)
|
@Excel(name = "*人为干预统计", replace = {"不参与统计_0", "参与统计_1"}, width = 15)
|
||||||
@NotNull(message = "统计标志不为空")
|
@NotNull(message = "统计标志不为空")
|
||||||
private Integer statFlag;
|
private Integer statFlag;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.device.pq.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:请求装置文件系统参数
|
||||||
|
* Date: 2026/04/30 上午 10:51【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AskFileSysParam {
|
||||||
|
|
||||||
|
private String devId;
|
||||||
|
private String path;
|
||||||
|
private String remotePath;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.njcn.device.pq.pojo.po;
|
package com.njcn.device.pq.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -17,6 +19,7 @@ import java.io.Serializable;
|
|||||||
public class DeviceProcess implements Serializable {
|
public class DeviceProcess implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
//设备id
|
//设备id
|
||||||
|
@TableId("Id")
|
||||||
private String id;
|
private String id;
|
||||||
//设备设备所在前置机进程号
|
//设备设备所在前置机进程号
|
||||||
private Integer processNo;
|
private Integer processNo;
|
||||||
|
|||||||
@@ -105,6 +105,12 @@ public class LineDetailVO implements Serializable {
|
|||||||
@ApiModelProperty(name = "终端厂家")
|
@ApiModelProperty(name = "终端厂家")
|
||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "监测对象ID")
|
||||||
|
private String objId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "监测对象名称")
|
||||||
|
private String objName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ public class LineIntegrityDataVO implements Serializable {
|
|||||||
private Integer algoDescribe;
|
private Integer algoDescribe;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "devType",value = "终端型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
@ApiModelProperty(name = "loadType",value = "干扰源类型")
|
@ApiModelProperty(name = "loadType",value = "干扰源类型")
|
||||||
private String loadType;
|
private String loadType;
|
||||||
|
|||||||
@@ -59,4 +59,7 @@ public class RunTimeVO implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "onlineEvaluate",value = "在线率评价")
|
@ApiModelProperty(name = "onlineEvaluate",value = "在线率评价")
|
||||||
private Double onlineEvaluate;
|
private Double onlineEvaluate;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "objName",value = "用户对象名称")
|
||||||
|
private String objName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ public class DeviceOnlineRate {
|
|||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测对象")
|
||||||
|
private String objName;
|
||||||
|
|
||||||
@ApiModelProperty("监测点运行状态")
|
@ApiModelProperty("监测点运行状态")
|
||||||
private String runFlag;
|
private String runFlag;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.device.pq.pojo.vo.dataClean;
|
|||||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -72,6 +73,12 @@ public class DataVerifyExcel implements Serializable {
|
|||||||
@Excel(name = "厂商")
|
@Excel(name = "厂商")
|
||||||
private String manufacturer;
|
private String manufacturer;
|
||||||
|
|
||||||
|
@ColumnWidth(20)
|
||||||
|
@ExcelProperty(value = "电网标志")
|
||||||
|
@Excel(name = "电网标志")
|
||||||
|
@ApiModelProperty(name = "powerFlag",value = "电网标志")
|
||||||
|
private String powerFlag;
|
||||||
|
|
||||||
@ColumnWidth(20)
|
@ColumnWidth(20)
|
||||||
@ExcelProperty(value = "总指标异常时间")
|
@ExcelProperty(value = "总指标异常时间")
|
||||||
@Excel(name = "总指标异常时间")
|
@Excel(name = "总指标异常时间")
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.device.pq.utils;
|
package com.njcn.device.pq.utils;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
|
||||||
import com.njcn.device.pq.pojo.vo.dataClean.CityDataExcel;
|
import com.njcn.device.pq.pojo.vo.dataClean.CityDataExcel;
|
||||||
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
import com.njcn.device.pq.pojo.vo.dataClean.LineDataExcel;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class DataLineExcelUtil {
|
|||||||
List<List<Object>> result = new ArrayList<>();
|
List<List<Object>> result = new ArrayList<>();
|
||||||
if(CollUtil.isNotEmpty(data)){
|
if(CollUtil.isNotEmpty(data)){
|
||||||
for (LineDataExcel datum : data) {
|
for (LineDataExcel datum : data) {
|
||||||
ArrayList<Object> row = Lists.newArrayList(datum.getLineNum(),
|
ArrayList<Object> row = ListUtil.toList(datum.getLineNum(),
|
||||||
datum.getLineName(),
|
datum.getLineName(),
|
||||||
datum.getDeptName(),
|
datum.getDeptName(),
|
||||||
datum.getPowerSubstationName(),
|
datum.getPowerSubstationName(),
|
||||||
@@ -89,7 +89,7 @@ public class DataLineExcelUtil {
|
|||||||
List<List<Object>> result = new ArrayList<>();
|
List<List<Object>> result = new ArrayList<>();
|
||||||
if(CollUtil.isNotEmpty(data)){
|
if(CollUtil.isNotEmpty(data)){
|
||||||
for (CityDataExcel datum : data) {
|
for (CityDataExcel datum : data) {
|
||||||
ArrayList<Object> row = Lists.newArrayList(datum.getDeptName(),
|
ArrayList<Object> row = ListUtil.toList(datum.getDeptName(),
|
||||||
datum.getDeviceNum(),
|
datum.getDeviceNum(),
|
||||||
datum.getLineNum(),
|
datum.getLineNum(),
|
||||||
datum.getOnlineRate(),
|
datum.getOnlineRate(),
|
||||||
|
|||||||
@@ -132,8 +132,9 @@ public class FixedDynamicExcelExport {
|
|||||||
head.add(Collections.singletonList("监测对象名称"));
|
head.add(Collections.singletonList("监测对象名称"));
|
||||||
head.add(Collections.singletonList("电网侧变电站"));
|
head.add(Collections.singletonList("电网侧变电站"));
|
||||||
head.add(Collections.singletonList("厂商"));
|
head.add(Collections.singletonList("厂商"));
|
||||||
|
head.add(Collections.singletonList("电网标志"));
|
||||||
head.add(Collections.singletonList("总指标异常时间"));
|
head.add(Collections.singletonList("总指标异常时间"));
|
||||||
List<String> sortedFields = allFields.subList(10, allFields.size());
|
List<String> sortedFields = allFields.subList(11, allFields.size());
|
||||||
for (String field : sortedFields) {
|
for (String field : sortedFields) {
|
||||||
// 每个列名单独封装成List,EasyExcel才能识别为不同列
|
// 每个列名单独封装成List,EasyExcel才能识别为不同列
|
||||||
head.add(Collections.singletonList(DataVerifyExcel.FIELD_COLUMN_MAP.get(field)));
|
head.add(Collections.singletonList(DataVerifyExcel.FIELD_COLUMN_MAP.get(field)));
|
||||||
@@ -209,6 +210,7 @@ public class FixedDynamicExcelExport {
|
|||||||
fieldAlls.add("objName");
|
fieldAlls.add("objName");
|
||||||
fieldAlls.add("powerSubstationName");
|
fieldAlls.add("powerSubstationName");
|
||||||
fieldAlls.add("manufacturer");
|
fieldAlls.add("manufacturer");
|
||||||
|
fieldAlls.add("powerFlag");
|
||||||
fieldAlls.add("allTime");
|
fieldAlls.add("allTime");
|
||||||
fieldAlls.addAll(fields);
|
fieldAlls.addAll(fields);
|
||||||
return fieldAlls;
|
return fieldAlls;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.device.pq.controller;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
@@ -156,8 +157,10 @@ public class DataVerifyController extends BaseController {
|
|||||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||||
response.setContentType("application/vnd.ms-excel");
|
response.setContentType("application/vnd.ms-excel");
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
if(StrUtil.isNotBlank(monitorBaseParam.getSearchBeginTime())&&StrUtil.isNotBlank(monitorBaseParam.getSearchEndTime())){
|
||||||
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
monitorBaseParam.setSearchBeginTime(DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())).toString());
|
||||||
|
monitorBaseParam.setSearchEndTime(DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())).toString());
|
||||||
|
}
|
||||||
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ public class LineIntegrityDataController extends BaseController {
|
|||||||
@ApiOperation("监测点数据完整性(冀北)")
|
@ApiOperation("监测点数据完整性(冀北)")
|
||||||
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
|
@ApiImplicitParam(name = "param", value = "参数实体", required = true)
|
||||||
public HttpResult<DeviceOnlineRate> getData(@RequestBody DeviceInfoParam.BusinessParam param) {
|
public HttpResult<DeviceOnlineRate> getData(@RequestBody DeviceInfoParam.BusinessParam param) {
|
||||||
param.setLineOrDevice(0);
|
|
||||||
String methodDescribe = getMethodDescribe("getData");
|
String methodDescribe = getMethodDescribe("getData");
|
||||||
DeviceOnlineRate rate = irStatIntegrityDService.getData(param);
|
DeviceOnlineRate rate = irStatIntegrityDService.getData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rate, methodDescribe);
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ package com.njcn.device.pq.controller;
|
|||||||
* @Description: 异常告警数据指标范围
|
* @Description: 异常告警数据指标范围
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
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.dataProcess.param.DataCleanParam;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
|
||||||
import com.njcn.device.pq.service.ReasonableRangeService;
|
import com.njcn.device.pq.service.ReasonableRangeService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|||||||
@@ -42,6 +42,17 @@ public class RunManageController extends BaseController {
|
|||||||
|
|
||||||
private final RunManageService runManageService;
|
private final RunManageService runManageService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLineLedgerComm")
|
||||||
|
@ApiOperation("监测点台账信息")
|
||||||
|
@ApiImplicitParam(name = "runManageParam", value = "监测点台账参数", required = true)
|
||||||
|
public HttpResult<Page<RunManageVO>> getLineLedgerComm(@RequestBody @Validated RunManageParam runManageParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLineLedgerComm");
|
||||||
|
Page<RunManageVO> res = runManageService.getLineLedgerComm(runManageParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineLedger")
|
@PostMapping("/getLineLedger")
|
||||||
@ApiOperation("监测点台账信息")
|
@ApiOperation("监测点台账信息")
|
||||||
@@ -54,18 +65,18 @@ public class RunManageController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getRuntimeData")
|
@PostMapping("/getRuntimeData")
|
||||||
@ApiOperation("终端台账信息")
|
@ApiOperation("终端台账信息(通用)")
|
||||||
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
||||||
public HttpResult<List<RunTimeVO>> getRuntimeData(@RequestBody @Validated RunManageParam runManageParam) {
|
public HttpResult<Page<RunTimeVO>> getRuntimeData(@RequestBody @Validated RunManageParam runManageParam) {
|
||||||
String methodDescribe = getMethodDescribe("getRuntimeData");
|
String methodDescribe = getMethodDescribe("getRuntimeData");
|
||||||
List<RunTimeVO> result = runManageService.getRuntimeDetail(runManageParam);
|
Page<RunTimeVO> result = runManageService.getRuntimeDetail(runManageParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getDeviceLedger")
|
@PostMapping("/getDeviceLedger")
|
||||||
@ApiOperation("获取基本的终端台账信息")
|
@ApiOperation("获取基本的终端台账信息(冀北)")
|
||||||
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
@ApiImplicitParam(name = "runManageParam", value = "终端台账参数", required = true)
|
||||||
public HttpResult<Page<RunTimeVO>> getDeviceLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
public HttpResult<Page<RunTimeVO>> getDeviceLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
||||||
String methodDescribe = getMethodDescribe("getRuntimeData");
|
String methodDescribe = getMethodDescribe("getRuntimeData");
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.device.device.service.DeviceProcessService;
|
||||||
|
import com.njcn.device.device.service.IDeviceService;
|
||||||
|
import com.njcn.device.pq.pojo.param.AskFileSysParam;
|
||||||
|
import com.njcn.device.pq.pojo.po.Device;
|
||||||
|
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||||
|
import com.njcn.message.api.ProduceFeignClient;
|
||||||
|
import com.njcn.message.message.AskFileSysMessage;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2026/04/29 上午 11:41【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/dir")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "装置文件系统")
|
||||||
|
public class DirectoryController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
private final ProduceFeignClient produceFeignClient;
|
||||||
|
|
||||||
|
|
||||||
|
private final PendingRequestManager pendingRequestManager;
|
||||||
|
|
||||||
|
private final IDeviceService iDeviceService;
|
||||||
|
private final DeviceProcessService deviceProcessService;
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("获取装置文件目录")
|
||||||
|
public DeferredResult<Object> listDirectory(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("listDirectory");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(0);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/downLoadFile")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("获取装置文件文件")
|
||||||
|
public DeferredResult<Object> downLoadFile(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("downLoadFile");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(1);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/upLoadFile")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("上传装置文件文件")
|
||||||
|
public DeferredResult<Object> upLoadFile(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("upLoadFile");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(2);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
askFileSysMessage.setRemotePath(askFileSysParam.getRemotePath());
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("装置目录,文件删除")
|
||||||
|
public DeferredResult<Object> delete(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("delete");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setType(3);
|
||||||
|
askFileSysMessage.setPath(askFileSysParam.getPath());
|
||||||
|
askFileSysMessage.setRemotePath(askFileSysParam.getRemotePath());
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/restart")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("装置重启")
|
||||||
|
public DeferredResult<Object> restart(@RequestBody AskFileSysParam askFileSysParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("restart");
|
||||||
|
|
||||||
|
long timeoutMs = 15000L; // 15 秒超时
|
||||||
|
// 构造指令 body
|
||||||
|
Device device = iDeviceService.getById(askFileSysParam.getDevId());
|
||||||
|
DeviceProcess deviceProcess = deviceProcessService.getById(askFileSysParam.getDevId());
|
||||||
|
// 发送 MQ 指令,获取 msgId
|
||||||
|
AskFileSysMessage askFileSysMessage = new AskFileSysMessage();
|
||||||
|
askFileSysMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
askFileSysMessage.setNodeId(device.getNodeId());
|
||||||
|
askFileSysMessage.setProcessNo(deviceProcess.getProcessNo());
|
||||||
|
askFileSysMessage.setDevId(askFileSysParam.getDevId());
|
||||||
|
askFileSysMessage.setPath("reboot");
|
||||||
|
askFileSysMessage.setType(4);
|
||||||
|
produceFeignClient.askFileSys(askFileSysMessage);
|
||||||
|
// 创建挂起请求
|
||||||
|
DeferredResult<Object> deferredResult = pendingRequestManager.createPendingRequest(askFileSysMessage.getGuid(), timeoutMs);
|
||||||
|
// 可额外在 Redis 中记录初始状态(可选)
|
||||||
|
// 返回 DeferredResult,Spring 将挂起此请求
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class PendingRequestManager {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
// 本地映射:msgId -> DeferredResult,主要用于超时清理和主动完成
|
||||||
|
private final ConcurrentHashMap<String, DeferredResult<Object>> deferredResultMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// 创建挂起请求
|
||||||
|
public DeferredResult<Object> createPendingRequest(String msgId, long timeoutMs) {
|
||||||
|
DeferredResult<Object> deferredResult = new DeferredResult<>(timeoutMs);
|
||||||
|
// 超时回调
|
||||||
|
deferredResult.onTimeout(() -> {
|
||||||
|
// 清理 Redis 中的等待记录
|
||||||
|
redisTemplate.delete("pending:" + msgId);
|
||||||
|
deferredResultMap.remove(msgId);
|
||||||
|
deferredResult.setErrorResult(new BusinessException("前置超时...."));
|
||||||
|
});
|
||||||
|
// 完成回调(正常或异常后移出本地映射)
|
||||||
|
deferredResult.onCompletion(() -> deferredResultMap.remove(msgId));
|
||||||
|
|
||||||
|
deferredResultMap.put(msgId, deferredResult);
|
||||||
|
return deferredResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收到 Redis 通知后,根据 msgId 完成请求
|
||||||
|
public void completeRequest(String msgId) {
|
||||||
|
if (deferredResultMap.containsKey(msgId)) {
|
||||||
|
DeferredResult<Object> deferredResult = deferredResultMap.get(msgId);
|
||||||
|
|
||||||
|
// 从 Redis 中获取结果内容
|
||||||
|
String key = "pending:" + msgId;
|
||||||
|
Object result = redisTemplate.opsForValue().get(key);
|
||||||
|
if (result != null) {
|
||||||
|
deferredResult.setResult( HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result,""));
|
||||||
|
} else {
|
||||||
|
log.info("Receive notification for unknown msgId: " + msgId);
|
||||||
|
deferredResult.setErrorResult(new BusinessException("前置未返回结果"));
|
||||||
|
}
|
||||||
|
// 清理 Redis 中的记录(可选,利用过期时间自动删除也可)
|
||||||
|
redisTemplate.delete(key);
|
||||||
|
} else {
|
||||||
|
// 可能请求已超时被移除了,仅记录日志即可
|
||||||
|
log.info("Receive notification for unknown msgId: " + msgId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.connection.Message;
|
||||||
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RedisMessageSubscriber implements MessageListener {
|
||||||
|
@Autowired
|
||||||
|
private PendingRequestManager pendingRequestManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Message message, byte[] pattern) {
|
||||||
|
String msgId = new String(message.getBody(), StandardCharsets.UTF_8);
|
||||||
|
pendingRequestManager.completeRequest(msgId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.njcn.device.pq.controller.file;
|
||||||
|
|
||||||
|
import com.njcn.redis.config.RedisConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.data.redis.connection.Message;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.listener.ChannelTopic;
|
||||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
|
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2026/04/29 下午 3:37【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@Import(RedisConfig.class) // 引入公共配置
|
||||||
|
public class RedisSubscriptionConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisMessageListenerContainer redisContainer(
|
||||||
|
RedisConnectionFactory connectionFactory,
|
||||||
|
MessageListenerAdapter resultListenerAdapter) {
|
||||||
|
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||||
|
container.setConnectionFactory(connectionFactory);
|
||||||
|
container.addMessageListener(resultListenerAdapter, new ChannelTopic("result_ready_channel"));
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MessageListenerAdapter resultListenerAdapter(RedisMessageSubscriber subscriber) {
|
||||||
|
return new MessageListenerAdapter(subscriber, "onMessage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -10,9 +10,11 @@ import com.njcn.device.node.mapper.NodeMapper;
|
|||||||
import com.njcn.device.pq.pojo.po.Device;
|
import com.njcn.device.pq.pojo.po.Device;
|
||||||
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
import com.njcn.device.pq.pojo.po.DeviceProcess;
|
||||||
import com.njcn.device.pq.pojo.po.Node;
|
import com.njcn.device.pq.pojo.po.Node;
|
||||||
|
import com.njcn.message.constant.RedisKeyPrefix;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -21,6 +23,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +36,7 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@ConditionalOnProperty(name = "business.task-enabled", havingValue = "true", matchIfMissing = true)
|
||||||
public class DeviceComflagTasks {
|
public class DeviceComflagTasks {
|
||||||
private final NodeMapper nodeMapper;
|
private final NodeMapper nodeMapper;
|
||||||
private final IDeviceService iDeviceService;
|
private final IDeviceService iDeviceService;
|
||||||
@@ -63,8 +67,17 @@ public class DeviceComflagTasks {
|
|||||||
pqsCommunicateDto.setTime(LocalDateTimeUtil.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
pqsCommunicateDto.setTime(LocalDateTimeUtil.now().format(DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
pqsCommunicateDto.setDevId(temp);
|
pqsCommunicateDto.setDevId(temp);
|
||||||
pqsCommunicateDto.setType(0);
|
pqsCommunicateDto.setType(0);
|
||||||
|
//获取之前设备状态
|
||||||
|
String devFalg =redisUtil.getStringByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(temp));
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(devFalg)||(!Objects.equals(Integer.valueOf(devFalg),pqsCommunicateDto.getType()))){
|
||||||
|
//状态翻转
|
||||||
|
redisUtil.saveByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(temp),pqsCommunicateDto.getType()+"");
|
||||||
|
pqsCommunicateFeignClient.insertion(pqsCommunicateDto) ;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
pqsCommunicateFeignClient.insertion(pqsCommunicateDto) ;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +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.dataProcess.pojo.po.PqReasonableRange;
|
import com.njcn.algorithm.pojo.po.PqReasonableRange;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -84,6 +84,7 @@
|
|||||||
pldsdd.id AS lineGrade,
|
pldsdd.id AS lineGrade,
|
||||||
pldsdd.Algo_Describe AS algoDescribe,
|
pldsdd.Algo_Describe AS algoDescribe,
|
||||||
pld.Load_Type AS loadType,
|
pld.Load_Type AS loadType,
|
||||||
|
pd.Dev_Type AS devType,
|
||||||
pld.obj_id as objId
|
pld.obj_id as objId
|
||||||
FROM
|
FROM
|
||||||
pq_line AS line
|
pq_line AS line
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.device.pq.service;
|
package com.njcn.device.pq.service;
|
||||||
|
|
||||||
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.param.dataClean.MonitorBaseParam;
|
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||||
@@ -10,7 +9,6 @@ import com.njcn.device.pq.pojo.vo.dataClean.PowerQualityIndicatorsVO;
|
|||||||
import com.njcn.device.pq.pojo.vo.dataClean.VerifyMonitorVO;
|
import com.njcn.device.pq.pojo.vo.dataClean.VerifyMonitorVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -22,19 +20,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface IDataVerifyService extends IService<DataVerify> {
|
public interface IDataVerifyService extends IService<DataVerify> {
|
||||||
|
|
||||||
|
|
||||||
VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam);
|
|
||||||
|
|
||||||
List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam);
|
|
||||||
|
|
||||||
|
|
||||||
List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
|
||||||
|
|
||||||
|
|
||||||
VerifyMonitorVO getMonitorLimitData(MonitorBaseParam monitorBaseParam);
|
VerifyMonitorVO getMonitorLimitData(MonitorBaseParam monitorBaseParam);
|
||||||
|
|
||||||
List<PowerQualityIndicatorsVO> getMonitorLimitDataDay(MonitorBaseParam monitorBaseParam);
|
List<PowerQualityIndicatorsVO> getMonitorLimitDataDay(MonitorBaseParam monitorBaseParam);
|
||||||
@@ -43,6 +28,5 @@ public interface IDataVerifyService extends IService<DataVerify> {
|
|||||||
|
|
||||||
DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
|
DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||||
|
|
||||||
|
|
||||||
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);
|
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.njcn.device.pq.service;
|
package com.njcn.device.pq.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
import com.njcn.algorithm.pojo.po.PqReasonableRange;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import java.util.List;
|
|||||||
* @date 2022/3/30
|
* @date 2022/3/30
|
||||||
*/
|
*/
|
||||||
public interface RunManageService {
|
public interface RunManageService {
|
||||||
|
|
||||||
|
Page<RunManageVO> getLineLedgerComm(RunManageParam runManageParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取监测点台账信息
|
* 获取监测点台账信息
|
||||||
* @param runManageParam 参数
|
* @param runManageParam 参数
|
||||||
@@ -27,7 +30,7 @@ public interface RunManageService {
|
|||||||
* @param runManageParam 参数
|
* @param runManageParam 参数
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
List<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam);
|
Page<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam);
|
||||||
|
|
||||||
|
|
||||||
Page<RunTimeVO> getDeviceLedger(RunManageParam runManageParam);
|
Page<RunTimeVO> getDeviceLedger(RunManageParam runManageParam);
|
||||||
|
|||||||
@@ -9,20 +9,17 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.hutool.json.JSONArray;
|
import cn.hutool.json.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.algorithm.pojo.api.PqReasonableRangeFeignClient;
|
||||||
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.dataProcess.api.DataLimitRateDetailFeignClient;
|
import com.njcn.dataProcess.api.DataLimitRateDetailFeignClient;
|
||||||
import com.njcn.dataProcess.api.DataLimitRateFeignClient;
|
import com.njcn.dataProcess.api.DataLimitRateFeignClient;
|
||||||
import com.njcn.dataProcess.api.DataLimitTargetFeignClient;
|
import com.njcn.dataProcess.api.DataLimitTargetFeignClient;
|
||||||
import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
|
||||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
|
||||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
|
||||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
import com.njcn.device.line.service.DeptLineService;
|
import com.njcn.device.line.service.DeptLineService;
|
||||||
@@ -31,13 +28,11 @@ import com.njcn.device.pq.mapper.DataVerifyMapper;
|
|||||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||||
import com.njcn.device.pq.pojo.po.DataVerify;
|
import com.njcn.device.pq.pojo.po.DataVerify;
|
||||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
|
||||||
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.device.pq.pojo.vo.dataClean.*;
|
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||||
import com.njcn.device.pq.service.CommTerminalService;
|
import com.njcn.device.pq.service.CommTerminalService;
|
||||||
import com.njcn.device.pq.service.IDataVerifyService;
|
import com.njcn.device.pq.service.IDataVerifyService;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
@@ -51,7 +46,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -76,7 +70,6 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
|||||||
private final CommTerminalService commTerminalService;
|
private final CommTerminalService commTerminalService;
|
||||||
private final LineMapper lineMapper;
|
private final LineMapper lineMapper;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
|
||||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||||
private final DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
private final DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
||||||
private final DataLimitRateFeignClient dataLimitRateFeignClient;
|
private final DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||||
@@ -86,121 +79,6 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
|
|||||||
private final DeptLineService deptLineService;
|
private final DeptLineService deptLineService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
|
||||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
|
||||||
if (CollUtil.isEmpty(monitorIds)) {
|
|
||||||
throw new BusinessException(DeviceResponseEnum.QUERY_LINE_DATA_EMPTY);
|
|
||||||
}
|
|
||||||
List<DataVerify> dataVerifyList = commQuery(monitorIds, monitorBaseParam);
|
|
||||||
VerifyMonitorVO verifyMonitorVO = new VerifyMonitorVO();
|
|
||||||
verifyMonitorVO.setRunNum(monitorIds.size());
|
|
||||||
verifyMonitorVO.setAbnormalNum(dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getLineId)).size());
|
|
||||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, dataVerifyList));
|
|
||||||
verifyMonitorVO.setTargetList(getAbnormalTarget(dataVerifyList));
|
|
||||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(dataVerifyList, monitorBaseParam));
|
|
||||||
return verifyMonitorVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
|
||||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
|
||||||
List<DataVerify> dataVerifyList = commQuery(monitorIds, monitorBaseParam);
|
|
||||||
return getAbnormalTable(dataVerifyList, monitorBaseParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam) {
|
|
||||||
List<DetailAbnormalVO> result = new ArrayList<>();
|
|
||||||
List<LineDevGetDTO> lineDetailList = lineMapper.getMonitorListDetail(monitorBaseParam.getMonitorIds());
|
|
||||||
Map<String, LineDevGetDTO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDevGetDTO::getPointId, Function.identity()));
|
|
||||||
|
|
||||||
LambdaQueryWrapper<DataVerify> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())),
|
|
||||||
DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
|
||||||
.in(DataVerify::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(DataVerify::getTime);
|
|
||||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
|
||||||
String[] target = monitorBaseParam.getTargetKey().split(SEPARATOR);
|
|
||||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode, target[0]).eq(DataVerify::getIndexTable, target[1]);
|
|
||||||
}
|
|
||||||
List<DataVerify> dataVerifyList = this.list(lambdaQueryWrapper);
|
|
||||||
Map<String, List<DataVerify>> dataMap = dataVerifyList.stream().collect(Collectors.groupingBy(it -> it.getTime().format(DATE_FORMAT)));
|
|
||||||
dataMap.forEach((dateStr, data) -> {
|
|
||||||
Map<String, List<DataVerify>> lineMap = data.stream().collect(Collectors.groupingBy(DataVerify::getLineId));
|
|
||||||
lineMap.forEach((lineId, lineList) -> {
|
|
||||||
long count = lineList.stream().map(DataVerify::getTime).distinct().count();
|
|
||||||
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
|
|
||||||
LineDevGetDTO lineDevGetDTO = lineDetailMap.get(lineId);
|
|
||||||
detailAbnormalVO.setTimeSum("");
|
|
||||||
detailAbnormalVO.setDate(dateStr);
|
|
||||||
detailAbnormalVO.setMonitorName(lineDevGetDTO.getPointName());
|
|
||||||
detailAbnormalVO.setMonitorId(lineDevGetDTO.getPointId());
|
|
||||||
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
|
|
||||||
result.add(detailAbnormalVO);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DetailAbnormalVO.DetailAbnormalInnerVO> monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam) {
|
|
||||||
Map<String, PqReasonableRangeDto> dtoMap = getStandRange();
|
|
||||||
|
|
||||||
List<DetailAbnormalVO.DetailAbnormalInnerVO> result = new ArrayList<>();
|
|
||||||
LambdaQueryWrapper<DataVerify> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.between(DataVerify::getTime, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())))
|
|
||||||
.in(DataVerify::getLineId, monitorBaseParam.getMonitorIds()).orderByAsc(DataVerify::getTime);
|
|
||||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
|
||||||
String[] queryTarget = monitorBaseParam.getTargetKey().split(SEPARATOR);
|
|
||||||
lambdaQueryWrapper.eq(DataVerify::getIndexCode, queryTarget[0]).eq(DataVerify::getIndexTable, queryTarget[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<DataVerify> dataVerifyList = this.list(lambdaQueryWrapper);
|
|
||||||
Map<LocalDateTime, List<DataVerify>> listMap = dataVerifyList.stream().collect(Collectors.groupingBy(DataVerify::getTime, TreeMap::new,
|
|
||||||
Collectors.toList()));
|
|
||||||
listMap.forEach((time, timeList) -> {
|
|
||||||
Map<String, List<DataVerify>> indexMap = timeList.stream().collect(Collectors.groupingBy(it -> it.getIndexCode() + SEPARATOR + it.getIndexTable() + SEPARATOR + it.getIndexName()));
|
|
||||||
indexMap.forEach((target, list) -> {
|
|
||||||
String[] temKey = target.split(SEPARATOR);
|
|
||||||
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(temKey[0] + SEPARATOR + temKey[1]);
|
|
||||||
String unit;
|
|
||||||
if (StrUtil.isNotBlank(pqReasonableRangeDto.getUnit())) {
|
|
||||||
unit = pqReasonableRangeDto.getUnit();
|
|
||||||
} else {
|
|
||||||
unit = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, List<DataVerify>> phaseMap = list.stream().collect(Collectors.groupingBy(DataVerify::getPhasicType));
|
|
||||||
phaseMap.forEach((phaseKey, valueList) -> {
|
|
||||||
DetailAbnormalVO.DetailAbnormalInnerVO vo = new DetailAbnormalVO.DetailAbnormalInnerVO();
|
|
||||||
vo.setTime(time.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
|
||||||
vo.setTargetName(temKey[2]);
|
|
||||||
vo.setTargetKey(temKey[0] + temKey[1]);
|
|
||||||
vo.setPhaseType(phaseKey);
|
|
||||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
|
||||||
valueList.forEach(it -> {
|
|
||||||
switch (it.getValueType()) {
|
|
||||||
case "AVG":
|
|
||||||
vo.setAvg(it.getAbnormalValue().toString());
|
|
||||||
break;
|
|
||||||
case "MAX":
|
|
||||||
vo.setMax(it.getAbnormalValue().toString());
|
|
||||||
break;
|
|
||||||
case "MIN":
|
|
||||||
vo.setMin(it.getAbnormalValue().toString());
|
|
||||||
break;
|
|
||||||
case "CP95":
|
|
||||||
vo.setCp95(it.getAbnormalValue().toString());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
result.add(vo);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VerifyMonitorVO getMonitorLimitData(MonitorBaseParam monitorBaseParam) {
|
public VerifyMonitorVO getMonitorLimitData(MonitorBaseParam monitorBaseParam) {
|
||||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ import com.njcn.device.pq.pojo.vo.*;
|
|||||||
import com.njcn.device.pq.service.DeviceRunEvaluateService;
|
import com.njcn.device.pq.service.DeviceRunEvaluateService;
|
||||||
import com.njcn.device.pq.service.IPqDataVerifyCountService;
|
import com.njcn.device.pq.service.IPqDataVerifyCountService;
|
||||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||||
|
import com.njcn.device.userledger.service.UserLedgerService;
|
||||||
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
||||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
|
||||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
@@ -64,7 +64,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
|||||||
private final RStatOnlinerateDMapper onLineRateDMapper;
|
private final RStatOnlinerateDMapper onLineRateDMapper;
|
||||||
private final RStatIntegrityDMapper integrityDMapper;
|
private final RStatIntegrityDMapper integrityDMapper;
|
||||||
private final LineMapper lineMapper;
|
private final LineMapper lineMapper;
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
private final UserLedgerService userLedgerService;
|
||||||
private final DeptLineService deptLineService;
|
private final DeptLineService deptLineService;
|
||||||
private final GeneralDeviceService deviceService;
|
private final GeneralDeviceService deviceService;
|
||||||
private final OnLineRateMapper onLineRateMapper;
|
private final OnLineRateMapper onLineRateMapper;
|
||||||
@@ -523,7 +523,7 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
|
|||||||
|
|
||||||
|
|
||||||
private Map<String, NewUserReportVO> getUserLedgerByObjIds(List<String> objIds) {
|
private Map<String, NewUserReportVO> getUserLedgerByObjIds(List<String> objIds) {
|
||||||
List<NewUserReportVO> userReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
List<NewUserReportVO> userReportVOList = userLedgerService.getUserReportByIds(objIds);
|
||||||
return userReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
return userReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.njcn.device.pq.service.impl;
|
|||||||
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 cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
@@ -28,8 +27,8 @@ import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
|||||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||||
import com.njcn.device.pq.utils.DataStatisticsUtil;
|
import com.njcn.device.pq.utils.DataStatisticsUtil;
|
||||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||||
|
import com.njcn.device.userledger.service.UserLedgerService;
|
||||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
|
||||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||||
@@ -38,8 +37,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.text.Collator;
|
import java.text.Collator;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -59,18 +56,12 @@ import java.util.stream.Stream;
|
|||||||
public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataMapper, LineIntegrityDataVO> implements LineIntegrityDataService {
|
public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataMapper, LineIntegrityDataVO> implements LineIntegrityDataService {
|
||||||
|
|
||||||
private final LineIntegrityDataMapper lineIntegrityDataMapper;
|
private final LineIntegrityDataMapper lineIntegrityDataMapper;
|
||||||
|
|
||||||
private final AlarmClient alarmClient;
|
private final AlarmClient alarmClient;
|
||||||
|
|
||||||
private final GeneralDeviceService generalDeviceService;
|
private final GeneralDeviceService generalDeviceService;
|
||||||
|
|
||||||
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||||
|
private final UserLedgerService userLedgerService;
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点数据完整性
|
* 监测点数据完整性
|
||||||
@@ -88,7 +79,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
|||||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||||
Map<String, UserLedgerVO> userLedgerVOMap;
|
Map<String, UserLedgerVO> userLedgerVOMap;
|
||||||
if (lineIntegrityDataParam.isUserLedger()) {
|
if (lineIntegrityDataParam.isUserLedger()) {
|
||||||
List<UserLedgerVO> userLedgerVOList = userLedgerFeignClient.selectUserList(new UserReportParam()).getData();
|
List<UserLedgerVO> userLedgerVOList = userLedgerService.selectUserList(new UserReportParam());
|
||||||
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
userLedgerVOMap = userLedgerVOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||||
} else {
|
} else {
|
||||||
userLedgerVOMap = new HashMap<>();
|
userLedgerVOMap = new HashMap<>();
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.algorithm.pojo.api.PqReasonableRangeFeignClient;
|
||||||
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
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;
|
||||||
import com.njcn.dataProcess.api.PqReasonableRangeFeignClient;
|
|
||||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
|
||||||
import com.njcn.device.common.mapper.onlinerate.OnLineRateMapper;
|
import com.njcn.device.common.mapper.onlinerate.OnLineRateMapper;
|
||||||
import com.njcn.device.common.service.GeneralDeviceService;
|
import com.njcn.device.common.service.GeneralDeviceService;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
@@ -45,7 +45,6 @@ import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
|||||||
import com.njcn.device.pq.utils.DataLineExcelUtil;
|
import com.njcn.device.pq.utils.DataLineExcelUtil;
|
||||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -86,7 +85,6 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
|||||||
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
private final PqReasonableRangeFeignClient pqReasonableRangeFeignClient;
|
||||||
private final LineMapper lineMapper;
|
private final LineMapper lineMapper;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final DeptLineService deptLineService;
|
private final DeptLineService deptLineService;
|
||||||
private final GeneralDeviceService deviceService;
|
private final GeneralDeviceService deviceService;
|
||||||
@@ -197,7 +195,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
|||||||
@Override
|
@Override
|
||||||
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
public List<PowerQualityIndicatorsVO> getMonitorVerifyDay(MonitorBaseParam monitorBaseParam) {
|
||||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||||
if(CollectionUtils.isEmpty(monitorIds)){
|
if (CollectionUtils.isEmpty(monitorIds)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
List<PqDataVerifyBak> dataVerifyList = baseDataVerifyQuery(monitorIds, monitorBaseParam);
|
||||||
@@ -437,6 +435,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
|||||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||||
|
dataVerifyExcel.setPowerFlag(areaLineInfoVO.getPowerFlag() == 0 ? "电网侧" : "非电网侧");
|
||||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package com.njcn.device.pq.service.impl;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
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.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.device.biz.commApi.CommLineClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
|
||||||
import com.njcn.device.common.service.GeneralDeviceService;
|
import com.njcn.device.common.service.GeneralDeviceService;
|
||||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
@@ -30,7 +33,11 @@ import com.njcn.device.pq.pojo.vo.RStatIntegrityVO;
|
|||||||
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
|
import com.njcn.device.pq.pojo.vo.common.DeviceOnlineRate;
|
||||||
import com.njcn.device.pq.service.IRStatIntegrityDService;
|
import com.njcn.device.pq.service.IRStatIntegrityDService;
|
||||||
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
import com.njcn.device.rstatintegrity.mapper.RStatIntegrityDMapper;
|
||||||
|
import com.njcn.device.userledger.service.UserLedgerService;
|
||||||
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -149,14 +156,14 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
.stream()
|
.stream()
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
rate.setTotalNum(lineIds.size());
|
|
||||||
//获取所有监测点的数据完整性
|
//获取所有监测点的数据完整性
|
||||||
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime());
|
List<RStatIntegrityVO> lineIntegrityRateInfo = rStatIntegrityDMapper.getLineIntegrityRateInfo(lineIds, param.getSearchBeginTime(), param.getSearchEndTime());
|
||||||
//获取所有监测点信息信息
|
//获取所有监测点信息信息
|
||||||
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(lineIds);
|
List<LineDetailVO.Detail> LineInfoByIds = lineService.getLineDetailByIds(lineIds);
|
||||||
|
|
||||||
|
rate.setTotalNum(lineIds.size());
|
||||||
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo) ? calculateIntegrityRate(lineIntegrityRateInfo, 90, lineIds.size()) : lineIds.size());
|
rate.setBelowNum(CollUtil.isNotEmpty(lineIntegrityRateInfo) ? calculateIntegrityRate(lineIntegrityRateInfo, 90, lineIds.size()) : lineIds.size());
|
||||||
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, lineIds).doubleValue()>100.0?BigDecimal.valueOf(100.0) : calculateIntegrityRate(lineIntegrityRateInfo, lineIds));
|
rate.setTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, lineIds).doubleValue() > 100.0 ? BigDecimal.valueOf(100.0) : calculateIntegrityRate(lineIntegrityRateInfo, lineIds));
|
||||||
List<DeviceOnlineRate.CitDetail> citDetailList = new ArrayList<>();
|
List<DeviceOnlineRate.CitDetail> citDetailList = new ArrayList<>();
|
||||||
DeviceOnlineRate.CitDetail citDetail;
|
DeviceOnlineRate.CitDetail citDetail;
|
||||||
DeviceOnlineRate.LineDetail detail;
|
DeviceOnlineRate.LineDetail detail;
|
||||||
@@ -166,12 +173,12 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
Map<String, BigDecimal> onlineRateByDevMap = citDevOnRate.stream()
|
Map<String, BigDecimal> onlineRateByDevMap = citDevOnRate.stream()
|
||||||
.collect(Collectors.toMap(RStatIntegrityVO::getLineIndex, RStatIntegrityVO::getIntegrityRate));
|
.collect(Collectors.toMap(RStatIntegrityVO::getLineIndex, RStatIntegrityVO::getIntegrityRate));
|
||||||
citDetail = new DeviceOnlineRate.CitDetail();
|
citDetail = new DeviceOnlineRate.CitDetail();
|
||||||
|
List<LineDetailVO.Detail> lineDetail = LineInfoByIds.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||||
citDetail.setCitName(dto.getName());
|
citDetail.setCitName(dto.getName());
|
||||||
citDetail.setCitTotalNum(dto.getLineIndexes().size());
|
citDetail.setCitTotalNum(dto.getLineIndexes().size());
|
||||||
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateIntegrityRate(citDevOnRate, 90, dto.getLineIndexes().size()) : dto.getLineIndexes().size());
|
citDetail.setCitBelowNum(CollUtil.isNotEmpty(citDevOnRate) ? calculateIntegrityRate(citDevOnRate, 90, dto.getLineIndexes().size()) : dto.getLineIndexes().size());
|
||||||
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()).doubleValue()>100.0?BigDecimal.valueOf(100.0):calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()));
|
citDetail.setCitTotalOnlineRate(calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()).doubleValue() > 100.0 ? BigDecimal.valueOf(100.0) : calculateIntegrityRate(lineIntegrityRateInfo, dto.getLineIndexes()));
|
||||||
List<DeviceOnlineRate.LineDetail> detailList = new ArrayList<>();
|
List<DeviceOnlineRate.LineDetail> detailList = new ArrayList<>();
|
||||||
List<LineDetailVO.Detail> lineDetail = LineInfoByIds.stream().filter(x -> dto.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
|
||||||
for (LineDetailVO.Detail line : lineDetail) {
|
for (LineDetailVO.Detail line : lineDetail) {
|
||||||
detail = new DeviceOnlineRate.LineDetail();
|
detail = new DeviceOnlineRate.LineDetail();
|
||||||
detail.setCit(line.getDeptName());
|
detail.setCit(line.getDeptName());
|
||||||
@@ -184,8 +191,10 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
detail.setRunFlag(RunFlagEnum.getRunFlagRemarkByStatus(Integer.valueOf(line.getLineRunType())));
|
detail.setRunFlag(RunFlagEnum.getRunFlagRemarkByStatus(Integer.valueOf(line.getLineRunType())));
|
||||||
detail.setLineId(line.getLineId());
|
detail.setLineId(line.getLineId());
|
||||||
detail.setLineName(line.getLineName());
|
detail.setLineName(line.getLineName());
|
||||||
|
//用户侧监测点 监测对象
|
||||||
|
detail.setObjName(StringUtils.isBlank(line.getObjName()) ? "/" : line.getObjName());
|
||||||
detail.setLatestTime(line.getTimeID());
|
detail.setLatestTime(line.getTimeID());
|
||||||
detail.setIntegrity(onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)).doubleValue()>100.0?BigDecimal.valueOf(100.0):onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)));
|
detail.setIntegrity(onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)).doubleValue() > 100.0 ? BigDecimal.valueOf(100.0) : onlineRateByDevMap.getOrDefault(line.getLineId(), BigDecimal.valueOf(0)));
|
||||||
detailList.add(detail);
|
detailList.add(detail);
|
||||||
}
|
}
|
||||||
citDetail.setDetailList(detailList);
|
citDetail.setDetailList(detailList);
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package com.njcn.device.pq.service.impl;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
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.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
import com.njcn.algorithm.pojo.param.DataCleanParam;
|
||||||
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
|
import com.njcn.algorithm.pojo.po.PqReasonableRange;
|
||||||
import com.njcn.device.pq.mapper.ReasonableRangeMapper;
|
import com.njcn.device.pq.mapper.ReasonableRangeMapper;
|
||||||
import com.njcn.device.pq.service.ReasonableRangeService;
|
import com.njcn.device.pq.service.ReasonableRangeService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.njcn.device.pq.pojo.vo.RunManageVO;
|
|||||||
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
import com.njcn.device.pq.pojo.vo.RunTimeVO;
|
||||||
import com.njcn.device.pq.pojo.vo.TerminalLedgerVO;
|
import com.njcn.device.pq.pojo.vo.TerminalLedgerVO;
|
||||||
import com.njcn.device.pq.service.RunManageService;
|
import com.njcn.device.pq.service.RunManageService;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
import com.njcn.device.userledger.service.UserLedgerService;
|
||||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataTypeEnum;
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
@@ -70,7 +70,34 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
|
|
||||||
private final LineDetailMapper lineDetailMapper;
|
private final LineDetailMapper lineDetailMapper;
|
||||||
|
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
private final UserLedgerService userLedgerService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用监测点台账,区别冀北版本的
|
||||||
|
* @author cdf
|
||||||
|
* @date 2026/3/22
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<RunManageVO> getLineLedgerComm(RunManageParam runManageParam) {
|
||||||
|
Page<RunManageVO> pageResult = new Page<>(PageFactory.getPageNum(runManageParam),PageFactory.getPageSize(runManageParam));
|
||||||
|
List<String> lineIndexes ;
|
||||||
|
if(CollUtil.isNotEmpty(runManageParam.getIds())){
|
||||||
|
lineIndexes =runManageParam.getIds();
|
||||||
|
}else{
|
||||||
|
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||||
|
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||||
|
deviceInfoParam.setServerName("pqs-common");
|
||||||
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||||
|
lineIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if(CollectionUtil.isEmpty(lineIndexes)){
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
pageResult = deviceMapper.getRunManageCommList(new Page<>(PageFactory.getPageNum(runManageParam),PageFactory.getPageSize(runManageParam)),lineIndexes, runManageParam.getComFlag(),Objects.isNull(runManageParam.getRunFlag())?new ArrayList<>():runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||||
@@ -89,7 +116,7 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),Objects.isNull(runManageParam.getRunFlag())?new ArrayList<>():runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),Objects.isNull(runManageParam.getRunFlag())?new ArrayList<>():runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||||
if(CollUtil.isNotEmpty(resultList)){
|
if(CollUtil.isNotEmpty(resultList)){
|
||||||
List<String> objIds = resultList.stream().map(RunManageVO::getObjId).collect(Collectors.toList());
|
List<String> objIds = resultList.stream().map(RunManageVO::getObjId).collect(Collectors.toList());
|
||||||
Map<String,NewUserReportVO> runManageVOMap = userLedgerFeignClient.getUserReportByIds(objIds).getData().stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
|
Map<String,NewUserReportVO> runManageVOMap = userLedgerService.getUserReportByIds(objIds).stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
|
||||||
resultList.forEach(it->{
|
resultList.forEach(it->{
|
||||||
if(StrUtil.isNotBlank(it.getObjId())){
|
if(StrUtil.isNotBlank(it.getObjId())){
|
||||||
if(runManageVOMap.containsKey(it.getObjId())){
|
if(runManageVOMap.containsKey(it.getObjId())){
|
||||||
@@ -103,34 +130,18 @@ public class RunManageServiceImpl implements RunManageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam) {
|
public Page<RunTimeVO> getRuntimeDetail(RunManageParam runManageParam) {
|
||||||
List<RunTimeVO> runManageDevList = new ArrayList<>();
|
|
||||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||||
|
deviceInfoParam.setServerName("pqs-common");
|
||||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
|
||||||
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||||
DateFormat bf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(runManageParam.getSearchBeginTime()) && StrUtil.isNotBlank(runManageParam.getSearchEndTime())) {
|
|
||||||
runManageParam.setSearchBeginTime(bf.format(DateUtil.beginOfDay(DateUtil.parse(runManageParam.getSearchBeginTime()))));
|
|
||||||
runManageParam.setSearchEndTime(bf.format(DateUtil.beginOfDay(DateUtil.parse(runManageParam.getSearchEndTime()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(devIndexes)) {
|
if (CollectionUtil.isEmpty(devIndexes)) {
|
||||||
runManageDevList = deviceMapper.getRunManageDevList(devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
return new Page<>(PageFactory.getPageNum(runManageParam), PageFactory.getPageSize(runManageParam));
|
||||||
List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVOList = deviceMapper.getOnlineEvaluate(devIndexes, runManageParam.getSearchBeginTime(), runManageParam.getSearchEndTime());
|
|
||||||
Map<String, LineInfluxDbOnlineVO> map = lineInfluxDbOnlineVOList.stream().collect(Collectors.toMap(LineInfluxDbOnlineVO::getDevIndex, Function.identity()));
|
|
||||||
runManageDevList = runManageDevList.stream().peek(item -> item.setOnlineEvaluate(!map.containsKey(item.getId()) ? 3.14159 : NumberUtil.round(map.get(item.getId()).getOnlineRate(), 4).doubleValue())).collect(Collectors.toList());
|
|
||||||
String evaluate = runManageParam.getEvaluate();
|
|
||||||
if (StrUtil.isNotBlank(evaluate)) {
|
|
||||||
runManageDevList = runManageDevList.stream().filter(x -> filterOnlineEvaluate(evaluate, x.getOnlineEvaluate())).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
return deviceMapper.getRunManageDevList(new Page<>(PageFactory.getPageNum(runManageParam), PageFactory.getPageSize(runManageParam)),devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
||||||
return runManageDevList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,14 +23,13 @@ import com.njcn.device.pq.pojo.po.LineDetail;
|
|||||||
import com.njcn.device.pq.pojo.vo.DeptLineTreeVO;
|
import com.njcn.device.pq.pojo.vo.DeptLineTreeVO;
|
||||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||||
import com.njcn.device.pq.service.TerminalTreeService;
|
import com.njcn.device.pq.service.TerminalTreeService;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
import com.njcn.device.userledger.service.UserLedgerService;
|
||||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||||
import com.njcn.system.pojo.po.Area;
|
import com.njcn.system.pojo.po.Area;
|
||||||
import com.njcn.user.api.DeptFeignClient;
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
import com.njcn.user.pojo.po.Dept;
|
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -66,7 +65,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
|||||||
|
|
||||||
private final TreeMapper treeMapper;
|
private final TreeMapper treeMapper;
|
||||||
|
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
private final UserLedgerService userLedgerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 台账页面终端树
|
* 台账页面终端树
|
||||||
@@ -114,7 +113,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
|||||||
|
|
||||||
|
|
||||||
UserReportParam userReportParam = new UserReportParam();
|
UserReportParam userReportParam = new UserReportParam();
|
||||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
List<UserLedgerVO> userReportPOList = userLedgerService.selectUserList(userReportParam);
|
||||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||||
Map<String, List<UserLedgerVO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserLedgerVO::getStationId));
|
Map<String, List<UserLedgerVO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserLedgerVO::getStationId));
|
||||||
|
|
||||||
@@ -194,13 +193,16 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
||||||
if (Objects.isNull(userReportPO)) {
|
|
||||||
System.out.println(map);
|
|
||||||
}
|
|
||||||
TerminalTree terminalTree = new TerminalTree();
|
TerminalTree terminalTree = new TerminalTree();
|
||||||
terminalTree.setName(userReportPO.getProjectName());
|
if (Objects.isNull(userReportPO)) {
|
||||||
terminalTree.setId(userReportPO.getId());
|
terminalTree.setName("用户对象缺失");
|
||||||
terminalTree.setPid(userReportPO.getStationId());
|
terminalTree.setId(objId);
|
||||||
|
terminalTree.setPid("");
|
||||||
|
}else {
|
||||||
|
terminalTree.setName(userReportPO.getProjectName());
|
||||||
|
terminalTree.setId(userReportPO.getId());
|
||||||
|
terminalTree.setPid(userReportPO.getStationId());
|
||||||
|
}
|
||||||
terminalTree.setPowerFlag(1);
|
terminalTree.setPowerFlag(1);
|
||||||
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||||
terminalTree.setChildren(temDevList);
|
terminalTree.setChildren(temDevList);
|
||||||
@@ -272,7 +274,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
|||||||
} else {
|
} else {
|
||||||
// 获取用户
|
// 获取用户
|
||||||
UserReportParam userReportParam = new UserReportParam();
|
UserReportParam userReportParam = new UserReportParam();
|
||||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
List<UserLedgerVO> userReportPOList = userLedgerService.selectUserList(userReportParam);
|
||||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||||
Map<String, UserLedgerVO> userMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
Map<String, UserLedgerVO> userMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,7 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.njcn</groupId>
|
|
||||||
<artifactId>supervision-api</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>common-oss</artifactId>
|
<artifactId>common-oss</artifactId>
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.njcn.device.device.mapper.DeviceMapper;
|
|||||||
import com.njcn.device.device.service.DeviceBakService;
|
import com.njcn.device.device.service.DeviceBakService;
|
||||||
import com.njcn.device.device.service.DeviceProcessService;
|
import com.njcn.device.device.service.DeviceProcessService;
|
||||||
import com.njcn.device.device.service.NodeDeviceService;
|
import com.njcn.device.device.service.NodeDeviceService;
|
||||||
|
import com.njcn.device.device.service.PqDevTypeService;
|
||||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
@@ -61,7 +62,9 @@ import com.njcn.device.pq.utils.DeviceUtil;
|
|||||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||||
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
||||||
|
import com.njcn.device.userledger.service.UserLedgerService;
|
||||||
import com.njcn.device.utils.ExcelStyleUtil;
|
import com.njcn.device.utils.ExcelStyleUtil;
|
||||||
|
import com.njcn.device.utils.LineSortHelper;
|
||||||
import com.njcn.message.api.ProduceFeignClient;
|
import com.njcn.message.api.ProduceFeignClient;
|
||||||
import com.njcn.message.constant.DeviceRebootType;
|
import com.njcn.message.constant.DeviceRebootType;
|
||||||
import com.njcn.message.constant.RedisKeyPrefix;
|
import com.njcn.message.constant.RedisKeyPrefix;
|
||||||
@@ -73,7 +76,8 @@ import com.njcn.oss.utils.FileStorageUtil;
|
|||||||
import com.njcn.poi.excel.ExcelUtil;
|
import com.njcn.poi.excel.ExcelUtil;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||||
|
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
@@ -97,7 +101,6 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -140,7 +143,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
private final NodeDeviceService nodeDeviceService;
|
private final NodeDeviceService nodeDeviceService;
|
||||||
private final DeviceProcessService deviceProcessService;
|
private final DeviceProcessService deviceProcessService;
|
||||||
private final ProduceFeignClient produceFeignClient;
|
private final ProduceFeignClient produceFeignClient;
|
||||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
private final UserLedgerService userLedgerService;
|
||||||
|
private final PqDevTypeService pqDevTypeService;
|
||||||
|
private final LineSortHelper lineSortHelper;
|
||||||
|
|
||||||
@Value("${oracle.isSync}")
|
@Value("${oracle.isSync}")
|
||||||
private Boolean isSync;
|
private Boolean isSync;
|
||||||
@@ -202,6 +207,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
if (StrUtil.isBlank(projectIndex)) {
|
if (StrUtil.isBlank(projectIndex)) {
|
||||||
checkName(addTerminalParam, PROJECT_LEVEL.getCode(), null);
|
checkName(addTerminalParam, PROJECT_LEVEL.getCode(), null);
|
||||||
Line line = assembleLine(addTerminalParam.getProjectParam().getName(), PROJECT_LEVEL.getCode(), "0", "0", addTerminalParam.getProjectParam().getSort());
|
Line line = assembleLine(addTerminalParam.getProjectParam().getName(), PROJECT_LEVEL.getCode(), "0", "0", addTerminalParam.getProjectParam().getSort());
|
||||||
|
lineSortHelper.handleSort(PROJECT_LEVEL.getCode(),addTerminalParam.getProjectParam().getSort(),line);
|
||||||
this.baseMapper.insert(line);
|
this.baseMapper.insert(line);
|
||||||
projectIndex = line.getId();
|
projectIndex = line.getId();
|
||||||
}
|
}
|
||||||
@@ -216,6 +222,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
LogUtil.njcnDebug(log, "获取区域信息:{}", result.toString());
|
LogUtil.njcnDebug(log, "获取区域信息:{}", result.toString());
|
||||||
checkName(addTerminalParam, PROVINCE_LEVEL.getCode(), projectIndex);
|
checkName(addTerminalParam, PROVINCE_LEVEL.getCode(), projectIndex);
|
||||||
Line province = assembleLine(result.getId(), PROVINCE_LEVEL.getCode(), projectIndex, projectIndex, addTerminalParam.getProvinceParam().getSort());
|
Line province = assembleLine(result.getId(), PROVINCE_LEVEL.getCode(), projectIndex, projectIndex, addTerminalParam.getProvinceParam().getSort());
|
||||||
|
lineSortHelper.handleSort(PROVINCE_LEVEL.getCode(),addTerminalParam.getProvinceParam().getSort(),province);
|
||||||
this.baseMapper.insert(province);
|
this.baseMapper.insert(province);
|
||||||
provinceIndex = province.getId();
|
provinceIndex = province.getId();
|
||||||
}
|
}
|
||||||
@@ -226,6 +233,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
if (StrUtil.isBlank(gdIndex) && StrUtil.isNotBlank(provinceIndex)) {
|
if (StrUtil.isBlank(gdIndex) && StrUtil.isNotBlank(provinceIndex)) {
|
||||||
checkName(addTerminalParam, GD_LEVEL.getCode(), provinceIndex);
|
checkName(addTerminalParam, GD_LEVEL.getCode(), provinceIndex);
|
||||||
Line gdInformation = assembleLine(addTerminalParam.getGdInformationParam().getName(), GD_LEVEL.getCode(), provinceIndex, projectIndex + StrUtil.COMMA + provinceIndex, addTerminalParam.getGdInformationParam().getSort());
|
Line gdInformation = assembleLine(addTerminalParam.getGdInformationParam().getName(), GD_LEVEL.getCode(), provinceIndex, projectIndex + StrUtil.COMMA + provinceIndex, addTerminalParam.getGdInformationParam().getSort());
|
||||||
|
lineSortHelper.handleSort(GD_LEVEL.getCode(),addTerminalParam.getGdInformationParam().getSort(),gdInformation);
|
||||||
this.baseMapper.insert(gdInformation);
|
this.baseMapper.insert(gdInformation);
|
||||||
gdIndex = gdInformation.getId();
|
gdIndex = gdInformation.getId();
|
||||||
}
|
}
|
||||||
@@ -236,6 +244,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
|
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
|
||||||
checkName(addTerminalParam, LineBaseEnum.SUB_LEVEL.getCode(), gdIndex);
|
checkName(addTerminalParam, LineBaseEnum.SUB_LEVEL.getCode(), gdIndex);
|
||||||
Line subStation = assembleLine(addTerminalParam.getSubStationParam().getName(), LineBaseEnum.SUB_LEVEL.getCode(), gdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex, addTerminalParam.getSubStationParam().getSort());
|
Line subStation = assembleLine(addTerminalParam.getSubStationParam().getName(), LineBaseEnum.SUB_LEVEL.getCode(), gdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex, addTerminalParam.getSubStationParam().getSort());
|
||||||
|
lineSortHelper.handleSort(SUB_LEVEL.getCode(),addTerminalParam.getSubStationParam().getSort(),subStation);
|
||||||
this.baseMapper.insert(subStation);
|
this.baseMapper.insert(subStation);
|
||||||
subIndex = subStation.getId();
|
subIndex = subStation.getId();
|
||||||
|
|
||||||
@@ -256,6 +265,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) {
|
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) {
|
||||||
//校验变电站下的装置名称ip是否重复
|
//校验变电站下的装置名称ip是否重复
|
||||||
checkDevNameAndIp(addTerminalParam, subIndex, lineLambdaQueryWrapper);
|
checkDevNameAndIp(addTerminalParam, subIndex, lineLambdaQueryWrapper);
|
||||||
|
|
||||||
|
Integer devSort = lineSortHelper.getNextSort(DEVICE_LEVEL.getCode());
|
||||||
for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) {
|
for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) {
|
||||||
//用于记录装置id
|
//用于记录装置id
|
||||||
String devIdIndex;
|
String devIdIndex;
|
||||||
@@ -283,9 +294,16 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
|
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
|
||||||
Line device = assembleLine(deviceParam.getName(), LineBaseEnum.DEVICE_LEVEL.getCode(), subIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex, deviceParam.getSort());
|
Line device = assembleLine(deviceParam.getName(), LineBaseEnum.DEVICE_LEVEL.getCode(), subIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex, deviceParam.getSort());
|
||||||
|
if(Objects.isNull(deviceParam.getSort()) || deviceParam.getSort() == 0){
|
||||||
|
device.setSort(devSort);
|
||||||
|
}
|
||||||
this.baseMapper.insert(device);
|
this.baseMapper.insert(device);
|
||||||
|
if(Objects.isNull(deviceParam.getSort()) || deviceParam.getSort() == 0){
|
||||||
|
devSort++;
|
||||||
|
}
|
||||||
devIdIndex = device.getId();
|
devIdIndex = device.getId();
|
||||||
|
|
||||||
//装置详情
|
//装置详情
|
||||||
@@ -390,7 +408,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, voltageListBySubId.stream().map(Line::getName).collect(Collectors.joining(";")));
|
throw new BusinessException(DeviceResponseEnum.SUBV_NAME_SAME, voltageListBySubId.stream().map(Line::getName).collect(Collectors.joining(";")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Integer subvSort = lineSortHelper.getNextSort(SUB_V_LEVEL.getCode());
|
||||||
for (SubVoltageParam subVoltageParam : deviceParam.getSubVoltageParam()) {
|
for (SubVoltageParam subVoltageParam : deviceParam.getSubVoltageParam()) {
|
||||||
//母线id
|
//母线id
|
||||||
String subvIndex;
|
String subvIndex;
|
||||||
@@ -410,7 +428,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
Line subVoltage = assembleLine(subVoltageParam.getName(), LineBaseEnum.SUB_V_LEVEL.getCode(), devIdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex, subVoltageParam.getSort());
|
Line subVoltage = assembleLine(subVoltageParam.getName(), LineBaseEnum.SUB_V_LEVEL.getCode(), devIdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex, subVoltageParam.getSort());
|
||||||
|
if(Objects.isNull(subVoltageParam.getSort()) || subVoltageParam.getSort() == 0) {
|
||||||
|
subVoltage.setSort(subvSort);
|
||||||
|
}
|
||||||
this.baseMapper.insert(subVoltage);
|
this.baseMapper.insert(subVoltage);
|
||||||
|
if(Objects.isNull(subVoltageParam.getSort()) || subVoltageParam.getSort() == 0) {
|
||||||
|
subvSort++;
|
||||||
|
}
|
||||||
subvIndex = subVoltage.getId();
|
subvIndex = subVoltage.getId();
|
||||||
Voltage voltage = new Voltage();
|
Voltage voltage = new Voltage();
|
||||||
voltage.setId(subVoltage.getId());
|
voltage.setId(subVoltage.getId());
|
||||||
@@ -438,6 +462,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//通用新增监测点
|
//通用新增监测点
|
||||||
|
Integer lineSort = lineSortHelper.getNextSort(LineBaseEnum.LINE_LEVEL.getCode());
|
||||||
for (LineParam lineParam : subVoltageParam.getLineParam()) {
|
for (LineParam lineParam : subVoltageParam.getLineParam()) {
|
||||||
if (StrUtil.isBlank(lineParam.getLineIndex()) && StrUtil.isNotBlank(subvIndex)) {
|
if (StrUtil.isBlank(lineParam.getLineIndex()) && StrUtil.isNotBlank(subvIndex)) {
|
||||||
//判断监测点序号是否重复
|
//判断监测点序号是否重复
|
||||||
@@ -451,7 +476,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
//删除与当前线路号重复的项
|
//删除与当前线路号重复的项
|
||||||
listLineNum.removeIf(lineNo -> lineNo.equals(lineParam.getNum()));
|
listLineNum.removeIf(lineNo -> lineNo.equals(lineParam.getNum()));
|
||||||
Line line = assembleLine(lineParam.getName(), LineBaseEnum.LINE_LEVEL.getCode(), subvIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex + StrUtil.COMMA + subvIndex, lineParam.getSort());
|
Line line = assembleLine(lineParam.getName(), LineBaseEnum.LINE_LEVEL.getCode(), subvIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex + StrUtil.COMMA + subvIndex, lineParam.getSort());
|
||||||
|
if(Objects.isNull(lineParam.getSort()) || lineParam.getSort() == 0) {
|
||||||
|
line.setSort(lineSort);
|
||||||
|
}
|
||||||
this.baseMapper.insert(line);
|
this.baseMapper.insert(line);
|
||||||
|
if(Objects.isNull(lineParam.getSort()) || lineParam.getSort() == 0) {
|
||||||
|
lineSort++;
|
||||||
|
}
|
||||||
LineDetail lineDetail = new LineDetail();
|
LineDetail lineDetail = new LineDetail();
|
||||||
BeanUtils.copyProperties(lineParam, lineDetail);
|
BeanUtils.copyProperties(lineParam, lineDetail);
|
||||||
lineDetail.setId(line.getId());
|
lineDetail.setId(line.getId());
|
||||||
@@ -478,7 +509,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
//监测点限值
|
//监测点限值
|
||||||
DictData scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()).getData();
|
DictData scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()).getData();
|
||||||
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||||
|
|
||||||
if (Objects.isNull(lineParam.getVoltageDev())) {
|
if (Objects.isNull(lineParam.getVoltageDev())) {
|
||||||
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
||||||
@@ -749,7 +780,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
float voltageLevel = Float.parseFloat(dictData.getValue());
|
float voltageLevel = Float.parseFloat(dictData.getValue());
|
||||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
for (LineDetail lineDetail : lineList) {
|
for (LineDetail lineDetail : lineList) {
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||||
overlimit.setId(lineDetail.getId());
|
overlimit.setId(lineDetail.getId());
|
||||||
overlimitMapper.deleteById(lineDetail.getId());
|
overlimitMapper.deleteById(lineDetail.getId());
|
||||||
overlimitMapper.insert(overlimit);
|
overlimitMapper.insert(overlimit);
|
||||||
@@ -836,7 +867,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
||||||
|
|
||||||
//监测点限值
|
//监测点限值
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||||
if (Objects.isNull(updateLineBO.getVoltageDev())) {
|
if (Objects.isNull(updateLineBO.getVoltageDev())) {
|
||||||
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
||||||
} else {
|
} else {
|
||||||
@@ -854,7 +885,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
if (!Objects.equals(lineDetail.getCt1(), lineDetailRes.getCt1()) || !Objects.equals(lineDetail.getCt2(), lineDetailRes.getCt2())
|
if (!Objects.equals(lineDetail.getCt1(), lineDetailRes.getCt1()) || !Objects.equals(lineDetail.getCt2(), lineDetailRes.getCt2())
|
||||||
|| !Objects.equals(lineDetail.getPt1(), lineDetailRes.getPt1()) || !Objects.equals(lineDetail.getPt2(), lineDetailRes.getPt2())
|
|| !Objects.equals(lineDetail.getPt1(), lineDetailRes.getPt1()) || !Objects.equals(lineDetail.getPt2(), lineDetailRes.getPt2())
|
||||||
|| !Objects.equals(lineDetail.getDevCapacity(), lineDetailRes.getDevCapacity()) || !Objects.equals(lineDetail.getShortCapacity(), lineDetailRes.getShortCapacity())
|
|| !Objects.equals(lineDetail.getDevCapacity(), lineDetailRes.getDevCapacity()) || !Objects.equals(lineDetail.getShortCapacity(), lineDetailRes.getShortCapacity())
|
||||||
|| !Objects.equals(lineDetail.getStandardCapacity(), lineDetailRes.getStandardCapacity()) || !Objects.equals(lineDetail.getDealCapacity(), lineDetailRes.getDealCapacity())) {
|
|| !Objects.equals(lineDetail.getStandardCapacity(), lineDetailRes.getStandardCapacity()) || !Objects.equals(lineDetail.getDealCapacity(), lineDetailRes.getDealCapacity())
|
||||||
|
|| !Objects.equals(lineDetail.getPtType(), lineDetailRes.getPtType())) {
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
String index = RequestUtil.getUserIndex();
|
String index = RequestUtil.getUserIndex();
|
||||||
queryUpdateAndInsertLog(userName, index, lineDetail, lineDetailRes);
|
queryUpdateAndInsertLog(userName, index, lineDetail, lineDetailRes);
|
||||||
@@ -886,11 +918,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
private void coderM3d(Device deviceDetail, Boolean updateFlag) {
|
private void coderM3d(Device deviceDetail, Boolean updateFlag) {
|
||||||
if (updateFlag) {
|
if (updateFlag) {
|
||||||
Device deviceRes = deviceMapper.selectById(deviceDetail.getId());
|
Device deviceRes = deviceMapper.selectById(deviceDetail.getId());
|
||||||
if (StrUtil.isNotBlank(deviceDetail.getDevKey()) && !deviceRes.getDevKey().equals(deviceDetail.getDevKey())) {
|
if (!Objects.equals(deviceRes.getDevKey(),deviceDetail.getDevKey())) {
|
||||||
deviceDetail.setDevKey(DeviceUtil.encodeString(devCD, deviceDetail.getDevKey()));
|
deviceDetail.setDevKey(DeviceUtil.encodeString(devCD, deviceDetail.getDevKey()));
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(deviceRes.getSeries(),deviceDetail.getSeries())) {
|
||||||
if (StrUtil.isNotBlank(deviceDetail.getSeries()) && !deviceRes.getSeries().equals(deviceDetail.getSeries())) {
|
|
||||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -901,7 +932,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
deviceDetail.setSeries(DeviceUtil.encodeString(devCD, deviceDetail.getSeries()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decoderM3d(Device deviceDetail) {
|
private void decoderM3d(Device deviceDetail) {
|
||||||
@@ -962,6 +992,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
sbNew.append("协议容量: ").append(newLine.getDealCapacity()).append(";");
|
sbNew.append("协议容量: ").append(newLine.getDealCapacity()).append(";");
|
||||||
sbOld.append("协议容量: ").append(oldLine.getDealCapacity()).append(";");
|
sbOld.append("协议容量: ").append(oldLine.getDealCapacity()).append(";");
|
||||||
}
|
}
|
||||||
|
//接线方式
|
||||||
|
if (!Objects.equals(newLine.getPtType(), oldLine.getPtType())) {
|
||||||
|
sbNew.append("接线方式: ").append(newLine.getPtType()).append(";");
|
||||||
|
sbOld.append("接线方式: ").append(oldLine.getPtType()).append(";");
|
||||||
|
}
|
||||||
sb.append(sbNew).append(sbOld);
|
sb.append(sbNew).append(sbOld);
|
||||||
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode());
|
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode());
|
||||||
DictData data = dicDataByCode.getData();
|
DictData data = dicDataByCode.getData();
|
||||||
@@ -989,7 +1024,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
Line obj;
|
Line obj;
|
||||||
if (level == 700) {
|
if (level == 700) {
|
||||||
obj = new Line();
|
obj = new Line();
|
||||||
UserLedgerVO userLedgerVO = userLedgerFeignClient.selectUserInfo(id).getData();
|
UserLedgerVO userLedgerVO = userLedgerService.selectUserInfo(id);
|
||||||
if (Objects.nonNull(userLedgerVO)) {
|
if (Objects.nonNull(userLedgerVO)) {
|
||||||
obj.setId(userLedgerVO.getId());
|
obj.setId(userLedgerVO.getId());
|
||||||
obj.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
obj.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||||
@@ -1628,6 +1663,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Line> getLineByCondition(List<String> ids, DeviceInfoParam deviceInfoParam) {
|
public List<Line> getLineByCondition(List<String> ids, DeviceInfoParam deviceInfoParam) {
|
||||||
|
if(StrUtil.isNotBlank(deviceInfoParam.getSearchValue())){
|
||||||
|
return this.baseMapper.getLineByConditionBySearchValue(ids, deviceInfoParam);
|
||||||
|
}
|
||||||
return this.baseMapper.getLineByCondition(ids, deviceInfoParam);
|
return this.baseMapper.getLineByCondition(ids, deviceInfoParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1728,18 +1766,24 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
List<DictData> businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData();
|
List<DictData> businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData();
|
||||||
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
||||||
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
||||||
List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData();
|
// List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData();
|
||||||
|
List<PqDevType> devTypeList = pqDevTypeService.list(new LambdaQueryWrapper<PqDevType>()
|
||||||
|
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||||
|
.orderByDesc(PqDevType::getCreateTime));
|
||||||
List<DictData> frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData();
|
List<DictData> frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData();
|
||||||
List<DictData> scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
List<DictData> scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
|
List<UserLedgerVO> userLedgerVOS = userLedgerService.selectUserList(new UserReportParam());
|
||||||
List<Node> nodeList = nodeService.nodeAllList();
|
List<Node> nodeList = nodeService.nodeAllList();
|
||||||
|
|
||||||
|
ExcelUtil.selectList(workbook, 4, 4, scaleList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
|
ExcelUtil.selectList(workbook, 40, 40, userLedgerVOS.stream().map(UserLedgerVO::getProjectName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
|
|
||||||
//这里是自己加的 带下拉框的代码
|
//这里是自己加的 带下拉框的代码
|
||||||
ExcelUtil.selectList(workbook, 8, 8, new String[]{"虚拟设备", "实际设备", "离线设备"});
|
ExcelUtil.selectList(workbook, 8, 8, new String[]{"虚拟设备", "实际设备", "离线设备"});
|
||||||
ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"});
|
ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"});
|
||||||
ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"});
|
ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"});
|
||||||
ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(PqDevType::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"});
|
ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"});
|
||||||
ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
@@ -1757,6 +1801,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"});
|
ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"});
|
||||||
ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"});
|
ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"});
|
||||||
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
|
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1845,7 +1891,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
float voltageLevel = Float.parseFloat(scaleResult.getValue());
|
float voltageLevel = Float.parseFloat(scaleResult.getValue());
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||||
overlimit.setId(lineDetail.getId());
|
overlimit.setId(lineDetail.getId());
|
||||||
overlimitMapper.insert(overlimit);
|
overlimitMapper.insert(overlimit);
|
||||||
count++;
|
count++;
|
||||||
@@ -2178,7 +2224,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
//监测点限值
|
//监测点限值
|
||||||
DictData scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()).getData();
|
DictData scaleResult = dicDataFeignClient.getDicDataById(voltage.getScale()).getData();
|
||||||
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
float scaTmp = Float.parseFloat(scaleResult.getValue());
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), 1, 0);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(scaTmp, lineDetail.getDealCapacity(), lineDetail.getDevCapacity(), lineDetail.getShortCapacity(), lineDetail.getPowerFlag(), 0);
|
||||||
|
|
||||||
if (Objects.isNull(lineParam.getVoltageDev())) {
|
if (Objects.isNull(lineParam.getVoltageDev())) {
|
||||||
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
overlimit.setVoltageDev(overlimit.getVoltageDev());
|
||||||
@@ -2726,7 +2772,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2022/5/18
|
* @date 2022/5/18
|
||||||
*/
|
*/
|
||||||
private void saveTerminalBase(List<TerminalBaseExcel> terminalBaseExcels) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void saveTerminalBase(List<TerminalBaseExcel> terminalBaseExcels) {
|
||||||
List<TerminalBaseExcel.TerminalBaseExcelMsg> terminalBaseExcelMsgs = new ArrayList<>();
|
List<TerminalBaseExcel.TerminalBaseExcelMsg> terminalBaseExcelMsgs = new ArrayList<>();
|
||||||
//任意集合数据为空,不处理
|
//任意集合数据为空,不处理
|
||||||
if (CollectionUtil.isNotEmpty(terminalBaseExcels)) {
|
if (CollectionUtil.isNotEmpty(terminalBaseExcels)) {
|
||||||
@@ -2841,9 +2888,15 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
//处理终端类型
|
//处理终端类型
|
||||||
DictData devTypeDicData = dicDataFeignClient.getDicDataByName(terminalBaseExcel.getDevType()).getData();
|
DictData devTypeDicData = dicDataFeignClient.getDicDataByName(terminalBaseExcel.getDevType()).getData();
|
||||||
|
PqDevType one = new PqDevType();
|
||||||
if (Objects.isNull(devTypeDicData)) {
|
if (Objects.isNull(devTypeDicData)) {
|
||||||
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典装置型号不存在"));
|
//上边逻辑不删兼容旧版本,新版本查询pq_dev_type
|
||||||
continue;
|
one = pqDevTypeService.lambdaQuery().eq(PqDevType::getName, terminalBaseExcel.getDevType()).eq(PqDevType::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
|
if(Objects.isNull(one)){
|
||||||
|
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典装置型号不存在"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.baseMapper.insert(temp);
|
this.baseMapper.insert(temp);
|
||||||
Device device = new Device();
|
Device device = new Device();
|
||||||
@@ -2853,7 +2906,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
device.setIp(terminalBaseExcel.getIp());
|
device.setIp(terminalBaseExcel.getIp());
|
||||||
device.setNodeId(node.getId());
|
device.setNodeId(node.getId());
|
||||||
device.setFrontType(frontTypeDicData.getId());
|
device.setFrontType(frontTypeDicData.getId());
|
||||||
device.setDevType(devTypeDicData.getId());
|
device.setDevType(Objects.isNull(devTypeDicData)?one.getId():devTypeDicData.getId());
|
||||||
device.setComFlag(0);
|
device.setComFlag(0);
|
||||||
device.setCheckFlag(1);
|
device.setCheckFlag(1);
|
||||||
device.setLoginTime(LocalDate.now());
|
device.setLoginTime(LocalDate.now());
|
||||||
@@ -2862,7 +2915,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
device.setUpdateTime(LocalDateTime.now());
|
device.setUpdateTime(LocalDateTime.now());
|
||||||
device.setElectroplate(0);
|
device.setElectroplate(0);
|
||||||
device.setOnTime(1);
|
device.setOnTime(1);
|
||||||
|
//处理装置识别码秘钥
|
||||||
|
coderM3d(device, false);
|
||||||
deviceMapper.insert(device);
|
deviceMapper.insert(device);
|
||||||
|
//分配前置进程
|
||||||
|
nodeDeviceService.oneKeyDistribution(node.getId());
|
||||||
}
|
}
|
||||||
//添加终端索引
|
//添加终端索引
|
||||||
pids.add(temp.getId());
|
pids.add(temp.getId());
|
||||||
@@ -2889,6 +2946,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
//处理电压等级字典表
|
//处理电压等级字典表
|
||||||
DictData subvScale = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
DictData subvScale = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
|
|
||||||
if (Objects.isNull(subvScale)) {
|
if (Objects.isNull(subvScale)) {
|
||||||
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典电压等级:" + terminalBaseExcel.getSubStationScale() + "不存在"));
|
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典电压等级:" + terminalBaseExcel.getSubStationScale() + "不存在"));
|
||||||
continue;
|
continue;
|
||||||
@@ -2966,11 +3024,20 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
lineDetail.setPt2(Float.valueOf(pt[1]));
|
lineDetail.setPt2(Float.valueOf(pt[1]));
|
||||||
lineDetail.setCt1(Float.valueOf(ct[0]));
|
lineDetail.setCt1(Float.valueOf(ct[0]));
|
||||||
lineDetail.setCt2(Float.valueOf(ct[1]));
|
lineDetail.setCt2(Float.valueOf(ct[1]));
|
||||||
|
if(StringUtils.isNoneBlank(terminalBaseExcel.getObjName())){
|
||||||
|
UserReportPO one = userLedgerService.lambdaQuery().eq(UserReportPO::getProjectName, terminalBaseExcel.getObjName())
|
||||||
|
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode()).one();
|
||||||
|
if(Objects.nonNull(one)){
|
||||||
|
lineDetail.setObjId(one.getId());
|
||||||
|
|
||||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(), DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
|
|
||||||
lineDetailMapper.insert(lineDetail);
|
lineDetailMapper.insert(lineDetail);
|
||||||
Overlimit overlimit = COverlimitUtil.globalAssemble(Float.parseFloat(dictData.getValue()), terminalBaseExcel.getDealCapacity(), terminalBaseExcel.getDevCapacity(), terminalBaseExcel.getShortCapacity(), null, null);
|
Overlimit overlimit = COverlimitUtil.globalAssemble(Float.parseFloat(dictData.getValue()), terminalBaseExcel.getDealCapacity(), terminalBaseExcel.getDevCapacity(), terminalBaseExcel.getShortCapacity(), terminalBaseExcel.getPowerFlag(), 0);
|
||||||
overlimit.setId(temp.getId());
|
overlimit.setId(temp.getId());
|
||||||
overlimitMapper.insert(overlimit);
|
overlimitMapper.insert(overlimit);
|
||||||
}
|
}
|
||||||
@@ -3854,14 +3921,29 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
//设备删除找不到设备名称,重日志截取
|
//设备删除找不到设备名称,重日志截取
|
||||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||||
String temLos = "%s名称:%s;前置信息:%s";
|
//删除有2种情况,1.设备删除,2,设备状态修改;
|
||||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
if (lineMap.containsKey(deviceId)) {
|
||||||
String devName = strings.get(1); // 设备名称
|
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||||
String nodeName = strings.get(2); // 进程名称
|
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||||
pqsTerminalPushLogDTO.setDevName(devName);
|
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
pqsTerminalPushLogDTO.setNodeName(nodeMap.containsKey(nodeId)?nodeMap.get(nodeId).getName():"删除前置");
|
||||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
|
||||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
}else {
|
||||||
|
if(temp.getTerminalDescribe().contains("前置信息")){
|
||||||
|
String temLos = "%s名称:%s;前置信息:%s";
|
||||||
|
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||||
|
String devName = strings.get(1); // 设备名称
|
||||||
|
String nodeName = strings.get(2); // 进程名称
|
||||||
|
pqsTerminalPushLogDTO.setDevName(devName);
|
||||||
|
String nodeId = nodeNameMap.get(nodeName).getId();
|
||||||
|
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||||
|
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
||||||
|
}else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
||||||
if (lineMap.containsKey(deviceId)) {
|
if (lineMap.containsKey(deviceId)) {
|
||||||
@@ -4283,6 +4365,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
|
|
||||||
// 比较装置 所属前置
|
// 比较装置 所属前置
|
||||||
flag |= compareAndAppend(stringBuilder, devDetail.getNodeId(), updateDeviceParam.getNodeId(), "终端所属前置机");
|
flag |= compareAndAppend(stringBuilder, devDetail.getNodeId(), updateDeviceParam.getNodeId(), "终端所属前置机");
|
||||||
|
//如果前置机切换,可能装置在进程2上,但是切换后前置机只有一个进程,因此修改装置进程表设为默认进程1
|
||||||
|
if(!Objects.equals(updateDeviceParam.getNodeId(), devDetail.getNodeId())){
|
||||||
|
deviceProcessService.lambdaUpdate().eq(DeviceProcess::getId,devDetail.getId()).set(DeviceProcess::getProcessNo,1).update();
|
||||||
|
}
|
||||||
|
|
||||||
// 比较装置端口号
|
// 比较装置端口号
|
||||||
flag |= compareAndAppend(stringBuilder, devDetail.getPort(), updateDeviceParam.getPort(), "终端端口号");
|
flag |= compareAndAppend(stringBuilder, devDetail.getPort(), updateDeviceParam.getPort(), "终端端口号");
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ package com.njcn.device.device.controller;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.lang.Console;
|
import cn.hutool.core.lang.Console;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
|
||||||
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
|
||||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
@@ -27,12 +24,10 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -57,132 +52,132 @@ public class DeviceController extends BaseController {
|
|||||||
|
|
||||||
private final GeneralDeviceService generalDeviceService;
|
private final GeneralDeviceService generalDeviceService;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/socketLine")
|
// @PostMapping("/socketLine")
|
||||||
@ApiOperation("获取监测点定值信息")
|
// @ApiOperation("获取监测点定值信息")
|
||||||
public HttpResult<String> socketLine(@RequestBody @Validated ConstantValueParam.Constant param) {
|
// public HttpResult<String> socketLine(@RequestBody @Validated ConstantValueParam.Constant param) {
|
||||||
String methodDescribe = getMethodDescribe("socketLine");
|
// String methodDescribe = getMethodDescribe("socketLine");
|
||||||
if(StrUtil.isBlank(param.getIp())){
|
// if(StrUtil.isBlank(param.getIp())){
|
||||||
param.setIp(RequestUtil.getRealIp());
|
// param.setIp(RequestUtil.getRealIp());
|
||||||
}
|
// }
|
||||||
String s = iDeviceService.sentLine(param);
|
// String s = iDeviceService.sentLine(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/updateSocketLine")
|
// @PostMapping("/updateSocketLine")
|
||||||
@ApiOperation("修改监测点定值信息")
|
// @ApiOperation("修改监测点定值信息")
|
||||||
public HttpResult<String> updateSocketLine(@RequestBody @Validated ConstantValueParam.ValueData param) {
|
// public HttpResult<String> updateSocketLine(@RequestBody @Validated ConstantValueParam.ValueData param) {
|
||||||
String methodDescribe = getMethodDescribe("updateSocketLine");
|
// String methodDescribe = getMethodDescribe("updateSocketLine");
|
||||||
if(StrUtil.isBlank(param.getIp())){
|
// if(StrUtil.isBlank(param.getIp())){
|
||||||
param.setIp(RequestUtil.getRealIp());
|
// param.setIp(RequestUtil.getRealIp());
|
||||||
}
|
// }
|
||||||
String s = iDeviceService.sentLineData(param);
|
// String s = iDeviceService.sentLineData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/socketDev")
|
// @PostMapping("/socketDev")
|
||||||
@ApiOperation("获取终端定值信息")
|
// @ApiOperation("获取终端定值信息")
|
||||||
public HttpResult<String> socketDev(@RequestBody @Validated ConstantValueParam.Constant param) {
|
// public HttpResult<String> socketDev(@RequestBody @Validated ConstantValueParam.Constant param) {
|
||||||
String methodDescribe = getMethodDescribe("socketDev");
|
// String methodDescribe = getMethodDescribe("socketDev");
|
||||||
if(StrUtil.isBlank(param.getIp())){
|
// if(StrUtil.isBlank(param.getIp())){
|
||||||
param.setIp(RequestUtil.getRealIp());
|
// param.setIp(RequestUtil.getRealIp());
|
||||||
}
|
// }
|
||||||
String s = iDeviceService.sentDev(param);
|
// String s = iDeviceService.sentDev(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/updateSocketDev")
|
// @PostMapping("/updateSocketDev")
|
||||||
@ApiOperation("修改终端定值信息")
|
// @ApiOperation("修改终端定值信息")
|
||||||
public HttpResult<String> updateSocketDev(@RequestBody @Validated ConstantValueParam.ValueData param) {
|
// public HttpResult<String> updateSocketDev(@RequestBody @Validated ConstantValueParam.ValueData param) {
|
||||||
String methodDescribe = getMethodDescribe("updateSocketDev");
|
// String methodDescribe = getMethodDescribe("updateSocketDev");
|
||||||
if(StrUtil.isBlank(param.getIp())){
|
// if(StrUtil.isBlank(param.getIp())){
|
||||||
param.setIp(RequestUtil.getRealIp());
|
// param.setIp(RequestUtil.getRealIp());
|
||||||
}
|
// }
|
||||||
String s = iDeviceService.sentDevData(param);
|
// String s = iDeviceService.sentDevData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/socketDevProperty")
|
// @PostMapping("/socketDevProperty")
|
||||||
@ApiOperation("获取终端性能信息")
|
// @ApiOperation("获取终端性能信息")
|
||||||
public HttpResult<String> socketDevProperty(String devID) {
|
// public HttpResult<String> socketDevProperty(String devID) {
|
||||||
String methodDescribe = getMethodDescribe("socketDevProperty");
|
// String methodDescribe = getMethodDescribe("socketDevProperty");
|
||||||
String s = iDeviceService.socketDevProperty(devID);
|
// String s = iDeviceService.socketDevProperty(devID);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/socketDevPropertyClose")
|
// @PostMapping("/socketDevPropertyClose")
|
||||||
@ApiOperation("终端性能关闭")
|
// @ApiOperation("终端性能关闭")
|
||||||
public HttpResult<String> socketDevPropertyClose(String devID) {
|
// public HttpResult<String> socketDevPropertyClose(String devID) {
|
||||||
String methodDescribe = getMethodDescribe("socketDevPropertyClose");
|
// String methodDescribe = getMethodDescribe("socketDevPropertyClose");
|
||||||
String s = iDeviceService.socketDevPropertyClose(devID);
|
// String s = iDeviceService.socketDevPropertyClose(devID);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/realTimeData")
|
// @PostMapping("/realTimeData")
|
||||||
@ApiOperation("监测点实时数据查看")
|
// @ApiOperation("监测点实时数据查看")
|
||||||
public HttpResult<String> realTimeData(String lineID) {
|
// public HttpResult<String> realTimeData(String lineID) {
|
||||||
String methodDescribe = getMethodDescribe("realTimeData");
|
// String methodDescribe = getMethodDescribe("realTimeData");
|
||||||
String s = iDeviceService.realTimeData(lineID);
|
// String s = iDeviceService.realTimeData(lineID);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/heartRealTimeData")
|
// @PostMapping("/heartRealTimeData")
|
||||||
@ApiOperation("监测实施数据心跳")
|
// @ApiOperation("监测实施数据心跳")
|
||||||
public HttpResult<String> heartRealTimeData(String lineID) {
|
// public HttpResult<String> heartRealTimeData(String lineID) {
|
||||||
String methodDescribe = getMethodDescribe("heartRealTimeData");
|
// String methodDescribe = getMethodDescribe("heartRealTimeData");
|
||||||
String s = iDeviceService.heartRealTimeData(lineID);
|
// String s = iDeviceService.heartRealTimeData(lineID);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/closeRealTimeData")
|
// @PostMapping("/closeRealTimeData")
|
||||||
@ApiOperation("监测点实施数据关闭")
|
// @ApiOperation("监测点实施数据关闭")
|
||||||
public HttpResult<String> closeRealTimeData(String lineID) {
|
// public HttpResult<String> closeRealTimeData(String lineID) {
|
||||||
String methodDescribe = getMethodDescribe("closeRealTimeData");
|
// String methodDescribe = getMethodDescribe("closeRealTimeData");
|
||||||
String s = iDeviceService.closeRealTimeData(lineID);
|
// String s = iDeviceService.closeRealTimeData(lineID);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/getDevUpgrades")
|
// @PostMapping("/getDevUpgrades")
|
||||||
@ApiOperation("终端版本升级")
|
// @ApiOperation("终端版本升级")
|
||||||
public HttpResult<String> getDevUpgrades(@RequestBody @Validated ConstantValueParam.Upgrades param) {
|
// public HttpResult<String> getDevUpgrades(@RequestBody @Validated ConstantValueParam.Upgrades param) {
|
||||||
String methodDescribe = getMethodDescribe("getDevUpgrades");
|
// String methodDescribe = getMethodDescribe("getDevUpgrades");
|
||||||
String s = iDeviceService.getDevUpgrades(param.getList(),param.getEdIndex());
|
// String s = iDeviceService.getDevUpgrades(param.getList(),param.getEdIndex());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/closeUpgrades")
|
// @PostMapping("/closeUpgrades")
|
||||||
@ApiOperation("终端升级取消")
|
// @ApiOperation("终端升级取消")
|
||||||
public HttpResult<String> closeUpgrades(@RequestBody List<String> devList) {
|
// public HttpResult<String> closeUpgrades(@RequestBody List<String> devList) {
|
||||||
String methodDescribe = getMethodDescribe("closeUpgrades");
|
// String methodDescribe = getMethodDescribe("closeUpgrades");
|
||||||
String s = iDeviceService.closeUpgrades(devList);
|
// String s = iDeviceService.closeUpgrades(devList);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
// @OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/restartDev")
|
// @PostMapping("/restartDev")
|
||||||
@ApiOperation("重启装置命令")
|
// @ApiOperation("重启装置命令")
|
||||||
public HttpResult<String> restartDev(@RequestBody List<String> devList) {
|
// public HttpResult<String> restartDev(@RequestBody List<String> devList) {
|
||||||
String methodDescribe = getMethodDescribe("restartDev");
|
// String methodDescribe = getMethodDescribe("restartDev");
|
||||||
String s = iDeviceService.restartDev(devList);
|
// String s = iDeviceService.restartDev(devList);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||||
}
|
// }
|
||||||
@MqttSubscribe(value = "/zl/devData/{devID}",qos = 1)
|
// @MqttSubscribe(value = "/zl/devData/{devID}",qos = 1)
|
||||||
public void responseRtData(String topic, @NamedValue("devID") String pageId, MqttMessage message, @Payload String payload) {
|
// public void responseRtData(String topic, @NamedValue("devID") String pageId, MqttMessage message, @Payload String payload) {
|
||||||
Console.log("receive from : {}", topic);
|
// Console.log("receive from : {}", topic);
|
||||||
Console.log("receive from : {}", pageId);
|
// Console.log("receive from : {}", pageId);
|
||||||
Console.log("message : {}", message.getPayload());
|
// Console.log("message : {}", message.getPayload());
|
||||||
Console.log("message payload : {}", new String(message.getPayload(), StandardCharsets.UTF_8));
|
// Console.log("message payload : {}", new String(message.getPayload(), StandardCharsets.UTF_8));
|
||||||
Console.log("string payload : {}", payload);
|
// Console.log("string payload : {}", payload);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@PostMapping("/updateDevCheckTime")
|
@PostMapping("/updateDevCheckTime")
|
||||||
|
|||||||
@@ -36,6 +36,19 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
List<Device> getDeviceBySubId(@Param("subId") String subId,@Param("ip") String ip,@Param("port") Integer port,@Param("devId")String devId);
|
List<Device> getDeviceBySubId(@Param("subId") String subId,@Param("ip") String ip,@Param("port") Integer port,@Param("devId")String devId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监测点台账信息
|
||||||
|
* @param list 监测点集合
|
||||||
|
* @param comFlag 状态
|
||||||
|
* @param searchValue
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Page<RunManageVO> getRunManageCommList(@Param("page")Page<RunTimeVO> page,
|
||||||
|
@Param("list") List<String> list,
|
||||||
|
@Param("comFlag") List<Integer> comFlag,
|
||||||
|
@Param("runFlag") List<Integer> runFlag,
|
||||||
|
@Param("searchValue") String searchValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取监测点台账信息
|
* 获取监测点台账信息
|
||||||
* @param list 监测点集合
|
* @param list 监测点集合
|
||||||
@@ -57,7 +70,8 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
|||||||
* @param searchValue
|
* @param searchValue
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
List<RunTimeVO> getRunManageDevList(@Param("list") List<String> list,
|
Page<RunTimeVO> getRunManageDevList(@Param("page")Page<RunTimeVO> page,
|
||||||
|
@Param("list") List<String> list,
|
||||||
@Param("comFlag") List<Integer> comFlag,
|
@Param("comFlag") List<Integer> comFlag,
|
||||||
@Param("runFlag") List<Integer> runFlag,
|
@Param("runFlag") List<Integer> runFlag,
|
||||||
@Param("manufacturers") List<String> manufacturer,
|
@Param("manufacturers") List<String> manufacturer,
|
||||||
|
|||||||
@@ -16,6 +16,128 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getRunManageCommList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
||||||
|
SELECT
|
||||||
|
linedetail.Num AS id,
|
||||||
|
line.NAME AS lineName,
|
||||||
|
area.NAME AS areaName,
|
||||||
|
gd.NAME AS gdName,
|
||||||
|
sub.NAME AS bdName,
|
||||||
|
scaleId.Name as scale,
|
||||||
|
manufacturerId.name as manufacturer,
|
||||||
|
dev.name as devName,
|
||||||
|
device.IP as ip,
|
||||||
|
case linedetail.Run_Flag
|
||||||
|
when 0 then '投运'
|
||||||
|
when 1 then '检修'
|
||||||
|
when 2 then '停运'
|
||||||
|
when 3 then '调试'
|
||||||
|
when 4 then '退运'
|
||||||
|
end as runFlag,
|
||||||
|
case device.Com_Flag
|
||||||
|
when 0 then '中断'
|
||||||
|
when 1 then '正常'
|
||||||
|
end as comFlag,
|
||||||
|
loadtypeId.Name as loadType,
|
||||||
|
businesstypeId.name as businessType,
|
||||||
|
IFNULL(obj.project_name,'/') as objName,
|
||||||
|
case linedetail.PT_Type
|
||||||
|
when 0 then '星型接线'
|
||||||
|
when 1 then '三角型接线'
|
||||||
|
when 2 then '开口三角型接线'
|
||||||
|
end as ptType,
|
||||||
|
CONCAT(linedetail.PT1,'/', linedetail.PT2) as pt,
|
||||||
|
CONCAT(linedetail.CT1,'/', linedetail.CT2) as ct,
|
||||||
|
linedetail.Standard_Capacity as standardCapacity,
|
||||||
|
linedetail.Short_Capacity as shortCapacity,
|
||||||
|
linedetail.Dev_Capacity as devCapacity,
|
||||||
|
linedetail.Deal_Capacity as dealCapacity,
|
||||||
|
overlimit.Freq_Dev as freqDev,
|
||||||
|
overlimit.Voltage_Dev as voltageDev,
|
||||||
|
overlimit.Uvoltage_Dev as uvoltageDev,
|
||||||
|
overlimit.Ubalance as ubalance,
|
||||||
|
overlimit.I_Neg as iNeg,
|
||||||
|
overlimit.Flicker as flicker,
|
||||||
|
overlimit.Uaberrance as uaberrance,
|
||||||
|
overlimit.Uharm_3 as oddHarm,
|
||||||
|
overlimit.Uharm_2 as evenHarm,
|
||||||
|
overlimit.Iharm_2 as iharm2,
|
||||||
|
overlimit.Iharm_3 as iharm3,
|
||||||
|
overlimit.Iharm_4 as iharm4,
|
||||||
|
overlimit.Iharm_5 as iharm5,
|
||||||
|
overlimit.Iharm_6 as iharm6,
|
||||||
|
overlimit.Iharm_7 as iharm7,
|
||||||
|
overlimit.Iharm_8 as iharm8,
|
||||||
|
overlimit.Iharm_9 as iharm9,
|
||||||
|
overlimit.Iharm_10 as iharm10,
|
||||||
|
overlimit.Iharm_11 as iharm11,
|
||||||
|
overlimit.Iharm_12 as iharm12,
|
||||||
|
overlimit.Iharm_13 as iharm13,
|
||||||
|
overlimit.Iharm_14 as iharm14,
|
||||||
|
overlimit.Iharm_15 as iharm15,
|
||||||
|
overlimit.Iharm_16 as iharm16,
|
||||||
|
overlimit.Iharm_17 as iharm17,
|
||||||
|
overlimit.Iharm_18 as iharm18,
|
||||||
|
overlimit.Iharm_19 as iharm19,
|
||||||
|
overlimit.Iharm_20 as iharm20,
|
||||||
|
overlimit.Iharm_21 as iharm21,
|
||||||
|
overlimit.Iharm_22 as iharm22,
|
||||||
|
overlimit.Iharm_23 as iharm23,
|
||||||
|
overlimit.Iharm_24 as iharm24,
|
||||||
|
overlimit.Iharm_25 as iharm25,
|
||||||
|
overlimit.InUharm_1 as inUharm,
|
||||||
|
overlimit.InUharm_16 as inUharm16
|
||||||
|
FROM pq_line line
|
||||||
|
inner join pq_line_detail detail on line.id = detail.id
|
||||||
|
left join supervision_user_report obj on obj.id = detail.obj_id
|
||||||
|
INNER JOIN pq_line vol ON vol.Id = line.Pid
|
||||||
|
INNER JOIN pq_line dev ON dev.Id = vol.Pid
|
||||||
|
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
||||||
|
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||||
|
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
||||||
|
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
||||||
|
INNER JOIN pq_overlimit overlimit ON overlimit.Id = line.Id
|
||||||
|
INNER JOIN pq_voltage voltage ON voltage.Id = vol.Id
|
||||||
|
INNER JOIN sys_dict_data scaleId ON scaleId.Id = voltage.Scale
|
||||||
|
INNER JOIN pq_device device ON device.Id = dev.Id
|
||||||
|
INNER JOIN sys_dict_data manufacturerId ON manufacturerId.Id = device.Manufacturer
|
||||||
|
INNER JOIN pq_line_detail linedetail ON linedetail.Id = line.Id
|
||||||
|
INNER JOIN sys_dict_data loadtypeId ON loadtypeId.Id = linedetail.Load_Type
|
||||||
|
INNER JOIN sys_dict_data businesstypeId ON businesstypeId.Id = linedetail.Business_Type
|
||||||
|
WHERE line.Id in
|
||||||
|
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
<if test="comFlag.size()!=0">
|
||||||
|
and device.Com_Flag in
|
||||||
|
<foreach item="item2" collection="comFlag" open="(" separator="," close=")">
|
||||||
|
#{item2}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="runFlag.size()!=0">
|
||||||
|
and linedetail.run_Flag in
|
||||||
|
<foreach item="item" collection="runFlag" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="searchValue != '' and searchValue != null ">
|
||||||
|
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||||
|
AND (sub.NAME LIKE #{searchValueLike}
|
||||||
|
OR dev.name LIKE #{searchValueLike}
|
||||||
|
OR line.NAME LIKE #{searchValueLike}
|
||||||
|
OR loadtypeId.Name LIKE #{searchValueLike}
|
||||||
|
OR manufacturerId.name LIKE #{searchValueLike}
|
||||||
|
OR obj.project_name LIKE #{searchValueLike}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
ORDER BY
|
||||||
|
gdName,
|
||||||
|
bdName,
|
||||||
|
devNAME,
|
||||||
|
objName
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getRunManageList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
<select id="getRunManageList" resultType="com.njcn.device.pq.pojo.vo.RunManageVO">
|
||||||
SELECT
|
SELECT
|
||||||
linedetail.Num AS id,
|
linedetail.Num AS id,
|
||||||
@@ -137,10 +259,12 @@
|
|||||||
|
|
||||||
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
<select id="getRunManageDevList" resultType="com.njcn.device.pq.pojo.vo.RunTimeVO">
|
||||||
SELECT
|
SELECT
|
||||||
|
DISTINCT
|
||||||
dev.Id AS id,
|
dev.Id AS id,
|
||||||
area.NAME AS areaName,
|
area.NAME AS areaName,
|
||||||
gd.NAME AS gdName,
|
gd.NAME AS gdName,
|
||||||
sub.NAME AS bdName,
|
sub.NAME AS bdName,
|
||||||
|
obj.project_name objName,
|
||||||
manufacturerId.NAME AS manufacturer,
|
manufacturerId.NAME AS manufacturer,
|
||||||
dev.NAME AS devName,
|
dev.NAME AS devName,
|
||||||
device.IP AS ip,
|
device.IP AS ip,
|
||||||
@@ -152,7 +276,7 @@
|
|||||||
WHEN 0 THEN
|
WHEN 0 THEN
|
||||||
'投运'
|
'投运'
|
||||||
WHEN 1 THEN
|
WHEN 1 THEN
|
||||||
'热备用'
|
'检修'
|
||||||
WHEN 2 THEN
|
WHEN 2 THEN
|
||||||
'停运'
|
'停运'
|
||||||
END AS runFlag,
|
END AS runFlag,
|
||||||
@@ -165,8 +289,12 @@
|
|||||||
END AS comFlag,
|
END AS comFlag,
|
||||||
device.Update_Time AS updateTime
|
device.Update_Time AS updateTime
|
||||||
FROM
|
FROM
|
||||||
pq_line dev
|
pq_line line
|
||||||
INNER JOIN pq_line sub ON sub.Id = dev.Pid
|
left join pq_line_detail detail on line.id = detail.id
|
||||||
|
left join supervision_user_report obj on obj.id = detail.obj_id
|
||||||
|
inner join pq_line busBar on line.pid = busBar.id
|
||||||
|
inner join pq_line dev on busBar.pid = dev.id
|
||||||
|
INNER JOIN pq_line sub ON sub.id = dev.Pid
|
||||||
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
INNER JOIN pq_line gd ON gd.Id = sub.Pid
|
||||||
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
INNER JOIN pq_line areaId ON areaId.Id = gd.Pid
|
||||||
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
INNER JOIN sys_area area ON area.Id = areaId.NAME
|
||||||
@@ -197,10 +325,13 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="searchValue != '' and searchValue != null ">
|
<if test="searchValue != '' and searchValue != null ">
|
||||||
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
<bind name="searchValueLike" value="'%'+searchValue+'%'"/>
|
||||||
AND sub.NAME LIKE #{searchValueLike}
|
AND
|
||||||
|
(sub.NAME LIKE #{searchValueLike}
|
||||||
OR dev.NAME LIKE #{searchValueLike}
|
OR dev.NAME LIKE #{searchValueLike}
|
||||||
OR devT.Name LIKE #{searchValueLike}
|
OR devT.Name LIKE #{searchValueLike}
|
||||||
OR device.IP LIKE #{searchValueLike}
|
OR device.IP LIKE #{searchValueLike}
|
||||||
|
OR obj.project_name LIKE #{searchValueLike}
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
gdName,
|
gdName,
|
||||||
|
|||||||
@@ -19,113 +19,113 @@ import java.util.List;
|
|||||||
public interface IDeviceService extends IService<Device> {
|
public interface IDeviceService extends IService<Device> {
|
||||||
|
|
||||||
|
|
||||||
/***
|
// /***
|
||||||
* @Description: mqtt获取外部定值
|
// * @Description: mqtt获取外部定值
|
||||||
* @param param
|
// * @param param
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/14 10:17
|
// * @Date: 2023/8/14 10:17
|
||||||
*/
|
// */
|
||||||
String sentLine(ConstantValueParam.Constant param);
|
// String sentLine(ConstantValueParam.Constant param);
|
||||||
|
//
|
||||||
/***
|
// /***
|
||||||
* @Description: mqtt修改外部定值
|
// * @Description: mqtt修改外部定值
|
||||||
* @param param
|
// * @param param
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/14 11:07
|
// * @Date: 2023/8/14 11:07
|
||||||
*/
|
// */
|
||||||
String sentLineData(ConstantValueParam.ValueData param);
|
// String sentLineData(ConstantValueParam.ValueData param);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param param
|
// * @param param
|
||||||
* @Description: mqtt获取内部定值
|
// * @Description: mqtt获取内部定值
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/14 14:51
|
// * @Date: 2023/8/14 14:51
|
||||||
*/
|
// */
|
||||||
String sentDev(ConstantValueParam.Constant param);
|
// String sentDev(ConstantValueParam.Constant param);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param param
|
// * @param param
|
||||||
* @Description: mqtt修改内部定值
|
// * @Description: mqtt修改内部定值
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/14 14:51
|
// * @Date: 2023/8/14 14:51
|
||||||
*/
|
// */
|
||||||
String sentDevData(ConstantValueParam.ValueData param);
|
// String sentDevData(ConstantValueParam.ValueData param);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param devID
|
// * @param devID
|
||||||
* @Description: 终端性能查看
|
// * @Description: 终端性能查看
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/15 11:27
|
// * @Date: 2023/8/15 11:27
|
||||||
*/
|
// */
|
||||||
String socketDevProperty(String devID);
|
// String socketDevProperty(String devID);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param devID
|
// * @param devID
|
||||||
* @Description: 终端性能关闭
|
// * @Description: 终端性能关闭
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/15 16:13
|
// * @Date: 2023/8/15 16:13
|
||||||
*/
|
// */
|
||||||
String socketDevPropertyClose(String devID);
|
// String socketDevPropertyClose(String devID);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param lineIndex
|
// * @param lineIndex
|
||||||
* @Description: 监测点实时数据查看
|
// * @Description: 监测点实时数据查看
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/15 16:13
|
// * @Date: 2023/8/15 16:13
|
||||||
*/
|
// */
|
||||||
String realTimeData(String lineIndex);
|
// String realTimeData(String lineIndex);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param lineIndex
|
// * @param lineIndex
|
||||||
* @Description: 监测实施数据心跳
|
// * @Description: 监测实施数据心跳
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/15 16:14
|
// * @Date: 2023/8/15 16:14
|
||||||
*/
|
// */
|
||||||
String heartRealTimeData(String lineIndex);
|
// String heartRealTimeData(String lineIndex);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param lineIndex
|
// * @param lineIndex
|
||||||
* @Description: 监测点实施数据关闭
|
// * @Description: 监测点实施数据关闭
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/15 16:14
|
// * @Date: 2023/8/15 16:14
|
||||||
*/
|
// */
|
||||||
String closeRealTimeData(String lineIndex);
|
// String closeRealTimeData(String lineIndex);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 终端版本升级,批量升级条件必须是相同终端系列的终端才能升级
|
// * 终端版本升级,批量升级条件必须是相同终端系列的终端才能升级
|
||||||
*
|
// *
|
||||||
* @param list
|
// * @param list
|
||||||
* @param edIndex
|
// * @param edIndex
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
String getDevUpgrades(List<String> list, String edIndex);
|
// String getDevUpgrades(List<String> list, String edIndex);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param devList
|
// * @param devList
|
||||||
* @Description: 终端升级取消
|
// * @Description: 终端升级取消
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/17 9:24
|
// * @Date: 2023/8/17 9:24
|
||||||
*/
|
// */
|
||||||
String closeUpgrades(List<String> devList);
|
// String closeUpgrades(List<String> devList);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param devList
|
// * @param devList
|
||||||
* @Description: 重启装置命令
|
// * @Description: 重启装置命令
|
||||||
* @return: java.lang.String
|
// * @return: java.lang.String
|
||||||
* @Author: wr
|
// * @Author: wr
|
||||||
* @Date: 2023/8/17 9:24
|
// * @Date: 2023/8/17 9:24
|
||||||
*/
|
// */
|
||||||
String restartDev(List<String> devList);
|
// String restartDev(List<String> devList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param devId 装置id
|
* @param devId 装置id
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package com.njcn.device.device.service.impl;
|
package com.njcn.device.device.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -14,16 +10,11 @@ import com.njcn.device.device.mapper.DeviceMapper;
|
|||||||
import com.njcn.device.device.service.IDeviceService;
|
import com.njcn.device.device.service.IDeviceService;
|
||||||
import com.njcn.device.device.service.ProgramVersionService;
|
import com.njcn.device.device.service.ProgramVersionService;
|
||||||
import com.njcn.device.line.mapper.LineMapper;
|
import com.njcn.device.line.mapper.LineMapper;
|
||||||
import com.njcn.device.pq.pojo.advanced.*;
|
|
||||||
import com.njcn.device.pq.pojo.param.ConstantValueParam;
|
|
||||||
import com.njcn.device.pq.pojo.po.DevVersion;
|
|
||||||
import com.njcn.device.pq.pojo.po.Device;
|
import com.njcn.device.pq.pojo.po.Device;
|
||||||
import com.njcn.device.pq.pojo.po.Line;
|
|
||||||
import com.njcn.device.pq.pojo.po.Version;
|
|
||||||
import com.njcn.device.pq.pojo.vo.DevStatusNumVO;
|
import com.njcn.device.pq.pojo.vo.DevStatusNumVO;
|
||||||
import com.njcn.device.pq.pojo.vo.DeviceIpRVO;
|
|
||||||
import com.njcn.device.utils.SocketClient;
|
|
||||||
import com.njcn.web.utils.RequestUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -45,360 +36,360 @@ import java.util.stream.Collectors;
|
|||||||
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements IDeviceService {
|
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements IDeviceService {
|
||||||
|
|
||||||
private final LineMapper lineMapper;
|
private final LineMapper lineMapper;
|
||||||
private final SocketClient socketClient;
|
// private final SocketClient socketClient;
|
||||||
private final DevVersionMapper devVersionMapper;
|
private final DevVersionMapper devVersionMapper;
|
||||||
private final ProgramVersionService programVersionService;
|
private final ProgramVersionService programVersionService;
|
||||||
|
|
||||||
@Value("${socket.port:60000}")
|
@Value("${socket.port:60000}")
|
||||||
private Integer socketPort;
|
private Integer socketPort;
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public String sentLine(ConstantValueParam.Constant param) {
|
// public String sentLine(ConstantValueParam.Constant param) {
|
||||||
try {
|
// try {
|
||||||
//获取根据监测点获取终端信息
|
// //获取根据监测点获取终端信息
|
||||||
UpDevVO upDevVO = lineMapper.getDevInfo(param.getId());
|
// UpDevVO upDevVO = lineMapper.getDevInfo(param.getId());
|
||||||
//查询前置ip
|
// //查询前置ip
|
||||||
String host = lineMapper.getNodeIp(upDevVO.getDevIndex(),0);
|
// String host = lineMapper.getNodeIp(upDevVO.getDevIndex(),0);
|
||||||
//拼接属性
|
// //拼接属性
|
||||||
ContValueRVO upParamVO = new ContValueRVO();
|
// ContValueRVO upParamVO = new ContValueRVO();
|
||||||
ContValueVO valueVO = new ContValueVO();
|
// ContValueVO valueVO = new ContValueVO();
|
||||||
valueVO.setType(param.getType());
|
// valueVO.setType(param.getType());
|
||||||
valueVO.setLineid(param.getId());
|
// valueVO.setLineid(param.getId());
|
||||||
valueVO.setHander(param.getHander());
|
// valueVO.setHander(param.getHander());
|
||||||
JSONObject jsonStr = new JSONObject(valueVO);
|
// JSONObject jsonStr = new JSONObject(valueVO);
|
||||||
Integer len = jsonStr.toString().length();
|
// Integer len = jsonStr.toString().length();
|
||||||
upParamVO.setLen(len.toString());
|
// upParamVO.setLen(len.toString());
|
||||||
upParamVO.setData(valueVO);
|
// upParamVO.setData(valueVO);
|
||||||
JSONObject jsonObject = new JSONObject(upParamVO);
|
// JSONObject jsonObject = new JSONObject(upParamVO);
|
||||||
String str = jsonObject.toString();
|
// String str = jsonObject.toString();
|
||||||
List<UpDevVO> devList = new ArrayList<>();
|
// List<UpDevVO> devList = new ArrayList<>();
|
||||||
devList.add(upDevVO);
|
// devList.add(upDevVO);
|
||||||
return socketClient.sentLine(param.getIp(), str, host, socketPort, "wr", devList);
|
// return socketClient.sentLine(param.getIp(), str, host, socketPort, "wr", devList);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
return "获取定值失败";
|
// return "获取定值失败";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String sentLineData(ConstantValueParam.ValueData param) {
|
// public String sentLineData(ConstantValueParam.ValueData param) {
|
||||||
try {
|
// try {
|
||||||
//获取根据监测点获取终端信息
|
// //获取根据监测点获取终端信息
|
||||||
UpDevVO upDevVO = lineMapper.getDevInfo(param.getId());
|
// UpDevVO upDevVO = lineMapper.getDevInfo(param.getId());
|
||||||
//查询前置ip
|
// //查询前置ip
|
||||||
String host = lineMapper.getNodeIp(upDevVO.getDevIndex(),0);
|
// String host = lineMapper.getNodeIp(upDevVO.getDevIndex(),0);
|
||||||
ContUpdateValueRVO upParamVO = new ContUpdateValueRVO();
|
// ContUpdateValueRVO upParamVO = new ContUpdateValueRVO();
|
||||||
ContUpdateValueVO valueVO = new ContUpdateValueVO();
|
// ContUpdateValueVO valueVO = new ContUpdateValueVO();
|
||||||
valueVO.setType(param.getType());
|
// valueVO.setType(param.getType());
|
||||||
valueVO.setLineid(param.getId());
|
// valueVO.setLineid(param.getId());
|
||||||
valueVO.setHander(param.getHander());
|
// valueVO.setHander(param.getHander());
|
||||||
float[] intArr;
|
// float[] intArr;
|
||||||
if (StrUtil.isBlank(param.getInterValue())) {
|
// if (StrUtil.isBlank(param.getInterValue())) {
|
||||||
intArr = new float[0];
|
// intArr = new float[0];
|
||||||
} else {
|
// } else {
|
||||||
String[] valueArr = param.getInterValue().split(",");
|
// String[] valueArr = param.getInterValue().split(",");
|
||||||
intArr = new float[valueArr.length];
|
// intArr = new float[valueArr.length];
|
||||||
for (int i = 0; i < valueArr.length; i++) {
|
// for (int i = 0; i < valueArr.length; i++) {
|
||||||
intArr[i] = Float.parseFloat(valueArr[i]);
|
// intArr[i] = Float.parseFloat(valueArr[i]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
valueVO.setValue(intArr);
|
// valueVO.setValue(intArr);
|
||||||
JSONObject jsonStr = new JSONObject(valueVO);
|
// JSONObject jsonStr = new JSONObject(valueVO);
|
||||||
Integer len = jsonStr.toString().length();
|
// Integer len = jsonStr.toString().length();
|
||||||
upParamVO.setLen(len.toString());
|
// upParamVO.setLen(len.toString());
|
||||||
upParamVO.setData(valueVO);
|
// upParamVO.setData(valueVO);
|
||||||
JSONObject jsonObject = new JSONObject(upParamVO);
|
// JSONObject jsonObject = new JSONObject(upParamVO);
|
||||||
String str = jsonObject.toString();
|
// String str = jsonObject.toString();
|
||||||
List<UpDevVO> devList = new ArrayList<>();
|
// List<UpDevVO> devList = new ArrayList<>();
|
||||||
devList.add(upDevVO);
|
// devList.add(upDevVO);
|
||||||
return socketClient.sentLine(param.getIp(), str, host, socketPort, "wr", devList);
|
// return socketClient.sentLine(param.getIp(), str, host, socketPort, "wr", devList);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
return "运行失败";
|
// return "运行失败";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String sentDev(ConstantValueParam.Constant param) {
|
// public String sentDev(ConstantValueParam.Constant param) {
|
||||||
try {
|
// try {
|
||||||
Line line = lineMapper.selectById(param.getId());
|
// Line line = lineMapper.selectById(param.getId());
|
||||||
UpDevVO upDevVO = new UpDevVO();
|
// UpDevVO upDevVO = new UpDevVO();
|
||||||
upDevVO.setDevIndex(line.getId());
|
// upDevVO.setDevIndex(line.getId());
|
||||||
upDevVO.setDevName(line.getName());
|
// upDevVO.setDevName(line.getName());
|
||||||
String host = lineMapper.getNodeIp(line.getId(),1);
|
// String host = lineMapper.getNodeIp(line.getId(),1);
|
||||||
ContValueRVO upParamVO = new ContValueRVO();
|
// ContValueRVO upParamVO = new ContValueRVO();
|
||||||
ContValueVO valueVO = new ContValueVO();
|
// ContValueVO valueVO = new ContValueVO();
|
||||||
valueVO.setType(param.getType());
|
// valueVO.setType(param.getType());
|
||||||
valueVO.setIndex(param.getId());
|
// valueVO.setIndex(param.getId());
|
||||||
valueVO.setHander(param.getHander());
|
// valueVO.setHander(param.getHander());
|
||||||
JSONObject jsonStr = new JSONObject(valueVO);
|
// JSONObject jsonStr = new JSONObject(valueVO);
|
||||||
Integer len = jsonStr.toString().length();
|
// Integer len = jsonStr.toString().length();
|
||||||
upParamVO.setLen(len.toString());
|
// upParamVO.setLen(len.toString());
|
||||||
upParamVO.setData(valueVO);
|
// upParamVO.setData(valueVO);
|
||||||
JSONObject jsonObject = new JSONObject(upParamVO);
|
// JSONObject jsonObject = new JSONObject(upParamVO);
|
||||||
String str = jsonObject.toString();
|
// String str = jsonObject.toString();
|
||||||
List<UpDevVO> devList = new ArrayList<>();
|
// List<UpDevVO> devList = new ArrayList<>();
|
||||||
devList.add(upDevVO);
|
// devList.add(upDevVO);
|
||||||
return socketClient.sentDZDev(param.getIp(), str, host, socketPort, "wr", devList);
|
// return socketClient.sentDZDev(param.getIp(), str, host, socketPort, "wr", devList);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
return "获取定值失败";
|
// return "获取定值失败";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String sentDevData(ConstantValueParam.ValueData param) {
|
// public String sentDevData(ConstantValueParam.ValueData param) {
|
||||||
try {
|
// try {
|
||||||
Line line = lineMapper.selectById(param.getId());
|
// Line line = lineMapper.selectById(param.getId());
|
||||||
UpDevVO upDevVO = new UpDevVO();
|
// UpDevVO upDevVO = new UpDevVO();
|
||||||
upDevVO.setDevIndex(line.getId());
|
// upDevVO.setDevIndex(line.getId());
|
||||||
upDevVO.setDevName(line.getName());
|
// upDevVO.setDevName(line.getName());
|
||||||
String host = lineMapper.getNodeIp(line.getId(),1);
|
// String host = lineMapper.getNodeIp(line.getId(),1);
|
||||||
ContUpdateDevValueRVO upParamVO = new ContUpdateDevValueRVO();
|
// ContUpdateDevValueRVO upParamVO = new ContUpdateDevValueRVO();
|
||||||
ContUpdateDevValueVO valueVO = new ContUpdateDevValueVO();
|
// ContUpdateDevValueVO valueVO = new ContUpdateDevValueVO();
|
||||||
valueVO.setType(param.getType());
|
// valueVO.setType(param.getType());
|
||||||
valueVO.setIndex(line.getId());
|
// valueVO.setIndex(line.getId());
|
||||||
valueVO.setHander(String.valueOf(param.getHander()));
|
// valueVO.setHander(String.valueOf(param.getHander()));
|
||||||
int[] intArr;
|
// int[] intArr;
|
||||||
if (StrUtil.isBlank(param.getInterValue())) {
|
// if (StrUtil.isBlank(param.getInterValue())) {
|
||||||
intArr = new int[0];
|
// intArr = new int[0];
|
||||||
} else {
|
// } else {
|
||||||
String[] valueArr = param.getInterValue().split(",");
|
// String[] valueArr = param.getInterValue().split(",");
|
||||||
intArr = new int[valueArr.length];
|
// intArr = new int[valueArr.length];
|
||||||
for (int i = 0; i < valueArr.length; i++) {
|
// for (int i = 0; i < valueArr.length; i++) {
|
||||||
intArr[i] = Integer.parseInt(valueArr[i]);
|
// intArr[i] = Integer.parseInt(valueArr[i]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
valueVO.setInterValue(intArr);
|
// valueVO.setInterValue(intArr);
|
||||||
JSONObject jsonStr = new JSONObject(valueVO);
|
// JSONObject jsonStr = new JSONObject(valueVO);
|
||||||
Integer len = jsonStr.toString().length();
|
// Integer len = jsonStr.toString().length();
|
||||||
upParamVO.setLen(len.toString());
|
// upParamVO.setLen(len.toString());
|
||||||
upParamVO.setData(valueVO);
|
// upParamVO.setData(valueVO);
|
||||||
JSONObject jsonObject = new JSONObject(upParamVO);
|
// JSONObject jsonObject = new JSONObject(upParamVO);
|
||||||
String str = jsonObject.toString();
|
// String str = jsonObject.toString();
|
||||||
|
//
|
||||||
List<UpDevVO> devList = new ArrayList<>();
|
// List<UpDevVO> devList = new ArrayList<>();
|
||||||
devList.add(upDevVO);
|
// devList.add(upDevVO);
|
||||||
return socketClient.sentDZDev(param.getIp(), str, host, socketPort, "wr", devList);
|
// return socketClient.sentDZDev(param.getIp(), str, host, socketPort, "wr", devList);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
return "运行失败";
|
// return "运行失败";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String socketDevProperty(String devID) {
|
// public String socketDevProperty(String devID) {
|
||||||
String host = lineMapper.getNodeIp(devID,1);
|
// String host = lineMapper.getNodeIp(devID,1);
|
||||||
if(StrUtil.isBlank(host)){
|
// if(StrUtil.isBlank(host)){
|
||||||
return "前置ip获取失败";
|
// return "前置ip获取失败";
|
||||||
}
|
// }
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
Map<String,String> map = new HashMap<>();
|
// Map<String,String> map = new HashMap<>();
|
||||||
map.put("type","190");
|
// map.put("type","190");
|
||||||
map.put("index",devID);
|
// map.put("index",devID);
|
||||||
map.put("hander","1");
|
// map.put("hander","1");
|
||||||
jsonObject.set("data", map);
|
// jsonObject.set("data", map);
|
||||||
Integer len = jsonObject.get("data").toString().length();
|
// Integer len = jsonObject.get("data").toString().length();
|
||||||
jsonObject.set("len", len.toString());
|
// jsonObject.set("len", len.toString());
|
||||||
socketClient.showProperty(jsonObject.toString(),host,socketPort,RequestUtil.getLoginName());
|
// socketClient.showProperty(jsonObject.toString(),host,socketPort,RequestUtil.getLoginName());
|
||||||
return "终端性能获取成功";
|
// return "终端性能获取成功";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String socketDevPropertyClose(String devID) {
|
// public String socketDevPropertyClose(String devID) {
|
||||||
String host = lineMapper.getNodeIp(devID,1);
|
// String host = lineMapper.getNodeIp(devID,1);
|
||||||
try {
|
// try {
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
Map<String, String> map = new HashMap<>();
|
// Map<String, String> map = new HashMap<>();
|
||||||
map.put("type", "190");
|
// map.put("type", "190");
|
||||||
map.put("index", devID);
|
// map.put("index", devID);
|
||||||
map.put("hander", "0");
|
// map.put("hander", "0");
|
||||||
jsonObject.set("data", map);
|
// jsonObject.set("data", map);
|
||||||
Integer len = jsonObject.get("data").toString().length();
|
// Integer len = jsonObject.get("data").toString().length();
|
||||||
jsonObject.set("len", len.toString());
|
// jsonObject.set("len", len.toString());
|
||||||
socketClient.closeDevSocket(jsonObject.toString(),host,socketPort,RequestUtil.getLoginName());
|
// socketClient.closeDevSocket(jsonObject.toString(),host,socketPort,RequestUtil.getLoginName());
|
||||||
return "执行成功";
|
// return "执行成功";
|
||||||
}catch (Exception e){
|
// }catch (Exception e){
|
||||||
return "执行失败";
|
// return "执行失败";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String realTimeData(String lineIndex) {
|
// public String realTimeData(String lineIndex) {
|
||||||
//查询前置ip
|
// //查询前置ip
|
||||||
String host = lineMapper.getNodeIp(lineIndex,0);
|
// String host = lineMapper.getNodeIp(lineIndex,0);
|
||||||
if(StrUtil.isBlank(host)){
|
// if(StrUtil.isBlank(host)){
|
||||||
return "设备前置机服务器配置异常,请联系管理员";
|
// return "设备前置机服务器配置异常,请联系管理员";
|
||||||
}else {
|
// }else {
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.set("LineId", lineIndex);
|
// jsonObject.set("LineId", lineIndex);
|
||||||
jsonObject.set("type", 0);
|
// jsonObject.set("type", 0);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
// JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.set("len",0);
|
// jsonObject1.set("len",0);
|
||||||
jsonObject1.set("data",jsonObject);
|
// jsonObject1.set("data",jsonObject);
|
||||||
socketClient.realTimeData(jsonObject1.toString(),host,socketPort,lineIndex);
|
// socketClient.realTimeData(jsonObject1.toString(),host,socketPort,lineIndex);
|
||||||
}
|
// }
|
||||||
return "请求成功";
|
// return "请求成功";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String heartRealTimeData(String lineIndex) {
|
// public String heartRealTimeData(String lineIndex) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.set("LineId", lineIndex);
|
// jsonObject.set("LineId", lineIndex);
|
||||||
jsonObject.set("type", 1);
|
// jsonObject.set("type", 1);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
// JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.set("len", 0);
|
// jsonObject1.set("len", 0);
|
||||||
jsonObject1.set("data", jsonObject);
|
// jsonObject1.set("data", jsonObject);
|
||||||
String host = lineMapper.getNodeIp(lineIndex,0);
|
// String host = lineMapper.getNodeIp(lineIndex,0);
|
||||||
socketClient.heartRealData(jsonObject1.toString(),host,socketPort,lineIndex);
|
// socketClient.heartRealData(jsonObject1.toString(),host,socketPort,lineIndex);
|
||||||
return "实时数据心跳请求成功";
|
// return "实时数据心跳请求成功";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String closeRealTimeData(String lineIndex) {
|
// public String closeRealTimeData(String lineIndex) {
|
||||||
socketClient.closeRealData(lineIndex);
|
// socketClient.closeRealData(lineIndex);
|
||||||
return "关闭实时数据请求成功";
|
// return "关闭实时数据请求成功";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String getDevUpgrades(List<String> list, String edIndex) {
|
// public String getDevUpgrades(List<String> list, String edIndex) {
|
||||||
List<DeviceIpRVO> resTemlist = new ArrayList<>();
|
// List<DeviceIpRVO> resTemlist = new ArrayList<>();
|
||||||
|
//
|
||||||
List<DeviceIpRVO> relist = lineMapper.getDevicesIp(list);
|
// List<DeviceIpRVO> relist = lineMapper.getDevicesIp(list);
|
||||||
//判断设备版本号
|
// //判断设备版本号
|
||||||
Integer isExit = devVersionMapper.selectCount(new LambdaQueryWrapper<DevVersion>()
|
// Integer isExit = devVersionMapper.selectCount(new LambdaQueryWrapper<DevVersion>()
|
||||||
.eq(DevVersion::getVersionId,edIndex)
|
// .eq(DevVersion::getVersionId,edIndex)
|
||||||
.in(DevVersion::getLineId,list)
|
// .in(DevVersion::getLineId,list)
|
||||||
.eq(DevVersion::getState,1)
|
// .eq(DevVersion::getState,1)
|
||||||
);
|
// );
|
||||||
if (isExit > 0) {
|
// if (isExit > 0) {
|
||||||
return "请勿选择相同版本号升级";
|
// return "请勿选择相同版本号升级";
|
||||||
}
|
// }
|
||||||
if (!CollectionUtil.isEmpty(relist)) {
|
// if (!CollectionUtil.isEmpty(relist)) {
|
||||||
Version version = programVersionService.getById(edIndex);
|
// Version version = programVersionService.getById(edIndex);
|
||||||
String series = version.getDevType();
|
// String series = version.getDevType();
|
||||||
//判断设备是否存在相同型号
|
// //判断设备是否存在相同型号
|
||||||
for (DeviceIpRVO deviceIpRVO : relist) {
|
// for (DeviceIpRVO deviceIpRVO : relist) {
|
||||||
if (!series.equals(deviceIpRVO.getDevSeries())) {
|
// if (!series.equals(deviceIpRVO.getDevSeries())) {
|
||||||
return "当前装置版本系列与目标版本系列不相同";
|
// return "当前装置版本系列与目标版本系列不相同";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//判断是否断开
|
// //判断是否断开
|
||||||
if (relist.stream().filter(w -> w.getComFlag() == 0).findAny().isPresent()) {
|
// if (relist.stream().filter(w -> w.getComFlag() == 0).findAny().isPresent()) {
|
||||||
return "存在通讯中断设备";
|
// return "存在通讯中断设备";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
Set<String> set = new HashSet<>();
|
// Set<String> set = new HashSet<>();
|
||||||
for (DeviceIpRVO d : relist) {
|
// for (DeviceIpRVO d : relist) {
|
||||||
set.add(d.getIp());
|
// set.add(d.getIp());
|
||||||
}
|
// }
|
||||||
Iterator<String> iterator = set.iterator();
|
// Iterator<String> iterator = set.iterator();
|
||||||
while (iterator.hasNext()) {
|
// while (iterator.hasNext()) {
|
||||||
List<UpDevVO> devIndex = new ArrayList<>();
|
// List<UpDevVO> devIndex = new ArrayList<>();
|
||||||
DeviceIpRVO deviceIpRVO = new DeviceIpRVO();
|
// DeviceIpRVO deviceIpRVO = new DeviceIpRVO();
|
||||||
String ip = iterator.next();
|
// String ip = iterator.next();
|
||||||
for (DeviceIpRVO d : relist) {
|
// for (DeviceIpRVO d : relist) {
|
||||||
UpDevVO upDevVO = new UpDevVO();
|
// UpDevVO upDevVO = new UpDevVO();
|
||||||
upDevVO.setDevIndex(d.getDevIndex());
|
// upDevVO.setDevIndex(d.getDevIndex());
|
||||||
upDevVO.setDevName(d.getDevName());
|
// upDevVO.setDevName(d.getDevName());
|
||||||
if (ip.equals(d.getIp())) {
|
// if (ip.equals(d.getIp())) {
|
||||||
devIndex.add(upDevVO);
|
// devIndex.add(upDevVO);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
deviceIpRVO.setIp(ip);
|
// deviceIpRVO.setIp(ip);
|
||||||
deviceIpRVO.setDevlist(devIndex);
|
// deviceIpRVO.setDevlist(devIndex);
|
||||||
resTemlist.add(deviceIpRVO);
|
// resTemlist.add(deviceIpRVO);
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return "存在未知错误";
|
// return "存在未知错误";
|
||||||
}
|
// }
|
||||||
for (DeviceIpRVO deviceIpRVO : resTemlist) {
|
// for (DeviceIpRVO deviceIpRVO : resTemlist) {
|
||||||
String ip = deviceIpRVO.getIp();
|
// String ip = deviceIpRVO.getIp();
|
||||||
List<UpDevVO> devlist = deviceIpRVO.getDevlist();
|
// List<UpDevVO> devlist = deviceIpRVO.getDevlist();
|
||||||
UpDataVO upDataVO = new UpDataVO();
|
// UpDataVO upDataVO = new UpDataVO();
|
||||||
UpParamVO upParamVO = new UpParamVO();
|
// UpParamVO upParamVO = new UpParamVO();
|
||||||
upDataVO.setTerminal(devlist);
|
// upDataVO.setTerminal(devlist);
|
||||||
upDataVO.setType("180");
|
// upDataVO.setType("180");
|
||||||
upDataVO.setEdIndex(edIndex);
|
// upDataVO.setEdIndex(edIndex);
|
||||||
upDataVO.setUserIndex(RequestUtil.getUserIndex());
|
// upDataVO.setUserIndex(RequestUtil.getUserIndex());
|
||||||
JSONObject jsonstr = new JSONObject(upDataVO);
|
// JSONObject jsonstr = new JSONObject(upDataVO);
|
||||||
Integer len = jsonstr.toString().length();
|
// Integer len = jsonstr.toString().length();
|
||||||
upParamVO.setData(upDataVO);
|
// upParamVO.setData(upDataVO);
|
||||||
upParamVO.setLen(len.toString());
|
// upParamVO.setLen(len.toString());
|
||||||
JSONObject jsonObject = new JSONObject(upParamVO);
|
// JSONObject jsonObject = new JSONObject(upParamVO);
|
||||||
String str = jsonObject.toString();
|
// String str = jsonObject.toString();
|
||||||
socketClient.sentUpgrades(str, ip, socketPort, RequestUtil.getLoginName(), edIndex, devlist);
|
// socketClient.sentUpgrades(str, ip, socketPort, RequestUtil.getLoginName(), edIndex, devlist);
|
||||||
}
|
// }
|
||||||
return "运行成功";
|
// return "运行成功";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String closeUpgrades(List<String> devList) {
|
// public String closeUpgrades(List<String> devList) {
|
||||||
List<DeviceIpRVO> relist = lineMapper.getDevicesIp(devList);
|
// List<DeviceIpRVO> relist = lineMapper.getDevicesIp(devList);
|
||||||
if(CollectionUtil.isEmpty(relist)){
|
// if(CollectionUtil.isEmpty(relist)){
|
||||||
return "前置机为空";
|
// return "前置机为空";
|
||||||
}else {
|
// }else {
|
||||||
List<String> nodeIp = relist.stream().map(DeviceIpRVO::getIp).distinct().collect(Collectors.toList());
|
// List<String> nodeIp = relist.stream().map(DeviceIpRVO::getIp).distinct().collect(Collectors.toList());
|
||||||
for(String ip: nodeIp){
|
// for(String ip: nodeIp){
|
||||||
List<DeviceIpRVO> devLl= relist.stream().filter(item->item.getIp().equals(ip)).collect(Collectors.toList());
|
// List<DeviceIpRVO> devLl= relist.stream().filter(item->item.getIp().equals(ip)).collect(Collectors.toList());
|
||||||
if(CollectionUtil.isEmpty(devLl)){
|
// if(CollectionUtil.isEmpty(devLl)){
|
||||||
return "出错啦";
|
// return "出错啦";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
List<JSONObject> list = new ArrayList<>();
|
// List<JSONObject> list = new ArrayList<>();
|
||||||
for(DeviceIpRVO devRVO:devLl){
|
// for(DeviceIpRVO devRVO:devLl){
|
||||||
JSONObject dev = new JSONObject();
|
// JSONObject dev = new JSONObject();
|
||||||
dev.put("devIndex",devRVO.getDevIndex());
|
// dev.put("devIndex",devRVO.getDevIndex());
|
||||||
dev.put("devName",devRVO.getDevName());
|
// dev.put("devName",devRVO.getDevName());
|
||||||
list.add(dev);
|
// list.add(dev);
|
||||||
}
|
// }
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.set("terminal", list);
|
// jsonObject.set("terminal", list);
|
||||||
jsonObject.set("type", 182);
|
// jsonObject.set("type", 182);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
// JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.set("len", 0);
|
// jsonObject1.set("len", 0);
|
||||||
jsonObject1.set("data", jsonObject);
|
// jsonObject1.set("data", jsonObject);
|
||||||
socketClient.cancelUp(jsonObject1.toString(),ip,socketPort,devLl.size());
|
// socketClient.cancelUp(jsonObject1.toString(),ip,socketPort,devLl.size());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return "取消命令发送成功";
|
// return "取消命令发送成功";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public String restartDev(List<String> devList) {
|
// public String restartDev(List<String> devList) {
|
||||||
List<DeviceIpRVO> relist = lineMapper.getDevicesIp(devList);
|
// List<DeviceIpRVO> relist = lineMapper.getDevicesIp(devList);
|
||||||
if(CollUtil.isEmpty(relist)){
|
// if(CollUtil.isEmpty(relist)){
|
||||||
return "前置机为空";
|
// return "前置机为空";
|
||||||
}else {
|
// }else {
|
||||||
List<String> nodeIp = relist.stream().map(DeviceIpRVO::getIp).distinct().collect(Collectors.toList());
|
// List<String> nodeIp = relist.stream().map(DeviceIpRVO::getIp).distinct().collect(Collectors.toList());
|
||||||
for(String ip: nodeIp){
|
// for(String ip: nodeIp){
|
||||||
List<DeviceIpRVO> devLl = relist.stream().filter(item->item.getIp().equals(ip)).collect(Collectors.toList());
|
// List<DeviceIpRVO> devLl = relist.stream().filter(item->item.getIp().equals(ip)).collect(Collectors.toList());
|
||||||
if(CollUtil.isEmpty(devLl)){
|
// if(CollUtil.isEmpty(devLl)){
|
||||||
return "出错啦";
|
// return "出错啦";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
List<JSONObject> list = new ArrayList<>();
|
// List<JSONObject> list = new ArrayList<>();
|
||||||
List<String> devIn = new ArrayList<>();
|
// List<String> devIn = new ArrayList<>();
|
||||||
for(DeviceIpRVO devRVO:devLl){
|
// for(DeviceIpRVO devRVO:devLl){
|
||||||
devIn.add(devRVO.getDevIndex());
|
// devIn.add(devRVO.getDevIndex());
|
||||||
JSONObject dev = new JSONObject();
|
// JSONObject dev = new JSONObject();
|
||||||
dev.set("devIndex", devRVO.getDevIndex());
|
// dev.set("devIndex", devRVO.getDevIndex());
|
||||||
dev.set("devName", devRVO.getDevName());
|
// dev.set("devName", devRVO.getDevName());
|
||||||
list.add(dev);
|
// list.add(dev);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
JSONObject jsonObject = new JSONObject();
|
// JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.set("terminal", list);
|
// jsonObject.set("terminal", list);
|
||||||
jsonObject.set("type", 181);
|
// jsonObject.set("type", 181);
|
||||||
jsonObject.set("userIndex", RequestUtil.getUserIndex());
|
// jsonObject.set("userIndex", RequestUtil.getUserIndex());
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
// JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.set("len", 0);
|
// jsonObject1.set("len", 0);
|
||||||
jsonObject1.set("data", jsonObject);
|
// jsonObject1.set("data", jsonObject);
|
||||||
|
//
|
||||||
socketClient.restartDev(jsonObject1.toString(),ip,socketPort,devIn);
|
// socketClient.restartDev(jsonObject1.toString(),ip,socketPort,devIn);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return "命令发送成功";
|
// return "命令发送成功";
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDevCheckTime(String devId, String thisTimeCheck, String nextTimeCheck) {
|
public void updateDevCheckTime(String devId, String thisTimeCheck, String nextTimeCheck) {
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ public interface LineMapper extends BaseMapper<Line> {
|
|||||||
*/
|
*/
|
||||||
List<Line> getLineByCondition(@Param("ids") List<String> ids, @Param("deviceInfoParam") DeviceInfoParam deviceInfoParam);
|
List<Line> getLineByCondition(@Param("ids") List<String> ids, @Param("deviceInfoParam") DeviceInfoParam deviceInfoParam);
|
||||||
|
|
||||||
|
List<Line> getLineByConditionBySearchValue(@Param("ids") List<String> ids, @Param("deviceInfoParam") DeviceInfoParam deviceInfoParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询终端信息
|
* 查询终端信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -88,7 +88,9 @@
|
|||||||
voltage.name busBarname,
|
voltage.name busBarname,
|
||||||
pq_voltage.scale voltageLevel,
|
pq_voltage.scale voltageLevel,
|
||||||
bd.name bdName,
|
bd.name bdName,
|
||||||
gd.name gdName
|
gd.name gdName,
|
||||||
|
supervision_user_report.project_name objName
|
||||||
|
|
||||||
from pq_dept_line pq_dept_line
|
from pq_dept_line pq_dept_line
|
||||||
inner join pq_line point on pq_dept_line.line_id = point.id
|
inner join pq_line point on pq_dept_line.line_id = point.id
|
||||||
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
||||||
@@ -98,6 +100,7 @@
|
|||||||
inner join pq_device device on dev.id = device.id
|
inner join pq_device device on dev.id = device.id
|
||||||
inner join pq_line bd on dev.pid = bd.id
|
inner join pq_line bd on dev.pid = bd.id
|
||||||
inner join pq_line gd on bd.pid = gd.id
|
inner join pq_line gd on bd.pid = gd.id
|
||||||
|
left join supervision_user_report on lineDetail.Obj_Id = supervision_user_report.id
|
||||||
where device.Dev_Model = 1
|
where device.Dev_Model = 1
|
||||||
and point.state = 1
|
and point.state = 1
|
||||||
and device.Dev_Data_Type in
|
and device.Dev_Data_Type in
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user