二级评估联调和导出评估结果

This commit is contained in:
wr
2025-08-26 18:15:00 +08:00
parent 9caf1724a6
commit fb0f23e70b
24 changed files with 1070 additions and 87 deletions

View File

@@ -13,6 +13,7 @@ import com.njcn.harmonic.pojo.param.HistoryParam;
import com.njcn.harmonic.pojo.param.NormHistoryParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.vo.AssessEvaluation;
import com.njcn.harmonic.pojo.vo.HistoryDataResultVO;
import com.njcn.harmonic.pojo.vo.StatHarmonicOrgVO;
import com.njcn.harmonic.service.HistoryResultService;
@@ -127,4 +128,13 @@ public class HistoryResultController extends BaseController {
);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getHarmIAndHarmVData")
@ApiOperation("评估结果获取谐波电压和谐波电流含有率、三项不平横度和负序电流")
@ApiImplicitParam(name = "param", value = "获取越线监测点越线次数请求参数", required = true)
public HttpResult<AssessEvaluation> getHarmIAndHarmVData(@RequestBody StatisticsBizBaseParam param) {
String methodDescribe = getMethodDescribe("getHarmIAndHarmVData");
AssessEvaluation harmIAndHarmVData = historyResultService.getHarmIAndHarmVData(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, harmIAndHarmVData, methodDescribe);
}
}

View File

@@ -0,0 +1,13 @@
package com.njcn.harmonic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateIDPO;
/**
* @Description:
* @Author: wr
* @Date: 2024/7/31 9:24
*/
public interface RStatDataHarmRateIDMapper extends BaseMapper<RStatDataHarmrateIDPO> {
}

View File

@@ -0,0 +1,13 @@
package com.njcn.harmonic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.po.day.RStatDataHarmrateVDPO;
/**
* @Description:
* @Author: wr
* @Date: 2024/7/31 9:24
*/
public interface RStatDataHarmRateVDMapper extends BaseMapper<RStatDataHarmrateVDPO> {
}

View File

@@ -4,6 +4,7 @@ import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.harmonic.pojo.param.HistoryHarmParam;
import com.njcn.harmonic.pojo.param.HistoryParam;
import com.njcn.harmonic.pojo.param.NormHistoryParam;
import com.njcn.harmonic.pojo.vo.AssessEvaluation;
import com.njcn.harmonic.pojo.vo.HistoryDataResultVO;
import com.njcn.harmonic.pojo.vo.StatHarmonicOrgVO;
import com.njcn.influx.pojo.dto.HarmHistoryDataDTO;
@@ -47,4 +48,9 @@ public interface HistoryResultService {
* @return HarmHistoryDataDTO
*/
HarmHistoryDataDTO getHistoryHarmData(HistoryHarmParam historyHarmParam);
/**
* 二级评估评估数据
*/
AssessEvaluation getHarmIAndHarmVData(StatisticsBizBaseParam param);
}

View File

@@ -1,14 +1,17 @@
package com.njcn.harmonic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.common.pojo.constant.BizParamConstant;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.utils.PubUtils;
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateVD;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.po.Overlimit;
@@ -16,19 +19,21 @@ import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.biz.utils.COverlimitUtil;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.harmonic.enums.HarmonicResponseEnum;
import com.njcn.harmonic.mapper.StatHarmonicOrgDMapper;
import com.njcn.harmonic.mapper.StatHarmonicOrgMMapper;
import com.njcn.harmonic.mapper.StatHarmonicOrgQMapper;
import com.njcn.harmonic.mapper.StatHarmonicOrgYMapper;
import com.njcn.harmonic.mapper.*;
import com.njcn.harmonic.pojo.QueryResultLimitVO;
import com.njcn.harmonic.pojo.param.HistoryHarmParam;
import com.njcn.harmonic.pojo.param.HistoryParam;
import com.njcn.harmonic.pojo.param.NormHistoryParam;
import com.njcn.harmonic.pojo.po.RStatDataVD;
import com.njcn.harmonic.pojo.po.day.*;
import com.njcn.harmonic.pojo.vo.AssessEvaluation;
import com.njcn.harmonic.pojo.vo.EventDetailVO;
import com.njcn.harmonic.pojo.vo.HistoryDataResultVO;
import com.njcn.harmonic.pojo.vo.StatHarmonicOrgVO;
import com.njcn.harmonic.service.HistoryResultService;
import com.njcn.harmonic.service.IRStatDataVDService;
import com.njcn.influx.imapper.CommonMapper;
import com.njcn.influx.imapper.DataHarmRateVMapper;
import com.njcn.influx.imapper.DataIMapper;
@@ -44,12 +49,15 @@ import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
@@ -90,6 +98,10 @@ public class HistoryResultServiceImpl implements HistoryResultService {
private final DicDataFeignClient dicDataFeignClient;
private final RStatDataIDMapper dataIDMapper;
private final RStatDataVDMapper dataVDMapper;
private final RStatDataHarmRateVDMapper dataHarmRateVDMapper;
private final RStatDataHarmRateIDMapper dataHarmRateIDMapper;
@Override
public List<HistoryDataResultVO> getHistoryResult(HistoryParam historyParam) {
@@ -1078,6 +1090,99 @@ public class HistoryResultServiceImpl implements HistoryResultService {
return new HarmHistoryDataDTO(historyData, overLimit);
}
@Override
public AssessEvaluation getHarmIAndHarmVData(StatisticsBizBaseParam param) {
String id = param.getId();
String startTime = param.getStartTime();
String endTime = param.getEndTime();
List<RStatDataIDPO> rStatDataIDPOS = dataIDMapper.selectList(new LambdaQueryWrapper<RStatDataIDPO>()
.eq(RStatDataIDPO::getLineId, id)
.eq(RStatDataIDPO::getValueType,"CP95")
.in(RStatDataIDPO::getPhaseType,Arrays.asList("A","B","C"))
.ge(RStatDataIDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(RStatDataIDPO::getTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
);
List<RStatDataVD> rStatDataVDS = dataVDMapper.selectList(new LambdaQueryWrapper<RStatDataVD>()
.eq(RStatDataVD::getLineId, id)
.eq(RStatDataVD::getValueType,"CP95")
.in(RStatDataVD::getPhasicType,Arrays.asList("A","B","C"))
.ge(RStatDataVD::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(RStatDataVD::getTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
);
List<RStatDataHarmrateVDPO> harmV = dataHarmRateVDMapper.selectList(new LambdaQueryWrapper<RStatDataHarmrateVDPO>()
.eq(RStatDataHarmrateVDPO::getLineId, id)
.eq(RStatDataHarmrateVDPO::getValueType,"CP95")
.in(RStatDataHarmrateVDPO::getPhaseType,Arrays.asList("A","B","C"))
.ge(RStatDataHarmrateVDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(RStatDataHarmrateVDPO::getTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
);
List<RStatDataHarmrateIDPO> harmI = dataHarmRateIDMapper.selectList(new LambdaQueryWrapper<RStatDataHarmrateIDPO>()
.eq(RStatDataHarmrateIDPO::getLineId, id)
.eq(RStatDataHarmrateIDPO::getValueType,"CP95")
.in(RStatDataHarmrateIDPO::getPhaseType,Arrays.asList("A","B","C"))
.ge(RStatDataHarmrateIDPO::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(RStatDataHarmrateIDPO::getTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
);
AssessEvaluation assessEvaluation=new AssessEvaluation();
List<Double> iMax=new ArrayList<>();
List<Double> uMax=new ArrayList<>();
if(CollUtil.isNotEmpty(rStatDataIDPOS)&&CollUtil.isNotEmpty(rStatDataVDS)&&CollUtil.isNotEmpty(harmV)&&CollUtil.isNotEmpty(harmI)){
Double iNeg = rStatDataIDPOS.stream().map(RStatDataIDPO::getINeg).max(Comparator.naturalOrder()).get();
assessEvaluation.setINeg(iNeg);
BigDecimal vUnbalance = rStatDataVDS.stream().map(RStatDataVD::getVUnbalance).max(Comparator.naturalOrder()).get();
assessEvaluation.setUnbalance(vUnbalance.doubleValue());
for (int i = 2; i < 51; i++) {
uMax.add(reflectDataV(harmV,"v"+i).stream().max(Comparator.naturalOrder()).get());
iMax.add(reflectDataI(harmI,"i"+i).stream().max(Comparator.naturalOrder()).get());
}
assessEvaluation.setIMax(iMax);
assessEvaluation.setUMax(uMax);
}else{
return null;
}
return assessEvaluation;
}
private List<Double> reflectDataV(List<RStatDataHarmrateVDPO> harmVList,String attribute) {
Field field;
try {
field = RStatDataHarmrateVDPO.class.getDeclaredField(attribute);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
field.setAccessible(true);
return harmVList.stream().map(temp -> {
Double o;
try {
o = (Double) field.get(temp);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return o;
}).collect(Collectors.toList());
}
private List<Double> reflectDataI(List<RStatDataHarmrateIDPO> harmIList,String attribute) {
Field field;
try {
field = RStatDataHarmrateIDPO.class.getDeclaredField(attribute);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
field.setAccessible(true);
return harmIList.stream().map(temp -> {
Double o;
try {
o = (Double) field.get(temp);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
return o;
}).collect(Collectors.toList());
}
/***
* 获取指定次数 监测点的历史谐波电流数据
* @author hongawen