1.全景增加暂态信息和调整告警条件

2.增加暂态列表信息和冀北树污染值条件
This commit is contained in:
wr
2025-12-11 15:02:52 +08:00
parent 2166529b4d
commit e89c6a2888
21 changed files with 599 additions and 264 deletions

View File

@@ -1,10 +1,12 @@
package com.njcn.event.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@@ -34,4 +36,21 @@ public class EventCount implements Serializable {
public EventCount(String lineId) {
this.lineId = lineId;
}
@Data
public static class Detail implements Serializable {
@ApiModelProperty("监测点ID")
private String lineId;
@ApiModelProperty("监测点名称")
private String lineName;
@ApiModelProperty("暂态指标")
private String dicData;
@ApiModelProperty("暂降次数")
private BigDecimal count;
}
}

View File

@@ -28,6 +28,11 @@ public class EventBaseParam extends BaseParam implements Serializable {
private String deptId;
@Data
public static class Info extends EventBaseParam {
@ApiModelProperty(name = "dicData", value = "字典id")
private String dicData;
}
}

View File

@@ -1,9 +1,11 @@
package com.njcn.event.pojo.vo;
import com.njcn.event.pojo.dto.EventCount;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @version 1.0.0
@@ -25,12 +27,21 @@ public class EventDetailVO implements Serializable {
@ApiModelProperty(name = "swellTimes",value = "电压暂升发生次数")
private Long swellTimes;
@ApiModelProperty(name = "swellTimes", value = "电压暂升发生监测点集合")
private List<EventCount.Detail> swellTimesIds;
@ApiModelProperty(name = "sagTimes",value = "电压暂降发生次数")
private Long sagTimes;
@ApiModelProperty(name = "sagTimes", value = "电压暂降发生监测点集合")
private List<EventCount.Detail> sagTimesIds;
@ApiModelProperty(name = "interruptTimes",value = "短时中断发生次数")
private Long interruptTimes;
@ApiModelProperty(name = "interruptTimesIds", value = "短时中断发生监测点集合")
private List<EventCount.Detail> interruptTimesIds;
@ApiModelProperty(name = "rate90",value = "暂态严重度占比小于90%")
private Double rate90;

View File

@@ -156,4 +156,14 @@ public class RmpEventDetailController extends BaseController {
List<EventCount> eventCount = rmpEventDetailService.getEventCount(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventCount, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getEventByLineIdsCount")
@ApiOperation("全景暂降详情列表")
public HttpResult<Page<AdvanceEventDetailVO>> getEventByLineIdsCount(@RequestBody EventBaseParam.Info param) {
String methodDescribe = getMethodDescribe("getEventByLineIdsCount");
Page<AdvanceEventDetailVO> page = rmpEventDetailService.getEventByLineIdsCount(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -46,28 +46,29 @@ public class AreaInfoServiceImpl implements AreaInfoService {
private final LineFeignClient lineFeignClient;
private final EventDetailService eventDetailService;
private final PollutionSubstationClient pollutionSubstationClient;
@Override
public List<AreaSubLineVO> getAreaLineInfo(DeviceInfoParam.GridDiagram deviceInfoParam) {
List<AreaSubLineVO> resultVOList = new ArrayList<>();
List<String> lineIds =new ArrayList<>();
List<String> lineIds = new ArrayList<>();
Map<String, UserLinePollution> userMap = new HashMap<>();
if(1==deviceInfoParam.getType()){
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
if (1 == deviceInfoParam.getType()) {
if (CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())) {
lineIds.addAll(deviceInfoParam.getCoutList());
}
if(CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())){
if (CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())) {
lineIds.addAll(deviceInfoParam.getAlarmList());
}
}else{
} else {
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
lineIds.addAll(generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()));
}
if (CollectionUtil.isNotEmpty(lineIds)) {
List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
if(1==deviceInfoParam.getType()){
OnlineRateParam.Info param=new OnlineRateParam.Info();
if (1 == deviceInfoParam.getIsPollution()) {
OnlineRateParam.Info param = new OnlineRateParam.Info();
param.setIds(resList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList()));
param.setDicData(deviceInfoParam.getDicData());
param.setStartTime(deviceInfoParam.getSearchBeginTime());
@@ -76,11 +77,11 @@ public class AreaInfoServiceImpl implements AreaInfoService {
}
//设置冀北告警监测点类型
if(CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())){
resList.stream().filter(x->deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x->x.setType(0));
if (CollectionUtil.isNotEmpty(deviceInfoParam.getCoutList())) {
resList.stream().filter(x -> deviceInfoParam.getCoutList().contains(x.getLineId())).forEach(x -> x.setType(0));
}
if(CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())){
resList.stream().filter(x->deviceInfoParam.getAlarmList().contains(x.getLineId())).forEach(x->x.setType(1));
if (CollectionUtil.isNotEmpty(deviceInfoParam.getAlarmList())) {
resList.stream().filter(x -> deviceInfoParam.getAlarmList().contains(x.getLineId())).forEach(x -> x.setType(1));
}
//查询监测点未处理暂态事件
@@ -100,10 +101,10 @@ public class AreaInfoServiceImpl implements AreaInfoService {
areaLineInfoVO.setNoDealCount(Math.toIntExact(aLong));
}
}
if(userMap.containsKey(areaLineInfoVO.getLineId())){
if (userMap.containsKey(areaLineInfoVO.getLineId())) {
UserLinePollution userLinePollution = userMap.get(areaLineInfoVO.getLineId());
areaLineInfoVO.setVHarmonicValue(userLinePollution.getVHarmonicValue());
areaLineInfoVO.setUserList(BeanUtil.copyToList(userLinePollution.getUserList(),AreaLineInfoVO.User.class));
areaLineInfoVO.setUserList(BeanUtil.copyToList(userLinePollution.getUserList(), AreaLineInfoVO.User.class));
}
}

View File

@@ -32,6 +32,7 @@ import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.GridDiagramParam;
import com.njcn.device.pq.pojo.po.Device;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
@@ -46,6 +47,7 @@ import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.RmpEventDetailService;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.harmonic.pojo.vo.RStatOrgIndexVO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.enums.DicDataTypeEnum;
@@ -55,10 +57,13 @@ import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.pojo.param.BaseParam;
import com.njcn.web.utils.RequestUtil;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -196,18 +201,18 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
if (Objects.isNull(rmpEventDetailPO)) {
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
}
List<String> monitorIds = Stream.of(rmpEventDetailPO.getLineId()).collect(Collectors.toList());
List<String> monitorIds = Stream.of(rmpEventDetailPO.getLineId()).collect(Collectors.toList());
BeanUtils.copyProperties(rmpEventDetailPO, rmpEventDetailVO);
if ("pms".equals(sysType)) {
if(Objects.isNull(smallType) || smallType == 0){
if (Objects.isNull(smallType) || smallType == 0) {
List<Monitor> monitorList = monitorClient.getMonitorList(monitorIds).getData();
if (CollectionUtil.isNotEmpty(monitorList)) {
rmpEventDetailVO.setMeasurementPointName(monitorList.get(0).getName());
rmpEventDetailVO.setPowerStationName(monitorList.get(0).getPowerrName());
}
}else {
} else {
//配网
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = distributionMonitorClient.pwMonitorAreaDetailInfo(monitorIds).getData();
if (CollectionUtil.isNotEmpty(pwPmsMonitorDTOList)) {
@@ -228,21 +233,21 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
@Override
public Page<AdvanceEventDetailVO> querySagEvents(BaseParam baseParam) {
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam));
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
if(CollUtil.isNotEmpty(lineIds)){
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper =new LambdaQueryWrapper<>();
if (CollUtil.isNotEmpty(lineIds)) {
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.isNull(RmpEventDetailPO::getEventassIndex);
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(),AdvanceEventDetailVO.class);
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item->{
if(map.containsKey(item.getLineId())){
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(), AdvanceEventDetailVO.class);
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
if (map.containsKey(item.getLineId())) {
item.setGdName(map.get(item.getLineId()).getGdName());
item.setSubName(map.get(item.getLineId()).getSubName());
switch (item.getDealFlag()) {
@@ -262,9 +267,9 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
}
//录波文件
if(Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1){
if (Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1) {
item.setBoFileFlag(EnumFlag.EXIST.description);
}else {
} else {
item.setBoFileFlag(EnumFlag.ABSENCE.description);
}
@@ -282,7 +287,6 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
}
@Override
public RmpEventDetailPO queryEventDetailByEventId(String eventId) {
return this.getById(eventId);
@@ -302,17 +306,17 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
deptGetLineParam.setLineRunFlag(0);
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
List<LineDevGetDTO> collect = deptGetChildrenMoreDTOS.stream()
.filter(x->deptIDS.contains(x.getUnitId()))
.filter(x -> deptIDS.contains(x.getUnitId()))
.flatMap(x -> x.getLineBaseList().stream()).collect(Collectors.toList());
List<String> lineAllIds = collect.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
List<String> gwLineAllIds = collect.stream().filter(x->1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
List<String> gwLineAllIds = collect.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
List<RmpEventDetailPO> list1 = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(CollUtil.isNotEmpty(lineAllIds), RmpEventDetailPO::getMeasurementPointId, lineAllIds)
.ge(StrUtil.isNotBlank(param.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
);
List<RmpEventDetailPO> list =list1.stream().filter(x->param.getIds().contains(x.getEventType())).collect(Collectors.toList());
List<RmpEventDetailPO> list = list1.stream().filter(x -> param.getIds().contains(x.getEventType())).collect(Collectors.toList());
Map<String, DeptGetChildrenMoreDTO> deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetChildrenMoreDTO::getUnitId, Function.identity()));
GridDiagramVO.LineStatistics lineStatistics;
@@ -327,7 +331,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
gwLineStatistics.setOrgName(datum.getName());
List<LineDevGetDTO> lineBaseList = deptLineMap.get(datum.getId()).getLineBaseList();
List<String> lineIds = lineBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
long count = list.stream().filter(x -> lineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
long gwCount = list.stream().filter(x -> gwLineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
lineStatistics.setCount(count);
@@ -345,38 +349,48 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
@Override
public List<EventDetailVO> getEventDetailByList(GridDiagramParam param) {
List<EventDetailVO> info=new ArrayList<>();
//获取污区图统计类型
List<EventDetailVO> info = new ArrayList<>();
//获取统计类型
DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
DictData interruptions = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData();
List<String> lineIds = data.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
List<RmpEventDetailPO> list = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.select(RmpEventDetailPO::getEventId,RmpEventDetailPO::getMeasurementPointId ,RmpEventDetailPO::getEventType, RmpEventDetailPO::getSeverity)
.select(RmpEventDetailPO::getEventId, RmpEventDetailPO::getMeasurementPointId, RmpEventDetailPO::getEventType, RmpEventDetailPO::getSeverity)
.in(CollUtil.isNotEmpty(lineIds), RmpEventDetailPO::getMeasurementPointId, lineIds)
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
);
Map<String, Line> lineMap = new HashMap<>();
if (CollUtil.isNotEmpty(lineIds)) {
List<Line> lines = lineFeignClient.getBaseLineList(lineIds).getData();
lineMap = lines.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
}
EventDetailVO vo;
for (GeneralDeviceDTO datum : data) {
vo=new EventDetailVO();
vo = new EventDetailVO();
vo.setId(datum.getIndex());
vo.setName(datum.getName());
List<RmpEventDetailPO> detailPOList = list.stream().filter(x -> datum.getLineIndexes().contains(x.getMeasurementPointId())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(detailPOList)){
vo.setSwellTimes(detailPOList.stream().filter(x->x.getEventType().equals(rise.getId())).count());
vo.setSagTimes(detailPOList.stream().filter(x->x.getEventType().equals(dip.getId())).count());
vo.setInterruptTimes(detailPOList.stream().filter(x->x.getEventType().equals(interruptions.getId())).count());
double v90 = detailPOList.stream().filter(x -> x.getSeverity()*100<=90).count() * 100.0 / detailPOList.size();
double v50 = detailPOList.stream().filter(x -> x.getSeverity()*100<=50).count() * 100.0 / detailPOList.size();
double v20 = detailPOList.stream().filter(x -> x.getSeverity()*100<=20).count() * 100.0 / detailPOList.size();
vo.setRate90(NumberUtil.round(v90,2).doubleValue());
vo.setRate50(NumberUtil.round(v50,2).doubleValue());
vo.setRate20(NumberUtil.round(v20,2).doubleValue());
}else {
if (CollUtil.isNotEmpty(detailPOList)) {
vo.setSwellTimes(detailPOList.stream().filter(x -> x.getEventType().equals(rise.getId())).count());
vo.setSwellTimesIds(eventLine(detailPOList, rise.getId(), lineMap));
vo.setSagTimes(detailPOList.stream().filter(x -> x.getEventType().equals(dip.getId())).count());
vo.setSagTimesIds(eventLine(detailPOList, dip.getId(), lineMap));
vo.setInterruptTimes(detailPOList.stream().filter(x -> x.getEventType().equals(interruptions.getId())).count());
vo.setInterruptTimesIds(eventLine(detailPOList, interruptions.getId(), lineMap));
double v90 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 90).count() * 100.0 / detailPOList.size();
double v50 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 50).count() * 100.0 / detailPOList.size();
double v20 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 20).count() * 100.0 / detailPOList.size();
vo.setRate90(NumberUtil.round(v90, 2).doubleValue());
vo.setRate50(NumberUtil.round(v50, 2).doubleValue());
vo.setRate20(NumberUtil.round(v20, 2).doubleValue());
} else {
vo.setSwellTimes(0L);
vo.setSagTimes(0L);
vo.setInterruptTimes(0L);
@@ -389,6 +403,24 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
return info;
}
public List<EventCount.Detail> eventLine(List<RmpEventDetailPO> detailPOList, String dicData, Map<String, Line> lineMap) {
List<EventCount.Detail> info = new ArrayList<>();
Map<String, Long> collect = detailPOList.stream().filter(x -> x.getEventType().equals(dicData))
.collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.counting()));
collect.forEach((key, value) -> {
if (lineMap.containsKey(key)) {
EventCount.Detail detail = new EventCount.Detail();
detail.setLineId(key);
detail.setDicData(dicData);
detail.setLineName(lineMap.get(key).getName());
detail.setCount(BigDecimal.valueOf(value));
info.add(detail);
}
});
info.sort(Comparator.comparing(EventCount.Detail::getCount).reversed());
return info;
}
@Override
public RMpEventDetailM getEventDetailByLine(StatisticsBizBaseParam param) {
RMpEventDetailM rMpEventDetailM = eventDetailMMapper.selectOne(new LambdaQueryWrapper<RMpEventDetailM>()
@@ -401,37 +433,37 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
@Override
public List<Map<String, Object>> getImMonitorEvents(EventBaseParam param) {
List<Map<String,Object>> mapList = new ArrayList<>();
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(),DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(),DicDataTypeEnum.DEV_GRADE.getCode()).getData();
List<Map<String, Object>> mapList = new ArrayList<>();
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(), DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(), DicDataTypeEnum.DEV_GRADE.getCode()).getData();
QueryWrapper<RmpEventDetailPO> queryWrapper = new QueryWrapper<>();
if(StrUtil.isNotBlank(param.getLineId())){
queryWrapper.eq("measurement_point_id",param.getSearchValue());
}else {
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),param.getDeptId()).getData();
if(CollUtil.isEmpty(lineIds)){
if (StrUtil.isNotBlank(param.getLineId())) {
queryWrapper.eq("measurement_point_id", param.getSearchValue());
} else {
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(), param.getDeptId()).getData();
if (CollUtil.isEmpty(lineIds)) {
return mapList;
}
queryWrapper.in("measurement_point_id",lineIds);
queryWrapper.in("measurement_point_id", lineIds);
}
//lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),)
queryWrapper.select("measurement_point_id as lineId","count(event_id) as eventCount").between("start_time",param.getSearchBeginTime(),param.getSearchEndTime())
.eq("event_type",eventDic.getId())
queryWrapper.select("measurement_point_id as lineId", "count(event_id) as eventCount").between("start_time", param.getSearchBeginTime(), param.getSearchEndTime())
.eq("event_type", eventDic.getId())
.groupBy("measurement_point_id");
mapList = this.baseMapper.selectMaps(queryWrapper);
if(CollUtil.isEmpty(mapList)){
if (CollUtil.isEmpty(mapList)) {
return mapList;
}
List<String> ids = mapList.stream().map(it->it.get("lineId").toString()).distinct().collect(Collectors.toList());
List<String> ids = mapList.stream().map(it -> it.get("lineId").toString()).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(ids).getData();
Map<String,AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
Map<String, AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
mapList.forEach(item->{
mapList.forEach(item -> {
AreaLineInfoVO tem = lineMap.get(item.get("lineId").toString());
item.put("lineName",tem.getVoltageName()+"_"+tem.getLineName());
item.put("lineName", tem.getVoltageName() + "_" + tem.getLineName());
});
return mapList;
@@ -452,9 +484,60 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
return eventCountList;
}
@Override
public Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param) {
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(StrUtil.isNotBlank(param.getLineId()), RmpEventDetailPO::getLineId, param.getLineId())
.eq(StrUtil.isNotBlank(param.getDicData()), RmpEventDetailPO::getEventType, param.getDicData())
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
);
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(), AdvanceEventDetailVO.class);
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
if (map.containsKey(item.getLineId())) {
item.setGdName(map.get(item.getLineId()).getGdName());
item.setSubName(map.get(item.getLineId()).getSubName());
switch (item.getDealFlag()) {
case 0:
item.setFeatureAmplitudeFlag(EnumFlag.UNTREATED.getDescription());
break;
case 1:
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSED.getDescription());
break;
case 2:
item.setFeatureAmplitudeFlag(EnumFlag.NODATA.getDescription());
break;
case 3:
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSFAIL.getDescription());
break;
default:
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
}
//录波文件
if (Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1) {
item.setBoFileFlag(EnumFlag.EXIST.description);
} else {
item.setBoFileFlag(EnumFlag.ABSENCE.description);
}
}
}).collect(Collectors.toList());
Page<AdvanceEventDetailVO> pageResult = new Page<>();
pageResult.setRecords(advanceEventDetailVOList);
pageResult.setTotal(poPage.getTotal());
pageResult.setPages(poPage.getPages());
pageResult.setSize(poPage.getSize());
pageResult.setCurrent(poPage.getCurrent());
return pageResult;
}
private List<Double> setData(List<String> gwLineAllIds, List<RmpEventDetailPO> list) {
List<Double> info=new ArrayList<>();
List<Double> info = new ArrayList<>();
long count90 = list.stream()
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
@@ -463,21 +546,21 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
.filter(x -> 0.5 > x.getSeverity()).count();
if(count90>0){
info.add(NumberUtil.round(count90*100.0/list.size(),2).doubleValue());
}else {
if (count90 > 0) {
info.add(NumberUtil.round(count90 * 100.0 / list.size(), 2).doubleValue());
} else {
info.add(0.0);
}
if(count50>0){
info.add(NumberUtil.round(count50*100.0/list.size(),2).doubleValue());
}else {
if (count50 > 0) {
info.add(NumberUtil.round(count50 * 100.0 / list.size(), 2).doubleValue());
} else {
info.add(0.0);
}
return info;
}
/**
* 内部枚举类:高级算法处理事件的标识描述
* 内部枚举类:高级算法处理事件的标识描述
*/
enum EnumFlag {
PROCESSED(1, "计算成功"), UNTREATED(0, "未计算"), EXIST(1, "存在"), ABSENCE(0, "不存在"), NODATA(2, "无结果"), PROCESSFAIL(3, "计算失败");

View File

@@ -84,4 +84,6 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
List<EventCount> getEventCount(GridDiagramParam param);
Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param);
}