代码修改
This commit is contained in:
@@ -227,6 +227,9 @@ public class COverlimit {
|
|||||||
case "515kV":
|
case "515kV":
|
||||||
uL = 535.0f;
|
uL = 535.0f;
|
||||||
break;
|
break;
|
||||||
|
case "800kV":
|
||||||
|
uL = 825.0f;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ package com.njcn.device.pq.mapper;
|
|||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
|
||||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -14,4 +18,11 @@ import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
|||||||
*/
|
*/
|
||||||
public interface RStatIntegrityDMapper extends BaseMapper<RStatIntegrityD> {
|
public interface RStatIntegrityDMapper extends BaseMapper<RStatIntegrityD> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取监测点数据完整性
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/3/29
|
||||||
|
*/
|
||||||
|
List<LineDataIntegrity> getLineIntegrityRate(@Param("lineIds")List<String> lineIds,@Param("startTime")String startTime,@Param("endTime")String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?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.TerminalOnlineRateDataMapper">
|
||||||
|
|
||||||
|
<select id="getLineIntegrityRate" resultType="LineDataIntegrity">
|
||||||
|
select line_index lineId,avg(real_time/due_time) integrityData
|
||||||
|
from r_stat_integrity_d
|
||||||
|
where line_index in
|
||||||
|
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
and time_id between #{startTime} and #{endTime}
|
||||||
|
group by line_index
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -172,7 +172,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="getDevOnlineByDevIds" resultType="TerminalOnlineRateData">
|
<select id="getDevOnlineByDevIds" resultType="TerminalOnlineRateData">
|
||||||
select dev_index,avg(offline_min) offlineRate
|
select dev_index devId,avg(online_min/(online_min+offline_min)) onlineRate
|
||||||
from r_stat_onlinerate_d
|
from r_stat_onlinerate_d
|
||||||
where dev_index in
|
where dev_index in
|
||||||
<foreach collection="devIds" item="item" open="(" close=")" separator=",">
|
<foreach collection="devIds" item="item" open="(" close=")" separator=",">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.device.pq.api.AlarmClient;
|
|||||||
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
||||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||||
import com.njcn.device.pq.mapper.LineIntegrityDataMapper;
|
import com.njcn.device.pq.mapper.LineIntegrityDataMapper;
|
||||||
|
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||||
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
||||||
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
|
import com.njcn.device.pq.pojo.po.LineDataIntegrity;
|
||||||
@@ -54,6 +55,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
|||||||
|
|
||||||
private final GeneralDeviceService generalDeviceService;
|
private final GeneralDeviceService generalDeviceService;
|
||||||
|
|
||||||
|
private final RStatIntegrityDMapper rStatIntegrityDMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点数据完整性
|
* 监测点数据完整性
|
||||||
*
|
*
|
||||||
@@ -105,13 +108,9 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
|
|||||||
// 通过供电公司索引查询省会
|
// 通过供电公司索引查询省会
|
||||||
List<LineIntegrityDataVO> proList = lineIntegrityDataMapper.getProvinceList(gdIds);
|
List<LineIntegrityDataVO> proList = lineIntegrityDataMapper.getProvinceList(gdIds);
|
||||||
|
|
||||||
|
List<LineDataIntegrity> percentageOfCompleteDatas = rStatIntegrityDMapper.getLineIntegrityRate(generalDeviceDTO.getLineIndexes(),lineIntegrityDataParam.getSearchBeginTime(), lineIntegrityDataParam.getSearchEndTime());
|
||||||
|
|
||||||
|
|
||||||
// 通过工具类得到查询influxdb的条件(相当于mysql中的in)
|
|
||||||
StringBuilder lineIdsForInfluxdb = InfluxDBCommUtils.assToInfluxParam(generalDeviceDTO.getLineIndexes());
|
|
||||||
// 通过监测点id集合查询influxdb监测点数据完整性
|
|
||||||
List<LineDataIntegrity> percentageOfCompleteDatas = getPercentageOfCompleteData(lineIntegrityDataParam.getSearchBeginTime(), lineIntegrityDataParam.getSearchEndTime(), lineIdsForInfluxdb);
|
|
||||||
|
|
||||||
|
|
||||||
for (LineIntegrityDataVO lineDataIntegrity : lineList) {
|
for (LineIntegrityDataVO lineDataIntegrity : lineList) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
|||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final IRStatOnlinerateDService irStatOnlinerateDService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终端在线率列表
|
* 终端在线率列表
|
||||||
@@ -188,40 +188,6 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 从influxdb中获取完整数据百分比
|
|
||||||
*
|
|
||||||
* @param startTime 查询开始时间
|
|
||||||
* @param endTime 查询结束时间
|
|
||||||
* @param deviceIndexes 终端id索引集合
|
|
||||||
*/
|
|
||||||
private List<TerminalOnlineRateData> getPercentageOfOnlineRate(String startTime, String endTime, StringBuilder deviceIndexes) {
|
|
||||||
|
|
||||||
//组装sql语句
|
|
||||||
StringBuilder queryCriteria = new StringBuilder();
|
|
||||||
// 构造sql查询条件
|
|
||||||
queryCriteria.append(deviceIndexes)
|
|
||||||
.append(" and ")
|
|
||||||
.append(InfluxDBPublicParam.TIME)
|
|
||||||
.append(" >= '")
|
|
||||||
.append(startTime)
|
|
||||||
.append(InfluxDBPublicParam.START_TIME)
|
|
||||||
.append("' and ")
|
|
||||||
.append(InfluxDBPublicParam.TIME)
|
|
||||||
.append(" <= '")
|
|
||||||
.append(endTime)
|
|
||||||
.append(InfluxDBPublicParam.END_TIME)
|
|
||||||
.append("'");
|
|
||||||
//sql语句
|
|
||||||
String sql = "SELECT mean(online_rate) as online_rate FROM pqs_onlinerate WHERE " + queryCriteria + " group by dev_id " + InfluxDBPublicParam.TIME_ZONE;
|
|
||||||
// 结果集
|
|
||||||
QueryResult results = influxDbUtils.query(sql);
|
|
||||||
|
|
||||||
// 结果集映射到对象中
|
|
||||||
InfluxDBResultMapper resultMapper = new InfluxDBResultMapper();
|
|
||||||
// 返回结果
|
|
||||||
return resultMapper.toPOJO(results, TerminalOnlineRateData.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user