1.数据质量统计算法->台账质量统计算法
This commit is contained in:
@@ -21,4 +21,7 @@ public class DeptGetBusBarDTO extends DeptGetBase {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "pwBusBarIds",value = "配网母线/线路信息")
|
@ApiModelProperty(name = "pwBusBarIds",value = "配网母线/线路信息")
|
||||||
private List<String> pwBusBarIds;
|
private List<String> pwBusBarIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "busBarIds",value = "线路/监测点id信息")
|
||||||
|
private List<String> busBarAndMonitorIDs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,7 @@ public class DeptGetSubStationDTO extends DeptGetBase {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "pwStationIds",value = "配网电站信息")
|
@ApiModelProperty(name = "pwStationIds",value = "配网电站信息")
|
||||||
private List<String> pwStationIds;
|
private List<String> pwStationIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "stationIds",value = "变电站/监测点信息")
|
||||||
|
private List<String> stationAndMonitorIDs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,6 @@ public class TerminalGetBase {
|
|||||||
* 台账(监测点,母线,装置,电站,供电公司)id
|
* 台账(监测点,母线,装置,电站,供电公司)id
|
||||||
*/
|
*/
|
||||||
private String ledgerId;
|
private String ledgerId;
|
||||||
|
|
||||||
|
private String lineId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,17 +44,17 @@ public class RQualityParameterPO implements Serializable {
|
|||||||
* 监测点-母线-变电站匹配个数
|
* 监测点-母线-变电站匹配个数
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "matchingCount",value = "监测点-母线-变电站匹配个数")
|
@ApiModelProperty(name = "matchingCount",value = "监测点-母线-变电站匹配个数")
|
||||||
private String matchingCount;
|
private Integer matchingCount;
|
||||||
/**
|
/**
|
||||||
* 监测点-母线-变电站匹配个率
|
* 监测点-母线-变电站匹配个率
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "matchingRate",value = "监测点-母线-变电站匹配个率")
|
@ApiModelProperty(name = "matchingRate",value = "监测点-母线-变电站匹配个率")
|
||||||
private String matchingRate;
|
private Float matchingRate;
|
||||||
/**
|
/**
|
||||||
* 监测点台账完整率
|
* 监测点台账完整率
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "monitoringIntegrityRate",value = "监测点台账完整率")
|
@ApiModelProperty(name = "monitoringIntegrityRate",value = "监测点台账完整率")
|
||||||
private String monitoringIntegrityRate;
|
private Float monitoringIntegrityRate;
|
||||||
/**
|
/**
|
||||||
* 数据类型,字典表(01:主网测点 02:配网测点)
|
* 数据类型,字典表(01:主网测点 02:配网测点)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,25 +40,25 @@ public class RQualityParameterVO implements Serializable {
|
|||||||
* 监测点数量
|
* 监测点数量
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "measurementCount",value = "监测点数量")
|
@ApiModelProperty(name = "measurementCount",value = "监测点数量")
|
||||||
private String measurementCount;
|
private Integer measurementCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点-母线-变电站匹配个数
|
* 监测点-母线-变电站匹配个数
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "matchingCount",value = "监测点-母线-变电站匹配个数")
|
@ApiModelProperty(name = "matchingCount",value = "监测点-母线-变电站匹配个数")
|
||||||
private String matchingCount;
|
private Integer matchingCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点-母线-变电站匹配个率
|
* 监测点-母线-变电站匹配个率
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "matchingRate",value = "监测点-母线-变电站匹配个率")
|
@ApiModelProperty(name = "matchingRate",value = "监测点-母线-变电站匹配个率")
|
||||||
private String matchingRate;
|
private Float matchingRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点台账完整率
|
* 监测点台账完整率
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(name = "monitoringIntegrityRate",value = "监测点台账完整率")
|
@ApiModelProperty(name = "monitoringIntegrityRate",value = "监测点台账完整率")
|
||||||
private String monitoringIntegrityRate;
|
private Float monitoringIntegrityRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型,字典表(01:主网测点 02:配网测点)
|
* 数据类型,字典表(01:主网测点 02:配网测点)
|
||||||
|
|||||||
@@ -55,4 +55,13 @@ public interface PmsGeneratrixWireMapper extends MppBaseMapper<GeneratrixWire> {
|
|||||||
* @date 2023/5/11
|
* @date 2023/5/11
|
||||||
*/
|
*/
|
||||||
List<GeneratrixWire> getGeneratrixWireList();
|
List<GeneratrixWire> getGeneratrixWireList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 监测点和线路关系
|
||||||
|
* @param
|
||||||
|
* @return: java.util.List<com.njcn.device.pms.pojo.po.GeneratrixWire>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/10/11 13:57
|
||||||
|
*/
|
||||||
|
List<GeneratrixWire> getWireAndMonitor();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,17 @@
|
|||||||
on pms_generatrix_wire.Station_Id = pms_statation_stat.Power_Id
|
on pms_generatrix_wire.Station_Id = pms_statation_stat.Power_Id
|
||||||
where pms_generatrix_wire.status = 1
|
where pms_generatrix_wire.status = 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getWireAndMonitor" resultType="com.njcn.device.pms.pojo.po.GeneratrixWire">
|
||||||
|
SELECT
|
||||||
|
monitor.id as id,
|
||||||
|
monitor.Org_Id as orgId
|
||||||
|
FROM
|
||||||
|
pms_generatrix_wire wire
|
||||||
|
INNER JOIN pms_statation_stat stat ON wire.Station_Id = stat.Power_Id
|
||||||
|
INNER JOIN pms_monitor monitor ON monitor.Line_Id = wire.id
|
||||||
|
WHERE
|
||||||
|
wire.STATUS = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class PwDataQualityStatServiceImpl implements PwDataQualityStatService {
|
|||||||
BeanUtils.copyProperties(po, vo);
|
BeanUtils.copyProperties(po, vo);
|
||||||
vo.setOrgName(deptDTOMap.get(vo.getOrgNo()).getName());
|
vo.setOrgName(deptDTOMap.get(vo.getOrgNo()).getName());
|
||||||
vo.setMeasurementCompleteQuantity(Double.toString(
|
vo.setMeasurementCompleteQuantity(Double.toString(
|
||||||
Integer.parseInt(po.getMeasurementCount()) * Double.parseDouble(po.getMonitoringIntegrityRate())
|
Integer.parseInt(po.getMeasurementCount()) * po.getMonitoringIntegrityRate()
|
||||||
));
|
));
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import com.njcn.device.biz.pojo.po.Overlimit;
|
|||||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||||
import com.njcn.device.pms.mapper.majornetwork.*;
|
import com.njcn.device.pms.mapper.majornetwork.*;
|
||||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||||
|
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
|
||||||
|
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
|
||||||
import com.njcn.device.pms.pojo.po.*;
|
import com.njcn.device.pms.pojo.po.*;
|
||||||
import com.njcn.device.pms.service.ledgerManger.DeptLineService;
|
import com.njcn.device.pms.service.ledgerManger.DeptLineService;
|
||||||
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
|
||||||
@@ -174,6 +176,10 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().eq(StatationStat::getStatus, 1));
|
List<StatationStat> statationStatList = statationStatMapper.selectList(new LambdaQueryWrapper<StatationStat>().eq(StatationStat::getStatus, 1));
|
||||||
Map<String, List<StatationStat>> map = statationStatList.stream().collect(Collectors.groupingBy(StatationStat::getOrgId));
|
Map<String, List<StatationStat>> map = statationStatList.stream().collect(Collectors.groupingBy(StatationStat::getOrgId));
|
||||||
|
|
||||||
|
//获取监测点信息
|
||||||
|
List<PmsStatationStatInfoDTO> statationStatInfo = statationStatMapper.getStatationStatInfo(new PmsStatationStatInfoParam());
|
||||||
|
Map<String, List<PmsStatationStatInfoDTO>> statationAndMonitorMap = statationStatInfo.stream().collect(Collectors.groupingBy(PmsStatationStatInfoDTO::getOrgId));
|
||||||
|
|
||||||
//List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0);
|
//List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0);
|
||||||
//Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
//Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
||||||
|
|
||||||
@@ -187,15 +193,21 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||||
List<String> lineList = new ArrayList<>();
|
List<String> lineList = new ArrayList<>();
|
||||||
List<String> lineListPw = new ArrayList<>();
|
List<String> lineListPw = new ArrayList<>();
|
||||||
|
List<String> statationList = new ArrayList<>();
|
||||||
deptIds.forEach(i -> {
|
deptIds.forEach(i -> {
|
||||||
if (map.containsKey(i)) {
|
if (map.containsKey(i)) {
|
||||||
lineList.addAll(map.get(i).stream().map(StatationStat::getPowerId).distinct().collect(Collectors.toList()));
|
lineList.addAll(map.get(i).stream().map(StatationStat::getPowerId).distinct().collect(Collectors.toList()));
|
||||||
|
|
||||||
|
}
|
||||||
|
if(statationAndMonitorMap.containsKey(i)){
|
||||||
|
statationList.addAll(statationAndMonitorMap.get(i).stream().filter(x->x.getPowerId()!=null).map(PmsStatationStatInfoDTO::getMonitorId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
/*if (mapPms.containsKey(i)) {
|
/*if (mapPms.containsKey(i)) {
|
||||||
lineListPw.addAll(mapPms.get(i).stream().map(PmsMonitorBaseDTO::getPowerrId).distinct().collect(Collectors.toList()));
|
lineListPw.addAll(mapPms.get(i).stream().map(PmsMonitorBaseDTO::getPowerrId).distinct().collect(Collectors.toList()));
|
||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
deptGetSubStationDTO.setStationIds(lineList.stream().distinct().collect(Collectors.toList()));
|
deptGetSubStationDTO.setStationIds(lineList.stream().distinct().collect(Collectors.toList()));
|
||||||
|
deptGetSubStationDTO.setStationAndMonitorIDs(statationList.stream().distinct().collect(Collectors.toList()));
|
||||||
deptGetSubStationDTO.setPwStationIds(lineListPw.stream().distinct().collect(Collectors.toList()));
|
deptGetSubStationDTO.setPwStationIds(lineListPw.stream().distinct().collect(Collectors.toList()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -212,6 +224,10 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
List<GeneratrixWire> generatrixWireList = pmsGeneratrixWireMapper.getGeneratrixWireList();
|
List<GeneratrixWire> generatrixWireList = pmsGeneratrixWireMapper.getGeneratrixWireList();
|
||||||
Map<String, List<GeneratrixWire>> map = generatrixWireList.stream().collect(Collectors.groupingBy(GeneratrixWire::getOrgId));
|
Map<String, List<GeneratrixWire>> map = generatrixWireList.stream().collect(Collectors.groupingBy(GeneratrixWire::getOrgId));
|
||||||
|
|
||||||
|
//获取主网,线路和监测点关系个数
|
||||||
|
List<GeneratrixWire> wireAndMonitor = pmsGeneratrixWireMapper.getWireAndMonitor();
|
||||||
|
Map<String, List<GeneratrixWire>> wireAndMonitorMap = wireAndMonitor.stream().collect(Collectors.groupingBy(GeneratrixWire::getOrgId));
|
||||||
|
|
||||||
/*List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0);
|
/*List<PmsMonitorBaseDTO> pmsMonitorBaseDTOList = distributionMonitorMapper.getDisMonitorAllList(null, 0);
|
||||||
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
Map<String, List<PmsMonitorBaseDTO>> mapPms = pmsMonitorBaseDTOList.stream().collect(Collectors.groupingBy(PmsMonitorBaseDTO::getOrgId));
|
||||||
*/
|
*/
|
||||||
@@ -225,15 +241,20 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||||
List<String> lineList = new ArrayList<>();
|
List<String> lineList = new ArrayList<>();
|
||||||
List<String> lineListPw = new ArrayList<>();
|
List<String> lineListPw = new ArrayList<>();
|
||||||
|
List<String> wireAndMonitorList = new ArrayList<>();
|
||||||
deptIds.forEach(i -> {
|
deptIds.forEach(i -> {
|
||||||
if (map.containsKey(i)) {
|
if (map.containsKey(i)) {
|
||||||
lineList.addAll(map.get(i).stream().map(GeneratrixWire::getId).collect(Collectors.toList()));
|
lineList.addAll(map.get(i).stream().map(GeneratrixWire::getId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
if(wireAndMonitorMap.containsKey(i)){
|
||||||
|
wireAndMonitorList.addAll(wireAndMonitorMap.get(i).stream().map(GeneratrixWire::getId).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
/* if (mapPms.containsKey(i)) {
|
/* if (mapPms.containsKey(i)) {
|
||||||
lineListPw.addAll(mapPms.get(i).stream().map(PmsMonitorBaseDTO::getLineId).collect(Collectors.toList()));
|
lineListPw.addAll(mapPms.get(i).stream().map(PmsMonitorBaseDTO::getLineId).collect(Collectors.toList()));
|
||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
deptGetBusBarDTO.setBusBarIds(lineList);
|
deptGetBusBarDTO.setBusBarIds(lineList);
|
||||||
|
deptGetBusBarDTO.setBusBarAndMonitorIDs(wireAndMonitorList);
|
||||||
deptGetBusBarDTO.setPwBusBarIds(lineListPw);
|
deptGetBusBarDTO.setPwBusBarIds(lineListPw);
|
||||||
}
|
}
|
||||||
result.add(deptGetBusBarDTO);
|
result.add(deptGetBusBarDTO);
|
||||||
|
|||||||
@@ -72,9 +72,12 @@ public class ROperatingIndexMServiceImpl extends ServiceImpl<ROperatingIndexMMap
|
|||||||
//在线监测率
|
//在线监测率
|
||||||
Integer measurementRunPoints = item.getMeasurementRunPoints(); //监测点数
|
Integer measurementRunPoints = item.getMeasurementRunPoints(); //监测点数
|
||||||
Integer transitMeasurementPoints = item.getTransitMeasurementPoints(); //在线监测点数
|
Integer transitMeasurementPoints = item.getTransitMeasurementPoints(); //在线监测点数
|
||||||
Double transitMeasurementRate = Double.parseDouble(df.format(transitMeasurementPoints / (measurementRunPoints * 1.0) * 100));
|
if(transitMeasurementPoints!=null&&transitMeasurementPoints!=0){
|
||||||
rOperatingIndexCommonVO.setTransitMeasurementRate(transitMeasurementRate); //在线监测率
|
Double transitMeasurementRate = Double.parseDouble(df.format(transitMeasurementPoints / (measurementRunPoints * 1.0) * 100));
|
||||||
|
rOperatingIndexCommonVO.setTransitMeasurementRate(transitMeasurementRate); //在线监测率
|
||||||
|
}else{
|
||||||
|
rOperatingIndexCommonVO.setTransitMeasurementRate(0.0);
|
||||||
|
}
|
||||||
return rOperatingIndexCommonVO;
|
return rOperatingIndexCommonVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return resultList;
|
return resultList;
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
DISTINCT
|
DISTINCT
|
||||||
pq_dept_line.id unitId,
|
pq_dept_line.id unitId,
|
||||||
dic.value voltageLevel,
|
dic.value voltageLevel,
|
||||||
voltage.id pointId
|
voltage.id pointId,
|
||||||
|
point.id devId
|
||||||
</if>
|
</if>
|
||||||
<!--装置-->
|
<!--装置-->
|
||||||
<if test="type == 3">
|
<if test="type == 3">
|
||||||
@@ -73,7 +73,8 @@
|
|||||||
select
|
select
|
||||||
DISTINCT
|
DISTINCT
|
||||||
pq_dept_line.id unitId,
|
pq_dept_line.id unitId,
|
||||||
substation.id ledgerId
|
substation.id ledgerId,
|
||||||
|
point.id lineId
|
||||||
from pq_dept_line pq_dept_line
|
from pq_dept_line pq_dept_line
|
||||||
inner join pq_line point on pq_dept_line.line_id = point.id
|
inner join pq_line point on pq_dept_line.line_id = point.id
|
||||||
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.device.pq.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||||
|
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
|
||||||
import com.njcn.device.pq.pojo.po.DeptLine;
|
import com.njcn.device.pq.pojo.po.DeptLine;
|
||||||
import com.njcn.web.pojo.param.DeptLineParam;
|
import com.njcn.web.pojo.param.DeptLineParam;
|
||||||
|
|
||||||
@@ -89,7 +90,7 @@ public interface DeptLineService extends IService<DeptLine> {
|
|||||||
* @author cdf
|
* @author cdf
|
||||||
* @date 2023/5/10
|
* @date 2023/5/10
|
||||||
*/
|
*/
|
||||||
Map<String, List<String>> orgSubStationGet(List<Integer> devType);
|
Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devType);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
public List<DeptGetSubStationDTO> deptSubStation(DeptGetLineParam deptGetLineParam) {
|
public List<DeptGetSubStationDTO> deptSubStation(DeptGetLineParam deptGetLineParam) {
|
||||||
List<DeptGetSubStationDTO> result = new ArrayList<>();
|
List<DeptGetSubStationDTO> result = new ArrayList<>();
|
||||||
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
|
||||||
Map<String, List<String>> map = deptLineService.orgSubStationGet(filterDataTypeNew(deptGetLineParam.getServerName()));
|
Map<String, List<TerminalGetBase>> map = deptLineService.orgSubStationGet(filterDataTypeNew(deptGetLineParam.getServerName()));
|
||||||
temDept.forEach(item -> {
|
temDept.forEach(item -> {
|
||||||
DeptGetSubStationDTO deptGetSubStationDTO = new DeptGetSubStationDTO();
|
DeptGetSubStationDTO deptGetSubStationDTO = new DeptGetSubStationDTO();
|
||||||
deptGetSubStationDTO.setUnitId(item.getUnitId());
|
deptGetSubStationDTO.setUnitId(item.getUnitId());
|
||||||
@@ -123,13 +123,16 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
|
deptGetSubStationDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||||
List<String> deptIds = item.getUnitChildrenList();
|
List<String> deptIds = item.getUnitChildrenList();
|
||||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||||
|
List<String> subList = new ArrayList<>();
|
||||||
List<String> lineList = new ArrayList<>();
|
List<String> lineList = new ArrayList<>();
|
||||||
deptIds.forEach(i -> {
|
deptIds.forEach(i -> {
|
||||||
if (map.containsKey(i)) {
|
if (map.containsKey(i)) {
|
||||||
lineList.addAll(map.get(i));
|
subList.addAll(map.get(i).stream().map(TerminalGetBase::getLedgerId).collect(Collectors.toList()));
|
||||||
|
lineList.addAll(map.get(i).stream().map(TerminalGetBase::getLineId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
deptGetSubStationDTO.setStationIds(lineList);
|
deptGetSubStationDTO.setStationIds(subList);
|
||||||
|
deptGetSubStationDTO.setStationAndMonitorIDs(lineList);
|
||||||
}
|
}
|
||||||
result.add(deptGetSubStationDTO);
|
result.add(deptGetSubStationDTO);
|
||||||
});
|
});
|
||||||
@@ -148,13 +151,16 @@ public class CommTerminalServiceImpl implements CommTerminalService {
|
|||||||
deptGetBusBarDTO.setUnitChildrenList(item.getUnitChildrenList());
|
deptGetBusBarDTO.setUnitChildrenList(item.getUnitChildrenList());
|
||||||
List<String> deptIds = item.getUnitChildrenList();
|
List<String> deptIds = item.getUnitChildrenList();
|
||||||
if (CollectionUtil.isNotEmpty(deptIds)) {
|
if (CollectionUtil.isNotEmpty(deptIds)) {
|
||||||
|
List<String> busBarList = new ArrayList<>();
|
||||||
List<String> lineList = new ArrayList<>();
|
List<String> lineList = new ArrayList<>();
|
||||||
deptIds.forEach(i -> {
|
deptIds.forEach(i -> {
|
||||||
if (map.containsKey(i)) {
|
if (map.containsKey(i)) {
|
||||||
lineList.addAll(map.get(i).stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()));
|
busBarList.addAll(map.get(i).stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()));
|
||||||
|
lineList.addAll(map.get(i).stream().map(LineDevGetDTO::getDevId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
deptGetBusBarDTO.setBusBarIds(lineList);
|
deptGetBusBarDTO.setBusBarIds(busBarList);
|
||||||
|
deptGetBusBarDTO.setBusBarAndMonitorIDs(lineList);
|
||||||
}
|
}
|
||||||
result.add(deptGetBusBarDTO);
|
result.add(deptGetBusBarDTO);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -99,9 +99,9 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<String>> orgSubStationGet(List<Integer> devDataType) {
|
public Map<String, List<TerminalGetBase>> orgSubStationGet(List<Integer> devDataType) {
|
||||||
List<TerminalGetBase> deptLines = deptLineMapper.orgSubStationGet(devDataType);
|
List<TerminalGetBase> deptLines = deptLineMapper.orgSubStationGet(devDataType);
|
||||||
return deptLines.stream ().collect (Collectors.groupingBy (TerminalGetBase::getUnitId, Collectors.mapping (TerminalGetBase::getLedgerId,Collectors.toList ())));
|
return deptLines.stream ().collect (Collectors.groupingBy (TerminalGetBase::getUnitId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.njcn.prepare.harmonic.pojo.mysql;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测指标数据质量问题汇总统计-月表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-10-09
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("r_quality_parameter_m")
|
||||||
|
@ApiModel(value = "RQualityParameterM对象", description = "监测指标数据质量问题汇总统计-月表")
|
||||||
|
public class RQualityParameterM {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("单位ID")
|
||||||
|
@MppMultiId("org_no")
|
||||||
|
private String orgNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("时间")
|
||||||
|
@MppMultiId("data_date")
|
||||||
|
private LocalDateTime dataDate;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点数量")
|
||||||
|
@TableField("measurement_count")
|
||||||
|
private Integer measurementCount;
|
||||||
|
|
||||||
|
@ApiModelProperty("有效接入监测点数量")
|
||||||
|
@TableField("effective_access_measurement_count")
|
||||||
|
private Integer effectiveAccessMeasurementCount;
|
||||||
|
|
||||||
|
@ApiModelProperty("存在数据质量问题监测点")
|
||||||
|
@TableField("problem")
|
||||||
|
private Integer problem;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点-母线-变电站匹配个数")
|
||||||
|
@TableField("matching_count")
|
||||||
|
private Integer matchingCount;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点-母线-变电站匹配个率")
|
||||||
|
@TableField("matching_rate")
|
||||||
|
private Float matchingRate;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点台账完整率")
|
||||||
|
@TableField("monitoring_integrity_rate")
|
||||||
|
private Float monitoringIntegrityRate;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据类型,字典表(01:主网测点 02:配网测点)")
|
||||||
|
@MppMultiId("data_type")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.prepare.harmonic.controller.newalgorithm;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.common.utils.NjcnDateUtils;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.PrimaryGridParam;
|
||||||
|
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RQualityParameterMService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测指标数据质量问题汇总统计-月表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-10-09
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rQualityParameterM")
|
||||||
|
@Api(tags = "监测指标数据质量问题汇总统计")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RQualityParameterMController extends BaseController {
|
||||||
|
|
||||||
|
private final RQualityParameterMService rQualityParameterMService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("监测指标数据质量问题汇总统计(r_quality_parameter_m表数据)")
|
||||||
|
@ApiImplicitParam(value = "jobParam", name = "jobParam", required = true)
|
||||||
|
@PostMapping("rQualityParameterMHandler")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
|
public HttpResult<Boolean> rQualityParameterMHandler(@RequestBody LineParam jobParam) {
|
||||||
|
log.info(LocalDateTime.now() + "rQualityParameterMHandler开始执行");
|
||||||
|
String methodDescribe = getMethodDescribe("rQualityParameterMHandler");
|
||||||
|
rQualityParameterMService.rQualityParameterMHandler(jobParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.prepare.harmonic.mapper.mysql.newalgorithm;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.mysql.RQualityParameterM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测指标数据质量问题汇总统计-月表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-10-09
|
||||||
|
*/
|
||||||
|
public interface RQualityParameterMMapper extends MppBaseMapper<RQualityParameterM> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.prepare.mapper.RQualityParameterMMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.prepare.harmonic.service.mysql.newalgorithm;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.mysql.RQualityParameterM;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测指标数据质量问题汇总统计-月表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-10-09
|
||||||
|
*/
|
||||||
|
public interface RQualityParameterMService extends IMppService<RQualityParameterM> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 监测指标数据质量问题汇总统计算法
|
||||||
|
* @param jobParam
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/10/9 10:21
|
||||||
|
*/
|
||||||
|
void rQualityParameterMHandler(LineParam jobParam);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
package com.njcn.prepare.harmonic.service.mysql.newalgorithm.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.*;
|
||||||
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||||
|
import com.njcn.harmonic.pojo.po.ROperatingIndexMPO;
|
||||||
|
import com.njcn.prepare.harmonic.mapper.mysql.newalgorithm.RQualityParameterMMapper;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.mysql.ROperatingMonitorDPO;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.mysql.RQualityParameterM;
|
||||||
|
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
|
import com.njcn.prepare.harmonic.service.mysql.area.ROperatingIndexMPOService;
|
||||||
|
import com.njcn.prepare.harmonic.service.mysql.line.ROperatingMonitorService;
|
||||||
|
import com.njcn.prepare.harmonic.service.mysql.newalgorithm.RQualityParameterMService;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
|
import com.njcn.user.pojo.po.Dept;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 监测指标数据质量问题汇总统计-月表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author wr
|
||||||
|
* @since 2023-10-09
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RQualityParameterMServiceImpl extends MppServiceImpl<RQualityParameterMMapper, RQualityParameterM> implements RQualityParameterMService {
|
||||||
|
|
||||||
|
private final ROperatingIndexMPOService rOperatingIndexMPOService;
|
||||||
|
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||||
|
private final DeptFeignClient deptFeignClient;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private final ROperatingMonitorService rOperatingMonitorDService;
|
||||||
|
@Override
|
||||||
|
@Async("asyncExecutor")
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
|
public void rQualityParameterMHandler(LineParam jobParam) {
|
||||||
|
//获取主网id
|
||||||
|
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||||
|
|
||||||
|
List<RQualityParameterM> info = new ArrayList();
|
||||||
|
Dept dept = deptFeignClient.getRootDept().getData();
|
||||||
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(dept.getId());
|
||||||
|
List<DeptGetChildrenMoreDTO> deptGetBaseList = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||||
|
//获取线路信息
|
||||||
|
List<DeptGetBusBarDTO> busBarList = commTerminalGeneralClient.deptBusBar(deptGetLineParam).getData();
|
||||||
|
Map<String, List<String>> busBarMap = busBarList.stream().collect(Collectors.toMap(DeptGetBusBarDTO::getUnitId, DeptGetBusBarDTO::getBusBarAndMonitorIDs));
|
||||||
|
|
||||||
|
//获取线路信息
|
||||||
|
List<DeptGetSubStationDTO> subStationList = commTerminalGeneralClient.deptSubStation(deptGetLineParam).getData();
|
||||||
|
Map<String, List<String>> subStationMap = subStationList.stream().collect(Collectors.toMap(DeptGetSubStationDTO::getUnitId, DeptGetSubStationDTO::getStationAndMonitorIDs));
|
||||||
|
|
||||||
|
|
||||||
|
//获取监测点数量和在运监测点
|
||||||
|
List<ROperatingIndexMPO> list = rOperatingIndexMPOService.list(new LambdaQueryWrapper<ROperatingIndexMPO>()
|
||||||
|
.ge(ROperatingIndexMPO::getDataDate, jobParam.getBeginTime())
|
||||||
|
.le(ROperatingIndexMPO::getDataDate, jobParam.getEndTime())
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, ROperatingIndexMPO> orgMonitorNumMap = list.stream().collect(Collectors.toMap(ROperatingIndexMPO::getOrgNo, Function.identity()));
|
||||||
|
RQualityParameterM rQualityParameterM;
|
||||||
|
for (DeptGetChildrenMoreDTO deptGetBase : deptGetBaseList) {
|
||||||
|
rQualityParameterM = new RQualityParameterM();
|
||||||
|
if (orgMonitorNumMap.containsKey(deptGetBase.getUnitId())) {
|
||||||
|
ROperatingIndexMPO rOperatingIndexMPO = orgMonitorNumMap.get(deptGetBase.getUnitId());
|
||||||
|
rQualityParameterM.setMeasurementCount(rOperatingIndexMPO.getMeasurementRunPoints());
|
||||||
|
rQualityParameterM.setEffectiveAccessMeasurementCount(rOperatingIndexMPO.getEffectiveAccessMeasurementCount());
|
||||||
|
//查询数据异常的监测点
|
||||||
|
if(CollUtil.isNotEmpty(deptGetBase.getLineBaseList())){
|
||||||
|
List<String> lineIds = deptGetBase.getLineBaseList().stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||||
|
int num = rOperatingMonitorDService.count(new LambdaQueryWrapper<ROperatingMonitorDPO>()
|
||||||
|
.in(ROperatingMonitorDPO::getMeasurementPointId, lineIds)
|
||||||
|
.eq(ROperatingMonitorDPO::getIsUnusual, 0)
|
||||||
|
.ge(ROperatingMonitorDPO::getDataDate, jobParam.getBeginTime())
|
||||||
|
.le(ROperatingMonitorDPO::getDataDate, jobParam.getEndTime())
|
||||||
|
);
|
||||||
|
rQualityParameterM.setProblem(num);
|
||||||
|
}else{
|
||||||
|
rQualityParameterM.setProblem(0);
|
||||||
|
}
|
||||||
|
if(busBarMap.containsKey(deptGetBase.getUnitId())&&subStationMap.containsKey(deptGetBase.getUnitId())){
|
||||||
|
List<String> ids1 = busBarMap.get(deptGetBase.getUnitId());
|
||||||
|
List<String> ids2 = subStationMap.get(deptGetBase.getUnitId());
|
||||||
|
Integer sum = ids1.stream().filter(ids2::contains).collect(Collectors.toList()).size();
|
||||||
|
rQualityParameterM.setMatchingCount(sum);
|
||||||
|
Integer matchingCount = rQualityParameterM.getMatchingCount();
|
||||||
|
if(matchingCount!=null&&matchingCount!=0){
|
||||||
|
BigDecimal round = NumberUtil.round(sum / matchingCount * 1.0, 2);
|
||||||
|
rQualityParameterM.setMatchingRate(round.floatValue()*100);
|
||||||
|
}else{
|
||||||
|
rQualityParameterM.setMatchingCount(0);
|
||||||
|
rQualityParameterM.setMatchingRate(0.0f);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
rQualityParameterM.setMatchingCount(0);
|
||||||
|
rQualityParameterM.setMatchingRate(0.0f);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rQualityParameterM.setMeasurementCount(0);
|
||||||
|
rQualityParameterM.setEffectiveAccessMeasurementCount(0);
|
||||||
|
rQualityParameterM.setProblem(0);
|
||||||
|
rQualityParameterM.setMatchingCount(0);
|
||||||
|
rQualityParameterM.setMatchingRate(0.0F);
|
||||||
|
}
|
||||||
|
rQualityParameterM.setMonitoringIntegrityRate(100.0F);
|
||||||
|
rQualityParameterM.setDataDate(PubUtils.localDateTimeFormat(jobParam.getDataDate() + " " + "00:00:00"));
|
||||||
|
rQualityParameterM.setOrgNo(deptGetBase.getUnitId());
|
||||||
|
rQualityParameterM.setDataType(data.getId());
|
||||||
|
|
||||||
|
info.add(rQualityParameterM);
|
||||||
|
}
|
||||||
|
List<RQualityParameterM> collect = info.stream().filter(x -> x.getMatchingCount() > 0).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(info)) {
|
||||||
|
// this.saveOrUpdateBatchByMultiId(info, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user