Compare commits
235 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79cec4e21b | |||
|
|
615fe78d61 | ||
|
|
5fff0890e8 | ||
|
|
f5e134b194 | ||
|
|
291a20649e | ||
|
|
7eef16599f | ||
| 11750a4f3a | |||
|
|
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 | ||
|
|
94037d588b | ||
| 01a77fa92d | |||
| 9d9150e418 | |||
| ee1ca85a5d | |||
|
|
2c3c716607 | ||
|
|
e1d17c63a2 | ||
|
|
6234ac8ce9 | ||
| 6c91774200 | |||
| fc951e913c | |||
| d138d4353f | |||
| aecee4de49 | |||
|
|
fd04c21997 | ||
| 08d8b5b488 | |||
| 82457bc9c2 | |||
|
|
63330a04a6 | ||
|
|
ad45661c3c | ||
|
|
23de6313a6 | ||
|
|
7a5ef040bb | ||
| 140ed85108 | |||
|
|
99ab77dcf0 | ||
|
|
c772c9cd81 | ||
| 996ec87ea8 | |||
|
|
b6eaff3b1e | ||
|
|
56bf5bb7c9 | ||
|
|
7410d32241 | ||
|
|
41ba37b723 | ||
|
|
3f77d30cfd | ||
| f71f87ced4 | |||
| 32295f60c0 | |||
|
|
d2945b0fb2 | ||
|
|
133766a2c7 | ||
| 2a5a5087ad | |||
| 4edb27d20b | |||
| 71d6636be0 | |||
|
|
8ccdb84ea9 | ||
|
|
5389903ed7 | ||
|
|
0684bdf503 | ||
|
|
d0b4a1ec71 | ||
| 764ca4a12a | |||
|
|
ca992cadbc | ||
|
|
ed166cf1e0 | ||
| 598fa803a1 | |||
| 10050ce418 | |||
| cb688ad7ad | |||
| f6c4d050da | |||
|
|
fd6ec7bdf2 | ||
|
|
ca7f1010b0 | ||
| 97ddd133f0 | |||
| 735c99e8ac | |||
| 9a53399ec9 | |||
| f27276624a | |||
| df149a3cc2 | |||
| 7ca23b9431 | |||
| b27f049c9f | |||
| 23c4a78383 | |||
|
|
c9301d1f8f | ||
|
|
977a0e7a35 | ||
|
|
9143ff5b80 | ||
| 0502dc7508 | |||
| eb689c9852 | |||
|
|
c576bd3bf7 | ||
| 27bac7288c | |||
| a7c69f7c43 | |||
| 33ab825497 | |||
| 22c8ff3b22 | |||
|
|
875d114733 | ||
|
|
bd1fe68060 | ||
| c1d933467e | |||
|
|
e7daf05670 | ||
|
|
e251fc6a1a | ||
| 0e7cc360f7 | |||
| e2d3394669 | |||
| b3ab5d2587 | |||
|
|
ed029139d3 | ||
| 02578546f2 | |||
|
|
09e2f329b7 | ||
|
|
ee2fae105b | ||
| 82efce189a | |||
|
|
be8c14625f | ||
| 95a571d3c3 | |||
| 322001150a | |||
|
|
b805bda25b | ||
| f592f2b580 | |||
|
|
184b2b8fad | ||
|
|
fe029fcb95 | ||
|
|
9143466ce7 | ||
|
|
9409d57243 | ||
| 63603dee08 | |||
|
|
e35bbd9b34 | ||
|
|
ea2173fff4 | ||
| faac7953d3 | |||
| c3cc39973e | |||
| 6d8bfacd0a | |||
|
|
ab5d28e3cb | ||
|
|
2dccb22cf8 | ||
| 6b0bad6047 | |||
| 9ffbdbdf57 | |||
|
|
778f689b3e | ||
|
|
917e3fb2d5 | ||
| e0f1e314a4 | |||
| 2f2ed06a35 | |||
| 277400670d | |||
| a1031109c4 | |||
| eeb27c519b | |||
|
|
670eaf7d38 | ||
| 2b79cefad6 | |||
| 212db18835 | |||
|
|
e9a1c34160 | ||
|
|
fb7a2b7084 | ||
|
|
4b3ec39a11 | ||
|
|
2d255a5dd3 | ||
|
|
614647d36d | ||
|
|
a899614c89 | ||
|
|
2543f87dd2 | ||
|
|
c5074df93d | ||
| 24e4c4de37 | |||
|
|
4f70566c65 | ||
|
|
dc11d34add | ||
| 9f3bb52d9a | |||
|
|
567ba2f56e | ||
|
|
371d4efb29 | ||
|
|
47b08d4797 | ||
| 65805e4f50 | |||
| 41d555121c | |||
|
|
4d48b42c98 | ||
|
|
f5e1fac55d | ||
|
|
cebda9323e | ||
| d09f1472a9 | |||
| b9696e957d | |||
| 12cfecac7e | |||
| 3a97f01383 | |||
|
|
10273dd2b0 | ||
|
|
5e8e03cbb1 | ||
|
|
b103141a54 | ||
|
|
a6d2d6ed47 | ||
| 601a78246e | |||
| 5e7b973d5f | |||
|
|
e89c6a2888 | ||
| 2166529b4d | |||
| 2117e16b61 | |||
|
|
054d5534a8 | ||
|
|
c03a516931 | ||
|
|
0fdc3edb89 | ||
| a730ad61b1 | |||
| 9b758dc7c9 | |||
| a74dd460d1 | |||
| 2708aa8b81 | |||
|
|
6d833678a6 | ||
| be264acd79 | |||
|
|
186d46752c | ||
|
|
e03478eeec | ||
|
|
0c1bb606d6 | ||
|
|
42b619fa56 | ||
|
|
f0894ca0ed | ||
|
|
8a958fa34c | ||
|
|
770fb09223 | ||
|
|
b4e5d0c638 | ||
|
|
eb334cc7c7 | ||
|
|
404d11526a | ||
| 7bac805988 | |||
|
|
e4e04fc5db | ||
| f588a0ffc8 | |||
| f8ffe767dc | |||
|
|
68cbad2fdb | ||
|
|
9b9d75e463 | ||
|
|
62c3c09a6b | ||
|
|
b523a24e5b | ||
|
|
075dfc19d6 | ||
|
|
279c5c7642 | ||
|
|
ff1351b107 | ||
|
|
2dd67f9e3a | ||
|
|
b0ef851479 | ||
|
|
be899a262b | ||
| 4339a37268 | |||
|
|
9659aa257a | ||
| 9d32ca05df | |||
|
|
d48cf09119 | ||
|
|
c38b07ec07 | ||
|
|
87f05c6278 | ||
| e9ac024f73 | |||
| b7e3bb9796 | |||
| 4bebf28b76 | |||
|
|
20ec9bc0b4 |
17
pom.xml
17
pom.xml
@@ -39,11 +39,12 @@
|
|||||||
</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.22</middle.server.url>
|
<middle.server.url>192.168.1.103</middle.server.url>
|
||||||
<!--微服务模块发布地址-->
|
<!--微服务模块发布地址-->
|
||||||
<service.server.url>192.168.1.127</service.server.url>
|
<service.server.url>192.168.2.130</service.server.url>
|
||||||
<!--docker仓库地址-->
|
<!--docker仓库地址-->
|
||||||
<docker.server.url>192.168.1.22</docker.server.url>
|
<docker.server.url>192.168.1.22</docker.server.url>
|
||||||
<!--nacos的ip:port-->
|
<!--nacos的ip:port-->
|
||||||
@@ -51,11 +52,11 @@
|
|||||||
<!--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></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>-->
|
||||||
<nacos.namespace>78588706-e06f-4580-b612-b26d72493fcb</nacos.namespace>
|
<!-- <nacos.namespace>12b467cc-a7e6-411d-8944-090cbfa09dde</nacos.namespace>-->
|
||||||
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
|
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
|
||||||
<!-- sentinel:port-->
|
<!-- sentinel:port-->
|
||||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||||
@@ -81,6 +82,7 @@
|
|||||||
<springcloud.alibaba.version>2.2.7.RELEASE</springcloud.alibaba.version>
|
<springcloud.alibaba.version>2.2.7.RELEASE</springcloud.alibaba.version>
|
||||||
<hutool.version>5.8.11</hutool.version>
|
<hutool.version>5.8.11</hutool.version>
|
||||||
<knife4j.version>3.0.2</knife4j.version>
|
<knife4j.version>3.0.2</knife4j.version>
|
||||||
|
<postgresql.version>42.3.8</postgresql.version>
|
||||||
<knife4j.aggregation.version>2.0.8</knife4j.aggregation.version>
|
<knife4j.aggregation.version>2.0.8</knife4j.aggregation.version>
|
||||||
<lombok.version>1.18.18</lombok.version>
|
<lombok.version>1.18.18</lombok.version>
|
||||||
<mybatis.version>2.1.3</mybatis.version>
|
<mybatis.version>2.1.3</mybatis.version>
|
||||||
@@ -171,6 +173,11 @@
|
|||||||
<artifactId>knife4j-spring-ui</artifactId>
|
<artifactId>knife4j-spring-ui</artifactId>
|
||||||
<version>${knife4j.version}</version>
|
<version>${knife4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>${postgresql.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-aggregation-spring-boot-starter</artifactId>
|
<artifactId>knife4j-aggregation-spring-boot-starter</artifactId>
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import java.util.List;
|
|||||||
* angle_diff_cn C相相位负跳变
|
* angle_diff_cn C相相位负跳变
|
||||||
* bph_max_value 不平衡度(单位%)
|
* bph_max_value 不平衡度(单位%)
|
||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true,value = {"pointer"})
|
||||||
public class BackData extends Structure {
|
public class BackData extends Structure {
|
||||||
public int qvvr_cata_cause[] = new int[256];
|
public int qvvr_cata_cause[] = new int[256];
|
||||||
public int qvvr_phasetype[] = new int[256];
|
public int qvvr_phasetype[] = new int[256];
|
||||||
|
|||||||
@@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ public class EventRelevantAnalysisController extends BaseController {
|
|||||||
public HttpResult<Page<RmpEventDetailAssPO>> queryEventsAssPage(@RequestBody BaseParam baseParam){
|
public HttpResult<Page<RmpEventDetailAssPO>> queryEventsAssPage(@RequestBody BaseParam baseParam){
|
||||||
String methodDescribe = getMethodDescribe("queryEventsAssPage");
|
String methodDescribe = getMethodDescribe("queryEventsAssPage");
|
||||||
String searchValue = baseParam.getSearchValue();
|
String searchValue = baseParam.getSearchValue();
|
||||||
Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
// Pattern pattern = Pattern.compile(PatternRegex.SPECIAL_REGEX);
|
||||||
if(pattern.matcher(searchValue).find()){
|
// if(pattern.matcher(searchValue).find()){
|
||||||
throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
// throw new BusinessException(ValidMessage.SPECIAL_REGEX);
|
||||||
}
|
// }
|
||||||
Page<RmpEventDetailAssPO> page = eventRelevantAnalysisService.queryEventsAssPage(baseParam);
|
Page<RmpEventDetailAssPO> page = eventRelevantAnalysisService.queryEventsAssPage(baseParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ public interface QvvrCauseDLL extends Library {
|
|||||||
|
|
||||||
// 创建临时文件
|
// 创建临时文件
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("java.io.tmpdir");
|
||||||
File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
File tempLibFile = new File(tempDir, libFileName);
|
||||||
|
|
||||||
|
//File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||||
|
|
||||||
// 提取库文件到临时目录
|
// 提取库文件到临时目录
|
||||||
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
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.event.cause.core.VoltageSagAnalyzer;
|
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.AnalysisResult;
|
|
||||||
import com.njcn.advance.event.cause.model.DataFeature;
|
import com.njcn.advance.event.cause.model.DataFeature;
|
||||||
import com.njcn.advance.event.cause.model.QvvrDataStruct;
|
import com.njcn.advance.event.type.jna.*;
|
||||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||||
import com.njcn.advance.event.service.IEventAdvanceService;
|
import com.njcn.advance.event.service.IEventAdvanceService;
|
||||||
import com.njcn.advance.event.type.jna.QvvrDLL;
|
import com.njcn.advance.pojo.dto.waveAnalysis.Rect;
|
||||||
|
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;
|
||||||
@@ -21,6 +21,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;
|
||||||
@@ -47,11 +48,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);
|
||||||
@@ -60,11 +62,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);
|
||||||
@@ -73,7 +75,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);
|
||||||
@@ -89,8 +91,70 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<List<Float>> listWaveData = waveDataDTO.getListWaveData();
|
List<List<Float>> listWaveData = waveDataDTO.getListWaveData();
|
||||||
|
// 暂降类型
|
||||||
|
// 创建数据结构
|
||||||
|
QvvrDLL.QvvrDataStruct typeDataStruct = new QvvrDLL.QvvrDataStruct();
|
||||||
|
System.out.println("初始化qvvrdll成功-----------");
|
||||||
|
typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||||
|
System.out.println("采样率-----------" + typeDataStruct.smp_rate);
|
||||||
|
typeDataStruct.smp_len = listWaveData.size();
|
||||||
|
System.out.println("波形长度-----------" + listWaveData.size());
|
||||||
|
|
||||||
|
// 获取ABC三相的瞬时数据
|
||||||
|
for (int i = 0; i < listWaveData.size(); i++) {
|
||||||
|
typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
|
||||||
|
typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
|
||||||
|
typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 执行算法分析 - 直接调用C DLL
|
||||||
|
try {
|
||||||
|
QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
||||||
|
System.out.println("调用qvvrdll成功-----------");
|
||||||
|
|
||||||
|
if (typeDataStruct.evt_num > 0) {
|
||||||
|
// 全局比较找出最小三相电压特征值
|
||||||
|
float globalMinVoltage = Float.MAX_VALUE;
|
||||||
|
int globalFaultType = 10;
|
||||||
|
for (int i = 0; i < typeDataStruct.evt_num; i++) {
|
||||||
|
QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
|
||||||
|
for (int j = 0; j < evt.u_min_num; j++) {
|
||||||
|
float u3min = evt.u3_min[j];
|
||||||
|
if (u3min < globalMinVoltage) {
|
||||||
|
globalMinVoltage = u3min;
|
||||||
|
globalFaultType = evt.qvvr_cata_type[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String str = WriteData2File(typeDataStruct);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//上传HR
|
||||||
|
eventAnalysis.setType(globalFaultType);
|
||||||
|
} else {
|
||||||
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
|
}
|
||||||
|
System.out.println("结束qvvrdll方法调用-----------");
|
||||||
|
} catch (Exception e) {
|
||||||
|
eventAnalysis.setType(DataFeature.TYPE10);
|
||||||
|
eventAnalysis.setTypeFlag(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 暂降原因JNA的方式
|
// 暂降原因JNA的方式
|
||||||
com.njcn.advance.event.cause.jna.QvvrCauseDLL.QvvrDataStruct causeDataStruct = new com.njcn.advance.event.cause.jna.QvvrCauseDLL.QvvrDataStruct();
|
QvvrCauseDLL.QvvrDataStruct causeDataStruct = new QvvrCauseDLL.QvvrDataStruct();
|
||||||
causeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
causeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
||||||
causeDataStruct.smp_len = listWaveData.size();
|
causeDataStruct.smp_len = listWaveData.size();
|
||||||
// 获取ABC三相的瞬时数据
|
// 获取ABC三相的瞬时数据
|
||||||
@@ -112,45 +176,308 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
}
|
}
|
||||||
System.out.println("暂降原因分析完毕===============");
|
System.out.println("暂降原因分析完毕===============");
|
||||||
System.out.println("cause:" + eventAnalysis);
|
System.out.println("cause:" + eventAnalysis);
|
||||||
|
|
||||||
// 暂降类型
|
|
||||||
// 创建数据结构
|
|
||||||
// com.njcn.advance.event.type.jna.QvvrDLL.QvvrDataStruct typeDataStruct = new com.njcn.advance.event.type.jna.QvvrDLL.QvvrDataStruct();
|
|
||||||
// typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
|
|
||||||
// typeDataStruct.smp_len = listWaveData.size();
|
|
||||||
// // 获取ABC三相的瞬时数据
|
|
||||||
// for (int i = 0; i < listWaveData.size(); i++) {
|
|
||||||
// typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
|
|
||||||
// typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
|
|
||||||
// typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
|
|
||||||
// }
|
|
||||||
// // 执行算法分析 - 直接调用C DLL
|
|
||||||
// try {
|
|
||||||
// QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
|
|
||||||
// if (typeDataStruct.evt_num > 0) {
|
|
||||||
// // 全局比较找出最小三相电压特征值
|
|
||||||
// float globalMinVoltage = Float.MAX_VALUE;
|
|
||||||
// int globalFaultType = 10;
|
|
||||||
// for (int i = 0; i < typeDataStruct.evt_num; i++) {
|
|
||||||
// QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
|
|
||||||
// for (int j = 0; j < evt.u_min_num; j++) {
|
|
||||||
// float u3min = evt.u3_min[j];
|
|
||||||
// if (u3min < globalMinVoltage) {
|
|
||||||
// globalMinVoltage = u3min;
|
|
||||||
// globalFaultType = evt.qvvr_cata_type[j];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// eventAnalysis.setType(globalFaultType);
|
|
||||||
// } else {
|
|
||||||
// eventAnalysis.setType(DataFeature.TYPE10);
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// eventAnalysis.setType(DataFeature.TYPE10);
|
|
||||||
// eventAnalysis.setTypeFlag(0);
|
|
||||||
// }
|
|
||||||
return eventAnalysis;
|
return eventAnalysis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String WriteData2File(QvvrDLL.QvvrDataStruct rect) 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,
|
||||||
|
rect.evt_buf[i].qvvr_cata_cause[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_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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public interface QvvrDLL extends Library {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从jar中提取库文件到临时目录
|
* 从jar中提取库文件到临时目录
|
||||||
*/
|
*/
|
||||||
@@ -62,11 +62,13 @@ public interface QvvrDLL extends Library {
|
|||||||
if (libStream == null) {
|
if (libStream == null) {
|
||||||
throw new FileNotFoundException("在jar中找不到库文件: " + resourcePath);
|
throw new FileNotFoundException("在jar中找不到库文件: " + resourcePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建临时文件
|
// 创建临时文件
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("java.io.tmpdir");
|
||||||
File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
File tempLibFile = new File(tempDir, libFileName);
|
||||||
|
|
||||||
|
// File tempLibFile = new File(tempDir, "qvvr_" + System.currentTimeMillis() + "_" + libFileName);
|
||||||
|
|
||||||
// 提取库文件到临时目录
|
// 提取库文件到临时目录
|
||||||
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
try (FileOutputStream out = new FileOutputStream(tempLibFile)) {
|
||||||
byte[] buffer = new byte[8192];
|
byte[] buffer = new byte[8192];
|
||||||
@@ -77,45 +79,47 @@ public interface QvvrDLL extends Library {
|
|||||||
} finally {
|
} finally {
|
||||||
libStream.close();
|
libStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置为可执行
|
// 设置为可执行
|
||||||
tempLibFile.setExecutable(true);
|
tempLibFile.setExecutable(true);
|
||||||
tempLibFile.setReadable(true);
|
tempLibFile.setReadable(true);
|
||||||
|
|
||||||
// JVM退出时删除临时文件
|
// JVM退出时删除临时文件
|
||||||
tempLibFile.deleteOnExit();
|
tempLibFile.deleteOnExit();
|
||||||
|
|
||||||
System.out.println("已提取库文件到: " + tempLibFile.getAbsolutePath());
|
System.out.println("已提取库文件到: " + tempLibFile.getAbsolutePath());
|
||||||
return tempLibFile;
|
return tempLibFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直接调用C DLL的qvvr_fun函数
|
* 直接调用C DLL的qvvr_fun函数
|
||||||
* void __stdcall qvvr_fun(void *data)
|
* void __stdcall qvvr_fun(void *data)
|
||||||
*/
|
*/
|
||||||
void qvvr_fun(QvvrDataStruct data);
|
void qvvr_fun(QvvrDataStruct data);
|
||||||
|
|
||||||
|
void ping();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对应C语言的qvvr_data_struct结构体
|
* 对应C语言的qvvr_data_struct结构体
|
||||||
*/
|
*/
|
||||||
public static class QvvrDataStruct extends Structure {
|
public static class QvvrDataStruct extends Structure {
|
||||||
|
|
||||||
// 输入数据
|
// 输入数据
|
||||||
public float[] smp_va = new float[128 * 50 * 120]; // A相电压
|
public float[] smp_va = new float[128 * 50 * 120]; // A相电压
|
||||||
public float[] smp_vb = new float[128 * 50 * 120]; // B相电压
|
public float[] smp_vb = new float[128 * 50 * 120]; // B相电压
|
||||||
public float[] smp_vc = new float[128 * 50 * 120]; // C相电压
|
public float[] smp_vc = new float[128 * 50 * 120]; // C相电压
|
||||||
public int smp_rate; // 采样频率
|
public int smp_rate; // 采样频率
|
||||||
public int smp_len; // 数据长度
|
public int smp_len; // 数据长度
|
||||||
|
|
||||||
// 输出结果
|
// 输出结果
|
||||||
public int evt_num; // 事件数量
|
public int evt_num; // 事件数量
|
||||||
public EventBuffer[] evt_buf = new EventBuffer[32]; // 事件缓冲区
|
public EventBuffer[] evt_buf = new EventBuffer[32]; // 事件缓冲区
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> getFieldOrder() {
|
protected List<String> getFieldOrder() {
|
||||||
return Arrays.asList("smp_va", "smp_vb", "smp_vc", "smp_rate", "smp_len", "evt_num", "evt_buf");
|
return Arrays.asList("smp_va", "smp_vb", "smp_vc", "smp_rate", "smp_len", "evt_num", "evt_buf");
|
||||||
}
|
}
|
||||||
|
|
||||||
public QvvrDataStruct() {
|
public QvvrDataStruct() {
|
||||||
super();
|
super();
|
||||||
// 初始化事件缓冲区
|
// 初始化事件缓冲区
|
||||||
@@ -124,49 +128,49 @@ public interface QvvrDLL extends Library {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件缓冲区结构
|
* 事件缓冲区结构
|
||||||
*/
|
*/
|
||||||
public static class EventBuffer extends Structure {
|
public static class EventBuffer extends Structure {
|
||||||
public int[] qvvr_cata_cause = new int[256];
|
public int[] qvvr_cata_cause = new int[256];
|
||||||
public int[] qvvr_phasetype = new int[256];
|
public int[] qvvr_phasetype = new int[256];
|
||||||
public int[] qvvr_cata_type = new int[256];
|
public int[] qvvr_cata_type = new int[256];
|
||||||
|
|
||||||
public float hold_time_rms;
|
public float hold_time_rms;
|
||||||
public float hold_time_dq;
|
public float hold_time_dq;
|
||||||
|
|
||||||
public float POW_a;
|
public float POW_a;
|
||||||
public float POW_b;
|
public float POW_b;
|
||||||
public float POW_c;
|
public float POW_c;
|
||||||
|
|
||||||
public float Voltagechange_Va;
|
public float Voltagechange_Va;
|
||||||
public float Voltagechange_Vb;
|
public float Voltagechange_Vb;
|
||||||
public float Voltagechange_Vc;
|
public float Voltagechange_Vc;
|
||||||
|
|
||||||
public int SEG_T_num;
|
public int SEG_T_num;
|
||||||
public int[] SEG_T0_idx = new int[256];
|
public int[] SEG_T0_idx = new int[256];
|
||||||
public int[] SEG_T_idx = new int[256];
|
public int[] SEG_T_idx = new int[256];
|
||||||
|
|
||||||
public int SEG_RMS_T_num;
|
public int SEG_RMS_T_num;
|
||||||
public int[] SEG_RMS_T_idx = new int[256];
|
public int[] SEG_RMS_T_idx = new int[256];
|
||||||
|
|
||||||
public int u_min_num;
|
public int u_min_num;
|
||||||
public float[] ua_min = new float[256];
|
public float[] ua_min = new float[256];
|
||||||
public float[] ub_min = new float[256];
|
public float[] ub_min = new float[256];
|
||||||
public float[] uc_min = new float[256];
|
public float[] uc_min = new float[256];
|
||||||
public float[] u3_min = new float[256];
|
public float[] u3_min = new float[256];
|
||||||
public int[] order_min_idx = new int[256];
|
public int[] order_min_idx = new int[256];
|
||||||
|
|
||||||
public float[] angle_diff_ap = new float[256];
|
public float[] angle_diff_ap = new float[256];
|
||||||
public float[] angle_diff_bp = new float[256];
|
public float[] angle_diff_bp = new float[256];
|
||||||
public float[] angle_diff_cp = new float[256];
|
public float[] angle_diff_cp = new float[256];
|
||||||
public float[] angle_diff_an = new float[256];
|
public float[] angle_diff_an = new float[256];
|
||||||
public float[] angle_diff_bn = new float[256];
|
public float[] angle_diff_bn = new float[256];
|
||||||
public float[] angle_diff_cn = new float[256];
|
public float[] angle_diff_cn = new float[256];
|
||||||
|
|
||||||
public float[] bph_max_value = new float[256];
|
public float[] bph_max_value = new float[256];
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> getFieldOrder() {
|
protected List<String> getFieldOrder() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ public class SecondaryEvaluationServiceImpl implements SecondaryEvaluationServic
|
|||||||
unblance.add(evaluationResult);
|
unblance.add(evaluationResult);
|
||||||
|
|
||||||
evaluationResult = new AssessResultVO.EvaluationResult();
|
evaluationResult = new AssessResultVO.EvaluationResult();
|
||||||
evaluationResult.setData(result.getApproUnblance().multiply(BigDecimal.valueOf(200)));
|
evaluationResult.setData(result.getApproUnblance());
|
||||||
evaluationResult.setLimitData(overLimit.getUnblance());
|
evaluationResult.setLimitData(overLimit.getUnblance());
|
||||||
evaluationResult.setIsQualified(NumberUtil.isLess(evaluationResult.getData(), evaluationResult.getLimitData()));
|
evaluationResult.setIsQualified(NumberUtil.isLess(evaluationResult.getData(), evaluationResult.getLimitData()));
|
||||||
unblance.add(evaluationResult);
|
unblance.add(evaluationResult);
|
||||||
|
|||||||
@@ -322,10 +322,7 @@ public class SgEventServiceImpl extends ServiceImpl<SgEventMapper, SgEvent> impl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteEventData(List<String> ids) {
|
public boolean deleteEventData(List<String> ids) {
|
||||||
return this.lambdaUpdate()
|
return this.removeByIds(ids);
|
||||||
.set(SgEvent::getState, DataStateEnum.DELETED.getCode())
|
|
||||||
.in(SgEvent::getId, ids)
|
|
||||||
.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||||
import com.njcn.advance.mapper.govern.voltage.SgMachineMapper;
|
import com.njcn.advance.mapper.govern.voltage.SgMachineMapper;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
||||||
|
import com.njcn.advance.pojo.param.govern.voltage.SgUserParam;
|
||||||
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||||
|
import com.njcn.advance.pojo.po.govern.voltage.SgUser;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
import com.njcn.advance.pojo.vo.govern.voltage.SgMachineVO;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
import com.njcn.advance.service.govern.voltage.ISgMachineService;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||||
@@ -56,12 +58,34 @@ public class SgMachineServiceImpl extends ServiceImpl<SgMachineMapper, SgMachine
|
|||||||
@Override
|
@Override
|
||||||
public String addMachine(SgMachineParam sgMachineParam) {
|
public String addMachine(SgMachineParam sgMachineParam) {
|
||||||
SgMachine sgMachine = new SgMachine();
|
SgMachine sgMachine = new SgMachine();
|
||||||
|
checkMachineName(sgMachineParam, false);
|
||||||
|
|
||||||
BeanUtil.copyProperties(sgMachineParam, sgMachine);
|
BeanUtil.copyProperties(sgMachineParam, sgMachine);
|
||||||
//默认为正常状态
|
//默认为正常状态
|
||||||
sgMachine.setState(DataStateEnum.ENABLE.getCode());
|
sgMachine.setState(DataStateEnum.ENABLE.getCode());
|
||||||
this.save(sgMachine);
|
this.save(sgMachine);
|
||||||
return sgMachine.getId();
|
return sgMachine.getId();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 校验参数,检查是否存在相同名称的业务用户
|
||||||
|
*/
|
||||||
|
private void checkMachineName(SgMachineParam sgMachineParam, boolean isExcludeSelf) {
|
||||||
|
LambdaQueryWrapper<SgMachine> sgUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
sgUserLambdaQueryWrapper
|
||||||
|
.eq(SgMachine::getName, sgMachineParam.getName())
|
||||||
|
.eq(SgMachine::getState, DataStateEnum.ENABLE.getCode());
|
||||||
|
//更新的时候,需排除当前记录
|
||||||
|
if (isExcludeSelf) {
|
||||||
|
if (sgMachineParam instanceof SgMachineParam.SgMachineUpdateParam) {
|
||||||
|
sgUserLambdaQueryWrapper.ne(SgMachine::getId, ((SgMachineParam.SgMachineUpdateParam) sgMachineParam).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int countByAccount = this.count(sgUserLambdaQueryWrapper);
|
||||||
|
//大于等于1个则表示重复
|
||||||
|
if (countByAccount >= 1) {
|
||||||
|
throw new BusinessException(AdvanceResponseEnum.SG_USER_NAME_REPEAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新设备
|
* 更新设备
|
||||||
@@ -70,6 +94,8 @@ public class SgMachineServiceImpl extends ServiceImpl<SgMachineMapper, SgMachine
|
|||||||
@Override
|
@Override
|
||||||
public boolean updateSgMachine(SgMachineParam.SgMachineUpdateParam updateParam) {
|
public boolean updateSgMachine(SgMachineParam.SgMachineUpdateParam updateParam) {
|
||||||
SgMachine sgMachine = new SgMachine();
|
SgMachine sgMachine = new SgMachine();
|
||||||
|
checkMachineName(updateParam, true);
|
||||||
|
|
||||||
BeanUtil.copyProperties(updateParam, sgMachine);
|
BeanUtil.copyProperties(updateParam, sgMachine);
|
||||||
return this.updateById(sgMachine);
|
return this.updateById(sgMachine);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package com.njcn.advance.service.govern.voltage.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
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.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.advance.enums.AdvanceResponseEnum;
|
import com.njcn.advance.enums.AdvanceResponseEnum;
|
||||||
import com.njcn.advance.mapper.govern.voltage.SgSensitiveUnitMapper;
|
import com.njcn.advance.mapper.govern.voltage.SgSensitiveUnitMapper;
|
||||||
|
import com.njcn.advance.pojo.param.govern.voltage.SgMachineParam;
|
||||||
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
import com.njcn.advance.pojo.param.govern.voltage.SgSensitiveUnitParam;
|
||||||
|
import com.njcn.advance.pojo.po.govern.voltage.SgMachine;
|
||||||
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
import com.njcn.advance.pojo.po.govern.voltage.SgSensitiveUnit;
|
||||||
import com.njcn.advance.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
import com.njcn.advance.pojo.vo.govern.voltage.SgSensitiveUnitVO;
|
||||||
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
import com.njcn.advance.service.govern.voltage.ISgSensitiveUnitService;
|
||||||
@@ -54,12 +57,34 @@ public class SgSensitiveUnitServiceImpl extends ServiceImpl<SgSensitiveUnitMappe
|
|||||||
@Override
|
@Override
|
||||||
public String addSensitiveUnit(SgSensitiveUnitParam sgSensitiveUnitParam) {
|
public String addSensitiveUnit(SgSensitiveUnitParam sgSensitiveUnitParam) {
|
||||||
SgSensitiveUnit sgSensitiveUnit = new SgSensitiveUnit();
|
SgSensitiveUnit sgSensitiveUnit = new SgSensitiveUnit();
|
||||||
|
checkSensitiveUnitName(sgSensitiveUnitParam, false);
|
||||||
|
|
||||||
BeanUtil.copyProperties(sgSensitiveUnitParam, sgSensitiveUnit);
|
BeanUtil.copyProperties(sgSensitiveUnitParam, sgSensitiveUnit);
|
||||||
//默认为正常状态
|
//默认为正常状态
|
||||||
sgSensitiveUnit.setState(DataStateEnum.ENABLE.getCode());
|
sgSensitiveUnit.setState(DataStateEnum.ENABLE.getCode());
|
||||||
this.save(sgSensitiveUnit);
|
this.save(sgSensitiveUnit);
|
||||||
return sgSensitiveUnit.getId();
|
return sgSensitiveUnit.getId();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 校验参数,检查是否存在相同名称的业务用户
|
||||||
|
*/
|
||||||
|
private void checkSensitiveUnitName(SgSensitiveUnitParam sgSensitiveUnitParam, boolean isExcludeSelf) {
|
||||||
|
LambdaQueryWrapper<SgSensitiveUnit> sgUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
sgUserLambdaQueryWrapper
|
||||||
|
.eq(SgSensitiveUnit::getName, sgSensitiveUnitParam.getName())
|
||||||
|
.eq(SgSensitiveUnit::getState, DataStateEnum.ENABLE.getCode());
|
||||||
|
//更新的时候,需排除当前记录
|
||||||
|
if (isExcludeSelf) {
|
||||||
|
if (sgSensitiveUnitParam instanceof SgSensitiveUnitParam.SgSensitiveUnitUpdateParam) {
|
||||||
|
sgUserLambdaQueryWrapper.ne(SgSensitiveUnit::getId, ((SgSensitiveUnitParam.SgSensitiveUnitUpdateParam) sgSensitiveUnitParam).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int countByAccount = this.count(sgUserLambdaQueryWrapper);
|
||||||
|
//大于等于1个则表示重复
|
||||||
|
if (countByAccount >= 1) {
|
||||||
|
throw new BusinessException(AdvanceResponseEnum.SG_USER_NAME_REPEAT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新元器件
|
* 更新元器件
|
||||||
@@ -69,6 +94,8 @@ public class SgSensitiveUnitServiceImpl extends ServiceImpl<SgSensitiveUnitMappe
|
|||||||
@Override
|
@Override
|
||||||
public boolean updateSgSensitiveUnit(SgSensitiveUnitParam.SgSensitiveUnitUpdateParam updateParam) {
|
public boolean updateSgSensitiveUnit(SgSensitiveUnitParam.SgSensitiveUnitUpdateParam updateParam) {
|
||||||
SgSensitiveUnit sgSensitiveUnit = new SgSensitiveUnit();
|
SgSensitiveUnit sgSensitiveUnit = new SgSensitiveUnit();
|
||||||
|
checkSensitiveUnitName(updateParam, true);
|
||||||
|
|
||||||
BeanUtil.copyProperties(updateParam, sgSensitiveUnit);
|
BeanUtil.copyProperties(updateParam, sgSensitiveUnit);
|
||||||
return this.updateById(sgSensitiveUnit);
|
return this.updateById(sgSensitiveUnit);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,11 @@ import io.swagger.models.auth.In;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -471,6 +473,8 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
|
|
||||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
|
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
|
||||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||||
|
item.setFeatureAmplitude(roundHalfUp(item.getFeatureAmplitude()*100));
|
||||||
|
|
||||||
if (map.containsKey(item.getLineId())) {
|
if (map.containsKey(item.getLineId())) {
|
||||||
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
|
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
|
||||||
item.setGdName(areaLineInfoVO.getGdName());
|
item.setGdName(areaLineInfoVO.getGdName());
|
||||||
@@ -489,7 +493,17 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 四舍五入保留两位小数
|
||||||
|
*/
|
||||||
|
private Double roundHalfUp(double num) {
|
||||||
|
if (num == 3.14159) {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
BigDecimal b = new BigDecimal(num);
|
||||||
|
//保留2位小数
|
||||||
|
return com.njcn.harmonic.utils.PubUtils.dataLimits(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
|
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
|
||||||
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
||||||
@@ -498,7 +512,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
lambdaQueryWrapper.like(RmpEventDetailAssPO::getContentDes, baseParam.getSearchValue());
|
lambdaQueryWrapper.like(RmpEventDetailAssPO::getContentDes, baseParam.getSearchValue());
|
||||||
}
|
}
|
||||||
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
lambdaQueryWrapper.between(RmpEventDetailAssPO::getTimeId, timeV.get(0), timeV.get(1))
|
||||||
.orderByAsc(RmpEventDetailAssPO::getTimeId);
|
.orderByDesc(RmpEventDetailAssPO::getTimeId);
|
||||||
return rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
return rmpEventDetailAssMapper.selectPage(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -720,7 +734,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
|
|
||||||
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
||||||
|
|
||||||
|
advanceEventDetailVOLsit = advanceEventDetailVOLsit.stream().filter(temp-> StringUtils.isNotEmpty(temp.getAdvanceType())).collect(Collectors.toList());
|
||||||
for (AdvanceEventDetailVO advanceEventDetailVO : advanceEventDetailVOLsit) { // 获取监测点线路序号
|
for (AdvanceEventDetailVO advanceEventDetailVO : advanceEventDetailVOLsit) { // 获取监测点线路序号
|
||||||
//母线id
|
//母线id
|
||||||
String nodePhysics = advanceEventDetailVO.getVoltageId();
|
String nodePhysics = advanceEventDetailVO.getVoltageId();
|
||||||
@@ -854,6 +868,21 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
/*************************************************************************************
|
/*************************************************************************************
|
||||||
* 获取变压器信息并生成矩阵
|
* 获取变压器信息并生成矩阵
|
||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
|
public Map<String, Map<String, Integer>> getNodeBefore(){
|
||||||
|
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||||
|
|
||||||
|
HandleEvent handleEvent = new HandleEvent();
|
||||||
|
List<EntityLogic> list = relevantLogMapper.getLogic();
|
||||||
|
Map<String, Map<String, Integer>> setNodeSort = new HashMap<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
Map<String, List<String>> map = getLogicInfo(list);
|
||||||
|
setNodeSort = nodeSort(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
return setNodeSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<String, EntityMtrans> getNodeInfo( ) {
|
public Map<String, EntityMtrans> getNodeInfo( ) {
|
||||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -81,7 +87,13 @@ public class EventWaveAnalysisServiceImpl implements EventWaveAnalysisService {
|
|||||||
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG);
|
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG);
|
||||||
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
try {
|
||||||
|
inputStreamCfg = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.CFG.toLowerCase());
|
||||||
|
inputStreamDat = fileStorageUtil.getFileStream(OssPath.WAVE_DIR + lineDetailDataVO.getIp() + StrUtil.SLASH + rmpEventDetailPO.getWavePath() + GeneralConstant.DAT.toLowerCase());
|
||||||
|
} catch (Exception e1) {
|
||||||
|
|
||||||
|
throw new BusinessException("暂降cfg,dat文件缺失,请联系管理员");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//读取
|
//读取
|
||||||
@@ -164,17 +176,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);
|
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 (rmpEventDetailPO.getDealFlag() != 1) {
|
if (rmpEventDetailPO.getDealFlag() != 1) {
|
||||||
//如果存在三个文件但是没有调用dll/so计算
|
//如果存在三个文件但是没有调用dll/so计算
|
||||||
|
|
||||||
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
getDataFromDLL(rmpEventDetailPO, waveOriginalData, rect, entityAdvancedData, causeStruct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -208,6 +216,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处理并保存结果
|
||||||
@@ -352,7 +525,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;
|
||||||
|
|||||||
@@ -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: sjzx
|
||||||
#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}
|
|
||||||
Binary file not shown.
Binary file not shown.
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}
|
|
||||||
@@ -88,7 +88,7 @@ public class BpmSignParam extends BaseEntity implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("标识key")
|
@ApiModelProperty("标识key")
|
||||||
private String key;
|
private String signKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import org.springframework.context.annotation.DependsOn;
|
|||||||
* @date 2022/11/10
|
* @date 2022/11/10
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@DependsOn("proxyMapperRegister")
|
|
||||||
@MapperScan("com.njcn.**.mapper")
|
@MapperScan("com.njcn.**.mapper")
|
||||||
@EnableFeignClients(basePackages = "com.njcn")
|
@EnableFeignClients(basePackages = "com.njcn")
|
||||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ public class BpmCategoryServiceImpl extends ServiceImpl<BpmCategoryMapper, BpmCa
|
|||||||
@Override
|
@Override
|
||||||
public Page<BpmCategoryVO> getCategoryPage(BpmCategoryParam.BpmCategoryQueryParam bpmCategoryQueryParam) {
|
public Page<BpmCategoryVO> getCategoryPage(BpmCategoryParam.BpmCategoryQueryParam bpmCategoryQueryParam) {
|
||||||
QueryWrapper<BpmCategoryVO> categoryVOQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<BpmCategoryVO> categoryVOQueryWrapper = new QueryWrapper<>();
|
||||||
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getName())) {
|
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getSearchValue())) {
|
||||||
categoryVOQueryWrapper.like("bpm_category.name", bpmCategoryQueryParam.getName());
|
categoryVOQueryWrapper.like("bpm_category.name", bpmCategoryQueryParam.getSearchValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getCode())) {
|
if (StrUtil.isNotBlank(bpmCategoryQueryParam.getCode())) {
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ public class BpmSignServiceImpl extends ServiceImpl<BpmSignMapper, BpmSign> impl
|
|||||||
bpmSignVOQueryWrapper.like("bpm_sign.name", bpmSignQueryParam.getName());
|
bpmSignVOQueryWrapper.like("bpm_sign.name", bpmSignQueryParam.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(bpmSignQueryParam.getKey())) {
|
if (StrUtil.isNotBlank(bpmSignQueryParam.getSignKey())) {
|
||||||
bpmSignVOQueryWrapper.like("bpm_sign.signKey", bpmSignQueryParam.getKey());
|
bpmSignVOQueryWrapper.like("bpm_sign.sign_key", bpmSignQueryParam.getSignKey());
|
||||||
}
|
}
|
||||||
bpmSignVOQueryWrapper.eq("bpm_sign.state", DataStateEnum.ENABLE.getCode());
|
bpmSignVOQueryWrapper.eq("bpm_sign.state", DataStateEnum.ENABLE.getCode());
|
||||||
bpmSignVOQueryWrapper.orderByAsc("bpm_sign.sort");
|
bpmSignVOQueryWrapper.orderByAsc("bpm_sign.sort");
|
||||||
|
|||||||
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}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -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>-->
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ public interface PatternRegex {
|
|||||||
String ROLE_REGEX = "^[a-zA-Z][a-zA-Z0-9]{2,50}$";
|
String ROLE_REGEX = "^[a-zA-Z][a-zA-Z0-9]{2,50}$";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门名称由汉字组成,长度为0-20
|
* 部门名称由汉字组成,长度为0-32 (前端统一32了这边改下长度)
|
||||||
*/
|
*/
|
||||||
String DEPT_NAME_REGEX = "^[\\u4e00-\\u9fa5]{1,20}$";
|
String DEPT_NAME_REGEX = "^[\\u4e00-\\u9fa5]{1,32}$";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典名称包括中文、数字、字母、罗马数字、括号以及点号
|
* 字典名称包括中文、数字、字母、罗马数字、括号以及点号
|
||||||
@@ -258,7 +258,7 @@ public interface PatternRegex {
|
|||||||
/**
|
/**
|
||||||
* 任意字符,长度在1-20位,常用于名称、编码等常规录入
|
* 任意字符,长度在1-20位,常用于名称、编码等常规录入
|
||||||
*/
|
*/
|
||||||
String ALL_CHAR_1_20 = "^[-_A-Za-z0-9\\u4e00-\\u9fa5]{1,20}$";
|
String ALL_CHAR_1_20 = "^[-_A-Za-z0-9\\u4e00-\\u9fa5]{1,32}$";
|
||||||
|
|
||||||
String SPECIALCHARACTER ="[<>%'%;()&+/\\\\-\\\\\\\\_|@*?#$!,.]|html";
|
String SPECIALCHARACTER ="[<>%'%;()&+/\\\\-\\\\\\\\_|@*?#$!,.]|html";
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ public class SimpleDTO implements Serializable {
|
|||||||
@ApiModelProperty(name = "value", value = "数值")
|
@ApiModelProperty(name = "value", value = "数值")
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对云南曲靖特殊处理的五层树标识符
|
||||||
|
* 特殊在不显示供电公司,显示(变电站、线路)这两个是部门的名称+母线_监测点的名称
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
private Integer algoDescribe;
|
private Integer algoDescribe;
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,11 @@
|
|||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--vastbase驱动用postgresql-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
</dependency>
|
||||||
<!--达梦驱动-->
|
<!--达梦驱动-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dameng</groupId>
|
<groupId>com.dameng</groupId>
|
||||||
@@ -69,6 +74,12 @@
|
|||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--数据库相关********end-->
|
<!--数据库相关********end-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class PieGenerator {
|
|||||||
Option reasonOption = new Option();
|
Option reasonOption = new Option();
|
||||||
//取消渲染动画
|
//取消渲染动画
|
||||||
reasonOption.setAnimation(false);
|
reasonOption.setAnimation(false);
|
||||||
|
String[] colorArr = {"#526ADE", "#00BFF5","#FFBF00","#77DA63","#D5FF6B"};
|
||||||
|
reasonOption.setColor(colorArr);
|
||||||
//背景色
|
//背景色
|
||||||
reasonOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
|
reasonOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
|
||||||
//标题
|
//标题
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class BusinessDataUtil {
|
|||||||
List<List<Double>> unTolerateData = new ArrayList<>();
|
List<List<Double>> unTolerateData = new ArrayList<>();
|
||||||
for (List<Double> list : originData) {
|
for (List<Double> list : originData) {
|
||||||
//是否超过上限
|
//是否超过上限
|
||||||
if (list.get(0) <= 0.03) {
|
if (list.get(0) <= 0.003) {
|
||||||
int line = 230 - 30000 * list.get(0).intValue();
|
int line = 230 - 30000 * list.get(0).intValue();
|
||||||
if (list.get(1) > line) {
|
if (list.get(1) > line) {
|
||||||
unTolerateData.add(list);
|
unTolerateData.add(list);
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public class DrawPicUtil {
|
|||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 绘制波形图
|
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
|
* 绘制波形图
|
||||||
* @date 2023/6/21 11:01
|
* @date 2023/6/21 11:01
|
||||||
* @return String base64数据
|
* @return String base64数据
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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,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,39 @@ 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";
|
||||||
|
|
||||||
|
|
||||||
interface AppDataTag {
|
interface AppDataTag {
|
||||||
|
|
||||||
@@ -124,4 +153,17 @@ public interface BusinessTopic {
|
|||||||
String STREAM_TAG = "streamInfo";
|
String STREAM_TAG = "streamInfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface HeartTag {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apf 心跳
|
||||||
|
*/
|
||||||
|
String APF_TAG = "apf";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cld 心跳
|
||||||
|
*/
|
||||||
|
String CLD_TAG = "cld";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -48,6 +48,28 @@
|
|||||||
<artifactId>minioss-springboot-starter</artifactId>
|
<artifactId>minioss-springboot-starter</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>aliyun-oss-springboot-starter</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-api</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.18.0</version>
|
||||||
|
<optional>false</optional>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -13,6 +13,7 @@ public interface GeneralConstant {
|
|||||||
Integer LOCAL_DISK = 1;
|
Integer LOCAL_DISK = 1;
|
||||||
Integer HUAWEI_OBS = 2;
|
Integer HUAWEI_OBS = 2;
|
||||||
Integer MINIO_OSS = 3;
|
Integer MINIO_OSS = 3;
|
||||||
|
Integer AliYUN_OSS = 4;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 波形文件的3种后缀
|
* 波形文件的3种后缀
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public interface OssPath {
|
|||||||
*/
|
*/
|
||||||
String WAVE_DIR="comtrade/";
|
String WAVE_DIR="comtrade/";
|
||||||
|
|
||||||
|
String WAVE_FILE="wave/";
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 下载文件
|
* 下载文件
|
||||||
*/
|
*/
|
||||||
@@ -167,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/";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.njcn.oss.utils;
|
package com.njcn.oss.utils;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.lang.UUID;
|
|
||||||
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.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,8 +15,9 @@ 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.errors.*;
|
|
||||||
import io.minio.messages.Item;
|
import io.minio.messages.Item;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -66,6 +70,16 @@ public class FileStorageUtil {
|
|||||||
|
|
||||||
private final MinIossProperties minIossProperties;
|
private final MinIossProperties minIossProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云文件服务器
|
||||||
|
*/
|
||||||
|
private final AliYunOssUtils aliYunOssUtils;
|
||||||
|
|
||||||
|
private final HuaweiObsProperties huaweiObsProperties;
|
||||||
|
|
||||||
|
private final OSS ossClient;
|
||||||
|
private final AliYunOssConfig ossConfig;
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 上传MultipartFile文件,
|
* 上传MultipartFile文件,
|
||||||
@@ -79,7 +93,7 @@ public class FileStorageUtil {
|
|||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
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.MINIO_OSS){
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||||
try {
|
try {
|
||||||
//把名称存入数据
|
//把名称存入数据
|
||||||
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.upload(multipartFile, minIossProperties.getBucket(), dir);
|
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.upload(multipartFile, minIossProperties.getBucket(), dir);
|
||||||
@@ -87,11 +101,15 @@ public class FileStorageUtil {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||||
}
|
}
|
||||||
}else {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
filePath = dir;
|
||||||
|
aliYunOssUtils.uploadFile(dir, multipartFile);
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
// 构建完整目录:基准目录 + dir子目录
|
// 构建完整目录:基准目录 + dir子目录
|
||||||
Path basePath = Paths.get(generalInfo.getLocalStorePath());
|
Path basePath = Paths.get(generalInfo.getLocalStorePath());
|
||||||
Path uploadPath = basePath.resolve(dir); // 将dir作为子目录添加
|
// 将dir作为子目录添加
|
||||||
|
Path uploadPath = basePath.resolve(dir);
|
||||||
|
|
||||||
// 确保完整目录存在(包括dir子目录)
|
// 确保完整目录存在(包括dir子目录)
|
||||||
if (!Files.exists(uploadPath)) {
|
if (!Files.exists(uploadPath)) {
|
||||||
@@ -135,6 +153,9 @@ public class FileStorageUtil {
|
|||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
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) {
|
||||||
|
filePath = dir;
|
||||||
|
aliYunOssUtils.uploadFile(dir, multipartFile);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
//把名称存入数据
|
//把名称存入数据
|
||||||
@@ -160,7 +181,7 @@ public class FileStorageUtil {
|
|||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
filePath = dir + minIoUtils.minFileName(fileName);
|
filePath = dir + minIoUtils.minFileName(fileName);
|
||||||
obsUtil.uploadStream(inputStream, filePath);
|
obsUtil.uploadStream(inputStream, filePath);
|
||||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||||
try {
|
try {
|
||||||
//把名称存入数据
|
//把名称存入数据
|
||||||
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.uploadStream(inputStream, minIossProperties.getBucket(), dir, minIoUtils.minFileName(fileName));
|
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.uploadStream(inputStream, minIossProperties.getBucket(), dir, minIoUtils.minFileName(fileName));
|
||||||
@@ -168,14 +189,17 @@ public class FileStorageUtil {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||||
}
|
}
|
||||||
}else {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
filePath = dir + fileName;
|
||||||
|
aliYunOssUtils.uploadFile(filePath, inputStream);
|
||||||
|
} else {
|
||||||
// 本地存储逻辑
|
// 本地存储逻辑
|
||||||
try {
|
try {
|
||||||
// 1. 获取本地存储路径
|
// 1. 获取本地存储路径
|
||||||
String localStoragePath = generalInfo.getLocalStorePath();
|
String localStoragePath = generalInfo.getLocalStorePath();
|
||||||
|
|
||||||
// 2. 确保目录存在(如果不存在则创建)
|
// 2. 确保目录存在(如果不存在则创建)
|
||||||
File targetDir = new File(localStoragePath +File.separator+ dir);
|
File targetDir = new File(localStoragePath + File.separator + dir);
|
||||||
if (!targetDir.exists()) {
|
if (!targetDir.exists()) {
|
||||||
boolean created = targetDir.mkdirs();
|
boolean created = targetDir.mkdirs();
|
||||||
if (!created) {
|
if (!created) {
|
||||||
@@ -193,7 +217,7 @@ public class FileStorageUtil {
|
|||||||
// 5. 返回相对路径
|
// 5. 返回相对路径
|
||||||
filePath = dir + finalFileName;
|
filePath = dir + finalFileName;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR,e.getMessage());
|
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
@@ -209,6 +233,9 @@ public class FileStorageUtil {
|
|||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
filePath = dir + minIoUtils.minFileName(fileName);
|
filePath = dir + minIoUtils.minFileName(fileName);
|
||||||
obsUtil.uploadStream(inputStream, filePath);
|
obsUtil.uploadStream(inputStream, filePath);
|
||||||
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
filePath = dir + fileName;
|
||||||
|
aliYunOssUtils.uploadFile(filePath, inputStream);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
//把名称存入数据
|
//把名称存入数据
|
||||||
@@ -232,6 +259,8 @@ public class FileStorageUtil {
|
|||||||
String url;
|
String url;
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
url = obsUtil.getFileUrl(filePath);
|
url = obsUtil.getFileUrl(filePath);
|
||||||
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
url = aliYunOssUtils.generatePresignedUrl(filePath, 3600);
|
||||||
} else {
|
} else {
|
||||||
url = minIoUtils.getObjectUrl(minIossProperties.getBucket(), filePath, 7 * 24 * 60 * 60);
|
url = minIoUtils.getObjectUrl(minIossProperties.getBucket(), filePath, 7 * 24 * 60 * 60);
|
||||||
}
|
}
|
||||||
@@ -250,10 +279,12 @@ public class FileStorageUtil {
|
|||||||
try {
|
try {
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
inputStream = obsUtil.downloadStream(filePath);
|
inputStream = obsUtil.downloadStream(filePath);
|
||||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||||
inputStream = minIoUtils.downloadStream(minIossProperties.getBucket(), filePath);
|
inputStream = minIoUtils.downloadStream(minIossProperties.getBucket(), filePath);
|
||||||
}else {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
Path path = Paths.get(generalInfo.getLocalStorePath()+File.separator+filePath);
|
inputStream = aliYunOssUtils.downloadStream(filePath);
|
||||||
|
} else {
|
||||||
|
Path path = Paths.get(generalInfo.getLocalStorePath() + File.separator + filePath);
|
||||||
inputStream = Files.newInputStream(path);
|
inputStream = Files.newInputStream(path);
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
@@ -274,11 +305,13 @@ public class FileStorageUtil {
|
|||||||
try {
|
try {
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
inputStream = obsUtil.downloadStream(filePath);
|
inputStream = obsUtil.downloadStream(filePath);
|
||||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||||
inputStream = minIoUtils.downloadStream(minIossProperties.getBucket(), filePath);
|
inputStream = minIoUtils.downloadStream(minIossProperties.getBucket(), filePath);
|
||||||
}else {
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
inputStream = aliYunOssUtils.downloadStream(filePath);
|
||||||
|
} else {
|
||||||
// 本地存储处理
|
// 本地存储处理
|
||||||
Path path = Paths.get(generalInfo.getLocalStorePath()+File.separator+filePath);
|
Path path = Paths.get(generalInfo.getLocalStorePath() + File.separator + filePath);
|
||||||
inputStream = Files.newInputStream(path);
|
inputStream = Files.newInputStream(path);
|
||||||
|
|
||||||
// 设置下载文件名(从路径中提取)
|
// 设置下载文件名(从路径中提取)
|
||||||
@@ -331,14 +364,16 @@ public class FileStorageUtil {
|
|||||||
public void deleteFile(String fileName) {
|
public void deleteFile(String fileName) {
|
||||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
obsUtil.delete(fileName);
|
obsUtil.delete(fileName);
|
||||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||||
minIoUtils.removeObject(minIossProperties.getBucket(), fileName);
|
minIoUtils.removeObject(minIossProperties.getBucket(), fileName);
|
||||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK){
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
Path path = Paths.get(generalInfo.getLocalStorePath()+File.separator+fileName);
|
aliYunOssUtils.deleteFile(fileName);
|
||||||
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||||
|
Path path = Paths.get(generalInfo.getLocalStorePath() + File.separator + fileName);
|
||||||
try {
|
try {
|
||||||
Files.delete(path);
|
Files.delete(path);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info("删除本地文件{}失败失败原因{}", path,e.getMessage());
|
log.info("删除本地文件{}失败失败原因{}", path, e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,11 +444,70 @@ public class FileStorageUtil {
|
|||||||
|
|
||||||
file = File.createTempFile(lastItem.objectName(), "xlsx");
|
file = File.createTempFile(lastItem.objectName(), "xlsx");
|
||||||
FileUtil.writeFromStream(stream, file);
|
FileUtil.writeFromStream(stream, file);
|
||||||
}else if(generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS){
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||||
file = obsUtil.getLastFile(OssPath.LOGBAK);
|
file = obsUtil.getLastFile(OssPath.LOGBAK);
|
||||||
|
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||||
|
file = aliYunOssUtils.getLastFile(directory);
|
||||||
}
|
}
|
||||||
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:";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,22 @@ public enum RedisKeyEnum {
|
|||||||
/**
|
/**
|
||||||
* 云前置心跳
|
* 云前置心跳
|
||||||
*/
|
*/
|
||||||
CLD_HEART_BEAT_KEY("CLD_HEART_BEAT:", 180L);
|
CLD_HEART_BEAT_KEY("CLD_HEART_BEAT:", 180L),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户日志队列
|
||||||
|
*/
|
||||||
|
USER_LOG_QUEUE("USER_LOG_QUEUE", -1L),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户日志邮件推送队列
|
||||||
|
*/
|
||||||
|
USER_LOG_EMAIL_QUEUE("USER_LOG_EMAIL_QUEUE", -1L),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端日志
|
||||||
|
*/
|
||||||
|
DEVICE_LOG_QUEUE("DEVICE_LOG_QUEUE", -1L);
|
||||||
|
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.njcn.redis.utils;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redis 消息队列工具类
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RedisMessageQueueUtil {
|
||||||
|
|
||||||
|
private final RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送消息到队列(左推)
|
||||||
|
*
|
||||||
|
* @param queueKey 队列Key
|
||||||
|
* @param message 消息内容(JSON字符串)
|
||||||
|
*/
|
||||||
|
public void pushMessage(String queueKey, String message) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForList().leftPush(queueKey, message);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("推送消息到队列失败,queueKey={}", queueKey, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阻塞式弹出消息(右弹)
|
||||||
|
*
|
||||||
|
* @param queueKey 队列Key
|
||||||
|
* @param timeout 超时时间(秒)
|
||||||
|
* @return 消息内容,超时返回null
|
||||||
|
*/
|
||||||
|
public String popMessage(String queueKey, long timeout) {
|
||||||
|
try {
|
||||||
|
Object result = redisTemplate.opsForList().rightPop(queueKey, timeout, TimeUnit.SECONDS);
|
||||||
|
return result != null ? result.toString() : null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("弹出消息失败,queueKey={}", queueKey, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取队列长度(用于监控)
|
||||||
|
*
|
||||||
|
* @param queueKey 队列Key
|
||||||
|
* @return 队列长度
|
||||||
|
*/
|
||||||
|
public Long getQueueSize(String queueKey) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForList().size(queueKey);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取队列长度失败,queueKey={}", queueKey, e);
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ public class Knife4jSwaggerConfig {
|
|||||||
@Value("${microservice.gateway.url}")
|
@Value("${microservice.gateway.url}")
|
||||||
private String gatewayUrl;
|
private String gatewayUrl;
|
||||||
|
|
||||||
|
@Value("${swagger.enable:true}")
|
||||||
|
private Boolean swaggerEnable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* swagger通用配置
|
* swagger通用配置
|
||||||
*/
|
*/
|
||||||
@@ -56,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",
|
||||||
@@ -71,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",
|
||||||
@@ -81,7 +86,11 @@ public class Knife4jSwaggerConfig {
|
|||||||
"com.njcn.supervision.controller",
|
"com.njcn.supervision.controller",
|
||||||
"com.njcn.algorithm",
|
"com.njcn.algorithm",
|
||||||
"com.njcn.dataProcess",
|
"com.njcn.dataProcess",
|
||||||
"com.njcn.migration"
|
"com.njcn.migration",
|
||||||
|
"com.njcn.harmonic.rstatlimitrate.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<>();
|
||||||
@@ -94,7 +103,7 @@ public class Knife4jSwaggerConfig {
|
|||||||
//securyContext
|
//securyContext
|
||||||
return new Docket(DocumentationType.SWAGGER_2)
|
return new Docket(DocumentationType.SWAGGER_2)
|
||||||
.apiInfo(apiInfo())
|
.apiInfo(apiInfo())
|
||||||
.enable(true)
|
.enable(swaggerEnable)
|
||||||
.select()
|
.select()
|
||||||
// 指定添加swagger注解的方法
|
// 指定添加swagger注解的方法
|
||||||
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class FeignConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
public Decoder feignDecoder() {
|
public Decoder feignDecoder() {
|
||||||
return (response, type) -> {
|
return (response, type) -> {
|
||||||
|
|
||||||
String bodyStr = Util.toString(response.body().asReader(Util.UTF_8));
|
String bodyStr = Util.toString(response.body().asReader(Util.UTF_8));
|
||||||
//对结果进行转换
|
//对结果进行转换
|
||||||
HttpResult<Object> result = PubUtils.json2obj(bodyStr, type);
|
HttpResult<Object> result = PubUtils.json2obj(bodyStr, type);
|
||||||
@@ -60,6 +61,8 @@ public class FeignConfig {
|
|||||||
}
|
}
|
||||||
switch (commonResponseEnum) {
|
switch (commonResponseEnum) {
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
|
// case NO_DATA:
|
||||||
|
// case FAIL:
|
||||||
return result;
|
return result;
|
||||||
default:
|
default:
|
||||||
throw new BusinessException(result);
|
throw new BusinessException(result);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface ValidMessage {
|
|||||||
|
|
||||||
String NAME_NOT_BLANK = "名称不能为空,请检查name参数";
|
String NAME_NOT_BLANK = "名称不能为空,请检查name参数";
|
||||||
|
|
||||||
String NAME_FORMAT_ERROR = "名称格式错误,存在特殊符号或超过20字符,请检查name参数";
|
String NAME_FORMAT_ERROR = "名称格式错误,存在特殊符号或超过32字符,请检查name参数";
|
||||||
|
|
||||||
String INDUSTRY_NOT_BLANK = "行业不能为空,请检查industry参数";
|
String INDUSTRY_NOT_BLANK = "行业不能为空,请检查industry参数";
|
||||||
String INDUSTRY_FORMAT_ERROR = "行业格式错误,请检查industry参数";
|
String INDUSTRY_FORMAT_ERROR = "行业格式错误,请检查industry参数";
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.njcn.web.service.impl;
|
package com.njcn.web.service.impl;
|
||||||
|
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.LogInfo;
|
import com.njcn.common.pojo.constant.LogInfo;
|
||||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||||
@@ -10,6 +8,8 @@ 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.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.common.utils.ReflectCommonUtil;
|
import com.njcn.common.utils.ReflectCommonUtil;
|
||||||
|
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||||
|
import com.njcn.redis.utils.RedisMessageQueueUtil;
|
||||||
import com.njcn.web.advice.DeviceLog;
|
import com.njcn.web.advice.DeviceLog;
|
||||||
import com.njcn.web.service.ILogService;
|
import com.njcn.web.service.ILogService;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
@@ -46,8 +46,15 @@ public class LogServiceImpl implements ILogService {
|
|||||||
|
|
||||||
|
|
||||||
private final GeneralInfo generalInfo;
|
private final GeneralInfo generalInfo;
|
||||||
|
/**
|
||||||
|
* mqtt处理日志异步发布
|
||||||
|
*/
|
||||||
|
// private final MqttPublisher publisher;
|
||||||
|
|
||||||
private final MqttPublisher publisher;
|
/**
|
||||||
|
* redis队列处理日志异步发布
|
||||||
|
*/
|
||||||
|
private final RedisMessageQueueUtil redisMessageQueueUtil;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,14 +89,27 @@ public class LogServiceImpl implements ILogService {
|
|||||||
String operateType = ReflectCommonUtil.getOperateTypeByMethod(returnType.getMethod());
|
String operateType = ReflectCommonUtil.getOperateTypeByMethod(returnType.getMethod());
|
||||||
Integer severity = levelStringToNumber(level);
|
Integer severity = levelStringToNumber(level);
|
||||||
LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, userName, ip, methodDescribe, operateType, result.equalsIgnoreCase("失败") ? 0 : 1, "", severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), userIndex, LocalDateTime.now());
|
LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, userName, ip, methodDescribe, operateType, result.equalsIgnoreCase("失败") ? 0 : 1, "", severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), userIndex, LocalDateTime.now());
|
||||||
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
// publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
|
|
||||||
|
redisMessageQueueUtil.pushMessage(
|
||||||
|
RedisKeyEnum.USER_LOG_QUEUE.getKey(),
|
||||||
|
PubUtils.obj2json(logInfoDTO)
|
||||||
|
);
|
||||||
|
|
||||||
//推送审计消息功能
|
//推送审计消息功能
|
||||||
if (severity != 0) {
|
if (severity != 0) {
|
||||||
if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
||||||
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
/**注意,此处是给前端推送的,如果没有了mqtt协议,此处前端就无消息可消费了*/
|
||||||
|
// publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
|
|
||||||
//发送邮箱功能
|
//发送邮箱功能
|
||||||
if (severity == 2 && logInfoDTO.getResult() == 0) {
|
if (severity == 2 && logInfoDTO.getResult() == 0) {
|
||||||
//publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
//publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
|
|
||||||
|
// redisMessageQueueUtil.pushMessage(
|
||||||
|
// RedisKeyEnum.USER_LOG_EMAIL_QUEUE.getKey(),
|
||||||
|
// PubUtils.obj2json(logInfoDTO)
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,8 +117,11 @@ public class LogServiceImpl implements ILogService {
|
|||||||
if (Objects.nonNull((returnType.getMethod())) && (returnType.getMethod()).isAnnotationPresent(DeviceLog.class)) {
|
if (Objects.nonNull((returnType.getMethod())) && (returnType.getMethod()).isAnnotationPresent(DeviceLog.class)) {
|
||||||
String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType();
|
String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType();
|
||||||
DeviceLogDTO deviceLogDTO = new DeviceLogDTO(userName, deviceOperate, result.equalsIgnoreCase("失败") ? 0 : 1, "", loginName, userIndex);
|
DeviceLogDTO deviceLogDTO = new DeviceLogDTO(userName, deviceOperate, result.equalsIgnoreCase("失败") ? 0 : 1, "", loginName, userIndex);
|
||||||
publisher.send("/deviceLog", PubUtils.obj2json(deviceLogDTO), 2, false);
|
// publisher.send("/deviceLog", PubUtils.obj2json(deviceLogDTO), 2, false);
|
||||||
|
redisMessageQueueUtil.pushMessage(
|
||||||
|
RedisKeyEnum.DEVICE_LOG_QUEUE.getKey(),
|
||||||
|
PubUtils.obj2json(deviceLogDTO)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +158,11 @@ public class LogServiceImpl implements ILogService {
|
|||||||
String operateType = ReflectCommonUtil.getOperateTypeByMethod(method);
|
String operateType = ReflectCommonUtil.getOperateTypeByMethod(method);
|
||||||
Integer severity = levelStringToNumber(level);
|
Integer severity = levelStringToNumber(level);
|
||||||
LogInfoDTO logInfoDTO = new LogInfoDTO(tempLogInfo.getLoginName(), tempLogInfo.getUserName(), tempLogInfo.getIp(), ReflectCommonUtil.getMethodDescribeByMethod(method), operateType, result.equalsIgnoreCase("失败") ? 0 : 1, message, severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), userIndex, LocalDateTime.now());
|
LogInfoDTO logInfoDTO = new LogInfoDTO(tempLogInfo.getLoginName(), tempLogInfo.getUserName(), tempLogInfo.getIp(), ReflectCommonUtil.getMethodDescribeByMethod(method), operateType, result.equalsIgnoreCase("失败") ? 0 : 1, message, severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), userIndex, LocalDateTime.now());
|
||||||
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 1, false);
|
// publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 1, false);
|
||||||
|
redisMessageQueueUtil.pushMessage(
|
||||||
|
RedisKeyEnum.USER_LOG_QUEUE.getKey(),
|
||||||
|
PubUtils.obj2json(logInfoDTO)
|
||||||
|
);
|
||||||
auditPush(severity, logInfoDTO);
|
auditPush(severity, logInfoDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +190,11 @@ public class LogServiceImpl implements ILogService {
|
|||||||
Integer severity = levelStringToNumber(level);
|
Integer severity = levelStringToNumber(level);
|
||||||
String operateType = ReflectCommonUtil.getOperateTypeByMethod(method);
|
String operateType = ReflectCommonUtil.getOperateTypeByMethod(method);
|
||||||
LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, "", ip, ReflectCommonUtil.getMethodDescribeByMethod(method), operateType, result.equalsIgnoreCase("失败") ? 0 : 1, message, severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), loginName, LocalDateTime.now());
|
LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, "", ip, ReflectCommonUtil.getMethodDescribeByMethod(method), operateType, result.equalsIgnoreCase("失败") ? 0 : 1, message, severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), loginName, LocalDateTime.now());
|
||||||
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 1, false);
|
// publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 1, false);
|
||||||
|
redisMessageQueueUtil.pushMessage(
|
||||||
|
RedisKeyEnum.USER_LOG_QUEUE.getKey(),
|
||||||
|
PubUtils.obj2json(logInfoDTO)
|
||||||
|
);
|
||||||
auditPush(severity, logInfoDTO);
|
auditPush(severity, logInfoDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +202,12 @@ public class LogServiceImpl implements ILogService {
|
|||||||
//推送审计消息功能
|
//推送审计消息功能
|
||||||
if (severity != 0) {
|
if (severity != 0) {
|
||||||
if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
||||||
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
/**注意,此处是给前端推送的,如果没有了mqtt协议,此处前端就无消息可消费了*/
|
||||||
|
// publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
|
// redisMessageQueueUtil.pushMessage(
|
||||||
|
// RedisKeyEnum.USER_LOG_QUEUE.getKey(),
|
||||||
|
// PubUtils.obj2json(logInfoDTO)
|
||||||
|
// );
|
||||||
//发送邮箱功能
|
//发送邮箱功能
|
||||||
if (severity == 2 && logInfoDTO.getResult() == 0) {
|
if (severity == 2 && logInfoDTO.getResult() == 0) {
|
||||||
//publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
//publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.web.utils;
|
package com.njcn.web.utils;
|
||||||
|
|
||||||
import org.springframework.http.HttpEntity;
|
import org.slf4j.Logger;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.*;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@@ -15,8 +15,11 @@ import java.util.Map;
|
|||||||
* @createDate 2019-02-08
|
* @createDate 2019-02-08
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Component
|
||||||
public class RestTemplateUtil {
|
public class RestTemplateUtil {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RestTemplateUtil.class);
|
||||||
|
|
||||||
private static final RestTemplate restTemplate = new RestTemplate();
|
private static final RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
||||||
// ----------------------------------GET-------------------------------------------------------
|
// ----------------------------------GET-------------------------------------------------------
|
||||||
@@ -263,6 +266,24 @@ public class RestTemplateUtil {
|
|||||||
return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables);
|
return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T> ResponseEntity<T> post(String url, Object requestBody, HttpHeaders headers, Class<T> responseType) {
|
||||||
|
try {
|
||||||
|
if (headers == null) {
|
||||||
|
headers = new HttpHeaders();
|
||||||
|
}
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
|
||||||
|
HttpEntity<Object> entity = new HttpEntity<>(requestBody, headers);
|
||||||
|
log.info("发送POST请求到: {}", url);
|
||||||
|
ResponseEntity<T> response = restTemplate.postForEntity(url, entity, responseType);
|
||||||
|
log.info("POST请求响应状态: {}", response.getStatusCode());
|
||||||
|
return response;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("POST请求异常: {}", e.getMessage(), e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------PUT-------------------------------------------------------
|
// ----------------------------------PUT-------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
<artifactId>pqs-influx</artifactId>
|
<artifactId>pqs-influx</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ public interface CommTerminalGeneralClient {
|
|||||||
@PostMapping("deptGetLine")
|
@PostMapping("deptGetLine")
|
||||||
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
||||||
|
|
||||||
|
@PostMapping("deptGetLineInfo")
|
||||||
|
HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("deptGetAllLine")
|
||||||
|
HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(@RequestBody @Validated DeptGetLineParam deptGetLineParam);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据单位获取所有变电站
|
* 根据单位获取所有变电站
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.njcn.device.biz.utils.DeviceEnumUtil;
|
|||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -50,6 +51,19 @@ public class CommTerminalGeneralClientFallbackFactory implements FallbackFactory
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(DeptGetLineParam deptGetLineParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "根据部门获取监测点信息", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<DeptGetChildrenMoreDTO>> deptGetAllLine(DeptGetLineParam deptGetLineParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "根据单位获取all监测点信息", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<DeptGetSubStationDTO>> deptSubStation(DeptGetLineParam deptGetLineParam) {
|
public HttpResult<List<DeptGetSubStationDTO>> deptSubStation(DeptGetLineParam deptGetLineParam) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "根据单位获取所有变电站", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "根据单位获取所有变电站", throwable.toString());
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public enum DeviceResponseEnum {
|
|||||||
|
|
||||||
DEVICE_SAME_NAME("A0290","设备名称已存在"),
|
DEVICE_SAME_NAME("A0290","设备名称已存在"),
|
||||||
DEVICE_REPETITION("A0291","设备名称重复"),
|
DEVICE_REPETITION("A0291","设备名称重复"),
|
||||||
|
MODEL_NAME_REPEAT("A00350","名称不可重复"),
|
||||||
DEVICE_IP_REPETITION("A0292","设备ip端口号重复"),
|
DEVICE_IP_REPETITION("A0292","设备ip端口号重复"),
|
||||||
DEVICE_SAME_IP("A0293","当前设备ip端口号已存在"),
|
DEVICE_SAME_IP("A0293","当前设备ip端口号已存在"),
|
||||||
DEVICE_EMPTY("A0294","设备为空"),
|
DEVICE_EMPTY("A0294","设备为空"),
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.device.biz.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2022-01-04
|
||||||
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
|
@Mapper
|
||||||
|
public interface OverLimitWlMapper extends BaseMapper<Overlimit> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.device.biz.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2022-01-04
|
||||||
|
*/
|
||||||
|
public interface OverlimitMapper extends BaseMapper<Overlimit> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有在线投运的监测点限值
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/3/23
|
||||||
|
*/
|
||||||
|
List<Overlimit> getAllLineOverLimit(@Param("list") List<Integer> list);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.device.biz.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
public interface PqSensitiveUserMapper extends BaseMapper<PqSensitiveUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.device.biz.mapper.OverlimitMapper">
|
||||||
|
|
||||||
|
<select id="getAllLineOverLimit" resultType="com.njcn.device.biz.pojo.po.Overlimit">
|
||||||
|
select f.* from pq_line a
|
||||||
|
inner join pq_line_detail b on a.id = b.id
|
||||||
|
inner join pq_line c on a.pid = c.id
|
||||||
|
inner join pq_line d on c.pid = d.id
|
||||||
|
inner join pq_device e on d.id = e.id
|
||||||
|
inner join pq_overlimit f on a.id=f.id
|
||||||
|
where e.dev_data_type in
|
||||||
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
and e.run_flag = 0
|
||||||
|
and e.dev_model = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -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 = "电压等级")
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class LineDevGetDTO {
|
|||||||
|
|
||||||
private String pointName;
|
private String pointName;
|
||||||
|
|
||||||
|
private Integer lineRunFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置监测点索引集合
|
* 装置监测点索引集合
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.njcn.device.biz.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2026-01-06
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MonitorCommLedgerInfoDTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private String monitorId;
|
||||||
|
|
||||||
|
private String monitorName;
|
||||||
|
|
||||||
|
private String gdName;
|
||||||
|
|
||||||
|
private String bdName;
|
||||||
|
|
||||||
|
private String busBarName;
|
||||||
|
|
||||||
|
private String voltageLevel;
|
||||||
|
|
||||||
|
private String shortCapacity;
|
||||||
|
|
||||||
|
private String devCapacity;
|
||||||
|
|
||||||
|
private String dealCapacity;
|
||||||
|
|
||||||
|
private String standardCapacity;
|
||||||
|
|
||||||
|
private Integer timeInterval;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,8 @@ public class PollutionLineInfoDTO {
|
|||||||
/**
|
/**
|
||||||
* 所属变电站
|
* 所属变电站
|
||||||
*/
|
*/
|
||||||
|
private String subStationId;
|
||||||
|
|
||||||
private String subStationName;
|
private String subStationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +76,10 @@ public class PollutionLineInfoDTO {
|
|||||||
* 电压等级
|
* 电压等级
|
||||||
*/
|
*/
|
||||||
private String lineVoltage;
|
private String lineVoltage;
|
||||||
|
/**
|
||||||
|
* 变电站电压等级
|
||||||
|
*/
|
||||||
|
private String subVoltage;
|
||||||
/**
|
/**
|
||||||
* 装置id
|
* 装置id
|
||||||
*/
|
*/
|
||||||
@@ -94,4 +99,9 @@ public class PollutionLineInfoDTO {
|
|||||||
* 监测点名称
|
* 监测点名称
|
||||||
*/
|
*/
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实际安装位置
|
||||||
|
*/
|
||||||
|
private String actualArea;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public class DeptGetLineParam {
|
|||||||
private Boolean monitorStateRunning=true;
|
private Boolean monitorStateRunning=true;
|
||||||
|
|
||||||
@ApiModelProperty(name = "isUpToGrid",value = "0.非送国网 1.需要送国网的")
|
@ApiModelProperty(name = "isUpToGrid",value = "0.非送国网 1.需要送国网的")
|
||||||
|
|
||||||
private Integer isUpToGrid;
|
private Integer isUpToGrid;
|
||||||
/**
|
/**
|
||||||
* 0-电网侧
|
* 0-电网侧
|
||||||
@@ -48,4 +47,7 @@ public class DeptGetLineParam {
|
|||||||
@ApiModelProperty("监测点运行状态")
|
@ApiModelProperty("监测点运行状态")
|
||||||
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
|
@Range(min = 0, max = 2, message = "监测点运行状态" + ValidMessage.PARAM_FORMAT_ERROR)
|
||||||
private Integer lineRunFlag;
|
private Integer lineRunFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("搜索值")
|
||||||
|
private String searchValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -762,81 +762,6 @@ public class Overlimit implements Serializable {
|
|||||||
public Overlimit(){}
|
public Overlimit(){}
|
||||||
|
|
||||||
|
|
||||||
public Overlimit(String lineId, String scaTmp, float fDLRL, float fJZRL, float fXYRL, float fSBRL){
|
|
||||||
float[] fLimit = COverlimit.GetOverLimit(scaTmp, fDLRL, fJZRL, fXYRL, fSBRL);
|
|
||||||
this.id=lineId;
|
|
||||||
this.freqDev=fLimit[0];
|
|
||||||
this.voltageDev=fLimit[1];
|
|
||||||
this.ubalance=fLimit[2];
|
|
||||||
this.flicker=fLimit[3];
|
|
||||||
this.uaberrance=fLimit[4];
|
|
||||||
this.uharm2=fLimit[5];
|
|
||||||
this.uharm3=fLimit[6];
|
|
||||||
this.uharm4=fLimit[7];
|
|
||||||
this.uharm5=fLimit[8];
|
|
||||||
this.uharm6=fLimit[9];
|
|
||||||
this.uharm7=fLimit[10];
|
|
||||||
this.uharm8=fLimit[11];
|
|
||||||
this.uharm9=fLimit[12];
|
|
||||||
this.uharm10=fLimit[13];
|
|
||||||
this.uharm11=fLimit[14];
|
|
||||||
this.uharm12=fLimit[15];
|
|
||||||
this.uharm13=fLimit[16];
|
|
||||||
this.uharm14=fLimit[17];
|
|
||||||
this.uharm15=fLimit[18];
|
|
||||||
this.uharm16=fLimit[19];
|
|
||||||
this.uharm17=fLimit[20];
|
|
||||||
this.uharm18=fLimit[21];
|
|
||||||
this.uharm19=fLimit[22];
|
|
||||||
this.uharm20=fLimit[23];
|
|
||||||
this.uharm21=fLimit[24];
|
|
||||||
this.uharm22=fLimit[25];
|
|
||||||
this.uharm23=fLimit[26];
|
|
||||||
this.uharm24=fLimit[27];
|
|
||||||
this.uharm25=fLimit[28];
|
|
||||||
this.iharm2=fLimit[29];
|
|
||||||
this.iharm3=fLimit[30];
|
|
||||||
this.iharm4=fLimit[31];
|
|
||||||
this.iharm5=fLimit[32];
|
|
||||||
this.iharm6=fLimit[33];
|
|
||||||
this.iharm7=fLimit[34];
|
|
||||||
this.iharm8=fLimit[35];
|
|
||||||
this.iharm9=fLimit[36];
|
|
||||||
this.iharm10=fLimit[37];
|
|
||||||
this.iharm11=fLimit[38];
|
|
||||||
this.iharm12=fLimit[39];
|
|
||||||
this.iharm13=fLimit[40];
|
|
||||||
this.iharm14=fLimit[41];
|
|
||||||
this.iharm15=fLimit[42];
|
|
||||||
this.iharm16=fLimit[43];
|
|
||||||
this.iharm17=fLimit[44];
|
|
||||||
this.iharm18=fLimit[45];
|
|
||||||
this.iharm19=fLimit[46];
|
|
||||||
this.iharm20=fLimit[47];
|
|
||||||
this.iharm21=fLimit[48];
|
|
||||||
this.iharm22=fLimit[49];
|
|
||||||
this.iharm23=fLimit[50];
|
|
||||||
this.iharm24=fLimit[51];
|
|
||||||
this.iharm25=fLimit[52];
|
|
||||||
this.uvoltageDev=fLimit[53];
|
|
||||||
this.iNeg=fLimit[54];
|
|
||||||
this.inuharm1=fLimit[55];
|
|
||||||
this.inuharm2=fLimit[56];
|
|
||||||
this.inuharm3=fLimit[57];
|
|
||||||
this.inuharm4=fLimit[58];
|
|
||||||
this.inuharm5=fLimit[59];
|
|
||||||
this.inuharm6=fLimit[60];
|
|
||||||
this.inuharm7=fLimit[61];
|
|
||||||
this.inuharm8=fLimit[62];
|
|
||||||
this.inuharm9=fLimit[63];
|
|
||||||
this.inuharm10=fLimit[64];
|
|
||||||
this.inuharm11=fLimit[65];
|
|
||||||
this.inuharm12=fLimit[66];
|
|
||||||
this.inuharm13=fLimit[67];
|
|
||||||
this.inuharm14=fLimit[68];
|
|
||||||
this.inuharm15=fLimit[69];
|
|
||||||
this.inuharm16=fLimit[70];
|
|
||||||
}
|
|
||||||
|
|
||||||
public void buildIHarm(Float[] iHarmTem){
|
public void buildIHarm(Float[] iHarmTem){
|
||||||
this.iharm2= iHarmTem[0];
|
this.iharm2= iHarmTem[0];
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.njcn.device.biz.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2026-02-10
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("pq_sensitive_user")
|
||||||
|
public class PqSensitiveUser extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感负荷类型
|
||||||
|
*/
|
||||||
|
private String loadType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户协议容量
|
||||||
|
*/
|
||||||
|
private Double userAgreementCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装机容量
|
||||||
|
*/
|
||||||
|
private Double installedCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属厂站名称
|
||||||
|
*/
|
||||||
|
private String substationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -57,8 +57,8 @@ public class COverlimitUtil {
|
|||||||
//配网
|
//配网
|
||||||
Float[] iHarmTem = new Float[49];
|
Float[] iHarmTem = new Float[49];
|
||||||
for (int i = 0; i <= 48; i++) {
|
for (int i = 0; i <= 48; i++) {
|
||||||
|
//目前只处理了配网II类测点,III类测点暂未处理,III类测点参考主网
|
||||||
iHarmTem[i] = -3.14159f;
|
iHarmTem[i] = getHarmTag(i+2,voltageLevel).floatValue();
|
||||||
}
|
}
|
||||||
overlimit.buildIHarm(iHarmTem);
|
overlimit.buildIHarm(iHarmTem);
|
||||||
overlimit.setINeg(-3.14159f);
|
overlimit.setINeg(-3.14159f);
|
||||||
|
|||||||
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
|
|
||||||
@@ -7,10 +7,10 @@
|
|||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
monitor.Org_Id AS orgId,
|
monitor.Org_Id AS orgId,
|
||||||
monitor.Org_Name AS orgName,
|
monitor.Org_Name AS orgName,
|
||||||
monitor.`Powerr_Id` AS powerId,
|
monitor.Powerr_Id AS powerId,
|
||||||
monitor.`Powerr_Name` AS powerName,
|
monitor.Powerr_Name AS powerName,
|
||||||
monitor.id AS monitorId,
|
monitor.id AS monitorId,
|
||||||
monitor.`Name` AS monitorName,
|
monitor.Name AS monitorName,
|
||||||
monitor.Line_Id,
|
monitor.Line_Id,
|
||||||
monitor.Line_Name,
|
monitor.Line_Name,
|
||||||
pdm.Monitor_Sort AS monitorSort,
|
pdm.Monitor_Sort AS monitorSort,
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
pm.id,
|
pm.id,
|
||||||
pm.`Name`,
|
pm.Name,
|
||||||
pm.`Status`,
|
pm.Status,
|
||||||
pm.Org_Id,
|
pm.Org_Id,
|
||||||
pm.Org_Name,
|
pm.Org_Name,
|
||||||
pm.Powerr_Id,
|
pm.Powerr_Id,
|
||||||
@@ -51,8 +51,8 @@
|
|||||||
) AS monitor
|
) AS monitor
|
||||||
INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id
|
INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id
|
||||||
WHERE
|
WHERE
|
||||||
monitor.`Status` = 1
|
monitor.Status = 1
|
||||||
AND pdm.`Status` = 1
|
AND pdm.Status = 1
|
||||||
AND monitor.Org_Id IN
|
AND monitor.Org_Id IN
|
||||||
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
|
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
|
||||||
#{orgId}
|
#{orgId}
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
|
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
|
||||||
</if>
|
</if>
|
||||||
<if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''">
|
<if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''">
|
||||||
AND monitor.`Name` LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
|
AND monitor.Name LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<modules>
|
<modules>
|
||||||
<module>pq-device-api</module>
|
<module>pq-device-api</module>
|
||||||
<module>pq-device-boot</module>
|
<module>pq-device-boot</module>
|
||||||
|
<module>pq-device-com</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
|||||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -70,6 +70,16 @@ public interface GeneralDeviceInfoClient {
|
|||||||
HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
|
HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取变电站分类的所有终端综合信息
|
||||||
|
*
|
||||||
|
* @param deviceInfoParam 查询终端条件
|
||||||
|
* @return 获取变电站分类的所有终端综合信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getPracticalAllDeviceInfoAsSubstation")
|
||||||
|
HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(@RequestBody DeviceInfoParam deviceInfoParam);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取实际运行终端综合信息
|
* 获取实际运行终端综合信息
|
||||||
*
|
*
|
||||||
@@ -111,7 +121,7 @@ public interface GeneralDeviceInfoClient {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/getOnlineRateByDevIds")
|
@PostMapping("/getOnlineRateByDevIds")
|
||||||
HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
|
HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*根据单位获取投运监测点(双系统)
|
*根据单位获取投运监测点(双系统)
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package com.njcn.device.pq.api;
|
|||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
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.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 com.njcn.device.pq.api.fallback.DeviceTreeClientFallbackFactory;
|
import com.njcn.device.pq.api.fallback.DeviceTreeClientFallbackFactory;
|
||||||
import com.njcn.device.pq.api.fallback.LineIntegrityClientFallbackFactory;
|
import com.njcn.device.pq.api.fallback.LineIntegrityClientFallbackFactory;
|
||||||
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
|
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
|
||||||
@@ -11,6 +13,8 @@ import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
|||||||
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
||||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
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;
|
||||||
@@ -51,4 +55,7 @@ public interface LineIntegrityClient {
|
|||||||
|
|
||||||
@PostMapping("/lineDataQuality")
|
@PostMapping("/lineDataQuality")
|
||||||
HttpResult<List<LineDataQualityDTO>> getLineDataQuality(@RequestBody LineDataQualityParam lineDataQualityParam);
|
HttpResult<List<LineDataQualityDTO>> getLineDataQuality(@RequestBody LineDataQualityParam lineDataQualityParam);
|
||||||
|
|
||||||
|
@PostMapping("/noData")
|
||||||
|
HttpResult<List<OnlineMonitorVo>> getNoData(@RequestBody LineBaseQueryParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
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.dataVerifyCountFallbackFactory;
|
||||||
|
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.DEVICE, path = "/dataVerifyCount", fallbackFactory = dataVerifyCountFallbackFactory.class, contextId = "dataVerifyCount")
|
||||||
|
public interface PqDataVerifyCountClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取有异常数据的监测点相关信息
|
||||||
|
*/
|
||||||
|
@PostMapping("/getAnomalousData")
|
||||||
|
HttpResult<List<OnlineMonitorVo>> getAnomalousData(@RequestBody LineBaseQueryParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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) ;
|
||||||
|
}
|
||||||
@@ -3,9 +3,9 @@ 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.device.biz.utils.DeviceEnumUtil;
|
||||||
import com.njcn.device.pq.api.AlarmClient;
|
import com.njcn.device.pq.api.AlarmClient;
|
||||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -14,11 +14,12 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 告警管理熔断降级
|
* 告警管理熔断降级
|
||||||
|
*
|
||||||
* @author yzh
|
* @author yzh
|
||||||
* @date 2022/9/19
|
* @date 2022/9/19
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component("deviceAlarmClientFallbackFactory")
|
||||||
public class AlarmClientFallbackFactory implements FallbackFactory<AlarmClient> {
|
public class AlarmClientFallbackFactory implements FallbackFactory<AlarmClient> {
|
||||||
@Override
|
@Override
|
||||||
public AlarmClient create(Throwable throwable) {
|
public AlarmClient create(Throwable throwable) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
|||||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||||
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
import com.njcn.device.pq.pojo.po.TopMsgPO;
|
||||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
|
||||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -59,6 +59,12 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<GeneralDeviceDTO>> getPracticalAllDeviceInfoAsSubstation(DeviceInfoParam deviceInfoParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "获取变电站分类的所有终端综合信息", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfo(DeviceInfoParam deviceInfoParam) {
|
public HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfo(DeviceInfoParam deviceInfoParam) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "获取实际运行终端综合信息", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "获取实际运行终端综合信息", throwable.toString());
|
||||||
@@ -84,7 +90,7 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(OnlineRateParam param) {
|
public HttpResult<List<RStatOnlineRateVO>> getOnlineRateByDevIds(OnlineRateParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "获取终端在线率(谐波专用)", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "获取终端在线率(谐波专用)", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
|||||||
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
||||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -54,6 +55,12 @@ public class LineIntegrityClientFallbackFactory implements FallbackFactory<LineI
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<OnlineMonitorVo>> getNoData(LineBaseQueryParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "获取监测点数据完成性为0的数据", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.njcn.device.pq.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||||
|
import com.njcn.device.pq.api.PqDataVerifyCountClient;
|
||||||
|
import com.njcn.device.pq.api.PqDevTypeClient;
|
||||||
|
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||||
|
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||||
|
import com.njcn.device.pq.pojo.vo.OnlineMonitorVo;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class dataVerifyCountFallbackFactory implements FallbackFactory<PqDataVerifyCountClient> {
|
||||||
|
@Override
|
||||||
|
public PqDataVerifyCountClient create(Throwable throwable) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (throwable.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||||
|
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new PqDataVerifyCountClient()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<OnlineMonitorVo>> getAnomalousData(LineBaseQueryParam param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "获取有异常数据的监测点相关信息异常", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,7 +55,11 @@ public interface Param {
|
|||||||
//长时间闪变值
|
//长时间闪变值
|
||||||
String pst = "DataFlicker-pst";
|
String pst = "DataFlicker-pst";
|
||||||
|
|
||||||
|
//电压暂降
|
||||||
|
String Voltage_Dip = "r_mp_event_detail-Voltage_Dip";
|
||||||
|
//电压暂升
|
||||||
String Voltage_Rise = "r_mp_event_detail-Voltage_Rise";
|
String Voltage_Rise = "r_mp_event_detail-Voltage_Rise";
|
||||||
|
|
||||||
String pf = "DataHarmPowerP-pf";
|
String pf = "DataHarmPowerP-pf";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user