From 140ed851081d671393cd5de3cf91f0d5a4cecf50 Mon Sep 17 00:00:00 2001 From: xy <748613696@qq.com> Date: Fri, 6 Feb 2026 09:57:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommMonitorEventReportServiceImpl.java | 5 +- .../report/ExportModelController.java | 2 +- .../service/MonitorHarmonicReportService.java | 2 +- .../impl/CustomReportTableServiceImpl.java | 9 +- .../MonitorHarmonicReportServiceImpl.java | 100 +++++++++++++----- 5 files changed, 85 insertions(+), 33 deletions(-) diff --git a/pqs-event/event-common/src/main/java/com/njcn/event/common/service/impl/CommMonitorEventReportServiceImpl.java b/pqs-event/event-common/src/main/java/com/njcn/event/common/service/impl/CommMonitorEventReportServiceImpl.java index d71044d44..dbb68f628 100644 --- a/pqs-event/event-common/src/main/java/com/njcn/event/common/service/impl/CommMonitorEventReportServiceImpl.java +++ b/pqs-event/event-common/src/main/java/com/njcn/event/common/service/impl/CommMonitorEventReportServiceImpl.java @@ -12,9 +12,9 @@ import com.njcn.echarts.pojo.constant.PicCommonData; import com.njcn.echarts.util.DrawPicUtil; import com.njcn.event.common.mapper.RmpEventDetailMapper; import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO; +import com.njcn.event.common.service.CommMonitorEventReportService; import com.njcn.event.common.service.EventAnalysisService; import com.njcn.event.common.service.EventReportService; -import com.njcn.event.common.service.CommMonitorEventReportService; import com.njcn.event.common.utils.WordUtils; import com.njcn.event.pojo.param.ExportParam; import com.njcn.event.pojo.param.StatisticsParam; @@ -218,7 +218,7 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport EventDetail eventDetail = plot.get(j); String s = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")); - insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude() * 100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + ""); + insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude() * 100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", Objects.isNull(eventDetail.getAdvanceType())?"/":eventDetail.getAdvanceType(), Objects.isNull(eventDetail.getAdvanceReason())?"/":eventDetail.getAdvanceReason(), Objects.isNull(eventDetail.getSeverity())?"/":eventDetail.getSeverity() + ""); } i++; } @@ -585,6 +585,7 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport // .in(RmpEventDetailPO::getEventType, typeIds) .ge(StrUtil.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))) .le(StrUtil.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime()))) + .orderByDesc(RmpEventDetailPO::getStartTime) ); return BeanUtil.copyToList(info, EventDetail.class); diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/report/ExportModelController.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/report/ExportModelController.java index 23e4e6f52..09ee2160f 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/report/ExportModelController.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/controller/report/ExportModelController.java @@ -125,6 +125,6 @@ public class ExportModelController extends BaseController { - monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO); + monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO,null); } } diff --git a/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/MonitorHarmonicReportService.java b/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/MonitorHarmonicReportService.java index 64853e817..b102eaa8f 100644 --- a/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/MonitorHarmonicReportService.java +++ b/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/MonitorHarmonicReportService.java @@ -25,5 +25,5 @@ public interface MonitorHarmonicReportService { String crmName, Boolean isUrl, MultipartFile file, - HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit); + HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit, String dataLevel); } diff --git a/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/CustomReportTableServiceImpl.java b/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/CustomReportTableServiceImpl.java index 40e35fdab..78c1f7223 100644 --- a/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/CustomReportTableServiceImpl.java +++ b/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/CustomReportTableServiceImpl.java @@ -14,6 +14,7 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONTokener; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.toolkit.SqlRunner; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; @@ -157,7 +158,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService { } else { phase = PHASE_MAPPING.get(item.getPhase()); } - tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula()); + if (ObjectUtils.isNotNull(item.getHarmStart()) && ObjectUtils.isNotNull(item.getHarmEnd())) { + for (int i = item.getHarmStart(); i <= item.getHarmEnd() + 1; i++) { + tMap.put((item.getOtherName() + "_" + i + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula()); + } + } else { + tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula()); + } }); eleEpdPqdList = eleEpdPqdList.stream().filter(it->"T".equals(it.getPhase())||"M".equals(it.getPhase())).collect(Collectors.toList()); diff --git a/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/MonitorHarmonicReportServiceImpl.java b/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/MonitorHarmonicReportServiceImpl.java index 74d99249a..0a57f5a6d 100644 --- a/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/MonitorHarmonicReportServiceImpl.java +++ b/pqs-harmonic/harmonic-common/src/main/java/com/njcn/harmonic/common/service/impl/MonitorHarmonicReportServiceImpl.java @@ -14,15 +14,15 @@ import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pq.api.DeviceUnitClient; import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO; +import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO; +import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO; +import com.njcn.harmonic.common.service.MonitorCommReportService; +import com.njcn.harmonic.common.service.MonitorHarmonicReportService; import com.njcn.harmonic.pojo.param.ReportQueryParam; import com.njcn.harmonic.pojo.po.report.EnumPass; import com.njcn.harmonic.pojo.po.report.Pass; import com.njcn.harmonic.pojo.po.report.ReportTarget; import com.njcn.harmonic.pojo.vo.ReportValue; -import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO; -import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO; -import com.njcn.harmonic.common.service.MonitorCommReportService; -import com.njcn.harmonic.common.service.MonitorHarmonicReportService; import com.njcn.harmonic.utils.WordUtil2; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.ThemeFeignClient; @@ -114,7 +114,7 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe String crmName, Boolean isUrl, MultipartFile file, - HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit) { + HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit, String dataLevel) { //获取监测点信息 String bdname; Integer pttype; @@ -122,6 +122,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe String atype = ""; String btype = ""; String ctype = ""; + //pt + Double pt = getData(lineDto.getPt()); + //ct + Double ct = getData(lineDto.getCt()); + + if (type == 0) { if (ObjectUtil.isNull(lineDto)) { throw new BusinessException(CommonResponseEnum.NO_DATA); @@ -263,14 +269,13 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe // 基波电压最大值 reportmap.put("$B" + "V0" + "X" + "_A$", judgeNull(voltage1.getFmaxValue())); - reportmap.put("$B" + "V0" + "X" + "_B$", judgeNull(voltage2.getFmaxValue())); reportmap.put("$B" + "V0" + "X" + "_C$", judgeNull(voltage3.getFmaxValue())); // 基波电流最大值 - reportmap.put("$B" + "I0" + "X" + "_A$", judgeNull(current1.getFmaxValue())); - reportmap.put("$B" + "I0" + "X" + "_B$", judgeNull(current2.getFmaxValue())); - reportmap.put("$B" + "I0" + "X" + "_C$", judgeNull(current3.getFmaxValue())); + reportmap.put("$B" + "I0" + "X" + "_A$", dataConversion(current1.getFmaxValue(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "X" + "_B$", dataConversion(current2.getFmaxValue(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "X" + "_C$", dataConversion(current3.getFmaxValue(),dataLevel,ct,true)); /************************************************************** **** 三张大表基础数据幅值 @@ -291,9 +296,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe reportmap.put("$B" + "V0" + "N" + "_C$", judgeNull(voltage3.getMinValue())); // 基波电流最小值 - reportmap.put("$B" + "I0" + "N" + "_A$", judgeNull(current1.getMinValue())); - reportmap.put("$B" + "I0" + "N" + "_B$", judgeNull(current2.getMinValue())); - reportmap.put("$B" + "I0" + "N" + "_C$", judgeNull(current3.getMinValue())); + reportmap.put("$B" + "I0" + "N" + "_A$", dataConversion(current1.getMinValue(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "N" + "_B$", dataConversion(current2.getMinValue(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "N" + "_C$", dataConversion(current3.getMinValue(),dataLevel,ct,true)); /************************************************************** **** 三张大表基础数据幅值 @@ -314,9 +319,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe reportmap.put("$B" + "V0" + "E" + "_C$", judgeNull(voltage3.getMeanValue())); // 基波电流平均值 - reportmap.put("$B" + "I0" + "E" + "_A$", judgeNull(current1.getMeanValue())); - reportmap.put("$B" + "I0" + "E" + "_B$", judgeNull(current2.getMeanValue())); - reportmap.put("$B" + "I0" + "E" + "_C$", judgeNull(current3.getMeanValue())); + reportmap.put("$B" + "I0" + "E" + "_A$", dataConversion(current1.getMeanValue(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "E" + "_B$", dataConversion(current2.getMeanValue(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "E" + "_C$", dataConversion(current3.getMeanValue(),dataLevel,ct,true)); /************************************************************** **** 三张大表基础数据幅值 @@ -337,9 +342,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe reportmap.put("$B" + "V0" + "%" + "_C$", judgeNull(voltage3.getCp95Value())); // 基波电流cp95值 - reportmap.put("$B" + "I0" + "%" + "_A$", judgeNull(current1.getCp95Value())); - reportmap.put("$B" + "I0" + "%" + "_B$", judgeNull(current2.getCp95Value())); - reportmap.put("$B" + "I0" + "%" + "_C$", judgeNull(current3.getCp95Value())); + reportmap.put("$B" + "I0" + "%" + "_A$", dataConversion(current1.getCp95Value(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "%" + "_B$", dataConversion(current2.getCp95Value(),dataLevel,ct,true)); + reportmap.put("$B" + "I0" + "%" + "_C$", dataConversion(current3.getCp95Value(),dataLevel,ct,true)); /************************************************************** **** 三张大表基础数据幅值 @@ -387,10 +392,10 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe Double vaveValue = Double.parseDouble(reportmap.get("$BV0E_" + tmpstrMap + "$").toString()); Double vcp95Value = Double.parseDouble(reportmap.get("$BV0%_" + tmpstrMap + "$").toString()); // 基波电流 - Double imaxValue = Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString()); - Double iminValue = Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString()); - Double iaveValue = Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString()); - Double icp95Value = Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString()); + Double imaxValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString())*ct; + Double iminValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString())*ct; + Double iaveValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString())*ct; + Double icp95Value = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString())*ct; if (!(vmaxValue >= vminValue && vmaxValue >= vaveValue && vmaxValue >= vcp95Value)) { strBaseVIResult += "注意:从上表中可以看出" + strLineBaseName @@ -1222,9 +1227,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe String strCurrent = strMap + (i + 1) + "%"; // 谐波电流幅值 - strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value()); - strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value()); - strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value()); +// strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value()); +// strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value()); +// strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value()); + strCurrentA = dataConversion(this.listICurrent.get(i).getList().get(0).getCp95Value(),dataLevel,ct,true); + strCurrentB = dataConversion(this.listICurrent.get(i).getList().get(1).getCp95Value(),dataLevel,ct,true); + strCurrentC = dataConversion(this.listICurrent.get(i).getList().get(2).getCp95Value(),dataLevel,ct,true); strLimit = judgeNull(this.listICurrent.get(i).getOverLimit()); reportmap.put(strCurrent + "_A$", strCurrentA); @@ -1253,9 +1261,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe reportmap.put("$CI" + (i + 1) + "L$", strLimit); try { - maxValue = Double.parseDouble(strCurrentA); - minValue = Double.parseDouble(strCurrentB); - aveValue = Double.parseDouble(strCurrentC); + maxValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentA)*ct : Double.parseDouble(strCurrentA); + minValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentB)*ct : Double.parseDouble(strCurrentB); + aveValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentC)*ct : Double.parseDouble(strCurrentC);; limit = Double.parseDouble(strLimit); } catch (Exception e) { strResultCurrentValue += "注意:从上表中可以看出" + strLineBaseName +(i + 1)+ "次谐波电流幅值95%概率值数据存在异常(不是数值类型)。\r\n"; @@ -1380,6 +1388,26 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe } } + public Double getData(String data) { + double ratio = 1.0; + if (Objects.isNull(data) || data.isEmpty()) { + return ratio; + } + String[] parts = data.split("/"); + if (parts.length == 2) { + try { + Double num1 = Double.parseDouble(parts[0]); + Double num2 = Double.parseDouble(parts[1]); + ratio = num1 / num2; + } catch (NumberFormatException var7) { + System.out.println("字符串格式错误"); + } + } else { + ratio = Double.parseDouble(parts[0]); + } + return ratio; + } + /** * 数据单位信息 重组 * @@ -1722,6 +1750,22 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe return (result == null) ? "/" : result.toString(); } + public String dataConversion(Float result, String dataLevel, Double ratio, Boolean isI) { + if (result == null) { + return "/"; + } + if (!"Secondary".equals(dataLevel)) { + return String.valueOf(result); + } + double conversionRatio = (ratio != null) ? ratio : 1.0; + double convertedValue = result * conversionRatio; + if (isI != null && Boolean.TRUE.equals(isI)) { + return String.format("%.2f", convertedValue); + } else { + return String.format("%.2f", convertedValue / 1000.0); + } + } + /** * 谐波电流限值 *