修改暂降严重度和暂降热力图接口

This commit is contained in:
Lee
2023-04-10 16:35:47 +08:00
parent 766d824f54
commit 9fc0e6bb41
9 changed files with 161 additions and 111 deletions

View File

@@ -1,5 +1,6 @@
package com.njcn.device.pq.pojo.dto; package com.njcn.device.pq.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -28,6 +29,7 @@ public class GeneralDeviceDTO implements Serializable {
/** /**
* name对应统计名称如 区域南京市、苏州市电压等级10kV、220kV... * name对应统计名称如 区域南京市、苏州市电压等级10kV、220kV...
*/ */
@ApiModelProperty(name = "name", value = "名称")
private String name; private String name;
/** /**
@@ -59,5 +61,7 @@ public class GeneralDeviceDTO implements Serializable {
* lineIndexes监测点索引集合 * lineIndexes监测点索引集合
*/ */
private List<String> lineIndexes = new ArrayList<>(); private List<String> lineIndexes = new ArrayList<>();
@ApiModelProperty(name = "tail", value = "总数")
private Integer tail;
} }

View File

@@ -82,4 +82,7 @@ public class AreaLineInfoVO implements Serializable {
@ApiModelProperty(name = "loadType",value = "干扰源类型") @ApiModelProperty(name = "loadType",value = "干扰源类型")
private String loadType; private String loadType;
@ApiModelProperty(name = "tail",value = "总数")
private Integer tail;
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.event.pojo.vo; package com.njcn.event.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -16,4 +17,9 @@ public class BaseVO {
private String name; private String name;
private BigDecimal value; private BigDecimal value;
/**
* 综合评估
*/
@ApiModelProperty("综合评估")
private String data;
} }

View File

@@ -1,5 +1,6 @@
package com.njcn.event.pojo.vo; package com.njcn.event.pojo.vo;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -18,5 +19,5 @@ public class EventHeatMapVO implements Serializable {
private List<BaseVO> areaValue; private List<BaseVO> areaValue;
@ApiModelProperty(name = "eventHeatMapValue",value = "热力图数值") @ApiModelProperty(name = "eventHeatMapValue",value = "热力图数值")
private List<List<Object>> eventHeatMapValue; private List<List<AreaLineInfoVO>> eventHeatMapValue;
} }

View File

@@ -8,15 +8,16 @@ import java.util.List;
/** /**
* 暂降严重度 * 暂降严重度
*
* @author denghuajun * @author denghuajun
* @version 1.0.0 * @version 1.0.0
* @date 2022年05月07日 09:03 * @date 2022年05月07日 09:03
*/ */
@Data @Data
public class EventSeverityVO implements Serializable { public class EventSeverityVO implements Serializable {
@ApiModelProperty(name = "areaValue",value = "数值") @ApiModelProperty(name = "areaValue", value = "数值")
private List<List<Object>> areaValue; private List<List<Object>> areaValue;
@ApiModelProperty(name = "eventSeverityValue",value = "暂降严重度数值") @ApiModelProperty(name = "eventSeverityValue", value = "暂降严重度数值")
private List<EventSeverityValueVO> eventSeverityValue; private List<EventSeverityValueVO> eventSeverityValue;
} }

View File

@@ -23,6 +23,10 @@ import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningInfoVO;
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO; import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO;
import com.njcn.event.service.majornetwork.AreaLineService; import com.njcn.event.service.majornetwork.AreaLineService;
import com.njcn.event.service.majornetwork.EventDetailService; import com.njcn.event.service.majornetwork.EventDetailService;
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.influxdb.param.InfluxDBPublicParam; import com.njcn.influxdb.param.InfluxDBPublicParam;
import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.influxdb.utils.InfluxDbUtils;
import com.njcn.system.pojo.enums.StatisticsEnum; import com.njcn.system.pojo.enums.StatisticsEnum;
@@ -30,6 +34,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.influxdb.dto.QueryResult; import org.influxdb.dto.QueryResult;
import org.influxdb.impl.InfluxDBResultMapper; import org.influxdb.impl.InfluxDBResultMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -62,7 +67,10 @@ public class AreaLineServiceImpl implements AreaLineService {
private final PqDeviceMapper pqDeviceMapper; private final PqDeviceMapper pqDeviceMapper;
private final EventDetailService eventDetailService; private final EventDetailService eventDetailService;
@Autowired
private LargeScreenService largeScreenService;
@Autowired
private HarmonicComAssesUtil comAssesUtil;
@Override @Override
public AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam) { public AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam) {
@@ -155,7 +163,7 @@ public class AreaLineServiceImpl implements AreaLineService {
@Override @Override
public EventHeatMapVO getEventHeatMap(DeviceInfoParam.BusinessParam deviceInfoParam) { public EventHeatMapVO getEventHeatMap(DeviceInfoParam.BusinessParam deviceInfoParam) {
EventHeatMapVO eventHeatMapVO = new EventHeatMapVO(); EventHeatMapVO eventHeatMapVO = new EventHeatMapVO();
List<List<Object>> eventHeatMapDetailList = new ArrayList<>(); List<List<AreaLineInfoVO>> eventHeatMapDetailList = new ArrayList<>();
deviceInfoParam.setServerName(ServerEnum.EVENT.getName()); deviceInfoParam.setServerName(ServerEnum.EVENT.getName());
List<BaseVO> listObject = new ArrayList<>(); List<BaseVO> listObject = new ArrayList<>();
// 获取暂降监测点 // 获取暂降监测点
@@ -172,37 +180,42 @@ public class AreaLineServiceImpl implements AreaLineService {
//数据暂降查询 //数据暂降查询
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIndexs) .in(RmpEventDetailPO::getMeasurementPointId, lineIndexs)
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) .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()))) .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
); );
List<EventHeatDeatilVO> eventdetailList= BeanUtil.copyToList(info,EventHeatDeatilVO.class); List<EventHeatDeatilVO> eventdetailList = BeanUtil.copyToList(info, EventHeatDeatilVO.class);
if (eventdetailList.size() > 0) { if (eventdetailList.size() > 0) {
List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).collect(Collectors.toList()); List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).collect(Collectors.toList());
List<AreaLineInfoVO> areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); List<AreaLineInfoVO> areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
for (EventHeatDeatilVO eventHeat : eventdetailList) { for (EventHeatDeatilVO eventHeat : eventdetailList) {
for(AreaLineInfoVO areaLineInfoVO : areaAnalysisVOList){ for (AreaLineInfoVO areaLineInfoVO : areaAnalysisVOList) {
if(eventHeat.getLineId().equals(areaLineInfoVO.getLineId())){ if (eventHeat.getLineId().equals(areaLineInfoVO.getLineId())) {
List<Object> ev = new ArrayList<>(); List<AreaLineInfoVO> ev = new ArrayList<>();
tail += eventHeat.getCount(); tail += eventHeat.getCount() == null ? 0 : eventHeat.getCount();
ev.add(areaLineInfoVO.getLng()); areaLineInfoVO.setTail(tail);
ev.add(areaLineInfoVO.getLat()); ev.add(areaLineInfoVO);
ev.add(tail);
eventHeatMapDetailList.add(ev); eventHeatMapDetailList.add(ev);
break; break;
} }
} }
} }
//获取综合评估
List<PQSComAssesPO> comAccessData = largeScreenService.getComAccessData(lineIndexs, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime());
List<ComAssessDTO> comAssessDTOS = new ArrayList<>();
largeScreenService.setResults(comAccessData, comAssessDTOS);
float allComAss = comAssesUtil.getAllComAss(comAssessDTOS);
BaseVO baseVO = new BaseVO(); BaseVO baseVO = new BaseVO();
baseVO.setName(generalDeviceDTO.getName()); baseVO.setName(generalDeviceDTO.getName());
baseVO.setValue(BigDecimal.valueOf(lineIndexs.size())); baseVO.setValue(BigDecimal.valueOf(lineIndexs.size()));
baseVO.setData(String.valueOf(allComAss));
listObject.add(baseVO); listObject.add(baseVO);
} }
} else { } else {
BaseVO baseVO = new BaseVO(); BaseVO baseVO = new BaseVO();
baseVO.setName(generalDeviceDTO.getName()); baseVO.setName(generalDeviceDTO.getName());
baseVO.setValue(BigDecimal.valueOf(3.141592)); baseVO.setValue(BigDecimal.valueOf(3.141592));
baseVO.setData("-1");
listObject.add(baseVO); listObject.add(baseVO);
} }
i++; i++;
@@ -233,10 +246,10 @@ public class AreaLineServiceImpl implements AreaLineService {
// List<EventHeatDeatilVO> eventdetailList = getContion(deviceInfoParam, lineIndexs); // List<EventHeatDeatilVO> eventdetailList = getContion(deviceInfoParam, lineIndexs);
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>() List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIndexs) .in(RmpEventDetailPO::getMeasurementPointId, lineIndexs)
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))) .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()))) .le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
); );
List<EventHeatDeatilVO> eventdetailList= BeanUtil.copyToList(info,EventHeatDeatilVO.class); List<EventHeatDeatilVO> eventdetailList = BeanUtil.copyToList(info, EventHeatDeatilVO.class);
if (eventdetailList.size() > 0) { if (eventdetailList.size() > 0) {
for (int eventNum = 0; eventNum < eventdetailList.size(); eventNum++) { for (int eventNum = 0; eventNum < eventdetailList.size(); eventNum++) {
tail += eventdetailList.get(eventNum).getCount(); tail += eventdetailList.get(eventNum).getCount();
@@ -245,7 +258,7 @@ public class AreaLineServiceImpl implements AreaLineService {
eventSeverityValueVO.setLineNum(lineIndexs.size()); eventSeverityValueVO.setLineNum(lineIndexs.size());
eventSeverityValueVO.setEventNum(tail); eventSeverityValueVO.setEventNum(tail);
eventSeverityValueList.add(eventSeverityValueVO); eventSeverityValueList.add(eventSeverityValueVO);
objectList.add(generalDeviceDTO.getName() + "\n(" + lineIndexs.size() + ")"); objectList.add(generalDeviceDTO.getName());
objectList.add(tail); objectList.add(tail);
listObject.add(objectList); listObject.add(objectList);
} }

View File

@@ -1,8 +1,10 @@
package com.njcn.event.service.majornetwork.Impl; package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; 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.api.GeneralDeviceInfoClient;
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;
import com.njcn.device.pq.pojo.param.LargeScreenParam; import com.njcn.device.pq.pojo.param.LargeScreenParam;
@@ -17,9 +19,7 @@ import com.njcn.system.pojo.enums.StatisticsEnum;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -340,7 +340,7 @@ public class LargeScreenServiceImpl implements LargeScreenService {
/*comAssessVO.setLevel(lv);*/ /*comAssessVO.setLevel(lv);*/
} }
for (AllDataVO allDataVO : result) { for (AllDataVO allDataVO : result) {
if (Objects.isNull(allDataVO.getData())){ if (Objects.isNull(allDataVO.getData())) {
allDataVO.setData("-1"); allDataVO.setData("-1");
} }
} }
@@ -451,70 +451,73 @@ public class LargeScreenServiceImpl implements LargeScreenService {
} }
//设置保留四位小数 //设置保留四位小数
private void setResults(List<PQSComAssesPO> pqsComAssesPOS, List<ComAssessDTO> comAssessDTOS) { @Override
for (int i = 0; i < pqsComAssesPOS.size(); i++) { public void setResults(List<PQSComAssesPO> pqsComAssesPOS, List<ComAssessDTO> comAssessDTOS) {
float v1 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); if (CollectionUtil.isNotEmpty(pqsComAssesPOS)) {
ComAssessDTO comAssessDTO = new ComAssessDTO(); for (int i = 0; i < pqsComAssesPOS.size(); i++) {
comAssessDTO.setVuDev1(v1); float v1 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
float v2 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); ComAssessDTO comAssessDTO = new ComAssessDTO();
comAssessDTO.setVuDev2(v2); comAssessDTO.setVuDev1(v1);
float v3 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float v2 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVuDev3(v3); comAssessDTO.setVuDev2(v2);
float v4 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float v3 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVuDev4(v4); comAssessDTO.setVuDev3(v3);
float v5 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float v4 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVuDev5(v5); comAssessDTO.setVuDev4(v4);
float f1 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float v5 = new BigDecimal(pqsComAssesPOS.get(i).getVuDev5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setFreqDev1(f1); comAssessDTO.setVuDev5(v5);
float f2 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float f1 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setFreqDev2(f2); comAssessDTO.setFreqDev1(f1);
float f3 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float f2 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setFreqDev3(f3); comAssessDTO.setFreqDev2(f2);
float f4 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float f3 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setFreqDev4(f4); comAssessDTO.setFreqDev3(f3);
float f5 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float f4 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setFreqDev5(f5); comAssessDTO.setFreqDev4(f4);
float d1 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float f5 = new BigDecimal(pqsComAssesPOS.get(i).getFreqDev5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setDataPlT1(d1); comAssessDTO.setFreqDev5(f5);
float d2 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float d1 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setDataPlT2(d2); comAssessDTO.setDataPlT1(d1);
float d3 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float d2 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setDataPlT3(d3); comAssessDTO.setDataPlT2(d2);
float d4 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float d3 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setDataPlT4(d4); comAssessDTO.setDataPlT3(d3);
float d5 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float d4 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setDataPlT5(d5); comAssessDTO.setDataPlT4(d4);
float vu1 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float d5 = new BigDecimal(pqsComAssesPOS.get(i).getDataPlt5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVUnbalance1(vu1); comAssessDTO.setDataPlT5(d5);
float vu2 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vu1 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVUnbalance2(vu2); comAssessDTO.setVUnbalance1(vu1);
float vu3 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vu2 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVUnbalance3(vu3); comAssessDTO.setVUnbalance2(vu2);
float vu4 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vu3 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVUnbalance4(vu4); comAssessDTO.setVUnbalance3(vu3);
float vu5 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vu4 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVUnbalance5(vu5); comAssessDTO.setVUnbalance4(vu4);
float vt1 = new BigDecimal(pqsComAssesPOS.get(i).getVThd1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vu5 = new BigDecimal(pqsComAssesPOS.get(i).getVUnbalance5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVTHD1(vt1); comAssessDTO.setVUnbalance5(vu5);
float vt2 = new BigDecimal(pqsComAssesPOS.get(i).getVThd2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vt1 = new BigDecimal(pqsComAssesPOS.get(i).getVThd1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVTHD2(vt2); comAssessDTO.setVTHD1(vt1);
float vt3 = new BigDecimal(pqsComAssesPOS.get(i).getVThd3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vt2 = new BigDecimal(pqsComAssesPOS.get(i).getVThd2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVTHD3(vt3); comAssessDTO.setVTHD2(vt2);
float vt4 = new BigDecimal(pqsComAssesPOS.get(i).getVThd4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vt3 = new BigDecimal(pqsComAssesPOS.get(i).getVThd3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVTHD4(vt4); comAssessDTO.setVTHD3(vt3);
float vt5 = new BigDecimal(pqsComAssesPOS.get(i).getVThd5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vt4 = new BigDecimal(pqsComAssesPOS.get(i).getVThd4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setVTHD5(vt5); comAssessDTO.setVTHD4(vt4);
float e1 = new BigDecimal(pqsComAssesPOS.get(i).getEvent1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float vt5 = new BigDecimal(pqsComAssesPOS.get(i).getVThd5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setEvent1(e1); comAssessDTO.setVTHD5(vt5);
float e2 = new BigDecimal(pqsComAssesPOS.get(i).getEvent2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float e1 = new BigDecimal(pqsComAssesPOS.get(i).getEvent1()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setEvent2(e2); comAssessDTO.setEvent1(e1);
float e3 = new BigDecimal(pqsComAssesPOS.get(i).getEvent3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float e2 = new BigDecimal(pqsComAssesPOS.get(i).getEvent2()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setEvent3(e3); comAssessDTO.setEvent2(e2);
float e4 = new BigDecimal(pqsComAssesPOS.get(i).getEvent4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float e3 = new BigDecimal(pqsComAssesPOS.get(i).getEvent3()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setEvent4(e4); comAssessDTO.setEvent3(e3);
float e5 = new BigDecimal(pqsComAssesPOS.get(i).getEvent5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); float e4 = new BigDecimal(pqsComAssesPOS.get(i).getEvent4()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setEvent5(e5); comAssessDTO.setEvent4(e4);
comAssessDTOS.add(comAssessDTO); float e5 = new BigDecimal(pqsComAssesPOS.get(i).getEvent5()).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
comAssessDTO.setEvent5(e5);
comAssessDTOS.add(comAssessDTO);
}
} }
} }
@@ -526,12 +529,15 @@ public class LargeScreenServiceImpl implements LargeScreenService {
* @param searchBeginTime * @param searchBeginTime
* @param searchEndTime * @param searchEndTime
*/ */
private List<PQSComAssesPO> getComAccessData(List<String> lineIndexes, String searchBeginTime, String searchEndTime) { @Override
List<PQSComAssesPO> avgCount = largeScreenMapper.getAvgCount(lineIndexes, public List<PQSComAssesPO> getComAccessData(List<String> lineIndexes, String searchBeginTime, String searchEndTime) {
DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toString(), if (CollectionUtil.isNotEmpty(lineIndexes)) {
DateUtil.beginOfDay(DateUtil.parse(searchEndTime)).toString()); List<PQSComAssesPO> avgCount = largeScreenMapper.getAvgCount(lineIndexes,
if (CollUtil.isNotEmpty(avgCount)) { DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toString(),
return avgCount; DateUtil.beginOfDay(DateUtil.parse(searchEndTime)).toString());
if (CollUtil.isNotEmpty(avgCount)) {
return avgCount;
}
} }
return new ArrayList<>(); return new ArrayList<>();
} }

View File

@@ -2,6 +2,8 @@ package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.LargeScreenParam; import com.njcn.device.pq.pojo.param.LargeScreenParam;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
import com.njcn.harmonic.pojo.dto.ComAssessDTO;
import com.njcn.harmonic.pojo.po.PQSComAssesPO;
import java.util.List; import java.util.List;
@@ -28,4 +30,8 @@ public interface LargeScreenService {
List<MiddleTerminalVO> getMiddleTerminal(LargeScreenParam largeScreenParam); List<MiddleTerminalVO> getMiddleTerminal(LargeScreenParam largeScreenParam);
List<MiddleLimitRateVO> getMiddleLimitRate(LargeScreenParam largeScreenParam); List<MiddleLimitRateVO> getMiddleLimitRate(LargeScreenParam largeScreenParam);
List<PQSComAssesPO> getComAccessData(List<String> lineIndexes, String searchBeginTime, String searchEndTime);
void setResults(List<PQSComAssesPO> pqsComAssesPOS, List<ComAssessDTO> comAssessDTOS);
} }

View File

@@ -1,6 +1,7 @@
package com.njcn.harmonic.utils; package com.njcn.harmonic.utils;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.harmonic.pojo.dto.ComAssessDTO; import com.njcn.harmonic.pojo.dto.ComAssessDTO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -65,7 +66,7 @@ public class HarmonicComAssesUtil {
// 综合评估程序,返回值为评估分 // 综合评估程序,返回值为评估分
public float GetComAsses(float in_data[][]) { public float GetComAsses(float in_data[][]) {
float fResult = 0.0f;//返回最终评分 float fResult = 0.0f;//返回最终评分
try{ try {
//实例化所有参数 //实例化所有参数
Assess = new float[ST_QT_NUM][GRADE_NUM]; Assess = new float[ST_QT_NUM][GRADE_NUM];
Weight = new float[ST_QT_NUM][METHOD_NUM]; Weight = new float[ST_QT_NUM][METHOD_NUM];
@@ -88,7 +89,12 @@ public class HarmonicComAssesUtil {
if (getBysxf()) { if (getBysxf()) {
//G和F得出综合权重A //G和F得出综合权重A
if (getZhqzf()) { if (getZhqzf()) {
A[0] = 0.28f;A[1] = 0.23f;A[2] = 0.13f;A[3] = 0.16f;A[4] = 0.08f;A[5] = 0.12f; A[0] = 0.28f;
A[1] = 0.23f;
A[2] = 0.13f;
A[3] = 0.16f;
A[4] = 0.08f;
A[5] = 0.12f;
for (i = 0; i < GRADE_NUM; i++) { for (i = 0; i < GRADE_NUM; i++) {
B[i] = 0; B[i] = 0;
for (j = 0; j < ST_QT_NUM; j++) { for (j = 0; j < ST_QT_NUM; j++) {
@@ -105,34 +111,38 @@ public class HarmonicComAssesUtil {
} }
} }
} }
fResult = FloatUtils.get2Float(fResult); fResult = FloatUtils.get2Float(fResult);
}catch (Exception e){ } catch (Exception e) {
//Todo //Todo
} }
return fResult; return fResult;
} }
/** /**
* 大批量的监测点的综合得分获取平均值 * 大批量的监测点的综合得分获取平均值
*
* @param comAssessDTOS 批量数据 * @param comAssessDTOS 批量数据
*/ */
public float getAllComAss(List<ComAssessDTO> comAssessDTOS) { public float getAllComAss(List<ComAssessDTO> comAssessDTOS) {
float allData=0f; float allData = 0f;
for(int i=0;i<comAssessDTOS.size();i++){ if (CollectionUtil.isNotEmpty(comAssessDTOS)) {
ComAssessDTO tempPqs = comAssessDTOS.get(i); for (int i = 0; i < comAssessDTOS.size(); i++) {
//组合二维数组 ComAssessDTO tempPqs = comAssessDTOS.get(i);
float f1[][]={{tempPqs.getFreqDev1(),tempPqs.getFreqDev2(),tempPqs.getFreqDev3(),tempPqs.getFreqDev4(),tempPqs.getFreqDev5()} //组合二维数组
,{tempPqs.getVTHD1(),tempPqs.getVTHD2(),tempPqs.getVTHD3(),tempPqs.getVTHD4(),tempPqs.getVTHD5(),} float f1[][] = {{tempPqs.getFreqDev1(), tempPqs.getFreqDev2(), tempPqs.getFreqDev3(), tempPqs.getFreqDev4(), tempPqs.getFreqDev5()}
,{tempPqs.getDataPlT1(),tempPqs.getDataPlT2(),tempPqs.getDataPlT3(),tempPqs.getDataPlT4(),tempPqs.getDataPlT5()} , {tempPqs.getVTHD1(), tempPqs.getVTHD2(), tempPqs.getVTHD3(), tempPqs.getVTHD4(), tempPqs.getVTHD5(),}
,{tempPqs.getVuDev1(),tempPqs.getVuDev2(),tempPqs.getVuDev3(),tempPqs.getVuDev4(),tempPqs.getVuDev5(),} , {tempPqs.getDataPlT1(), tempPqs.getDataPlT2(), tempPqs.getDataPlT3(), tempPqs.getDataPlT4(), tempPqs.getDataPlT5()}
,{tempPqs.getVUnbalance1(),tempPqs.getVUnbalance2(),tempPqs.getVUnbalance3(),tempPqs.getVUnbalance4(),tempPqs.getVUnbalance5(),} , {tempPqs.getVuDev1(), tempPqs.getVuDev2(), tempPqs.getVuDev3(), tempPqs.getVuDev4(), tempPqs.getVuDev5(),}
,{tempPqs.getEvent1(),tempPqs.getEvent2(),tempPqs.getEvent3(),tempPqs.getEvent4(),tempPqs.getEvent5(),}}; , {tempPqs.getVUnbalance1(), tempPqs.getVUnbalance2(), tempPqs.getVUnbalance3(), tempPqs.getVUnbalance4(), tempPqs.getVUnbalance5(),}
//获取该值返回的数据 , {tempPqs.getEvent1(), tempPqs.getEvent2(), tempPqs.getEvent3(), tempPqs.getEvent4(), tempPqs.getEvent5(),}};
float temp=GetComAsses(f1); //获取该值返回的数据
allData+=temp; float temp = GetComAsses(f1);
allData += temp;
}
float aveData = allData / comAssessDTOS.size();
return FloatUtils.get2Float(aveData);
} }
float aveData=allData/comAssessDTOS.size(); return allData;
return FloatUtils.get2Float(aveData);
} }