Compare commits
49 Commits
2025-12
...
8ccdb84ea9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
12
pom.xml
12
pom.xml
@@ -43,7 +43,7 @@
|
||||
<!-- <middle.server.url>10.95.53.49</middle.server.url>-->
|
||||
<middle.server.url>192.168.1.103</middle.server.url>
|
||||
<!--微服务模块发布地址-->
|
||||
<service.server.url>127.0.0.1</service.server.url>
|
||||
<service.server.url>192.168.2.130</service.server.url>
|
||||
<!--docker仓库地址-->
|
||||
<docker.server.url>192.168.1.22</docker.server.url>
|
||||
<!--nacos的ip:port-->
|
||||
@@ -53,9 +53,9 @@
|
||||
<!--nacos的ip:port-->
|
||||
<nacos.password>nacos</nacos.password>
|
||||
<!--服务器发布内容为空-->
|
||||
<!-- <nacos.namespace></nacos.namespace>-->
|
||||
<nacos.namespace>hswbpm</nacos.namespace>
|
||||
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
|
||||
<nacos.namespace>6fd2d036-f390-46ee-9c9d-d5a5c00e3314</nacos.namespace>
|
||||
<!-- <nacos.namespace>12b467cc-a7e6-411d-8944-090cbfa09dde</nacos.namespace>-->
|
||||
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>-->
|
||||
<!-- sentinel:port-->
|
||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||
@@ -81,6 +81,7 @@
|
||||
<springcloud.alibaba.version>2.2.7.RELEASE</springcloud.alibaba.version>
|
||||
<hutool.version>5.8.11</hutool.version>
|
||||
<knife4j.version>3.0.2</knife4j.version>
|
||||
<postgresql.version>42.3.8</postgresql.version>
|
||||
<knife4j.aggregation.version>2.0.8</knife4j.aggregation.version>
|
||||
<lombok.version>1.18.18</lombok.version>
|
||||
<mybatis.version>2.1.3</mybatis.version>
|
||||
@@ -171,6 +172,11 @@
|
||||
<artifactId>knife4j-spring-ui</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-aggregation-spring-boot-starter</artifactId>
|
||||
|
||||
@@ -75,9 +75,9 @@ public interface PatternRegex {
|
||||
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}$";
|
||||
|
||||
/**
|
||||
* 字典名称包括中文、数字、字母、罗马数字、括号以及点号
|
||||
|
||||
@@ -25,6 +25,12 @@ public class SimpleDTO implements Serializable {
|
||||
@ApiModelProperty(name = "value", value = "数值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 针对云南曲靖特殊处理的五层树标识符
|
||||
* 特殊在不显示供电公司,显示(变电站、线路)这两个是部门的名称+母线_监测点的名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer algoDescribe;
|
||||
|
||||
@@ -74,6 +74,12 @@
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--数据库相关********end-->
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BusinessDataUtil {
|
||||
List<List<Double>> unTolerateData = new ArrayList<>();
|
||||
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();
|
||||
if (list.get(1) > line) {
|
||||
unTolerateData.add(list);
|
||||
|
||||
@@ -34,24 +34,24 @@ public class NacosLogbackConfigLoader implements SpringApplicationRunListener, A
|
||||
|
||||
@Override
|
||||
public void environmentPrepared(ConfigurableEnvironment environment) {
|
||||
// String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||
// String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||
// String projectName = environment.getProperty("microservice.ename");
|
||||
// String logLevel = environment.getProperty("logging.level.root");
|
||||
// String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||
// HttpHeaders headers = new HttpHeaders();
|
||||
// headers.set("cndl408125hawen", "lanxia201");
|
||||
// HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||
// if (response.getStatusCode().is2xxSuccessful()) {
|
||||
// String logbackConfigContent = response.getBody();
|
||||
// //替换项目名称
|
||||
// logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||
// logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
||||
// // 应用获取到的Logback配置
|
||||
// applyLogbackConfig(logbackConfigContent);
|
||||
// }
|
||||
/* String serverAddr = environment.getProperty("spring.cloud.nacos.config.server-addr");
|
||||
String namespace = environment.getProperty("spring.cloud.nacos.config.namespace");
|
||||
String projectName = environment.getProperty("microservice.ename");
|
||||
String logLevel = environment.getProperty("logging.level.root");
|
||||
String url = String.format("http://%s/nacos/v1/cs/configs?tenant=%s&group=DEFAULT_GROUP&dataId=logback.xml", serverAddr, namespace);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("cndl408125hawen", "lanxia201");
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
|
||||
if (response.getStatusCode().is2xxSuccessful()) {
|
||||
String logbackConfigContent = response.getBody();
|
||||
//替换项目名称
|
||||
logbackConfigContent = logbackConfigContent.replace("projectDefaultName",projectName);
|
||||
logbackConfigContent = logbackConfigContent.replace("logDefaultLevel",logLevel);
|
||||
// 应用获取到的Logback配置
|
||||
applyLogbackConfig(logbackConfigContent);
|
||||
}*/
|
||||
}
|
||||
|
||||
private void applyLogbackConfig(String logbackConfigContent) {
|
||||
|
||||
@@ -48,6 +48,28 @@
|
||||
<artifactId>minioss-springboot-starter</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</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>
|
||||
|
||||
</project>
|
||||
@@ -13,6 +13,7 @@ public interface GeneralConstant {
|
||||
Integer LOCAL_DISK = 1;
|
||||
Integer HUAWEI_OBS = 2;
|
||||
Integer MINIO_OSS = 3;
|
||||
Integer AliYUN_OSS = 4;
|
||||
|
||||
/***
|
||||
* 波形文件的3种后缀
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.njcn.oss.utils;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.njcn.ali.oss.util.AliYunOssUtils;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.huawei.obs.util.OBSUtil;
|
||||
@@ -13,7 +13,6 @@ import com.njcn.oss.constant.GeneralConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.enums.OssResponseEnum;
|
||||
import io.minio.*;
|
||||
import io.minio.errors.*;
|
||||
import io.minio.messages.Item;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -66,6 +65,11 @@ public class FileStorageUtil {
|
||||
|
||||
private final MinIossProperties minIossProperties;
|
||||
|
||||
/**
|
||||
* 阿里云文件服务器
|
||||
*/
|
||||
private final AliYunOssUtils aliYunOssUtils;
|
||||
|
||||
|
||||
/***
|
||||
* 上传MultipartFile文件,
|
||||
@@ -79,7 +83,7 @@ public class FileStorageUtil {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
filePath = dir + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
||||
obsUtil.uploadMultipart(multipartFile, filePath);
|
||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||
try {
|
||||
//把名称存入数据
|
||||
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.upload(multipartFile, minIossProperties.getBucket(), dir);
|
||||
@@ -87,11 +91,15 @@ public class FileStorageUtil {
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||
}
|
||||
}else {
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
filePath = dir;
|
||||
aliYunOssUtils.uploadFile(dir, multipartFile);
|
||||
} else {
|
||||
try {
|
||||
// 构建完整目录:基准目录 + dir子目录
|
||||
Path basePath = Paths.get(generalInfo.getLocalStorePath());
|
||||
Path uploadPath = basePath.resolve(dir); // 将dir作为子目录添加
|
||||
// 将dir作为子目录添加
|
||||
Path uploadPath = basePath.resolve(dir);
|
||||
|
||||
// 确保完整目录存在(包括dir子目录)
|
||||
if (!Files.exists(uploadPath)) {
|
||||
@@ -135,6 +143,9 @@ public class FileStorageUtil {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
filePath = dir + minIoUtils.minFileName(multipartFile.getOriginalFilename());
|
||||
obsUtil.uploadMultipart(multipartFile, filePath);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
filePath = dir;
|
||||
aliYunOssUtils.uploadFile(dir, multipartFile);
|
||||
} else {
|
||||
try {
|
||||
//把名称存入数据
|
||||
@@ -160,7 +171,7 @@ public class FileStorageUtil {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
filePath = dir + minIoUtils.minFileName(fileName);
|
||||
obsUtil.uploadStream(inputStream, filePath);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||
try {
|
||||
//把名称存入数据
|
||||
MinIoUploadResDTO minIoUploadResDTO = minIoUtils.uploadStream(inputStream, minIossProperties.getBucket(), dir, minIoUtils.minFileName(fileName));
|
||||
@@ -168,14 +179,17 @@ public class FileStorageUtil {
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR);
|
||||
}
|
||||
}else {
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
filePath = dir + fileName;
|
||||
aliYunOssUtils.uploadFile(filePath, inputStream);
|
||||
} else {
|
||||
// 本地存储逻辑
|
||||
try {
|
||||
// 1. 获取本地存储路径
|
||||
String localStoragePath = generalInfo.getLocalStorePath();
|
||||
|
||||
// 2. 确保目录存在(如果不存在则创建)
|
||||
File targetDir = new File(localStoragePath +File.separator+ dir);
|
||||
File targetDir = new File(localStoragePath + File.separator + dir);
|
||||
if (!targetDir.exists()) {
|
||||
boolean created = targetDir.mkdirs();
|
||||
if (!created) {
|
||||
@@ -193,7 +207,7 @@ public class FileStorageUtil {
|
||||
// 5. 返回相对路径
|
||||
filePath = dir + finalFileName;
|
||||
} catch (IOException e) {
|
||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR,e.getMessage());
|
||||
throw new BusinessException(OssResponseEnum.UPLOAD_FILE_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
return filePath;
|
||||
@@ -209,6 +223,9 @@ public class FileStorageUtil {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
filePath = dir + minIoUtils.minFileName(fileName);
|
||||
obsUtil.uploadStream(inputStream, filePath);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
filePath = dir + fileName;
|
||||
aliYunOssUtils.uploadFile(filePath, inputStream);
|
||||
} else {
|
||||
try {
|
||||
//把名称存入数据
|
||||
@@ -232,6 +249,8 @@ public class FileStorageUtil {
|
||||
String url;
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
url = obsUtil.getFileUrl(filePath);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
url = aliYunOssUtils.generatePresignedUrl(filePath, 3600);
|
||||
} else {
|
||||
url = minIoUtils.getObjectUrl(minIossProperties.getBucket(), filePath, 7 * 24 * 60 * 60);
|
||||
}
|
||||
@@ -250,10 +269,12 @@ public class FileStorageUtil {
|
||||
try {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
inputStream = obsUtil.downloadStream(filePath);
|
||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||
inputStream = minIoUtils.downloadStream(minIossProperties.getBucket(), filePath);
|
||||
}else {
|
||||
Path path = Paths.get(generalInfo.getLocalStorePath()+File.separator+filePath);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
inputStream = aliYunOssUtils.downloadStream(filePath);
|
||||
} else {
|
||||
Path path = Paths.get(generalInfo.getLocalStorePath() + File.separator + filePath);
|
||||
inputStream = Files.newInputStream(path);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
@@ -274,11 +295,13 @@ public class FileStorageUtil {
|
||||
try {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
inputStream = obsUtil.downloadStream(filePath);
|
||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||
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);
|
||||
|
||||
// 设置下载文件名(从路径中提取)
|
||||
@@ -331,14 +354,16 @@ public class FileStorageUtil {
|
||||
public void deleteFile(String fileName) {
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
obsUtil.delete(fileName);
|
||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS){
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.MINIO_OSS) {
|
||||
minIoUtils.removeObject(minIossProperties.getBucket(), fileName);
|
||||
} else if(generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK){
|
||||
Path path = Paths.get(generalInfo.getLocalStorePath()+File.separator+fileName);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
aliYunOssUtils.deleteFile(fileName);
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||
Path path = Paths.get(generalInfo.getLocalStorePath() + File.separator + fileName);
|
||||
try {
|
||||
Files.delete(path);
|
||||
} catch (IOException e) {
|
||||
log.info("删除本地文件{}失败失败原因{}", path,e.getMessage());
|
||||
log.info("删除本地文件{}失败失败原因{}", path, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -409,9 +434,10 @@ public class FileStorageUtil {
|
||||
|
||||
file = File.createTempFile(lastItem.objectName(), "xlsx");
|
||||
FileUtil.writeFromStream(stream, file);
|
||||
}else if(generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS){
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.HUAWEI_OBS) {
|
||||
file = obsUtil.getLastFile(OssPath.LOGBAK);
|
||||
|
||||
} else if (generalInfo.getBusinessFileStorage() == GeneralConstant.AliYUN_OSS) {
|
||||
file = aliYunOssUtils.getLastFile(directory);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@ public class FeignConfig {
|
||||
@Bean
|
||||
public Decoder feignDecoder() {
|
||||
return (response, type) -> {
|
||||
|
||||
String bodyStr = Util.toString(response.body().asReader(Util.UTF_8));
|
||||
//对结果进行转换
|
||||
HttpResult<Object> result = PubUtils.json2obj(bodyStr, type);
|
||||
@@ -60,6 +61,8 @@ public class FeignConfig {
|
||||
}
|
||||
switch (commonResponseEnum) {
|
||||
case SUCCESS:
|
||||
// case NO_DATA:
|
||||
// case FAIL:
|
||||
return result;
|
||||
default:
|
||||
throw new BusinessException(result);
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface ValidMessage {
|
||||
|
||||
String NAME_NOT_BLANK = "名称不能为空,请检查name参数";
|
||||
|
||||
String NAME_FORMAT_ERROR = "名称格式错误,存在特殊符号或超过20字符,请检查name参数";
|
||||
String NAME_FORMAT_ERROR = "名称格式错误,存在特殊符号或超过32字符,请检查name参数";
|
||||
|
||||
String INDUSTRY_NOT_BLANK = "行业不能为空,请检查industry参数";
|
||||
String INDUSTRY_FORMAT_ERROR = "行业格式错误,请检查industry参数";
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.njcn.web.service.impl;
|
||||
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
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.dto.DeviceLogDTO;
|
||||
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.utils.PubUtils;
|
||||
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.service.ILogService;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -46,8 +46,15 @@ public class LogServiceImpl implements ILogService {
|
||||
|
||||
|
||||
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());
|
||||
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());
|
||||
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 (!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) {
|
||||
//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)) {
|
||||
String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType();
|
||||
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);
|
||||
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());
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -163,7 +190,11 @@ public class LogServiceImpl implements ILogService {
|
||||
Integer severity = levelStringToNumber(level);
|
||||
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());
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -171,7 +202,12 @@ public class LogServiceImpl implements ILogService {
|
||||
//推送审计消息功能
|
||||
if (severity != 0) {
|
||||
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) {
|
||||
//publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -51,6 +51,10 @@ public interface CommTerminalGeneralClient {
|
||||
@PostMapping("deptGetLine")
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
@@ -50,6 +51,13 @@ public class CommTerminalGeneralClientFallbackFactory implements FallbackFactory
|
||||
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());
|
||||
|
||||
@@ -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> {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.device.overlimit.mapper;
|
||||
package com.njcn.device.biz.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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.overlimit.mapper.OverlimitMapper">
|
||||
<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
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -762,81 +762,6 @@ public class Overlimit implements Serializable {
|
||||
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){
|
||||
this.iharm2= iHarmTem[0];
|
||||
|
||||
@@ -57,8 +57,8 @@ public class COverlimitUtil {
|
||||
//配网
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
|
||||
iHarmTem[i] = -3.14159f;
|
||||
//目前只处理了配网II类测点,III类测点暂未处理,III类测点参考主网
|
||||
iHarmTem[i] = getHarmTag(i+2,voltageLevel).floatValue();
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
overlimit.setINeg(-3.14159f);
|
||||
|
||||
@@ -42,6 +42,13 @@ public enum LineBaseEnum {
|
||||
POWER_FLAG_NOT(1,"非电网侧"),
|
||||
|
||||
|
||||
/**
|
||||
* 装置系统类型
|
||||
*/
|
||||
DEV_DATA_TYPE_ZT(0,"暂态系统装置"),
|
||||
DEV_DATA_TYPE_WT(1,"稳态系统装置"),
|
||||
DEV_DATA_TYPE_ALL(2,"全部系统装置")
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -136,6 +136,9 @@ public class AreaLineInfoVO implements Serializable {
|
||||
@ApiModelProperty(name = "objId",value = "对象id")
|
||||
private String objId;
|
||||
|
||||
@ApiModelProperty(name = "powerSubstationName", value = "电网侧变电站")
|
||||
private String powerSubstationName;
|
||||
|
||||
@ApiModelProperty(name = "vHarmonicValue",value = "污染值")
|
||||
private Double vHarmonicValue;
|
||||
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.njcn.device.pq.pojo.vo.dataClean;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/07/18 11:04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
public class DataVerifyExcel implements Serializable {
|
||||
|
||||
private String lineId;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "供电公司")
|
||||
@Excel(name = "供电公司")
|
||||
private String city;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "所属变电站")
|
||||
@Excel(name = "所属变电站")
|
||||
private String stationName;
|
||||
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "终端名称")
|
||||
@Excel(name = "终端名称")
|
||||
private String devName;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "监测点名称")
|
||||
@Excel(name = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "IP")
|
||||
@Excel(name = "IP")
|
||||
private String ip;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "干扰源类型")
|
||||
@Excel(name = "干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "监测对象名称")
|
||||
@Excel(name = "监测对象名称")
|
||||
private String objName;
|
||||
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电网侧变电站")
|
||||
@Excel(name = "电网侧变电站")
|
||||
private String powerSubstationName;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "厂商")
|
||||
@Excel(name = "厂商")
|
||||
private String manufacturer;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "总指标异常时间")
|
||||
@Excel(name = "总")
|
||||
private Integer allTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "频率")
|
||||
@Excel(name = "频率")
|
||||
private Integer freqTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "频率偏差")
|
||||
@Excel(name = "频率偏差")
|
||||
private Integer freqDevTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "相电压有效值")
|
||||
@Excel(name = "相电压有效值")
|
||||
private Integer vRmsTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "正序电压")
|
||||
@Excel(name = "正序电压")
|
||||
private Integer vPosTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "负序电压")
|
||||
@Excel(name = "负序电压")
|
||||
private Integer vNegTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "零序电压")
|
||||
@Excel(name = "零序电压")
|
||||
private Integer vZeroTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电压不平衡度")
|
||||
@Excel(name = "电压不平衡度")
|
||||
private Integer vUnbalanceTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "线电压有效值")
|
||||
@Excel(name = "线电压有效值")
|
||||
private Integer rmsLvrTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电压正偏差")
|
||||
@Excel(name = "电压正偏差")
|
||||
private Integer vuDevTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电压负偏差")
|
||||
@Excel(name = "电压负偏差")
|
||||
private Integer vlDevTime;
|
||||
|
||||
@ColumnWidth(25)
|
||||
@ExcelProperty(value = "电压总谐波畸变率")
|
||||
@Excel(name = "电压总谐波畸变率")
|
||||
private Integer vThdTime;
|
||||
|
||||
@ColumnWidth(25)
|
||||
@ExcelProperty(value = "相电压基波有效值")
|
||||
@Excel(name = "相电压基波有效值")
|
||||
private Integer vTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电流有效值")
|
||||
@Excel(name = "电流有效值")
|
||||
private Integer iRmsTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "长时闪变")
|
||||
@Excel(name = "长时闪变")
|
||||
private Integer pltTime;
|
||||
|
||||
@ColumnWidth(25)
|
||||
@ExcelProperty(value = "间谐波电压含有率")
|
||||
@Excel(name = "间谐波电压含有率")
|
||||
private Integer vInharmTime;
|
||||
|
||||
@ColumnWidth(25)
|
||||
@ExcelProperty(value = "谐波电压含有率")
|
||||
@Excel(name = "谐波电压含有率")
|
||||
private Integer vHarmTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "功率因数")
|
||||
@Excel(name = "功率因数")
|
||||
private Integer pfTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "谐波电压相角")
|
||||
@Excel(name = "谐波电压相角")
|
||||
private Integer vPhasicTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "谐波电压基波相角")
|
||||
@Excel(name = "谐波电压基波相角")
|
||||
private Integer v1PhasicTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电压波动")
|
||||
@Excel(name = "电压波动")
|
||||
private Integer flucTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "短时闪变")
|
||||
@Excel(name = "短时闪变")
|
||||
private Integer pstTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电压暂降")
|
||||
@Excel(name = "电压暂降")
|
||||
private Integer dipTime;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "电压暂升")
|
||||
@Excel(name = "电压暂升")
|
||||
private Integer riseTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqsDeviceUnitService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -108,6 +109,23 @@ public class CommTerminalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门监测点台账信息
|
||||
* @param deptGetLineParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("deptGetLineInfo")
|
||||
@ApiOperation("根据部门id获取部门监测点台账信息")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiImplicitParam(name = "deptGetLineParam", value = "请求体", required = true)
|
||||
public HttpResult<List<MonitorCommLedgerInfoDTO>> deptGetLineInfo(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
|
||||
String methodDescribe = getMethodDescribe("deptGetLineInfo");
|
||||
List<MonitorCommLedgerInfoDTO> result = commTerminalService.deptGetLineInfo(deptGetLineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("deptGetAllLine")
|
||||
@ApiOperation("根据单位获取监测点信息(all line)")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
|
||||
@@ -16,18 +16,18 @@ import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 异常数据功能
|
||||
* 异常数据功能
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
@@ -50,7 +50,7 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorVerifyData")
|
||||
@ApiOperation("异常-获取异常数据主页面")
|
||||
public HttpResult<VerifyMonitorVO> getMonitorVerifyData(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<VerifyMonitorVO> getMonitorVerifyData(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("getMonitorVerifyData");
|
||||
VerifyMonitorVO verifyMonitorVO = iPqDataVerifyBakService.getMonitorVerifyData(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, verifyMonitorVO, methodDescribe);
|
||||
@@ -59,7 +59,7 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorVerifyDay")
|
||||
@ApiOperation("异常-更新按钮-获取异常数据列表")
|
||||
public HttpResult<List<PowerQualityIndicatorsVO>> getMonitorVerifyDay(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<List<PowerQualityIndicatorsVO>> getMonitorVerifyDay(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("getMonitorVerifyDay");
|
||||
List<PowerQualityIndicatorsVO> list = iPqDataVerifyBakService.getMonitorVerifyDay(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
@@ -72,14 +72,13 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/monitorAbnormalTable")
|
||||
@ApiOperation("异常-弹框-获取异常监测点列表")
|
||||
public HttpResult<List<DetailAbnormalVO>> monitorAbnormalTable(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<List<DetailAbnormalVO>> monitorAbnormalTable(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("monitorAbnormalDetail");
|
||||
List<DetailAbnormalVO> page = iPqDataVerifyBakService.monitorAbnormalTable(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取稳态告警监测点相关信息
|
||||
*/
|
||||
@@ -93,14 +92,13 @@ public class DataVerifyController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取稳态告警数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorLimitData")
|
||||
@ApiOperation("获取稳态告警数据")
|
||||
public HttpResult<VerifyMonitorVO> getMonitorLimitData(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<VerifyMonitorVO> getMonitorLimitData(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("getMonitorLimitData");
|
||||
VerifyMonitorVO verifyMonitorVO = iDataVerifyService.getMonitorLimitData(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, verifyMonitorVO, methodDescribe);
|
||||
@@ -109,7 +107,7 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorLimitDataDay")
|
||||
@ApiOperation("更新按钮-获取稳态告警数据")
|
||||
public HttpResult<List<PowerQualityIndicatorsVO>> getMonitorLimitDataDay(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<List<PowerQualityIndicatorsVO>> getMonitorLimitDataDay(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("getMonitorLimitDataDay");
|
||||
List<PowerQualityIndicatorsVO> verifyMonitorVO = iDataVerifyService.getMonitorLimitDataDay(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, verifyMonitorVO, methodDescribe);
|
||||
@@ -121,7 +119,7 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/monitorLimitTable")
|
||||
@ApiOperation("弹框-获取稳态告警监测点列表")
|
||||
public HttpResult<List<DetailAbnormalVO>> monitorLimitTable(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<List<DetailAbnormalVO>> monitorLimitTable(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("monitorLimitTable");
|
||||
List<DetailAbnormalVO> list = iDataVerifyService.monitorLimitTable(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
@@ -134,7 +132,7 @@ public class DataVerifyController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/monitorLimitTableDetail")
|
||||
@ApiOperation("弹框-获取稳态告警监测点列表详情")
|
||||
public HttpResult<DetailAbnormalVO.DetailLimitCountVO> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
|
||||
public HttpResult<DetailAbnormalVO.DetailLimitCountVO> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam) {
|
||||
String methodDescribe = getMethodDescribe("monitorLimitTableDetail");
|
||||
DetailAbnormalVO.DetailLimitCountVO list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
@@ -150,5 +148,16 @@ public class DataVerifyController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/dataVerifyExcel")
|
||||
@ApiOperation(value = "导出异常监测点列表", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
iPqDataVerifyBakService.dataVerifyExcel(response, monitorBaseParam);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.DataVerifyExcel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +18,5 @@ import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
*/
|
||||
public interface PqDataVerifyBakMapper extends BaseMapper<PqDataVerifyBak> {
|
||||
|
||||
List<DataVerifyExcel> selectDataVerifySum(@Param("param") MonitorBaseParam monitorBaseParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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.pq.mapper.PqDataVerifyBakMapper">
|
||||
|
||||
<select id="selectDataVerifySum" resultType="com.njcn.device.pq.pojo.vo.dataClean.DataVerifyExcel">
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(select
|
||||
line_id AS lineId,
|
||||
(
|
||||
sum( freq_time ) +
|
||||
sum( freq_Dev_time ) +
|
||||
sum( v_Rms_time )+
|
||||
sum( v_Pos_time ) +
|
||||
sum( v_Neg_time )+
|
||||
sum( v_Zero_time )+
|
||||
sum( v_Unbalance_time )+
|
||||
sum( rms_Lvr_time ) +
|
||||
sum( vu_Dev_time ) +
|
||||
sum( vl_Dev_time ) +
|
||||
sum( v_Thd_time ) +
|
||||
sum( v_time ) +
|
||||
sum( i_Rms_time ) +
|
||||
sum( plt_time ) +
|
||||
sum( v_Inharm_time ) +
|
||||
sum( v_Harm_time )+
|
||||
sum( pf_time ) +
|
||||
sum( v_Phasic_time ) +
|
||||
sum( v1_Phasic_time ) +
|
||||
sum( fluc_time )+
|
||||
sum( pst_time ) +
|
||||
sum( dip_time ) +
|
||||
sum( rise_time )
|
||||
) allTime,
|
||||
sum( freq_time ) AS freqTime,
|
||||
sum( freq_Dev_time ) AS freqDevTime,
|
||||
sum( v_Rms_time ) AS vRmsTime,
|
||||
sum( v_Pos_time ) AS vPosTime,
|
||||
sum( v_Neg_time ) AS vNegTime,
|
||||
sum( v_Zero_time ) AS vZeroTime,
|
||||
sum( v_Unbalance_time ) AS vUnbalanceTime,
|
||||
sum( rms_Lvr_time ) AS rmsLvrTime,
|
||||
sum( vu_Dev_time ) AS vuDevTime,
|
||||
sum( vl_Dev_time ) AS vlDevTime,
|
||||
sum( v_Thd_time ) AS vThdTime,
|
||||
sum( v_time ) AS vTime,
|
||||
sum( i_Rms_time ) AS iRmsTime,
|
||||
sum( plt_time ) AS pltTime,
|
||||
sum( v_Inharm_time ) AS vInharmTime,
|
||||
sum( v_Harm_time ) AS vHarmTime,
|
||||
sum( pf_time ) AS pfTime,
|
||||
sum( v_Phasic_time ) AS vPhasicTime,
|
||||
sum( v1_Phasic_time ) AS v1PhasicTime,
|
||||
sum( fluc_time ) AS flucTime,
|
||||
sum( pst_time ) AS pstTime,
|
||||
sum( dip_time ) AS dipTime,
|
||||
sum( rise_time ) AS riseTime
|
||||
from
|
||||
pq_data_verify_bak
|
||||
<where>
|
||||
state = 1
|
||||
<if test="param.monitorIds != null and param.monitorIds.size > 0">
|
||||
AND line_id IN
|
||||
<foreach collection='param.monitorIds' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.searchBeginTime != null and param.searchBeginTime !=''">
|
||||
AND time_id >= #{param.searchBeginTime}
|
||||
</if>
|
||||
<if test="param.searchEndTime != null and param.searchEndTime != ''">
|
||||
AND time_id <= #{param.searchEndTime}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
GROUP BY line_id
|
||||
) a
|
||||
WHERE
|
||||
allTime >0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -3,8 +3,8 @@ package com.njcn.device.pq.service;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -40,6 +40,9 @@ public interface CommTerminalService {
|
||||
*/
|
||||
List<DeptGetChildrenMoreDTO> deptGetLine(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
|
||||
List<MonitorCommLedgerInfoDTO> deptGetLineInfo(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
List<DeptGetChildrenMoreDTO> deptGetAllLine(DeptGetLineParam deptGetLineParam);
|
||||
|
||||
List<LineDevGetDTO> deptGetLineByIdList(List<String> monitorIds);
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.njcn.device.pq.pojo.vo.dataClean.DetailAbnormalVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.PowerQualityIndicatorsVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.VerifyMonitorVO;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +32,6 @@ public interface IPqDataVerifyBakService extends IService<PqDataVerifyBak> {
|
||||
DetailAbnormalVO.DetailAbnormalCountVO monitorAbnormalTableDetail(MonitorBaseParam monitorBaseParam);
|
||||
|
||||
|
||||
|
||||
void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,10 @@ import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.device.biz.pojo.dto.*;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.line.mapper.DeptLineMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.pq.enums.RunFlagEnum;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
@@ -28,6 +29,8 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.device.pq.enums.LineBaseEnum.DEV_DATA_TYPE_ALL;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
@@ -49,6 +52,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
private final DeptLineMapper deptLineMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -59,10 +63,6 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
*/
|
||||
@Override
|
||||
public List<DeptGetBase> getDeptChildrenByParent(DeptGetLineParam deptGetLineParam) {
|
||||
/*List<DeptGetBase> redisResult = (List<DeptGetBase>) redisUtil.getObjectByKey(commTerminal + deptGetLineParam.getDeptId());
|
||||
if (CollectionUtil.isNotEmpty(redisResult)) {
|
||||
return redisResult;
|
||||
}*/
|
||||
List<DeptGetBase> result = new ArrayList<>();
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptGetLineParam.getDeptId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
deptDTOList.forEach(it -> {
|
||||
@@ -119,6 +119,13 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MonitorCommLedgerInfoDTO> deptGetLineInfo(DeptGetLineParam deptGetLineParam) {
|
||||
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(deptGetLineParam.getDeptId()).getData();
|
||||
List<MonitorCommLedgerInfoDTO> ledgerList = deptLineMapper.getMonitorByDeptIds(Stream.of(DEV_DATA_TYPE_ALL.getCode()).collect(Collectors.toList()),deptIds);
|
||||
return ledgerList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetChildrenMoreDTO> deptGetAllLine(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetChildrenMoreDTO> result = new ArrayList<>();
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONTokener;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -28,19 +29,19 @@ import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.DetailAbnormalVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.PowerQualityIndicatorsVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.VerifyMonitorVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.VerifyTargetVO;
|
||||
import com.njcn.device.pq.pojo.vo.dataClean.*;
|
||||
import com.njcn.device.pq.service.CommTerminalService;
|
||||
import com.njcn.device.pq.service.IPqDataVerifyBakService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -75,7 +76,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
@Override
|
||||
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
|
||||
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
|
||||
if (Objects.isNull(monitorBaseParam.getErrorTimeCount())) {
|
||||
monitorBaseParam.setErrorTimeCount(720);
|
||||
}
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
@@ -86,13 +87,13 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
verifyMonitorVO.setAbnormalNum(dataVerifyList.stream().collect(Collectors.groupingBy(PqDataVerifyBak::getLineId)).size());
|
||||
// List<PqDataVerifyBak> dataSumVerifyList = baseDataSumVerifyQuery(monitorIds, monitorBaseParam);
|
||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, dataVerifyList));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(dataVerifyList,monitorBaseParam.getErrorTimeCount()));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(dataVerifyList, monitorBaseParam.getErrorTimeCount()));
|
||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(dataVerifyList, monitorBaseParam));
|
||||
} else {
|
||||
verifyMonitorVO.setRunNum(0);
|
||||
verifyMonitorVO.setAbnormalNum(0);
|
||||
verifyMonitorVO.setMapList(getRangeAbnormalMonitor(monitorBaseParam, new ArrayList<>()));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>(),monitorBaseParam.getErrorTimeCount()));
|
||||
verifyMonitorVO.setTargetList(getAbnormalTarget(new ArrayList<>(), monitorBaseParam.getErrorTimeCount()));
|
||||
verifyMonitorVO.setMonitorAlarmInfo(getAbnormalTable(new ArrayList<>(), monitorBaseParam));
|
||||
}
|
||||
|
||||
@@ -152,7 +153,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
it.setMonitorName(lineDetail.getLineName());
|
||||
it.setStationName(lineDetail.getSubName());
|
||||
it.setDevName(lineDetail.getDeviceName());
|
||||
if(deptName.containsKey(lineDetail.getLineId())){
|
||||
if (deptName.containsKey(lineDetail.getLineId())) {
|
||||
it.setCity(deptName.get(lineDetail.getLineId()));
|
||||
}
|
||||
it.setVoltageLevel(lineDetail.getVoltageScale());
|
||||
@@ -183,7 +184,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
@Override
|
||||
public List<DetailAbnormalVO> monitorAbnormalTable(MonitorBaseParam monitorBaseParam) {
|
||||
if(Objects.isNull(monitorBaseParam.getErrorTimeCount())){
|
||||
if (Objects.isNull(monitorBaseParam.getErrorTimeCount())) {
|
||||
monitorBaseParam.setErrorTimeCount(720);
|
||||
}
|
||||
List<DetailAbnormalVO> result = new ArrayList<>();
|
||||
@@ -297,7 +298,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
for (PqDataVerifyBak pqDataVerifyBak : value) {
|
||||
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
|
||||
targetKey.setDate(pqDataVerifyBak.getTimeId().format(DatePattern.NORM_DATE_FORMATTER));
|
||||
targetKey.setTargetKeys(getAbnormalTarget(Arrays.asList(pqDataVerifyBak),monitorBaseParam.getErrorTimeCount()).stream().filter(x->x.getIds().size()>0).collect(Collectors.toList()));
|
||||
targetKey.setTargetKeys(getAbnormalTarget(Arrays.asList(pqDataVerifyBak), monitorBaseParam.getErrorTimeCount()).stream().filter(x -> x.getIds().size() > 0).collect(Collectors.toList()));
|
||||
targetKeyList.add(targetKey);
|
||||
}
|
||||
detailAbnormalVO.setDateTargetList(targetKeyList);
|
||||
@@ -331,11 +332,11 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) {
|
||||
try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) {
|
||||
JSONArray jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
jsonArray.forEach(it->{
|
||||
jsonArray.forEach(it -> {
|
||||
JSONObject targetJson = (JSONObject) it;
|
||||
if (targetJson.containsKey("lineErrorTimes")) {
|
||||
errorTimeCount[0] += Integer.valueOf(targetJson.get("lineErrorTimes").toString());
|
||||
}else{
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
|
||||
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
|
||||
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
|
||||
@@ -367,6 +368,40 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dataVerifyExcel(HttpServletResponse response, MonitorBaseParam monitorBaseParam) throws IOException {
|
||||
if (StrUtil.isNotBlank(monitorBaseParam.getDeptId())) {
|
||||
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
|
||||
monitorBaseParam.setMonitorIds(monitorIds);
|
||||
}
|
||||
List<DataVerifyExcel> dataVerifyExcels = this.baseMapper.selectDataVerifySum(monitorBaseParam);
|
||||
List<String> ids = dataVerifyExcels.stream().map(DataVerifyExcel::getLineId).collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaLineInfoVOList = lineMapper.getBaseLineAreaInfo(ids, null, null);
|
||||
Map<String, AreaLineInfoVO> map = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
||||
for (DataVerifyExcel dataVerifyExcel : dataVerifyExcels) {
|
||||
if (map.containsKey(dataVerifyExcel.getLineId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(dataVerifyExcel.getLineId());
|
||||
dataVerifyExcel.setCity(areaLineInfoVO.getGdName());
|
||||
dataVerifyExcel.setLineName(areaLineInfoVO.getLineName());
|
||||
dataVerifyExcel.setLoadType(areaLineInfoVO.getLoadType());
|
||||
dataVerifyExcel.setObjName(areaLineInfoVO.getObjName());
|
||||
dataVerifyExcel.setStationName(areaLineInfoVO.getSubName());
|
||||
dataVerifyExcel.setPowerSubstationName(areaLineInfoVO.getPowerSubstationName());
|
||||
dataVerifyExcel.setDevName(areaLineInfoVO.getDeviceName());
|
||||
dataVerifyExcel.setIp(areaLineInfoVO.getIp());
|
||||
dataVerifyExcel.setManufacturer(areaLineInfoVO.getManufacturer());
|
||||
}
|
||||
}
|
||||
Set<String> excludeColumnFiledNames = new HashSet<>(1);
|
||||
excludeColumnFiledNames.add("lineId");
|
||||
dataVerifyExcels.sort(Comparator.comparing((DataVerifyExcel item) -> item.getCity() + "_" + item.getStationName()+"_"+item.getDevName())
|
||||
.thenComparing(DataVerifyExcel::getAllTime, Comparator.reverseOrder())
|
||||
);
|
||||
EasyExcel.write(response.getOutputStream(), DataVerifyExcel.class)
|
||||
.excludeColumnFiledNames(excludeColumnFiledNames).sheet("sheet")
|
||||
.doWrite(dataVerifyExcels);
|
||||
}
|
||||
|
||||
|
||||
private static final Pattern HARMONIC_PATTERN = Pattern.compile("(\\d+)次谐波");
|
||||
|
||||
@@ -441,7 +476,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
// if ((DataCleanEnum.DataI.getCode() + SEPARATOR + DataCleanEnum.RmsI.getCode() ).equals(targetKey)) {
|
||||
// vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + "*CT1" + unit);
|
||||
// } else {
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
vo.setRangeDesc(pqReasonableRangeDto.getMinValue() + unit + " ~ " + pqReasonableRangeDto.getMaxValue() + unit);
|
||||
// }
|
||||
valueList.forEach(ites -> {
|
||||
switch (ites.getType()) {
|
||||
@@ -471,6 +506,9 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
|
||||
|
||||
private List<PqDataVerifyBak> baseDataVerifyQuery(List<String> monitorIds, MonitorBaseParam monitorBaseParam) {
|
||||
if (Objects.isNull(monitorBaseParam.getErrorTimeCount())) {
|
||||
monitorBaseParam.setErrorTimeCount(720);
|
||||
}
|
||||
LambdaQueryWrapper<PqDataVerifyBak> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(PqDataVerifyBak::getTimeId, DateUtil.beginOfDay(DateUtil.parse(monitorBaseParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(monitorBaseParam.getSearchEndTime())))
|
||||
.in(PqDataVerifyBak::getLineId, monitorIds)
|
||||
@@ -620,102 +658,102 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
/**
|
||||
* 指标异常测点数量
|
||||
*/
|
||||
public List<VerifyTargetVO> getAbnormalTarget(List<PqDataVerifyBak> dataVerifyList,Integer errorTimeCount) {
|
||||
public List<VerifyTargetVO> getAbnormalTarget(List<PqDataVerifyBak> dataVerifyList, Integer errorTimeCount) {
|
||||
List<VerifyTargetVO> result = new ArrayList<>();
|
||||
Map<String, PqReasonableRangeDto> rangeMap = getStandRange();
|
||||
rangeMap.forEach((key, dto) -> {
|
||||
Set<String> ids;
|
||||
switch (key) {
|
||||
case Param.freq:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFreqTime())).filter(it -> it.getFreqTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getFreqTime())).filter(it -> it.getFreqTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.freq_dev:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFreqDevTime())).filter(it -> it.getFreqDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getFreqDevTime())).filter(it -> it.getFreqDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.rms_v:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVRmsTime())).filter(it -> it.getVRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVRmsTime())).filter(it -> it.getVRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.rms_lvr:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getRmsLvrTime())).filter(it -> it.getRmsLvrTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getRmsLvrTime())).filter(it -> it.getRmsLvrTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.vu_dev:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVuDevTime())).filter(it -> it.getVuDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVuDevTime())).filter(it -> it.getVuDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.vl_dev:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVlDevTime())).filter(it -> it.getVlDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVlDevTime())).filter(it -> it.getVlDevTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.rms_i:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getIRmsTime())).filter(it -> it.getIRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getIRmsTime())).filter(it -> it.getIRmsTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_thd:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVThdTime())).filter(it -> it.getVThdTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVThdTime())).filter(it -> it.getVThdTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_1_v:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVTime())).filter(it -> it.getVTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVTime())).filter(it -> it.getVTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.phasic_v_1:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getV1PhasicTime())).filter(it -> it.getV1PhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getV1PhasicTime())).filter(it -> it.getV1PhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.phasic_rate_x:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVPhasicTime())).filter(it -> it.getVPhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVPhasicTime())).filter(it -> it.getVPhasicTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_rate:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVHarmTime())).filter(it -> it.getVHarmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVHarmTime())).filter(it -> it.getVHarmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.in_v_rate:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVInharmTime())).filter(it -> it.getVInharmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVInharmTime())).filter(it -> it.getVInharmTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_zero:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVZeroTime())).filter(it -> it.getVZeroTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVZeroTime())).filter(it -> it.getVZeroTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_neg:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVNegTime())).filter(it -> it.getVNegTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVNegTime())).filter(it -> it.getVNegTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_pos:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVPosTime())).filter(it -> it.getVPosTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVPosTime())).filter(it -> it.getVPosTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.v_unbalance:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getVUnbalanceTime())).filter(it -> it.getVUnbalanceTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getVUnbalanceTime())).filter(it -> it.getVUnbalanceTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.fluc:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getFlucTime())).filter(it -> it.getFlucTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getFlucTime())).filter(it -> it.getFlucTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.pst:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPstTime())).filter(it -> it.getPstTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getPstTime())).filter(it -> it.getPstTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.plt:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPltTime())).filter(it -> it.getPltTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getPltTime())).filter(it -> it.getPltTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.pf:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getPfTime())).filter(it -> it.getPfTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getPfTime())).filter(it -> it.getPfTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.Voltage_Dip:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getDipTime())).filter(it -> it.getDipTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getDipTime())).filter(it -> it.getDipTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
case Param.Voltage_Rise:
|
||||
ids = dataVerifyList.stream().filter(x-> ObjUtil.isNotNull(x.getRiseTime())).filter(it -> it.getRiseTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
ids = dataVerifyList.stream().filter(x -> ObjUtil.isNotNull(x.getRiseTime())).filter(it -> it.getRiseTime() > errorTimeCount).map(PqDataVerifyBak::getLineId).collect(Collectors.toSet());
|
||||
assembleEntity(ids, dto, result);
|
||||
break;
|
||||
default:
|
||||
@@ -744,7 +782,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
|
||||
// if (temStr.equals(Param.rms_i)) {
|
||||
// verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + "*CT1" + unit);
|
||||
// } else {
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + unit);
|
||||
verifyTargetVO.setRangeDesc(dto.getMinValue() + unit + " ~ " + dto.getMaxValue() + unit);
|
||||
// }
|
||||
result.add(verifyTargetVO);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
lineIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(lineIndexes)) {
|
||||
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||
resultList = deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(),Objects.isNull(runManageParam.getRunFlag())?new ArrayList<>():runManageParam.getRunFlag(), Objects.isNull(runManageParam.getSearchValue())?null:runManageParam.getSearchValue());
|
||||
if(CollUtil.isNotEmpty(resultList)){
|
||||
List<String> objIds = resultList.stream().map(RunManageVO::getObjId).collect(Collectors.toList());
|
||||
Map<String,NewUserReportVO> runManageVOMap = userLedgerFeignClient.getUserReportByIds(objIds).getData().stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
|
||||
|
||||
@@ -29,6 +29,8 @@ import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -52,6 +54,8 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final LineDetailMapper lineDetailMapper;
|
||||
|
||||
private final AreaFeignClient areaFeignClient;
|
||||
@@ -84,40 +88,40 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
//处理存在用户的台账
|
||||
List<TerminalTree> newLineList = lineMapper.getLineAndLineDetail();
|
||||
//用户侧测点
|
||||
List<TerminalTree> userLineList = newLineList.stream().filter(it->StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<TerminalTree> userLineList = newLineList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
|
||||
//用户侧装置
|
||||
List<String> devIds = userLineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.DEVICE_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||
List<TerminalTree> devUserList = devList.stream().filter(it->devIds.contains(it.getId())).collect(Collectors.toList());
|
||||
List<String> devIds = userLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.DEVICE_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||
List<TerminalTree> devUserList = devList.stream().filter(it -> devIds.contains(it.getId())).collect(Collectors.toList());
|
||||
|
||||
//用户侧线路
|
||||
List<TerminalTree> subvUserList = subvList.stream().filter(it->devIds.contains(it.getPid())).collect(Collectors.toList());
|
||||
List<TerminalTree> subvUserList = subvList.stream().filter(it -> devIds.contains(it.getPid())).collect(Collectors.toList());
|
||||
List<String> subvUserIds = subvUserList.stream().map(TerminalTree::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
//电网侧测点
|
||||
List<TerminalTree> otherLineList = newLineList.stream().filter(it->StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<String> devOtherIds = otherLineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.DEVICE_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||
List<TerminalTree> otherLineList = newLineList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<String> devOtherIds = otherLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.DEVICE_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||
|
||||
//电网侧装置
|
||||
List<TerminalTree> devOtherList = devList.stream().filter(it->devOtherIds.contains(it.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> noBindDevList = devList.stream().filter(it->!devOtherIds.contains(it.getId()) && !devIds.contains(it.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> devOtherList = devList.stream().filter(it -> devOtherIds.contains(it.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> noBindDevList = devList.stream().filter(it -> !devOtherIds.contains(it.getId()) && !devIds.contains(it.getId())).collect(Collectors.toList());
|
||||
devOtherList.addAll(noBindDevList);
|
||||
//电网侧线路
|
||||
List<TerminalTree> subvOtherList = subvList.stream().filter(it->devOtherIds.contains(it.getPid())).collect(Collectors.toList());
|
||||
List<TerminalTree> subvOtherList = subvList.stream().filter(it -> devOtherIds.contains(it.getPid())).collect(Collectors.toList());
|
||||
List<String> otherBusBarIds = subvOtherList.stream().map(TerminalTree::getId).distinct().collect(Collectors.toList());
|
||||
List<TerminalTree> noBindList = subvList.stream().filter(it->!subvUserIds.contains(it.getId()) && !otherBusBarIds.contains(it.getId())).collect(Collectors.toList());
|
||||
List<TerminalTree> noBindList = subvList.stream().filter(it -> !subvUserIds.contains(it.getId()) && !otherBusBarIds.contains(it.getId())).collect(Collectors.toList());
|
||||
subvOtherList.addAll(noBindList);
|
||||
|
||||
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
userReportPOList = userReportPOList.stream().filter(it->StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String,List<UserLedgerVO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserLedgerVO::getStationId));
|
||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String, List<UserLedgerVO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserLedgerVO::getStationId));
|
||||
|
||||
subvOtherList.forEach(subv -> subv.setChildren(getChildren(subv, otherLineList)));
|
||||
devOtherList.forEach(dev -> dev.setChildren(getChildren(dev, subvOtherList)));
|
||||
|
||||
subList.forEach(sub -> sub.setChildren(specialDealSubChildren(sub, userLineList,devOtherList,subvUserList,devUserList,userMap.get(sub.getId()))));
|
||||
subList.forEach(sub -> sub.setChildren(specialDealSubChildren(sub, userLineList, devOtherList, subvUserList, devUserList, userMap.get(sub.getId()))));
|
||||
//subList.forEach(sub -> sub.setChildren(getChildren(sub, devList)));
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
@@ -137,15 +141,15 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
}
|
||||
|
||||
|
||||
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){
|
||||
private List<TerminalTree> specialDealSubChildren(TerminalTree sub, List<TerminalTree> lineUserList, List<TerminalTree> devOtherList, List<TerminalTree> busBarList, List<TerminalTree> devAllList, List<UserLedgerVO> userReportPOList) {
|
||||
List<TerminalTree> list = new ArrayList<>();
|
||||
//电网侧
|
||||
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
|
||||
if(CollectionUtil.isNotEmpty(devTree)){
|
||||
List<TerminalTree> devTree = devOtherList.stream().filter(it -> it.getPid().equals(sub.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(devTree)) {
|
||||
list.addAll(devTree);
|
||||
}
|
||||
//非电网侧
|
||||
if(CollUtil.isNotEmpty(userReportPOList)) {
|
||||
if (CollUtil.isNotEmpty(userReportPOList)) {
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
List<TerminalTree> userLineList = lineUserList.stream().filter(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()].equals(sub.getId())).collect(Collectors.toList());
|
||||
@@ -190,7 +194,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
});
|
||||
|
||||
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
||||
if(Objects.isNull(userReportPO)){
|
||||
if (Objects.isNull(userReportPO)) {
|
||||
System.out.println(map);
|
||||
}
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
@@ -209,8 +213,6 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 5层树排除设备 母线监测点合并
|
||||
*
|
||||
@@ -226,78 +228,122 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
// 创建集合
|
||||
List<TerminalTree> taiZhang = new ArrayList<>();
|
||||
// 获取用户
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String, UserLedgerVO> userMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
// 遍历集合
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
// 创建实体类
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
// 判断监测点索引集合状态
|
||||
if (CollectionUtils.isEmpty(generalDeviceDTO.getLineIndexes())) {
|
||||
continue;
|
||||
}
|
||||
// 通过供电公司索引查询省会
|
||||
List<TerminalTree> proList = treeMapper.getProvinceList(generalDeviceDTO.getGdIndexes());
|
||||
// 通过供电公司索引查询供电公司信息
|
||||
List<TerminalTree> gdList = treeMapper.getGdList(generalDeviceDTO.getGdIndexes());
|
||||
// 通过供电站索引查询供电站信息
|
||||
List<TerminalTree> subList = treeMapper.getSubList(generalDeviceDTO.getSubIndexes());
|
||||
// 通过监测点索引查询监测点信息
|
||||
List<TerminalTree> lineList = treeMapper.getLineList(generalDeviceDTO.getLineIndexes());
|
||||
|
||||
List<TerminalTree> userLineList = lineList.stream().filter(it->StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<TerminalTree> otherLineList = lineList.stream().filter(it->StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
|
||||
Map<String,List<TerminalTree>> temMap = new HashMap<>();
|
||||
if(CollUtil.isNotEmpty(userLineList)) {
|
||||
Map<String, List<TerminalTree>> objMap = userLineList.stream().collect(Collectors.groupingBy(TerminalTree::getObjId));
|
||||
List<TerminalTree> temList = new ArrayList<>();
|
||||
objMap.forEach((objId, monitorList) -> {
|
||||
UserLedgerVO userLedgerVO = userMap.get(objId);
|
||||
TerminalTree tree = new TerminalTree();
|
||||
tree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||
tree.setPid(userLedgerVO.getStationId());
|
||||
tree.setId(userLedgerVO.getId());
|
||||
tree.setChildren(monitorList);
|
||||
int devSize = (int) monitorList.stream().map(x -> {
|
||||
// 获取父id字符串,通过 逗号 分割 成一个数组
|
||||
String[] pid = x.getPids().split(StrUtil.COMMA);
|
||||
return pid[LineBaseEnum.DEVICE_LEVEL.getCode()];
|
||||
}).distinct().count();
|
||||
tree.setName(userLedgerVO.getProjectName());
|
||||
//特殊处理,用户层级下面的装置数量临时存到pids字段。
|
||||
tree.setPids(String.valueOf(devSize));
|
||||
temList.add(tree);
|
||||
});
|
||||
temMap = temList.stream().collect(Collectors.groupingBy(TerminalTree::getPid));
|
||||
if (StrUtil.isNotBlank(deviceInfoParam.getStatisticalType().getDeptName())) {
|
||||
// 遍历集合
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
// 创建实体类
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setName(generalDeviceDTO.getName());
|
||||
terminalTree.setId(generalDeviceDTO.getIndex());
|
||||
terminalTree.setLevel(0);
|
||||
// 处理子部门
|
||||
deviceInfoParam.setDeptIndex(generalDeviceDTO.getIndex());
|
||||
List<GeneralDeviceDTO> generalDeviceDTOsubList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOsubList)) {
|
||||
List<TerminalTree> terminalTreeList = new ArrayList<>();
|
||||
for (int i = 0; i < generalDeviceDTOsubList.size(); i++) {
|
||||
GeneralDeviceDTO deviceDTO = generalDeviceDTOsubList.get(i);
|
||||
TerminalTree terminalSubTree = new TerminalTree();
|
||||
terminalSubTree.setName(deviceDTO.getName());
|
||||
terminalSubTree.setId(deviceDTO.getIndex());
|
||||
terminalSubTree.setPid(generalDeviceDTO.getIndex());
|
||||
terminalSubTree.setLevel(2);
|
||||
terminalSubTree.setSort(i);
|
||||
if(CollectionUtil.isNotEmpty(deviceDTO.getLineIndexes())){
|
||||
// 处理该部门下的检测点显示
|
||||
// 通过监测点索引查询监测点信息
|
||||
List<TerminalTree> lineList = treeMapper.getLineList(deviceDTO.getLineIndexes());
|
||||
terminalSubTree.setChildren(lineList);
|
||||
terminalTreeList.add(terminalSubTree);
|
||||
}
|
||||
}
|
||||
terminalTree.setChildren(terminalTreeList);
|
||||
} else {
|
||||
if(CollectionUtil.isNotEmpty(generalDeviceDTO.getLineIndexes())){
|
||||
// 处理该部门下的检测点显示
|
||||
// 通过监测点索引查询监测点信息
|
||||
List<TerminalTree> lineList = treeMapper.getLineList(generalDeviceDTO.getLineIndexes());
|
||||
terminalTree.setChildren(lineList);
|
||||
}
|
||||
}
|
||||
taiZhang.add(terminalTree);
|
||||
}
|
||||
|
||||
} else {
|
||||
// 获取用户
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
|
||||
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
|
||||
Map<String, UserLedgerVO> userMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
// 遍历集合
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
// 创建实体类
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
|
||||
// 判断监测点索引集合状态
|
||||
if (CollectionUtils.isEmpty(generalDeviceDTO.getLineIndexes())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 通过供电公司索引查询省会
|
||||
List<TerminalTree> proList = treeMapper.getProvinceList(generalDeviceDTO.getGdIndexes());
|
||||
// 通过供电公司索引查询供电公司信息
|
||||
List<TerminalTree> gdList = treeMapper.getGdList(generalDeviceDTO.getGdIndexes());
|
||||
// 通过供电站索引查询供电站信息
|
||||
List<TerminalTree> subList = treeMapper.getSubList(generalDeviceDTO.getSubIndexes());
|
||||
// 通过监测点索引查询监测点信息
|
||||
List<TerminalTree> lineList = treeMapper.getLineList(generalDeviceDTO.getLineIndexes());
|
||||
|
||||
List<TerminalTree> userLineList = lineList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<TerminalTree> otherLineList = lineList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
|
||||
Map<String, List<TerminalTree>> temMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(userLineList)) {
|
||||
Map<String, List<TerminalTree>> objMap = userLineList.stream().collect(Collectors.groupingBy(TerminalTree::getObjId));
|
||||
List<TerminalTree> temList = new ArrayList<>();
|
||||
objMap.forEach((objId, monitorList) -> {
|
||||
UserLedgerVO userLedgerVO = userMap.get(objId);
|
||||
TerminalTree tree = new TerminalTree();
|
||||
tree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||
tree.setPid(userLedgerVO.getStationId());
|
||||
tree.setId(userLedgerVO.getId());
|
||||
tree.setChildren(monitorList);
|
||||
int devSize = (int) monitorList.stream().map(x -> {
|
||||
// 获取父id字符串,通过 逗号 分割 成一个数组
|
||||
String[] pid = x.getPids().split(StrUtil.COMMA);
|
||||
return pid[LineBaseEnum.DEVICE_LEVEL.getCode()];
|
||||
}).distinct().count();
|
||||
tree.setName(userLedgerVO.getProjectName());
|
||||
//特殊处理,用户层级下面的装置数量临时存到pids字段。
|
||||
tree.setPids(String.valueOf(devSize));
|
||||
temList.add(tree);
|
||||
});
|
||||
temMap = temList.stream().collect(Collectors.groupingBy(TerminalTree::getPid));
|
||||
}
|
||||
|
||||
|
||||
//处理变电站
|
||||
dealChildrenData(subList, otherLineList, temMap,true);
|
||||
//处理变电站
|
||||
dealChildrenData(subList, otherLineList, temMap, true);
|
||||
|
||||
//监测点前面加序号,后面不需要删除下面两行就行
|
||||
//Integer[] arr = {1};
|
||||
//subList.forEach(item->item.getChildren().forEach(it->it.setName((arr[0]++ +"_"+it.getName()))));
|
||||
//处理供电公司
|
||||
dealChildrenData(gdList, subList, null,false);
|
||||
//监测点前面加序号,后面不需要删除下面两行就行
|
||||
//Integer[] arr = {1};
|
||||
//subList.forEach(item->item.getChildren().forEach(it->it.setName((arr[0]++ +"_"+it.getName()))));
|
||||
//处理供电公司
|
||||
dealChildrenData(gdList, subList, null, false);
|
||||
|
||||
if (deviceInfoParam.getStatisticalType().getCode().equalsIgnoreCase(StatisticsEnum.POWER_NETWORK.getCode())) {
|
||||
terminalTree.setChildren(gdList);
|
||||
} else {
|
||||
//还需要额外处理省会
|
||||
dealChildrenData(proList, gdList, null,false);
|
||||
terminalTree.setChildren(proList);
|
||||
if (deviceInfoParam.getStatisticalType().getCode().equalsIgnoreCase(StatisticsEnum.POWER_NETWORK.getCode())) {
|
||||
terminalTree.setChildren(gdList);
|
||||
} else {
|
||||
//还需要额外处理省会
|
||||
dealChildrenData(proList, gdList, null, false);
|
||||
terminalTree.setChildren(proList);
|
||||
}
|
||||
terminalTree.setId(generalDeviceDTO.getIndex());
|
||||
terminalTree.setName(generalDeviceDTO.getName());
|
||||
terminalTree.setLevel(0);
|
||||
taiZhang.add(terminalTree);
|
||||
}
|
||||
terminalTree.setId(generalDeviceDTO.getIndex());
|
||||
terminalTree.setName(generalDeviceDTO.getName());
|
||||
terminalTree.setLevel(0);
|
||||
taiZhang.add(terminalTree);
|
||||
}
|
||||
return taiZhang;
|
||||
} else {
|
||||
@@ -312,7 +358,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
* @param childrenData
|
||||
* @param isLine
|
||||
*/
|
||||
private void dealChildrenData(List<TerminalTree> targetData, List<TerminalTree> childrenData,Map<String,List<TerminalTree>> userLineMap, boolean isLine) {
|
||||
private void dealChildrenData(List<TerminalTree> targetData, List<TerminalTree> childrenData, Map<String, List<TerminalTree>> userLineMap, boolean isLine) {
|
||||
// 创建一个map集合,用于封装对象
|
||||
Map<String, List<TerminalTree>> groupLine;
|
||||
if (isLine) {
|
||||
@@ -328,7 +374,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
//变电站
|
||||
targetData.forEach(terminalTree -> {
|
||||
List<TerminalTree> terminalTrees = new ArrayList<>();
|
||||
if(groupLine.containsKey(terminalTree.getId())) {
|
||||
if (groupLine.containsKey(terminalTree.getId())) {
|
||||
terminalTrees.addAll(groupLine.get(terminalTree.getId()).stream().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()));
|
||||
}
|
||||
if (isLine) {
|
||||
@@ -340,13 +386,13 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
}).distinct().count();
|
||||
|
||||
int devSize = 0;
|
||||
if(userLineMap.containsKey(terminalTree.getId())){
|
||||
if (userLineMap.containsKey(terminalTree.getId())) {
|
||||
List<TerminalTree> userList = userLineMap.get(terminalTree.getId());
|
||||
devSize= (int) userList.stream().mapToDouble(it->Integer.parseInt(it.getPids())).sum();
|
||||
devSize = (int) userList.stream().mapToDouble(it -> Integer.parseInt(it.getPids())).sum();
|
||||
terminalTrees.addAll(userList);
|
||||
}
|
||||
int sumDev = size+devSize;
|
||||
terminalTree.setName(terminalTree.getName() + "(" +sumDev+ "台装置)");
|
||||
int sumDev = size + devSize;
|
||||
terminalTree.setName(terminalTree.getName() + "(" + sumDev + "台装置)");
|
||||
terminalTree.setChildren(terminalTrees);
|
||||
} else {
|
||||
terminalTree.setChildren(terminalTrees);
|
||||
@@ -392,7 +438,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
deviceInfoParam.setDeptIndex(RequestUtil.getDeptIndex());
|
||||
deviceInfoParam.setServerName(ServerEnum.HARMONIC.getName());
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0, 1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
if (CollectionUtil.isEmpty(generalDeviceDTO.getLineIndexes())) {
|
||||
@@ -472,89 +518,89 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
List<LineDetail> list = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().in(CollUtil.isNotEmpty(lineIds), LineDetail::getId, lineIds));
|
||||
Map<String, LineDetail> powerFlagMap = list.stream().collect(Collectors.toMap(LineDetail::getId, Function.identity()));
|
||||
for (TerminalTree x : lineList) {
|
||||
if(powerFlagMap.containsKey(x.getId())){
|
||||
if (powerFlagMap.containsKey(x.getId())) {
|
||||
x.setPowerFlag(powerFlagMap.get(x.getId()).getPowerFlag());
|
||||
x.setPowerSubstationName(powerFlagMap.get(x.getId()).getPowerSubstationName());
|
||||
x.setObjName(powerFlagMap.get(x.getId()).getObjName());
|
||||
}else{
|
||||
} else {
|
||||
x.setPowerFlag(LineBaseEnum.POWER_FLAG.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Map<String, List<TerminalTree>> lineObjNameMap = lineList.stream().filter(x -> StrUtil.isNotBlank(x.getPowerSubstationName())).collect(Collectors.groupingBy(TerminalTree::getPowerSubstationName));
|
||||
Map<String, List<TerminalTree>> lineObjNameMap = lineList.stream().filter(x -> StrUtil.isNotBlank(x.getPowerSubstationName())).collect(Collectors.groupingBy(TerminalTree::getPowerSubstationName));
|
||||
//组织变电站信息
|
||||
List<TerminalTree> subInfoList = new ArrayList<>();
|
||||
List<TerminalTree> subInfoList = new ArrayList<>();
|
||||
|
||||
lineObjNameMap.forEach((key, value)->{
|
||||
lineObjNameMap.forEach((key, value) -> {
|
||||
List<TerminalTree> terminalTrees = Collections.unmodifiableList(collect1);
|
||||
//获取变电信息
|
||||
List<TerminalTree> collect = subList.stream().filter(x -> x.getName().equals(key.replace("±",""))).collect(Collectors.toList());
|
||||
List<TerminalTree> collect = subList.stream().filter(x -> x.getName().equals(key.replace("±", ""))).collect(Collectors.toList());
|
||||
//电网侧监测点
|
||||
List<TerminalTree> powerFlag = value.stream().filter(x -> x.getPowerFlag().equals(LineBaseEnum.POWER_FLAG.getCode())).collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(powerFlag)){
|
||||
if (CollUtil.isEmpty(powerFlag)) {
|
||||
//解决变电站下没有监测点显示问题(变电站-》终端-》母线)
|
||||
powerFlag.addAll(collect);
|
||||
}
|
||||
List<TerminalTree> subChildren = new ArrayList<>();
|
||||
TerminalTree recursion = getRecursionChildren(powerFlag, terminalTrees);
|
||||
if(ObjectUtil.isNotNull(recursion)){
|
||||
if (ObjectUtil.isNotNull(recursion)) {
|
||||
subChildren.add(recursion);
|
||||
}
|
||||
//非电网侧监测点
|
||||
List<TerminalTree> powerFlagNot = value.stream().filter(x -> x.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())).collect(Collectors.toList());
|
||||
List<TerminalTree> notSubChildren = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(powerFlagNot)){
|
||||
if (CollUtil.isNotEmpty(powerFlagNot)) {
|
||||
Map<String, List<TerminalTree>> objNameMap = powerFlagNot.stream().collect(Collectors.groupingBy(TerminalTree::getObjName));
|
||||
objNameMap.forEach((objNameKey,objNameValue)->{
|
||||
objNameMap.forEach((objNameKey, objNameValue) -> {
|
||||
TerminalTree recursionChildren = getRecursionChildren(objNameValue, terminalTrees);
|
||||
if(ObjectUtil.isNotNull(recursionChildren)){
|
||||
if (ObjectUtil.isNotNull(recursionChildren)) {
|
||||
recursionChildren.setName(objNameKey);
|
||||
notSubChildren.add(recursionChildren);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
TerminalTree sub=new TerminalTree();
|
||||
TerminalTree sub = new TerminalTree();
|
||||
sub.setId(collect.get(0).getId());
|
||||
sub.setName(collect.get(0).getName());
|
||||
sub.setPid(collect.get(0).getPid());
|
||||
sub.setSort(0);
|
||||
sub.setChildren(valueList);
|
||||
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
TerminalTree powerTree = new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(collect.get(0).getId());
|
||||
powerTree.setChildren(subChildren);
|
||||
valueList.add(powerTree);
|
||||
|
||||
|
||||
TerminalTree notPowerTree=new TerminalTree();
|
||||
TerminalTree notPowerTree = new TerminalTree();
|
||||
notPowerTree.setName("非电网侧");
|
||||
notPowerTree.setChildren(notSubChildren);
|
||||
valueList.add(notPowerTree);
|
||||
subInfoList.add(sub);
|
||||
}else{
|
||||
} else {
|
||||
//电网侧变电站能否找到
|
||||
for (TerminalTree child : subChildren) {
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
List<TerminalTree> exist = subInfoList.stream().filter(x -> x.getId().equals(child.getId())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(exist)){
|
||||
if (CollUtil.isNotEmpty(exist)) {
|
||||
//电网侧
|
||||
List<TerminalTree> children =new ArrayList<>();
|
||||
List<TerminalTree> children = new ArrayList<>();
|
||||
children.addAll(exist.get(0).getChildren().get(0).getChildren());
|
||||
children.add(child);
|
||||
exist.get(0).getChildren().get(0).setChildren(children);
|
||||
}else{
|
||||
TerminalTree sub=new TerminalTree();
|
||||
} else {
|
||||
TerminalTree sub = new TerminalTree();
|
||||
sub.setId(child.getId());
|
||||
sub.setName(child.getName());
|
||||
sub.setPid(child.getPid());
|
||||
sub.setSort(0);
|
||||
TerminalTree powerTree=new TerminalTree();
|
||||
TerminalTree powerTree = new TerminalTree();
|
||||
powerTree.setName("电网侧");
|
||||
powerTree.setId(child.getId());
|
||||
powerTree.setChildren(Arrays.asList(child));
|
||||
@@ -574,7 +620,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
List<TerminalTree> exist = subInfoList.stream().filter(x -> x.getId().equals(child.getId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(exist)) {
|
||||
//非电网侧
|
||||
List<TerminalTree> children =new ArrayList<>();
|
||||
List<TerminalTree> children = new ArrayList<>();
|
||||
children.addAll(exist.get(0).getChildren().get(1).getChildren());
|
||||
children.add(child);
|
||||
exist.get(0).getChildren().get(1).setChildren(children);
|
||||
@@ -615,7 +661,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
for (TerminalTree notSub : collect) {
|
||||
//只显示变电站下有装置的
|
||||
TerminalTree notSub1 = findParents(collect1, notSub);
|
||||
if(CollUtil.isNotEmpty(notSub1.getChildren())){
|
||||
if (CollUtil.isNotEmpty(notSub1.getChildren())) {
|
||||
List<TerminalTree> valueList = new ArrayList<>();
|
||||
|
||||
TerminalTree sub = new TerminalTree();
|
||||
@@ -638,7 +684,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
subInfoList.add(sub);
|
||||
dw.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subInfoList)));
|
||||
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
|
||||
@@ -668,28 +714,26 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
List<TerminalTree> devList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
List<TerminalTree> linepowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() != 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> lineNotPowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())&&item.getPowerFlag() == 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> linepowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()) && item.getPowerFlag() != 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> lineNotPowerList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()) && item.getPowerFlag() == 1).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
subvList.forEach(subv ->{
|
||||
if(CollUtil.isEmpty(subv.getChildren())){
|
||||
subvList.forEach(subv -> {
|
||||
if (CollUtil.isEmpty(subv.getChildren())) {
|
||||
subv.setChildren(getRecursionChildren(subv, linepowerList));
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
subvList.forEach(subv -> {
|
||||
if(CollUtil.isEmpty(subv.getChildren())){
|
||||
if (CollUtil.isEmpty(subv.getChildren())) {
|
||||
subv.setChildren(getRecursionChildren(subv, lineNotPowerList));
|
||||
}
|
||||
}
|
||||
);
|
||||
subvList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
|
||||
subvList.stream().filter(x -> ObjUtil.isNull(x.getPowerFlag())).forEach(x -> x.setPowerFlag(0));
|
||||
devList.forEach(dev -> dev.setChildren(getRecursionChildren(dev, subvList)));
|
||||
devList.stream().filter(x-> ObjUtil.isNull(x.getPowerFlag())).forEach(x->x.setPowerFlag(0));
|
||||
|
||||
devList.stream().filter(x -> ObjUtil.isNull(x.getPowerFlag())).forEach(x -> x.setPowerFlag(0));
|
||||
|
||||
|
||||
subList.forEach(sub -> sub.setChildren(getRecursionChildrenCs(sub, devList)));
|
||||
@@ -709,36 +753,36 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
*/
|
||||
public List<TerminalTree> getChildren(TerminalTree item, List<TerminalTree> all) {
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
long sortSize = collect.stream().filter(x->ObjUtil.isNotNull(x.getSort())).filter(x -> x.getSort() == 0).count();
|
||||
if(collect.size()-sortSize/collect.size()>50){
|
||||
collect.sort(Comparator.comparing(x->x.getName()));
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
long sortSize = collect.stream().filter(x -> ObjUtil.isNotNull(x.getSort())).filter(x -> x.getSort() == 0).count();
|
||||
if (collect.size() - sortSize / collect.size() > 50) {
|
||||
collect.sort(Comparator.comparing(x -> x.getName()));
|
||||
}
|
||||
}
|
||||
return collect;
|
||||
}
|
||||
|
||||
public List<TerminalTree> getRecursionChildrenCs(TerminalTree item, List<TerminalTree> all){
|
||||
public List<TerminalTree> getRecursionChildrenCs(TerminalTree item, List<TerminalTree> all) {
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> list=new ArrayList<>();
|
||||
TerminalTree power=new TerminalTree();
|
||||
List<TerminalTree> list = new ArrayList<>();
|
||||
TerminalTree power = new TerminalTree();
|
||||
power.setName("电网侧");
|
||||
power.setSort(0);
|
||||
power.setChildren(collect.stream().filter(x -> 1 != x.getPowerFlag()).collect(Collectors.toList()));
|
||||
list.add(power);
|
||||
|
||||
|
||||
|
||||
TerminalTree notPower=new TerminalTree();
|
||||
TerminalTree notPower = new TerminalTree();
|
||||
notPower.setName("非电网侧");
|
||||
notPower.setSort(1);
|
||||
notPower.setChildren(collect.stream().filter(x -> 1 == x.getPowerFlag()).collect(Collectors.toList()));
|
||||
list.add(notPower);
|
||||
return list;
|
||||
}
|
||||
public List<TerminalTree> getRecursionChildren(TerminalTree item, List<TerminalTree> all){
|
||||
|
||||
public List<TerminalTree> getRecursionChildren(TerminalTree item, List<TerminalTree> all) {
|
||||
List<TerminalTree> list = all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
item.setPowerFlag(list.get(0).getPowerFlag());
|
||||
}
|
||||
return list;
|
||||
@@ -746,31 +790,32 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
|
||||
/**
|
||||
* 变电站层级增加电网侧和非电网侧电站
|
||||
*
|
||||
* @param line 变电站对象
|
||||
* @param all 检测对象
|
||||
* @param all 检测对象
|
||||
* @return
|
||||
*/
|
||||
public TerminalTree getRecursionChildren(List<TerminalTree> line, List<TerminalTree> all) {
|
||||
List<TerminalTree> aa=new ArrayList<>();
|
||||
List<TerminalTree> aa = new ArrayList<>();
|
||||
for (TerminalTree lineTree : line) {
|
||||
findParentsRecursive(lineTree, all,aa);
|
||||
findParentsRecursive(lineTree, all, aa);
|
||||
aa.add(lineTree);
|
||||
}
|
||||
List<TerminalTree> distinctList =new ArrayList<>(aa.stream().distinct().collect(Collectors.toList()));
|
||||
List<TerminalTree> distinctList = new ArrayList<>(aa.stream().distinct().collect(Collectors.toList()));
|
||||
long count = line.stream().filter(x -> !x.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).count();
|
||||
if(count>0){
|
||||
if (count > 0) {
|
||||
aa.addAll(all);
|
||||
}
|
||||
List<TerminalTree> lines = aa.stream().distinct().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
|
||||
List<TerminalTree> collect = distinctList.stream().filter(x -> x.getLevel() == LineBaseEnum.SUB_LEVEL.getCode()).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(collect)){
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
TerminalTree terminalTree = BeanUtil.copyProperties(collect.get(0), TerminalTree.class);
|
||||
return findParents(lines,terminalTree);
|
||||
return findParents(lines, terminalTree);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void findParentsRecursive(TerminalTree tree, List<TerminalTree> all,List<TerminalTree> newParents) {
|
||||
private static void findParentsRecursive(TerminalTree tree, List<TerminalTree> all, List<TerminalTree> newParents) {
|
||||
if (tree.getLevel() == LineBaseEnum.SUB_LEVEL.getCode()) {
|
||||
return;
|
||||
}
|
||||
@@ -783,12 +828,12 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
}
|
||||
}
|
||||
|
||||
private TerminalTree findParents(List<TerminalTree> all,TerminalTree subTree) {
|
||||
private TerminalTree findParents(List<TerminalTree> all, TerminalTree subTree) {
|
||||
List<TerminalTree> collect = all.stream().filter(allItem -> allItem.getPid().equals(subTree.getId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
collect.forEach(treeMap -> {
|
||||
subTree.setChildren(collect);
|
||||
findParents( all,treeMap);
|
||||
findParents(all, treeMap);
|
||||
});
|
||||
}
|
||||
return subTree;
|
||||
|
||||
@@ -369,7 +369,7 @@ public class GeneralDeviceService {
|
||||
StatisticsEnum statisticsEnum = StatisticsEnum.getStatisticsEnumByCode(deviceInfoParam.getStatisticalType().getCode());
|
||||
switch (statisticsEnum) {
|
||||
case VOLTAGE_LEVEL:
|
||||
return filterDataByScale(deviceInfos, deviceInfoParam.getScale());
|
||||
return filterDataByScale(deviceInfos, deviceInfoParam.getScale(),deviceInfoParam.getLineOrDevice());
|
||||
case LOAD_TYPE:
|
||||
return filterDataByLoadType(deviceInfos, deviceInfoParam.getLoadType());
|
||||
case MANUFACTURER:
|
||||
@@ -474,11 +474,12 @@ public class GeneralDeviceService {
|
||||
generalDeviceDTO.setLineIndexes(lineIndexes.stream().distinct().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private List<GeneralDeviceDTO> filterDataByScale(List<GeneralDeviceDTO> deviceInfos, List<SimpleDTO> scales) {
|
||||
private List<GeneralDeviceDTO> filterDataByScale(List<GeneralDeviceDTO> deviceInfos, List<SimpleDTO> scales,Integer type) {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOS = new ArrayList<>();
|
||||
List<String> subIds = new ArrayList<>(), lineIds = new ArrayList<>();
|
||||
List<String> subIds = new ArrayList<>(), subVIds = new ArrayList<>(),lineIds = new ArrayList<>();
|
||||
for (GeneralDeviceDTO generalDeviceDTO : deviceInfos) {
|
||||
subIds.addAll(generalDeviceDTO.getSubIndexes());
|
||||
subVIds.addAll(generalDeviceDTO.getVoltageIndexes());
|
||||
lineIds.addAll(generalDeviceDTO.getLineIndexes());
|
||||
}
|
||||
//如果电压等级集合为空,则查询所有的电压等级
|
||||
@@ -496,8 +497,13 @@ public class GeneralDeviceService {
|
||||
}
|
||||
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
||||
for (SimpleDTO simpleDTO : scales) {
|
||||
List<String> voltageScaleIds = terminalBaseService.getSubIdByScale(subIds, simpleDTO.getId());
|
||||
generalDeviceDTOS.add(assembleDataByLine(simpleDTO, lines, voltageScaleIds, LineBaseEnum.SUB_LEVEL.getCode()));
|
||||
if(ObjectUtil.isNull(type)){
|
||||
List<String> voltageScaleIds = terminalBaseService.getSubIdByScale(subIds, simpleDTO.getId());
|
||||
generalDeviceDTOS.add(assembleDataByLine(simpleDTO, lines, voltageScaleIds, LineBaseEnum.SUB_LEVEL.getCode()));
|
||||
}else{
|
||||
List<String> voltageScaleIds = terminalBaseService.getVoltageIdByScale(subVIds, simpleDTO.getId());
|
||||
generalDeviceDTOS.add(assembleDataByLine(simpleDTO, lines, voltageScaleIds, LineBaseEnum.SUB_V_LEVEL.getCode()));
|
||||
}
|
||||
}
|
||||
return generalDeviceDTOS;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.LineBakService;
|
||||
import com.njcn.device.node.service.INodeService;
|
||||
import com.njcn.device.overlimit.mapper.OverlimitMapper;
|
||||
import com.njcn.device.biz.mapper.OverlimitMapper;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
|
||||
@@ -96,6 +96,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -3698,305 +3699,339 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList = new ArrayList<>();
|
||||
List<String> addAndDelteId = new ArrayList<>();
|
||||
//异常标志
|
||||
Boolean exFlag= false;
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
//前置层修改
|
||||
List<PqsTerminalLogs> list1 = list.stream().filter(temp -> temp.getTerminalDescribe().contains("终端所属前置机由")).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(list1)) {
|
||||
for (PqsTerminalLogs temp : list1) {
|
||||
String temLos = "%s终端所属前置机由 %s 改为> %s;";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String node1 = strings.get(1); // 第一个前置
|
||||
String node2 = strings.get(2); // 第二个前置
|
||||
if (deviceProcesseMap.containsKey(temp.getObjIndex())) {
|
||||
Integer processNum = deviceProcesseMap.get(temp.getObjIndex());
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = new PqsTerminalPushLogDTO();
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.containsKey(deviceId) ? lineMap.get(deviceId).getName() : "删除设备");
|
||||
pqsTerminalPushLogDTO.setNodeId(node1);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(node1).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO.setProcessNum(processNum);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO2 = new PqsTerminalPushLogDTO();
|
||||
pqsTerminalPushLogDTO2.setId(temp.getId());
|
||||
pqsTerminalPushLogDTO2.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO2.setDevName(lineMap.containsKey(deviceId) ? lineMap.get(deviceId).getName() : "删除设备");
|
||||
pqsTerminalPushLogDTO2.setNodeId(node2);
|
||||
pqsTerminalPushLogDTO2.setNodeName(nodeMap.get(node2).getName());
|
||||
pqsTerminalPushLogDTO2.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO2.setProcessNum(processNum);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list.removeAll(list1);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
//终端层面和检测点层面修改
|
||||
list.forEach(temp -> {
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = new PqsTerminalPushLogDTO();
|
||||
if (Objects.equals(temp.getTerminalType(), 6)) {
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId;
|
||||
//如果不存在该设备id,说明监测点删除
|
||||
if (!lineDeviceMap.containsKey(temp.getObjIndex())) {
|
||||
String temLos = "%s监测点名称: %s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String[] lineName = strings.get(1).split("->");
|
||||
List<Line> devList = lineById.stream().filter(line -> Objects.equals(line.getName(), lineName[1])).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(devList)) {
|
||||
//如果不存在该设备说明设备也被删除,直接走下边删除设备逻辑;
|
||||
return;
|
||||
} else {
|
||||
Line sub = lineById.stream().filter(line -> Objects.equals(line.getName(), lineName[0])).collect(Collectors.toList()).get(0);
|
||||
Line tempDev = devList.stream().filter(dev -> dev.getPid().equals(sub.getId())).collect(Collectors.toList()).get(0);
|
||||
deviceId = tempDev.getId();
|
||||
}
|
||||
|
||||
} else {
|
||||
deviceId = lineDeviceMap.get(temp.getObjIndex());
|
||||
|
||||
}
|
||||
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
//如果前置删了直接返回
|
||||
if (!nodeMap.containsKey(nodeId)) {
|
||||
return;
|
||||
}
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(false);
|
||||
if (deviceProcesseMap.containsKey(deviceId)) {
|
||||
pqsTerminalPushLogDTO.setProcessNum(deviceProcesseMap.get(deviceId));
|
||||
} else {
|
||||
throw new BusinessException("存在终端未设置进程号,请在前置管理页面设置进程号在进行此操作");
|
||||
}
|
||||
pqsTerminalPushLogDTO.setOperateType(DeviceRebootType.LEDGER_MODIFY);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
|
||||
} else if (Objects.equals(temp.getTerminalType(), 4)) {
|
||||
//如果是修改进程操作记录2个进程日志;
|
||||
if (temp.getLogsType().equals(dataDic.getId())) {
|
||||
String temLos = "%s进行更新终端进程操作;终端名称 :%s,由进程%s修改成进程%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String num1 = strings.get(2); // 第一个进程
|
||||
String num2 = strings.get(3); // 第二个进程
|
||||
int processId1 = Integer.parseInt(num1);
|
||||
int processId2 = Integer.parseInt(num2);
|
||||
List<PqsTerminalLogs> list1 = new ArrayList<>();
|
||||
try {
|
||||
//前置层修改
|
||||
list1 = list.stream().filter(temp -> temp.getTerminalDescribe().contains("终端所属前置机由")).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(list1)) {
|
||||
for (PqsTerminalLogs temp : list1) {
|
||||
String temLos = "%s终端所属前置机由 %s 改为> %s;";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String node1 = strings.get(1); // 第一个前置
|
||||
String node2 = strings.get(2); // 第二个前置
|
||||
if (deviceProcesseMap.containsKey(temp.getObjIndex())) {
|
||||
Integer processNum = deviceProcesseMap.get(temp.getObjIndex());
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = new PqsTerminalPushLogDTO();
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.containsKey(deviceId) ? lineMap.get(deviceId).getName() : "删除设备");
|
||||
pqsTerminalPushLogDTO.setNodeId(node1);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(node1).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO.setProcessNum(processNum);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO2 = new PqsTerminalPushLogDTO();
|
||||
pqsTerminalPushLogDTO2.setId(temp.getId());
|
||||
pqsTerminalPushLogDTO2.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO2.setDevName(lineMap.containsKey(deviceId) ? lineMap.get(deviceId).getName() : "删除设备");
|
||||
pqsTerminalPushLogDTO2.setNodeId(node2);
|
||||
pqsTerminalPushLogDTO2.setNodeName(nodeMap.get(node2).getName());
|
||||
pqsTerminalPushLogDTO2.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO2.setProcessNum(processNum);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list.removeAll(list1);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
//终端层面和检测点层面修改
|
||||
list.forEach(temp -> {
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = new PqsTerminalPushLogDTO();
|
||||
if (Objects.equals(temp.getTerminalType(), 6)) {
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId;
|
||||
//如果不存在该设备id,说明监测点删除
|
||||
if (!lineDeviceMap.containsKey(temp.getObjIndex())) {
|
||||
String temLos = "%s监测点名称: %s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String[] lineName = strings.get(1).split("->");
|
||||
List<Line> devList = lineById.stream().filter(line -> Objects.equals(line.getName(), lineName[1])).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(devList)) {
|
||||
//如果不存在该设备说明设备也被删除,直接走下边删除设备逻辑;
|
||||
return;
|
||||
} else {
|
||||
Line sub = lineById.stream().filter(line -> Objects.equals(line.getName(), lineName[0])).collect(Collectors.toList()).get(0);
|
||||
Line tempDev = devList.stream().filter(dev -> dev.getPid().equals(sub.getId())).collect(Collectors.toList()).get(0);
|
||||
deviceId = tempDev.getId();
|
||||
}
|
||||
|
||||
} else {
|
||||
deviceId = lineDeviceMap.get(temp.getObjIndex());
|
||||
|
||||
}
|
||||
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
//如果前置删了直接返回
|
||||
if (!nodeMap.containsKey(nodeId)) {
|
||||
return;
|
||||
}
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO.setProcessNum(processId1);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO1 = new PqsTerminalPushLogDTO();
|
||||
|
||||
pqsTerminalPushLogDTO1.setId(temp.getId());
|
||||
pqsTerminalPushLogDTO1.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO1.setDevName(lineMap.get(deviceId).getName());
|
||||
pqsTerminalPushLogDTO1.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO1.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO1.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO1.setProcessNum(processId2);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO1);
|
||||
|
||||
} else {
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
//区分删除操作,新增和其他操作
|
||||
String operate = DeviceRebootType.LEDGER_MODIFY;
|
||||
|
||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||
operate = DeviceRebootType.DELETE_TERMINAL;
|
||||
|
||||
|
||||
} else if (Objects.equals(temp.getOperateType(), Param.ADD)) {
|
||||
operate = DeviceRebootType.ADD_TERMINAL;
|
||||
|
||||
}
|
||||
//设备删除找不到设备名称,重日志截取
|
||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||
String temLos = "%s名称:%s;前置信息:%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String devName = strings.get(1); // 设备名称
|
||||
String nodeName = strings.get(2); // 进程名称
|
||||
pqsTerminalPushLogDTO.setDevName(devName);
|
||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
||||
} else {
|
||||
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
||||
if (lineMap.containsKey(deviceId)) {
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
} else {
|
||||
pqsTerminalPushLogDTO.setDevName("删除设备");
|
||||
|
||||
}
|
||||
//如果新增的没有,说明该新增设备在本次也删除了,
|
||||
if (deviceMap.containsKey(deviceId)) {
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
} else {
|
||||
addAndDelteId.add(deviceId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(false);
|
||||
if (deviceProcesseMap.containsKey(deviceId)) {
|
||||
pqsTerminalPushLogDTO.setProcessNum(deviceProcesseMap.get(deviceId));
|
||||
} else {
|
||||
throw new BusinessException("存在终端未设置进程号,请在前置管理页面设置进程号在进行此操作");
|
||||
}
|
||||
|
||||
pqsTerminalPushLogDTO.setOperateType(operate);
|
||||
pqsTerminalPushLogDTO.setOperateType(DeviceRebootType.LEDGER_MODIFY);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
|
||||
} else if (Objects.equals(temp.getTerminalType(), 4)) {
|
||||
String deviceId = temp.getObjIndex();
|
||||
if(!deviceMap.containsKey(deviceId)){
|
||||
//说明设备被删除
|
||||
String temLos = "%s名称:%s;前置信息:%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String devName = strings.get(1); // 设备名称
|
||||
String nodeName = strings.get(2); // 进程名称
|
||||
pqsTerminalPushLogDTO.setDevName(devName);
|
||||
//如果前置删了直接返回
|
||||
if(!nodeNameMap.containsKey(nodeName)){
|
||||
return;
|
||||
}
|
||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
||||
}
|
||||
|
||||
//如果是修改进程操作记录2个进程日志;
|
||||
if (temp.getLogsType().equals(dataDic.getId())) {
|
||||
String temLos = "%s进行更新终端进程操作;终端名称 :%s,由进程%s修改成进程%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String num1 = strings.get(2); // 第一个进程
|
||||
String num2 = strings.get(3); // 第二个进程
|
||||
int processId1 = Integer.parseInt(num1);
|
||||
int processId2 = Integer.parseInt(num2);
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
// String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.containsKey(deviceId) ? lineMap.get(deviceId).getName() : "删除设备");
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO.setProcessNum(processId1);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO1 = new PqsTerminalPushLogDTO();
|
||||
|
||||
pqsTerminalPushLogDTO1.setId(temp.getId());
|
||||
pqsTerminalPushLogDTO1.setDevId(deviceId);
|
||||
pqsTerminalPushLogDTO1.setDevName(lineMap.get(deviceId).getName());
|
||||
pqsTerminalPushLogDTO1.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO1.setNodeName(nodeMap.get(nodeId).getName());
|
||||
pqsTerminalPushLogDTO1.setProcessUpdateFlag(true);
|
||||
pqsTerminalPushLogDTO1.setProcessNum(processId2);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO1);
|
||||
|
||||
} else {
|
||||
pqsTerminalPushLogDTO.setId(temp.getId());
|
||||
// String deviceId = temp.getObjIndex();
|
||||
pqsTerminalPushLogDTO.setDevId(deviceId);
|
||||
//区分删除操作,新增和其他操作
|
||||
String operate = DeviceRebootType.LEDGER_MODIFY;
|
||||
|
||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||
operate = DeviceRebootType.DELETE_TERMINAL;
|
||||
|
||||
|
||||
} else if (Objects.equals(temp.getOperateType(), Param.ADD)) {
|
||||
operate = DeviceRebootType.ADD_TERMINAL;
|
||||
|
||||
}
|
||||
//设备删除找不到设备名称,重日志截取
|
||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||
String temLos = "%s名称:%s;前置信息:%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String devName = strings.get(1); // 设备名称
|
||||
String nodeName = strings.get(2); // 进程名称
|
||||
pqsTerminalPushLogDTO.setDevName(devName);
|
||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
||||
} else {
|
||||
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
||||
if (lineMap.containsKey(deviceId)) {
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
} else {
|
||||
pqsTerminalPushLogDTO.setDevName("删除设备");
|
||||
|
||||
}
|
||||
//如果新增的没有,说明该新增设备在本次也删除了,
|
||||
if (deviceMap.containsKey(deviceId)) {
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.containsKey(nodeId)?nodeMap.get(nodeId).getName():"删除前置");
|
||||
} else {
|
||||
addAndDelteId.add(deviceId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
pqsTerminalPushLogDTO.setProcessUpdateFlag(false);
|
||||
if (deviceProcesseMap.containsKey(deviceId)) {
|
||||
pqsTerminalPushLogDTO.setProcessNum(deviceProcesseMap.get(deviceId));
|
||||
} else {
|
||||
throw new BusinessException("存在终端未设置进程号,请在前置管理页面设置进程号在进行此操作");
|
||||
}
|
||||
|
||||
pqsTerminalPushLogDTO.setOperateType(operate);
|
||||
pqsTerminalPushLogDTOList.add(pqsTerminalPushLogDTO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Map<String, Map<Integer, List<PqsTerminalPushLogDTO>>> collect2 = pqsTerminalPushLogDTOList.stream().filter(temp -> !addAndDelteId.contains(temp.getDevId())).collect(Collectors.groupingBy(PqsTerminalPushLogDTO::getNodeId, Collectors.groupingBy(PqsTerminalPushLogDTO::getProcessNum)));
|
||||
collect2.forEach((nodeId, pqsTerminalPushLogDTOMap) -> {
|
||||
pqsTerminalPushLogDTOMap.forEach((processId, tempPqsTerminalPushLogDTOList) -> {
|
||||
Map<String, Map<Integer, List<PqsTerminalPushLogDTO>>> collect2 = pqsTerminalPushLogDTOList.stream().filter(temp -> !addAndDelteId.contains(temp.getDevId())).collect(Collectors.groupingBy(PqsTerminalPushLogDTO::getNodeId, Collectors.groupingBy(PqsTerminalPushLogDTO::getProcessNum)));
|
||||
collect2.forEach((nodeId, pqsTerminalPushLogDTOMap) -> {
|
||||
pqsTerminalPushLogDTOMap.forEach((processId, tempPqsTerminalPushLogDTOList) -> {
|
||||
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = tempPqsTerminalPushLogDTOList.get(0);
|
||||
//如果存在终端变更进程的记录直接重启进程
|
||||
boolean processUpdateFlag = tempPqsTerminalPushLogDTOList.stream().map(PqsTerminalPushLogDTO::getProcessUpdateFlag).anyMatch(b -> b != null && b);
|
||||
if (processUpdateFlag) {
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "重启前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
//调用重启进程接口
|
||||
this.askRestartProcess(guid, pqsTerminalPushLogDTO.getNodeId(), processId, "delete", "all");
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
} else {
|
||||
List<String> deviceIds = tempPqsTerminalPushLogDTOList.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
//如果一个进程上涉及10个以上的设备修改,直接重启进程,否则重启设备
|
||||
if (CollectionUtil.isNotEmpty(deviceIds) && deviceIds.size() > 10) {
|
||||
PqsTerminalPushLogDTO pqsTerminalPushLogDTO = tempPqsTerminalPushLogDTOList.get(0);
|
||||
//如果存在终端变更进程的记录直接重启进程
|
||||
boolean processUpdateFlag = tempPqsTerminalPushLogDTOList.stream().map(PqsTerminalPushLogDTO::getProcessUpdateFlag).anyMatch(b -> b != null && b);
|
||||
if (processUpdateFlag) {
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "重启前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
|
||||
//调用重启进程接口
|
||||
this.askRestartProcess(guid, pqsTerminalPushLogDTO.getNodeId(), processId, "delete", "all");
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
|
||||
} else {
|
||||
//调用重启设备接口先删除设备,在新增,在修改在重启设备
|
||||
List<String> deleteDevIds = new ArrayList<>();
|
||||
List<String> addDevIds = new ArrayList<>();
|
||||
List<String> modifyDevIds = new ArrayList<>();
|
||||
Map<String, List<PqsTerminalPushLogDTO>> collect = tempPqsTerminalPushLogDTOList.stream().collect(Collectors.groupingBy(PqsTerminalPushLogDTO::getOperateType));
|
||||
if (collect.containsKey(DeviceRebootType.DELETE_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.DELETE_TERMINAL);
|
||||
deleteDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.ADD_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.ADD_TERMINAL);
|
||||
addDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.LEDGER_MODIFY)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.LEDGER_MODIFY);
|
||||
modifyDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.DELETE_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.DELETE_TERMINAL);
|
||||
List<String> finalAddDevIds = addDevIds;
|
||||
//过滤本次新增的设备,因为前置那边还没有新增该装备
|
||||
pqsTerminalPushLogDTOList1 = pqsTerminalPushLogDTOList1.stream().filter(temp -> !finalAddDevIds.contains(temp.getDevId())).distinct().collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(pqsTerminalPushLogDTOList1)) {
|
||||
String devNameString = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevName).distinct().collect(Collectors.joining(","));
|
||||
List<String> resultDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
List<String> deviceIds = tempPqsTerminalPushLogDTOList.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
//如果一个进程上涉及10个以上的设备修改,直接重启进程,否则重启设备
|
||||
if (CollectionUtil.isNotEmpty(deviceIds) && deviceIds.size() > 10) {
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "重启前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
|
||||
String command = "删除前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId + "下终端" + devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
//调用重启进程接口
|
||||
this.askRestartProcess(guid, pqsTerminalPushLogDTO.getNodeId(), processId, "delete", "all");
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
|
||||
} else {
|
||||
//调用重启设备接口先删除设备,在新增,在修改在重启设备
|
||||
List<String> deleteDevIds = new ArrayList<>();
|
||||
List<String> addDevIds = new ArrayList<>();
|
||||
List<String> modifyDevIds = new ArrayList<>();
|
||||
Map<String, List<PqsTerminalPushLogDTO>> collect = tempPqsTerminalPushLogDTOList.stream().collect(Collectors.groupingBy(PqsTerminalPushLogDTO::getOperateType));
|
||||
if (collect.containsKey(DeviceRebootType.DELETE_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.DELETE_TERMINAL);
|
||||
deleteDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.ADD_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.ADD_TERMINAL);
|
||||
addDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.LEDGER_MODIFY)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.LEDGER_MODIFY);
|
||||
modifyDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.DELETE_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.DELETE_TERMINAL);
|
||||
List<String> finalAddDevIds = addDevIds;
|
||||
//过滤本次新增的设备,因为前置那边还没有新增该装备
|
||||
pqsTerminalPushLogDTOList1 = pqsTerminalPushLogDTOList1.stream().filter(temp -> !finalAddDevIds.contains(temp.getDevId())).distinct().collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(pqsTerminalPushLogDTOList1)) {
|
||||
String devNameString = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevName).distinct().collect(Collectors.joining(","));
|
||||
List<String> resultDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
|
||||
String command = "删除前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId + "下终端" + devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
|
||||
//调用重启设备接口
|
||||
this.askRestartDevice(guid, pqsTerminalPushLogDTO.getNodeId(), resultDevIds, DeviceRebootType.DELETE_TERMINAL, processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.ADD_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.ADD_TERMINAL);
|
||||
List<String> finalDeleteDevIds = deleteDevIds;
|
||||
pqsTerminalPushLogDTOList1 = pqsTerminalPushLogDTOList1.stream().filter(temp -> !finalDeleteDevIds.contains(temp.getDevId())).distinct().collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(pqsTerminalPushLogDTOList1)) {
|
||||
String devNameString = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevName).distinct().collect(Collectors.joining(","));
|
||||
List<String> resultDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "新增前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId + "下终端" + devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid, pqsTerminalPushLogDTO.getNodeId(), resultDevIds, DeviceRebootType.ADD_TERMINAL, processId);
|
||||
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.LEDGER_MODIFY)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.LEDGER_MODIFY);
|
||||
List<String> finalDeleteDevIds1 = deleteDevIds;
|
||||
List<String> finalAddDevIds1 = addDevIds;
|
||||
pqsTerminalPushLogDTOList1 = pqsTerminalPushLogDTOList1.stream().filter(temp -> !finalDeleteDevIds1.contains(temp.getDevId()) && !finalAddDevIds1.contains(temp.getDevId())).distinct().collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(pqsTerminalPushLogDTOList1)) {
|
||||
String devNameString = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevName).distinct().collect(Collectors.joining(","));
|
||||
List<String> resultDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "修改前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId + "下终端" + devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid, pqsTerminalPushLogDTO.getNodeId(), resultDevIds, DeviceRebootType.LEDGER_MODIFY, processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
//调用重启设备接口
|
||||
this.askRestartDevice(guid, pqsTerminalPushLogDTO.getNodeId(), resultDevIds, DeviceRebootType.DELETE_TERMINAL, processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.ADD_TERMINAL)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.ADD_TERMINAL);
|
||||
List<String> finalDeleteDevIds = deleteDevIds;
|
||||
pqsTerminalPushLogDTOList1 = pqsTerminalPushLogDTOList1.stream().filter(temp -> !finalDeleteDevIds.contains(temp.getDevId())).distinct().collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(pqsTerminalPushLogDTOList1)) {
|
||||
String devNameString = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevName).distinct().collect(Collectors.joining(","));
|
||||
List<String> resultDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "新增前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId + "下终端" + devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid, pqsTerminalPushLogDTO.getNodeId(), resultDevIds, DeviceRebootType.ADD_TERMINAL, processId);
|
||||
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
}
|
||||
if (collect.containsKey(DeviceRebootType.LEDGER_MODIFY)) {
|
||||
List<PqsTerminalPushLogDTO> pqsTerminalPushLogDTOList1 = collect.get(DeviceRebootType.LEDGER_MODIFY);
|
||||
List<String> finalDeleteDevIds1 = deleteDevIds;
|
||||
List<String> finalAddDevIds1 = addDevIds;
|
||||
pqsTerminalPushLogDTOList1 = pqsTerminalPushLogDTOList1.stream().filter(temp -> !finalDeleteDevIds1.contains(temp.getDevId()) && !finalAddDevIds1.contains(temp.getDevId())).distinct().collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(pqsTerminalPushLogDTOList1)) {
|
||||
String devNameString = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevName).distinct().collect(Collectors.joining(","));
|
||||
List<String> resultDevIds = pqsTerminalPushLogDTOList1.stream().map(PqsTerminalPushLogDTO::getDevId).distinct().collect(Collectors.toList());
|
||||
PreCommandDTO preCommandDTO = new PreCommandDTO();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
String command = "修改前置机:" + pqsTerminalPushLogDTO.getNodeName() + "下进程:" + processId + "下终端" + devNameString;
|
||||
preCommandDTO.setGuid(guid);
|
||||
preCommandDTO.setCommand(command);
|
||||
preCommandDTO.setResult("2");
|
||||
//调用重启进程接口
|
||||
this.askRestartDevice(guid, pqsTerminalPushLogDTO.getNodeId(), resultDevIds, DeviceRebootType.LEDGER_MODIFY, processId);
|
||||
preCommandDTOList.add(preCommandDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (Exception e) {
|
||||
//出现异常,直接重启整个前置
|
||||
exFlag=true;
|
||||
for (Node node : nodes) {
|
||||
RestartParam restartParam = new RestartParam();
|
||||
restartParam.setDeviceRebootType("1");
|
||||
restartParam.setNodeId(node.getId());
|
||||
|
||||
askRestartProcess(restartParam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(list1)) {
|
||||
list1.forEach(temp -> {
|
||||
temp.setIsPush(1);
|
||||
@@ -4016,6 +4051,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
} else {
|
||||
throw new BusinessException("暂无变动的装置测点推送");
|
||||
}
|
||||
if(exFlag){
|
||||
throw new BusinessException("存在未知错误,重启前置");
|
||||
|
||||
}
|
||||
if (CollectionUtils.isEmpty(preCommandDTOList)) {
|
||||
throw new BusinessException("暂无变动的装置测点推送");
|
||||
}
|
||||
@@ -4166,7 +4205,21 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
subName = subMap.get(line.getPids().split(StrUtil.COMMA)[SUB_LEVEL.getCode()]).getName();
|
||||
String temLos = "%s进行%s%s操作;详细信息: %s名称: %s";
|
||||
if (line.getLevel().equals(LINE_LEVEL.getCode())) {
|
||||
String devName = this.getById(line.getPids().split(StrUtil.COMMA)[DEVICE_LEVEL.getCode()]).getName();
|
||||
String devId=line.getPids().split(StrUtil.COMMA)[DEVICE_LEVEL.getCode()];
|
||||
Line byId = this.getById(devId);
|
||||
String devName="";
|
||||
//设备已删除
|
||||
if(Objects.nonNull(byId)){
|
||||
devName= byId.getName();
|
||||
}else{
|
||||
List<Line> device = logsList.stream().filter(temp -> Objects.equals(temp.getId(), devId)).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(device)){
|
||||
devName =device.get(0).getName();
|
||||
}else {
|
||||
devName = "已删除设备";
|
||||
|
||||
}
|
||||
}
|
||||
tem = String.format(temLos, name, op, levelOperate, levelOperate, subName + "->" + devName + "->" + line.getName() + nodeName);
|
||||
} else {
|
||||
tem = String.format(temLos, name, op, levelOperate, levelOperate, subName + "->" + line.getName() + nodeName);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.dto.SubGetBase;
|
||||
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -74,6 +75,9 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
|
||||
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type,@Param("lineRunFlag") Integer lineRunFlag);
|
||||
|
||||
List<MonitorCommLedgerInfoDTO> getMonitorByDeptIds(@Param("list")List<Integer> devType,@Param("deptIds")List<String> deptIds);
|
||||
|
||||
|
||||
List<LineDevGetDTO> lineDevAllGet(@Param("list")List<Integer> devType,@Param("type")Integer type,@Param("lineRunFlag") Integer lineRunFlag, @Param("lineType") Integer lineType);
|
||||
|
||||
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
||||
|
||||
@@ -74,6 +74,45 @@
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getMonitorByDeptIds" resultType="com.njcn.device.biz.pojo.dto.MonitorCommLedgerInfoDTO">
|
||||
select
|
||||
point.id monitorId,
|
||||
point.name monitorName,
|
||||
lineDetail.Time_Interval timeInterval,
|
||||
lineDetail.Dev_Capacity devCapacity,
|
||||
lineDetail.Short_Capacity shortCapacity,
|
||||
lineDetail.Standard_Capacity standardCapacity,
|
||||
lineDetail.Deal_Capacity dealCapacity,
|
||||
voltage.name busBarname,
|
||||
pq_voltage.scale voltageLevel,
|
||||
bd.name bdName,
|
||||
gd.name gdName
|
||||
from pq_dept_line pq_dept_line
|
||||
inner join pq_line point on pq_dept_line.line_id = point.id
|
||||
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
||||
inner join pq_line voltage on point.pid = voltage.id
|
||||
inner join pq_voltage pq_voltage on voltage.id = pq_voltage.id
|
||||
inner join pq_line dev on voltage.pid = dev.id
|
||||
inner join pq_device device on dev.id = device.id
|
||||
inner join pq_line bd on dev.pid = bd.id
|
||||
inner join pq_line gd on bd.pid = gd.id
|
||||
where device.Dev_Model = 1
|
||||
and point.state = 1
|
||||
and device.Dev_Data_Type in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
and device.Run_Flag = 0
|
||||
and pq_dept_line.id in
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by point.name asc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="lineDevAllGet" resultType="com.njcn.device.biz.pojo.dto.LineDevGetDTO">
|
||||
select
|
||||
<!--监测点-->
|
||||
|
||||
@@ -562,7 +562,7 @@
|
||||
detail.Short_Capacity,
|
||||
detail.Standard_Capacity,
|
||||
detail.Deal_Capacity,
|
||||
detail.Business_Type,
|
||||
detail.Business_Type businessType,
|
||||
detail.Calssification_Grade,
|
||||
detail.Superiors_Substation,
|
||||
detail.Hang_Line,
|
||||
@@ -571,7 +571,8 @@
|
||||
detail.obj_id,
|
||||
detail.big_obj_type,
|
||||
detail.small_obj_type,
|
||||
detail.Power_Flag powerFlag
|
||||
detail.Power_Flag powerFlag,
|
||||
detail.Power_Substation_Name powerSubstationName
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line_detail detail,
|
||||
@@ -1565,7 +1566,6 @@
|
||||
lineDetail.Power_Flag powerFlag,
|
||||
lineDetail.Run_Flag lineRunType
|
||||
FROM
|
||||
pq_line line,
|
||||
pq_line voltage,
|
||||
pq_line device,
|
||||
pq_line substation,
|
||||
@@ -1574,12 +1574,11 @@
|
||||
pq_device deviceDetail,
|
||||
pq_line_detail lineDetail,
|
||||
pq_voltage vg,
|
||||
pq_dept_line deptLine,
|
||||
sys_dept dept
|
||||
pq_line line
|
||||
LEFT JOIN pq_dept_line deptLine on line.id = deptLine.Line_Id
|
||||
LEFT JOIN sys_dept dept on deptLine.Id = dept.Id
|
||||
<where>
|
||||
line.id = deptLine.Line_Id
|
||||
AND deptLine.Id = dept.Id
|
||||
AND line.pid = voltage.id
|
||||
line.pid = voltage.id
|
||||
AND voltage.pid = device.id
|
||||
AND device.pid = substation.id
|
||||
AND substation.pid = gd.id
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.njcn.device.line.mapper.LineMapper;
|
||||
import com.njcn.device.line.service.DeptLineService;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.line.mapper.LineDetailMapper;
|
||||
import com.njcn.device.overlimit.mapper.OverlimitMapper;
|
||||
import com.njcn.device.biz.mapper.OverlimitMapper;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.enums.PowerFlagEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.njcn.common.utils.EnumUtils;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.overlimit.mapper.OverlimitMapper;
|
||||
import com.njcn.device.biz.mapper.OverlimitMapper;
|
||||
import com.njcn.device.overlimit.service.IOverLimitService;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
|
||||
@@ -94,6 +94,11 @@
|
||||
<artifactId>advance-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.njcn.event.pojo.param.EventCountParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.GeneralVO;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.event.pojo.param.EventMonitorReportParam;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.EventMonitorReportService;
|
||||
import com.njcn.event.common.service.EventMonitorReportService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -51,7 +51,7 @@ public class EventMonitorReportController extends BaseController {
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
*
|
||||
* @author jianghaifei
|
||||
* @date 2022-10-29 14:08
|
||||
* @param eventMonitorReportParam
|
||||
@@ -67,7 +67,7 @@ public class EventMonitorReportController extends BaseController {
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
*
|
||||
* @author jianghaifei
|
||||
* @date 2022-10-29 14:08
|
||||
* @param eventMonitorReportParam
|
||||
|
||||
@@ -2,15 +2,13 @@ package com.njcn.event.controller.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.event.pojo.param.*;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.EventAnalysisService;
|
||||
import com.njcn.event.common.service.EventAnalysisService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,7 +16,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
package com.njcn.event.controller.majornetwork;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.pojo.param.*;
|
||||
import com.njcn.event.pojo.vo.DetailVO;
|
||||
import com.njcn.event.pojo.vo.GeneralVO;
|
||||
import com.njcn.event.pojo.vo.ReasonsVO;
|
||||
import com.njcn.event.pojo.vo.WaveTypeVO;
|
||||
import com.njcn.event.service.majornetwork.ReportService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import freemarker.template.TemplateException;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -27,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -44,6 +56,14 @@ public class ReportController extends BaseController {
|
||||
|
||||
private final ReportService reportService;
|
||||
|
||||
private final CommMonitorEventReportService commMonitorEventReportService;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getGeneralSituation")
|
||||
@ApiOperation("暂态总体概况(区域)")
|
||||
@@ -149,7 +169,31 @@ public class ReportController extends BaseController {
|
||||
@ApiOperation("监测点报告导出")
|
||||
@ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true)
|
||||
public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException {
|
||||
reportService.getLineExport(exportParam, response);
|
||||
|
||||
LineDetailDataCommDTO lineDetailDataCommDTO = new LineDetailDataCommDTO();
|
||||
if(exportParam.getType() == 0) {
|
||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(exportParam.getLineId()).getData();
|
||||
if (ObjectUtil.isNull(lineDetailData)) {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, "查询监测点失败");
|
||||
}
|
||||
BeanUtil.copyProperties(lineDetailData,lineDetailDataCommDTO);
|
||||
}else {
|
||||
HttpResult<List<Monitor>> monitorList = monitorClient.getMonitorList(Arrays.asList(exportParam.getLineId()));
|
||||
if (ObjectUtil.isNull(monitorList)) {
|
||||
throw new BusinessException(EventResponseEnum.NOT_FOUND);
|
||||
}
|
||||
lineDetailDataCommDTO.setLineName(monitorList.getData().get(0).getName());
|
||||
lineDetailDataCommDTO.setScale(dicDataFeignClient.getDicDataById(monitorList.getData().get(0).getVoltageLevel()).getData().getName());
|
||||
lineDetailDataCommDTO.setPt(monitorList.getData().get(0).getPt1() + "/" + monitorList.getData().get(0).getPt2());
|
||||
lineDetailDataCommDTO.setPt(monitorList.getData().get(0).getCt1() + "/" + monitorList.getData().get(0).getCt2());
|
||||
lineDetailDataCommDTO.setDealCapacity(monitorList.getData().get(0).getUserAgreementCapacity());
|
||||
// insertRow(doc, table, centerParagraph, false, "基准容量", monitorList.getData().get(0).getMinShortCircuitCapacity() + "");
|
||||
lineDetailDataCommDTO.setDevCapacity(monitorList.getData().get(0).getPowerSupplyEqCapacity());
|
||||
lineDetailDataCommDTO.setShortCapacity(monitorList.getData().get(0).getMinShortCircuitCapacity());
|
||||
lineDetailDataCommDTO.setPtType(dicDataFeignClient.getDicDataById(monitorList.getData().get(0).getTerminalWiringMethod()).getData().getName());
|
||||
}
|
||||
|
||||
commMonitorEventReportService.getLineExport(exportParam, lineDetailDataCommDTO,response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?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.event.mapper.majornetwork.EventDistributionStatisticsMapper">
|
||||
<mapper namespace="com.njcn.event.common.mapper.EventDistributionStatisticsMapper">
|
||||
|
||||
<!--获取暂态指标分布统计-->
|
||||
<select id="getEventDistributionStatistics"
|
||||
@@ -469,4 +469,4 @@
|
||||
)
|
||||
r
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
<select id="selectDownCount" resultType="java.lang.Integer">
|
||||
select
|
||||
count(ed.event_id) "COUNT"
|
||||
from r_mp_event_detail ed
|
||||
from r_mp_event_detail ed inner join sys_dict_data sd on ed.event_type= sd.id
|
||||
where
|
||||
sd.code in ('Voltage_Dip','Short_Interruptions')
|
||||
and
|
||||
ed.measurement_point_id in
|
||||
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.event.pojo.param.StatisticsParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <监测点报表>
|
||||
*
|
||||
* @author wr
|
||||
* @createTime: 2023-02-10
|
||||
*/
|
||||
public interface EventReportService {
|
||||
|
||||
/**
|
||||
*获取Disdip表格(监测点报表专用)
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<DISDIPVO> eventDisdip(List<EventDetail> info);
|
||||
|
||||
/**
|
||||
* 获取IEC411数据
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<IEC411VO> IEC411(List<EventDetail> info);
|
||||
|
||||
/**
|
||||
* 获取IEC28数据
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<IEC28VO> IEC28(List<EventDetail> info);
|
||||
|
||||
/**
|
||||
*暂降幅值概率分布
|
||||
* @param info2 influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
ProbabilityVO getProbabilityDistribution(List<EventDetail> info2);
|
||||
|
||||
/**
|
||||
* 获取时间列表(月份统计)
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam,List<EventDetail> info) throws ParseException;
|
||||
|
||||
/**
|
||||
* 获取点状表格数据2.1
|
||||
* @param info 结果集
|
||||
* @param reasonData 暂降原因
|
||||
* @param typeData 暂降类型
|
||||
* @return
|
||||
*/
|
||||
List<EventDetail> getPlot(List<EventDetail> info, List<DictData> reasonData, List<DictData> typeData);
|
||||
|
||||
/**
|
||||
* 获取详细数据对象
|
||||
* @param info
|
||||
* @param reasonData
|
||||
* @param typeData
|
||||
* @return
|
||||
*/
|
||||
StatisticVO getStatistic(List<EventDetail> info,List<DictData> reasonData,List<DictData>typeData);
|
||||
|
||||
/**
|
||||
* 获取密度点图
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
Integer[][] getCoords(List<EventDetail> info);
|
||||
}
|
||||
//package com.njcn.event.service.majornetwork;
|
||||
//
|
||||
//import com.njcn.event.pojo.param.StatisticsParam;
|
||||
//import com.njcn.event.pojo.po.EventDetail;
|
||||
//import com.njcn.event.pojo.vo.*;
|
||||
//import com.njcn.system.pojo.po.DictData;
|
||||
//
|
||||
//import java.text.ParseException;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * <监测点报表>
|
||||
// *
|
||||
// * @author wr
|
||||
// * @createTime: 2023-02-10
|
||||
// */
|
||||
//public interface EventReportService {
|
||||
//
|
||||
// /**
|
||||
// *获取Disdip表格(监测点报表专用)
|
||||
// * @param info influxdb查询结果(pqs_eventdetail表)
|
||||
// * @return
|
||||
// */
|
||||
// List<DISDIPVO> eventDisdip(List<EventDetail> info);
|
||||
//
|
||||
// /**
|
||||
// * 获取IEC411数据
|
||||
// * @param info influxdb查询结果(pqs_eventdetail表)
|
||||
// * @return
|
||||
// */
|
||||
// List<IEC411VO> IEC411(List<EventDetail> info);
|
||||
//
|
||||
// /**
|
||||
// * 获取IEC28数据
|
||||
// * @param info influxdb查询结果(pqs_eventdetail表)
|
||||
// * @return
|
||||
// */
|
||||
// List<IEC28VO> IEC28(List<EventDetail> info);
|
||||
//
|
||||
// /**
|
||||
// *暂降幅值概率分布
|
||||
// * @param info2 influxdb查询结果(pqs_eventdetail表)
|
||||
// * @return
|
||||
// */
|
||||
// ProbabilityVO getProbabilityDistribution(List<EventDetail> info2);
|
||||
//
|
||||
// /**
|
||||
// * 获取时间列表(月份统计)
|
||||
// * @param info influxdb查询结果(pqs_eventdetail表)
|
||||
// * @return
|
||||
// */
|
||||
// List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam,List<EventDetail> info) throws ParseException;
|
||||
//
|
||||
// /**
|
||||
// * 获取点状表格数据2.1
|
||||
// * @param info 结果集
|
||||
// * @param reasonData 暂降原因
|
||||
// * @param typeData 暂降类型
|
||||
// * @return
|
||||
// */
|
||||
// List<EventDetail> getPlot(List<EventDetail> info, List<DictData> reasonData, List<DictData> typeData);
|
||||
//
|
||||
// /**
|
||||
// * 获取详细数据对象
|
||||
// * @param info
|
||||
// * @param reasonData
|
||||
// * @param typeData
|
||||
// * @return
|
||||
// */
|
||||
// StatisticVO getStatistic(List<EventDetail> info,List<DictData> reasonData,List<DictData>typeData);
|
||||
//
|
||||
// /**
|
||||
// * 获取密度点图
|
||||
// * @param info
|
||||
// * @return
|
||||
// */
|
||||
// Integer[][] getCoords(List<EventDetail> info);
|
||||
//}
|
||||
|
||||
@@ -20,20 +20,18 @@ import com.njcn.event.pojo.vo.AreaAnalysisVO;
|
||||
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO;
|
||||
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO.VoltageToleranceCurveDataList;
|
||||
import com.njcn.event.service.majornetwork.AreaAnalysisService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -54,9 +52,12 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
private final EventDetailService eventDetailService;
|
||||
@Override
|
||||
public AreaAnalysisVO getEventReason(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
|
||||
//获取暂降字典信息
|
||||
DictData voltageData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
if(ObjectUtil.isNull(voltageData)){
|
||||
DictData shortInterruptionsData = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||
|
||||
if(ObjectUtil.isNull(voltageData)||ObjectUtil.isNull(shortInterruptionsData)){
|
||||
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
||||
}
|
||||
AreaAnalysisVO areaAnalysisVO = new AreaAnalysisVO();
|
||||
@@ -71,7 +72,9 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new QueryWrapper<RmpEventDetailPO>()
|
||||
.select("advance_reason,advance_type,count(event_id) as count")
|
||||
.in("measurement_point_id", lineIds)
|
||||
.eq("event_type", voltageData.getId())
|
||||
.in("event_type", Stream.of(voltageData.getId(),shortInterruptionsData.getId()).collect(Collectors.toList()))
|
||||
|
||||
// .eq("event_type", voltageData.getId())
|
||||
.in("advance_reason", dicReasonList.stream().map(DictData::getId).collect(Collectors.toList()))
|
||||
.in("advance_type", dicTypeList.stream().map(DictData::getId).collect(Collectors.toList()))
|
||||
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()),"start_time" ,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AreaSubLineVO;
|
||||
import com.njcn.event.service.majornetwork.AreaInfoService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.harmonic.api.PollutionSubstationClient;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -148,12 +149,11 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
eventDetailNew = BeanUtil.copyProperties(eventDetail, EventDetailNew.class);
|
||||
//监测点id
|
||||
eventDetailNew.setLineId(eventDetail.getMeasurementPointId());
|
||||
//需要转成百分比*100
|
||||
eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude()*100);
|
||||
//特征幅值 需要转成百分比*100
|
||||
eventDetailNew.setFeatureAmplitude(roundHalfUp(eventDetail.getFeatureAmplitude()*100));
|
||||
//持续时间
|
||||
eventDetailNew.setDuration(eventDetail.getDuration());
|
||||
//特征幅值
|
||||
eventDetailNew.setFeatureAmplitude(eventDetail.getFeatureAmplitude());
|
||||
|
||||
if (lineMap.containsKey(eventDetail.getMeasurementPointId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = lineMap.get(eventDetail.getMeasurementPointId());
|
||||
eventDetailNew.setLineName(areaLineInfoVO.getLineName());
|
||||
@@ -165,7 +165,14 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
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
|
||||
public List<EventDetailNew> getNoDealEventsByLineId(String id, String searchBeginTime, String searchEndTime) {
|
||||
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(Stream.of(id).collect(Collectors.toList())).getData();
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningInfoVO;
|
||||
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO;
|
||||
import com.njcn.event.service.majornetwork.AreaLineService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.LargeScreenService;
|
||||
import com.njcn.harmonic.pojo.dto.ComAssessDTO;
|
||||
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
|
||||
@@ -47,6 +47,7 @@ import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.event.influxdb.QueryBuilder.beginOfDay;
|
||||
import static com.njcn.event.influxdb.QueryBuilder.endOfDay;
|
||||
@@ -122,9 +123,12 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
|
||||
@Override
|
||||
public EventHeatMapVO getEventHeatMap(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
//新增需求添加中断
|
||||
//获取暂降字典信息
|
||||
DictData voltageData = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
if(ObjectUtil.isNull(voltageData)){
|
||||
DictData shortInterruptionsData = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||
|
||||
if(ObjectUtil.isNull(voltageData)||ObjectUtil.isNull(shortInterruptionsData)){
|
||||
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
||||
}
|
||||
EventHeatMapVO eventHeatMapVO = new EventHeatMapVO();
|
||||
@@ -146,7 +150,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new QueryWrapper<RmpEventDetailPO>()
|
||||
.select("measurement_point_id as measurementPointId,count(file_flag) as fileFlag")
|
||||
.in("measurement_point_id", lineIndexs)
|
||||
.eq("event_type", voltageData.getId())
|
||||
.in("event_type", Stream.of(voltageData.getId(),shortInterruptionsData.getId()).collect(Collectors.toList()))
|
||||
.ge("start_time" ,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||
.le("start_time", DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
|
||||
.groupBy("measurement_point_id")
|
||||
|
||||
@@ -5,8 +5,11 @@ import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -22,7 +25,7 @@ import com.njcn.event.pojo.vo.AreaStatisticalVO.VoltageStatisticsVO;
|
||||
import com.njcn.event.pojo.vo.MonthCalculationVO;
|
||||
import com.njcn.event.pojo.vo.VoltageLevelCalculationVO;
|
||||
import com.njcn.event.service.majornetwork.AreaStatisticalService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.event.pojo.vo.NodeVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -66,7 +69,11 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
public AreaStatisticalVO getAreaCalculation(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
//获取录波字典信息
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
DictData shortInterruptionsData = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||
|
||||
if(ObjectUtil.isNull(data)||ObjectUtil.isNull(shortInterruptionsData)){
|
||||
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
||||
}
|
||||
// 获取指定部门下的监测点集合
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
@@ -80,7 +87,8 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||
//todo 是否缺少录波
|
||||
.eq(RmpEventDetailPO::getEventType, data.getId())
|
||||
.in(RmpEventDetailPO::getEventType, Stream.of(data.getId(),shortInterruptionsData.getId()).collect(Collectors.toList()))
|
||||
|
||||
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
|
||||
);
|
||||
@@ -105,7 +113,11 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
List<NodeVO> nodeVOS=new ArrayList<>();
|
||||
//获取录波字典信息
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
||||
DictData shortInterruptionsData = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
||||
|
||||
if(ObjectUtil.isNull(data)||ObjectUtil.isNull(shortInterruptionsData)){
|
||||
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
||||
}
|
||||
// 获取指定部门下的监测点集合
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
@@ -119,7 +131,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||
//todo 是否缺少录波
|
||||
.eq(RmpEventDetailPO::getEventType, data.getId())
|
||||
.in(RmpEventDetailPO::getEventType, Stream.of(data.getId(),shortInterruptionsData.getId()).collect(Collectors.toList()))
|
||||
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper;
|
||||
import com.njcn.event.common.mapper.EventDistributionStatisticsMapper;
|
||||
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
|
||||
import com.njcn.event.pojo.po.EventDurationLineChartPO;
|
||||
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
|
||||
@@ -21,8 +21,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@ import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.mapper.majornetwork.RMpEventDetailMMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.dto.EventCount;
|
||||
import com.njcn.event.pojo.param.EventBaseParam;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.njcn.event.file.component.WaveFileComponent;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.mapper.majornetwork.TransientMapper;
|
||||
import com.njcn.event.pojo.param.EventVerifyReasonParam;
|
||||
import com.njcn.event.pojo.param.TransientParam;
|
||||
@@ -33,7 +33,7 @@ import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.TransientService;
|
||||
import com.njcn.minioss.config.MinIossProperties;
|
||||
import com.njcn.minioss.util.MinIoUtils;
|
||||
@@ -56,7 +56,6 @@ import java.text.DecimalFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -340,30 +339,30 @@ public class TransientServiceImpl implements TransientService {
|
||||
// 获取按终端分类的监测点索引集合
|
||||
List<String> lineList = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
List<TerminalTree> data = deviceTreeClient.getTerminalTree().getData();
|
||||
if (!CollectionUtils.isEmpty(transientParam.getSubstationIds())) {
|
||||
List<String> collect = data.stream().map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.filter(temp -> transientParam.getSubstationIds().contains(temp.getId()))
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getId).collect(Collectors.toList());
|
||||
lineList.retainAll(collect);
|
||||
}
|
||||
// if (!CollectionUtils.isEmpty(transientParam.getSubstationIds())) {
|
||||
// List<String> collect = data.stream().map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .filter(temp -> transientParam.getSubstationIds().contains(temp.getId()))
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getId).collect(Collectors.toList());
|
||||
// lineList.retainAll(collect);
|
||||
// }
|
||||
|
||||
if (!CollectionUtils.isEmpty(transientParam.getLineIds())) {
|
||||
List<String> collect1 = data.stream().map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
.filter(temp -> transientParam.getLineIds().contains(temp.getId()))
|
||||
.map(TerminalTree::getId).collect(Collectors.toList());
|
||||
lineList.retainAll(collect1);
|
||||
// List<String> collect1 = data.stream().map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .map(TerminalTree::getChildren).flatMap(Collection::stream)
|
||||
// .filter(temp -> transientParam.getLineIds().contains(temp.getId()))
|
||||
// .map(TerminalTree::getId).collect(Collectors.toList());
|
||||
lineList.retainAll(transientParam.getLineIds());
|
||||
}
|
||||
if (CollUtil.isEmpty(lineList)) {
|
||||
return new Page<>();
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.EventNewStationVo;
|
||||
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.SpThroughService;
|
||||
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
|
||||
import com.njcn.event.pojo.param.SpThroughParam;
|
||||
|
||||
43
pqs-event/event-common/pom.xml
Normal file
43
pqs-event/event-common/pom.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-event</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<artifactId>event-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>event-common</name>
|
||||
<description>event-common</description>
|
||||
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>advance-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.mapper.majornetwork;
|
||||
package com.njcn.event.common.mapper;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
|
||||
import com.njcn.event.pojo.po.EventDurationLineChartPO;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.mapper.majornetwork;
|
||||
package com.njcn.event.common.mapper;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.event.mapper.majornetwork.RmpEventDetailMapper">
|
||||
<mapper namespace="com.njcn.event.common.mapper.RmpEventDetailMapper">
|
||||
|
||||
<select id="getDetailsOfTransientEvents" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
|
||||
SELECT
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.njcn.event.common.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2026/1/17
|
||||
*/
|
||||
@Data
|
||||
public class LineDetailDataCommDTO {
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "id",value = "监测点序号")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "areaName",value = "工程名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty(name = "gdName",value = "单位")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty(name = "bdName",value = "部门")
|
||||
private String bdName;
|
||||
|
||||
@ApiModelProperty(name = "scale",value = "电压等级")
|
||||
private String scale;
|
||||
|
||||
@ApiModelProperty(name = "manufacturer",value = "厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(name = "devId",value = "终端Id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty(name = "devName",value = "终端名称")
|
||||
private String devName;
|
||||
|
||||
@ApiModelProperty(name = "ip",value = "网络参数")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(name = "runFlag",value = "终端运行状态")
|
||||
private String runFlag;
|
||||
|
||||
@ApiModelProperty(name = "comFlag",value = "通讯状态")
|
||||
private String comFlag;
|
||||
|
||||
@ApiModelProperty(name = "loadType",value = "干扰源类型")
|
||||
private String loadType;
|
||||
|
||||
@ApiModelProperty(name = "businessType",value = "行业类型")
|
||||
private String businessType;
|
||||
|
||||
@ApiModelProperty(name = "objName",value = "监测点对象名称")
|
||||
private String objName;
|
||||
|
||||
@ApiModelProperty(name = "ptType",value = "接线方式")
|
||||
private String ptType;
|
||||
|
||||
@ApiModelProperty(name = "pt",value = "PT变比")
|
||||
private String pt;
|
||||
|
||||
@ApiModelProperty(name = "ct",value = "CT变比")
|
||||
private String ct;
|
||||
|
||||
@ApiModelProperty(name = "standardCapacity",value = "基准容量(MVA)")
|
||||
private Float standardCapacity;
|
||||
|
||||
@ApiModelProperty(name = "shortCapacity",value = "最小短路容量(MVA)")
|
||||
private Float shortCapacity;
|
||||
|
||||
@ApiModelProperty(name = "devCapacity",value = "供电设备容量(MVA)")
|
||||
private Float devCapacity;
|
||||
|
||||
@ApiModelProperty(name = "dealCapacity",value = "用户协议容量(MVA)")
|
||||
private Float dealCapacity;
|
||||
|
||||
@ApiModelProperty(name = "powerFlag",value = "电网标志(0-电网侧;1-非电网侧)")
|
||||
private Integer powerFlag;
|
||||
|
||||
/**
|
||||
* 测量间隔(1-10分钟)
|
||||
*/
|
||||
@ApiModelProperty(name = "timeInterval",value = "测量间隔(1-10分钟)")
|
||||
private Integer timeInterval;
|
||||
|
||||
/**
|
||||
* 监测点拥有者
|
||||
*/
|
||||
@ApiModelProperty(name = "owner",value = "监测点拥有者")
|
||||
private String owner;
|
||||
|
||||
/**
|
||||
* 拥有者职务
|
||||
*/
|
||||
@ApiModelProperty(name = "ownerDuty",value = "拥有者职务")
|
||||
private String ownerDuty;
|
||||
|
||||
/**
|
||||
* 拥有者联系方式
|
||||
*/
|
||||
@ApiModelProperty(name = "ownerTel",value = "拥有者联系方式")
|
||||
private String ownerTel;
|
||||
|
||||
/**
|
||||
* 接线图
|
||||
*/
|
||||
@ApiModelProperty(name = "wiringDiagram",value = "接线图")
|
||||
private String wiringDiagram;
|
||||
@ApiModelProperty(name = "ptPhaseType",value = "监测点接线相别(0,单相,1,三相,默认三相)")
|
||||
private Integer ptPhaseType;
|
||||
|
||||
@ApiModelProperty(name = "投运日期")
|
||||
private LocalDate loginTime;
|
||||
|
||||
@ApiModelProperty(name = "最新数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(name = "监测对象信息ID")
|
||||
private String objId;
|
||||
|
||||
@ApiModelProperty(name = "对象类型大类")
|
||||
private String bigObjType;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.event.common.service;
|
||||
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.pojo.param.ExportParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2026/1/17
|
||||
*/
|
||||
public interface CommMonitorEventReportService {
|
||||
|
||||
void getLineExport(ExportParam exportParam, LineDetailDataCommDTO lineDetailDataCommDTO, HttpServletResponse response);
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
package com.njcn.event.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.event.pojo.param.*;
|
||||
@@ -55,7 +55,7 @@ public interface EventAnalysisService {
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException;
|
||||
List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam);
|
||||
|
||||
/**
|
||||
* 获取详细数据对象
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
package com.njcn.event.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.event.pojo.dto.EventDeatilDTO;
|
||||
@@ -41,4 +41,4 @@ public interface EventDetailService extends IService<RmpEventDetailPO> {
|
||||
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<String> waveType);
|
||||
|
||||
Boolean addEventDetail(EventDeatilDTO deatilDTO);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
package com.njcn.event.common.service;
|
||||
|
||||
import com.njcn.event.pojo.param.EventMonitorReportParam;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.njcn.event.common.service;
|
||||
|
||||
import com.njcn.event.pojo.param.StatisticsParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <监测点报表>
|
||||
*
|
||||
* @author wr
|
||||
* @createTime: 2023-02-10
|
||||
*/
|
||||
public interface EventReportService {
|
||||
|
||||
/**
|
||||
*获取Disdip表格(监测点报表专用)
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<DISDIPVO> eventDisdip(List<EventDetail> info);
|
||||
|
||||
/**
|
||||
* 获取IEC411数据
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<IEC411VO> IEC411(List<EventDetail> info);
|
||||
|
||||
/**
|
||||
* 获取IEC28数据
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<IEC28VO> IEC28(List<EventDetail> info);
|
||||
|
||||
/**
|
||||
*暂降幅值概率分布
|
||||
* @param info2 influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
ProbabilityVO getProbabilityDistribution(List<EventDetail> info2);
|
||||
|
||||
/**
|
||||
* 获取时间列表(月份统计)
|
||||
* @param info influxdb查询结果(pqs_eventdetail表)
|
||||
* @return
|
||||
*/
|
||||
List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam,List<EventDetail> info) throws ParseException;
|
||||
|
||||
/**
|
||||
* 获取点状表格数据2.1
|
||||
* @param info 结果集
|
||||
* @param reasonData 暂降原因
|
||||
* @param typeData 暂降类型
|
||||
* @return
|
||||
*/
|
||||
List<EventDetail> getPlot(List<EventDetail> info, List<DictData> reasonData, List<DictData> typeData);
|
||||
|
||||
/**
|
||||
* 获取详细数据对象
|
||||
* @param info
|
||||
* @param reasonData
|
||||
* @param typeData
|
||||
* @return
|
||||
*/
|
||||
StatisticVO getStatistic(List<EventDetail> info,List<DictData> reasonData,List<DictData>typeData);
|
||||
|
||||
/**
|
||||
* 获取密度点图
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
Integer[][] getCoords(List<EventDetail> info);
|
||||
}
|
||||
@@ -0,0 +1,593 @@
|
||||
package com.njcn.event.common.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.echarts.pojo.constant.PicCommonData;
|
||||
import com.njcn.echarts.util.DrawPicUtil;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.common.service.EventAnalysisService;
|
||||
import com.njcn.event.common.service.EventReportService;
|
||||
import com.njcn.event.common.service.CommMonitorEventReportService;
|
||||
import com.njcn.event.common.utils.WordUtils;
|
||||
import com.njcn.event.pojo.param.ExportParam;
|
||||
import com.njcn.event.pojo.param.StatisticsParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.util.Units;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2026/1/17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CommMonitorEventReportServiceImpl implements CommMonitorEventReportService {
|
||||
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final EventReportService eventReportService;
|
||||
//调用暂降密度接口
|
||||
private final EventAnalysisService eventAnalysisService;
|
||||
private final MonitorClient monitorClient;
|
||||
private final RmpEventDetailMapper rmpEventDetailMapper;
|
||||
|
||||
private final DrawPicUtil drawPicUtil;
|
||||
|
||||
/**
|
||||
* 监测点导出word
|
||||
*
|
||||
* @param exportParam .
|
||||
* @param response .
|
||||
*/
|
||||
@Override
|
||||
public void getLineExport(ExportParam exportParam, LineDetailDataCommDTO lineDetailData, HttpServletResponse response) {
|
||||
//创建word文档(poi生成word)
|
||||
XWPFDocument doc = new XWPFDocument(); //创建Word文件
|
||||
//设置标题样式
|
||||
WordUtils.setHeadingStyle(doc);
|
||||
XWPFParagraph p = doc.createParagraph(); //新建一个段落
|
||||
//设置对齐
|
||||
p.setAlignment(ParagraphAlignment.CENTER);
|
||||
p.setVerticalAlignment(TextAlignment.CENTER);
|
||||
XWPFRun r = p.createRun();//创建段落文本
|
||||
r.addBreak();
|
||||
r.addBreak();
|
||||
r.addBreak();
|
||||
r.addBreak();
|
||||
r.addBreak();
|
||||
r.addBreak();
|
||||
r.setText("");
|
||||
r.setBold(true);//设置为粗体
|
||||
r.setFontSize(14);//字体大小
|
||||
r.addBreak();
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun r1 = p.createRun();//创建段落文本
|
||||
r1.setText("电压暂降事件分析报告");
|
||||
r1.setBold(true);//设置为粗体
|
||||
r1.setFontSize(36);//字体大小
|
||||
r1.addBreak();
|
||||
r1.addBreak();
|
||||
r1.addBreak();
|
||||
r1.addBreak();
|
||||
r1.addBreak();
|
||||
r1.addBreak();
|
||||
r1.addBreak();
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun r2 = p.createRun();//创建段落文本
|
||||
//获取当前时间
|
||||
Date date = new Date();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy 年 MM 月 dd 日");
|
||||
String time = dateFormat.format(date);
|
||||
|
||||
r2.setText("日期: " + time);
|
||||
r2.setBold(true);//设置为粗体
|
||||
r2.setFontSize(14);//字体大小
|
||||
|
||||
r2.addBreak();
|
||||
r2.addBreak();
|
||||
r2.addBreak();
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun r3 = p.createRun();//创建段落文本
|
||||
r3.setText("电压暂降事件区域报告");
|
||||
r3.setFontSize(24);//字体大小
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.LEFT);
|
||||
createTitle(doc, "1. 引言", "标题 1", 0, 15);
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.BOTH);
|
||||
XWPFRun r5 = p.createRun();//创建段落文本
|
||||
r5.setText("对所选中区间内电压暂降事件进行分析,能够直观清晰查看响应的暂降事件信息。");
|
||||
r5.setFontSize(11);//字体大小
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.LEFT);
|
||||
createTitle(doc, "2. 报告分析对象", "标题 1", 0, 15);
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.BOTH);
|
||||
XWPFRun r7 = p.createRun();//创建段落文本
|
||||
r7.setText(exportParam.getLineName());
|
||||
r7.setFontSize(11);//字体大小
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.LEFT);
|
||||
createTitle(doc, "3. 报告分析时间", "标题 1", 0, 15);
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.BOTH);
|
||||
XWPFRun r9 = p.createRun();//创建段落文本
|
||||
r9.setText(exportParam.getSearchBeginTime() + " 至 " + exportParam.getSearchEndTime());
|
||||
r9.setFontSize(11);//字体大小
|
||||
|
||||
p = doc.createParagraph(); //新建一个段落
|
||||
p.setAlignment(ParagraphAlignment.LEFT);
|
||||
createTitle(doc, "4. 总汇信息", "标题 1", 0, 15);
|
||||
|
||||
//查询参数
|
||||
StatisticsParam param = new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag());
|
||||
//获取暂降原因字典
|
||||
List<DictData> reasonData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
|
||||
//获取暂降类型字典
|
||||
List<DictData> typeData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
|
||||
//influxdb查询结果(pqs_eventdetail表)
|
||||
List<EventDetail> info = info(param);
|
||||
|
||||
//记录数
|
||||
int i = 1;
|
||||
//1.监测点信息
|
||||
if (exportParam.isXq()) {
|
||||
createTitle(doc, "4." + i + " 监测点信息", "标题 2", 200, 15);
|
||||
XWPFTable table = createTable(doc);
|
||||
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
|
||||
insertRow(doc, table, centerParagraph, true, "项目", "描述");
|
||||
insertRow(doc, table, centerParagraph, false, "监测点名称", lineDetailData.getLineName());
|
||||
insertRow(doc, table, centerParagraph, false, "电压等级", lineDetailData.getScale());
|
||||
insertRow(doc, table, centerParagraph, false, "PT变比", lineDetailData.getPt());
|
||||
insertRow(doc, table, centerParagraph, false, "CT变比", lineDetailData.getCt());
|
||||
insertRow(doc, table, centerParagraph, false, "协议容量", lineDetailData.getDealCapacity() + "");
|
||||
insertRow(doc, table, centerParagraph, false, "设备容量", lineDetailData.getDevCapacity() + "");
|
||||
insertRow(doc, table, centerParagraph, false, "最小短路容量", lineDetailData.getShortCapacity() + "");
|
||||
insertRow(doc, table, centerParagraph, false, "接线方式", lineDetailData.getPtType());
|
||||
if (exportParam.getType() == 0) {
|
||||
insertRow(doc, table, centerParagraph, false, "基准容量", lineDetailData.getStandardCapacity() + "");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
//2.暂降事件暂降事件列表和暂降点图
|
||||
//2.1.判断列表和点图是否是要导出
|
||||
if (exportParam.isLb() || exportParam.isSjdF47() || exportParam.isSjdITIC()) {
|
||||
// List<EventDetail> plot = eventAnalysisService.getPlot(param);
|
||||
List<EventDetail> plot = eventReportService.getPlot(info, reasonData, typeData);
|
||||
//暂降事件列表
|
||||
if (exportParam.isLb()) {
|
||||
createTitle(doc, "4." + i + " 暂降事件列表", "标题 2", 200, 15);
|
||||
XWPFTable table = createTable(doc);
|
||||
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
|
||||
insertRow(doc, table, centerParagraph, true, "序号", "暂降发生时刻", "暂降幅值(%)", "持续时间(s)", "暂降类型", "暂降原因", "严重度");
|
||||
for (int j = 0; j < plot.size(); j++) {
|
||||
EventDetail eventDetail = plot.get(j);
|
||||
String s = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
|
||||
|
||||
insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude() * 100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + "");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
//暂降事件点图
|
||||
if (exportParam.isSjdF47() || exportParam.isSjdITIC()) {
|
||||
ArrayList<List<Double>> ass = getAss(plot);
|
||||
createTitle(doc, "4." + i + " 暂降事件点图", "标题 2", 200, 15);
|
||||
int two = 1;
|
||||
if (exportParam.isSjdITIC()) {
|
||||
createTitle(doc, "4." + i + "." + two + " ITIC 曲线", "标题 3", 400, 15);
|
||||
String itic = drawPicUtil.drawItic(ass);
|
||||
createPic(doc, itic, "ITIC曲线");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isSjdF47()) {
|
||||
createTitle(doc, "4." + i + "." + two + " F47 曲线", "标题 3", 400, 15);
|
||||
String f47 = drawPicUtil.drawF47(ass);
|
||||
createPic(doc, f47, "SEMI F47曲线");
|
||||
two++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//3.暂降密度
|
||||
if (exportParam.isMdbg() || exportParam.isMdtx()) {
|
||||
createTitle(doc, "4." + i + " 暂降密度", "标题 2", 200, 15);
|
||||
int two = 1;
|
||||
if (exportParam.isMdtx()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 暂降密度点图", "标题 3", 400, 15);
|
||||
Integer[][] eventDensityData = eventReportService.getCoords(info);
|
||||
String str = drawPicUtil.drawEventDensity(eventDensityData);
|
||||
createPic(doc, str, "暂降密度图");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isMdbg()) {
|
||||
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
|
||||
createTitle(doc, "4." + i + "." + two + " DISDIP 表格:国际发配电联盟(UNIPEDE)", "标题 3", 400, 15);
|
||||
// List<DISDIPVO> eventDisdip = eventAnalysisService.eventDisdip(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
|
||||
List<DISDIPVO> eventDisdip = eventReportService.eventDisdip(info);
|
||||
|
||||
XWPFTable table1 = createTable(doc);
|
||||
insertRow(doc, table1, centerParagraph, true, "剩余电压", "20ms", "100ms", "500ms", "1s", "3s", "20s", "60s", "180s");
|
||||
for (int j = 0; j < eventDisdip.size(); j++) {
|
||||
DISDIPVO disdipvo = eventDisdip.get(j);
|
||||
insertRow(doc, table1, centerParagraph, false, disdipvo.getName(), disdipvo.getTwentyMs(), disdipvo.getOneHundredMs(), disdipvo.getFiveHundredMs(), disdipvo.getOneS(), disdipvo.getThreeS(), disdipvo.getTwentyS(), disdipvo.getSixtyS(), disdipvo.getOneEightyS());
|
||||
}
|
||||
two++;
|
||||
createTitle(doc, "4." + i + "." + two + " IEC 61000-4-11:(用电终端的电压暂降抗度)", "标题 3", 400, 15);
|
||||
// List<IEC411VO> iec411VOS = eventAnalysisService.IEC411(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
|
||||
List<IEC411VO> iec411VOS = eventReportService.IEC411(info);
|
||||
XWPFTable table2 = createTable(doc);
|
||||
insertRow(doc, table2, centerParagraph, true, "剩余电压", "10~20ms", "20~100ms", "0.1~0.2s", "0.2~0.5s", "0.5~1s", ">1s");
|
||||
for (int j = 0; j < iec411VOS.size(); j++) {
|
||||
IEC411VO iec411VO = iec411VOS.get(j);
|
||||
insertRow(doc, table2, centerParagraph, false, iec411VO.getName(), iec411VO.getTenTwentyMs(), iec411VO.getTwentyOneHundredMs(), iec411VO.getZeroPiontOneTwoS(), iec411VO.getZeroPiontTwoFiveS(), iec411VO.getZeroPiontFive1S(), iec411VO.getGreater1S());
|
||||
}
|
||||
two++;
|
||||
createTitle(doc, "4." + i + "." + two + " IEC 61000-2-8:(公共电网电压暂降测量统计)", "标题 3", 400, 15);
|
||||
// List<IEC28VO> iec28VOS = eventAnalysisService.IEC28(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
|
||||
List<IEC28VO> iec28VOS = eventReportService.IEC28(info);
|
||||
XWPFTable table3 = createTable(doc);
|
||||
insertRow(doc, table3, centerParagraph, true, "剩余电压", "0.02~0.1s", "0.1~0.25s", "0.25~0.5s", "0.5s~1s", "1~3s", "3~20s", "20~60s", "60~180s");
|
||||
for (int j = 0; j < iec28VOS.size(); j++) {
|
||||
IEC28VO iec28VO = iec28VOS.get(j);
|
||||
insertRow(doc, table3, centerParagraph, false, iec28VO.getName(), iec28VO.getQ(), iec28VO.getW(), iec28VO.getE(), iec28VO.getR(), iec28VO.getT(), iec28VO.getY(), iec28VO.getU(), iec28VO.getI());
|
||||
}
|
||||
two++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
//4.暂降幅值概率分布
|
||||
if (exportParam.isGlfbfz() || exportParam.isGlfbsj()) {
|
||||
createTitle(doc, "4." + i + " 暂降幅值概率分布图", "标题 2", 200, 15);
|
||||
// ProbabilityVO probabilityVO = eventAnalysisService.getProbabilityDistribution(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
|
||||
ProbabilityVO probabilityVO = eventReportService.getProbabilityDistribution(info);
|
||||
int two = 1;
|
||||
if (exportParam.isGlfbfz()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 暂降幅值的概率分函数", "标题 3", 400, 15);
|
||||
List<String> ybardata = probabilityVO.getPereventvalue();
|
||||
List<String> ylinedata = probabilityVO.getEventvalue();
|
||||
String fz = drawPicUtil.drawEventAmplitude(ylinedata, ybardata);
|
||||
createPic(doc, fz, "暂降幅值的概率分布函数");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isGlfbsj()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 持续时间的概率分函数", "标题 3", 400, 15);
|
||||
List<String> ybardata = probabilityVO.getPersisttime();
|
||||
List<String> ylinedata = probabilityVO.getSisttime();
|
||||
String sj = drawPicUtil.drawPersistentTime(ylinedata, ybardata);
|
||||
createPic(doc, sj, "持续时间的概率分布函数");
|
||||
two++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
//5.月份统计
|
||||
if (exportParam.isTjbg() || exportParam.isTjtx()) {
|
||||
createTitle(doc, "4." + i + " 月份统计", "标题 2", 200, 15);
|
||||
int two = 1;
|
||||
List<TimeVO> reasonTypeTime = eventAnalysisService.getReasonTypeTime(param);
|
||||
//暂时时间端按月查询不能查询
|
||||
// List<TimeVO> reasonTypeTime = eventReportService.getReasonTypeTime(param,null);
|
||||
if (exportParam.isTjtx()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 月份统计图", "标题 3", 400, 15);
|
||||
List<Integer> count = new ArrayList<>();
|
||||
List<String> name = new ArrayList<>();
|
||||
if (exportParam.getFlag() == 0) {
|
||||
for (TimeVO timeVO : reasonTypeTime) {
|
||||
name.add(timeVO.getMonth() + "");
|
||||
count.add(Integer.parseInt(timeVO.getTimes()));
|
||||
}
|
||||
} else {
|
||||
for (TimeVO timeVO : reasonTypeTime) {
|
||||
name.add(timeVO.getDay() + "");
|
||||
count.add(Integer.parseInt(timeVO.getTimes()));
|
||||
}
|
||||
}
|
||||
String yftj = drawPicUtil.drawMonth(name, count, reasonTypeTime.get(0).getYear(), exportParam.getFlag());
|
||||
createPic(doc, yftj, "月份统计图");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isTjbg()) {
|
||||
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
|
||||
createTitle(doc, "4." + i + "." + two + " 时间统计表格", "标题 3", 400, 15);
|
||||
|
||||
XWPFTable table1 = createTable(doc);
|
||||
if (exportParam.getFlag() == 0) {
|
||||
insertRow(doc, table1, centerParagraph, true, "时间(月)", "电压暂降次数");
|
||||
} else {
|
||||
insertRow(doc, table1, centerParagraph, true, "时间(天)", "电压暂降次数");
|
||||
}
|
||||
if (exportParam.getFlag() == 0) {
|
||||
for (int j = 0; j < reasonTypeTime.size(); j++) {
|
||||
TimeVO timeVO = reasonTypeTime.get(j);
|
||||
insertRow(doc, table1, centerParagraph, false, timeVO.getMonth(), timeVO.getTimes());
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < reasonTypeTime.size(); j++) {
|
||||
TimeVO timeVO = reasonTypeTime.get(j);
|
||||
insertRow(doc, table1, centerParagraph, false,timeVO.getFulltime(), timeVO.getTimes());
|
||||
}
|
||||
}
|
||||
two++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
//6.原因统计
|
||||
//6.1整合提出查询语句
|
||||
Boolean fly = exportParam.isYybg() || exportParam.isYytx() || exportParam.isLxbg() || exportParam.isLxtx();
|
||||
if (fly) {
|
||||
List<DictData> tempDictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
List<String> typeIds = tempDictType.stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(x.getCode()) || DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(x.getCode()))
|
||||
.map(DictData::getId).collect(Collectors.toList());
|
||||
List<EventDetail> tempInfo = info.stream().filter(temp -> typeIds.contains(temp.getEventType())).collect(Collectors.toList());
|
||||
StatisticVO statistic = eventReportService.getStatistic(tempInfo, reasonData, typeData);
|
||||
if (exportParam.isYybg() || exportParam.isYytx()) {
|
||||
createTitle(doc, "4." + i + " 原因统计", "标题 2", 200, 15);
|
||||
// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
|
||||
int two = 1;
|
||||
if (exportParam.isYytx()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 原因统计图", "标题 3", 400, 15);
|
||||
List<String> xdata = new ArrayList<>();
|
||||
List<Map<String, Object>> reasonList = new ArrayList<>();
|
||||
|
||||
List<ReasonsVO> reason = statistic.getReason();
|
||||
for (ReasonsVO reasonsVO : reason) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("value", reasonsVO.getTimes());
|
||||
map.put("name", reasonsVO.getReason());
|
||||
reasonList.add(map);
|
||||
xdata.add(reasonsVO.getReason());
|
||||
}
|
||||
String tr = drawPicUtil.drawReason(xdata, reasonList);
|
||||
createPic(doc, tr, "暂降原因图");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isYybg()) {
|
||||
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
|
||||
createTitle(doc, "4." + i + "." + two + " 原因统计表格", "标题 3", 400, 15);
|
||||
XWPFTable table1 = createTable(doc);
|
||||
insertRow(doc, table1, centerParagraph, true, "暂降原因", "电压暂降次数");
|
||||
List<ReasonsVO> reason = statistic.getReason();
|
||||
for (int j = 0; j < reason.size(); j++) {
|
||||
ReasonsVO reasonsVO = reason.get(j);
|
||||
insertRow(doc, table1, centerParagraph, false, reasonsVO.getReason(), reasonsVO.getTimes() + "");
|
||||
}
|
||||
two++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
//7.类型统计
|
||||
if (exportParam.isLxbg() || exportParam.isLxtx()) {
|
||||
createTitle(doc, "4." + i + " 类型统计", "标题 2", 200, 15);
|
||||
// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
|
||||
int two = 1;
|
||||
if (exportParam.isLxtx()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 类型统计图", "标题 3", 400, 15);
|
||||
List<String> xdata = new ArrayList<>();
|
||||
List<TypesVO> types = statistic.getTypes();
|
||||
|
||||
List<Map<String, Object>> reasonList = new ArrayList<>();
|
||||
for (TypesVO type : types) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("value", type.getTimes());
|
||||
map.put("name", type.getType());
|
||||
reasonList.add(map);
|
||||
xdata.add(type.getType());
|
||||
}
|
||||
String tr = drawPicUtil.drawType(xdata, reasonList);
|
||||
createPic(doc, tr, "暂降类型图");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isLxbg()) {
|
||||
createTitle(doc, "4." + i + "." + two + " 类型统计表格", "标题 3", 400, 15);
|
||||
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
|
||||
XWPFTable table1 = createTable(doc);
|
||||
insertRow(doc, table1, centerParagraph, true, "暂降原因", "电压暂降次数");
|
||||
List<TypesVO> types = statistic.getTypes();
|
||||
for (int j = 0; j < types.size(); j++) {
|
||||
TypesVO typesVO = types.get(j);
|
||||
insertRow(doc, table1, centerParagraph, false, typesVO.getType(), typesVO.getTimes() + "");
|
||||
}
|
||||
two++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
String fileName = URLEncoder.encode(exportParam.getLineName() + ".docx", "UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
doc.write(outputStream);
|
||||
outputStream.close();
|
||||
}catch (Exception e){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"导出监测点暂降报告异常");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建标题
|
||||
*
|
||||
* @param document 文档
|
||||
* @param message 标题内容
|
||||
* @param style 标题等级
|
||||
* @param line 缩进
|
||||
* @param fontSize 字体大小
|
||||
*/
|
||||
public void createTitle(XWPFDocument document, String message, String style, int line, int fontSize) {
|
||||
XWPFParagraph summaeTableParagraph = WordUtils.getLeftParagraph(document);
|
||||
summaeTableParagraph.setStyle(style);
|
||||
summaeTableParagraph.setIndentationFirstLine(line);
|
||||
XWPFRun summaeTableRun = summaeTableParagraph.createRun();
|
||||
WordUtils.addParagraph(summaeTableRun, "宋体", fontSize, "000000", message, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格插入行数据
|
||||
*
|
||||
* @param document 文档
|
||||
* @param table 表格
|
||||
* @param head 是否是表头
|
||||
* @param values 数据内容
|
||||
*/
|
||||
public static void insertRow(XWPFDocument document, XWPFTable table, XWPFParagraph excelParagraph, boolean head,
|
||||
String... values) {
|
||||
if (head) {
|
||||
XWPFTableRow summaTableRowOne = table.getRow(0);
|
||||
WordUtils.setExcelHeadContent(excelParagraph, summaTableRowOne, values);
|
||||
} else {
|
||||
XWPFTableRow summaTableRowOne = table.createRow();
|
||||
WordUtils.setExcelContent(excelParagraph, summaTableRowOne, values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建表格
|
||||
*
|
||||
* @param document
|
||||
* @return
|
||||
*/
|
||||
public XWPFTable createTable(XWPFDocument document) {
|
||||
XWPFTable summaTable = document.createTable();
|
||||
// 列宽自动分割
|
||||
CTTblWidth summaTableWidth = summaTable.getCTTbl().addNewTblPr().addNewTblW();
|
||||
summaTableWidth.setType(STTblWidth.DXA);
|
||||
summaTableWidth.setW(BigInteger.valueOf(8160));
|
||||
return summaTable;
|
||||
}
|
||||
|
||||
|
||||
public void setCellStyle(HSSFCell cellname, String value, HSSFCellStyle style) {
|
||||
cellname.setCellValue(value);
|
||||
cellname.setCellStyle(style);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param document 文档
|
||||
* @param image 图片base64
|
||||
* @param name 图片名
|
||||
* @throws IOException
|
||||
* @throws InvalidFormatException
|
||||
*/
|
||||
public void createPic(XWPFDocument document, String image, String name) {
|
||||
try {
|
||||
XWPFParagraph picParagraph = WordUtils.getCenterParagraph(document);
|
||||
XWPFRun createRun = picParagraph.createRun();
|
||||
if (image.contains(PicCommonData.PNG_PREFIX)) {
|
||||
image = image.replace(PicCommonData.PNG_PREFIX, "");
|
||||
}
|
||||
byte[] bytes = Base64.getDecoder().decode(image);
|
||||
InputStream in = new ByteArrayInputStream(bytes);
|
||||
createRun.addPicture(in, 5, name, Units.toEMU(410), Units.toEMU(170));
|
||||
}catch (Exception e){
|
||||
log.error("在word中创建图片异常:",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 监测点暂降事件点图赋值
|
||||
*
|
||||
* @param plot
|
||||
* @return
|
||||
*/
|
||||
private ArrayList<List<Double>> getAss(List<EventDetail> plot) {
|
||||
ArrayList<List<Double>> list = new ArrayList<>();
|
||||
for (EventDetail eventDetail : plot) {
|
||||
ArrayList<Double> doubles = new ArrayList<>();
|
||||
doubles.add(eventDetail.getDuration());
|
||||
doubles.add(Double.parseDouble(String.valueOf(eventDetail.getFeatureAmplitude() * 100)));
|
||||
list.add(doubles);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* influxdb查询结果集
|
||||
*
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
private List<EventDetail> info(StatisticsParam statisticsParam) {
|
||||
// //获取事件类型
|
||||
// List<DictData> dictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
// List<String> typeIds = dictType.stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(x.getCode()) || DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(x.getCode()))
|
||||
// .map(DictData::getId).collect(Collectors.toList());
|
||||
//数据暂降查询
|
||||
List<RmpEventDetailPO> info = rmpEventDetailMapper.selectList(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
|
||||
// .in(RmpEventDetailPO::getEventType, typeIds)
|
||||
.ge(StrUtil.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
|
||||
);
|
||||
|
||||
return BeanUtil.copyToList(info, EventDetail.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
package com.njcn.event.common.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -13,6 +13,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||
import com.njcn.event.pojo.param.EventBaseParam;
|
||||
@@ -20,8 +21,7 @@ import com.njcn.event.pojo.param.StatisticsParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.EventAnalysisService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventAnalysisService;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -792,7 +792,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
* @author xxy
|
||||
*/
|
||||
@Override
|
||||
public List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException {
|
||||
public List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam) {
|
||||
//获取暂降字典信息
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList()); List<TimeVO> list = new ArrayList<>();
|
||||
@@ -949,21 +949,22 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
Map<String, Integer> reasonMap = new LinkedHashMap<>();
|
||||
Map<String, Integer> typeMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
info = info.stream().filter(temp->Objects.nonNull(temp.getAdvanceReason())||Objects.nonNull(temp.getAdvanceType())).collect(Collectors.toList());
|
||||
//添加detail
|
||||
for (RmpEventDetailPO detail : info) {
|
||||
EventDetail details = null;
|
||||
if (typeList.contains(detail.getEventType())) {
|
||||
for (DictData data : reasonData) {
|
||||
reasonMap.put(data.getName(), 0);
|
||||
if (detail.getAdvanceReason().equals(data.getId())) {
|
||||
//此处写法会报空指针异常修改写法
|
||||
if (Objects.equals(detail.getAdvanceReason(),data.getId())) {
|
||||
details = BeanUtil.copyProperties(detail, EventDetail.class);
|
||||
details.setAdvanceReason(data.getName());
|
||||
}
|
||||
}
|
||||
for (DictData data : typeData) {
|
||||
typeMap.put(data.getName(), 0);
|
||||
if (detail.getAdvanceType().equals(data.getId())) {
|
||||
if (Objects.equals(detail.getAdvanceType(),data.getId())) {
|
||||
// details = BeanUtil.copyProperties(detail, EventDetail.class);
|
||||
details.setAdvanceType(data.getName());
|
||||
}
|
||||
@@ -974,13 +975,13 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
|
||||
//添加reason到map
|
||||
for (EventDetail data : list) {
|
||||
if (reasonMap.get(data.getAdvanceReason()) != null) {
|
||||
if (Objects.nonNull(data.getAdvanceReason())&&reasonMap.get(data.getAdvanceReason()) != null) {
|
||||
reasonMap.put(data.getAdvanceReason(), reasonMap.get(data.getAdvanceReason()) + 1);
|
||||
}
|
||||
}
|
||||
//添加type到map
|
||||
for (EventDetail data : list) {
|
||||
if (typeMap.get(data.getAdvanceType()) != null) {
|
||||
if (Objects.nonNull(data.getAdvanceType())&&typeMap.get(data.getAdvanceType()) != null) {
|
||||
typeMap.put(data.getAdvanceType(), typeMap.get(data.getAdvanceType()) + 1);
|
||||
}
|
||||
}
|
||||
@@ -1327,12 +1328,12 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
// }
|
||||
// }
|
||||
//获取电压暂降信息
|
||||
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList());
|
||||
// List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
// List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList());
|
||||
//查询监测点未处理暂态事件
|
||||
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
|
||||
.in(RmpEventDetailPO::getEventType,typeList)
|
||||
// .in(RmpEventDetailPO::getEventType,typeList)
|
||||
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
|
||||
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
|
||||
);
|
||||
@@ -1464,9 +1465,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
waveTypeVO.setAdvanceReason(dictData.getName());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//抛出异常,当前暂态原因为空
|
||||
throw new BusinessException(EventResponseEnum.EVENT_REASON_NOT_FOUND);
|
||||
}
|
||||
|
||||
if (waveTypeVO.getAdvanceType() != null) {
|
||||
@@ -1476,9 +1474,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
waveTypeVO.setAdvanceType(dictData.getName());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//抛出异常,当前暂态类型为空
|
||||
throw new BusinessException(EventResponseEnum.EVENT_TYPE_NOT_FOUND);
|
||||
}
|
||||
waveTypeVOS.add(waveTypeVO);
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
package com.njcn.event.common.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -10,33 +9,27 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.advance.api.EventCauseFeignClient;
|
||||
import com.njcn.advance.api.EventWaveAnalysisFeignClient;
|
||||
import com.njcn.advance.pojo.dto.EventAnalysisDTO;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetBase;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pq.api.DeptLineFeignClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.vo.SendEventVO;
|
||||
import com.njcn.event.utils.EventUtil;
|
||||
import com.njcn.event.mapper.majornetwork.EventDetailMapper;
|
||||
import com.njcn.event.pojo.dto.EventDeatilDTO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.common.service.EventDetailService;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
@@ -60,7 +53,7 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEventDetailPO> implements EventDetailService {
|
||||
public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, RmpEventDetailPO> implements EventDetailService {
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
package com.njcn.event.common.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
@@ -7,12 +7,12 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
||||
import com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.common.mapper.EventDistributionStatisticsMapper;
|
||||
import com.njcn.event.common.service.EventMonitorReportService;
|
||||
import com.njcn.event.common.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.param.EventMonitorReportParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.EventMonitorReportService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
package com.njcn.event.common.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.event.common.service.EventReportService;
|
||||
import com.njcn.event.pojo.constant.Param;
|
||||
import com.njcn.event.pojo.param.StatisticsParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.EventReportService;
|
||||
import com.njcn.influx.utils.InfluxDbUtils;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -44,7 +44,8 @@ public class EventReportServiceImpl implements EventReportService {
|
||||
}
|
||||
for (int i = 0; i < info.size(); i++) {
|
||||
Double eventvalue = info.get(i).getFeatureAmplitude();
|
||||
double persisttime = info.get(i).getDuration();
|
||||
//mysql存的S要转换成ms
|
||||
double persisttime = info.get(i).getDuration()*1000;
|
||||
if (eventvalue * 100 < 10) {
|
||||
if (persisttime < 20) {
|
||||
arr[4][0]++;
|
||||
@@ -156,7 +157,8 @@ public class EventReportServiceImpl implements EventReportService {
|
||||
}
|
||||
for (int i = 0; i < info.size(); i++) {
|
||||
Double eventvalue = info.get(i).getFeatureAmplitude();
|
||||
double persisttime = info.get(i).getDuration();
|
||||
//mysql存的S要转换成ms
|
||||
double persisttime = info.get(i).getDuration()*1000;
|
||||
if (eventvalue * 100 < 1) {
|
||||
if (persisttime < 20 && persisttime >= 10) {
|
||||
arr[2][0]++;
|
||||
@@ -218,7 +220,9 @@ public class EventReportServiceImpl implements EventReportService {
|
||||
}
|
||||
for (int i = 0; i < info.size(); i++) {
|
||||
Double eventvalue = info.get(i).getFeatureAmplitude();
|
||||
double persisttime = info.get(i).getDuration();
|
||||
//mysql存的S要转换成ms
|
||||
double persisttime = info.get(i).getDuration()*1000;
|
||||
|
||||
if (eventvalue * 100 < 1 && eventvalue * 100 >= 0) {
|
||||
if (persisttime > 10 && persisttime <= 100) {
|
||||
arr[16][0]++;
|
||||
@@ -709,7 +713,8 @@ public class EventReportServiceImpl implements EventReportService {
|
||||
timeMap.put("<180", 0);
|
||||
//求不同时间段的总数
|
||||
for (EventDetail eventDetail : info) {
|
||||
Double persistTime = eventDetail.getDuration();
|
||||
//转换成ms
|
||||
Double persistTime = eventDetail.getDuration()*1000;
|
||||
if (persistTime / 1000 < 0.1) {
|
||||
timeMap.put("<0.1", timeMap.get("<0.1") + 1);
|
||||
} else if (persistTime / 1000 > 0.1 && persistTime / 1000 < 0.25) {
|
||||
@@ -770,7 +775,7 @@ public class EventReportServiceImpl implements EventReportService {
|
||||
//求sisttime
|
||||
List<String> sisttime = new ArrayList<>();
|
||||
for (EventDetail eventDetail : info) {
|
||||
Double persistTime = eventDetail.getDuration();
|
||||
Double persistTime = eventDetail.getDuration()*1000;
|
||||
if (persistTime / 1000 < 0.1) {
|
||||
timeMap2.put("<0.1", timeMap2.get("<0.1") + 1);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.utils;
|
||||
package com.njcn.event.common.utils;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.math.BigInteger;
|
||||
@@ -28,7 +28,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STStyleType;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
|
||||
|
||||
public class WordUtils {
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args)throws Exception {
|
||||
|
||||
@@ -200,7 +200,7 @@ public class WordUtils {
|
||||
paragraph.setSpacingAfter(100);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 返回指定格式的段落 居中型
|
||||
* @param document 文档对象
|
||||
*/
|
||||
@@ -211,8 +211,8 @@ public class WordUtils {
|
||||
paragraph.setVerticalAlignment(TextAlignment.CENTER);
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 返回指定格式的段落 居左型
|
||||
* @param document 文档对象
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ public class WordUtils {
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加换行符
|
||||
@@ -13,10 +13,11 @@
|
||||
<modules>
|
||||
<module>event-api</module>
|
||||
<module>event-boot</module>
|
||||
<module>event-common</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
<packaging>pom</packaging>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -4,9 +4,6 @@ import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||
import com.njcn.common.pojo.dto.LogInfoDTO;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
@@ -14,6 +11,8 @@ import com.njcn.gateway.enums.GateWayEnum;
|
||||
import com.njcn.gateway.security.AuthorizationManager;
|
||||
import com.njcn.gateway.utils.ResponseUtils;
|
||||
import com.njcn.gateway.utils.WebFluxRequestUtil;
|
||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||
import com.njcn.redis.utils.RedisMessageQueueUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -39,7 +38,6 @@ import java.security.KeyFactory;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -54,7 +52,16 @@ public class ResourceServerConfig {
|
||||
|
||||
private final WhiteListConfig whiteListConfig;
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
/**
|
||||
* mqtt处理日志异步发布
|
||||
*/
|
||||
// private final MqttPublisher publisher;
|
||||
|
||||
/**
|
||||
* redis队列处理日志异步发布
|
||||
*/
|
||||
private final RedisMessageQueueUtil redisMessageQueueUtil;
|
||||
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
|
||||
@@ -108,8 +115,12 @@ public class ResourceServerConfig {
|
||||
userIndex,
|
||||
LocalDateTime.now()
|
||||
);
|
||||
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||
// publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||
redisMessageQueueUtil.pushMessage(
|
||||
RedisKeyEnum.USER_LOG_QUEUE.getKey(),
|
||||
PubUtils.obj2json(logInfoDTO)
|
||||
);
|
||||
// publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||
return ResponseUtils.writeErrorInfo(response, GateWayEnum.NO_AUTHORIZATION);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,13 +48,6 @@ public class IpUtils {
|
||||
public static String getRealIpAddress(ServerHttpRequest request) {
|
||||
HttpHeaders headers = request.getHeaders();
|
||||
String ipAddress = headers.getFirst(HEADER_X_FORWARDED_FOR);
|
||||
log.info("X-Forwarded-For:"+ipAddress);
|
||||
ipAddress = headers.getFirst("X-Real-IP");
|
||||
log.error("X-Real-IP:"+ipAddress);
|
||||
ipAddress = headers.getFirst("Proxy-Client-IP");
|
||||
log.error("Proxy-Client-IP:"+ipAddress);
|
||||
ipAddress = headers.getFirst("REMOTE-HOST");
|
||||
log.error("REMOTE-HOST:"+ipAddress);
|
||||
if (StrUtil.isBlankIfStr(ipAddress) || UNKNOWN.equalsIgnoreCase(ipAddress)) {
|
||||
ipAddress = headers.getFirst(HEADER_PROXY_CLIENT_IP);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.harmonic.pojo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class THDistortionDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStation;
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端IP")
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
|
||||
/**
|
||||
* 总畸变率
|
||||
*/
|
||||
@ApiModelProperty("总畸变率")
|
||||
private Double distortion = 3.14159;
|
||||
}
|
||||
@@ -56,4 +56,9 @@ public class ReportTemplateDTO {
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 针对电压下偏差新增的字段
|
||||
*/
|
||||
private String lowValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.harmonic.pojo.dto.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-06
|
||||
* @Description: 公共台账
|
||||
*/
|
||||
@Data
|
||||
public class CommReportLedgerDto {
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private List<MonitorLedgerInfo> monitorNameList;
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
static class MonitorLedgerInfo {
|
||||
|
||||
private String monitorName;
|
||||
|
||||
private String gdName;
|
||||
|
||||
private String bdName;
|
||||
|
||||
private String busBarName;
|
||||
|
||||
private String voltageLevel;
|
||||
|
||||
private String shortCapacity;
|
||||
|
||||
private String devCapacity;
|
||||
|
||||
private String dealCapacity;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.harmonic.pojo.dto.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-07
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class TableMergeRule {
|
||||
|
||||
/** 文档中表格的索引(从0开始) */
|
||||
private Integer tableIndex;
|
||||
/** 要合并的列索引(比如0=第0列) */
|
||||
private Integer mergeColIndex;
|
||||
/** 从第几行开始合并(从0开始计数,比如从第2行开始填2) */
|
||||
private Integer startRow = 0;
|
||||
/** 每多少行合并一次(比如5=每5行合并一组) */
|
||||
private Integer mergeRowsPerGroup;
|
||||
/** 是否启用该规则 */
|
||||
private boolean enable = true;
|
||||
|
||||
// 快捷构造方法(包含起始行)
|
||||
public static TableMergeRule build(int tableIndex, int mergeColIndex, int startRow, int mergeRowsPerGroup) {
|
||||
TableMergeRule rule = new TableMergeRule();
|
||||
rule.setTableIndex(tableIndex);
|
||||
rule.setMergeColIndex(mergeColIndex);
|
||||
rule.setStartRow(startRow);
|
||||
rule.setMergeRowsPerGroup(mergeRowsPerGroup);
|
||||
rule.setEnable(true);
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.harmonic.pojo.param.report;
|
||||
|
||||
import com.njcn.harmonic.pojo.dto.report.CommReportLedgerDto;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2026-01-06
|
||||
* @Description: 谐波区域报告
|
||||
*/
|
||||
@Data
|
||||
public class AreaHarmReportParam {
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String deptId;
|
||||
|
||||
}
|
||||
@@ -48,6 +48,9 @@ public class HistoryDataResultVO implements Serializable {
|
||||
@ApiModelProperty("接线方式 0.星型 1.星三角 2.三角")
|
||||
private String wiringMethod;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("暂降事件详情")
|
||||
private List<EventDetailVO> eventDetail;
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
@@ -37,24 +40,44 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer frequencyMonitorNumber = 0;
|
||||
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> freqMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double frequencyBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double frequencyDayAvgBiLi = -1.0;
|
||||
|
||||
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
private Double frequencyOverDayBiLi = -1.0;
|
||||
|
||||
|
||||
//电压偏差超标情况
|
||||
/**
|
||||
* 个数
|
||||
*/
|
||||
private Integer voltageMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> voltageMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double voltageBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double voltageDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -65,10 +88,19 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer harmonicVoltageMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> harmonicVoltageMonitorList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double harmonicVoltageBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double harmonicVoltageDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -79,10 +111,18 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer harmonicCurrentMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> harmonicCurrentMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double harmonicCurrentBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double harmonicCurrentDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -93,10 +133,18 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer threePhaseVoltageMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> threePhaseVoltageMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double threePhaseVoltageBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double threePhaseVoltageDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -107,10 +155,18 @@ public class OverAreaLimitVO {
|
||||
* 个数
|
||||
*/
|
||||
private Integer flickerMonitorNumber = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> flickerMonitorList = new ArrayList<>();;
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double flickerBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double flickerDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -125,6 +181,10 @@ public class OverAreaLimitVO {
|
||||
* 占比
|
||||
*/
|
||||
private Double negativeBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double negativeDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
@@ -139,8 +199,48 @@ public class OverAreaLimitVO {
|
||||
* 占比
|
||||
*/
|
||||
private Double interHarmonicBiLi = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double interHarmonicDayAvgBiLi = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
private Double interHarmonicOverDayBiLi = -1.0;
|
||||
|
||||
|
||||
|
||||
private List<InnerHarmV> innerHarmVList;
|
||||
|
||||
|
||||
private List<InnerHarmV> innerHarmIList;
|
||||
|
||||
|
||||
@Data
|
||||
public static class InnerHarmV{
|
||||
|
||||
private String name;
|
||||
//谐波电压超标情况
|
||||
/**
|
||||
* 个数
|
||||
*/
|
||||
private Integer limitCount = 0;
|
||||
/**
|
||||
* 超标监测点集合,区域报告使用
|
||||
*/
|
||||
private List<String> limitIdList;
|
||||
|
||||
/**
|
||||
* 占比
|
||||
*/
|
||||
private Double limitRate = -1.0;
|
||||
/**
|
||||
* 日均超标占比
|
||||
*/
|
||||
private Double dayAvg = -1.0;
|
||||
/**
|
||||
* 平均超标天数
|
||||
*/
|
||||
private Double dayLimit = -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +31,7 @@ public class OverAreaVO extends DeviceInfoParam.BusinessParam{
|
||||
@Range(min = 1,message = "条数必须大于0")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("1.报告标志")
|
||||
private Integer areaReportFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.njcn.harmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: hongawen
|
||||
*/
|
||||
@Data
|
||||
public class SteadyQualifyDetailVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty("地市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty("供电公司")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStation;
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty("终端名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty("终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty("终端IP")
|
||||
private String ip;
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
@ApiModelProperty("监测点名称")
|
||||
private String lineName;
|
||||
|
||||
// @ApiModelProperty("终端运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||
// private String runFlag;
|
||||
//
|
||||
// @ApiModelProperty("终端通讯状态(0:中断;1:正常)")
|
||||
// private String comFlag;
|
||||
//
|
||||
// @ApiModelProperty("最新数据时间")
|
||||
// private LocalDateTime timeID;
|
||||
|
||||
/**
|
||||
* 谐波电压
|
||||
*/
|
||||
@ApiModelProperty("谐波电压")
|
||||
private Double harmonicVoltage =3.14159;
|
||||
/**
|
||||
* 电压偏差
|
||||
*/
|
||||
@ApiModelProperty("电压偏差")
|
||||
private Double voltageOffset =3.14159;
|
||||
/**
|
||||
* 相电压不平衡度
|
||||
*/
|
||||
@ApiModelProperty("相电压不平衡度")
|
||||
private Double voltageUnbalance =3.14159;
|
||||
/**
|
||||
* 间谐波电压含有率
|
||||
*/
|
||||
@ApiModelProperty("间谐波电压含有率")
|
||||
private Double interHarmonic =3.14159;
|
||||
/**
|
||||
* 谐波电流
|
||||
*/
|
||||
@ApiModelProperty("谐波电流")
|
||||
private Double harmonicCurrent =3.14159;
|
||||
/**
|
||||
* 负序电流
|
||||
*/
|
||||
@ApiModelProperty("负序电流")
|
||||
private Double negativeCurrent =3.14159;
|
||||
/**
|
||||
* 频率偏差
|
||||
*/
|
||||
@ApiModelProperty("频率偏差")
|
||||
private Double freqOffset =3.14159;
|
||||
/**
|
||||
* 闪变
|
||||
*/
|
||||
@ApiModelProperty("闪变")
|
||||
private Double flicker =3.14159;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
package com.njcn.harmonic.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.harmonic.pojo.dto.report.TableMergeRule;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -26,7 +29,13 @@ public class WordUtil2 {
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList, HttpServletResponse response)
|
||||
// 保留原有getWord方法(兼容旧调用,无合并规则时直接执行)
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,
|
||||
List<List<String[]>> tableList, HttpServletResponse response) throws Exception {
|
||||
this.getWord(path, params, fileName, tableList, null, response);
|
||||
}
|
||||
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList,List<TableMergeRule> mergeRules, HttpServletResponse response)
|
||||
throws Exception {
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
InputStream inStream = null;
|
||||
@@ -35,20 +44,29 @@ public class WordUtil2 {
|
||||
try {
|
||||
inStream = new ClassPathResource(path).getInputStream();;
|
||||
doc = new CustomXWPFDocument(inStream);
|
||||
// 替换表格里面的变量
|
||||
if(CollUtil.isNotEmpty(tableList)){
|
||||
this.replaceInTable(doc, params,tableList);
|
||||
}else{
|
||||
this.replaceInTable(doc, params);
|
||||
}
|
||||
// 替换表格里面的变量
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
// 替换文本里面的变量
|
||||
this.replaceInPara(doc, params);
|
||||
|
||||
//新增:执行动态合并规则
|
||||
if(CollUtil.isNotEmpty(mergeRules)) {
|
||||
this.dynamicMergeTables(doc, mergeRules);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
@@ -223,6 +241,74 @@ public class WordUtil2 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* public static void processParagraphs(List<XWPFParagraph> paragraphList, Map<String, Object> param,
|
||||
CustomXWPFDocument doc) {
|
||||
if (paragraphList != null && !paragraphList.isEmpty()) {
|
||||
for (XWPFParagraph paragraph : paragraphList) {
|
||||
// 先获取整个段落的完整文本
|
||||
String fullText = paragraph.getText();
|
||||
|
||||
// 检查是否包含变量
|
||||
boolean hasVariable = false;
|
||||
for (String key : param.keySet()) {
|
||||
if (fullText.contains(key)) {
|
||||
hasVariable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasVariable) {
|
||||
// 进行变量替换
|
||||
String replacedText = fullText;
|
||||
boolean hasImage = false;
|
||||
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (replacedText.contains(key)) {
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
replacedText = replacedText.replace(key, value.toString());
|
||||
} else if (value instanceof Map) {
|
||||
// 处理图片:需要特殊处理
|
||||
hasImage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasImage) {
|
||||
// 如果没有图片,直接替换整个段落文本
|
||||
// 清空原有 Runs
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
for (int i = runs.size() - 1; i >= 0; i--) {
|
||||
paragraph.removeRun(i);
|
||||
}
|
||||
|
||||
// 创建新的 Run
|
||||
XWPFRun newRun = paragraph.createRun();
|
||||
newRun.setText(replacedText);
|
||||
} else {
|
||||
// 有图片的情况:逐个 Run 处理(保留原逻辑)
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
for (XWPFRun run : runs) {
|
||||
String text = run.getText(0);
|
||||
if (text != null) {
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (text.contains(key)) {
|
||||
// ... 原图片处理逻辑
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 替换段落里面的变量
|
||||
*
|
||||
@@ -292,33 +378,6 @@ public class WordUtil2 {
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 为表格插入数据,行数不够添加新行
|
||||
*
|
||||
* @param table 需要插入数据的表格
|
||||
* @param tableList 插入数据集合
|
||||
*/
|
||||
private static void insertTable(XWPFTable table, List<String[]> tableList) {
|
||||
//删除占位符行数
|
||||
table.removeRow(1);
|
||||
if (CollUtil.isNotEmpty(tableList)) {
|
||||
// 创建行,根据需要插入的数据添加新行,不处理表头
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
XWPFTableRow row = table.createRow();
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
for (int j = 0; j < cells.size(); j++) {
|
||||
String s = tableList.get(i)[j];
|
||||
XWPFTableCell cell = cells.get(j);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph paragraph = cell.addParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
// 在段落中添加文本
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换表格里面的变量
|
||||
@@ -350,6 +409,7 @@ public class WordUtil2 {
|
||||
}else {
|
||||
if (CollUtil.isNotEmpty(tableList.get(num))){
|
||||
insertTable(table, tableList.get(num)); // 插入数据
|
||||
|
||||
}
|
||||
num++;
|
||||
}
|
||||
@@ -357,6 +417,53 @@ public class WordUtil2 {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为表格插入数据,行数不够添加新行
|
||||
*
|
||||
* @param table 需要插入数据的表格
|
||||
* @param tableList 插入数据集合
|
||||
*/
|
||||
private static void insertTable(XWPFTable table, List<String[]> tableList) {
|
||||
//删除占位符行数
|
||||
table.removeRow(1);
|
||||
if (CollUtil.isNotEmpty(tableList)) {
|
||||
// 创建行,根据需要插入的数据添加新行,不处理表头
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
XWPFTableRow row = table.createRow();
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
String[] rowData = tableList.get(i);
|
||||
|
||||
for (int j = 0; j < cells.size(); j++) {
|
||||
String s = tableList.get(i)[j];
|
||||
XWPFTableCell cell = cells.get(j);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph paragraph = cell.addParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
// 在段落中添加文本
|
||||
XWPFRun run = paragraph.createRun();
|
||||
// 处理普通数据
|
||||
if (j < rowData.length && !rowData[j].startsWith("merge:")) {
|
||||
run.setText(rowData[j] == null ? "" : rowData[j]);
|
||||
}
|
||||
// 处理合并配置
|
||||
else if (j < rowData.length && rowData[j].startsWith("merge:")) {
|
||||
String[] mergeParams = rowData[j].replace("merge:", "").split(",");
|
||||
int rowMerge = Integer.parseInt(mergeParams[0]);
|
||||
int colMerge = Integer.parseInt(mergeParams[1]);
|
||||
// 调用合并方法
|
||||
setCellMerge(cell, rowMerge, colMerge);
|
||||
// 清空跨列后续单元格
|
||||
for (int k = j + 1; k < j + colMerge && k < cells.size(); k++) {
|
||||
cells.get(k).removeParagraph(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 正则匹配字符串
|
||||
*
|
||||
@@ -398,4 +505,144 @@ public class WordUtil2 {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 适配 POI 4.1.1 的单元格合并核心方法
|
||||
* @param cell 要合并的单元格
|
||||
* @param rowMerge 纵向合并行数(1=不合并,>1=合并行数)
|
||||
* @param colMerge 横向合并列数(1=不合并,>1=合并列数)
|
||||
*/
|
||||
private static void setCellMerge(XWPFTableCell cell, int rowMerge, int colMerge) {
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.getTcPr() == null ? ctTc.addNewTcPr() : ctTc.getTcPr();
|
||||
tcPr.addNewVAlign().setVal(STVerticalJc.CENTER);
|
||||
|
||||
// 1. 横向合并(跨列)- POI 4.1.1 写法
|
||||
if (colMerge > 1) {
|
||||
// 直接创建 gridSpan 并设置值
|
||||
tcPr.addNewGridSpan().setVal(BigInteger.valueOf(colMerge));
|
||||
}
|
||||
|
||||
// 2. 纵向合并(跨行)- POI 4.1.1 写法
|
||||
if (rowMerge > 1) {
|
||||
// 起始单元格标记为 RESTART
|
||||
tcPr.addNewVMerge().setVal(STMerge.RESTART);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配 POI 4.1.1 的表格单元格合并工具方法
|
||||
* @param table Word表格对象
|
||||
* @param rowIndex 行索引(从0开始)
|
||||
* @param colIndex 列索引(从0开始)
|
||||
* @param mergeRows 跨行数(如2表示合并当前行和下一行)
|
||||
* @param mergeCols 跨列数(如2表示合并当前列和下一列)
|
||||
*/
|
||||
public static void mergeTableCell(XWPFTable table, int rowIndex, int colIndex, int mergeRows, int mergeCols) {
|
||||
// 参数校验
|
||||
if (table == null || rowIndex < 0 || colIndex < 0 || mergeRows < 1 || mergeCols < 1) {
|
||||
log.error("表格合并参数无效:行{} 列{} 跨行{} 跨列{}", rowIndex, colIndex, mergeRows, mergeCols);
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取目标行和单元格
|
||||
XWPFTableRow targetRow = table.getRow(rowIndex);
|
||||
if (targetRow == null) {
|
||||
log.error("指定行不存在:{}", rowIndex);
|
||||
return;
|
||||
}
|
||||
XWPFTableCell targetCell = targetRow.getCell(colIndex);
|
||||
if (targetCell == null) {
|
||||
log.error("指定列不存在:{}", colIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置起始单元格的合并属性
|
||||
setCellMerge(targetCell, mergeRows, mergeCols);
|
||||
|
||||
// 处理跨行合并的后续单元格(标记为 CONTINUE)
|
||||
for (int i = rowIndex + 1; i < rowIndex + mergeRows; i++) {
|
||||
XWPFTableRow row = table.getRow(i);
|
||||
if (row == null) break;
|
||||
|
||||
XWPFTableCell cell = row.getCell(colIndex);
|
||||
if (cell == null) continue;
|
||||
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.getTcPr() == null ? ctTc.addNewTcPr() : ctTc.getTcPr();
|
||||
// 后续单元格标记为 CONTINUE
|
||||
tcPr.addNewVMerge().setVal(STMerge.CONTINUE);
|
||||
}
|
||||
|
||||
// 处理跨列合并的后续单元格(清空并标记为 CONTINUE)
|
||||
for (int j = colIndex + 1; j < colIndex + mergeCols; j++) {
|
||||
XWPFTableCell cell = targetRow.getCell(j);
|
||||
if (cell == null) break;
|
||||
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.getTcPr() == null ? ctTc.addNewTcPr() : ctTc.getTcPr();
|
||||
tcPr.addNewVMerge().setVal(STMerge.CONTINUE);
|
||||
// 清空跨列后续单元格的内容
|
||||
cell.removeParagraph(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ========== 新增:动态合并核心方法 ==========
|
||||
/**
|
||||
* 动态执行多个表格的合并规则
|
||||
* @param doc Word文档对象
|
||||
* @param mergeRules 合并规则列表
|
||||
*/
|
||||
public void dynamicMergeTables(CustomXWPFDocument doc, List<TableMergeRule> mergeRules) {
|
||||
// 遍历文档中的所有表格,按规则合并
|
||||
Iterator<XWPFTable> tableIterator = doc.getTablesIterator();
|
||||
int currentTableIndex = 0; // 当前遍历到的表格索引(从0开始)
|
||||
while (tableIterator.hasNext()) {
|
||||
XWPFTable table = tableIterator.next();
|
||||
// 查找当前表格是否有匹配的合并规则
|
||||
for (TableMergeRule rule : mergeRules) {
|
||||
if (rule.isEnable() && rule.getTableIndex().equals(currentTableIndex)) {
|
||||
// 执行该表格的合并规则
|
||||
mergeTableByRule(table, rule);
|
||||
break; // 一个表格只执行一条规则,避免重复处理
|
||||
}
|
||||
}
|
||||
currentTableIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单条规则合并指定表格(支持指定起始行)
|
||||
* @param table 要合并的表格
|
||||
* @param rule 合并规则
|
||||
*/
|
||||
private void mergeTableByRule(XWPFTable table, TableMergeRule rule) {
|
||||
if (table == null || rule == null || !rule.isEnable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int totalRows = table.getRows().size();
|
||||
int mergeCol = rule.getMergeColIndex();
|
||||
int startRow = rule.getStartRow(); // 新增:获取指定的起始行
|
||||
int mergeRowsPerGroup = rule.getMergeRowsPerGroup();
|
||||
|
||||
// 参数校验:起始行不能大于总行数、行数不足、列索引非法、合并行数小于2
|
||||
if (startRow >= totalRows || totalRows < 2 || mergeCol < 0 || mergeRowsPerGroup < 2) {
|
||||
log.warn("表格{}合并规则无效:总行数{} 起始行{} 合并列{} 每组行数{}",
|
||||
rule.getTableIndex(), totalRows, startRow, mergeCol, mergeRowsPerGroup);
|
||||
return;
|
||||
}
|
||||
|
||||
// 核心改动:从startRow开始,每mergeRowsPerGroup行合并一组
|
||||
for (int currentStart = startRow; currentStart < totalRows; currentStart += mergeRowsPerGroup) {
|
||||
// 最后一组可能不足N行,取实际行数
|
||||
int actualMergeRows = Math.min(mergeRowsPerGroup, totalRows - currentStart);
|
||||
// 复用原有mergeTableCell方法执行合并
|
||||
mergeTableCell(table, currentStart, mergeCol, actualMergeRows, 1);
|
||||
}
|
||||
log.info("表格{}合并完成:第{}列 从第{}行开始 每{}行合并一次",
|
||||
rule.getTableIndex(), mergeCol, startRow, mergeRowsPerGroup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.harmonic.rstatlimitrate.controller;
|
||||
package com.njcn.harmonic.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -12,7 +12,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.harmonic.pojo.param.*;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.vo.*;
|
||||
import com.njcn.harmonic.rstatlimitrate.service.IRStatLimitRateDService;
|
||||
import com.njcn.harmonic.service.IRStatLimitRateDService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.harmonic.rstatlimitrate.controller;
|
||||
package com.njcn.harmonic.controller;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
@@ -15,7 +15,7 @@ import com.njcn.harmonic.pojo.vo.LimitCalendarVO;
|
||||
import com.njcn.harmonic.pojo.vo.LimitExtentVO;
|
||||
import com.njcn.harmonic.pojo.vo.LimitProbabilityVO;
|
||||
import com.njcn.harmonic.pojo.vo.LimitTimeProbabilityVO;
|
||||
import com.njcn.harmonic.rstatlimitrate.service.IRStatLimitRateDetailDService;
|
||||
import com.njcn.harmonic.service.IRStatLimitRateDetailDService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
|
||||
import com.njcn.harmonic.service.SteadyQualifyService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -69,4 +70,14 @@ public class SteadyQualifyController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSteadyQualifyTableData")
|
||||
@ApiOperation("稳态合格率列表(曲靖)")
|
||||
@ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
|
||||
public HttpResult<List<SteadyQualifyDetailVO>> getSteadyQualifyTableData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
|
||||
String methodDescribe = getMethodDescribe("getSteadyQualifyTableData");
|
||||
List<SteadyQualifyDetailVO> list = steadyQualifyService.getSteadyQualifyTableData(steadyParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.harmonic.pojo.THDistortionDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.RMpVThdVO;
|
||||
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionCensusVO;
|
||||
import com.njcn.harmonic.pojo.vo.THDistortionVO;
|
||||
import com.njcn.harmonic.service.THDistortionService;
|
||||
@@ -48,6 +50,18 @@ public class THDController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTHDistortionTableData")
|
||||
@ApiOperation("谐波总畸变率列表(曲靖)")
|
||||
@ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
|
||||
public HttpResult<List<THDistortionDetailVO>> getTHDistortionTableData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
|
||||
String methodDescribe = getMethodDescribe("getTHDistortionTableData");
|
||||
List<THDistortionDetailVO> list = thDistortionService.getTHDistortionTableData(steadyParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getNodeTHDistortionData")
|
||||
@ApiOperation("谐波总畸变率节点图")
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.njcn.harmonic.controller.report;
|
||||
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.harmonic.pojo.dto.FpyReportDTO;
|
||||
import com.njcn.harmonic.pojo.param.QualifiedReportParam;
|
||||
import com.njcn.harmonic.pojo.param.report.AreaHarmReportParam;
|
||||
import com.njcn.harmonic.service.majornetwork.QualifiedReportService;
|
||||
import com.njcn.harmonic.service.report.AreaHarmonicService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 合格率报告
|
||||
* @author cdf
|
||||
* @date 2023/5/31
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/areaHarmonicReport")
|
||||
@Api(tags = "区域稳态报告")
|
||||
@RequiredArgsConstructor
|
||||
public class AreaHarmonicReportController extends BaseController {
|
||||
|
||||
private final AreaHarmonicService areaHarmonicService;
|
||||
|
||||
/**
|
||||
* 区域稳态报告
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/areaHarmonicReport")
|
||||
@ApiOperation("导出区域稳态报告")
|
||||
public void areaHarmonicReport(@RequestBody AreaHarmReportParam areaHarmReportParam, HttpServletResponse response) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
String methodDescribe = getMethodDescribe("areaHarmonicReport");
|
||||
areaHarmonicService.areaHarmonicReport(areaHarmReportParam,response);
|
||||
|
||||
log.info("区域稳态报告执行时长:"+timeInterval.interval());
|
||||
//return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,10 +10,10 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
import com.njcn.harmonic.pojo.param.ReportTemplateParam;
|
||||
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.harmonic.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.harmonic.pojo.vo.ReportTreeVO;
|
||||
import com.njcn.harmonic.pojo.vo.SysDeptTempVO;
|
||||
import com.njcn.harmonic.service.CustomReportService;
|
||||
import com.njcn.harmonic.service.report.CustomReportService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.njcn.harmonic.controller.report;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.api.DeviceUnitClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
|
||||
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
|
||||
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/exportmodel")
|
||||
@Api(tags = "word报告")
|
||||
@AllArgsConstructor
|
||||
public class ExportModelController extends BaseController {
|
||||
|
||||
private final MonitorHarmonicReportService monitorHarmonicReportService;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
private final DeviceUnitClient deviceUnitClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
/**
|
||||
* @param response
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param type 区分pq:0 pms:1
|
||||
* @param lineIndex 监测点id
|
||||
* @param name 监测点名称
|
||||
* @param reportNumber 客户编号
|
||||
* @param crmName 客户名称
|
||||
* @param file 接线图
|
||||
* @param isUrl 是否地址栏返回
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/exportModel")
|
||||
@ApiOperation("word报告")
|
||||
public void exportWorld(HttpServletResponse response,
|
||||
@RequestParam(value ="startTime",required = false) String startTime,
|
||||
@RequestParam(value ="endTime",required = false) String endTime,
|
||||
@RequestParam(value ="type",required = false) Integer type,
|
||||
@RequestParam(value ="lineIndex",required = false) String lineIndex,
|
||||
@RequestParam(value ="name",required = false) String name,
|
||||
@RequestParam(value ="reportNumber",required = false) String reportNumber,
|
||||
@RequestParam(value ="crmName",required = false) String crmName,
|
||||
@RequestParam(value = "isUrl",required = false) Boolean isUrl,
|
||||
@RequestPart(value ="file",required = false) MultipartFile file) throws IOException {
|
||||
String methodDescribe = getMethodDescribe("exportWorld");
|
||||
|
||||
HarmLineDetailDataCommDTO harmLineDetailDataCommDTO;
|
||||
OverLimitInfoCommDTO overLimitInfoCommDTO;
|
||||
DeviceUnitCommDTO deviceUnitCommDTO;
|
||||
|
||||
LineDetailDataVO lineDto = new LineDetailDataVO();
|
||||
Overlimit overLimit = new Overlimit();
|
||||
PqsDeviceUnit deviceUnit = new PqsDeviceUnit();
|
||||
if(type == 1) {
|
||||
//河北pms
|
||||
List<Monitor> monitorList = monitorClient.getMonitorList(Collections.singletonList(lineIndex)).getData();
|
||||
if (ObjectUtil.isNull(monitorList)) {
|
||||
throw new BusinessException(EventResponseEnum.NOT_FOUND);
|
||||
}
|
||||
Monitor monitor = monitorList.get(0);
|
||||
lineDto.setBdName(monitor.getPowerrName());
|
||||
|
||||
lineDto.setAreaName(monitor.getOrgName());
|
||||
|
||||
lineDto.setPt(monitor.getPt1() + "/" + monitor.getPt2());
|
||||
lineDto.setCt(monitor.getCt1() + "/" + monitor.getCt2());
|
||||
//基准容量
|
||||
lineDto.setStandardCapacity(monitor.getStandShortCapacity());
|
||||
//短路容量
|
||||
lineDto.setShortCapacity(monitor.getMinShortCircuitCapacity());
|
||||
//协议容量
|
||||
lineDto.setDealCapacity(monitor.getUserAgreementCapacity());
|
||||
//设备容量
|
||||
lineDto.setDevCapacity(monitor.getPowerSupplyEqCapacity());
|
||||
//电压等级
|
||||
lineDto.setScale(dicDataFeignClient.getDicDataById(monitor.getVoltageLevel()).getData().getName());
|
||||
|
||||
overLimit = monitorClient.getOverLimitData(monitor.getId()).getData();
|
||||
}else {
|
||||
//通用
|
||||
lineDto = lineFeignClient.getLineDetailData(lineIndex).getData();
|
||||
overLimit = lineFeignClient.getOverLimitData(lineIndex).getData();
|
||||
|
||||
}
|
||||
//数据单位
|
||||
deviceUnit = deviceUnitClient.lineUnitDetail(lineIndex).getData();
|
||||
|
||||
harmLineDetailDataCommDTO = BeanUtil.copyProperties(lineDto, HarmLineDetailDataCommDTO.class);
|
||||
overLimitInfoCommDTO = BeanUtil.copyProperties(overLimit, OverLimitInfoCommDTO.class);
|
||||
deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class);
|
||||
|
||||
|
||||
|
||||
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.njcn.harmonic.controller;
|
||||
package com.njcn.harmonic.controller.report;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -25,7 +26,6 @@ import com.njcn.event.pojo.param.EventCountParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.harmonic.pojo.param.ReportQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.report.EnumPass;
|
||||
import com.njcn.harmonic.pojo.po.report.OverLimitInfo;
|
||||
import com.njcn.harmonic.pojo.po.report.Pass;
|
||||
import com.njcn.harmonic.pojo.po.report.ReportTarget;
|
||||
import com.njcn.harmonic.pojo.vo.ReportValue;
|
||||
@@ -145,7 +145,7 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
bdname = lineDto.getBdName();
|
||||
areaName = lineDto.getAreaName();
|
||||
if(areaName.equals("冀北")){
|
||||
if("冀北".equals(areaName)){
|
||||
areaName="国网"+areaName;
|
||||
}
|
||||
pttype = PubUtils.ptTypeName(lineDto.getPtType());
|
||||
@@ -198,18 +198,14 @@ public class ExportModelJBController extends BaseController {
|
||||
param.setB(day == 0);
|
||||
|
||||
//限值
|
||||
OverLimitInfo overLimitData = reportService.getOverLimitData(param);
|
||||
Overlimit overLimit;
|
||||
if (type == 0) {
|
||||
overLimit = lineFeignClient.getOverLimitData(param.getLineId()).getData();
|
||||
} else {
|
||||
overLimit = monitorClient.getOverLimitData(param.getLineId()).getData();
|
||||
}
|
||||
param.setCount(overLimitData.getCount());
|
||||
overLimitData.setOverLimitRate(Arrays.asList(overLimit));
|
||||
|
||||
|
||||
if (0 == overLimitData.getOverLimitRate().size()) {
|
||||
if (ObjUtil.isNull(overLimit)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "dataFail", methodDescribe);
|
||||
}
|
||||
|
||||
@@ -237,7 +233,7 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> reportmap = new HashMap<>();// 报告Map
|
||||
Map<String, Object> reportmap = new HashMap<>(200);
|
||||
//数据单位
|
||||
PqsDeviceUnit deviceUnit = deviceUnitClient.lineUnitDetail(lineIndex).getData();
|
||||
reportmap.putAll(unitMap(deviceUnit));
|
||||
@@ -245,7 +241,7 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$btype$", btype);
|
||||
reportmap.put("$ctype$", ctype);
|
||||
|
||||
Map<String, Object> header = new HashMap<String, Object>();
|
||||
Map<String, Object> header = new HashMap<String, Object>(2);
|
||||
if (ObjectUtil.isNotEmpty(file)) {
|
||||
byte[] bytes = file.getBytes();
|
||||
if(bytes.length>0){
|
||||
@@ -302,16 +298,24 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$image$", header);
|
||||
|
||||
getVirtualData(param);
|
||||
ReportValue voltage1 = this.listVirtual.get(0).getList().get(0);// 电压幅值
|
||||
ReportValue voltage2 = this.listVirtual.get(0).getList().get(1);// 电压幅值
|
||||
ReportValue voltage3 = this.listVirtual.get(0).getList().get(2);// 电压幅值
|
||||
ReportValue current1 = this.listVirtual.get(1).getList().get(0);// 电流幅值
|
||||
ReportValue current2 = this.listVirtual.get(1).getList().get(1);// 电流幅值
|
||||
ReportValue current3 = this.listVirtual.get(1).getList().get(2);// 电流幅值
|
||||
//电压幅值
|
||||
ReportValue voltage1 = this.listVirtual.get(0).getList().get(0);
|
||||
// 电压幅值
|
||||
ReportValue voltage2 = this.listVirtual.get(0).getList().get(1);
|
||||
// 电压幅值
|
||||
ReportValue voltage3 = this.listVirtual.get(0).getList().get(2);
|
||||
// 电流幅值
|
||||
ReportValue current1 = this.listVirtual.get(1).getList().get(0);
|
||||
// 电流幅值
|
||||
ReportValue current2 = this.listVirtual.get(1).getList().get(1);
|
||||
// 电流幅值
|
||||
ReportValue current3 = this.listVirtual.get(1).getList().get(2);
|
||||
|
||||
String strLineBaseName = String.format("%s%s", new String[]{bdname + "_", name});
|
||||
String strAnalysis = "";// 分析建议
|
||||
String strError = "";// 报表错误
|
||||
// 分析建议
|
||||
String strAnalysis = "";
|
||||
// 报表错误
|
||||
String strError = "";
|
||||
|
||||
/**************************************************************
|
||||
**** 基波电压/电流有效值表格
|
||||
@@ -421,8 +425,9 @@ public class ExportModelJBController extends BaseController {
|
||||
int iCount = 0;
|
||||
// 判断所取的基波电压、基波电流值是否为null
|
||||
for (Object value : reportmap.values()) {
|
||||
if (value == null)
|
||||
if (value == null){
|
||||
iCount++;
|
||||
}
|
||||
}
|
||||
// 假如所有的数据都为null,则返回(所选的时间段内未找到数据)
|
||||
if (iCount == reportmap.size()) {
|
||||
@@ -485,50 +490,65 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
}
|
||||
reportmap.put("$BaseVIResult$", strBaseVIResult);
|
||||
if (!"".equals(strBaseVIResult))
|
||||
if (!"".equals(strBaseVIResult)){
|
||||
strError += strBaseVIResult;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
**** 所选的时间段内有数据存在则进行其他加载
|
||||
***************************************************************/
|
||||
|
||||
// Depts dep = R.getCurrentDept();
|
||||
// String detpName = dep.getArea();
|
||||
reportmap.put("$detpName$", areaName); // 区域名称
|
||||
// 区域名称
|
||||
reportmap.put("$detpName$", areaName);
|
||||
// 获取报告生成时间
|
||||
Date currentTime = new Date();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");// 报告时分秒格式
|
||||
// 报告时分秒格式
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
|
||||
String strTime = String.format("%s——%s。",
|
||||
new String[]{DateUtil.format(startDate, "yyyy年MM月dd日 HH时mm分ss秒"),
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒")});
|
||||
reportmap.put("$number$", StrUtil.isBlank(reportNumber)?"":reportNumber); // 报告编号
|
||||
reportmap.put("$titlePoint$",StrUtil.isBlank(crmName)?"":crmName); // 客户名称
|
||||
|
||||
reportmap.put("$TitleTime$", formatter.format(currentTime)); // 报告生成时间
|
||||
reportmap.put("$ReportTitle$",
|
||||
String.format("对该地区%s电能质量在线监测数据进行分析, 以判断电能质量指标是否满足国标。", new String[]{strLineBaseName}));// 报告标题
|
||||
reportmap.put("$ReportTime$", strTime);// 报告分析时间段
|
||||
reportmap.put("$RunBaseName$", String.format("以下将对%s电能质量统计数据进行分析,数据包括基波电压/电流、谐波电压/电流、电压偏差、频率偏差、电压总谐波畸变率、2-25次谐波电压含有率、2-25次谐波电流、0.5-15.5次间谐波电压含有率、负序电压不平衡度、负序电流、电压闪变。",
|
||||
new String[]{strLineBaseName}));// 运行数据分析
|
||||
reportmap.put("$BaseVITable$", String.format("报告分析时间段内%s的基波电压/电流分钟统计数据见下表。", new String[]{strLineBaseName}));// 基波电压和电流
|
||||
reportmap.put("$VDTable$", String.format("报告分析时间段内%s的电压偏差统计数据见下表。", new String[]{strLineBaseName}));// 供电电压偏差
|
||||
reportmap.put("$FRETable$", String.format("报告分析时间段内%s的频率偏差统计数据见下表。", new String[]{strLineBaseName}));// 频率偏差
|
||||
reportmap.put("$THETable$", String.format("报告分析时间段内%s的三相电压不平衡度统计数据见下表。", new String[]{strLineBaseName}));// 三相电压不平衡度
|
||||
reportmap.put("$PLTTable$", String.format("报告分析时间段内%s的闪变统计数据见下表。", new String[]{strLineBaseName}));// 闪变
|
||||
reportmap.put("$ThdTable$", String.format("报告分析时间段内%s的电压总谐波畸变率统计数据见下表。", new String[]{strLineBaseName}));// 电压总谐波畸变率
|
||||
reportmap.put("$IneTable$", String.format("报告分析时间段内%s的负序电流统计数据见下表。", new String[]{strLineBaseName}));// 负序电流
|
||||
reportmap.put("$RVTable$",
|
||||
String.format("报告分析时间段内%s的2-25次谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));// 谐波电压
|
||||
reportmap.put("$INTable$",
|
||||
String.format("报告分析时间段内%s的0.5-15.5次间谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));// 间谐波
|
||||
reportmap.put("$RITable$",
|
||||
String.format("报告分析时间段内%s的2-25次谐波电流幅值CP95概率值统计数据见下表。", new String[]{strLineBaseName}));// 谐波电流
|
||||
|
||||
reportmap.put("$LineName1$", name);// 监测点名称1
|
||||
reportmap.put("$LineName2$", name);// 监测点名称2
|
||||
reportmap.put("$LineName3$", name);// 监测点名称3
|
||||
reportmap.put("$LineName4$", name);// 监测点名称4
|
||||
reportmap.put("$LineName5$", name);// 监测点名称5
|
||||
// 报告编号
|
||||
reportmap.put("$number$", StrUtil.isBlank(reportNumber)?"":reportNumber);
|
||||
// 客户名称
|
||||
reportmap.put("$titlePoint$",StrUtil.isBlank(crmName)?"":crmName);
|
||||
// 报告生成时间
|
||||
reportmap.put("$TitleTime$", formatter.format(currentTime));
|
||||
// 报告标题
|
||||
reportmap.put("$ReportTitle$", String.format("对该地区%s电能质量在线监测数据进行分析, 以判断电能质量指标是否满足国标。", new String[]{strLineBaseName}));
|
||||
// 报告分析时间段
|
||||
reportmap.put("$ReportTime$", strTime);
|
||||
// 运行数据分析
|
||||
reportmap.put("$RunBaseName$", String.format("以下将对%s电能质量统计数据进行分析,数据包括基波电压/电流、谐波电压/电流、电压偏差、频率偏差、电压总谐波畸变率、2-25次谐波电压含有率、2-25次谐波电流、0.5-15.5次间谐波电压含有率、负序电压不平衡度、负序电流、电压闪变。", new String[]{strLineBaseName}));
|
||||
// 基波电压和电流
|
||||
reportmap.put("$BaseVITable$", String.format("报告分析时间段内%s的基波电压/电流分钟统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 供电电压偏差
|
||||
reportmap.put("$VDTable$", String.format("报告分析时间段内%s的电压偏差统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 频率偏差
|
||||
reportmap.put("$FRETable$", String.format("报告分析时间段内%s的频率偏差统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 三相电压不平衡度
|
||||
reportmap.put("$THETable$", String.format("报告分析时间段内%s的三相电压不平衡度统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 闪变
|
||||
reportmap.put("$PLTTable$", String.format("报告分析时间段内%s的闪变统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 电压总谐波畸变率
|
||||
reportmap.put("$ThdTable$", String.format("报告分析时间段内%s的电压总谐波畸变率统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 负序电流
|
||||
reportmap.put("$IneTable$", String.format("报告分析时间段内%s的负序电流统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 谐波电压
|
||||
reportmap.put("$RVTable$", String.format("报告分析时间段内%s的2-25次谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 间谐波
|
||||
reportmap.put("$INTable$", String.format("报告分析时间段内%s的0.5-15.5次间谐波电压含有率CP95概率值统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 谐波电流
|
||||
reportmap.put("$RITable$", String.format("报告分析时间段内%s的2-25次谐波电流幅值CP95概率值统计数据见下表。", new String[]{strLineBaseName}));
|
||||
// 监测点名称1
|
||||
reportmap.put("$LineName1$", name);
|
||||
// 监测点名称2
|
||||
reportmap.put("$LineName2$", name);
|
||||
// 监测点名称3
|
||||
reportmap.put("$LineName3$", name);
|
||||
// 监测点名称4
|
||||
reportmap.put("$LineName4$", name);
|
||||
// 监测点名称5
|
||||
reportmap.put("$LineName5$", name);
|
||||
|
||||
/**********************
|
||||
**** 数据获取
|
||||
@@ -544,16 +564,20 @@ public class ExportModelJBController extends BaseController {
|
||||
getCurrentRate(param, overLimit);
|
||||
getInRate(param, overLimit);
|
||||
getIne(param, overLimit);
|
||||
|
||||
ReportValue pst1 = this.listFlicker.get(0).getList().get(0);// 短闪
|
||||
ReportValue pst2 = this.listFlicker.get(0).getList().get(1);// 短闪
|
||||
ReportValue pst3 = this.listFlicker.get(0).getList().get(2);// 短闪
|
||||
ReportValue plt1 = this.listFlicker.get(1).getList().get(0);// 长闪
|
||||
ReportValue plt2 = this.listFlicker.get(1).getList().get(1);// 长闪
|
||||
ReportValue plt3 = this.listFlicker.get(1).getList().get(2);// 长闪
|
||||
|
||||
reportmap.put("$LineBase$", String.format("%s%s,CT变比为:%s,PT变比为:%s。",
|
||||
new String[]{bdname, name, lineDto.getCt(), lineDto.getPt()}));// 监测点基本信息
|
||||
// 短闪 A
|
||||
ReportValue pst1 = this.listFlicker.get(0).getList().get(0);
|
||||
// 短闪 B
|
||||
ReportValue pst2 = this.listFlicker.get(0).getList().get(1);
|
||||
// 短闪 C
|
||||
ReportValue pst3 = this.listFlicker.get(0).getList().get(2);
|
||||
// 长闪 A
|
||||
ReportValue plt1 = this.listFlicker.get(1).getList().get(0);
|
||||
// 长闪 B
|
||||
ReportValue plt2 = this.listFlicker.get(1).getList().get(1);
|
||||
// 长闪 C
|
||||
ReportValue plt3 = this.listFlicker.get(1).getList().get(2);
|
||||
// 监测点基本信息
|
||||
reportmap.put("$LineBase$", String.format("%s%s,CT变比为:%s,PT变比为:%s。", new String[]{bdname, name, lineDto.getCt(), lineDto.getPt()}));
|
||||
|
||||
/**************************************************************
|
||||
**** 三张大表基础数据幅值
|
||||
@@ -604,74 +628,105 @@ public class ExportModelJBController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 电压偏差(上偏差和下偏差)
|
||||
***************************************************************/
|
||||
ReportValue vdeviation1 = this.listVdeviation.get(0).getList().get(0);
|
||||
ReportValue vdeviation2 = this.listVdeviation.get(0).getList().get(1);
|
||||
ReportValue vdeviation3 = this.listVdeviation.get(0).getList().get(2);
|
||||
String vdeviationLimit = judgeNull(this.listVdeviation.get(0).getOverLimit());// 获取电压上下偏差的国标限值
|
||||
// 获取电压上偏差的国标限值
|
||||
String vdeviationLimit = judgeNull(this.listVdeviation.get(0).getOverLimit());
|
||||
reportmap.put("$VD_L$", vdeviationLimit);
|
||||
reportmap.put("$VD_U$", judgeNull(this.listVdeviation.get(1).getOverLimit()));
|
||||
//获取电压下偏差的国标限值
|
||||
String ldeviationLimit = judgeNull(this.listVdeviation.get(1).getOverLimit());
|
||||
reportmap.put("$VD_U$", ldeviationLimit);
|
||||
String strResultVdeviationdata = "";
|
||||
String tmpstrResultVdeviationdata = "";
|
||||
String strResultVdeviationdataValue = "";
|
||||
// 获取电压偏差
|
||||
String tmpstrMap = "";
|
||||
reportmap.put("$VDTX_A$", judgeNull(vdeviation1.getFmaxValue()));
|
||||
reportmap.put("$VDTN_A$", judgeNull(vdeviation1.getMinValue()));
|
||||
reportmap.put("$VDTE_A$", judgeNull(vdeviation1.getMeanValue()));
|
||||
reportmap.put("$VDT%_A$", judgeNull(vdeviation1.getCp95Value()));
|
||||
reportmap.put("$VDTX_B$", judgeNull(vdeviation2.getFmaxValue()));
|
||||
reportmap.put("$VDTN_B$", judgeNull(vdeviation2.getMinValue()));
|
||||
reportmap.put("$VDTE_B$", judgeNull(vdeviation2.getMeanValue()));
|
||||
reportmap.put("$VDT%_B$", judgeNull(vdeviation2.getCp95Value()));
|
||||
if (pttype != 2) {
|
||||
reportmap.put("$VDTX_C$", judgeNull(vdeviation3.getFmaxValue()));
|
||||
reportmap.put("$VDTN_C$", judgeNull(vdeviation3.getMinValue()));
|
||||
reportmap.put("$VDTE_C$", judgeNull(vdeviation3.getMeanValue()));
|
||||
reportmap.put("$VDT%_C$", judgeNull(vdeviation3.getCp95Value()));
|
||||
} else {
|
||||
reportmap.put("$VDTX_C$", "-");
|
||||
reportmap.put("$VDTN_C$", "-");
|
||||
reportmap.put("$VDTE_C$", "-");
|
||||
reportmap.put("$VDT%_C$", "-");
|
||||
}
|
||||
|
||||
// 值错误判断
|
||||
try {
|
||||
maxValue = Math.abs(Double.parseDouble(vdeviation1.getFmaxValue().toString()));
|
||||
minValue = Math.abs(Double.parseDouble(vdeviation1.getMinValue().toString()));
|
||||
aveValue = Math.abs(Double.parseDouble(vdeviation1.getMeanValue().toString()));
|
||||
cp95Value = Math.abs(Double.parseDouble(vdeviation1.getCp95Value().toString()));
|
||||
limit = Math.abs(Double.parseDouble(vdeviationLimit));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
String tmpstrMap ;
|
||||
switch (i) {
|
||||
case 0:
|
||||
tmpstrMap = "A";
|
||||
break;
|
||||
case 1:
|
||||
tmpstrMap = "B";
|
||||
break;
|
||||
default:
|
||||
tmpstrMap = "C";
|
||||
break;
|
||||
}
|
||||
ReportValue vdeviation = this.listVdeviation.get(0).getList().get(i);
|
||||
if(Objects.equals("C",tmpstrMap)&&pttype == 2){
|
||||
reportmap.put("$VDTX_C$", "-");
|
||||
reportmap.put("$VDTN_C$", "-");
|
||||
reportmap.put("$VDTE_C$", "-");
|
||||
reportmap.put("$VDT%_C$", "-");
|
||||
continue;
|
||||
}else {
|
||||
reportmap.put("$VDTX_" + tmpstrMap + "$", judgeNull(vdeviation.getFmaxValue()));
|
||||
reportmap.put("$VDTN_" + tmpstrMap + "$", judgeNull(vdeviation.getMinValue()));
|
||||
reportmap.put("$VDTE_" + tmpstrMap + "$", judgeNull(vdeviation.getMeanValue()));
|
||||
reportmap.put("$VDT%_" + tmpstrMap + "$", judgeNull(vdeviation.getCp95Value()));
|
||||
}
|
||||
|
||||
|
||||
// 电压偏差
|
||||
Double vmaxValue = Double.parseDouble(reportmap.get("$VDTX_" + tmpstrMap + "$").toString());
|
||||
Double vminValue = Double.parseDouble(reportmap.get("$VDTX_" + tmpstrMap + "$").toString());
|
||||
Double vaveValue = Double.parseDouble(reportmap.get("$VDTX_" + tmpstrMap + "$").toString());
|
||||
Double vcp95Value = Double.parseDouble(reportmap.get("$VDT%_" + tmpstrMap + "$").toString());
|
||||
|
||||
if("".equals(strResultVdeviationdataValue)){
|
||||
if (!(vmaxValue >= vminValue && vmaxValue >= vaveValue && vmaxValue >= vcp95Value)) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (vaveValue < vminValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (vcp95Value < vminValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
}
|
||||
}
|
||||
|
||||
if(vmaxValue>Double.valueOf(vdeviationLimit)||vmaxValue<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相最大值";
|
||||
|
||||
}
|
||||
if(vminValue>Double.valueOf(vdeviationLimit)||vminValue<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相最小值";
|
||||
|
||||
}
|
||||
if(vaveValue>Double.valueOf(vdeviationLimit)||vaveValue<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相平均值";
|
||||
|
||||
}
|
||||
if(vcp95Value>Double.valueOf(vdeviationLimit)||vcp95Value<Double.valueOf(ldeviationLimit)){
|
||||
if (!"".equals(tmpstrResultVdeviationdata)){
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
}
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相95%概率值";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName + "电压偏差数据存在异常(不是数值类型)。";
|
||||
}
|
||||
|
||||
if ("".equals(strResultVdeviationdataValue)) {
|
||||
if (!(maxValue >= minValue && maxValue >= aveValue && maxValue >= cp95Value)) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (aveValue < minValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
} else if (cp95Value < minValue) {
|
||||
strResultVdeviationdataValue += "注意:从上表中可以看出" + strLineBaseName
|
||||
+ "电压偏差数据存在异常( 1、最大值>=最小值、平均值、95%概率值;2、平均值>=最小值;3、95%概率值>=最小值)。";
|
||||
}
|
||||
}
|
||||
// 限值判断
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResultVdeviationdata))
|
||||
tmpstrResultVdeviationdata += "、";
|
||||
tmpstrResultVdeviationdata += tmpstrMap + "相";
|
||||
}
|
||||
|
||||
// 假如为空则所有的都满足
|
||||
if ("".equals(tmpstrResultVdeviationdata)) {
|
||||
strResultVdeviationdata += "从上表中可以看出" + strLineBaseName + "A、B、C三相电压偏差满足国标限值(10%)的要求。";
|
||||
strResultVdeviationdata += "从上表中可以看出" + strLineBaseName + "A、B、C三相电压偏差满足国标限值("+ldeviationLimit+"%至"+vdeviationLimit+"%)的要求。";
|
||||
} else {
|
||||
strAnalysis += tmpstrResultVdeviationdata + "电压偏差不满足国标限值(10%)的要求。";
|
||||
strAnalysis += tmpstrResultVdeviationdata + "电压偏差不满足国标限值("+vdeviationLimit+")的要求。";
|
||||
strResultVdeviationdata += "从上表中可以看出" + strLineBaseName + tmpstrResultVdeviationdata
|
||||
+ "电压偏差不满足国标限值(10%)的要求。";
|
||||
+ "电压偏差不满足国标限值("+ldeviationLimit+"%至"+vdeviationLimit+"%)的要求。";
|
||||
}
|
||||
|
||||
reportmap.put("$ResultVdeviationdata$", strResultVdeviationdata);
|
||||
@@ -682,7 +737,8 @@ public class ExportModelJBController extends BaseController {
|
||||
**** 频率偏差
|
||||
***************************************************************/
|
||||
ReportValue valueOfFreValue = this.listFrequency.get(1).getList().get(0);
|
||||
String valueOfFreLimit = judgeNull(this.listFrequency.get(1).getOverLimit());// 获取频率偏差国标限值
|
||||
// 获取频率偏差国标限值
|
||||
String valueOfFreLimit = judgeNull(this.listFrequency.get(1).getOverLimit());
|
||||
reportmap.put("$FRE_L$", valueOfFreLimit);
|
||||
String strResultFre = "";
|
||||
String tmpstrResultFre = "";
|
||||
@@ -703,25 +759,25 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$FV0%$", judgeNull(valueOfFreValue.getCp95Value()));
|
||||
|
||||
try {
|
||||
maxValue = Math.abs(Double.parseDouble(valueOfFreValue.getFmaxValue().toString()));
|
||||
minValue = Math.abs(Double.parseDouble(valueOfFreValue.getMinValue().toString()));
|
||||
aveValue = Math.abs(Double.parseDouble(valueOfFreValue.getMeanValue().toString()));
|
||||
cp95Value = Math.abs(Double.parseDouble(valueOfFreValue.getCp95Value().toString()));
|
||||
maxValue = Double.parseDouble(valueOfFreValue.getFmaxValue().toString());
|
||||
minValue = Double.parseDouble(valueOfFreValue.getMinValue().toString());
|
||||
aveValue = Double.parseDouble(valueOfFreValue.getMeanValue().toString());
|
||||
cp95Value = Double.parseDouble(valueOfFreValue.getCp95Value().toString());
|
||||
limit = Math.abs(Double.parseDouble(valueOfFreLimit));
|
||||
} catch (Exception e) {
|
||||
strResultFreValue += "注意:从上表中可以看出" + strLineBaseName + "频率偏差数据存在异常(不是数值类型)。";
|
||||
}
|
||||
|
||||
if (maxValue > limit) {
|
||||
if (Math.abs(maxValue) > limit) {
|
||||
tmpstrResultFre += "最大值为:" + valueOfFreValue.getFmaxValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (Math.abs(minValue) > limit) {
|
||||
tmpstrResultFre += "最小值为:" + valueOfFreValue.getMinValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (Math.abs(aveValue) > limit) {
|
||||
tmpstrResultFre += "平均值为:" + valueOfFreValue.getMeanValue().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
if (cp95Value > limit) {
|
||||
if (Math.abs(cp95Value) > limit) {
|
||||
tmpstrResultFre += "95%概率值为:" + valueOfFreValue.getCp95Value().toString() + deviceUnit.getUnitFrequencyDev();
|
||||
}
|
||||
|
||||
@@ -737,10 +793,12 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if ("".equals(tmpstrResultFre)) {
|
||||
reportmap.put("$FV0R$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$FV0R$", "合格");
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差均满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
} else {
|
||||
reportmap.put("$FV0R$", "不合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$FV0R$", "不合格");
|
||||
strAnalysis += tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差" + tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit
|
||||
+ deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
@@ -754,7 +812,8 @@ public class ExportModelJBController extends BaseController {
|
||||
**** 三相电压不平衡度
|
||||
***************************************************************/
|
||||
ReportValue valueOfThree = this.listThreephase.get(0).getList().get(0);
|
||||
String valueOfThreeLimit = judgeNull(this.listThreephase.get(0).getOverLimit());// 获取三相电压不平衡度国标限值
|
||||
// 获取三相电压不平衡度国标限值
|
||||
String valueOfThreeLimit = judgeNull(this.listThreephase.get(0).getOverLimit());
|
||||
reportmap.put("$THE_L$", valueOfThreeLimit);
|
||||
String strResultThree = "";
|
||||
String tmpstrResultThree = "";
|
||||
@@ -783,10 +842,12 @@ public class ExportModelJBController extends BaseController {
|
||||
strResultThreeValue += "注意:从上表中可以看出" + strLineBaseName + "三相电压不平衡度数据存在异常(不是数值类型)。";
|
||||
}
|
||||
if (cp95Value > limit) {
|
||||
reportmap.put("$TV0R$", "不合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$TV0R$", "不合格");
|
||||
tmpstrResultThree += "三相电压不平衡度95%概率值为:" + valueOfThree.getCp95Value().toString();
|
||||
} else {
|
||||
reportmap.put("$TV0R$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$TV0R$", "合格");
|
||||
}
|
||||
|
||||
if (!(maxValue >= minValue && maxValue >= aveValue && maxValue >= cp95Value)) {
|
||||
@@ -816,7 +877,8 @@ public class ExportModelJBController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 电压闪变
|
||||
***************************************************************/
|
||||
String valueOfFlickerLimit = judgeNull(this.listFlicker.get(1).getOverLimit());// 获取电压长时闪变的限值
|
||||
// 获取电压长时闪变的限值
|
||||
String valueOfFlickerLimit = judgeNull(this.listFlicker.get(1).getOverLimit());
|
||||
reportmap.put("$PLT_L$", valueOfFlickerLimit);
|
||||
String strResultFlicker = "";
|
||||
String tmpstrResultFlicker = "";
|
||||
@@ -836,8 +898,9 @@ public class ExportModelJBController extends BaseController {
|
||||
strResultFlickerValue += "注意:从上表中可以看出" + strLineBaseName + "长时闪变数据存在异常(不是数值类型)。";
|
||||
}
|
||||
if (fmaxValue1 > flickerLimit) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultFlicker += ",";
|
||||
}
|
||||
tmpstrResultFlicker += atype + "最大值为:" + plt1.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "不合格");
|
||||
} else {
|
||||
@@ -845,8 +908,9 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (fmaxValue2 > flickerLimit) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultFlicker += ",";
|
||||
}
|
||||
tmpstrResultFlicker += btype + "最大值为:" + plt2.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "不合格");
|
||||
} else {
|
||||
@@ -854,8 +918,9 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (fmaxValue3 > flickerLimit && pttype != 2) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultFlicker += ",";
|
||||
}
|
||||
tmpstrResultFlicker += ctype + "最大值为:" + plt3.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "不合格");
|
||||
} else {
|
||||
@@ -1021,26 +1086,38 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
String tmpstrResult = "";
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "A";
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "不合格");
|
||||
} else {
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_A$", "合格");
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "B";
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "不合格");
|
||||
} else {
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_B$", "合格");
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "C";
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "合格");// 三张大表取值
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "不合格");
|
||||
} else {
|
||||
// 三张大表取值
|
||||
reportmap.put("$CV" + (i + 1) + "R_C$", "合格");
|
||||
}
|
||||
// 判断单个结论是否存在
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResultVoltageRate += (i + 1) + "次谐波电压含有率95%概率值" + tmpstrResult + ";";
|
||||
@@ -1054,6 +1131,9 @@ public class ExportModelJBController extends BaseController {
|
||||
strAnalysis += tmpstrResultVoltageRate + "2-25次谐波电压含有率95%概率值均不满足国标限值要求。";
|
||||
strResultVoltageRate += "从上表中可以看出" + strLineBaseName + tmpstrResultVoltageRate + "均不满足国标限值要求。";
|
||||
}
|
||||
reportmap.put("$ResultVoltageRate$", strResultVoltageRate );
|
||||
reportmap.put("$ResultVoltageRateValue$", strResultVoltageRateValue);
|
||||
|
||||
|
||||
/**************************************************************
|
||||
**** 电压总谐波畸变率(THD)
|
||||
@@ -1102,28 +1182,31 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
// 限值判断
|
||||
if (cp95ValueA > limit) {
|
||||
if (!"".equals(tmpstrResultDistortion))
|
||||
if (!"".equals(tmpstrResultDistortion)) {
|
||||
tmpstrResultDistortion += "、";
|
||||
}
|
||||
tmpstrResultDistortion += atype;
|
||||
reportmap.put("$TV0R_A$", "不合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_A$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$TV0R_A$", "合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_A$", "合格");
|
||||
}
|
||||
if (cp95ValueB > limit) {
|
||||
if (!"".equals(tmpstrResultDistortion))
|
||||
if (!"".equals(tmpstrResultDistortion)) {
|
||||
tmpstrResultDistortion += "、";
|
||||
}
|
||||
tmpstrResultDistortion += btype;
|
||||
reportmap.put("$TV0R_B$", "不合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_B$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$TV0R_B$", "合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_B$", "合格");
|
||||
}
|
||||
if (cp95ValueC > limit && pttype != 2) {
|
||||
if (!"".equals(tmpstrResultDistortion))
|
||||
if (!"".equals(tmpstrResultDistortion)){
|
||||
tmpstrResultDistortion += "、";
|
||||
}
|
||||
tmpstrResultDistortion += ctype;
|
||||
reportmap.put("$TV0R_C$", "不合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_C$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$TV0R_C$", "合格");// 三张大表取值
|
||||
reportmap.put("$TV0R_C$", "合格");
|
||||
}
|
||||
|
||||
// 假如为空则所有的都满足
|
||||
@@ -1134,8 +1217,7 @@ public class ExportModelJBController extends BaseController {
|
||||
strResultDistortion += "从上表中可以看出" + strLineBaseName + tmpstrResultDistortion + "均不满足国标限值要求。";
|
||||
}
|
||||
|
||||
reportmap.put("$ResultVoltageRate$", strResultVoltageRate );
|
||||
reportmap.put("$ResultVoltageRateValue$", strResultVoltageRateValue + strResultDistortionValue);
|
||||
|
||||
reportmap.put("$ResultThdRate$", strResultDistortion);
|
||||
reportmap.put("$ResultThdRateValue$", strResultDistortionValue);
|
||||
|
||||
@@ -1194,26 +1276,32 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
String tmpstrResult = "";
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "A";
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "合格");// 三张大表取值
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$CI" + (i + 1) + "R_A$", "合格");
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "B";
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "合格");// 三张大表取值
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$CI" + (i + 1) + "R_B$", "合格");
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "C";
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "合格");// 三张大表取值
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$CI" + (i + 1) + "R_C$", "合格");
|
||||
}
|
||||
// 判断单个结论是否存在
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResultCurrent += (i + 1) + "次谐波电流幅值95%概率值" + tmpstrResult + ";";
|
||||
@@ -1234,20 +1322,23 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
|
||||
/**************************************************************
|
||||
**** 负序电压
|
||||
**** 负序电流
|
||||
***************************************************************/
|
||||
String ineLimit = judgeNull(this.listIneRate.get(0).getOverLimit());// 获取电压长时闪变的限值
|
||||
// 获取电压长时闪变的限值
|
||||
String ineLimit = judgeNull(this.listIneRate.get(0).getOverLimit());
|
||||
|
||||
String strResultIne = "";
|
||||
String tmpstrResultIne = "";
|
||||
String strResultIneValue = "";
|
||||
ReportValue ine1 = this.listIneRate.get(0).getList().get(0);// 短闪
|
||||
ReportValue ine2 = this.listIneRate.get(0).getList().get(1);// 短闪
|
||||
ReportValue ine3 = this.listIneRate.get(0).getList().get(2);// 短闪
|
||||
// 负序电流
|
||||
ReportValue ine1 = this.listIneRate.get(0).getList().get(0);
|
||||
ReportValue ine2 = this.listIneRate.get(0).getList().get(1);
|
||||
ReportValue ine3 = this.listIneRate.get(0).getList().get(2);
|
||||
try {
|
||||
if (Double.parseDouble(ine1.getFmaxValue().toString()) > Double.parseDouble(ineLimit)) {
|
||||
if (!"".equals(tmpstrResultFlicker))
|
||||
if (!"".equals(tmpstrResultFlicker)) {
|
||||
tmpstrResultIne += ",";
|
||||
}
|
||||
tmpstrResultIne += atype + "最大值为:" + ine1.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "A" + "$", "不合格");
|
||||
} else {
|
||||
@@ -1255,8 +1346,9 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (Double.parseDouble(ine2.getFmaxValue().toString()) > Double.parseDouble(ineLimit)) {
|
||||
if (!"".equals(tmpstrResultIne))
|
||||
if (!"".equals(tmpstrResultIne)) {
|
||||
tmpstrResultIne += ",";
|
||||
}
|
||||
tmpstrResultIne += btype + "最大值为:" + ine2.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "B" + "$", "不合格");
|
||||
} else {
|
||||
@@ -1264,16 +1356,18 @@ public class ExportModelJBController extends BaseController {
|
||||
}
|
||||
|
||||
if (Double.parseDouble(ine3.getFmaxValue().toString()) > Double.parseDouble(ineLimit) ) {
|
||||
if (!"".equals(tmpstrResultIne))
|
||||
if (!"".equals(tmpstrResultIne)) {
|
||||
tmpstrResultIne += ",";
|
||||
}
|
||||
tmpstrResultIne += ctype + "最大值为:" + ine3.getFmaxValue().toString();
|
||||
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$" + "L" + "V0R_" + "C" + "$", "合格");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if ("".equals(strResultIneValue))
|
||||
if ("".equals(strResultIneValue)) {
|
||||
strResultIneValue += "注意:从上表中可以看出" + strLineBaseName + "负序电流数据存在异常(不是数值类型)。";
|
||||
}
|
||||
}
|
||||
reportmap.put("$INETX_A$", judgeNull(ine1.getFmaxValue()));
|
||||
reportmap.put("$INETN_A$", judgeNull(ine1.getMinValue()));
|
||||
@@ -1319,7 +1413,7 @@ public class ExportModelJBController extends BaseController {
|
||||
String strMap = "$IN";
|
||||
String strCurrent = strMap + i + "%";
|
||||
|
||||
// 基波电压含有率
|
||||
// 间谐波电压
|
||||
strCurrentA = judgeNull(this.listInRate.get(i).getList().get(0).getCp95Value());
|
||||
strCurrentB = judgeNull(this.listInRate.get(i).getList().get(1).getCp95Value());
|
||||
strCurrentC = judgeNull(this.listInRate.get(i).getList().get(2).getCp95Value());
|
||||
@@ -1361,26 +1455,32 @@ public class ExportModelJBController extends BaseController {
|
||||
|
||||
String tmpstrResult = "";
|
||||
if (maxValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "A";
|
||||
reportmap.put("$IN" + i + "R_A$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$IN" + i + "R_A$", "合格");// 三张大表取值
|
||||
reportmap.put("$IN" + i + "R_A$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$IN" + i + "R_A$", "合格");
|
||||
}
|
||||
if (minValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "B";
|
||||
reportmap.put("$IN" + i + "R_B$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$IN" + i + "R_B$", "合格");// 三张大表取值
|
||||
reportmap.put("$IN" + i + "R_B$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$IN" + i + "R_B$", "合格");
|
||||
}
|
||||
if (aveValue > limit) {
|
||||
if (!"".equals(tmpstrResult))
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResult += "、";
|
||||
}
|
||||
tmpstrResult += "C";
|
||||
reportmap.put("$IN" + i + "R_C$", "不合格");// 三张大表取值
|
||||
} else
|
||||
reportmap.put("$IN" + i + "R_C$", "合格");// 三张大表取值
|
||||
reportmap.put("$IN" + i + "R_C$", "不合格");
|
||||
} else {
|
||||
reportmap.put("$IN" + i + "R_C$", "合格");
|
||||
}
|
||||
// 判断单个结论是否存在
|
||||
if (!"".equals(tmpstrResult)) {
|
||||
tmpstrResultIn += i + "次间谐波电压含有率95%概率值" + tmpstrResult + ";";
|
||||
@@ -1403,22 +1503,30 @@ public class ExportModelJBController extends BaseController {
|
||||
// 测试结果填写
|
||||
reportmap.put("$ResultTitle$", String.format("通过对(%s——%s)时间段内%s电能质量统计数据分析后得出以下结论:",
|
||||
new String[]{DateUtil.format(startDate, "yyyy年MM月dd日 HH时mm分ss秒"),
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒"), strLineBaseName}));// 结论标题
|
||||
reportmap.put("$Result_VD$", String.format("(1)电压偏差:%s", new String[]{strResultVdeviationdata}));// 电压偏差
|
||||
reportmap.put("$Result_FRE$", String.format("(2)频率偏差:%s", new String[]{strResultFre}));// 频率偏差
|
||||
reportmap.put("$Result_THE$", String.format("(3)三相电压不平衡度:%s", new String[]{strResultThree}));// 三相电压不平衡度
|
||||
reportmap.put("$Result_FIC$", String.format("(4)电压长时闪变:%s", new String[]{strResultFlicker}));// 电压长时闪变
|
||||
reportmap.put("$Result_VOL$", String.format("(5)谐波电压含有率:%s", new String[]{strResultVoltageRate}));// 谐波电压
|
||||
reportmap.put("$Result_U$", String.format("(6)电压总谐波畸变率:%s", new String[]{strResultDistortion}));// 谐波电压
|
||||
reportmap.put("$Result_IN$", String.format("(7)间谐波电压含有率:%s", new String[]{strResultIn}));// 谐波电压
|
||||
reportmap.put("$Result_CUR$", String.format("(8)谐波电流:%s", new String[]{strResultCurrent}));// 谐波电流
|
||||
//todo 负序电流 暂降事件
|
||||
reportmap.put("$Result_CUR$", String.format("(9)负序电流:%s", new String[]{strResultCurrent}));// 负序电流
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒"), strLineBaseName}));
|
||||
// 电压偏差
|
||||
reportmap.put("$Result_VD$", String.format("(1)电压偏差:%s", new String[]{strResultVdeviationdata}));
|
||||
// 频率偏差
|
||||
reportmap.put("$Result_FRE$", String.format("(2)频率偏差:%s", new String[]{strResultFre}));
|
||||
// 三相电压不平衡度
|
||||
reportmap.put("$Result_THE$", String.format("(3)三相电压不平衡度:%s", new String[]{strResultThree}));
|
||||
// 电压长时闪变
|
||||
reportmap.put("$Result_FIC$", String.format("(4)电压长时闪变:%s", new String[]{strResultFlicker}));
|
||||
// 谐波电压
|
||||
reportmap.put("$Result_VOL$", String.format("(5)谐波电压含有率:%s", new String[]{strResultVoltageRate}));
|
||||
// 电压总谐波畸变率
|
||||
reportmap.put("$Result_U$", String.format("(6)电压总谐波畸变率:%s", new String[]{strResultDistortion}));
|
||||
// 间谐波电压含有率
|
||||
reportmap.put("$Result_IN$", String.format("(7)间谐波电压含有率:%s", new String[]{strResultIn}));
|
||||
// 谐波电流
|
||||
reportmap.put("$Result_CUR$", String.format("(8)谐波电流:%s", new String[]{strResultCurrent}));
|
||||
// 负序电流
|
||||
reportmap.put("$Result_CUR$", String.format("(9)负序电流:%s", new String[]{strResultCurrent}));
|
||||
// 分析建议填写
|
||||
if (!"".equals(strAnalysis) || !"".equals(strError)) {
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + "," + strAnalysis + strError);// 分析建议
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + "," + strAnalysis + strError);
|
||||
} else {
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + ",电能质量数据满足国标限值要求。");// 分析建议
|
||||
reportmap.put("$Analysis$", "根据统计数据结果分析,监测点为:" + name + ",电能质量数据满足国标限值要求。");
|
||||
}
|
||||
|
||||
/************************************
|
||||
@@ -1444,7 +1552,8 @@ public class ExportModelJBController extends BaseController {
|
||||
reportmap.put("$YF0X$", judgeNull(powerDto4.getFmaxValue()));
|
||||
reportmap.put("$YF0N$", judgeNull(powerDto4.getMinValue()));
|
||||
reportmap.put("$YF0E$", judgeNull(powerDto4.getMeanValue()));
|
||||
formatter = new SimpleDateFormat("yyyyMMddHHmmss");// 报告时分秒格式
|
||||
// 报告时分秒格式
|
||||
formatter = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
/****
|
||||
* 暂态列表
|
||||
@@ -1512,7 +1621,8 @@ public class ExportModelJBController extends BaseController {
|
||||
tableList.add(2,risEList);
|
||||
tableList.add(3,shortList);
|
||||
}
|
||||
reportmap.put("$Result_EVENT$", String.format("(10)监测分析时间段内,发生电压暂升事件%s次,电压暂降事件%s次,电压中断事件%s次,需考虑相应治理措施", new String[]{tableList.get(1).size()+"",tableList.get(2).size()+"",tableList.get(3).size()+""}));// 负序电流
|
||||
// 暂降事件列表
|
||||
reportmap.put("$Result_EVENT$", String.format("(10)监测分析时间段内,发生电压暂升事件%s次,电压暂降事件%s次,电压中断事件%s次,需考虑相应治理措施", new String[]{tableList.get(1).size()+"",tableList.get(2).size()+"",tableList.get(3).size()+""}));
|
||||
String reportFileUrl = "";
|
||||
try {
|
||||
String fileName = name + formatter.format(currentTime) + ".docx";
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.harmonic.rstatlimitrate.mapper;
|
||||
package com.njcn.harmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.harmonic.rstatlimitrate.mapper;
|
||||
package com.njcn.harmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDetailDPO;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user