1.全景增加暂态信息和调整告警条件
2.增加暂态列表信息和冀北树污染值条件
This commit is contained in:
@@ -218,6 +218,9 @@ public class DeviceInfoParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("指标")
|
||||
private List<String> dicData;
|
||||
|
||||
@ApiModelProperty("是否展示污染值 0:否 1:是")
|
||||
private Integer isPollution;
|
||||
}
|
||||
|
||||
public Boolean isUserLedger() {
|
||||
|
||||
@@ -38,4 +38,7 @@ public class MonitorBaseParam extends BaseParam {
|
||||
@ApiModelProperty(value = "终端厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ApiModelProperty(value = "监测点运行状态")
|
||||
private Integer lineRunFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -50,12 +50,9 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 基础获取单位信息
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
@@ -77,7 +74,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptGetBase.setUnitChildrenList(deptChildren);
|
||||
result.add(deptGetBase);
|
||||
});
|
||||
redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(),result);
|
||||
redisUtil.saveByKey(commTerminal + deptGetLineParam.getDeptId(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -87,8 +84,8 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<DeptGetChildrenMoreDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, String> deptMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
1,deptGetLineParam.getLineRunFlag());
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
1, deptGetLineParam.getLineRunFlag());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
|
||||
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
|
||||
@@ -100,8 +97,8 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<LineDevGetDTO> lineList = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
map.get(i).forEach(x->{
|
||||
if(deptMap.containsKey(x.getUnitId())){
|
||||
map.get(i).forEach(x -> {
|
||||
if (deptMap.containsKey(x.getUnitId())) {
|
||||
x.setUnitName(deptMap.get(x.getUnitId()));
|
||||
}
|
||||
});
|
||||
@@ -127,7 +124,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, String> deptMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevAllGet(filterDataTypeNew(deptGetLineParam.getServerName()),
|
||||
1,deptGetLineParam.getLineRunFlag(),deptGetLineParam.getIsUpToGrid());
|
||||
1, deptGetLineParam.getLineRunFlag(), deptGetLineParam.getIsUpToGrid());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetChildrenMoreDTO deptGetChildrenMoreDTO = new DeptGetChildrenMoreDTO();
|
||||
deptGetChildrenMoreDTO.setUnitId(item.getUnitId());
|
||||
@@ -139,8 +136,8 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
List<LineDevGetDTO> lineList = new ArrayList<>();
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
map.get(i).forEach(x->{
|
||||
if(deptMap.containsKey(x.getUnitId())){
|
||||
map.get(i).forEach(x -> {
|
||||
if (deptMap.containsKey(x.getUnitId())) {
|
||||
x.setUnitName(deptMap.get(x.getUnitId()));
|
||||
}
|
||||
});
|
||||
@@ -184,7 +181,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
deptIds.forEach(i -> {
|
||||
if (map.containsKey(i)) {
|
||||
subList.addAll(map.get(i).stream().map(TerminalGetBase::getLedgerId).distinct().collect(Collectors.toList()));
|
||||
subList.addAll(map.get(i).stream().filter(x-> StrUtil.isNotBlank(x.getObjId())).map(TerminalGetBase::getObjId).distinct().collect(Collectors.toList()));
|
||||
subList.addAll(map.get(i).stream().filter(x -> StrUtil.isNotBlank(x.getObjId())).map(TerminalGetBase::getObjId).distinct().collect(Collectors.toList()));
|
||||
lineList.addAll(map.get(i).stream().map(TerminalGetBase::getLineId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
@@ -200,7 +197,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
public List<DeptGetBusBarDTO> deptBusBar(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetBusBarDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),2,deptGetLineParam.getLineRunFlag());
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()), 2, deptGetLineParam.getLineRunFlag());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetBusBarDTO deptGetBusBarDTO = new DeptGetBusBarDTO();
|
||||
deptGetBusBarDTO.setUnitId(item.getUnitId());
|
||||
@@ -225,10 +222,10 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type) {
|
||||
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam, Integer type) {
|
||||
List<DeptGetDeviceDTO> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),type,deptGetLineParam.getLineRunFlag());
|
||||
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()), type, deptGetLineParam.getLineRunFlag());
|
||||
temDept.forEach(item -> {
|
||||
DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO();
|
||||
deptGetDeviceDTO.setUnitId(item.getUnitId());
|
||||
@@ -266,7 +263,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
public List<DeptGetSubStationDTO.Info> deptSubStationInfo(DeptGetLineParam deptGetLineParam) {
|
||||
List<DeptGetSubStationDTO.Info> result = new ArrayList<>();
|
||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||
List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()),deptGetLineParam.getPowerFlag(),deptGetLineParam.getLineRunFlag(),deptGetLineParam.getIsUpToGrid());
|
||||
List<TerminalGetBase.Extend> anExtends = deptLineService.orgSubStationInfoGet(filterDataTypeNew(deptGetLineParam.getServerName()), deptGetLineParam.getPowerFlag(), deptGetLineParam.getLineRunFlag(), deptGetLineParam.getIsUpToGrid());
|
||||
Map<String, List<TerminalGetBase.Extend>> orgSub = anExtends.stream().collect(Collectors.groupingBy(TerminalGetBase::getUnitId));
|
||||
Map<String, String> deptNameMap = temDept.stream().collect(Collectors.toMap(DeptGetBase::getUnitId, DeptGetBase::getUnitName));
|
||||
temDept.forEach(item -> {
|
||||
@@ -284,15 +281,15 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
//获取部门下变电信息
|
||||
List<TerminalGetBase.Extend> sub = orgSub.get(deptId);
|
||||
Map<String, List<TerminalGetBase.Extend>> subMap = sub.stream()
|
||||
.collect(Collectors.groupingBy(x->x.getLedgerId()+"_"+x.getSubName()+"_"+x.getVoltageLevel()));
|
||||
.collect(Collectors.groupingBy(x -> x.getLedgerId() + "_" + x.getSubName() + "_" + x.getVoltageLevel()));
|
||||
for (Map.Entry<String, List<TerminalGetBase.Extend>> stringListEntry : subMap.entrySet()) {
|
||||
String[] split = stringListEntry.getKey().split("_");
|
||||
subGetBase=new SubGetBase();
|
||||
subGetBase = new SubGetBase();
|
||||
subGetBase.setId(split[0]);
|
||||
subGetBase.setName(split[1]);
|
||||
subGetBase.setVoltageLevel(split[2]);
|
||||
subGetBase.setOrgId(deptId);
|
||||
if(deptNameMap.containsKey(deptId)){
|
||||
if (deptNameMap.containsKey(deptId)) {
|
||||
subGetBase.setOrgName(deptNameMap.get(deptId));
|
||||
}
|
||||
//国网监测点
|
||||
@@ -318,12 +315,12 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
@Override
|
||||
public List<SubGetBase> tagOrIdGetSub(SubstationParam substationParam) {
|
||||
List<SubGetBase> subStationList = deptLineService.getSubStationList(substationParam);
|
||||
if(CollUtil.isNotEmpty(subStationList)){
|
||||
if (CollUtil.isNotEmpty(subStationList)) {
|
||||
List<String> ids = subStationList.stream().map(SubGetBase::getOrgId).collect(Collectors.toList());
|
||||
List<Dept> data = deptFeignClient.getDeptInfoListByIds(ids).getData();
|
||||
Map<String, String> deptMap = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
subStationList.stream().forEach(x->{
|
||||
if(deptMap.containsKey(x.getOrgId())){
|
||||
subStationList.stream().forEach(x -> {
|
||||
if (deptMap.containsKey(x.getOrgId())) {
|
||||
x.setOrgName(deptMap.get(x.getOrgId()));
|
||||
}
|
||||
});
|
||||
@@ -334,7 +331,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
||||
@Override
|
||||
public List<String> getRunMonitorByDept(MonitorBaseParam monitorBaseParam) {
|
||||
List<String> ids = deptFeignClient.getDepSonIdtByDeptId(monitorBaseParam.getDeptId()).getData();
|
||||
List<String> monitorIds = deptLineService.getLineByDeptIds(ids,monitorBaseParam.getManufacturer(),null,Stream.of(0,1,2).collect(Collectors.toList()),monitorBaseParam.getObjType());
|
||||
List<String> monitorIds = deptLineService.getLineByDeptIds(ids, monitorBaseParam.getManufacturer(), Arrays.asList(monitorBaseParam.getLineRunFlag()), Stream.of(0, 1, 2).collect(Collectors.toList()), monitorBaseParam.getObjType());
|
||||
return monitorIds;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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, "计算失败");
|
||||
|
||||
@@ -84,4 +84,6 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
|
||||
|
||||
|
||||
List<EventCount> getEventCount(GridDiagramParam param);
|
||||
|
||||
Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2025/12/9 21:12
|
||||
*/
|
||||
@Data
|
||||
public class AreaPollution {
|
||||
|
||||
@ApiModelProperty("部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty("评估分数")
|
||||
private Double score;
|
||||
|
||||
@ApiModelProperty("监测点详情")
|
||||
private List<PowerFlagPollution> powerFlagPollutionList;
|
||||
}
|
||||
@@ -24,4 +24,6 @@ public class UserLinePollution {
|
||||
private String lineId;
|
||||
private String city;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GridDiagramHarmController extends BaseController {
|
||||
@ApiOperation("变电站污染告警占比")
|
||||
public HttpResult<GridDiagramVO> getPollutionAlarmData(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSubLineGiveAnAlarm");
|
||||
GridDiagramVO subLineGiveAnAlarm = pollutionSubstationService.getPollutionAlarmData(param);
|
||||
GridDiagramVO subLineGiveAnAlarm = pollutionSubstationService.getNewPollutionAlarmData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subLineGiveAnAlarm, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.AreaPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
@@ -174,4 +175,14 @@ public class PollutionSubstationController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sumMap, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation(value = "区域污染值统计")
|
||||
@PostMapping(value = "/getAreaPollution")
|
||||
public HttpResult<List<AreaPollution>> getAreaPollution(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getAreaPollution");
|
||||
param.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString());
|
||||
param.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString());
|
||||
List<AreaPollution> areaPollution = pollutionSubstationService.getAreaPollution(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, areaPollution, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,4 +73,14 @@ public interface RStatLimitTargetDMapper extends BaseMapper<RStatLimitTargetDPO>
|
||||
List<RStatLimitTargetCountVO> getSumTargetCountDayes(@Param("ids") List<String> ids,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
/**
|
||||
* 获取谐波电压越线监测点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<String> getLinesHarmTarget(@Param("ids") List<String> ids,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -723,4 +723,56 @@
|
||||
GROUP BY
|
||||
A.lineId;
|
||||
</select>
|
||||
<select id="getLinesHarmTarget" resultType="java.lang.String">
|
||||
select
|
||||
my_index
|
||||
from (
|
||||
SELECT
|
||||
my_index,
|
||||
sum(if((
|
||||
uaberrance_overtime+
|
||||
uharm_2_overtime+
|
||||
uharm_3_overtime+
|
||||
uharm_4_overtime+
|
||||
uharm_5_overtime+
|
||||
uharm_6_overtime+
|
||||
uharm_7_overtime+
|
||||
uharm_8_overtime+
|
||||
uharm_9_overtime+
|
||||
uharm_10_overtime+
|
||||
uharm_11_overtime+
|
||||
uharm_12_overtime+
|
||||
uharm_13_overtime+
|
||||
uharm_14_overtime+
|
||||
uharm_15_overtime+
|
||||
uharm_16_overtime+
|
||||
uharm_17_overtime+
|
||||
uharm_18_overtime+
|
||||
uharm_19_overtime+
|
||||
uharm_20_overtime+
|
||||
uharm_21_overtime+
|
||||
uharm_22_overtime+
|
||||
uharm_23_overtime+
|
||||
uharm_24_overtime+
|
||||
uharm_25_overtime)>0,1,0)) AS allCount
|
||||
FROM
|
||||
r_stat_limit_rate_d
|
||||
<where>
|
||||
<if test=" ids != null and ids.size > 0">
|
||||
AND my_index IN
|
||||
<foreach collection='ids' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test=" startTime != null and startTime !=''">
|
||||
AND time_id >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND time_id <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
my_index
|
||||
) a where allCount>0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -26,6 +26,13 @@ public interface IRStatLimitTargetDService extends IService<RStatLimitTargetDPO>
|
||||
*/
|
||||
List<String> getLinesTarget(StatSubstationBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取谐波电压越线监测点
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<String> getLinesHarmTarget(StatSubstationBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 根据监测点查询一个月各指标越线超标天数
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.GridDiagramParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.AreaPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.LinePollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.SubstationPollution;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
@@ -20,8 +21,8 @@ import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.pojo.vo.SubstationVo;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
*
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||
* Date: 2022/10/13 8:56【需求编号】
|
||||
@@ -29,60 +30,64 @@ import java.util.List;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PollutionSubstationService extends IService<RStatPollutionSubstationM>{
|
||||
public interface PollutionSubstationService extends IService<RStatPollutionSubstationM> {
|
||||
|
||||
|
||||
/**
|
||||
* @Description: getPollutionSubstationData
|
||||
* @Param: [pollutionSubstationQuryParam]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionSubstationVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/10/13
|
||||
*/
|
||||
* @Description: getPollutionSubstationData
|
||||
* @Param: [pollutionSubstationQuryParam]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionSubstationVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/10/13
|
||||
*/
|
||||
List<PollutionSubstationVO> getPollutionSubstationData(PollutionSubstationQuryParam pollutionSubstationQuryParam);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: getDeptSubstationRelations
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
* @Description: getDeptSubstationRelations
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.vo.PollutionVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
List<PollutionVO> getDeptSubstationRelations(HarmonicPublicParam param);
|
||||
/**
|
||||
* @Description: getSubstationInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.dto.PollutionSubstationDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Description: getSubstationInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.dto.PollutionSubstationDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
List<PollutionSubstationDTO> getSubstationInfoById(HarmonicPublicParam param);
|
||||
|
||||
/**
|
||||
* @Description: getLineInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.biz.pojo.dto.PollutionLineDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Description: getLineInfoById
|
||||
* @Param: [param]
|
||||
* @return: java.util.List<com.njcn.device.biz.pojo.dto.PollutionLineDTO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/3
|
||||
*/
|
||||
List<PollutionLineDTO> getLineInfoById(HarmonicPublicParam param);
|
||||
|
||||
|
||||
List<PollutionLineDTO> getLineRankTop10(HarmonicPublicParam param);
|
||||
|
||||
/**
|
||||
* @Description: 污染告警信息
|
||||
* @param param
|
||||
* @Description: 污染告警信息
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2024/4/22 11:00
|
||||
*/
|
||||
@Deprecated
|
||||
GridDiagramVO getPollutionAlarmData(StatSubstationBizBaseParam param);
|
||||
|
||||
GridDiagramVO getNewPollutionAlarmData(StatSubstationBizBaseParam param);
|
||||
|
||||
/**
|
||||
* @Description: 污染告警信息
|
||||
* @param param
|
||||
* @Description: 污染告警信息
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2024/4/22 11:00
|
||||
@@ -97,6 +102,7 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
|
||||
/**
|
||||
* 导出监测点谐波污染值
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
List<LinePollution> downPollutionLineCalc(StatSubstationBizBaseParam param);
|
||||
@@ -109,10 +115,20 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
|
||||
/**
|
||||
* 变电站谐波电压污染值
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
List<SubstationPollution> downPollutionSubCalc(StatSubstationBizBaseParam param);
|
||||
|
||||
|
||||
List<UserLinePollution> getSumList(OnlineRateParam.Info param);
|
||||
|
||||
/**
|
||||
* @param param
|
||||
* @Description: 区域污染值统计
|
||||
* @return: java.util.List<com.njcn.harmonic.pojo.excel.pollution.AreaPollution>
|
||||
* @Author: wr
|
||||
* @Date: 2025/12/10 17:53
|
||||
*/
|
||||
List<AreaPollution> getAreaPollution(StatSubstationBizBaseParam param);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionSubstationVO;
|
||||
import com.njcn.harmonic.pojo.vo.PollutionVO;
|
||||
import com.njcn.harmonic.pojo.vo.SubstationVo;
|
||||
import com.njcn.harmonic.pojo.vo.hebeinorth.AssessVo;
|
||||
import com.njcn.harmonic.rstatlimitrate.mapper.RStatLimitRateDMapper;
|
||||
import com.njcn.harmonic.service.PollutionSubstationService;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
@@ -66,6 +67,7 @@ import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
|
||||
@@ -833,6 +835,37 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridDiagramVO getNewPollutionAlarmData(StatSubstationBizBaseParam param) {
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getId());
|
||||
deptGetLineParam.setIsUpToGrid(param.getIsUpToGrid());
|
||||
List<DeptGetSubStationDTO.Info> detSub = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
//获取全部变电站信息
|
||||
List<SubGetBase> collect = detSub.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList());
|
||||
GridDiagramVO vo = new GridDiagramVO();
|
||||
List<Double> info = new ArrayList<>();
|
||||
List<Double> gwInfo = new ArrayList<>();
|
||||
|
||||
|
||||
// if (CollUtil.isNotEmpty(subAll)) {
|
||||
// List<RStatPollutionSubstationM> substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper<RStatPollutionSubstationM>()
|
||||
// .select(RStatPollutionSubstationM::getSubstationId, RStatPollutionSubstationM::getValue)
|
||||
// .in(CollUtil.isNotEmpty(subAll), RStatPollutionSubstationM::getSubstationId, subAll)
|
||||
// .in(CollUtil.isNotEmpty(param.getIds()), RStatPollutionSubstationM::getPollutionType, param.getIds())
|
||||
// .ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationM::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||
// .le(StrUtil.isNotBlank(param.getEndTime()), RStatPollutionSubstationM::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||
// );
|
||||
// info.addAll(substationMlist.stream().map(RStatPollutionSubstationM::getValue).collect(Collectors.toList()));
|
||||
// gwInfo.addAll(substationMlist.stream()
|
||||
// .filter(x -> subGw.contains(x.getSubstationId()))
|
||||
// .map(RStatPollutionSubstationM::getValue).collect(Collectors.toList()));
|
||||
// }
|
||||
vo.setInfo(info);
|
||||
vo.setGwInfo(gwInfo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PollutionGridDiagramDTO> getPollutionAlarmPageData(StatSubstationBizBaseParam param) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
@@ -889,7 +922,8 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RMpPollutionDPO> rMpPollutionDPOS = rMpPollutionDPOMapper.selectSumList(lineIdList,
|
||||
Arrays.asList("b33a2946cb2d4f2641f485cf7720ecc7"),
|
||||
// Arrays.asList("b33a2946cb2d4f2641f485cf7720ecc7"),
|
||||
param.getIds(),
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> dept;
|
||||
@@ -1154,6 +1188,49 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaPollution> getAreaPollution(StatSubstationBizBaseParam param) {
|
||||
List<AreaPollution> info = new ArrayList<>();
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
deviceInfoParam.setDeptIndex(param.getId());
|
||||
deviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
deviceInfoParam.setMonitorFlag(param.getIsUpToGrid());
|
||||
List<GeneralDeviceDTO> deptData = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIdList = deptData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(lineIdList)) {
|
||||
List<RMpPollutionDPO> pollutionList = rMpPollutionDPOMapper.selectSumList(lineIdList, param.getIds(), param.getStartTime(), param.getEndTime());
|
||||
Map<String, Double> pollutionMap = pollutionList.stream().collect(Collectors.toMap(RMpPollutionDPO::getLineId, RMpPollutionDPO::getValue));
|
||||
//获取监测点详细信息
|
||||
List<PollutionLineInfoDTO> lineInfoDTOList = commLineClient.getPollutionLineInfo(lineIdList).getData();
|
||||
List<PowerFlagPollution> linePollutionList;
|
||||
for (GeneralDeviceDTO item : deptData) {
|
||||
linePollutionList = new ArrayList<>();
|
||||
AreaPollution pollution = new AreaPollution();
|
||||
pollution.setDeptName(item.getName());
|
||||
pollution.setDeptId(item.getIndex());
|
||||
List<PollutionLineInfoDTO> lineDetails = lineInfoDTOList.stream().filter(x -> item.getLineIndexes().contains(x.getLineId())).collect(Collectors.toList());
|
||||
PowerFlagPollution pollution1;
|
||||
for (PollutionLineInfoDTO lineDetail : lineDetails) {
|
||||
pollution1 = new PowerFlagPollution();
|
||||
pollution1.setLineName(lineDetail.getLineName());
|
||||
pollution1.setDevName(lineDetail.getDevName());
|
||||
pollution1.setManufacturer(lineDetail.getManufacturer());
|
||||
pollution1.setDevType(lineDetail.getDevType());
|
||||
pollution1.setLoginTime(lineDetail.getLoginTime());
|
||||
pollution1.setInterval(lineDetail.getTimeInterval());
|
||||
pollution1.setPowerFlag(lineDetail.getPowerFlag());
|
||||
pollution1.setVHarmonicValue(pollutionMap.containsKey(lineDetail.getLineId())?NumberUtil.round(pollutionMap.get(lineDetail.getLineId()),2).doubleValue():0.0);
|
||||
linePollutionList.add(pollution1);
|
||||
}
|
||||
pollution.setPowerFlagPollutionList(linePollutionList.stream().sorted(Comparator.comparing(PowerFlagPollution::getVHarmonicValue).reversed()).collect(Collectors.toList()));
|
||||
pollution.setScore(NumberUtil.round(linePollutionList.stream().mapToDouble(PowerFlagPollution::getVHarmonicValue).sum(),2).doubleValue());
|
||||
info.add(pollution);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
private List<String> addList(List<RMpPollutionDPO> pollLinelist, List<SubGetBase> notNum) {
|
||||
List<String> info = new ArrayList<>();
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.harmonic.service.IRStatLimitTargetDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,11 @@ public class RStatLimitTargetDServiceImpl extends ServiceImpl<RStatLimitTargetDM
|
||||
return this.baseMapper.getLinesTarget(param.getIds(),param.getStartTime(),param.getEndTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLinesHarmTarget(StatSubstationBizBaseParam param) {
|
||||
return this.baseMapper.getLinesHarmTarget(param.getIds(), param.getStartTime(), param.getEndTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RStatLimitTargetCountVO getGridDiagramTargetData(StatisticsBizBaseParam param) {
|
||||
List<RStatLimitTargetCountVO> sumTargetDetails = this.baseMapper.getSumTargetCountDayes(Arrays.asList(param.getId()),
|
||||
|
||||
@@ -74,89 +74,88 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
private final DistributionMonitorClient distributionMonitorClient;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<RStatLimitTargetDPO> monitorIdsGetLimitTargetInfo(String date, List<String> monitorIds) {
|
||||
return rStatLimitTargetDMapper.selectList(new LambdaQueryWrapper<RStatLimitTargetDPO>().in(RStatLimitTargetDPO::getLineId,monitorIds)
|
||||
.eq(RStatLimitTargetDPO::getTime,date).gt(RStatLimitTargetDPO::getAllTime,0));
|
||||
return rStatLimitTargetDMapper.selectList(new LambdaQueryWrapper<RStatLimitTargetDPO>().in(RStatLimitTargetDPO::getLineId, monitorIds)
|
||||
.eq(RStatLimitTargetDPO::getTime, date).gt(RStatLimitTargetDPO::getAllTime, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatLimitTargetVO> monitorOverLimitDays(String date, String endDate, List<String> monitorIds) {
|
||||
return rStatLimitTargetDMapper.getSumTargetDetails(monitorIds,date,endDate);
|
||||
return rStatLimitTargetDMapper.getSumTargetDetails(monitorIds, date, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridDiagramVO.LineData> getGridDiagramLineData(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<GridDiagramVO.LineData> info=new ArrayList<>();
|
||||
List<GridDiagramVO.LineData> info = new ArrayList<>();
|
||||
deviceInfoParam.setLineRunFlag(0);
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> list = data.stream().sorted(Comparator.comparing(x -> x.getLineIndexes().size(),Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
List<GeneralDeviceDTO> list = data.stream().sorted(Comparator.comparing(x -> x.getLineIndexes().size(), Comparator.reverseOrder())).collect(Collectors.toList());
|
||||
//终端总数量
|
||||
List<String> devIds = list.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
//监测点总数量
|
||||
List<String> lineIds = list.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
//超标监测点信息
|
||||
List<RStatLimitTargetVO> limitTargetList =new ArrayList<>();
|
||||
List<RStatIntegrityD> integrityList =new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(lineIds)){
|
||||
List<RStatLimitTargetVO> limitTargetList = new ArrayList<>();
|
||||
List<RStatIntegrityD> integrityList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(lineIds)) {
|
||||
limitTargetList = rStatLimitTargetDMapper.getSumTargetDetails(lineIds,
|
||||
DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())).toString());
|
||||
integrityList = lineIntegrityClient.getIntegrityByLineIds(lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime()).getData();
|
||||
}
|
||||
//终端在线率
|
||||
List<RStatOnlineRateVO> onlineRateList =new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
OnlineRateParam param=new OnlineRateParam();
|
||||
List<RStatOnlineRateVO> onlineRateList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(devIds)) {
|
||||
OnlineRateParam param = new OnlineRateParam();
|
||||
param.setIds(devIds);
|
||||
param.setStartTime(deviceInfoParam.getSearchBeginTime());
|
||||
param.setEndTime(deviceInfoParam.getSearchEndTime());
|
||||
onlineRateList = generalDeviceInfoClient.getOnlineRateByDevIds(param).getData();
|
||||
}
|
||||
List<GeneralDeviceDTO> topList=new ArrayList<>();
|
||||
List<GeneralDeviceDTO> otherList=new ArrayList<>();
|
||||
if(ObjectUtil.isNotNull(deviceInfoParam.getStatisticalType())){
|
||||
List<GeneralDeviceDTO> topList = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> otherList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(deviceInfoParam.getStatisticalType())) {
|
||||
SimpleDTO statisticalType = deviceInfoParam.getStatisticalType();
|
||||
if(!StatisticsEnum.POWER_NETWORK.getCode().equals(statisticalType.getCode())){
|
||||
if(list.size()>4){
|
||||
if (!StatisticsEnum.POWER_NETWORK.getCode().equals(statisticalType.getCode())) {
|
||||
if (list.size() > 4) {
|
||||
topList.addAll(list.subList(0, 4));
|
||||
otherList.addAll(list.subList(4, list.size()));
|
||||
}else{
|
||||
if(list.size()>3){
|
||||
} else {
|
||||
if (list.size() > 3) {
|
||||
topList.addAll(list.subList(0, 3));
|
||||
otherList.addAll(list.subList(3, list.size()));
|
||||
}else{
|
||||
if(list.size()>2){
|
||||
} else {
|
||||
if (list.size() > 2) {
|
||||
topList.addAll(list.subList(0, 2));
|
||||
otherList.addAll(list.subList(2, list.size()));
|
||||
}else{
|
||||
} else {
|
||||
topList.addAll(list.subList(0, 1));
|
||||
otherList.addAll(list.subList(1, list.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
topList.addAll(list);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
topList.addAll(list);
|
||||
}
|
||||
GridDiagramVO.LineData lineData;
|
||||
for (GeneralDeviceDTO dto : topList) {
|
||||
lineData=new GridDiagramVO.LineData();
|
||||
lineData = new GridDiagramVO.LineData();
|
||||
lineData.setOrgId(dto.getIndex());
|
||||
lineData.setOrgName(dto.getName()+"("+dto.getLineIndexes().size()+")");
|
||||
onLineAndIntegrity(dto.getLineIndexes(), integrityList, dto.getDeviceIndexes(), onlineRateList,limitTargetList, lineData);
|
||||
lineData.setOrgName(dto.getName() + "(" + dto.getLineIndexes().size() + ")");
|
||||
onLineAndIntegrity(dto.getLineIndexes(), integrityList, dto.getDeviceIndexes(), onlineRateList, limitTargetList, lineData);
|
||||
info.add(lineData);
|
||||
}
|
||||
if(CollUtil.isNotEmpty(otherList)){
|
||||
if (CollUtil.isNotEmpty(otherList)) {
|
||||
List<String> otherDevIds = otherList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
List<String> otherLineIds = otherList.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
lineData=new GridDiagramVO.LineData();
|
||||
lineData = new GridDiagramVO.LineData();
|
||||
lineData.setOrgId("123456");
|
||||
lineData.setOrgName("其他("+otherLineIds.size()+")");
|
||||
onLineAndIntegrity(otherLineIds, integrityList, otherDevIds, onlineRateList,limitTargetList, lineData);
|
||||
lineData.setOrgName("其他(" + otherLineIds.size() + ")");
|
||||
onLineAndIntegrity(otherLineIds, integrityList, otherDevIds, onlineRateList, limitTargetList, lineData);
|
||||
info.add(lineData);
|
||||
}
|
||||
return info;
|
||||
@@ -166,7 +165,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
public List<GridDiagramVO.AreaData> getGridDiagramAreaData(DeviceInfoParam.BusinessParam param) {
|
||||
List<GridDiagramVO.AreaData> info = new ArrayList<>();
|
||||
param.setLineRunFlag(0);
|
||||
GridDiagramVO.AreaData areaData ;
|
||||
GridDiagramVO.AreaData areaData;
|
||||
//监测点总数
|
||||
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
//在线
|
||||
@@ -183,11 +182,11 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
List<DeptGetSubStationDTO.Info> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData();
|
||||
Map<String, DeptGetSubStationDTO.Info> deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetSubStationDTO.Info::getUnitId, Function.identity()));
|
||||
|
||||
StatSubstationBizBaseParam baseParam=new StatSubstationBizBaseParam();
|
||||
StatSubstationBizBaseParam baseParam = new StatSubstationBizBaseParam();
|
||||
baseParam.setIds(onLine);
|
||||
baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString());
|
||||
baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> linesTarget=targetDService.getLinesTarget(baseParam);
|
||||
List<String> linesTarget = targetDService.getLinesTarget(baseParam);
|
||||
List<RStatIntegrityD> integrityDS = lineIntegrityClient.getIntegrityByLineIds(onLine,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString()).getData();
|
||||
@@ -200,7 +199,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
areaData.setLineNum(datum.getLineIndexes().size());
|
||||
areaData.setLineList(datum.getLineIndexes());
|
||||
areaData.setDeviceNum(datum.getDeviceIndexes().size());
|
||||
if(onMap.containsKey(datum.getIndex())){
|
||||
if (onMap.containsKey(datum.getIndex())) {
|
||||
GeneralDeviceDTO dto = onMap.get(datum.getIndex());
|
||||
areaData.setOnlineNum(dto.getLineIndexes().size());
|
||||
areaData.setOnlineList(dto.getLineIndexes());
|
||||
@@ -221,7 +220,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
if (0 == param.getMonitorFlag()) {
|
||||
lineIds.addAll(x.getUnitChildrenList());
|
||||
onlineIds.addAll(x.getUnitChildrenList().stream().filter(d -> onLine.contains(d)).collect(Collectors.toList()));
|
||||
}else {
|
||||
} else {
|
||||
lineIds.addAll(x.getGwUnitChildrenList());
|
||||
onlineIds.addAll(x.getGwUnitChildrenList().stream().filter(d -> onLine.contains(d)).collect(Collectors.toList()));
|
||||
}
|
||||
@@ -268,21 +267,20 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
List<GeneralDeviceDTO> onData = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
List<String> online = onData.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
||||
|
||||
StatSubstationBizBaseParam baseParam=new StatSubstationBizBaseParam();
|
||||
StatSubstationBizBaseParam baseParam = new StatSubstationBizBaseParam();
|
||||
baseParam.setIds(online);
|
||||
baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString());
|
||||
baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString());
|
||||
List<String> linesTarget=targetDService.getLinesTarget(baseParam);
|
||||
List<String> linesTarget = targetDService.getLinesHarmTarget(baseParam);
|
||||
List<RStatIntegrityD> integrityDS = lineIntegrityClient.getIntegrityByLineIds(online,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString()).getData();
|
||||
List<String> integrityDS0 = integrityDS.stream().filter(x -> 0.9 <= x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList());
|
||||
//在线率大于90的点
|
||||
List<String> integrityDS90 = integrityDS.stream().filter(x -> 0.9 <= x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList());
|
||||
|
||||
//合格-告警
|
||||
GridDiagramVO.RunData alarmData=new GridDiagramVO.RunData();
|
||||
List<String> lineAlarm = new ArrayList<>();
|
||||
lineAlarm.addAll(integrityDS0.stream().filter(d -> !linesTarget.contains(d)).distinct().collect(Collectors.toList()));
|
||||
List<String> alarm = lineAlarm.stream().distinct().collect(Collectors.toList());
|
||||
GridDiagramVO.RunData alarmData = new GridDiagramVO.RunData();
|
||||
List<String> alarm = integrityDS90.stream().filter(d -> !linesTarget.contains(d)).distinct().collect(Collectors.toList());
|
||||
List<String> us = line.stream().filter(x -> !alarm.contains(x)).distinct().collect(Collectors.toList());
|
||||
alarmData.setLineNumOne(alarm.size());
|
||||
alarmData.setLineListOne(alarm);
|
||||
@@ -291,7 +289,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
info.add(alarmData);
|
||||
|
||||
//在线-离线
|
||||
GridDiagramVO.RunData runData=new GridDiagramVO.RunData();
|
||||
GridDiagramVO.RunData runData = new GridDiagramVO.RunData();
|
||||
List<String> Offline = line.stream().filter(x -> !online.contains(x)).distinct().collect(Collectors.toList());
|
||||
runData.setLineNumOne(online.size());
|
||||
runData.setLineListOne(online);
|
||||
@@ -300,8 +298,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
info.add(runData);
|
||||
|
||||
//数据完整性≥90% - <90%
|
||||
GridDiagramVO.RunData integrityData=new GridDiagramVO.RunData();
|
||||
List<String> integrityDS90 = integrityDS.stream().filter(x -> 0.9 <= x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList());
|
||||
GridDiagramVO.RunData integrityData = new GridDiagramVO.RunData();
|
||||
List<String> integrity = online.stream().filter(x -> !integrityDS90.contains(x)).distinct().collect(Collectors.toList());
|
||||
integrityData.setLineNumOne(integrityDS90.size());
|
||||
integrityData.setLineListOne(integrityDS90);
|
||||
@@ -311,7 +308,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
|
||||
|
||||
//电能质量指标未超标-超标
|
||||
GridDiagramVO.RunData targetData=new GridDiagramVO.RunData();
|
||||
GridDiagramVO.RunData targetData = new GridDiagramVO.RunData();
|
||||
List<String> integrityS = online.stream().filter(x -> !linesTarget.contains(x)).distinct().collect(Collectors.toList());
|
||||
targetData.setLineNumOne(integrityS.size());
|
||||
targetData.setLineListOne(integrityS);
|
||||
@@ -324,63 +321,63 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
|
||||
@Override
|
||||
public Page<MonitorLimitRateVO> pwMonitorLimitData(PwUserMonitorParam pwUserMonitorParam) {
|
||||
Page<MonitorLimitRateVO> pageResult = new Page<>(PageFactory.getPageNum(pwUserMonitorParam),PageFactory.getPageSize(pwUserMonitorParam));
|
||||
Page<MonitorLimitRateVO> pageResult = new Page<>(PageFactory.getPageNum(pwUserMonitorParam), PageFactory.getPageSize(pwUserMonitorParam));
|
||||
List<PwUserMonitorDataVO> pwUserMonitorDataVOList = distributionMonitorClient.getPwUserIds(pwUserMonitorParam).getData();
|
||||
if(CollUtil.isEmpty(pwUserMonitorDataVOList)){
|
||||
if (CollUtil.isEmpty(pwUserMonitorDataVOList)) {
|
||||
return pageResult;
|
||||
}
|
||||
List<String> ids = pwUserMonitorDataVOList.stream().map(PwUserMonitorDataVO::getId).collect(Collectors.toList());
|
||||
|
||||
QueryWrapper<RStatLimitRateDPO> queryWrapper = new QueryWrapper<>();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for(int i = 2;i<26;i++){
|
||||
if(i == 25){
|
||||
for (int i = 2; i < 26; i++) {
|
||||
if (i == 25) {
|
||||
stringBuilder.append("sum(uharm_").append(i).append("_overtime) as uharm_").append(i).append("_overtime ");
|
||||
}else {
|
||||
} else {
|
||||
stringBuilder.append("sum(uharm_").append(i).append("_overtime) as uharm_").append(i).append("_overtime").append(",");
|
||||
}
|
||||
}
|
||||
queryWrapper.select("my_index lineId ,sum(all_time) all_time,sum(flicker_all_time) flicker_all_time,sum(freq_dev_overtime) freq_dev_overtime,sum(voltage_dev_overtime) voltage_dev_overtime,sum(ubalance_overtime) ubalance_overtime,sum(flicker_overtime) flicker_overtime,sum(uaberrance_overtime) uaberrance_overtime",stringBuilder.toString())
|
||||
.in("my_index",ids).between("time_id",pwUserMonitorParam.getSearchBeginTime(),pwUserMonitorParam.getSearchEndTime()).eq("phasic_type","T").groupBy("my_index");
|
||||
queryWrapper.select("my_index lineId ,sum(all_time) all_time,sum(flicker_all_time) flicker_all_time,sum(freq_dev_overtime) freq_dev_overtime,sum(voltage_dev_overtime) voltage_dev_overtime,sum(ubalance_overtime) ubalance_overtime,sum(flicker_overtime) flicker_overtime,sum(uaberrance_overtime) uaberrance_overtime", stringBuilder.toString())
|
||||
.in("my_index", ids).between("time_id", pwUserMonitorParam.getSearchBeginTime(), pwUserMonitorParam.getSearchEndTime()).eq("phasic_type", "T").groupBy("my_index");
|
||||
|
||||
if(StrUtil.isNotBlank(pwUserMonitorParam.getOrderBy())){
|
||||
if (StrUtil.isNotBlank(pwUserMonitorParam.getOrderBy())) {
|
||||
String sortBy = strToSql(pwUserMonitorParam.getSortBy());
|
||||
if(pwUserMonitorParam.getOrderBy().equals("asc")){
|
||||
queryWrapper.orderBy(true,true,sortBy);
|
||||
}else {
|
||||
queryWrapper.orderBy(true,false,sortBy);
|
||||
if (pwUserMonitorParam.getOrderBy().equals("asc")) {
|
||||
queryWrapper.orderBy(true, true, sortBy);
|
||||
} else {
|
||||
queryWrapper.orderBy(true, false, sortBy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Page<RStatLimitRateDPO> temPage = rStatLimitRateDMapper.selectPage(new Page<>(PageFactory.getPageNum(pwUserMonitorParam),PageFactory.getPageSize(pwUserMonitorParam)),queryWrapper);
|
||||
Page<RStatLimitRateDPO> temPage = rStatLimitRateDMapper.selectPage(new Page<>(PageFactory.getPageNum(pwUserMonitorParam), PageFactory.getPageSize(pwUserMonitorParam)), queryWrapper);
|
||||
pageResult.setTotal(temPage.getTotal());
|
||||
if(CollUtil.isNotEmpty(temPage.getRecords())){
|
||||
Map<String,PwUserMonitorDataVO> map = pwUserMonitorDataVOList.stream().collect(Collectors.toMap(PwUserMonitorDataVO::getId,Function.identity()));
|
||||
if (CollUtil.isNotEmpty(temPage.getRecords())) {
|
||||
Map<String, PwUserMonitorDataVO> map = pwUserMonitorDataVOList.stream().collect(Collectors.toMap(PwUserMonitorDataVO::getId, Function.identity()));
|
||||
List<MonitorLimitRateVO> resultList = new ArrayList<>();
|
||||
for(RStatLimitRateDPO item : temPage.getRecords()){
|
||||
for (RStatLimitRateDPO item : temPage.getRecords()) {
|
||||
MonitorLimitRateVO monitorLimitRateVO = new MonitorLimitRateVO();
|
||||
PwUserMonitorDataVO pwUserMonitorDataVO = map.get(item.getLineId());
|
||||
BeanUtil.copyProperties(pwUserMonitorDataVO,monitorLimitRateVO);
|
||||
if(item.getAllTime() == 0){
|
||||
BeanUtil.copyProperties(pwUserMonitorDataVO, monitorLimitRateVO);
|
||||
if (item.getAllTime() == 0) {
|
||||
monitorLimitRateVO.setFreqDevOvertime(BigDecimal.valueOf(3.14159));
|
||||
monitorLimitRateVO.setUaberranceOvertime(BigDecimal.valueOf(3.14159));
|
||||
monitorLimitRateVO.setUbalanceOvertime(BigDecimal.valueOf(3.14159));
|
||||
monitorLimitRateVO.setVoltageDevOvertime(BigDecimal.valueOf(3.14159));
|
||||
}else {
|
||||
monitorLimitRateVO.setFreqDevOvertime(calculatePercentage(item.getFreqDevOvertime(),item.getAllTime()));
|
||||
monitorLimitRateVO.setUaberranceOvertime(calculatePercentage(item.getUaberranceOvertime(),item.getAllTime()));
|
||||
monitorLimitRateVO.setUbalanceOvertime(calculatePercentage(item.getUbalanceOvertime(),item.getAllTime()));
|
||||
monitorLimitRateVO.setVoltageDevOvertime(calculatePercentage(item.getVoltageDevOvertime(),item.getAllTime()));
|
||||
} else {
|
||||
monitorLimitRateVO.setFreqDevOvertime(calculatePercentage(item.getFreqDevOvertime(), item.getAllTime()));
|
||||
monitorLimitRateVO.setUaberranceOvertime(calculatePercentage(item.getUaberranceOvertime(), item.getAllTime()));
|
||||
monitorLimitRateVO.setUbalanceOvertime(calculatePercentage(item.getUbalanceOvertime(), item.getAllTime()));
|
||||
monitorLimitRateVO.setVoltageDevOvertime(calculatePercentage(item.getVoltageDevOvertime(), item.getAllTime()));
|
||||
}
|
||||
|
||||
if(item.getFlickerAllTime() == 0){
|
||||
if (item.getFlickerAllTime() == 0) {
|
||||
monitorLimitRateVO.setFlickerOvertime(BigDecimal.valueOf(3.14159));
|
||||
}else {
|
||||
monitorLimitRateVO.setFlickerOvertime(calculatePercentage(item.getFlickerOvertime(),item.getFlickerAllTime()));
|
||||
} else {
|
||||
monitorLimitRateVO.setFlickerOvertime(calculatePercentage(item.getFlickerOvertime(), item.getFlickerAllTime()));
|
||||
}
|
||||
|
||||
setUharmOvertimeRatios(item,monitorLimitRateVO);
|
||||
setUharmOvertimeRatios(item, monitorLimitRateVO);
|
||||
resultList.add(monitorLimitRateVO);
|
||||
}
|
||||
pageResult.setRecords(resultList);
|
||||
@@ -393,7 +390,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
* 计算百分比,结果不超过100
|
||||
*
|
||||
* @param flickerOvertime 闪烁超时时间
|
||||
* @param flickerAllTime 总闪烁时间
|
||||
* @param flickerAllTime 总闪烁时间
|
||||
* @return 计算的百分比(如果结果超过100,则返回100)
|
||||
*/
|
||||
public BigDecimal calculatePercentage(Integer flickerOvertime, Integer flickerAllTime) {
|
||||
@@ -417,7 +414,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
@Override
|
||||
public List<PwLimitDataVO> pwMonitorLimitDataRange(PwUserMonitorParam pwUserMonitorParam) {
|
||||
List<PwLimitDataVO> result = new ArrayList<>();
|
||||
if(CollUtil.isEmpty(pwUserMonitorParam.getIds())){
|
||||
if (CollUtil.isEmpty(pwUserMonitorParam.getIds())) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -426,81 +423,77 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
LocalDate startDate = LocalDate.parse(pwUserMonitorParam.getSearchBeginTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
LocalDate endDate = LocalDate.parse(pwUserMonitorParam.getSearchEndTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
|
||||
lambdaQueryWrapper.select(RStatLimitTargetDPO::getLineId,RStatLimitTargetDPO::getTime,RStatLimitTargetDPO::getAllTime).in(RStatLimitTargetDPO::getLineId,pwUserMonitorParam.getIds());
|
||||
lambdaQueryWrapper.between(RStatLimitTargetDPO::getTime,pwUserMonitorParam.getSearchBeginTime(),pwUserMonitorParam.getSearchEndTime());
|
||||
List<RStatLimitTargetDPO> rStatLimitTargetDPOList = rStatLimitTargetDMapper.selectList(lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(rStatLimitTargetDPOList)){
|
||||
Map<String,List<RStatLimitTargetDPO>> map = rStatLimitTargetDPOList.stream().collect(Collectors.groupingBy(RStatLimitTargetDPO::getLineId));
|
||||
processDateRange(startDate,endDate,map,result);
|
||||
}
|
||||
lambdaQueryWrapper.select(RStatLimitTargetDPO::getLineId, RStatLimitTargetDPO::getTime, RStatLimitTargetDPO::getAllTime).in(RStatLimitTargetDPO::getLineId, pwUserMonitorParam.getIds());
|
||||
lambdaQueryWrapper.between(RStatLimitTargetDPO::getTime, pwUserMonitorParam.getSearchBeginTime(), pwUserMonitorParam.getSearchEndTime());
|
||||
List<RStatLimitTargetDPO> rStatLimitTargetDPOList = rStatLimitTargetDMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(rStatLimitTargetDPOList)) {
|
||||
Map<String, List<RStatLimitTargetDPO>> map = rStatLimitTargetDPOList.stream().collect(Collectors.groupingBy(RStatLimitTargetDPO::getLineId));
|
||||
processDateRange(startDate, endDate, map, result);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void processDateRange(LocalDate startDate, LocalDate endDate,Map<String,List<RStatLimitTargetDPO>> map,List<PwLimitDataVO> result) {
|
||||
map.forEach((lineKey,list)->{
|
||||
PwLimitDataVO pwLimitDataVO = new PwLimitDataVO();
|
||||
pwLimitDataVO.setLineId(lineKey);
|
||||
pwLimitDataVO.setName(lineKey);
|
||||
List<PwLimitDataVO.LimitDetail> detailList = new ArrayList<>();
|
||||
public void processDateRange(LocalDate startDate, LocalDate endDate, Map<String, List<RStatLimitTargetDPO>> map, List<PwLimitDataVO> result) {
|
||||
map.forEach((lineKey, list) -> {
|
||||
PwLimitDataVO pwLimitDataVO = new PwLimitDataVO();
|
||||
pwLimitDataVO.setLineId(lineKey);
|
||||
pwLimitDataVO.setName(lineKey);
|
||||
List<PwLimitDataVO.LimitDetail> detailList = new ArrayList<>();
|
||||
|
||||
if (startDate.getYear() == endDate.getYear() && startDate.getMonth() == endDate.getMonth()) {
|
||||
Map<LocalDate, RStatLimitTargetDPO> targetDPOMap = list.stream().collect(Collectors.toMap(RStatLimitTargetDPO::getTime, Function.identity()));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate.minusDays(1)); date = date.plusDays(1)) {
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if (targetDPOMap.containsKey(date)) {
|
||||
limitDetail.setLimitFlag(targetDPOMap.get(date).getAllTime() > 0 ? 2 : 1);
|
||||
} else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(date.getDayOfMonth() +"日");
|
||||
detailList.add(limitDetail);
|
||||
if (startDate.getYear() == endDate.getYear() && startDate.getMonth() == endDate.getMonth()) {
|
||||
Map<LocalDate, RStatLimitTargetDPO> targetDPOMap = list.stream().collect(Collectors.toMap(RStatLimitTargetDPO::getTime, Function.identity()));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate.minusDays(1)); date = date.plusDays(1)) {
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if (targetDPOMap.containsKey(date)) {
|
||||
limitDetail.setLimitFlag(targetDPOMap.get(date).getAllTime() > 0 ? 2 : 1);
|
||||
} else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(date.getDayOfMonth() + "日");
|
||||
detailList.add(limitDetail);
|
||||
}
|
||||
|
||||
}else {
|
||||
Map<String,List<RStatLimitTargetDPO>> targetDPOMap = list.stream().collect(Collectors.groupingBy(it->LocalDateTimeUtil.format(it.getTime(),DatePattern.NORM_MONTH_PATTERN)));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
} else {
|
||||
Map<String, List<RStatLimitTargetDPO>> targetDPOMap = list.stream().collect(Collectors.groupingBy(it -> LocalDateTimeUtil.format(it.getTime(), DatePattern.NORM_MONTH_PATTERN)));
|
||||
// 如果在同一个月,则遍历每一天
|
||||
|
||||
// 如果不在同一个月,则遍历每个月(这里简化处理,只打印月份和年份)
|
||||
LocalDate currentDate = startDate;
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
String date = LocalDateTimeUtil.format(currentDate,DatePattern.NORM_MONTH_PATTERN);
|
||||
// 如果不在同一个月,则遍历每个月(这里简化处理,只打印月份和年份)
|
||||
LocalDate currentDate = startDate;
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
String date = LocalDateTimeUtil.format(currentDate, DatePattern.NORM_MONTH_PATTERN);
|
||||
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if(targetDPOMap.containsKey(date)){
|
||||
boolean res = targetDPOMap.get(date).stream().anyMatch(item->item.getAllTime()>0);
|
||||
limitDetail.setLimitFlag(res ? 2:1);
|
||||
}else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(currentDate.getMonthValue() +"月");
|
||||
detailList.add(limitDetail);
|
||||
PwLimitDataVO.LimitDetail limitDetail = new PwLimitDataVO.LimitDetail();
|
||||
if (targetDPOMap.containsKey(date)) {
|
||||
boolean res = targetDPOMap.get(date).stream().anyMatch(item -> item.getAllTime() > 0);
|
||||
limitDetail.setLimitFlag(res ? 2 : 1);
|
||||
} else {
|
||||
limitDetail.setLimitFlag(0);
|
||||
}
|
||||
limitDetail.setDay(currentDate.getMonthValue() + "月");
|
||||
detailList.add(limitDetail);
|
||||
|
||||
|
||||
// 跳到下一个月的第一天(注意:这里简化了处理,没有实际遍历这个月的每一天)
|
||||
currentDate = currentDate.plusMonths(1).withDayOfMonth(1);
|
||||
|
||||
// 跳到下一个月的第一天(注意:这里简化了处理,没有实际遍历这个月的每一天)
|
||||
currentDate = currentDate.plusMonths(1).withDayOfMonth(1);
|
||||
|
||||
// 如果当前月已经超过了结束月,则退出循环
|
||||
if (currentDate.isAfter(endDate)) {
|
||||
break;
|
||||
}
|
||||
// 如果当前月已经超过了结束月,则退出循环
|
||||
if (currentDate.isAfter(endDate)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
pwLimitDataVO.setDetailList(detailList);
|
||||
result.add(pwLimitDataVO);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
pwLimitDataVO.setDetailList(detailList);
|
||||
result.add(pwLimitDataVO);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String strToSql(String originalString){
|
||||
public String strToSql(String originalString) {
|
||||
StringBuilder modifiedStringBuilder = new StringBuilder();
|
||||
|
||||
// 标记是否需要在下一个字符前添加下划线
|
||||
@@ -569,7 +562,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
monitorLimitRateVO.getClass().getMethod(setterName, BigDecimal.class)
|
||||
.invoke(monitorLimitRateVO, BigDecimal.valueOf(3.14159));
|
||||
} else {
|
||||
BigDecimal ratio = BigDecimal.valueOf((double) uharmOvertime / allTime*100)
|
||||
BigDecimal ratio = BigDecimal.valueOf((double) uharmOvertime / allTime * 100)
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
ratio = ratio.compareTo(BigDecimal.valueOf(100)) > 0 ? BigDecimal.valueOf(100) : ratio;
|
||||
monitorLimitRateVO.getClass().getMethod(setterName, BigDecimal.class)
|
||||
@@ -583,13 +576,13 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
}
|
||||
|
||||
|
||||
private void onLineAndIntegrity(List<String> lineIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIds, List<RStatOnlineRateVO> onlineRateByDevIds, List<RStatLimitTargetVO> limitTargetList, GridDiagramVO.LineData lineData) {
|
||||
private void onLineAndIntegrity(List<String> lineIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIds, List<RStatOnlineRateVO> onlineRateByDevIds, List<RStatLimitTargetVO> limitTargetList, GridDiagramVO.LineData lineData) {
|
||||
//监测完整率
|
||||
List<RStatIntegrityD> integrityDS = onIntegrityByIds.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(integrityDS)) {
|
||||
double realTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getRealTime).sum();
|
||||
double dueTime = integrityDS.stream().mapToDouble(RStatIntegrityD::getDueTime).sum();
|
||||
lineData.setIntegrityRate(Math.min(NumberUtil.round(realTime * 100.0 / dueTime, 2).floatValue(),100));
|
||||
lineData.setIntegrityRate(Math.min(NumberUtil.round(realTime * 100.0 / dueTime, 2).floatValue(), 100));
|
||||
} else {
|
||||
lineData.setIntegrityRate(0.0f);
|
||||
}
|
||||
@@ -598,14 +591,14 @@ public class RStatLimitServiceImpl implements RStatLimitService {
|
||||
if (CollUtil.isNotEmpty(onlineRateDS)) {
|
||||
double onlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOnlineMin).sum();
|
||||
double offlineTime = onlineRateDS.stream().mapToDouble(RStatOnlineRateVO::getOfflineMin).sum();
|
||||
lineData.setOnLineRate(Math.min(NumberUtil.round(onlineTime * 100.0 / (onlineTime + offlineTime), 2).floatValue(),100));
|
||||
lineData.setOnLineRate(Math.min(NumberUtil.round(onlineTime * 100.0 / (onlineTime + offlineTime), 2).floatValue(), 100));
|
||||
} else {
|
||||
lineData.setOnLineRate(0.0f);
|
||||
}
|
||||
//监测点超标占比
|
||||
List<RStatLimitTargetVO> limitTarget = limitTargetList.stream().filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(limitTarget)) {
|
||||
long count = limitTarget.stream().filter(o->o.getAllOvertime() > 0 || o.getFlickerAllTime()>0).count();
|
||||
long count = limitTarget.stream().filter(o -> o.getAllOvertime() > 0 || o.getFlickerAllTime() > 0).count();
|
||||
lineData.setOutOfStandardRate(NumberUtil.round(count * 100.0 / lineIds.size(), 2).floatValue());
|
||||
} else {
|
||||
lineData.setOutOfStandardRate(0.0f);
|
||||
|
||||
Reference in New Issue
Block a user