高级算法 部分
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -3,7 +3,6 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!--灿能微服务生态系统-->
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs</artifactId>
|
||||
@@ -21,6 +20,7 @@
|
||||
<module>pqs-job</module>
|
||||
<module>pqs-job/job-api</module>
|
||||
<module>pqs-quality</module>
|
||||
<module>pqs-advance</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
<name>灿能微服务生态系统</name>
|
||||
@@ -40,12 +40,12 @@
|
||||
<!--中间件目标地址-->
|
||||
<middle.server.url>192.168.1.13</middle.server.url>
|
||||
<!--微服务模块发布地址-->
|
||||
<service.server.url>192.168.1.111</service.server.url>
|
||||
<service.server.url>192.168.1.130</service.server.url>
|
||||
<!--nacos的ip:port-->
|
||||
<nacos.url>${middle.server.url}:18848</nacos.url>
|
||||
<!--服务器发布内容为空-->
|
||||
<!-- <nacos.namespace></nacos.namespace>-->
|
||||
<nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>
|
||||
<nacos.namespace>722a16dc-6988-419e-96e9-de885508296b</nacos.namespace>
|
||||
<!--sentinel:port-->
|
||||
<!-- <sentinel.url>192.168.1.14:8080</sentinel.url>-->
|
||||
<sentinel.url>${middle.server.url}:8080</sentinel.url>
|
||||
@@ -93,7 +93,6 @@
|
||||
<mqtt.version>1.2.7</mqtt.version>
|
||||
<easypoi.version>4.4.0</easypoi.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!--三剑客依赖******start-->
|
||||
@@ -291,7 +290,6 @@
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>${xxl-job.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.tocrhz</groupId>
|
||||
<artifactId>mqtt-spring-boot-starter</artifactId>
|
||||
@@ -304,7 +302,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -316,7 +313,6 @@
|
||||
<addResources>true</addResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
@@ -340,4 +336,4 @@
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
19
pqs-advance/advance-api/pom.xml
Normal file
19
pqs-advance/advance-api/pom.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>pqs-advance</artifactId>
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>advance-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
124
pqs-advance/advance-boot/pom.xml
Normal file
124
pqs-advance/advance-boot/pom.xml
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>pqs-advance</artifactId>
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>device-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>system-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-influxDB</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<artifactId>advance-boot</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<finalName>advanceboot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<executions>
|
||||
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||
<execution>
|
||||
<id>build-image</id>
|
||||
<phase>${docker.operate}</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!--<serverId>36dockerHarbor</serverId>-->
|
||||
<registryUrl>http://${docker.repostory}</registryUrl>
|
||||
<!-- 镜像名称 -->
|
||||
<imageName>${docker.repostory}/${docker.registry.name}/${project.artifactId}</imageName>
|
||||
<!-- 指定标签 -->
|
||||
<imageTags>
|
||||
<imageTag>latest</imageTag>
|
||||
</imageTags>
|
||||
<!-- 指定远程 Docker API地址 -->
|
||||
<dockerHost>${docker.url}</dockerHost>
|
||||
<dockerDirectory>${basedir}/</dockerDirectory>
|
||||
<!-- 复制 jar包到docker容器指定目录-->
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/ROOT</targetPath>
|
||||
<!-- 用于指定需要复制的根目录,${project.build.directory}表示target目录 -->
|
||||
<directory>${project.build.directory}</directory>
|
||||
<!-- 用于指定需要复制的文件,${project.build.finalName}.jar就是打包后的target目录下的jar包名称 -->
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.advance;
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 09:33
|
||||
*/
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@Slf4j
|
||||
@MapperScan("com.njcn.**.mapper")
|
||||
@EnableFeignClients(basePackages = "com.njcn")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
public class
|
||||
AdvanceBootApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdvanceBootApplication.class, args);
|
||||
}
|
||||
}
|
||||
53
pqs-advance/advance-boot/src/main/resources/bootstrap.yml
Normal file
53
pqs-advance/advance-boot/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10210
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
ip: @service.server.url@
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.advance.pojo
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
BIN
pqs-advance/advance-boot/src/main/resources/qvvr_balance.dll
Normal file
BIN
pqs-advance/advance-boot/src/main/resources/qvvr_balance.dll
Normal file
Binary file not shown.
BIN
pqs-advance/advance-boot/src/main/resources/qvvr_dll.dll
Normal file
BIN
pqs-advance/advance-boot/src/main/resources/qvvr_dll.dll
Normal file
Binary file not shown.
BIN
pqs-advance/advance-boot/src/main/resources/qvvr_dll_cause.dll
Normal file
BIN
pqs-advance/advance-boot/src/main/resources/qvvr_dll_cause.dll
Normal file
Binary file not shown.
24
pqs-advance/pom.xml
Normal file
24
pqs-advance/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>pqs</artifactId>
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>pqs-advance</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>advance-api</module>
|
||||
<module>advance-boot</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.device.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月15日 14:03
|
||||
*/
|
||||
@Data
|
||||
public class AbnomalCommuncateVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("年份")
|
||||
private String year;
|
||||
|
||||
@ApiModelProperty("月份")
|
||||
private String month;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private String day;
|
||||
|
||||
@ApiModelProperty("异常次数")
|
||||
private String abnormalTimes;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.device.pojo.vo;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @date 2022/8/14
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DeviceAbnormalVO implements Serializable {
|
||||
@ApiModelProperty("是否有下级")
|
||||
private Boolean isPid;
|
||||
|
||||
@ApiModelProperty("数值")
|
||||
private List<AbnomalCommuncateVO> data;
|
||||
}
|
||||
@@ -21,6 +21,9 @@ public class DeviceOnlineDataVO implements Serializable {
|
||||
@ApiModelProperty("月")
|
||||
private String month;
|
||||
|
||||
@ApiModelProperty("日")
|
||||
private String day;
|
||||
|
||||
@ApiModelProperty("在线率")
|
||||
private Float onlineRate;
|
||||
}
|
||||
|
||||
@@ -97,5 +97,14 @@ public class OperationContrController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getComunicateStatics")
|
||||
@ApiOperation("获取中断异常统计")
|
||||
@ApiImplicitParam(name = "conditionBusinessParam", value = "实体", required = true)
|
||||
public HttpResult<DeviceAbnormalVO> getComunicateStatics(@RequestBody @Validated DeviceInfoParam.ConditionBusinessParam conditionBusinessParam) {
|
||||
String methodDescribe = getMethodDescribe("getComunicateStatics");
|
||||
DeviceAbnormalVO result = lineService.getComunicateStatics(conditionBusinessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -141,5 +141,11 @@ public interface LineService {
|
||||
*/
|
||||
List<Line> getBaseLineList(List<String> lineIndex);
|
||||
|
||||
/**
|
||||
* 获取终端异常数据
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
DeviceAbnormalVO getComunicateStatics(DeviceInfoParam.ConditionBusinessParam deviceInfoParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.po.*;
|
||||
import com.njcn.device.pojo.vo.*;
|
||||
import com.njcn.device.service.LineService;
|
||||
import com.njcn.device.utils.PublicDateUtil;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
@@ -42,7 +44,6 @@ import org.springframework.util.CollectionUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -73,8 +74,6 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
private final SubstationMapper substationMapper;
|
||||
|
||||
private final CommunicateMapper communicateMapper;
|
||||
|
||||
private final GeneralDeviceService generalDeviceService;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
@@ -158,7 +157,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
@Override
|
||||
public CommunicateVO getComFlagInfoData(String id, String searchBeginTime, String searchEndTime) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<Communicate> communicateList = getCommunicate(id,searchBeginTime,searchEndTime);
|
||||
List<Communicate> communicateList = getCommunicate(id, searchBeginTime, searchEndTime);
|
||||
CommunicateVO communicateVOList = new CommunicateVO();
|
||||
List<String> updateTime = new ArrayList<>();
|
||||
List<Integer> comType = new ArrayList<>();
|
||||
@@ -260,24 +259,23 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
//根据部门id去获取省份信息
|
||||
Area area = areaFeignClient.areaDeptPro(generalDeviceDTO.getIndex()).getData();
|
||||
LineDistributionVO lineDistributionVO = new LineDistributionVO();
|
||||
lineDistributionVO.setName(generalDeviceDTO.getName());
|
||||
lineDistributionVO.setValue(generalDeviceDTO.getLineIndexes().size());
|
||||
lineDistributionVOList.add(lineDistributionVO);
|
||||
}
|
||||
|
||||
List<LineDistributionVO> result =new ArrayList<LineDistributionVO>();
|
||||
List<LineDistributionVO> result = new ArrayList<LineDistributionVO>();
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
for(LineDistributionVO lineDistributionVO:lineDistributionVOList){
|
||||
for (LineDistributionVO lineDistributionVO : lineDistributionVOList) {
|
||||
if (map.containsKey(lineDistributionVO.getName())) {
|
||||
map.put(lineDistributionVO.getName(), map.get(lineDistributionVO.getName())+lineDistributionVO.getValue());
|
||||
map.put(lineDistributionVO.getName(), map.get(lineDistributionVO.getName()) + lineDistributionVO.getValue());
|
||||
} else {
|
||||
map.put(lineDistributionVO.getName(), lineDistributionVO.getValue());
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||
result.add(new LineDistributionVO(entry.getKey(),entry.getValue()));
|
||||
result.add(new LineDistributionVO(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -383,9 +381,9 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
//根据监测点id获取终端id
|
||||
String devIndex = lineMapper.getDevIndex(lineId);
|
||||
//获取在线率
|
||||
List<LineStaticsValueVO> onlineRateValue = getDevOnline(devIndex,startTime,endTime);
|
||||
List<LineStaticsValueVO> onlineRateValue = getDevOnline(devIndex, startTime, endTime);
|
||||
//获取数据完整性
|
||||
List<LineStaticsValueVO> integrityValue = getInegrity(lineId,startTime,endTime);
|
||||
List<LineStaticsValueVO> integrityValue = getInegrity(lineId, startTime, endTime);
|
||||
//获取流量占比
|
||||
List<LineStaticsValueVO> flowMealValue = new ArrayList<>();
|
||||
//组装
|
||||
@@ -415,8 +413,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
for (LineFlowMealDetailVO lineFlowMealDetailVO : monitorList) {
|
||||
for (LineInfluxDbInegrityVO lineInfluxDbInegrity : lineInfluxDbInegrityVO) {
|
||||
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbInegrity.getLineId())) {
|
||||
BigDecimal flow =new BigDecimal(lineInfluxDbInegrity.getIntegrity().floatValue());
|
||||
lineFlowMealDetailVO.setIntegrity(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
BigDecimal flow = new BigDecimal(lineInfluxDbInegrity.getIntegrity().floatValue());
|
||||
lineFlowMealDetailVO.setIntegrity(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,18 +424,18 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<LineFlowMealDetailVO> deviceList = lineMapper.getFlowLineRunStatistics(busBarList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()), DateUtil.endOfDay(DateUtil.parse(steadyParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchEndTime())));
|
||||
for (LineFlowMealDetailVO lineFlowMealDetailVO : deviceList) {
|
||||
System.out.println(lineFlowMealDetailVO.getId());
|
||||
Float staticsValue = getStatisValueFlow(lineFlowMealDetailVO.getId(),steadyParam);
|
||||
BigDecimal b = new BigDecimal(staticsValue);
|
||||
float f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||
Float staticsValue = getStatisValueFlow(lineFlowMealDetailVO.getId(), steadyParam);
|
||||
BigDecimal b = new BigDecimal(staticsValue);
|
||||
float f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||
lineFlowMealDetailVO.setStatisValue(f1);
|
||||
BigDecimal flow =new BigDecimal(f1/lineFlowMealDetailVO.getFlowMeal()*100);
|
||||
BigDecimal flow = new BigDecimal(f1 / lineFlowMealDetailVO.getFlowMeal() * 100);
|
||||
//获取流量占比
|
||||
lineFlowMealDetailVO.setFlowProportion(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
lineFlowMealDetailVO.setFlowProportion(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
|
||||
for (LineInfluxDbOnlineVO lineInfluxDbOnline : lineInfluxDbOnlineVO) {
|
||||
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbOnline.getDevIndex())) {
|
||||
BigDecimal flowValue =new BigDecimal(lineInfluxDbOnline.getOnlineRate().floatValue());
|
||||
lineFlowMealDetailVO.setOnlineRate(flowValue.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
BigDecimal flowValue = new BigDecimal(lineInfluxDbOnline.getOnlineRate().floatValue());
|
||||
lineFlowMealDetailVO.setOnlineRate(flowValue.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,7 +587,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<List<Object>> listData = list.get(0).getValues();
|
||||
for (int i = 0; i < listData.size(); i++) {
|
||||
LineStaticsValueVO lineStaticsValueVO =new LineStaticsValueVO();
|
||||
LineStaticsValueVO lineStaticsValueVO = new LineStaticsValueVO();
|
||||
List<Object> objectList = listData.get(i);
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
lineStaticsValueVO.setTime(formatter.parse(objectList.get(0).toString()).toString());
|
||||
@@ -614,7 +612,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<List<Object>> listData = list.get(0).getValues();
|
||||
for (int i = 0; i < listData.size(); i++) {
|
||||
LineStaticsValueVO lineStaticsValueVO =new LineStaticsValueVO();
|
||||
LineStaticsValueVO lineStaticsValueVO = new LineStaticsValueVO();
|
||||
List<Object> objectList = listData.get(i);
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
lineStaticsValueVO.setTime(formatter.parse(objectList.get(0).toString()).toString());
|
||||
@@ -626,7 +624,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Float getStatisValueFlow(String lineIndex,DeviceInfoParam.BusinessParam steadyParam) {
|
||||
public Float getStatisValueFlow(String lineIndex, DeviceInfoParam.BusinessParam steadyParam) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(steadyParam.getSearchEndTime()))).append("' and ");
|
||||
@@ -639,19 +637,19 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<List<Object>> listData = list.get(0).getValues();
|
||||
List<Object> objectList = listData.get(0);
|
||||
staticsValue = ((Double)objectList.get(1)).floatValue();
|
||||
}else {
|
||||
staticsValue = ((Double) objectList.get(1)).floatValue();
|
||||
} else {
|
||||
staticsValue = 0f;
|
||||
}
|
||||
return staticsValue;
|
||||
}
|
||||
|
||||
public List<Communicate> getCommunicate(String lineIndex, String startTime,String endTime) {
|
||||
public List<Communicate> getCommunicate(String lineIndex, String startTime, String endTime) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("line_id = '").append(lineIndex).append("' group by line_id ").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "select * from "+InfluxDBPublicParam.PQS_COMMUNICATE+" where " + stringBuilder.toString();
|
||||
String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder.toString();
|
||||
//获取暂降事件
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
@@ -661,15 +659,226 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
|
||||
@Override
|
||||
public List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex,String searchValue,Integer comFlag) {
|
||||
return this.baseMapper.getBaseLineAreaInfo(lineIndex,searchValue,comFlag);
|
||||
public List<AreaLineInfoVO> getBaseLineAreaInfo(List<String> lineIndex, String searchValue, Integer comFlag) {
|
||||
return this.baseMapper.getBaseLineAreaInfo(lineIndex, searchValue, comFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Line> getBaseLineList(List<String> lineIndex) {
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Line::getState, DataStateEnum.ENABLE.getCode()).in(Line::getId,lineIndex);
|
||||
lambdaQueryWrapper.eq(Line::getState, DataStateEnum.ENABLE.getCode()).in(Line::getId, lineIndex);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public DeviceAbnormalVO getComunicateStatics(DeviceInfoParam.ConditionBusinessParam conditionBusinessParam) {
|
||||
DeviceAbnormalVO deviceAbnormalVO = new DeviceAbnormalVO();
|
||||
//获取所有监测点
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(conditionBusinessParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
List<String> lineIndexs = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
if (conditionBusinessParam.getTimeFlag() == 0) {
|
||||
List<String> intervalTime = this.getIntervalTime(conditionBusinessParam.getSearchBeginTime(), conditionBusinessParam.getSearchEndTime());
|
||||
List<AbnomalCommuncateVO> abnomalCommuncateVOS = new ArrayList<>();
|
||||
deviceAbnormalVO.setIsPid(true);
|
||||
for (String interTime : intervalTime) {
|
||||
System.out.println(lineIndexs);
|
||||
AbnomalCommuncateVO inter = new AbnomalCommuncateVO();
|
||||
String startTime, endTime;
|
||||
inter.setMonth(interTime.substring(5));
|
||||
inter.setYear(interTime.substring(0, 4));
|
||||
startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0,4)),Integer.parseInt (interTime.substring(5)));
|
||||
endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0,4)),Integer.parseInt(interTime.substring(5)));
|
||||
List<Communicate> communicateList = getCommunicateAbnorm(lineIndexs,startTime,endTime);
|
||||
inter.setDay("/");
|
||||
if (communicateList.size()==0){
|
||||
inter.setAbnormalTimes("3.14159");
|
||||
}else {
|
||||
inter.setAbnormalTimes(String.valueOf(communicateList.size()));
|
||||
}
|
||||
abnomalCommuncateVOS.add(inter);
|
||||
}
|
||||
deviceAbnormalVO.setData(abnomalCommuncateVOS);
|
||||
} else {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date dt = simpleDateFormat.parse(conditionBusinessParam.getSearchBeginTime());
|
||||
Date dtDate = simpleDateFormat.parse(conditionBusinessParam.getSearchEndTime());
|
||||
Integer year = Integer.valueOf(String.format("%tY", dt));
|
||||
Integer mon = Integer.valueOf(String.format("%tm", dt));
|
||||
Integer day = Integer.valueOf(String.format("%td", dtDate));
|
||||
List<String> intervalTime = this.getIntervalDateTime(year, mon,day);
|
||||
List<AbnomalCommuncateVO> abnomalCommuncateVOS = new ArrayList<>();
|
||||
deviceAbnormalVO.setIsPid(false);
|
||||
for (String interTime : intervalTime) {
|
||||
AbnomalCommuncateVO inter = new AbnomalCommuncateVO();
|
||||
String startTime, endTime;
|
||||
inter.setMonth(interTime.substring(5,7));
|
||||
inter.setYear(interTime.substring(0, 4));
|
||||
inter.setDay(interTime.substring(8));
|
||||
startTime = sdf.format(DateUtil.beginOfDay(DateUtil.parse(interTime)));
|
||||
endTime = sdf.format(DateUtil.endOfDay(DateUtil.parse(interTime)));
|
||||
List<Communicate> communicateList = getCommunicateAbnorm(lineIndexs,startTime,endTime);
|
||||
if (communicateList.size()==0){
|
||||
inter.setAbnormalTimes("3.14159");
|
||||
}else {
|
||||
inter.setAbnormalTimes(String.valueOf(communicateList.size()));
|
||||
}
|
||||
abnomalCommuncateVOS.add(inter);
|
||||
}
|
||||
deviceAbnormalVO.setData(abnomalCommuncateVOS);
|
||||
}
|
||||
|
||||
return deviceAbnormalVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户选择的时间区间返回月份日期
|
||||
*/
|
||||
@SneakyThrows
|
||||
private List<String> getIntervalTime(String startTime, String endTime) {
|
||||
List<String> times = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
Date start = sdf.parse(startTime);
|
||||
Date end = sdf.parse(endTime);
|
||||
// 同月
|
||||
if (start.getTime() == end.getTime()) {
|
||||
String time = startTime.substring(0, 7);
|
||||
times.add(time);
|
||||
} else if (start.getYear() == end.getYear()) {
|
||||
// 同年
|
||||
int startM = start.getMonth() + 1;
|
||||
int endM = end.getMonth() + 1;
|
||||
int temp = endM - startM;
|
||||
for (int i = 0; i <= temp; i++) {
|
||||
String time = start.getYear() + 1900 + "";
|
||||
int month = startM + i;
|
||||
if (month < 10) {
|
||||
time = time + "-0" + month;
|
||||
} else {
|
||||
time = time + "-" + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不同年!!!!这里忽略了年份之间跨年的情况
|
||||
int startY = start.getYear() + 1900;
|
||||
int startM = start.getMonth() + 1;
|
||||
int endY = end.getYear() + 1900;
|
||||
int endM = end.getMonth() + 1;
|
||||
int tempS = 12 - startM;
|
||||
// 连续的年份
|
||||
if (endY - startY == 1) {
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
// 第二年的时间获取
|
||||
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不连续的年份
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
int tempY = endY - startY;
|
||||
// 中间年份的时间
|
||||
for (int i = 1; i < tempY; i++) {
|
||||
for (int j = 1; j <= 12; j++) {
|
||||
String time = startY + i + "-";
|
||||
if (j < 10) {
|
||||
time = time + "0" + j;
|
||||
} else {
|
||||
time = time + j;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
}
|
||||
// 最后一年的时间获取
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
private List<String> getIntervalDateTime(Integer startTime, Integer endTime,Integer dd) {
|
||||
List<String> list = new ArrayList<>();
|
||||
Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
||||
calendar.set(startTime, endTime - 1, 1);
|
||||
int year = calendar.get(Calendar.YEAR);//年份
|
||||
int month = calendar.get(Calendar.MONTH) + 1;//月份
|
||||
for (int i = 1; i <= dd; i++) {
|
||||
String date = null;
|
||||
if (month < 10 && i < 10) {
|
||||
date = year + "-0" + month + "-0" + i;
|
||||
}
|
||||
if (month < 10 && i >= 10) {
|
||||
date = year + "-0" + month + "-" + i;
|
||||
}
|
||||
if (month >= 10 && i < 10) {
|
||||
date = year + "-" + month + "-0" + i;
|
||||
}
|
||||
if (month >= 10 && i >= 10) {
|
||||
date = year + "-" + month + "-" + i;
|
||||
}
|
||||
|
||||
list.add(date);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Communicate> getCommunicateAbnorm(List<String> lineIndex, String startTime, String endTime) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("(");
|
||||
for (int i = 0; i < lineIndex.size(); i++) {
|
||||
if (lineIndex.size() - i != 1) {
|
||||
stringBuilder.append("line_id = '").append(lineIndex.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("line_id = '").append(lineIndex.get(i)).append("')");
|
||||
}
|
||||
}
|
||||
stringBuilder.append("and type = 0").append(" group by line_id ").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder.toString();
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<Communicate> communicateList = influxDBResultMapper.toPOJO(result, Communicate.class);
|
||||
return communicateList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@
|
||||
<groupId>org.influxdb</groupId>
|
||||
<artifactId>influxdb-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>3.0.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 13:42
|
||||
* 电压区域综合评估基本类
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BalanceInfo implements Serializable {
|
||||
@Data
|
||||
public class PointInfo {
|
||||
private Integer pointId;
|
||||
private String pointName;
|
||||
private QtIdx qtIdx;
|
||||
private float civ;
|
||||
private int l;
|
||||
|
||||
public PointInfo() {
|
||||
super();
|
||||
qtIdx = new QtIdx();
|
||||
}
|
||||
}
|
||||
@ApiModelProperty("区域的index")
|
||||
private String areaIndex;
|
||||
@ApiModelProperty("区域名称")
|
||||
private String areaName;
|
||||
@ApiModelProperty("系统最终的评估分")
|
||||
private float ci;
|
||||
@ApiModelProperty("监测点的详细信息")
|
||||
private List<PointInfo> list;
|
||||
@ApiModelProperty("标识是否经过计算,默认为0-未计算,1-计算")
|
||||
private int isCount;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import com.sun.jna.Structure;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 13:45
|
||||
* //单个监测点的暂降事件计算评价指标
|
||||
*/
|
||||
public class QtIdx extends Structure {
|
||||
@ApiModelProperty("暂降幅值")
|
||||
public float r_esm;
|
||||
@ApiModelProperty("sarifi-90")
|
||||
public int sarfi_90;
|
||||
@ApiModelProperty("sarifi-50")
|
||||
public int sarifi_50;
|
||||
@ApiModelProperty("暂降能量")
|
||||
public float r_asei;
|
||||
@ApiModelProperty("严重程度")
|
||||
public float r_assi;
|
||||
|
||||
public static class ByReference extends QtIdx implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
public static class ByValue extends QtIdx implements Structure.ByValue {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List getFieldOrder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof QtIdx))
|
||||
return false;
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
QtIdx instance = (QtIdx) obj;
|
||||
|
||||
return (r_esm == instance.r_esm) && (sarfi_90 == instance.sarfi_90) && (sarifi_50 == instance.sarifi_50) && (r_asei == instance.r_asei) && (r_assi == instance.r_assi);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月19日 11:10
|
||||
*/
|
||||
@Data
|
||||
public class Sarifi implements Serializable {
|
||||
private Float sarifiValue;
|
||||
private Float time;
|
||||
private Float pt1;
|
||||
private Float pt2;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.po.BalanceInfo;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.EventHeatMapVO;
|
||||
import com.njcn.event.pojo.vo.EventSeverityVO;
|
||||
@@ -24,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
@@ -106,5 +109,22 @@ public class AreaController extends BaseController {
|
||||
TerminalRunningStatisticsVO result = areaLineService.getTerminalRunningStatistics(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂降严重度
|
||||
*
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBalanceInfo")
|
||||
@ApiOperation("获取区域暂降综合评估")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "参数", required = true)
|
||||
public HttpResult<List<BalanceInfo>> getBalanceInfo(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getBalanceInfo");
|
||||
LogUtil.njcnDebug(log, "{},参数为:{}", methodDescribe, deviceInfoParam);
|
||||
List<BalanceInfo> result = areaLineService.getBalanceInfo(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.event.service;
|
||||
|
||||
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.po.BalanceInfo;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -42,4 +43,11 @@ public interface AreaLineService {
|
||||
*/
|
||||
TerminalRunningStatisticsVO getTerminalRunningStatistics(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
|
||||
/**
|
||||
* 获取区域暂降综合评估
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
List<BalanceInfo> getBalanceInfo(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,19 +8,22 @@ import com.njcn.device.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.api.LineFeignClient;
|
||||
import com.njcn.device.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.device.pojo.vo.SubstationDetailVO;
|
||||
import com.njcn.event.influxdb.PqsOnlinerateQuery;
|
||||
import com.njcn.event.mapper.PqDeviceMapper;
|
||||
import com.njcn.event.pojo.po.PqDevice;
|
||||
import com.njcn.event.pojo.po.PqsOnlinerate;
|
||||
import com.njcn.event.pojo.po.*;
|
||||
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.AreaLineService;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import com.sun.org.apache.regexp.internal.RE;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
@@ -37,6 +40,8 @@ import java.util.stream.Collectors;
|
||||
import static com.njcn.event.influxdb.PqsOnlinerateQuery.devIdOr;
|
||||
import static com.njcn.event.influxdb.QueryBuilder.*;
|
||||
|
||||
import com.njcn.event.pojo.po.BalanceInfo.PointInfo;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
@@ -46,17 +51,19 @@ import static com.njcn.event.influxdb.QueryBuilder.*;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AreaLineServiceImpl implements AreaLineService {
|
||||
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
|
||||
private final PqsOnlinerateQuery pqsOnlinerateQuery;
|
||||
|
||||
|
||||
private final PqDeviceMapper pqDeviceMapper;
|
||||
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
@Override
|
||||
public AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam) {
|
||||
AreaLineVO areaLineVO = new AreaLineVO();
|
||||
@@ -78,7 +85,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
int stateZd = 0;
|
||||
// 总次数
|
||||
int tail = 0;
|
||||
|
||||
|
||||
String color = "";
|
||||
List<SubstationDetailVO> substationDetailVOS = new ArrayList<>();
|
||||
if (subIndexs.size() > 0) {
|
||||
@@ -104,7 +111,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
int stateFalse = 0;
|
||||
// 次数
|
||||
double r = 0.0035;
|
||||
|
||||
|
||||
int j = 0;
|
||||
// 总的监测点个数
|
||||
int lineTail = lineDataVOList.size();
|
||||
@@ -144,7 +151,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
areaLineVO.setAreaValue(listObject);
|
||||
return areaLineVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EventHeatMapVO getEventHeatMap(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
EventHeatMapVO eventHeatMapVO = new EventHeatMapVO();
|
||||
@@ -183,7 +190,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
eventHeatMapVO.setEventHeatMapValue(eventHeatMapDetailList);
|
||||
return eventHeatMapVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EventSeverityVO getEventSeverity(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
EventSeverityVO eventSeverityVO = new EventSeverityVO();
|
||||
@@ -222,7 +229,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
eventSeverityVO.setEventSeverityValue(eventSeverityValueList);
|
||||
return eventSeverityVO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取终端运行统计
|
||||
*
|
||||
@@ -233,60 +240,99 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
public TerminalRunningStatisticsVO getTerminalRunningStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
// 区域计算
|
||||
TerminalRunningVO area = analyzeTerminalRun(deviceInfoParam);
|
||||
|
||||
|
||||
// 厂家计算
|
||||
deviceInfoParam.getStatisticalType().setCode(StatisticsEnum.MANUFACTURER.getCode());
|
||||
TerminalRunningVO factory = analyzeTerminalRun(deviceInfoParam);
|
||||
|
||||
|
||||
return TerminalRunningStatisticsVO.buildVO(area, factory);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<BalanceInfo> getBalanceInfo(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<BalanceInfo> balanceInfos = new ArrayList<>();
|
||||
//获取符合条件的监测点
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return balanceInfos;
|
||||
}
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
BalanceInfo balanceInfo = new BalanceInfo();
|
||||
balanceInfo.setAreaName(generalDeviceDTO.getName());
|
||||
balanceInfo.setAreaIndex(generalDeviceDTO.getIndex());
|
||||
//监测点
|
||||
List<String> lineList = generalDeviceDTO.getLineIndexes();
|
||||
List<PointInfo> list = new ArrayList<>();
|
||||
for (String lineIndex : lineList) {
|
||||
PointInfo pointInfo = balanceInfo.new PointInfo();
|
||||
Float value = getSarfiValue(deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), 0.9f, lineIndex);
|
||||
pointInfo.getQtIdx().r_esm = (value == null ? 0f : value);
|
||||
pointInfo.getQtIdx().sarfi_90 = getSarfiCount(deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), 0.9f, lineIndex); // 统计小于0.9的总数
|
||||
pointInfo.getQtIdx().sarifi_50 = getSarfiCount(deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), 0.5f, lineIndex); // 统计小于0.9的总数 // 统计小于0.5的总数
|
||||
//获取当前监测点的暂降信息
|
||||
List<EventDetail> eventDetailList = getEventDetailInfo(lineIndex, 0.9f, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime());
|
||||
if(eventDetailList.size()>0) {
|
||||
//获取监测点信息
|
||||
LineDetailDataVO lineDetailVO = lineFeignClient.getLineDetailData(lineIndex).getData();
|
||||
List<Sarifi> sarifis = new ArrayList<>();
|
||||
for (EventDetail eventDetail:eventDetailList){
|
||||
Sarifi sarifi = new Sarifi();
|
||||
sarifi.setTime(eventDetail.getPersistTime().floatValue());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return balanceInfos;
|
||||
}
|
||||
|
||||
private TerminalRunningVO analyzeTerminalRun(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
|
||||
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return TerminalRunningVO.empty();
|
||||
}
|
||||
List<String> deviceIndexList =
|
||||
generalDeviceDTOList.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||
|
||||
|
||||
if (CollUtil.isEmpty(deviceIndexList)) {
|
||||
return TerminalRunningVO.empty();
|
||||
}
|
||||
|
||||
|
||||
List<PqsOnlinerate> pqsOnlinerateList =
|
||||
pqsOnlinerateQuery.selectList(Arrays.asList("dev_id", "offlinemin", "onlinemin"),
|
||||
devIdOr(deviceIndexList),
|
||||
timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
|
||||
|
||||
List<PqDevice> pqDeviceList = pqDeviceMapper.queryRunFlagByDeviceIndexs(deviceIndexList);
|
||||
|
||||
|
||||
List<TerminalRunningInfoVO> terminalRun = generalDeviceDTOList.parallelStream().map(dto -> {
|
||||
List<String> deviceIndexes = dto.getDeviceIndexes();
|
||||
|
||||
TerminalRunningInfoVO terminalRunningInfoVO = new TerminalRunningInfoVO();
|
||||
terminalRunningInfoVO.setAreaName(dto.getName());
|
||||
terminalRunningInfoVO.setNumberOfTerminals(deviceIndexes.size());
|
||||
terminalRunningInfoVO.setNormal(countDeviceRunStatus(pqDeviceList).apply(0, deviceIndexes));
|
||||
terminalRunningInfoVO.setBreaks(countDeviceRunStatus(pqDeviceList).apply(1, deviceIndexes));
|
||||
terminalRunningInfoVO.setShutdown(countDeviceRunStatus(pqDeviceList).apply(2, deviceIndexes));
|
||||
if (deviceIndexes.size()==0) {
|
||||
terminalRunningInfoVO.setNormalRate(0.0);
|
||||
terminalRunningInfoVO.setBreaksRate(0.0);
|
||||
terminalRunningInfoVO.setShutdownRate(0.0);
|
||||
} else {
|
||||
double normalRate = terminalRunningInfoVO.getNormal().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setNormalRate(new BigDecimal(normalRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
double breaksRate = terminalRunningInfoVO.getBreaks().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setBreaksRate(new BigDecimal(breaksRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
double shutdownRate = terminalRunningInfoVO.getShutdown().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setShutdownRate(new BigDecimal(shutdownRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
terminalRunningInfoVO.setOnlineRate(computingDeviceOnlineRate(pqsOnlinerateList).apply(deviceIndexes));
|
||||
return terminalRunningInfoVO;
|
||||
}).sorted(TerminalRunningInfoVO.sortAscAreaName())
|
||||
List<String> deviceIndexes = dto.getDeviceIndexes();
|
||||
|
||||
TerminalRunningInfoVO terminalRunningInfoVO = new TerminalRunningInfoVO();
|
||||
terminalRunningInfoVO.setAreaName(dto.getName());
|
||||
terminalRunningInfoVO.setNumberOfTerminals(deviceIndexes.size());
|
||||
terminalRunningInfoVO.setNormal(countDeviceRunStatus(pqDeviceList).apply(0, deviceIndexes));
|
||||
terminalRunningInfoVO.setBreaks(countDeviceRunStatus(pqDeviceList).apply(1, deviceIndexes));
|
||||
terminalRunningInfoVO.setShutdown(countDeviceRunStatus(pqDeviceList).apply(2, deviceIndexes));
|
||||
if (deviceIndexes.size() == 0) {
|
||||
terminalRunningInfoVO.setNormalRate(0.0);
|
||||
terminalRunningInfoVO.setBreaksRate(0.0);
|
||||
terminalRunningInfoVO.setShutdownRate(0.0);
|
||||
} else {
|
||||
double normalRate = terminalRunningInfoVO.getNormal().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setNormalRate(new BigDecimal(normalRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
double breaksRate = terminalRunningInfoVO.getBreaks().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setBreaksRate(new BigDecimal(breaksRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
double shutdownRate = terminalRunningInfoVO.getShutdown().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setShutdownRate(new BigDecimal(shutdownRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
terminalRunningInfoVO.setOnlineRate(computingDeviceOnlineRate(pqsOnlinerateList).apply(deviceIndexes));
|
||||
return terminalRunningInfoVO;
|
||||
}).sorted(TerminalRunningInfoVO.sortAscAreaName())
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
|
||||
Integer terminalSum = terminalRun.stream().mapToInt(TerminalRunningInfoVO::getNumberOfTerminals)
|
||||
.sum();
|
||||
Long normalSum = terminalRun.stream().mapToLong(TerminalRunningInfoVO::getNormal)
|
||||
@@ -295,17 +341,17 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
.sum();
|
||||
Long shutdownSum = terminalRun.stream().mapToLong(TerminalRunningInfoVO::getShutdown)
|
||||
.sum();
|
||||
Double normalRateSum = 0.0,breaksRateSum = 0.0,shutdownRateSum = 0.0;
|
||||
if (terminalSum!=0) {
|
||||
normalRateSum = new BigDecimal(normalSum.doubleValue() / terminalSum *100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
breaksRateSum = new BigDecimal(breaksSum.doubleValue() / terminalSum *100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
shutdownRateSum = new BigDecimal(shutdownSum.doubleValue() / terminalSum *100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
Double normalRateSum = 0.0, breaksRateSum = 0.0, shutdownRateSum = 0.0;
|
||||
if (terminalSum != 0) {
|
||||
normalRateSum = new BigDecimal(normalSum.doubleValue() / terminalSum * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
breaksRateSum = new BigDecimal(breaksSum.doubleValue() / terminalSum * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
shutdownRateSum = new BigDecimal(shutdownSum.doubleValue() / terminalSum * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
}
|
||||
Double onlineRateAvg = computingDeviceOnlineRate(pqsOnlinerateList).apply(deviceIndexList);
|
||||
return TerminalRunningVO.buildVO(terminalSum, normalSum, normalRateSum, breaksSum, breaksRateSum, shutdownSum,
|
||||
shutdownRateSum, onlineRateAvg, terminalRun);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算装置在线率,在线率计算公式
|
||||
* OnlineRate = OnLineMin/( OnLineMin+ OffLineMin) * 100%;
|
||||
@@ -318,7 +364,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
List<PqsOnlinerate> value = pqsOnlinerateList.stream()
|
||||
.filter(t -> deviceIndexes.contains(t.getDevId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
int onlineSum = value.stream().mapToInt(PqsOnlinerate::getOnlinemin).sum();
|
||||
int offlineSum = value.stream().mapToInt(PqsOnlinerate::getOfflinemin).sum();
|
||||
BigDecimal b1 = new BigDecimal(onlineSum);
|
||||
@@ -330,7 +376,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
return b1.divide(b1.add(b2), 4, RoundingMode.HALF_UP).multiply(c).doubleValue();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据终端运行状态(0:投运;1:热备用;2:停运)查询数据数量
|
||||
*
|
||||
@@ -343,7 +389,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
.filter(t -> deviceIndexes.contains(t.getId()))
|
||||
.count();
|
||||
}
|
||||
|
||||
|
||||
public List<EventHeatDeatilVO> getContion(DeviceInfoParam.BusinessParam deviceInfoParam, List<String> lineIndexs) {
|
||||
// 组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
@@ -366,4 +412,69 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
List<EventHeatDeatilVO> eventdetailList = influxDBResultMapper.toPOJO(result, EventHeatDeatilVO.class);
|
||||
return eventdetailList;
|
||||
}
|
||||
|
||||
public Float getSarfiValue(String startTime, String endTime, Float fvalue, String id) {
|
||||
Float retList = 0f;
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("line_id = '").append(id).append("'").append(" and event_value <=").append(fvalue).append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "select mean(event_value) from " + InfluxDBPublicParam.PQS_EVENT_DETAIL + " where " + stringBuilder.toString();
|
||||
QueryResult queryResult = influxDbUtils.query(sql);
|
||||
List<QueryResult.Result> results = queryResult.getResults();
|
||||
if (results == null || results.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Result result = results.get(0);
|
||||
List<QueryResult.Series> seriess = result.getSeries();
|
||||
if (seriess == null || seriess.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Series series = seriess.get(0);
|
||||
List<List<Object>> values = series.getValues();
|
||||
for (List<Object> columnValue : values) {
|
||||
retList = BigDecimal.valueOf(Float.parseFloat(columnValue.get(1).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
public Integer getSarfiCount(String startTime, String endTime, Float fvalue, String id) {
|
||||
Integer retList = 0;
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("line_id = '").append(id).append("'").append(" and event_value <=").append(fvalue).append(" and persist_time<6000").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "select count(*) from " + InfluxDBPublicParam.PQS_EVENT_DETAIL + " where " + stringBuilder.toString();
|
||||
QueryResult queryResult = influxDbUtils.query(sql);
|
||||
List<QueryResult.Result> results = queryResult.getResults();
|
||||
if (results == null || results.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Result result = results.get(0);
|
||||
List<QueryResult.Series> seriess = result.getSeries();
|
||||
if (seriess == null || seriess.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Series series = seriess.get(0);
|
||||
List<List<Object>> values = series.getValues();
|
||||
for (List<Object> columnValue : values) {
|
||||
retList = (Integer) columnValue.get(1);
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
public List<EventDetail> getEventDetailInfo(String id, Float fvalue, String startTime, String endTime) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
//sql语句
|
||||
stringBuilder.append("line_id ='").append(id).append("'").append(" and event_value <=").append(fvalue).append(" and persist_time < 60000").append(" tz('Asia/Shanghai')");
|
||||
|
||||
String sql = "select * from pqs_eventdetail where " + stringBuilder;
|
||||
//获取暂降事件
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetail> eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
return eventDetailList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user