zbj//1.大屏中间所有数据综合评估
This commit is contained in:
@@ -74,4 +74,10 @@ public class AllDataVO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("中断")
|
@ApiModelProperty("中断")
|
||||||
private String breakdown;
|
private String breakdown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 综合评估
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("综合评估")
|
||||||
|
private String data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,12 @@
|
|||||||
<artifactId>okio</artifactId>
|
<artifactId>okio</artifactId>
|
||||||
<version>2.8.0</version>
|
<version>2.8.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>harmonic-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.event.mapper.majornetwork;
|
|||||||
import com.njcn.device.pq.pojo.vo.AllDataVO;
|
import com.njcn.device.pq.pojo.vo.AllDataVO;
|
||||||
import com.njcn.device.pq.pojo.vo.EventVO;
|
import com.njcn.device.pq.pojo.vo.EventVO;
|
||||||
import com.njcn.device.pq.pojo.vo.MiddleLimitRateVO;
|
import com.njcn.device.pq.pojo.vo.MiddleLimitRateVO;
|
||||||
|
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,4 +36,14 @@ public interface LargeScreenMapper {
|
|||||||
|
|
||||||
List<Map<String,Object>> getHomeostasisArea (@Param("indexIds") List<String> indexIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
List<Map<String,Object>> getHomeostasisArea (@Param("indexIds") List<String> indexIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计综合评估平均值
|
||||||
|
* @param lineIndexes
|
||||||
|
* @param searchBeginTime
|
||||||
|
* @param searchEndTime
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PQSComAssesPO> getAvgCount(@Param("ids") List<String> lineIndexes,
|
||||||
|
@Param("statTime") String searchBeginTime,
|
||||||
|
@Param("endTime") String searchEndTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,4 +214,57 @@
|
|||||||
</if>
|
</if>
|
||||||
group by rshom.org_no
|
group by rshom.org_no
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAvgCount" resultType="com.njcn.harmonic.pojo.po.PQSComAssesPO">
|
||||||
|
SELECT
|
||||||
|
line_id,
|
||||||
|
AVG ( vu_dev1 ) AS vu_dev1,
|
||||||
|
AVG ( vu_dev2 ) AS vu_dev2,
|
||||||
|
AVG ( vu_dev3 ) AS vu_dev3,
|
||||||
|
AVG ( vu_dev4 ) AS vu_dev4,
|
||||||
|
AVG ( vu_dev5 ) AS vu_dev5,
|
||||||
|
AVG ( freq_dev1 ) AS freq_dev1,
|
||||||
|
AVG ( freq_dev2 ) AS freq_dev2,
|
||||||
|
AVG ( freq_dev3 ) AS freq_dev3,
|
||||||
|
AVG ( freq_dev4 ) AS freq_dev4,
|
||||||
|
AVG ( freq_dev5 ) AS freq_dev5,
|
||||||
|
AVG ( data_plt1 ) AS data_plt1,
|
||||||
|
AVG ( data_plt2 ) AS data_plt2,
|
||||||
|
AVG ( data_plt3 ) AS data_plt3,
|
||||||
|
AVG ( data_plt4 ) AS data_plt4,
|
||||||
|
AVG ( data_plt5 ) AS data_plt5,
|
||||||
|
AVG ( v_unbalance1 ) AS v_unbalance1,
|
||||||
|
AVG ( v_unbalance2 ) AS v_unbalance2,
|
||||||
|
AVG ( v_unbalance3 ) AS v_unbalance3,
|
||||||
|
AVG ( v_unbalance4 ) AS v_unbalance4,
|
||||||
|
AVG ( v_unbalance5 ) AS v_unbalance5,
|
||||||
|
AVG ( v_thd1 ) AS v_thd1,
|
||||||
|
AVG ( v_thd2 ) AS v_thd2,
|
||||||
|
AVG ( v_thd3 ) AS v_thd3,
|
||||||
|
AVG ( v_thd4 ) AS v_thd4,
|
||||||
|
AVG ( v_thd5 ) AS v_thd5,
|
||||||
|
AVG ( event1 ) AS event1,
|
||||||
|
AVG ( event2 ) AS event2,
|
||||||
|
AVG ( event3 ) AS event3,
|
||||||
|
AVG ( event4 ) AS event4,
|
||||||
|
AVG ( event5 ) AS event5
|
||||||
|
FROM
|
||||||
|
r_stat_comasses_d
|
||||||
|
<where>
|
||||||
|
<if test=" ids != null and ids.size > 0">
|
||||||
|
AND line_id IN
|
||||||
|
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test=" statTime != null and statTime !=''">
|
||||||
|
AND time_id >= #{statTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND time_id <= #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY line_id
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.njcn.event.service.majornetwork.Impl;
|
package com.njcn.event.service.majornetwork.Impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
@@ -8,6 +10,9 @@ import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam;
|
|||||||
import com.njcn.device.pq.pojo.vo.*;
|
import com.njcn.device.pq.pojo.vo.*;
|
||||||
import com.njcn.event.mapper.majornetwork.LargeScreenMapper;
|
import com.njcn.event.mapper.majornetwork.LargeScreenMapper;
|
||||||
import com.njcn.event.service.majornetwork.LargeScreenService;
|
import com.njcn.event.service.majornetwork.LargeScreenService;
|
||||||
|
import com.njcn.harmonic.pojo.dto.ComAssessDTO;
|
||||||
|
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
|
||||||
|
import com.njcn.harmonic.utils.HarmonicComAssesUtil;
|
||||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -15,7 +20,9 @@ import org.apache.commons.collections.map.HashedMap;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -37,6 +44,8 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
|
|
||||||
private final LargeScreenMapper largeScreenMapper;
|
private final LargeScreenMapper largeScreenMapper;
|
||||||
|
|
||||||
|
private final HarmonicComAssesUtil comAssesUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暂降事件区域
|
* 暂降事件区域
|
||||||
*/
|
*/
|
||||||
@@ -308,14 +317,33 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
float f = 0.0f;
|
float f = 0.0f;
|
||||||
for (AllDataVO allDataVO : result) {
|
for (AllDataVO allDataVO : result) {
|
||||||
for (Map<String, Object> map : homeostasisArea) {
|
for (Map<String, Object> map : homeostasisArea) {
|
||||||
if (Objects.equals(map.get("id"),allDataVO.getIndex())){
|
if (Objects.equals(map.get("id"), allDataVO.getIndex())) {
|
||||||
f=Float.parseFloat(map.get("avg").toString());
|
f = Float.parseFloat(map.get("avg").toString());
|
||||||
allDataVO.setSteadyLoad(String.valueOf((1-f)*100));
|
allDataVO.setSteadyLoad(String.valueOf((1 - f) * 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<ComAssessDTO> comAssessDTOS = new ArrayList<>();
|
||||||
//todo 该接口部分功能未完成 1.综合评估
|
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||||
|
if (!CollectionUtils.isEmpty(generalDeviceDTO.getLineIndexes())) {
|
||||||
|
List<PQSComAssesPO> pqsComAssesPOS = getComAccessData(generalDeviceDTO.getLineIndexes(), largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
||||||
|
setResults(pqsComAssesPOS, comAssessDTOS);
|
||||||
|
float allComAss = comAssesUtil.getAllComAss(comAssessDTOS);
|
||||||
|
/*String lv = getLevel(allComAss);*/
|
||||||
|
/*comAssessVO.setData(allComAss);*/
|
||||||
|
for (AllDataVO allDataVO : result) {
|
||||||
|
if (Objects.equals(generalDeviceDTO.getIndex(), allDataVO.getIndex())) {
|
||||||
|
allDataVO.setData(String.valueOf(allComAss));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*comAssessVO.setLevel(lv);*/
|
||||||
|
}
|
||||||
|
for (AllDataVO allDataVO : result) {
|
||||||
|
if (Objects.isNull(allDataVO.getData())){
|
||||||
|
allDataVO.setData("-1");
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +423,7 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
nf.setMaximumFractionDigits(2);//保留两位小数,即四舍五入到小数点后两位
|
nf.setMaximumFractionDigits(2);//保留两位小数,即四舍五入到小数点后两位
|
||||||
nf.setRoundingMode(RoundingMode.HALF_UP);//设置四舍五入模式为四舍五入
|
nf.setRoundingMode(RoundingMode.HALF_UP);//设置四舍五入模式为四舍五入
|
||||||
float v = Float.parseFloat(nf.format(value));
|
float v = Float.parseFloat(nf.format(value));
|
||||||
return String.valueOf(v*100);
|
return String.valueOf(v * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -421,4 +449,90 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
return largeScreenMapper.getMiddleLimitRate(lineIds, largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
return largeScreenMapper.getMiddleLimitRate(lineIds, largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置保留四位小数
|
||||||
|
private void setResults(List<PQSComAssesPO> pqsComAssesPOS, List<ComAssessDTO> comAssessDTOS) {
|
||||||
|
for (int i = 0; i < pqsComAssesPOS.size(); i++) {
|
||||||
|
float v1 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
ComAssessDTO comAssessDTO = new ComAssessDTO();
|
||||||
|
comAssessDTO.setVuDev1(v1);
|
||||||
|
float v2 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVuDev2(v2);
|
||||||
|
float v3 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVuDev3(v3);
|
||||||
|
float v4 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVuDev4(v4);
|
||||||
|
float v5 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVuDev5(v5);
|
||||||
|
float f1 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setFreqDev1(f1);
|
||||||
|
float f2 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setFreqDev2(f2);
|
||||||
|
float f3 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setFreqDev3(f3);
|
||||||
|
float f4 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setFreqDev4(f4);
|
||||||
|
float f5 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setFreqDev5(f5);
|
||||||
|
float d1 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setDataPlT1(d1);
|
||||||
|
float d2 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setDataPlT2(d2);
|
||||||
|
float d3 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setDataPlT3(d3);
|
||||||
|
float d4 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setDataPlT4(d4);
|
||||||
|
float d5 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setDataPlT5(d5);
|
||||||
|
float vu1 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVUnbalance1(vu1);
|
||||||
|
float vu2 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVUnbalance2(vu2);
|
||||||
|
float vu3 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVUnbalance3(vu3);
|
||||||
|
float vu4 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVUnbalance4(vu4);
|
||||||
|
float vu5 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVUnbalance5(vu5);
|
||||||
|
float vt1 = new BigDecimal(pqsComAssesPOS.get(i).getVThd1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVTHD1(vt1);
|
||||||
|
float vt2 = new BigDecimal(pqsComAssesPOS.get(i).getVThd2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVTHD2(vt2);
|
||||||
|
float vt3 = new BigDecimal(pqsComAssesPOS.get(i).getVThd3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVTHD3(vt3);
|
||||||
|
float vt4 = new BigDecimal(pqsComAssesPOS.get(i).getVThd4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVTHD4(vt4);
|
||||||
|
float vt5 = new BigDecimal(pqsComAssesPOS.get(i).getVThd5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setVTHD5(vt5);
|
||||||
|
float e1 = new BigDecimal(pqsComAssesPOS.get(i).getEvent1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setEvent1(e1);
|
||||||
|
float e2 = new BigDecimal(pqsComAssesPOS.get(i).getEvent2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setEvent2(e2);
|
||||||
|
float e3 = new BigDecimal(pqsComAssesPOS.get(i).getEvent3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setEvent3(e3);
|
||||||
|
float e4 = new BigDecimal(pqsComAssesPOS.get(i).getEvent4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setEvent4(e4);
|
||||||
|
float e5 = new BigDecimal(pqsComAssesPOS.get(i).getEvent5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
|
comAssessDTO.setEvent5(e5);
|
||||||
|
comAssessDTOS.add(comAssessDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* influxDB查询综合评估相关信息
|
||||||
|
* 返回每个监测点在时间段的各指标平均数
|
||||||
|
*
|
||||||
|
* @param lineIndexes
|
||||||
|
* @param searchBeginTime
|
||||||
|
* @param searchEndTime
|
||||||
|
*/
|
||||||
|
private List<PQSComAssesPO> getComAccessData(List<String> lineIndexes, String searchBeginTime, String searchEndTime) {
|
||||||
|
List<PQSComAssesPO> avgCount = largeScreenMapper.getAvgCount(lineIndexes,
|
||||||
|
DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toString(),
|
||||||
|
DateUtil.beginOfDay(DateUtil.parse(searchEndTime)).toString());
|
||||||
|
if (CollUtil.isNotEmpty(avgCount)) {
|
||||||
|
return avgCount;
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user