1.修改pqbug

2.添加统计类型下监测点数量
This commit is contained in:
wr
2023-05-31 13:52:10 +08:00
parent d2a1694242
commit dd83655a1b
12 changed files with 34 additions and 21 deletions

View File

@@ -75,4 +75,10 @@ public class ResourceData {
*/
@TableField(value = "file_name")
private String fileName;
/**
* 图片名称
*/
@TableField(value = "img_name")
private String imgName;
}

View File

@@ -203,7 +203,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
if (CollectionUtils.isEmpty(lineIndexes)) {
continue;
}
outParam.setType(generalDeviceDTO.getName());
outParam.setType(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getDeviceIndexes().size()+")");
//根据监测点查询数据完整性
List<PublicDTO> integrityData = getCondition(lineIndexes, integrityIconParam.getSearchBeginTime(), integrityIconParam.getSearchEndTime());
outParam.setSingle(NumberUtil.round(integrityData.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159),2).doubleValue());

View File

@@ -40,17 +40,20 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, ResourceDat
public Boolean uploadFile(MultipartFile multipartFile, MultipartFile picture, String name,Integer state, Integer type) {
String resUrl = "";
String picUrl = "";
String imgName = "";
//通过封装好的文件工具类来传入文件和文件夹名称来获取文件路径
resUrl = fileStorageUtil.uploadMultipart(multipartFile, OssPath.RESOURCEDATA);
//判断图片文件对象是否为空,不为空获取图片路径
if (null != picture && !picture.isEmpty()) {
picUrl = fileStorageUtil.uploadMultipart(picture, OssPath.RESOURCEDATA);
imgName = picture.getOriginalFilename();
}
//创建对象
ResourceData resourceData = new ResourceData();
resourceData.setResourceName(name);
resourceData.setResUrl(resUrl);
resourceData.setPicUrl(picUrl);
resourceData.setImgName(imgName);
resourceData.setUploadTime(LocalDateTime.now());
resourceData.setState(state);
resourceData.setType(type);
@@ -215,6 +218,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, ResourceDat
//获取路径
String picUrl = fileStorageUtil.uploadMultipart(picture, OssPath.RESOURCEDATA);
resourceData.setPicUrl(picUrl);
resourceData.setImgName(picture.getOriginalFilename());
}
if (StringUtils.isNotBlank(name)) {
resourceData.setResourceName(name);

View File

@@ -167,7 +167,7 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
if (CollectionUtils.isEmpty(deviceIndexes)) {
continue;
}
type.add(generalDeviceDTO.getName());
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getDeviceIndexes().size()+")");
//根据终端索引集查询在线率
List<PublicDTO> onlineRateList = getCondition(deviceIndexes, onlineRateCensusParam.getSearchBeginTime(), onlineRateCensusParam.getSearchEndTime());
single.add(onlineRateList.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159));

View File

@@ -3,6 +3,7 @@ package com.njcn.event.influxdb;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.EventDetailCount;
import com.njcn.influxdb.config.InfluxDbConfig;
import com.njcn.influxdb.utils.InfluxDbUtils;
@@ -137,7 +138,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
* @param eventDetailList influxdb数据
* @return 个数
*/
public static Function<List<String>, Long> countLineIndexes(List<EventDetail> eventDetailList) {
public static Function<List<String>, Long> countLineIndexes(List<RmpEventDetailPO> eventDetailList) {
return lineIndexes -> eventDetailList.stream().filter(t -> lineIndexes.contains(t.getLineId())).count();
}
@@ -146,7 +147,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
*
* @return 个数
*/
public static Function<List<EventDetail>, Long> countEventassIndexIsNoEmpty() {
public static Function<List<RmpEventDetailPO>, Long> countEventassIndexIsNoEmpty() {
return eventDetails -> eventDetails.stream().filter(t -> StringUtils.isNotEmpty(t.getEventassIndex())).count();
}
@@ -156,7 +157,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
* @param eventDetailList influxdb数据
* @return 数据
*/
public static BiFunction<DateTime, DateTime, List<EventDetail>> getBetweenTimeEventDetailList(List<EventDetail> eventDetailList) {
public static BiFunction<DateTime, DateTime, List<RmpEventDetailPO>> getBetweenTimeEventDetailList(List<RmpEventDetailPO> eventDetailList) {
ZoneId zone = ZoneId.systemDefault();
return (beginTime, endTime) -> eventDetailList.stream().filter(eventDetail -> {
Instant timeId = eventDetail.getStartTime().atZone(zone).toInstant();

View File

@@ -118,6 +118,9 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
@Override
public VoltageToleranceCurveVO getVoltageToleranceCurve(DeviceInfoParam.BusinessParam deviceInfoParam) {
// 获取指定部门下的监测点集合
if(CollUtil.isEmpty(deviceInfoParam.getScale())&&(CollUtil.isEmpty(deviceInfoParam.getLoadType()))){
return VoltageToleranceCurveVO.empty();
}
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
if (CollUtil.isEmpty(generalDeviceDTOList)) {
return VoltageToleranceCurveVO.empty();

View File

@@ -187,7 +187,7 @@ public class AreaLineServiceImpl implements AreaLineService {
);
List<EventHeatDeatilVO> eventdetailList = BeanUtil.copyToList(info, EventHeatDeatilVO.class);
if (eventdetailList.size() > 0) {
List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).collect(Collectors.toList());
List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
/* for (EventHeatDeatilVO eventHeat : eventdetailList) {

View File

@@ -66,7 +66,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
@Override
public AreaStatisticalVO getAreaCalculation(DeviceInfoParam.BusinessParam deviceInfoParam) {
//获取录波字典信息
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.RECORDING_WAVE.getCode()).getData();
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
// 获取指定部门下的监测点集合
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
@@ -81,23 +81,22 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
//todo 是否缺少录波
.ne(RmpEventDetailPO::getEventType, data.getId())
.eq(RmpEventDetailPO::getEventType, data.getId())
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
.le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
);
List<EventDetail> eventDetailList = BeanUtil.copyToList(info,EventDetail.class);
if (CollUtil.isEmpty(eventDetailList)) {
if (CollUtil.isEmpty(info)) {
return AreaStatisticalVO.empty();
}
AreaStatisticsVO areaStatisticsVO = statisticsAreaInfo(generalDeviceDTOList, eventDetailList);
AreaStatisticsVO areaStatisticsVO = statisticsAreaInfo(generalDeviceDTOList, info);
MonthlyStatisticsVO monthCalculationVOS = statisticsMonthInfo(deviceInfoParam, eventDetailList);
MonthlyStatisticsVO monthCalculationVOS = statisticsMonthInfo(deviceInfoParam, info);
deviceInfoParam.getStatisticalType().setCode(StatisticsEnum.VOLTAGE_LEVEL.getCode());
List<GeneralDeviceDTO> voltageLevelList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
VoltageStatisticsVO voltageStatisticsVO = statisticalVoltageLevelInfo(voltageLevelList, eventDetailList);
VoltageStatisticsVO voltageStatisticsVO = statisticalVoltageLevelInfo(voltageLevelList, info);
return AreaStatisticalVO.buildVO(areaStatisticsVO, voltageStatisticsVO, monthCalculationVOS);
}
@@ -109,7 +108,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
* @param eventDetailList influxdb数据
* @return 统计月份信息
*/
private MonthlyStatisticsVO statisticsMonthInfo(DeviceInfoParam.BusinessParam deviceInfoParam, List<EventDetail> eventDetailList) {
private MonthlyStatisticsVO statisticsMonthInfo(DeviceInfoParam.BusinessParam deviceInfoParam, List<RmpEventDetailPO> eventDetailList) {
List<DateTime> timeLimit = calculateTheTimePeriodRange(deviceInfoParam);
List<DateTime> monthStartAndEnd = new ArrayList<>();
if(deviceInfoParam.getTimeFlag()==0){
@@ -127,7 +126,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
DateTime beginMon = monthStartAndEnd.get(i);
DateTime endMon = monthStartAndEnd.get(i + 1);
List<EventDetail> eventDetails = getBetweenTimeEventDetailList(eventDetailList).apply(beginMon, endMon);
List<RmpEventDetailPO> eventDetails = getBetweenTimeEventDetailList(eventDetailList).apply(beginMon, endMon);
// 时间段内总记录数
Long count = (long) eventDetails.size();
@@ -161,7 +160,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
* @param eventDetailList influxdb数据
* @return 统计电压等级信息
*/
private VoltageStatisticsVO statisticalVoltageLevelInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<EventDetail> eventDetailList) {
private VoltageStatisticsVO statisticalVoltageLevelInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<RmpEventDetailPO> eventDetailList) {
List<VoltageLevelCalculationVO> voltageLevelCalculation = generalDeviceDTOList.parallelStream().map(t -> {
VoltageLevelCalculationVO voltageLevelCalculationVO = new VoltageLevelCalculationVO();
voltageLevelCalculationVO.setVoltageLevel(t.getName());
@@ -184,7 +183,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
* @param eventDetailList influxdb数据
* @return 统计区域信息
*/
private AreaStatisticsVO statisticsAreaInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<EventDetail> eventDetailList) {
private AreaStatisticsVO statisticsAreaInfo(List<GeneralDeviceDTO> generalDeviceDTOList, List<RmpEventDetailPO> eventDetailList) {
List<AreaCalculationVO> areaCalculation = generalDeviceDTOList.parallelStream().map(t -> {
AreaCalculationVO calculationVO = new AreaCalculationVO();
calculationVO.setAreaName(t.getName());

View File

@@ -89,7 +89,7 @@ public class SteadyExceedRateServiceImpl implements SteadyExceedRateService {
if (!CollectionUtils.isEmpty(deviceDataList)) {
List<Map<String,Double>> maps=new ArrayList<>();
for (GeneralDeviceDTO generalDeviceDTO: deviceDataList) {
type.add(generalDeviceDTO.getName());
type.add("("+generalDeviceDTO.getDeviceIndexes().size()+")"+generalDeviceDTO.getName());
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
Map<String, Double> collect=new HashMap<>();

View File

@@ -116,7 +116,7 @@ public class SteadyQualifyServiceImpl implements SteadyQualifyService {
if (CollectionUtils.isEmpty(lineIndexes)) {
continue;
}
type.add(generalDeviceDTO.getName());
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getDeviceIndexes().size()+")");
List<SteadyQualifyDTO> qualifiesRate = getQualifiesRate(lineIndexes, steadyCensusParam.getSearchBeginTime(), steadyCensusParam.getSearchEndTime());
SteadyQualifyVO dataMoreMonitorMoreDay = getDataMoreMonitorMoreDay(qualifiesRate);
harmonicVoltage.add(dataMoreMonitorMoreDay.getHarmonicVoltage());

View File

@@ -101,7 +101,7 @@ public class THDistortionServiceImpl implements THDistortionService {
if (CollectionUtils.isEmpty(lineIndexes)) {
continue;
}
type.add(generalDeviceDTO.getName());
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getDeviceIndexes().size()+")");
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionCensusParam.getSearchBeginTime(), thDistortionCensusParam.getSearchEndTime());
single.add(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
}

View File

@@ -88,7 +88,7 @@ public class TerminalServiceImpl implements TerminalService {
if (CollectionUtils.isEmpty(generalDeviceDTO.getDeviceIndexes())) {
continue;
}
type.add(generalDeviceDTO.getName());
type.add(generalDeviceDTO.getName()+"\n("+generalDeviceDTO.getDeviceIndexes().size()+")");
List<String> deviceIndexes = generalDeviceDTO.getDeviceIndexes();
//根据终端查询在线率
List<PublicDTO> condition = getCondition(deviceIndexes, terminalCensusParam.getSearchBeginTime(), terminalCensusParam.getSearchEndTime());