From 9a33fc4f8a0ace2d076418bd0f8d6441cb34b9a3 Mon Sep 17 00:00:00 2001 From: VVT789 <sdxt_0802@163.com> Date: 星期四, 13 二月 2025 10:57:43 +0800 Subject: [PATCH] 电能质量分析三相不平衡分析逻辑调整 --- zhitan-system/src/main/java/com/zhitan/energyMonitor/service/impl/ElectricThreePhaseServiceImpl.java | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/zhitan-system/src/main/java/com/zhitan/energyMonitor/service/impl/ElectricThreePhaseServiceImpl.java b/zhitan-system/src/main/java/com/zhitan/energyMonitor/service/impl/ElectricThreePhaseServiceImpl.java index 5a21836..f855043 100644 --- a/zhitan-system/src/main/java/com/zhitan/energyMonitor/service/impl/ElectricThreePhaseServiceImpl.java +++ b/zhitan-system/src/main/java/com/zhitan/energyMonitor/service/impl/ElectricThreePhaseServiceImpl.java @@ -54,9 +54,7 @@ @Override public ElectricThreePhaseVO list(String timeType, String timeCode, List<EnergyIndex> energyIndexList, String requestType, String meterId) { ElectricThreePhaseVO vo = new ElectricThreePhaseVO(); - if (ObjectUtil.isEmpty(energyIndexList)) { - return vo; - } + // 鑾峰彇鐢靛帇涓嶅钩琛℃暟鎹� if (CommonConst.STR_NUMBER_0.equals(requestType)) { energyIndexList = energyIndexList.stream() @@ -70,9 +68,13 @@ || StringUtil.ifEmptyOrNullReturnValue(x.getCode()).trim().endsWith(CommonConst.TAG_CODE_CURRENT_C)) .collect(Collectors.toList()); } + if (ObjectUtil.isEmpty(energyIndexList)) { + return vo; + } List<String> tagCodeList = energyIndexList.stream().map(EnergyIndex::getCode).collect(Collectors.toList()); - tagCodeList.add(CommonConst.STR_NUMBER_MINUS_ONE); - String tagCodes = String.join(StrUtil.COMMA, tagCodeList); + if(ObjectUtil.isEmpty(tagCodeList)){ + tagCodeList.add(CommonConst.STR_NUMBER_MINUS_ONE); + } Date start = ChartUtils.getDateTime(timeType, timeCode); Date end = getEndTime(timeType, start); @@ -82,7 +84,7 @@ long millis = new Duration(begin, finish).getMillis(); int pointCount = IntegerUtil.toInt(millis / CommonConst.DIGIT_3600 / CommonConst.DIGIT_1000); - List<TagValue> tagValueList = realtimeDatabaseService.retrieve(tagCodes, start, end, pointCount); + List<TagValue> tagValueList = realtimeDatabaseService.retrieve(tagCodeList, start, end, pointCount); List<ElectricThreePhaseItem> itemList = new ArrayList<>(); List<Date> dateList = new ArrayList<>(); ChartUtils.generateDateList(timeType, timeCode, dateList); @@ -281,10 +283,14 @@ */ private void listDayData(Date date, List<TagValue> tagValueList, ElectricThreePhaseItem temp, ElectricThreePhaseTempModel tempModel) { Date endTime = DateTimeUtil.addHours(date, CommonConst.DIGIT_1); - List<TagValue> currentTagValueList = tagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) <= 0 && DateTimeUtil.compareDateDiff(endTime, x.getDataTime()) > 0).collect(Collectors.toList()); - List<TagValue> currentATagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_A")).collect(Collectors.toList()); - List<TagValue> currentBTagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_B")).collect(Collectors.toList()); - List<TagValue> currentCTagValueList = currentTagValueList.stream().filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith("_C")).collect(Collectors.toList()); + List<TagValue> currentTagValueList = tagValueList.stream() + .filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) <= 0 && DateTimeUtil.compareDateDiff(endTime, x.getDataTime()) > 0).collect(Collectors.toList()); + List<TagValue> currentATagValueList = currentTagValueList.stream() + .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith(CommonConst.A_PHASE)).collect(Collectors.toList()); + List<TagValue> currentBTagValueList = currentTagValueList.stream() + .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith(CommonConst.B_PHASE)).collect(Collectors.toList()); + List<TagValue> currentCTagValueList = currentTagValueList.stream() + .filter(x -> StringUtil.ifEmptyOrNullReturnValue(x.getTagCode()).trim().endsWith(CommonConst.C_PHASE)).collect(Collectors.toList()); TagValue tagValueA = currentATagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); TagValue tagValueB = currentBTagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); TagValue tagValueC = currentCTagValueList.stream().filter(x -> DateTimeUtil.compareDateDiff(date, x.getDataTime()) == 0).findAny().orElse(null); -- Gitblit v1.9.3