From 199836779c14766f434b491154bff796cb58ea4b Mon Sep 17 00:00:00 2001 From: hzj <826100833@qq.com> Date: Sat, 11 Oct 2025 14:25:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E7=89=88=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EasyPoiWordExportServiceImpl.java | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/event_smart/src/main/java/com/njcn/product/event/report/service/impl/EasyPoiWordExportServiceImpl.java b/event_smart/src/main/java/com/njcn/product/event/report/service/impl/EasyPoiWordExportServiceImpl.java index bfd943c..1546aa4 100644 --- a/event_smart/src/main/java/com/njcn/product/event/report/service/impl/EasyPoiWordExportServiceImpl.java +++ b/event_smart/src/main/java/com/njcn/product/event/report/service/impl/EasyPoiWordExportServiceImpl.java @@ -94,7 +94,7 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService { lambdaQueryWrapper.in(PqsEventdetail::getWavetype,msgEventConfigService.getEventType()) .gt(PqsEventdetail::getPersisttime,msgEventConfigService.getEventDuration()) .le(PqsEventdetail::getEventvalue,msgEventConfigService.getEventValue()) - .between(PqsEventdetail::getTimeid,DateUtil.parse(param.getSearchBeginTime(),DatePattern.NORM_DATETIME_PATTERN),DateUtil.parse(param.getSearchEndTime(),DatePattern.NORM_DATETIME_PATTERN)); + .between(PqsEventdetail::getTimeid,DateUtil.parse(param.getSearchBeginTime(),DatePattern.NORM_DATETIME_PATTERN),DateUtil.parse(param.getSearchEndTime(),DatePattern.NORM_DATETIME_PATTERN)); if (deptIds.size() > 1000) { List> listList = CollUtil.split(deptIds, 1000); lambdaQueryWrapper.and(w->{ @@ -144,28 +144,9 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService { String busVoltageStr = busVoltageDeal(ledgerBaseInfoDTOList, pqsDicDataMap); bjReportDTO.setStationVoltage(busVoltageStr); //double容易精度缺失 - double min = Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble() * 100 * 100) * 0.01d; - double max = Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble() * 100 * 100) * 0.01d; + String min =String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01) ; + String max = String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01) ; bjReportDTO.setResidualVoltageRange(min + "%-" + max + "%"); - bjReportDTO.setBjTotalEvent(pqsEventdetailList.size()); - List lineIds = pqsEventdetailList.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList()); - if(CollectionUtils.isEmpty(lineIds)){ - //如果lineIds为空添加一个不是监测点的监测点id避免后边查询错误 - lineIds.add(99999999); - } - List ledgerBaseInfoDTOList = pqLineMapper.getBaseLedger(lineIds,null); - long stationCount = ledgerBaseInfoDTOList.stream().map(LedgerBaseInfoDTO::getStationId).distinct().count(); - bjReportDTO.setTotalEventSubstation((int)stationCount); - long busCount = ledgerBaseInfoDTOList.stream().map(LedgerBaseInfoDTO::getBusBarId).distinct().count(); - bjReportDTO.setBjTotalBus((int)busCount); - String busVoltageStr = busVoltageDeal(ledgerBaseInfoDTOList,pqsDicDataMap); - bjReportDTO.setStationVoltage(busVoltageStr); - //double容易精度缺失 - String min =String.format("%.3f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100)) ; - String max = String.format("%.3f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100)) ; -// double min =Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01d ; -// double max = Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01d; - bjReportDTO.setResidualVoltageRange(min+"%-"+max+"%"); double minPersisTime = pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getPersisttime).min().getAsDouble() / 1000; double maxPersisTime = pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getPersisttime).max().getAsDouble() / 1000; @@ -236,10 +217,9 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService { String stationStr = stationVoltageDeal(ledgerBaseInfoDTOList,pqsDicDataMap); String areabusVoltageDeal = areabusVoltageDeal(ledgerBaseInfoDTOList,pqsDicDataMap); - String min =String.format("%.3f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100)) ; - String max = String.format("%.3f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100)) ; -// double min =Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01d ; -// double max = Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01d; + + String min =String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01) ; + String max = String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01) ; String residualVoltage = min+"%-"+max+"%"; double minPersisTime = pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getPersisttime).min().getAsDouble()/1000; @@ -307,9 +287,9 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService { String companyStationStr = stationVoltageDeal(companyLedgerBaseInfoDTOList,pqsDicDataMap); String companyAreabusVoltageDeal = areabusVoltageDeal(companyLedgerBaseInfoDTOList,pqsDicDataMap); + String companyMin =String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01) ; + String companyMax = String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01) ; - String companyMin =String.format("%.3f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100)) ; - String companyMax = String.format("%.3f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100)) ; String companyResidualVoltage = companyMin+"%-"+companyMax+"%"; double companyMinPersisTime = companyevent.stream().mapToDouble(PqsEventdetail::getPersisttime).min().getAsDouble()/1000;