From daffdb9048e7efb39ef5af695c5a6c0b6c887ea2 Mon Sep 17 00:00:00 2001 From: wurui Date: Wed, 8 Mar 2023 16:08:30 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8C=BA=E5=9F=9F=E6=8A=A5=E5=91=8A=E5=92=8C?= =?UTF-8?q?=E7=9B=91=E6=B5=8B=E7=82=B9=E6=8A=A5=E5=91=8A=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=202.=E7=BB=88=E7=AB=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../njcn/event/pojo/param/ExportParam.java | 2 + .../majornetwork/ReportController.java | 8 +- .../majornetwork/Impl/ReportServiceImpl.java | 3427 ++++++++++++++++- .../service/majornetwork/ReportService.java | 8 + .../process/pojo/param/TerminalParam.java | 13 +- .../impl/PmsTerminalDetectionServiceImpl.java | 11 +- 6 files changed, 3370 insertions(+), 99 deletions(-) diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/ExportParam.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/ExportParam.java index cc98115aa..e97194318 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/ExportParam.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/ExportParam.java @@ -71,4 +71,6 @@ public class ExportParam implements Serializable { @ApiModelProperty(name = "flag",value = "标识") private Integer flag; + @ApiModelProperty(name = "type",value = "系统区分(0:pq 1:pms)") + private Integer type; } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/ReportController.java b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/ReportController.java index cc5f30575..91e9f8f84 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/ReportController.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/ReportController.java @@ -202,8 +202,14 @@ public class ReportController extends BaseController { @ApiImplicitParam(name = "areaReportParam", value = "参数体", required = true) public void getAreaReport(@RequestBody @Validated AreaReportParam areaReportParam, HttpServletResponse response) throws Exception { reportService.getAreaReport(areaReportParam, response); - } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getPmsAreaReport") + @ApiOperation("获取Pms区域报告") + @ApiImplicitParam(name = "areaReportParam", value = "参数体", required = true) + public void getPmsAreaReport(@RequestBody @Validated AreaReportParam areaReportParam, HttpServletResponse response) throws Exception { + reportService.getPmsAreaReport(areaReportParam, response); + } } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java index caaaf118e..9f2a7d004 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java @@ -19,8 +19,14 @@ import com.github.abel533.echarts.style.ItemStyle; import com.github.abel533.echarts.style.TextStyle; import com.github.abel533.echarts.style.itemstyle.Normal; import com.njcn.common.pojo.dto.SimpleDTO; +import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.response.HttpResult; +import com.njcn.device.pms.api.MonitorClient; +import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient; +import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO; +import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; +import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.enums.DeviceResponseEnum; @@ -47,6 +53,7 @@ import com.njcn.influxdb.utils.InfluxDBCommUtils; import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.poi.util.PoiUtil; import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.enums.StatisticsEnum; import com.njcn.system.pojo.po.DictData; @@ -114,6 +121,10 @@ public class ReportServiceImpl implements ReportService { //调用暂降密度接口 private final EventAnalysisService eventAnalysisService; + private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient; + + private final MonitorClient monitorClient; + public List getED(DeviceInfoParam.BusinessParam businessParam) { List info = new ArrayList<>(); QueryResult queryResult = new QueryResult(); @@ -1053,7 +1064,6 @@ public class ReportServiceImpl implements ReportService { //influxdb查询结果(pqs_eventdetail表) List info = info(param); - //记录数 int i = 1; //1.监测点信息 @@ -1061,20 +1071,37 @@ public class ReportServiceImpl implements ReportService { createTitle(doc, "4." + i + " 监测点信息", "标题 2", 200, 15); XWPFTable table = createTable(doc); XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - HttpResult lineDetailData = lineFeignClient.getLineDetailData(exportParam.getLineId()); - if (ObjectUtil.isNull(lineDetailData)) { - throw new BusinessException(EventResponseEnum.NOT_FOUND); + if(exportParam.getType()==0){ + HttpResult lineDetailData = lineFeignClient.getLineDetailData(exportParam.getLineId()); + if (ObjectUtil.isNull(lineDetailData)) { + throw new BusinessException(EventResponseEnum.NOT_FOUND); + } + insertRow(doc, table, centerParagraph, true, "项目", "描述"); + insertRow(doc, table, centerParagraph, false, "监测点名称", lineDetailData.getData().getLineName()); + insertRow(doc, table, centerParagraph, false, "电压等级", lineDetailData.getData().getScale()); + insertRow(doc, table, centerParagraph, false, "PT变比", lineDetailData.getData().getPt()); + insertRow(doc, table, centerParagraph, false, "CT变比", lineDetailData.getData().getCt()); + insertRow(doc, table, centerParagraph, false, "协议容量", lineDetailData.getData().getDealCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "基准容量", lineDetailData.getData().getStandardCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "设备容量", lineDetailData.getData().getDevCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "最小短路容量", lineDetailData.getData().getShortCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "接线方式", lineDetailData.getData().getPtType()); + }else{ + HttpResult> monitorList = monitorClient.getMonitorList(Arrays.asList(exportParam.getLineId())); + if (ObjectUtil.isNull(monitorList)) { + throw new BusinessException(EventResponseEnum.NOT_FOUND); + } + insertRow(doc, table, centerParagraph, true, "项目", "描述"); + insertRow(doc, table, centerParagraph, false, "监测点名称", monitorList.getData().get(0).getName()); + insertRow(doc, table, centerParagraph, false, "电压等级", dicDataFeignClient.getDicDataById(monitorList.getData().get(0).getVoltageLevel()).getData().getName()); + insertRow(doc, table, centerParagraph, false, "PT变比", monitorList.getData().get(0).getPt1() + "/" + monitorList.getData().get(0).getPt2()); + insertRow(doc, table, centerParagraph, false, "CT变比", monitorList.getData().get(0).getCt1() + "/" + monitorList.getData().get(0).getCt2()); + insertRow(doc, table, centerParagraph, false, "协议容量", monitorList.getData().get(0).getUserAgreementCapacity() + ""); +// insertRow(doc, table, centerParagraph, false, "基准容量", monitorList.getData().get(0).getMinShortCircuitCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "设备容量", monitorList.getData().get(0).getPowerSupplyEqCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "最小短路容量", monitorList.getData().get(0).getMinShortCircuitCapacity() + ""); + insertRow(doc, table, centerParagraph, false, "接线方式",dicDataFeignClient.getDicDataById(monitorList.getData().get(0).getTerminalWiringMethod()).getData().getName() ); } - insertRow(doc, table, centerParagraph, true, "项目", "描述"); - insertRow(doc, table, centerParagraph, false, "监测点名称", lineDetailData.getData().getLineName()); - insertRow(doc, table, centerParagraph, false, "电压等级", lineDetailData.getData().getScale()); - insertRow(doc, table, centerParagraph, false, "PT变比", lineDetailData.getData().getPt()); - insertRow(doc, table, centerParagraph, false, "CT变比", lineDetailData.getData().getCt()); - insertRow(doc, table, centerParagraph, false, "协议容量", lineDetailData.getData().getDealCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "基准容量", lineDetailData.getData().getStandardCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "设备容量", lineDetailData.getData().getDevCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "最小短路容量", lineDetailData.getData().getShortCapacity() + ""); - insertRow(doc, table, centerParagraph, false, "接线方式", lineDetailData.getData().getPtType()); i++; } //2.暂降事件暂降事件列表和暂降点图 @@ -2441,8 +2468,8 @@ public class ReportServiceImpl implements ReportService { //事件统计表格(部门查询) List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaReportParam).getData(); - //测试id监测点id - //generalDeviceDTOList.get(9).getLineIndexes().add("97ec50b62c84d39d1e15d83e61e06844"); + //测试id + generalDeviceDTOList.get(9).getLineIndexes().add("97ec50b62c84d39d1e15d83e61e06844"); //这是总的监测点id List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); @@ -2468,9 +2495,10 @@ public class ReportServiceImpl implements ReportService { InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); //提前创建,不然获取不到(初始化数据) - List eventDetailList = getEventDetailListInfo(areaReportParam,lineIds); - //电压集合(统计类型:电压) - List voltageParamList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaParam).getData(); + List eventDetailList = getEventDetailListInfo(areaReportParam, lineIds); + List voltageParamList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaReportParam).getData(); + + // List eventDetailList=new ArrayList<>(); @@ -2535,7 +2563,7 @@ public class ReportServiceImpl implements ReportService { r.addBreak(); r.addBreak(); r.addBreak(); - r.setText(deptName+"供电公司"); + r.setText(deptName + "供电公司"); r.setBold(true);//设置为粗体 r.setFontSize(14);//字体大小 r.addBreak(); @@ -2586,7 +2614,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r5 = p.createRun();//创建段落文本 - r5.setText(" "+deptName+"电网总共有" + size + "个监测点。"+deptName+"电网在所选择时间段" + areaReportParam.getSearchBeginTime() + " 至 " + areaReportParam.getSearchEndTime() + + r5.setText(" " + deptName + "电网总共有" + size + "个监测点。" + deptName + "电网在所选择时间段" + areaReportParam.getSearchBeginTime() + " 至 " + areaReportParam.getSearchEndTime() + "累计监测到" + typeName + "事件" + eventCount + "条,本报告按照监测点分布," + typeName + "事件统计," + typeName + "事件点图," + typeName + "热力图," + typeName + "密度图," + typeName + "概率分布图,事件关联统计," + typeName + "类型统计," + typeName + "原因统计等方面进行数据分析。"); r5.setFontSize(11);//字体大小 @@ -2619,8 +2647,8 @@ public class ReportServiceImpl implements ReportService { //在线监测点数 - Integer onLineIdCount=0; - if(CollectionUtil.isNotEmpty(lineIds)){ + Integer onLineIdCount = 0; + if (CollectionUtil.isNotEmpty(lineIds)) { onLineIdCount = lineFeignClient.getOnLineCount(lineIds).getData(); } @@ -2648,7 +2676,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网总共有监测点" + size + "个。监测点在线率达到" + onlineRateResult + "%(通讯正常为:" + onLineIdCount + "个,通讯异常为:" + unLineCount + "个)" + + r12.setText(" " + deptName + "电网总共有监测点" + size + "个。监测点在线率达到" + onlineRateResult + "%(通讯正常为:" + onLineIdCount + "个,通讯异常为:" + unLineCount + "个)" + "[通讯正常/总监测点数(统计时候排除检修和热备用监测点)],具体见下图:"); r12.setFontSize(11);//字体大小 @@ -2664,7 +2692,7 @@ public class ReportServiceImpl implements ReportService { } //2.暂降事件三表季图像判断 - if (areaReportParam.isEventCountTable()||areaReportParam.isEventCountChart()) { + if (areaReportParam.isEventCountTable() || areaReportParam.isEventCountChart()) { //所有的表结果装入集合 Map areaCount = new HashMap<>(); @@ -2682,7 +2710,7 @@ public class ReportServiceImpl implements ReportService { //如果集合中有id将id进行拼接 if (CollectionUtil.isNotEmpty(lineIndexes)) { //总条数 - QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam,lineIndexes); + QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { areaCount.put(generalDeviceDTO.getName(), 0); @@ -2711,7 +2739,7 @@ public class ReportServiceImpl implements ReportService { if (CollectionUtil.isNotEmpty(lineIndexes)) { //总条数 - QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam,lineIndexes); + QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { voltageCount.put(generalDeviceDTO.getName(), 0); @@ -2735,7 +2763,6 @@ public class ReportServiceImpl implements ReportService { } - //根据月份来进行查看暂降 //提前创建对象 int dayOfMonth = 0; @@ -3068,7 +3095,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + "" + typeName + "事件居多," + + r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + "" + typeName + "事件居多," + "第" + dayOfMonth + "" + table + "" + typeName + "事件居多,具体见下表(图):"); r12.setFontSize(11);//字体大小 @@ -3087,7 +3114,6 @@ public class ReportServiceImpl implements ReportService { } - //第二张表 XWPFTable monitorInfo1 = createTable(doc); XWPFParagraph monitorInfoExcelParagraph1 = WordUtils.getCenterParagraph(doc); @@ -3099,7 +3125,6 @@ public class ReportServiceImpl implements ReportService { } - //第三张表 XWPFTable monitorInfo2 = createTable(doc); XWPFParagraph monitorInfoExcelParagraph2 = WordUtils.getCenterParagraph(doc); @@ -3135,7 +3160,7 @@ public class ReportServiceImpl implements ReportService { List xdata = new ArrayList<>(); List ydata = new ArrayList<>(); //根据区域名称进行匹配 - for (String name: areaCount.keySet()) { + for (String name : areaCount.keySet()) { //将监测点的数量拼接在部门下面 for (String s : lineCount.keySet()) { if (s.equals(name)) { @@ -3181,7 +3206,7 @@ public class ReportServiceImpl implements ReportService { List xdata3 = new ArrayList<>(); List ydata3 = new ArrayList<>(); //根据电压名称进行匹配 - for (String name: voltageCount.keySet()) { + for (String name : voltageCount.keySet()) { //将监测点的数量拼接在部门下面 for (String s : lineCount1.keySet()) { if (s.equals(name)) { @@ -3204,7 +3229,7 @@ public class ReportServiceImpl implements ReportService { } //3.密度图 - if(areaReportParam.isDensityTable()||areaReportParam.isDensityChart()){ + if (areaReportParam.isDensityTable() || areaReportParam.isDensityChart()) { //暂降密度图形 @@ -5182,42 +5207,42 @@ public class ReportServiceImpl implements ReportService { resultCount.put("count", count); } */ - int resultCount1 = 0; - List resultList = new ArrayList<>(); + int resultCount1 = 0; + List resultList = new ArrayList<>(); - List eventList = eventDetailList.stream().filter(e -> e.getEventassIndex() != "").collect(Collectors.toList()); - if(CollectionUtil.isNotEmpty(eventList)){ - //记录条数 - resultCount.put("count", eventList.size()); + List eventList = eventDetailList.stream().filter(e -> e.getEventassIndex() != "").collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(eventList)) { + //记录条数 + resultCount.put("count", eventList.size()); - //将时间数存入集合Map集合(主数据) - for (EventDetailNew detail : eventList) { - timeCount.put(detail.getEventassIndex(), detail.getTimeId()); - } + //将时间数存入集合Map集合(主数据) + for (EventDetailNew detail : eventList) { + timeCount.put(detail.getEventassIndex(), detail.getTimeId()); + } - //时间拼接 event_time=getEventassIndex - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(new ArrayList<>(timeCount.keySet()), "event_time"); - StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE). - append("event_time = '").append(stringBuilder).append("' "); + //时间拼接 event_time=getEventassIndex + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(new ArrayList<>(timeCount.keySet()), "event_time"); + StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE). + append("event_time = '").append(stringBuilder).append("' "); - //结果集 - QueryResult result1 = influxDbUtils.query(stringResult1.toString()); + //结果集 + QueryResult result1 = influxDbUtils.query(stringResult1.toString()); - //结果集映射到对象中 - List eventassList = influxDBResultMapper.toPOJO(result1, Eventass.class); + //结果集映射到对象中 + List eventassList = influxDBResultMapper.toPOJO(result1, Eventass.class); - for (Eventass eventass : eventassList) { - EventassCountParam eventassCountParam = new EventassCountParam(); - eventassCountParam.setAssTime(eventass.getTimeId().toString()); - //获取时间 - String eventTime = timeCount.get(eventass.getEventTime()); - eventassCountParam.setEventTime(eventTime); - eventassCountParam.setDescribe(eventass.getDescribe()); - resultList.add(eventassCountParam); - } - }else{ - resultCount.put("count", 0); - } + for (Eventass eventass : eventassList) { + EventassCountParam eventassCountParam = new EventassCountParam(); + eventassCountParam.setAssTime(eventass.getTimeId().toString()); + //获取时间 + String eventTime = timeCount.get(eventass.getEventTime()); + eventassCountParam.setEventTime(eventTime); + eventassCountParam.setDescribe(eventass.getDescribe()); + resultList.add(eventassCountParam); + } + } else { + resultCount.put("count", 0); + } /* @@ -5257,7 +5282,7 @@ public class ReportServiceImpl implements ReportService { p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 //归一化需要高级算法,先字符串代替 - r12.setText(" "+deptName+"电网在所选择的分析时间段内累计监测" + typeName + "记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:"); + r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:"); r12.setFontSize(11);//字体大小 @@ -5283,7 +5308,7 @@ public class ReportServiceImpl implements ReportService { } //9.暂降原因表和暂降原因图形生成 - if(areaReportParam.isEventReasonTable()||areaReportParam.isEventReasonChart()){ + if (areaReportParam.isEventReasonTable() || areaReportParam.isEventReasonChart()) { //查询字典表 List reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData(); @@ -5300,10 +5325,10 @@ public class ReportServiceImpl implements ReportService { //优化数据(根据暂降原因,进行分组统计有多少条数据,key:暂降原因id,value:次数) Map reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getEventReason, Collectors.counting())); //将数据重新整合为(key:暂降原因的名称,value:暂降原因测次数) - reasonMap.forEach((key,value)->{ - if(reasonMapCount.containsKey(key)){ + reasonMap.forEach((key, value) -> { + if (reasonMapCount.containsKey(key)) { resultMap.put(value, Math.toIntExact(reasonMapCount.get(key))); - }else{ + } else { resultMap.put(value, 0); } }); @@ -5327,7 +5352,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网在所选择的分析时间内暂态事件主要的暂态原因为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态原因为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); r12.setFontSize(11);//字体大小 @@ -5384,7 +5409,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网在所选择的分析时间内暂态事件主要的暂态原因为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态原因为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); r12.setFontSize(11);//字体大小 @@ -5416,7 +5441,7 @@ public class ReportServiceImpl implements ReportService { } //10.暂降类型表格 和 暂降类型图表 - if(areaReportParam.isEventTypeTable()||areaReportParam.isEventTypeChart()){ + if (areaReportParam.isEventTypeTable() || areaReportParam.isEventTypeChart()) { //查询字典表(暂降类型) List typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData(); @@ -5433,10 +5458,10 @@ public class ReportServiceImpl implements ReportService { //优化数据(根据暂降类型,进行分组统计有多少条数据,key:暂降类型id,value:次数) Map typeMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getEventType, Collectors.counting())); //将数据重新整合为(key:暂降类型的名称,value:暂降类型次数) - typeMap.forEach((key,value)->{ - if(typeMapCount.containsKey(key)){ + typeMap.forEach((key, value) -> { + if (typeMapCount.containsKey(key)) { resultMap.put(value, Math.toIntExact(typeMapCount.get(key))); - }else{ + } else { resultMap.put(value, 0); } }); @@ -5460,7 +5485,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网在所选择的分析时间内暂态事件主要的暂态类型为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态类型为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); r12.setFontSize(11);//字体大小 @@ -5518,7 +5543,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网在所选择的分析时间内暂态事件主要的暂态类型为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态类型为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); r12.setFontSize(11);//字体大小 createTitle(doc, "4." + oneCount + "." + twoCount + " 类型统计图", "标题 3", 400, 11); @@ -5557,7 +5582,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" "+deptName+"电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条,使用颜色将地图上按照" + typeName + "记录发生频率进行描绘,所形成的热力具体见下图:"); + r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条,使用颜色将地图上按照" + typeName + "记录发生频率进行描绘,所形成的热力具体见下图:"); r12.setFontSize(11);//字体大小 //所有的表结果装入集合 @@ -5624,7 +5649,7 @@ public class ReportServiceImpl implements ReportService { out.close();*/ //文件下载 ServletOutputStream outputStream = response.getOutputStream(); - String fileName = URLEncoder.encode(deptName+"热力图.docx", "UTF-8"); + String fileName = URLEncoder.encode(deptName + "热力图.docx", "UTF-8"); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); response.setContentType("application/octet-stream;charset=UTF-8"); doc.write(outputStream); @@ -5636,6 +5661,3217 @@ public class ReportServiceImpl implements ReportService { } + @Override + public void getPmsAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception { + //暂态事件 + if (areaReportParam.getWaveType().equals(0)) { + //设置类型变量名为暂态 + String typeName = "暂态"; + + PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); + pmsDeviceInfoParam.setDeptIndex(areaReportParam.getDeptIndex()); + //获取统计类型 + pmsDeviceInfoParam.setStatisticalType(areaReportParam.getStatisticalType()); + //获取主网台账信息 + List generalDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData(); + if(areaReportParam.getDeptIndex().equals("0d52f9f6e43ec0ee83013cd32da93f66")){ + //测试id + generalDeviceDTOList.get(0).getMonitorIdList().add("97ec50b62c84d39d1e15d83e61e06844"); + } + //这是总的监测点id + List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getMonitorIdList().stream()).collect(Collectors.toList()); + + + InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); + //提前创建,不然获取不到(初始化数据) + List eventDetailList = getEventDetailListInfo(areaReportParam, lineIds); + if(CollectionUtil.isEmpty(eventDetailList)){ + throw new BusinessException(CommonResponseEnum.NO_DATA); + } + + //电压集合(统计类型:电压)根据监测点数据进行电压分组 + List voltageParamList = new ArrayList<>(); + List data = monitorClient.getMonitorList(lineIds).getData(); + Map> voltageMap = data.stream().collect(Collectors.groupingBy(Monitor::getVoltageLevel)); + //获取电压字典 + List voltageData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); + PmsGeneralDeviceDTO deviceDTO; + for (DictData voltageDatum : voltageData) { + deviceDTO = new PmsGeneralDeviceDTO(); + if (voltageMap.containsKey(voltageDatum.getId())) { + deviceDTO.setIndex(voltageDatum.getId()); + deviceDTO.setName(voltageDatum.getName()); + //获取检测点id + List monitorIds = voltageMap.get(voltageDatum.getId()).stream().map(Monitor::getId).collect(Collectors.toList()); + deviceDTO.setMonitorIdList(monitorIds); + } else { + deviceDTO.setIndex(voltageDatum.getId()); + deviceDTO.setName(voltageDatum.getName()); + } + voltageParamList.add(deviceDTO); + } + + + //创建幅值计数器 + int oneCount2 = 0; + + //创建ITIC与F47计数器 + int oneCount3 = 0; + int twoCount5 = 0; + + //创建暂降密度表和密度图的计数器 + int oneCount4 = 0; + int twoCount1 = 0; + + //创建暂降事件表格和图的计数器 + int oneCount5 = 0; + int twoCount2 = 0; + + //创建暂态类型图和暂态类型表格计数器 + int oneCount6 = 0; + int twoCount3 = 0; + + //创建暂态原因图和暂态原因表格计数器 + int oneCount7 = 0; + int twoCount4 = 0; + + //提前创建计数(累计监测点数量) + Integer eventCount = 0; + //如果集合中有id将id进行拼接 + if (CollectionUtil.isNotEmpty(lineIds)) { + //获取累计监测点数量 + eventCount = eventDetailList.size(); + } + + + //准备word表中参数 + //获取监测点总数量 + int size = lineIds.size(); + //还有当前传入的部门名称(例如:中国)需要等邓哥的公共方法 + String deptName = deptFeignClient.getDeptById(areaReportParam.getDeptIndex()).getData().getName(); + + + /** + * =====================生成word=========================== + */ + //设置序号初始值 + int oneCount = 1; + + //创建word文档(poi生成word) + XWPFDocument doc = new XWPFDocument();// 创建Word文件 + XWPFParagraph p = doc.createParagraph();// 新建一个段落 + + // 设定标题格式,可以生成可点击的序号 + WordUtils.setHeadingStyle(doc); + + //设置对齐 + p.setAlignment(ParagraphAlignment.CENTER); + XWPFRun r = p.createRun();//创建段落文本 + r.addBreak(); + r.addBreak(); + r.addBreak(); + r.addBreak(); + r.addBreak(); + r.addBreak(); + r.setText(deptName + "供电公司"); + r.setBold(true);//设置为粗体 + r.setFontSize(14);//字体大小 + r.addBreak(); + + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.CENTER); + XWPFRun r1 = p.createRun();//创建段落文本 + r1.setText("电压" + typeName + "事件区域报告"); + r1.setBold(true);//设置为粗体 + r1.setFontSize(36);//字体大小 + r1.addBreak(); + r1.addBreak(); + r1.addBreak(); + r1.addBreak(); + r1.addBreak(); + r1.addBreak(); + r1.addBreak(); + + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.CENTER); + XWPFRun r2 = p.createRun();//创建段落文本 + //获取当前时间 + Date date = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy 年 MM 月 dd 日"); + String time = dateFormat.format(date); + + r2.setText("日期: " + time); + r2.setBold(true);//设置为粗体 + r2.setFontSize(14);//字体大小 + + r2.addBreak(); + r2.addBreak(); + r2.addBreak(); + + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.CENTER); + XWPFRun r3 = p.createRun();//创建段落文本 + r3.setText("电压" + typeName + "事件区域报告"); + r3.setFontSize(24);//字体大小 + + + createTitle(doc, "1. 引言", "标题 1", 0, 15); + + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r5 = p.createRun();//创建段落文本 + r5.setText(" " + deptName + "电网总共有" + size + "个监测点。" + deptName + "电网在所选择时间段" + areaReportParam.getSearchBeginTime() + " 至 " + areaReportParam.getSearchEndTime() + + "累计监测到" + typeName + "事件" + eventCount + "条,本报告按照监测点分布," + typeName + "事件统计," + typeName + "事件点图," + typeName + "热力图," + typeName + "密度图," + typeName + "概率分布图,事件关联统计," + typeName + "类型统计," + typeName + "原因统计等方面进行数据分析。"); + r5.setFontSize(11);//字体大小 + + + createTitle(doc, "2. 报告分析对象", "标题 1", 0, 15); + + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r7 = p.createRun();//创建段落文本 + r7.setText(" " + deptName + "。"); + r7.setFontSize(11);//字体大小 + + + createTitle(doc, "3. 报告分析时间", "标题 1", 0, 15); + + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r9 = p.createRun();//创建段落文本 + r9.setText(" " + areaReportParam.getSearchBeginTime() + " 至 " + areaReportParam.getSearchEndTime() + "。"); + r9.setFontSize(11);//字体大小 + + + createTitle(doc, "4. 汇总信息", "标题 1", 0, 15); + + //1.监测网分布 + if (areaReportParam.isMonitorDistributeChart()) { + //监测网分布 + + + //在线监测点数 + Integer onLineIdCount = 0; + if (CollectionUtil.isNotEmpty(lineIds)) { + //获取监测点状态运行 + DictData runState = dicDataFeignClient.getDicDataByName(DicDataEnum.RUN.getName()).getData(); + onLineIdCount = data.stream().filter(ol -> ol.getMonitorState().equals(runState.getId())).collect(Collectors.toList()).size(); + } + + //离线总监测点数 + Integer unLineCount = Integer.valueOf(lineIds.size()) - onLineIdCount; + //在线率 + Double onlineRate = (onLineIdCount.doubleValue()) / (Double.valueOf(String.valueOf(lineIds.size()))) * 100; + + NumberFormat nf = NumberFormat.getNumberInstance(); + // 保留两位小数 + nf.setMaximumFractionDigits(2); + // 如果不需要四舍五入 + nf.setRoundingMode(RoundingMode.UP); + + String onlineRateResult = nf.format(onlineRate); + + + /** + * =========================续写word文档============================================== + */ + + + createTitle(doc, "4." + oneCount + " 监测网分布", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网总共有监测点" + size + "个。监测点在线率达到" + onlineRateResult + "%(通讯正常为:" + onLineIdCount + "个,通讯异常为:" + unLineCount + "个)" + + "[通讯正常/总监测点数(统计时候排除检修和热备用监测点)],具体见下图:"); + r12.setFontSize(11);//字体大小 + + + //todo 分布地图代码未实现 + + //序号计数进行++ + oneCount++; + + /** + * =======================================word结束========================================= + */ + } + + //2.暂降事件三表季图像判断 + if (areaReportParam.isEventCountTable() || areaReportParam.isEventCountChart()) { + + //所有的表结果装入集合 + Map areaCount = new HashMap<>(); + Map voltageCount = new HashMap<>(); + //暂降事件最多的两个电压 + Set topVoltage = new HashSet<>(); + + //1.部门信息。传入参数(判断统计类型) + if (Objects.nonNull(areaReportParam.getStatisticalType().getCode()) && areaReportParam.getStatisticalType().getCode().equals("Power_Network")) { + //进行遍历集合获得子区域名及其所有监测点id + for (PmsGeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { + + //当前子部门下所有id + List lineIndexes = generalDeviceDTO.getMonitorIdList(); + //如果集合中有id将id进行拼接 + if (CollectionUtil.isNotEmpty(lineIndexes)) { + //总条数 + QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); + + if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { + areaCount.put(generalDeviceDTO.getName(), 0); + + } else { + double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); + + areaCount.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); + } + + } else { + //为空put 0 + areaCount.put(generalDeviceDTO.getName(), 0); + } + } + + //2.电压集合(统计类型:电压) + List areaParamList = voltageParamList; + //进行遍历集合获得子区域名及其所有监测点id + for (PmsGeneralDeviceDTO generalDeviceDTO : areaParamList) { + + //当前子部门下所有id + List lineIndexes = generalDeviceDTO.getMonitorIdList(); + + //如果集合中有id将id进行拼接 + if (CollectionUtil.isNotEmpty(lineIndexes)) { + + //总条数 + QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); + + if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { + voltageCount.put(generalDeviceDTO.getName(), 0); + + } else { + double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); + + voltageCount.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); + } + + } else { + //为空put 0 + voltageCount.put(generalDeviceDTO.getName(), 0); + } + } + //数据排序 + Map linkMap = getSort(voltageCount); + //最多暂降事件的两个电压名称 + topVoltage = linkMap.keySet(); + + } + + + //根据月份来进行查看暂降 + //提前创建对象 + int dayOfMonth = 0; + //最后集合 + List timeSVoList = new ArrayList<>(); + //表格参数 + String table = ""; + + //月 + if ("3".equals(areaReportParam.getInterval())) { + table = "月份"; + + List dayCount = new ArrayList<>(); + List timeList = new ArrayList<>(); + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM"); + //进行for循环获取所有事件的时间 + for (EventDetailNew eventDetail : eventDetailList) { + //获取暂降事件时间 + /* String timeId = eventDetail.getTimeId(); + Date date1 = DateUtil.parse(timeId); + int day = Integer.parseInt(String.format("%td",date1));*/ + + dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getTimeId()), fmt)); + + //创建对象 + AreaEventMonthParam timeParam = new AreaEventMonthParam(); + timeParam.setDayOrMonth(DateUtil.format(DateUtil.parse(eventDetail.getTimeId()), fmt)); + timeParam.setEventAssIndex(eventDetail.getEventassIndex()); + timeList.add(timeParam); + } + + //Map集和 + Map> relevanceMap = new HashMap<>(); + List list = new ArrayList<>(); + + for (AreaEventMonthParam areaEventMonthParam : timeList) { + //如果存在 + if (relevanceMap.containsKey(areaEventMonthParam.getDayOrMonth())) { + list = relevanceMap.get(areaEventMonthParam.getDayOrMonth()); + list.add(areaEventMonthParam.getEventAssIndex()); + relevanceMap.put(areaEventMonthParam.getDayOrMonth(), (list)); + } else { + List list1 = new ArrayList<>(); + list1.add(areaEventMonthParam.getEventAssIndex()); + relevanceMap.put(areaEventMonthParam.getDayOrMonth(), (list1)); + } + } + //创建map集和装当天和次数 + Map resultMap = new HashMap<>(); + for (String day : dayCount) { + if (resultMap.containsKey(day)) { + resultMap.put(day, resultMap.get(day) + 1); + } else { + resultMap.put(day, 1); + } + } + + Map relevanceCountMap = new HashMap<>(); + + for (String key : relevanceMap.keySet()) { + List list1 = relevanceMap.get(key).stream().filter(s -> s != "").collect(Collectors.toList()); + //如果集合中有id将id进行拼接 + if (CollectionUtil.isNotEmpty(list1)) { + + StringBuilder stringBuilder = new StringBuilder("("); + + for (int i = 0; i < list1.size(); ++i) { + if (list1.size() - i != 1) { + stringBuilder.append("event_time ='").append((String) list1.get(i)).append("' or "); + } else { + stringBuilder.append("event_time ='").append((String) list1.get(i)).append("') "); + } + } + + + //查询sql语句总条数 + StringBuilder stringTotal = new StringBuilder("SELECT COUNT(*) as aa FROM ").append("pqs_eventass").append(" WHERE ") + .append(stringBuilder); + //总条数 + QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); + + //返回的结果 + if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) { + long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); + + if (relevanceCountMap.containsKey(key)) { + relevanceCountMap.put(key, relevanceCountMap.get(key) + (int) count); + } else { + relevanceCountMap.put(key, (int) count); + } + + + } + } + } + //开始时间 + LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime()); + LocalDate end = LocalDate.parse(areaReportParam.getSearchEndTime()); + //因为是比较月份,将起始时间的天数加给结束时间,不然while一直不能结束循环 + + String substring1 = end.toString().substring(0, 8); + String substring2 = beginTime.toString().substring(8, 10); + + String s1 = substring1 + substring2; + LocalDate endTime = LocalDate.parse(s1); + Set keySet = resultMap.keySet(); + + while (!beginTime.equals(endTime.plus(1, ChronoUnit.MONTHS))) { + if (keySet.contains(beginTime.toString().substring(0, 7))) { + Integer countSize = resultMap.get(beginTime.toString().substring(0, 7)); + TimeSVO timeVO = new TimeSVO(); + timeVO.setTimes(countSize.toString()); + timeVO.setYear(String.valueOf(beginTime.getYear())); + + //todo 不知道代码是否是写错了,时间判断有问题 +// if (beginTime.getDayOfMonth() < 10) { + if (beginTime.getMonthValue() < 10) { + timeVO.setMonth("0" + beginTime.getMonthValue() + ""); + } else { + timeVO.setMonth(beginTime.getMonthValue() + ""); + } + + timeVO.setFulltime(beginTime.toString().substring(0, 7)); + + //遍历 如果时间相同,将所有关联处理事件次数赋值上去 + for (String s : relevanceCountMap.keySet()) { + if (beginTime.toString().substring(0, 7).equals(s)) { + timeVO.setEventAssIndex(relevanceCountMap.get(s)); + } + } + timeSVoList.add(timeVO); + } else { + TimeSVO timeVO = new TimeSVO(); + timeVO.setTimes("0"); + timeVO.setYear(String.valueOf(beginTime.getYear())); + + //todo 未知问题:是否是代码错误 + if (beginTime.getMonthValue() < 10) { + timeVO.setMonth("0" + beginTime.getMonthValue() + ""); + } else { + timeVO.setMonth(beginTime.getMonthValue() + ""); + } + timeVO.setFulltime(beginTime.toString().substring(0, 7)); + timeSVoList.add(timeVO); + } + + beginTime = beginTime.plus(1, ChronoUnit.MONTHS); + } + + //数据排序 + Map linkMap = getSort(resultMap); + //暂降次数最多 + List collect = linkMap.keySet().stream().collect(Collectors.toList()); + //赋值 + dayOfMonth = Integer.parseInt(collect.get(0).substring(5, 7)); + } else { + table = "天数"; + + List dayCount = new ArrayList<>(); + List timeList = new ArrayList<>(); + + //进行for循环获取所有事件的时间 + for (EventDetailNew eventDetail : eventDetailList) { + //获取暂降事件时间 + /* String timeId = eventDetail.getTimeId(); + Date date1 = DateUtil.parse(timeId); + int day = Integer.parseInt(String.format("%td",date1));*/ + dayCount.add(DateUtil.formatDate(DateUtil.parse(eventDetail.getTimeId()))); + + //创建对象 + AreaEventMonthParam timeParam = new AreaEventMonthParam(); + timeParam.setDayOrMonth(DateUtil.formatDate(DateUtil.parse(eventDetail.getTimeId()))); + timeParam.setEventAssIndex(eventDetail.getEventassIndex()); + timeList.add(timeParam); + } + + //Map集和 + Map> relevanceMap = new HashMap<>(); + List list = new ArrayList<>(); + + for (AreaEventMonthParam areaEventMonthParam : timeList) { + //如果存在 + if (relevanceMap.containsKey(areaEventMonthParam.getDayOrMonth())) { + list = relevanceMap.get(areaEventMonthParam.getDayOrMonth()); + list.add(areaEventMonthParam.getEventAssIndex()); + relevanceMap.put(areaEventMonthParam.getDayOrMonth(), (list)); + } else { + List list1 = new ArrayList<>(); + list1.add(areaEventMonthParam.getEventAssIndex()); + relevanceMap.put(areaEventMonthParam.getDayOrMonth(), (list1)); + } + } + //创建map集和装当天和次数 + Map resultMap = new HashMap<>(); + for (String day : dayCount) { + if (resultMap.containsKey(day)) { + resultMap.put(day, resultMap.get(day) + 1); + } else { + resultMap.put(day, 1); + } + } + + Map relevanceCountMap = new HashMap<>(); + + for (String key : relevanceMap.keySet()) { + List list1 = relevanceMap.get(key).stream().filter(s -> s != "").collect(Collectors.toList()); + //如果集合中有id将id进行拼接 + if (CollectionUtil.isNotEmpty(list1)) { + + StringBuilder stringBuilder = new StringBuilder("("); + + for (int i = 0; i < list1.size(); ++i) { + if (list1.size() - i != 1) { + stringBuilder.append("event_time ='").append((String) list1.get(i)).append("' or "); + } else { + stringBuilder.append("event_time ='").append((String) list1.get(i)).append("') "); + } + } + + + //查询sql语句总条数 + StringBuilder stringTotal = new StringBuilder("SELECT COUNT(*) as aa FROM ").append("pqs_eventass").append(" WHERE ") + .append(stringBuilder); + //总条数 + QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); + + //返回的结果 + if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) { + long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); + + if (relevanceCountMap.containsKey(key)) { + relevanceCountMap.put(key, relevanceCountMap.get(key) + (int) count); + } else { + relevanceCountMap.put(key, (int) count); + } + + + } + } + } + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + //开始时间 + LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime(), fmt); + LocalDate endTime = LocalDate.parse(areaReportParam.getSearchEndTime(), fmt); + + Set keySet = resultMap.keySet(); + + while (!beginTime.equals(endTime.plus(1, ChronoUnit.DAYS))) { + if (keySet.contains(beginTime.toString())) { + + //获取暂降次数 + Integer countSize = resultMap.get(beginTime.toString()); + TimeSVO timeVO = new TimeSVO(); + timeVO.setTimes(countSize.toString()); + + if (beginTime.getDayOfMonth() < 10) { + timeVO.setDay("0" + beginTime.getDayOfMonth() + ""); + } else { + timeVO.setDay(beginTime.getDayOfMonth() + ""); + } + + timeVO.setYear(String.valueOf(beginTime.getYear())); + //todo 不知道代码是否是写错了,时间判断有问题 + if (beginTime.getMonthValue() < 10) { + timeVO.setMonth("0" + beginTime.getMonthValue() + ""); + } else { + timeVO.setMonth(beginTime.getMonthValue() + ""); + } + timeVO.setFulltime(beginTime.toString()); + + //遍历 如果时间相同,将所有关联处理事件次数赋值上去 + for (String s : relevanceCountMap.keySet()) { + if (beginTime.toString().equals(s)) { + timeVO.setEventAssIndex(relevanceCountMap.get(s)); + } + } + timeSVoList.add(timeVO); + } else { + TimeSVO timeVO = new TimeSVO(); + timeVO.setTimes("0"); + if (beginTime.getDayOfMonth() < 10) { + timeVO.setDay("0" + beginTime.getDayOfMonth() + ""); + } else { + timeVO.setDay(beginTime.getDayOfMonth() + ""); + } + timeVO.setYear(String.valueOf(beginTime.getYear())); + + //todo 未知问题:是否是代码错误 + if (beginTime.getMonthValue() < 10) { + timeVO.setMonth("0" + beginTime.getMonthValue() + ""); + } else { + timeVO.setMonth(beginTime.getMonthValue() + ""); + } + timeVO.setFulltime(beginTime.toString()); + timeSVoList.add(timeVO); + } + + beginTime = beginTime.plus(1, ChronoUnit.DAYS); + } + + //数据排序 + Map linkMap = getSort(resultMap); + //暂降次数最多 + List collect = linkMap.keySet().stream().collect(Collectors.toList()); + + //赋值 + dayOfMonth = LocalDate.parse(collect.get(0)).getDayOfMonth(); + + } + + //最高暂降事件的两个电压值 +// System.out.println(topVoltage); + //转为List + List topVoltageList = new ArrayList<>(); + for (String s : topVoltage) { + topVoltageList.add(s); + } + //表格 + if (areaReportParam.isEventCountTable()) { + + //创建表题计数 + int twoCount = 1; + + //与暂降事件图形共享序号 + oneCount5 = oneCount; + + + createTitle(doc, "4." + oneCount + " " + typeName + "事件列表", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + "" + typeName + "事件居多," + + "第" + dayOfMonth + "" + table + "" + typeName + "事件居多,具体见下表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "事件表格", "标题 3", 400, 11); + twoCount2 = twoCount; + + //第一张表 + XWPFTable monitorInfo = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); + // 表格第一行 + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "区域", "电压" + typeName + "次数"); + //塞入数据 + for (String s : areaCount.keySet()) { + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, false, s, areaCount.get(s).toString()); + } + + + //第二张表 + XWPFTable monitorInfo1 = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph1 = WordUtils.getCenterParagraph(doc); + // 表格第一行 + insertRow(doc, monitorInfo1, monitorInfoExcelParagraph1, true, "电压等级", "电压" + typeName + "次数"); + //塞入数据 + for (String s : voltageCount.keySet()) { + insertRow(doc, monitorInfo1, monitorInfoExcelParagraph1, false, s, voltageCount.get(s).toString()); + } + + + //第三张表 + XWPFTable monitorInfo2 = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph2 = WordUtils.getCenterParagraph(doc); + // 表格第一行 + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, true, "" + table + "", "电压" + typeName + "次数"); + //塞入数据 + for (int i = 0; i < timeSVoList.size(); i++) { + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, false, timeSVoList.get(i).getFulltime(), timeSVoList.get(i).getTimes()); + } + + //序号计数进行++ + oneCount++; + + /** + * =======================================word结束========================================= + */ + + } + + //图形 + if (areaReportParam.isEventCountChart()) { + twoCount2++; + createTitle(doc, "4." + oneCount5 + "." + twoCount2 + " " + typeName + "事件图形", "标题 3", 400, 11); + + + //创建部门与监测点次数的map集合 + Map lineCount = new HashMap<>(); + for (PmsGeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { + lineCount.put(generalDeviceDTO.getName(), generalDeviceDTO.getMonitorIdList().size()); + } + + //创建x,y参数 + List xdata = new ArrayList<>(); + List ydata = new ArrayList<>(); + //根据区域名称进行匹配 + for (String name : areaCount.keySet()) { + //将监测点的数量拼接在部门下面 + for (String s : lineCount.keySet()) { + if (s.equals(name)) { + xdata.add(name + "\n" + "(" + lineCount.get(s) + ")"); + } + } + + ydata.add(areaCount.get(name)); + } + + String qytj = getQYTJ(xdata, ydata); + createPic(doc, qytj, "" + typeName + "事件图形"); + + + //月份统计 + //创建x,y参数 + List xdata1 = new ArrayList<>(); + List ydata1 = new ArrayList<>(); + List ydata2 = new ArrayList<>(); + for (TimeSVO timeSVO : timeSVoList) { + xdata1.add(timeSVO.getFulltime()); + ydata1.add(Integer.parseInt(timeSVO.getTimes())); + ydata2.add(timeSVO.getEventAssIndex()); + + } + + + String year = areaReportParam.getSearchBeginTime().substring(0, 4); + List tableList = new ArrayList<>(); + tableList.add(table); + + String yftj = getYFTJ1(xdata1, ydata1, ydata2, year, tableList); + createPic(doc, yftj, "" + typeName + "事件图形"); + + + //创建电压uiiiuuuu与监测点次数的map集合 + List areaParamList = voltageParamList; + Map lineCount1 = new HashMap<>(); + for (PmsGeneralDeviceDTO generalDeviceDTO : areaParamList) { + lineCount1.put(generalDeviceDTO.getName(), generalDeviceDTO.getMonitorIdList().size()); + } + //创建x,y参数 + List xdata3 = new ArrayList<>(); + List ydata3 = new ArrayList<>(); + //根据电压名称进行匹配 + for (String name : voltageCount.keySet()) { + //将监测点的数量拼接在部门下面 + for (String s : lineCount1.keySet()) { + if (s.equals(name)) { + xdata3.add(name + "\n" + "(" + lineCount1.get(s) + ")"); + } + } + ydata3.add(voltageCount.get(name)); + } + + String dydj = getDYDJ(xdata3, ydata3); + createPic(doc, dydj, "" + typeName + "事件图形"); + + + /** + * =======================================word结束========================================= + */ + } + + + } + + //3.密度图 + if (areaReportParam.isDensityTable() || areaReportParam.isDensityChart()) { + + //暂降密度图形 + + AreaTableParam areaTableParam = new AreaTableParam(); + + //监测点id拼接 + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); + areaTableParam.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam.setStringBuilder(stringBuilder); + + + //创建结果集合 +// List info = TableInfo(areaTableParam); + List info = eventDetailList; + + //将sql结果集放入,共用一个sql,减少查询时间 + AreaTableParam areaTableParam1 = new AreaTableParam(); + areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam1.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam1.setStringBuilder(stringBuilder); + areaTableParam1.setInfo(info); + + + List iEC28VOResult = IEC28Area(areaTableParam1); + List iEC411VOResult = IEC411Area(areaTableParam1); + List dISDIPVOResult = eventDisdipArea(areaTableParam1); + + + //IEC411 <1% 总共集合 + List lessOneIEC411 = new ArrayList<>(); + //IEC411 1~40% 总共集合 + List lessFortyIEC411 = new ArrayList<>(); + //IEC411 40~70% 总共集合 + List lessSeventyIEC411 = new ArrayList<>(); + + + //IEC28 <1% 总共集合 + List lessOneIEC28 = new ArrayList<>(); + //IEC411 <10 总共集合 + List lessTenIEC28 = new ArrayList<>(); + //IEC411 <20 总共集合 + List lessTwentyIEC28 = new ArrayList<>(); + //IEC411 <30 总共集合 + List lessThirtyIEC28 = new ArrayList<>(); + //IEC411 <40 总共集合 + List lessFortyIEC28 = new ArrayList<>(); + //IEC411 <50 总共集合 + List lessFiftyIEC28 = new ArrayList<>(); + //IEC411 <60 总共集合 + List lessSixtyIEC28 = new ArrayList<>(); + //IEC411 <70 总共集合 + List lessSeventyIEC28 = new ArrayList<>(); + //IEC411 <80 总共集合 + List lessEightyIEC28 = new ArrayList<>(); + //IEC411 <90 总共集合 + List lessNinetyIEC28 = new ArrayList<>(); + //IEC411 <120 总共集合 + List lessHundredTwentyIEC28 = new ArrayList<>(); + //IEC411 <130 总共集合 + List lessHundredThirtyIEC28 = new ArrayList<>(); + //IEC411 <140 总共集合 + List lessHundredFortyIEC28 = new ArrayList<>(); + //IEC411 <150 总共集合 + List lessHundredFiftyIEC28 = new ArrayList<>(); + //IEC411 <160 总共集合 + List lessHundredSixtyIEC28 = new ArrayList<>(); + //IEC411 <170 总共集合 + List lessHundredSeventyIEC28 = new ArrayList<>(); + //IEC411 <180 总共集合 + List lessHundredEightyIEC28 = new ArrayList<>(); + + + //DISDIP = 10% + List equalTenDISDIP = new ArrayList<>(); + //DISDIP = 40% + List equalFortyDISDIP = new ArrayList<>(); + //DISDIP = 70% + List equalSeventyDISDIP = new ArrayList<>(); + //DISDIP = 85% + List equalEightyFiveDISDIP = new ArrayList<>(); + //DISDIP = 90% + List equalNinetyDISDIP = new ArrayList<>(); + + + //遍历将集合按名称分开 + for (int i1 = 0; i1 < iEC411VOResult.size(); i1++) { + if ("<1%".equals(iEC411VOResult.get(i1).getName())) { + //放入集合 + lessOneIEC411.add(iEC411VOResult.get(i1)); + } else if ("1~40%".equals(iEC411VOResult.get(i1).getName())) { + //放入集合 + lessFortyIEC411.add(iEC411VOResult.get(i1)); + } else { + //放入集合 + lessSeventyIEC411.add(iEC411VOResult.get(i1)); + } + } + + + //遍历将集合按名称分开 + for (int i1 = 0; i1 < iEC28VOResult.size(); i1++) { + if ("1>U>=0".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessOneIEC28.add(iEC28VOResult.get(i1)); + } else if ("10>U>=1".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessTenIEC28.add(iEC28VOResult.get(i1)); + } else if ("20>U>=10".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessTwentyIEC28.add(iEC28VOResult.get(i1)); + } else if ("30>U>=20".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessThirtyIEC28.add(iEC28VOResult.get(i1)); + } else if ("40>U>=30".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessFortyIEC28.add(iEC28VOResult.get(i1)); + } else if ("50>U>=40".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessFiftyIEC28.add(iEC28VOResult.get(i1)); + } else if ("60>U>=50".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessSixtyIEC28.add(iEC28VOResult.get(i1)); + } else if ("70>U>=60".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessSeventyIEC28.add(iEC28VOResult.get(i1)); + } else if ("80>U>=70".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessEightyIEC28.add(iEC28VOResult.get(i1)); + } else if ("90>U>=80".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessNinetyIEC28.add(iEC28VOResult.get(i1)); + } else if ("120>U>=110".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessHundredTwentyIEC28.add(iEC28VOResult.get(i1)); + } else if ("130>U>=120".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessHundredThirtyIEC28.add(iEC28VOResult.get(i1)); + } else if ("140>U>=130".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessHundredFortyIEC28.add(iEC28VOResult.get(i1)); + } else if ("150>U>=140".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessHundredFiftyIEC28.add(iEC28VOResult.get(i1)); + } else if ("160>U>=150".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessHundredSixtyIEC28.add(iEC28VOResult.get(i1)); + } else if ("170>U>=160".equals(iEC28VOResult.get(i1).getName())) { + //放入集合 + lessHundredSeventyIEC28.add(iEC28VOResult.get(i1)); + } else { + //放入集合 + lessHundredEightyIEC28.add(iEC28VOResult.get(i1)); + + } + } + + //遍历将集合按名称分开 + for (int i1 = 0; i1 < dISDIPVOResult.size(); i1++) { + if ("10%".equals(dISDIPVOResult.get(i1).getName())) { + //放入集合 + equalTenDISDIP.add(dISDIPVOResult.get(i1)); + } else if ("40%".equals(dISDIPVOResult.get(i1).getName())) { + //放入集合 + equalFortyDISDIP.add(dISDIPVOResult.get(i1)); + } else if ("70%".equals(dISDIPVOResult.get(i1).getName())) { + //放入集合 + equalSeventyDISDIP.add(dISDIPVOResult.get(i1)); + } else if ("85%".equals(dISDIPVOResult.get(i1).getName())) { + //放入集合 + equalEightyFiveDISDIP.add(dISDIPVOResult.get(i1)); + } else { + //放入集合 + equalNinetyDISDIP.add(dISDIPVOResult.get(i1)); + } + } + + + //遍历集合中的参数 + IEC411CountParam iec411LessOne = new IEC411CountParam(); + + for (IEC411VO iec411VO : lessOneIEC411) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec411LessOne.getName())) { + iec411LessOne.setName(iec411VO.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec411VO.getTenTwentyMs())) { + int tenToTwenty = iec411LessOne.getTenToTwenty(); + iec411LessOne.setTenToTwenty(tenToTwenty++); + } + if (!"0".equals(iec411VO.getTwentyOneHundredMs())) { + int twentyToHundred = iec411LessOne.getTwentyToHundred(); + iec411LessOne.setTenToTwenty(twentyToHundred++); + } + if (!"0".equals(iec411VO.getZeroPiontOneTwoS())) { + int zeroOneToZeroTwo = iec411LessOne.getZeroOneToZeroTwo(); + iec411LessOne.setTenToTwenty(zeroOneToZeroTwo++); + } + if (!"0".equals(iec411VO.getZeroPiontTwoFiveS())) { + int zeroTwoToZeroFive = iec411LessOne.getZeroTwoToZeroFive(); + iec411LessOne.setTenToTwenty(zeroTwoToZeroFive++); + } + if (!"0".equals(iec411VO.getZeroPiontFive1S())) { + int zeroFiveToOne = iec411LessOne.getZeroFiveToOne(); + iec411LessOne.setTenToTwenty(zeroFiveToOne++); + } + if (!"0".equals(iec411VO.getGreater1S())) { + int lessOne = iec411LessOne.getLessOne(); + iec411LessOne.setTenToTwenty(lessOne++); + } + } + + //遍历集合中的参数 + IEC411CountParam iec411LessForty = new IEC411CountParam(); + + for (IEC411VO iec411VO : lessFortyIEC411) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec411LessForty.getName())) { + iec411LessForty.setName(iec411VO.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec411VO.getTenTwentyMs())) { + int tenToTwenty = iec411LessForty.getTenToTwenty(); + iec411LessForty.setTenToTwenty(tenToTwenty++); + } + if (!"0".equals(iec411VO.getTwentyOneHundredMs())) { + int twentyToHundred = iec411LessForty.getTwentyToHundred(); + iec411LessForty.setTenToTwenty(twentyToHundred++); + } + if (!"0".equals(iec411VO.getZeroPiontOneTwoS())) { + int zeroOneToZeroTwo = iec411LessForty.getZeroOneToZeroTwo(); + iec411LessForty.setTenToTwenty(zeroOneToZeroTwo++); + } + if (!"0".equals(iec411VO.getZeroPiontTwoFiveS())) { + int zeroTwoToZeroFive = iec411LessForty.getZeroTwoToZeroFive(); + iec411LessForty.setTenToTwenty(zeroTwoToZeroFive++); + } + if (!"0".equals(iec411VO.getZeroPiontFive1S())) { + int zeroFiveToOne = iec411LessForty.getZeroFiveToOne(); + iec411LessForty.setTenToTwenty(zeroFiveToOne++); + } + if (!"0".equals(iec411VO.getGreater1S())) { + int lessOne = iec411LessForty.getLessOne(); + iec411LessForty.setTenToTwenty(lessOne++); + } + } + + //遍历集合中的参数 + IEC411CountParam iec411LessSeventy = new IEC411CountParam(); + + for (IEC411VO iec411VO : lessSeventyIEC411) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec411LessSeventy.getName())) { + iec411LessSeventy.setName(iec411VO.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec411VO.getTenTwentyMs())) { + int tenToTwenty = iec411LessSeventy.getTenToTwenty(); + iec411LessSeventy.setTenToTwenty(tenToTwenty++); + } + if (!"0".equals(iec411VO.getTwentyOneHundredMs())) { + int twentyToHundred = iec411LessSeventy.getTwentyToHundred(); + iec411LessSeventy.setTenToTwenty(twentyToHundred++); + } + if (!"0".equals(iec411VO.getZeroPiontOneTwoS())) { + int zeroOneToZeroTwo = iec411LessSeventy.getZeroOneToZeroTwo(); + iec411LessSeventy.setTenToTwenty(zeroOneToZeroTwo++); + } + if (!"0".equals(iec411VO.getZeroPiontTwoFiveS())) { + int zeroTwoToZeroFive = iec411LessSeventy.getZeroTwoToZeroFive(); + iec411LessSeventy.setTenToTwenty(zeroTwoToZeroFive++); + } + if (!"0".equals(iec411VO.getZeroPiontFive1S())) { + int zeroFiveToOne = iec411LessSeventy.getZeroFiveToOne(); + iec411LessSeventy.setTenToTwenty(zeroFiveToOne++); + } + if (!"0".equals(iec411VO.getGreater1S())) { + int lessOne = iec411LessSeventy.getLessOne(); + iec411LessSeventy.setTenToTwenty(lessOne++); + } + } + + /** + * ================第一张表结束====================== + */ + + DISDIPCountParam disdipEqualTen = new DISDIPCountParam(); + + for (DISDIPVO disdipvo : equalTenDISDIP) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(disdipEqualTen.getName())) { + disdipEqualTen.setName(disdipvo.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(disdipvo.getTwentyMs())) { + int twenty = disdipEqualTen.getTwenty(); + disdipEqualTen.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getOneHundredMs())) { + int oneHundredMS = disdipEqualTen.getOneHundredMS(); + disdipEqualTen.setOneHundredMS(oneHundredMS++); + } + if (!"0".equals(disdipvo.getFiveHundredMs())) { + int fiveHundredMS = disdipEqualTen.getFiveHundredMS(); + disdipEqualTen.setOneHundredMS(fiveHundredMS++); + } + if (!"0".equals(disdipvo.getOneS())) { + int one = disdipEqualTen.getOne(); + disdipEqualTen.setOne(one++); + } + if (!"0".equals(disdipvo.getThreeS())) { + int three = disdipEqualTen.getThree(); + disdipEqualTen.setOne(three++); + } + if (!"0".equals(disdipvo.getTwentyS())) { + int twenty = disdipEqualTen.getTwenty(); + disdipEqualTen.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getSixtyS())) { + int sixty = disdipEqualTen.getSixty(); + disdipEqualTen.setSixty(sixty++); + } + if (!"0".equals(disdipvo.getOneEightyS())) { + int oneHundredAndEighty = disdipEqualTen.getOneHundredAndEighty(); + disdipEqualTen.setOneHundredAndEighty(oneHundredAndEighty++); + } + } + + DISDIPCountParam disdipEqualForty = new DISDIPCountParam(); + + for (DISDIPVO disdipvo : equalFortyDISDIP) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(disdipEqualForty.getName())) { + disdipEqualForty.setName(disdipvo.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(disdipvo.getTwentyMs())) { + int twenty = disdipEqualForty.getTwenty(); + disdipEqualForty.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getOneHundredMs())) { + int oneHundredMS = disdipEqualForty.getOneHundredMS(); + disdipEqualForty.setOneHundredMS(oneHundredMS++); + } + if (!"0".equals(disdipvo.getFiveHundredMs())) { + int fiveHundredMS = disdipEqualForty.getFiveHundredMS(); + disdipEqualForty.setOneHundredMS(fiveHundredMS++); + } + if (!"0".equals(disdipvo.getOneS())) { + int one = disdipEqualForty.getOne(); + disdipEqualForty.setOne(one++); + } + if (!"0".equals(disdipvo.getThreeS())) { + int three = disdipEqualForty.getThree(); + disdipEqualForty.setOne(three++); + } + if (!"0".equals(disdipvo.getTwentyS())) { + int twenty = disdipEqualForty.getTwenty(); + disdipEqualForty.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getSixtyS())) { + int sixty = disdipEqualForty.getSixty(); + disdipEqualForty.setSixty(sixty++); + } + if (!"0".equals(disdipvo.getOneEightyS())) { + int oneHundredAndEighty = disdipEqualForty.getOneHundredAndEighty(); + disdipEqualForty.setOneHundredAndEighty(oneHundredAndEighty++); + } + } + + DISDIPCountParam disdipEqualSeventy = new DISDIPCountParam(); + + for (DISDIPVO disdipvo : equalSeventyDISDIP) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(disdipEqualSeventy.getName())) { + disdipEqualSeventy.setName(disdipvo.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(disdipvo.getTwentyMs())) { + int twenty = disdipEqualSeventy.getTwenty(); + disdipEqualSeventy.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getOneHundredMs())) { + int oneHundredMS = disdipEqualSeventy.getOneHundredMS(); + disdipEqualSeventy.setOneHundredMS(oneHundredMS++); + } + if (!"0".equals(disdipvo.getFiveHundredMs())) { + int fiveHundredMS = disdipEqualSeventy.getFiveHundredMS(); + disdipEqualSeventy.setOneHundredMS(fiveHundredMS++); + } + if (!"0".equals(disdipvo.getOneS())) { + int one = disdipEqualSeventy.getOne(); + disdipEqualSeventy.setOne(one++); + } + if (!"0".equals(disdipvo.getThreeS())) { + int three = disdipEqualSeventy.getThree(); + disdipEqualSeventy.setOne(three++); + } + if (!"0".equals(disdipvo.getTwentyS())) { + int twenty = disdipEqualSeventy.getTwenty(); + disdipEqualSeventy.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getSixtyS())) { + int sixty = disdipEqualSeventy.getSixty(); + disdipEqualSeventy.setSixty(sixty++); + } + if (!"0".equals(disdipvo.getOneEightyS())) { + int oneHundredAndEighty = disdipEqualSeventy.getOneHundredAndEighty(); + disdipEqualSeventy.setOneHundredAndEighty(oneHundredAndEighty++); + } + } + + DISDIPCountParam disdipEqualEighty = new DISDIPCountParam(); + + for (DISDIPVO disdipvo : equalEightyFiveDISDIP) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(disdipEqualEighty.getName())) { + disdipEqualEighty.setName(disdipvo.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(disdipvo.getTwentyMs())) { + int twenty = disdipEqualEighty.getTwenty(); + disdipEqualEighty.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getOneHundredMs())) { + int oneHundredMS = disdipEqualEighty.getOneHundredMS(); + disdipEqualEighty.setOneHundredMS(oneHundredMS++); + } + if (!"0".equals(disdipvo.getFiveHundredMs())) { + int fiveHundredMS = disdipEqualEighty.getFiveHundredMS(); + disdipEqualEighty.setOneHundredMS(fiveHundredMS++); + } + if (!"0".equals(disdipvo.getOneS())) { + int one = disdipEqualEighty.getOne(); + disdipEqualEighty.setOne(one++); + } + if (!"0".equals(disdipvo.getThreeS())) { + int three = disdipEqualEighty.getThree(); + disdipEqualEighty.setOne(three++); + } + if (!"0".equals(disdipvo.getTwentyS())) { + int twenty = disdipEqualEighty.getTwenty(); + disdipEqualEighty.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getSixtyS())) { + int sixty = disdipEqualEighty.getSixty(); + disdipEqualEighty.setSixty(sixty++); + } + if (!"0".equals(disdipvo.getOneEightyS())) { + int oneHundredAndEighty = disdipEqualEighty.getOneHundredAndEighty(); + disdipEqualEighty.setOneHundredAndEighty(oneHundredAndEighty++); + } + } + DISDIPCountParam disdipEqualNinety = new DISDIPCountParam(); + + for (DISDIPVO disdipvo : equalNinetyDISDIP) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(disdipEqualNinety.getName())) { + disdipEqualNinety.setName(disdipvo.getName()); + } + + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(disdipvo.getTwentyMs())) { + int twenty = disdipEqualNinety.getTwenty(); + disdipEqualNinety.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getOneHundredMs())) { + int oneHundredMS = disdipEqualNinety.getOneHundredMS(); + disdipEqualNinety.setOneHundredMS(oneHundredMS++); + } + if (!"0".equals(disdipvo.getFiveHundredMs())) { + int fiveHundredMS = disdipEqualNinety.getFiveHundredMS(); + disdipEqualNinety.setOneHundredMS(fiveHundredMS++); + } + if (!"0".equals(disdipvo.getOneS())) { + int one = disdipEqualNinety.getOne(); + disdipEqualNinety.setOne(one++); + } + if (!"0".equals(disdipvo.getThreeS())) { + int three = disdipEqualNinety.getThree(); + disdipEqualNinety.setOne(three++); + } + if (!"0".equals(disdipvo.getTwentyS())) { + int twenty = disdipEqualNinety.getTwenty(); + disdipEqualNinety.setTwenty(twenty++); + } + if (!"0".equals(disdipvo.getSixtyS())) { + int sixty = disdipEqualNinety.getSixty(); + disdipEqualNinety.setSixty(sixty++); + } + if (!"0".equals(disdipvo.getOneEightyS())) { + int oneHundredAndEighty = disdipEqualNinety.getOneHundredAndEighty(); + disdipEqualNinety.setOneHundredAndEighty(oneHundredAndEighty++); + } + } + + /** + * ======================第二张表结束============================== + */ + + //创建计数对象 + IEC28CountParam iec28CountLessOne = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessOneIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessOne.getName())) { + iec28CountLessOne.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessOne.getZeroZeroTwoToZeroOne(); + iec28CountLessOne.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessOne.getZeroOneToZeroTwentyFive(); + iec28CountLessOne.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessOne.getZeroTwentyFiveToZeroFive(); + iec28CountLessOne.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessOne.getZeroFiveToOne(); + iec28CountLessOne.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessOne.getOneToThree(); + iec28CountLessOne.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessOne.getThreeToTwenty(); + iec28CountLessOne.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessOne.getTwentyToSixty(); + iec28CountLessOne.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessOne.getSixtyToOneHundredAndEighty(); + iec28CountLessOne.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessTen = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessTenIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessTen.getName())) { + iec28CountLessTen.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessTen.getZeroZeroTwoToZeroOne(); + iec28CountLessTen.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessTen.getZeroOneToZeroTwentyFive(); + iec28CountLessTen.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessTen.getZeroTwentyFiveToZeroFive(); + iec28CountLessTen.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessTen.getZeroFiveToOne(); + iec28CountLessTen.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessTen.getOneToThree(); + iec28CountLessTen.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessTen.getThreeToTwenty(); + iec28CountLessTen.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessTen.getTwentyToSixty(); + iec28CountLessTen.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessTen.getSixtyToOneHundredAndEighty(); + iec28CountLessTen.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessTwenty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessTwentyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessTwenty.getName())) { + iec28CountLessTwenty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessTwenty.getZeroZeroTwoToZeroOne(); + iec28CountLessTwenty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessTwenty.getZeroOneToZeroTwentyFive(); + iec28CountLessTwenty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessTwenty.getZeroTwentyFiveToZeroFive(); + iec28CountLessTwenty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessTwenty.getZeroFiveToOne(); + iec28CountLessTwenty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessTwenty.getOneToThree(); + iec28CountLessTwenty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessTwenty.getThreeToTwenty(); + iec28CountLessTwenty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessTwenty.getTwentyToSixty(); + iec28CountLessTwenty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessTwenty.getSixtyToOneHundredAndEighty(); + iec28CountLessTwenty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessThirty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessThirtyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessThirty.getName())) { + iec28CountLessThirty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessThirty.getZeroZeroTwoToZeroOne(); + iec28CountLessThirty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessThirty.getZeroOneToZeroTwentyFive(); + iec28CountLessThirty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessThirty.getZeroTwentyFiveToZeroFive(); + iec28CountLessThirty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessThirty.getZeroFiveToOne(); + iec28CountLessThirty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessThirty.getOneToThree(); + iec28CountLessThirty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessThirty.getThreeToTwenty(); + iec28CountLessThirty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessThirty.getTwentyToSixty(); + iec28CountLessThirty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessThirty.getSixtyToOneHundredAndEighty(); + iec28CountLessThirty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessForty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessFortyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessForty.getName())) { + iec28CountLessForty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessForty.getZeroZeroTwoToZeroOne(); + iec28CountLessForty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessForty.getZeroOneToZeroTwentyFive(); + iec28CountLessForty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessForty.getZeroTwentyFiveToZeroFive(); + iec28CountLessForty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessForty.getZeroFiveToOne(); + iec28CountLessForty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessForty.getOneToThree(); + iec28CountLessForty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessForty.getThreeToTwenty(); + iec28CountLessForty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessForty.getTwentyToSixty(); + iec28CountLessForty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessForty.getSixtyToOneHundredAndEighty(); + iec28CountLessForty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessFifty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessFiftyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessFifty.getName())) { + iec28CountLessFifty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessFifty.getZeroZeroTwoToZeroOne(); + iec28CountLessFifty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessFifty.getZeroOneToZeroTwentyFive(); + iec28CountLessFifty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessFifty.getZeroTwentyFiveToZeroFive(); + iec28CountLessFifty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessFifty.getZeroFiveToOne(); + iec28CountLessFifty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessFifty.getOneToThree(); + iec28CountLessFifty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessFifty.getThreeToTwenty(); + iec28CountLessFifty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessFifty.getTwentyToSixty(); + iec28CountLessFifty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessFifty.getSixtyToOneHundredAndEighty(); + iec28CountLessFifty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessSixty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessSixtyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessSixty.getName())) { + iec28CountLessSixty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessSixty.getZeroZeroTwoToZeroOne(); + iec28CountLessSixty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessSixty.getZeroOneToZeroTwentyFive(); + iec28CountLessSixty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessSixty.getZeroTwentyFiveToZeroFive(); + iec28CountLessSixty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessSixty.getZeroFiveToOne(); + iec28CountLessSixty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessSixty.getOneToThree(); + iec28CountLessSixty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessSixty.getThreeToTwenty(); + iec28CountLessSixty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessSixty.getTwentyToSixty(); + iec28CountLessSixty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessSixty.getSixtyToOneHundredAndEighty(); + iec28CountLessSixty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessSeventy = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessSeventyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessSeventy.getName())) { + iec28CountLessSeventy.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessSeventy.getZeroZeroTwoToZeroOne(); + iec28CountLessSeventy.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessSeventy.getZeroOneToZeroTwentyFive(); + iec28CountLessSeventy.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessSeventy.getZeroTwentyFiveToZeroFive(); + iec28CountLessSeventy.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessSeventy.getZeroFiveToOne(); + iec28CountLessSeventy.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessSeventy.getOneToThree(); + iec28CountLessSeventy.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessSeventy.getThreeToTwenty(); + iec28CountLessSeventy.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessSeventy.getTwentyToSixty(); + iec28CountLessSeventy.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessSeventy.getSixtyToOneHundredAndEighty(); + iec28CountLessSeventy.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessEighty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessEightyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessEighty.getName())) { + iec28CountLessEighty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessEighty.getZeroZeroTwoToZeroOne(); + iec28CountLessEighty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessEighty.getZeroOneToZeroTwentyFive(); + iec28CountLessEighty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessEighty.getZeroTwentyFiveToZeroFive(); + iec28CountLessEighty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessEighty.getZeroFiveToOne(); + iec28CountLessEighty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessEighty.getOneToThree(); + iec28CountLessEighty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessEighty.getThreeToTwenty(); + iec28CountLessEighty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessEighty.getTwentyToSixty(); + iec28CountLessEighty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessEighty.getSixtyToOneHundredAndEighty(); + iec28CountLessEighty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + //创建计数对象 + IEC28CountParam iec28CountLessNinety = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessNinetyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessNinety.getName())) { + iec28CountLessNinety.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessNinety.getZeroZeroTwoToZeroOne(); + iec28CountLessNinety.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessNinety.getZeroOneToZeroTwentyFive(); + iec28CountLessNinety.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessNinety.getZeroTwentyFiveToZeroFive(); + iec28CountLessNinety.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessNinety.getZeroFiveToOne(); + iec28CountLessNinety.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessNinety.getOneToThree(); + iec28CountLessNinety.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessNinety.getThreeToTwenty(); + iec28CountLessNinety.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessNinety.getTwentyToSixty(); + iec28CountLessNinety.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessNinety.getSixtyToOneHundredAndEighty(); + iec28CountLessNinety.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + //创建计数对象 + IEC28CountParam iec28CountLessHundredTwenty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredTwentyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredTwenty.getName())) { + iec28CountLessHundredTwenty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredTwenty.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredTwenty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredTwenty.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredTwenty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredTwenty.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredTwenty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredTwenty.getZeroFiveToOne(); + iec28CountLessHundredTwenty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredTwenty.getOneToThree(); + iec28CountLessHundredTwenty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredTwenty.getThreeToTwenty(); + iec28CountLessHundredTwenty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredTwenty.getTwentyToSixty(); + iec28CountLessHundredTwenty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredTwenty.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredTwenty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessHundredThirty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredThirtyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredThirty.getName())) { + iec28CountLessHundredThirty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredThirty.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredThirty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredThirty.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredThirty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredThirty.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredThirty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredThirty.getZeroFiveToOne(); + iec28CountLessHundredThirty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredThirty.getOneToThree(); + iec28CountLessHundredThirty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredThirty.getThreeToTwenty(); + iec28CountLessHundredThirty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredThirty.getTwentyToSixty(); + iec28CountLessHundredThirty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredThirty.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredThirty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + //创建计数对象 + IEC28CountParam iec28CountLessHundredForty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredFortyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredForty.getName())) { + iec28CountLessHundredForty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredForty.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredForty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredForty.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredForty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredForty.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredForty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredForty.getZeroFiveToOne(); + iec28CountLessHundredForty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredForty.getOneToThree(); + iec28CountLessHundredForty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredForty.getThreeToTwenty(); + iec28CountLessHundredForty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredForty.getTwentyToSixty(); + iec28CountLessHundredForty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredForty.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredForty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessHundredFifty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredFiftyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredFifty.getName())) { + iec28CountLessHundredFifty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredFifty.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredFifty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredFifty.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredFifty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredFifty.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredFifty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredFifty.getZeroFiveToOne(); + iec28CountLessHundredFifty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredFifty.getOneToThree(); + iec28CountLessHundredFifty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredFifty.getThreeToTwenty(); + iec28CountLessHundredFifty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredFifty.getTwentyToSixty(); + iec28CountLessHundredFifty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredFifty.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredFifty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessHundredSixty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredSixtyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredSixty.getName())) { + iec28CountLessHundredSixty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredSixty.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredSixty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredSixty.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredSixty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredSixty.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredSixty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredSixty.getZeroFiveToOne(); + iec28CountLessHundredSixty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredSixty.getOneToThree(); + iec28CountLessHundredSixty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredSixty.getThreeToTwenty(); + iec28CountLessHundredSixty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredSixty.getTwentyToSixty(); + iec28CountLessHundredSixty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredSixty.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredSixty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessHundredSeventy = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredSeventyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredSeventy.getName())) { + iec28CountLessHundredSeventy.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredSeventy.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredSeventy.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredSeventy.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredSeventy.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredSeventy.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredSeventy.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredSeventy.getZeroFiveToOne(); + iec28CountLessHundredSeventy.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredSeventy.getOneToThree(); + iec28CountLessHundredSeventy.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredSeventy.getThreeToTwenty(); + iec28CountLessHundredSeventy.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredSeventy.getTwentyToSixty(); + iec28CountLessHundredSeventy.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredSeventy.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredSeventy.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + + //创建计数对象 + IEC28CountParam iec28CountLessHundredEighty = new IEC28CountParam(); + + for (IEC28VO iec28VO : lessHundredEightyIEC28) { + //获取当前剩余电压名称,不为空就进行添加 + if (Objects.isNull(iec28CountLessHundredEighty.getName())) { + iec28CountLessHundredEighty.setName(iec28VO.getName()); + } + //如果参数不等于0对对象中的参数进行++ + if (!"0".equals(iec28VO.getQ())) { + int zeroZeroTwoToZeroOne = iec28CountLessHundredEighty.getZeroZeroTwoToZeroOne(); + iec28CountLessHundredEighty.setZeroZeroTwoToZeroOne(zeroZeroTwoToZeroOne++); + } + if (!"0".equals(iec28VO.getW())) { + int zeroOneToZeroTwentyFive = iec28CountLessHundredEighty.getZeroOneToZeroTwentyFive(); + iec28CountLessHundredEighty.setZeroOneToZeroTwentyFive(zeroOneToZeroTwentyFive++); + } + if (!"0".equals(iec28VO.getE())) { + int zeroTwentyFiveToZeroFive = iec28CountLessHundredEighty.getZeroTwentyFiveToZeroFive(); + iec28CountLessHundredEighty.setZeroTwentyFiveToZeroFive(zeroTwentyFiveToZeroFive++); + } + if (!"0".equals(iec28VO.getR())) { + int zeroFiveToOne = iec28CountLessHundredEighty.getZeroFiveToOne(); + iec28CountLessHundredEighty.setZeroFiveToOne(zeroFiveToOne++); + } + if (!"0".equals(iec28VO.getT())) { + int oneToThree = iec28CountLessHundredEighty.getOneToThree(); + iec28CountLessHundredEighty.setOneToThree(oneToThree++); + } + if (!"0".equals(iec28VO.getY())) { + int threeToTwenty = iec28CountLessHundredEighty.getThreeToTwenty(); + iec28CountLessHundredEighty.setThreeToTwenty(threeToTwenty++); + } + if (!"0".equals(iec28VO.getU())) { + int twentyToSixty = iec28CountLessHundredEighty.getTwentyToSixty(); + iec28CountLessHundredEighty.setTwentyToSixty(twentyToSixty++); + } + if (!"0".equals(iec28VO.getI())) { + int sixtyToOneHundredAndEighty = iec28CountLessHundredEighty.getSixtyToOneHundredAndEighty(); + iec28CountLessHundredEighty.setSixtyToOneHundredAndEighty(sixtyToOneHundredAndEighty++); + } + } + + /** + * =========================第三张表结束=============================== + */ + + + //汇总放入集合 + List iec411Result = new ArrayList<>(); + iec411Result.add(iec411LessOne); + iec411Result.add(iec411LessForty); + iec411Result.add(iec411LessSeventy); + + List disdipResult = new ArrayList<>(); + disdipResult.add(disdipEqualTen); + disdipResult.add(disdipEqualForty); + disdipResult.add(disdipEqualSeventy); + disdipResult.add(disdipEqualEighty); + disdipResult.add(disdipEqualNinety); + + List iec28Result = new ArrayList<>(); + iec28Result.add(iec28CountLessOne); + iec28Result.add(iec28CountLessTen); + iec28Result.add(iec28CountLessTwenty); + iec28Result.add(iec28CountLessThirty); + iec28Result.add(iec28CountLessForty); + iec28Result.add(iec28CountLessFifty); + iec28Result.add(iec28CountLessSixty); + iec28Result.add(iec28CountLessSeventy); + iec28Result.add(iec28CountLessEighty); + iec28Result.add(iec28CountLessNinety); + iec28Result.add(iec28CountLessHundredTwenty); + iec28Result.add(iec28CountLessHundredThirty); + iec28Result.add(iec28CountLessHundredForty); + iec28Result.add(iec28CountLessHundredFifty); + iec28Result.add(iec28CountLessHundredSixty); + iec28Result.add(iec28CountLessHundredSeventy); + iec28Result.add(iec28CountLessHundredEighty); + + + Map resultMap = new HashMap<>(); + + for (int i = 0; i < iec28Result.size(); i++) { + + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getSixtyToOneHundredAndEighty()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getOneToThree()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getZeroFiveToOne()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getZeroOneToZeroTwentyFive()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getZeroTwentyFiveToZeroFive()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getThreeToTwenty()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getTwentyToSixty()); + resultMap.put(iec28Result.get(i).getName(), iec28Result.get(i).getZeroZeroTwoToZeroOne()); + } + + //todo 还要对集合中哪个次数最多挑出第一位 + Map linkMap = getSort(resultMap); + + //存放结果的集合 + List resultList = new ArrayList(); + + for (String s : linkMap.keySet()) { + resultList.add(s); + resultList.add(linkMap.get(s).toString()); + } + + //最多暂降事件名称 + for (int i = 0; i < iec28Result.size(); i++) { + if (iec28Result.get(i).getName().equals(resultList.get(0))) { + if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getZeroZeroTwoToZeroOne()))) { + resultList.add("0.02~0.1"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getZeroOneToZeroTwentyFive()))) { + resultList.add("0.1~0.25"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getZeroTwentyFiveToZeroFive()))) { + resultList.add("0.25~0.5"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getZeroFiveToOne()))) { + resultList.add("0.5~1"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getOneToThree()))) { + resultList.add("1~3"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getThreeToTwenty()))) { + resultList.add("3~20"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getTwentyToSixty()))) { + resultList.add("20~60"); + break; + } else if (resultList.get(1).equals(String.valueOf(iec28Result.get(i).getSixtyToOneHundredAndEighty()))) { + resultList.add("60~180"); + break; + } + } + } + //System.out.println(resultList); + + + //3.1密度密度表格 + if (areaReportParam.isDensityTable()) { + //创建表题计数 + int twoCount = 1; + + //同步给暂降密度图 + oneCount4 = oneCount; + + createTitle(doc, "4." + oneCount + " " + typeName + "密度", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + typeName + "密度统计可以从幅值和持续时间两个维度直接地反映" + typeName + "事件发生情况,主要反应事件的发生次数," + + "中国电网在所选择的分析时间内" + typeName + "事件主要集中在幅值为" + resultList.get(0) + ",持续时间为" + resultList.get(2) + "[根据 IEC 61000-2-8:(公共电网电压" + typeName + "测量统计)算出" + typeName + "事件发生最多的区间],具体见表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " DISDIP表格:国际发配电联盟(UNIPEDE)", "标题 3", 400, 11); + + //第一张表 + XWPFTable monitorInfo = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); + + // 表格第一行 + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "剩余电压", "20ms", "100ms", "500ms", "1s", "3s", "20s", "60s", "180s"); + + + //塞入数据 + for (int i = 0; i < disdipResult.size(); i++) { + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, false, disdipResult.get(i).getName(), String.valueOf(disdipResult.get(i).getTwentyMS()), + String.valueOf(disdipResult.get(i).getOneHundredMS()), String.valueOf(disdipResult.get(i).getFiveHundredMS()), String.valueOf(disdipResult.get(i).getOne()), String.valueOf(disdipResult.get(i).getThree()), + String.valueOf(disdipResult.get(i).getTwenty()), String.valueOf(disdipResult.get(i).getSixty()), String.valueOf(disdipResult.get(i).getOneHundredAndEighty())); + } + + twoCount++; + + + createTitle(doc, "4." + oneCount + "." + twoCount + " IEC 61000-4-11:(用电终端的电压" + typeName + "抗度)", "标题 3", 400, 11); + + //第二张表 + XWPFTable monitorInfo1 = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph1 = WordUtils.getCenterParagraph(doc); + + // 表格第一行 + insertRow(doc, monitorInfo1, monitorInfoExcelParagraph1, true, "剩余电压", "10~20ms", "20~100ms", "0.1~0.2s", "0.2~0.5s", "0.5~1s", ">1s"); + + + //塞入数据 + for (int i = 0; i < iec411Result.size(); i++) { + insertRow(doc, monitorInfo1, monitorInfoExcelParagraph1, false, iec411Result.get(i).getName(), String.valueOf(iec411Result.get(i).getTenToTwenty()), String.valueOf(iec411Result.get(i).getTwentyToHundred()), + String.valueOf(iec411Result.get(i).getZeroOneToZeroTwo()), String.valueOf(iec411Result.get(i).getZeroTwoToZeroFive()), String.valueOf(iec411Result.get(i).getZeroFiveToOne()), String.valueOf(iec411Result.get(i).getLessOne())); + } + + twoCount++; + + + createTitle(doc, "4." + oneCount + "." + twoCount + " IEC 61000-2-8:(公共电网电压" + typeName + "测量统计)", "标题 3", 400, 11); + + //第二张表 + XWPFTable monitorInfo2 = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph2 = WordUtils.getCenterParagraph(doc); + + // 表格第一行 + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, true, "剩余电压", "0.02~0.1s", "0.1~0.25s", "0.25~0.5s", "0.5~1s", "1~3s", "3~20s", "20~60s", "60~180s"); + + + //塞入数据 + for (int i = 0; i < iec28Result.size(); i++) { + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, false, iec28Result.get(i).getName(), String.valueOf(iec28Result.get(i).getZeroZeroTwoToZeroOne()), String.valueOf(iec28Result.get(i).getZeroOneToZeroTwentyFive()), + String.valueOf(iec28Result.get(i).getZeroTwentyFiveToZeroFive()), String.valueOf(iec28Result.get(i).getZeroFiveToOne()), String.valueOf(iec28Result.get(i).getOneToThree()), String.valueOf(iec28Result.get(i).getThreeToTwenty()), + String.valueOf(iec28Result.get(i).getTwentyToSixty()), String.valueOf(iec28Result.get(i).getSixtyToOneHundredAndEighty())); + } + + //同步给暂降密度表格 + twoCount1 = twoCount; + //序号计数进行++ + oneCount++; + } + + //3.2暂降密度图表 + if (areaReportParam.isDensityChart()) { + + //如果暂降幅值被勾选,就不需要进行写段落 + if (areaReportParam.isDensityTable()) { + twoCount1++; + + //如果幅值图存在与幅值的序号保持同步 + createTitle(doc, "4." + oneCount4 + "." + twoCount1 + " " + typeName + "密度图", "标题 3", 400, 11); + + //代码 + + } else { + int twoCount = 1; + createTitle(doc, "4." + oneCount + " " + typeName + "密度", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + typeName + "密度统计可以从幅值和持续时间两个维度直接地反映" + typeName + "事件发生情况,主要反应事件的发生次数," + + "中国电网在所选择的分析时间内" + typeName + "事件主要集中在幅值为" + resultList.get(0) + ",持续时间为" + resultList.get(2) + "[根据 IEC 61000-2-8:(公共电网电压" + typeName + "测量统计)算出" + typeName + "事件发生最多的区间],具体见表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "密度图", "标题 3", 400, 11); + + + //代码 + + + //序号计数进行++ + oneCount++; + } + } + } + + //4.itic图 + if (areaReportParam.isItic()) { + //itic图 + /* + AreaTableParam areaTableParam = new AreaTableParam(); + + //监测点id拼接 + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); + areaTableParam.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam.setStringBuilder(stringBuilder); + + + //创建结果集合 +// List info = TableInfo(areaTableParam); + List info = eventDetailList; + + //将sql结果集放入,共用一个sql,减少查询时间 + AreaTableParam areaTableParam1 = new AreaTableParam(); + areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam1.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam1.setStringBuilder(stringBuilder); + areaTableParam1.setInfo(info); + */ + +// List detailList = getPlotArea(areaTableParam1); + List detailList = eventDetailList; + + List obs = new ArrayList<>(); + ArrayList> list = new ArrayList<>(); + for (EventDetailNew eventDetail : detailList) { + obs.add(new OB(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "") + , Double.parseDouble(eventDetail.getEventValue() * 100 + ""))); + + ArrayList doubles = new ArrayList<>(); + doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + list.add(doubles); + } + + List result = getITICArea(obs); + + /** + * =========================续写word文档============================================== + */ + //创建表题计数 + int twoCount = 1; + + oneCount3 = oneCount; + + createTitle(doc, "4." + oneCount3 + " " + typeName + "事件点图", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + typeName + "事件点图统计分成ITIC曲线和F47曲线展示。"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount3 + "." + twoCount + " ITIC 曲线", "标题 3", 400, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r13 = p.createRun();//创建段落文本 + r13.setText(" ITIC曲线中可容忍" + typeName + "记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); + r13.setFontSize(11);//字体大小 + + + String itic = getITIC(list); + createPic(doc, itic, "ITIC曲线"); + + + twoCount5 = twoCount; + //序号计数进行++ + oneCount++; + + /** + * =======================================word结束========================================= + */ + + + } + + //5.f47图 + if (areaReportParam.isF47()) { + //f47图 + /* + AreaTableParam areaTableParam = new AreaTableParam(); + + //监测点id拼接 + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); + areaTableParam.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam.setStringBuilder(stringBuilder); + + + //创建结果集合 +// List info = TableInfo(areaTableParam); + List info = eventDetailList; + + //将sql结果集放入,共用一个sql,减少查询时间 + AreaTableParam areaTableParam1 = new AreaTableParam(); + areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam1.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam1.setStringBuilder(stringBuilder); + areaTableParam1.setInfo(info); + + + List detailList = getPlotArea(areaTableParam1); + */ + List detailList = eventDetailList; + + List obs = new ArrayList<>(); + + ArrayList> list = new ArrayList<>(); + for (EventDetailNew eventDetail : detailList) { + obs.add(new OB(Double.parseDouble(eventDetail.getPersistTime() / 1000 + ""), Double.parseDouble(eventDetail.getEventValue() * 100 + ""))); + + ArrayList doubles = new ArrayList<>(); + doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); + list.add(doubles); + } + + + List result = getF47Area(obs); + + /** + * =========================续写word文档============================================== + */ + + if (areaReportParam.isItic()) { + twoCount5++; + + createTitle(doc, "4." + oneCount3 + "." + twoCount5 + " F47 曲线", "标题 3", 400, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r13 = p.createRun();//创建段落文本 + r13.setText(" F47曲线中可容忍" + typeName + "记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); + r13.setFontSize(11);//字体大小 + + + String f47 = getF47(list); + createPic(doc, f47, "SEMI F47曲线"); + + /** + * =======================================word结束========================================= + */ + } else { + //创建表题计数 + int twoCount = 1; + + oneCount3 = oneCount; + + createTitle(doc, "4." + oneCount + " " + typeName + "事件点图", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + typeName + "事件点图统计分成ITIC曲线和F47曲线展示。"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " F47 曲线", "标题 3", 400, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r13 = p.createRun();//创建段落文本 + r13.setText(" F47曲线中可容忍" + typeName + "降记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); + r13.setFontSize(11);//字体大小 + + + String f47 = getF47(list); + createPic(doc, f47, "SEMI F47曲线"); + + + //序号计数进行++ + oneCount++; + + /** + * =======================================word结束========================================= + */ + } + + + } + + //6.暂降增幅 + if (areaReportParam.isSagAmplitude()) { + //暂降分布幅值 + /* + AreaTableParam areaTableParam = new AreaTableParam(); + + //监测点id拼接 + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); + areaTableParam.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam.setStringBuilder(stringBuilder); + + */ + //创建结果集合 +// List info = TableInfo(areaTableParam); + List info = eventDetailList; + + //将sql结果集放入,共用一个sql,减少查询时间 + AreaTableParam areaTableParam1 = new AreaTableParam(); + areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam1.setEndTime(areaReportParam.getSearchEndTime()); +// areaTableParam1.setStringBuilder(stringBuilder); + areaTableParam1.setInfo(info); + ProbabilityVO probabilityDistributionArea = getProbabilityDistributionArea(areaTableParam1); + + + List eventvalue = probabilityDistributionArea.getEventvalue(); + + List amplitudeList = new ArrayList<>(); + + List xName = new ArrayList<>(); + xName.add("0"); + xName.add("10%"); + xName.add("20%"); + xName.add("30%"); + xName.add("40%"); + xName.add("50%"); + xName.add("60%"); + xName.add("70%"); + xName.add("80%"); + xName.add("90%"); + //将幅值绑定对应的x值,放入集合 + for (int i = 0; i < eventvalue.size(); i++) { + AmplitudeCountParam amplitudeCountParam = new AmplitudeCountParam(); + amplitudeCountParam.setXName(xName.get(i)); + amplitudeCountParam.setYValue(eventvalue.get(i)); + amplitudeList.add(amplitudeCountParam); + } + //存储幅值结果集合 + List amplitudeResult = new ArrayList<>(); + for (int i = 1; i < amplitudeList.size(); i++) { + if (!amplitudeList.get(i).getYValue().equals(amplitudeList.get(i - 1).getYValue())) { + amplitudeResult.add(amplitudeList.get(i - 1).getXName()); + amplitudeResult.add(amplitudeList.get(i).getXName()); + break; + } else if (amplitudeList.get(0).getYValue().equals(amplitudeList.get(amplitudeList.size() - 1).getYValue())) { + amplitudeResult.add(amplitudeList.get(0).getXName()); + amplitudeResult.add(amplitudeList.get(amplitudeList.size() - 1).getXName()); + break; + } + } + + + List eventvalue1 = probabilityDistributionArea.getSisttime(); + + List amplitudeList1 = new ArrayList<>(); + + List xName1 = new ArrayList<>(); + xName1.add("0.01"); + xName1.add("0.1"); + xName1.add("0.25"); + xName1.add("0.5"); + xName1.add("1"); + xName1.add("3"); + xName1.add("20"); + xName1.add("60"); + xName1.add("180"); + //将幅值绑定对应的x值,放入集合 + for (int i = 0; i < eventvalue1.size(); i++) { + AmplitudeCountParam amplitudeCountParam = new AmplitudeCountParam(); + amplitudeCountParam.setXName(xName1.get(i)); + amplitudeCountParam.setYValue(eventvalue1.get(i)); + amplitudeList1.add(amplitudeCountParam); + } + //存储幅值结果集合 + List amplitudeResult1 = new ArrayList<>(); + for (int i = 1; i < amplitudeList1.size(); i++) { + if (!amplitudeList1.get(i).getYValue().equals(amplitudeList1.get(i - 1).getYValue())) { + amplitudeResult1.add(amplitudeList1.get(i - 1).getXName()); + amplitudeResult1.add(amplitudeList1.get(i).getXName()); + break; + } else if (amplitudeList1.get(0).getYValue().equals(amplitudeList1.get(amplitudeList1.size() - 1).getYValue())) { + amplitudeResult1.add(amplitudeList1.get(0).getXName()); + amplitudeResult1.add(amplitudeList1.get(amplitudeList1.size() - 1).getXName()); + break; + } + } + + + /** + * =========================续写word文档============================================== + */ + //创建表题计数 + int twoCount = 1; + + oneCount2 = oneCount; + + createTitle(doc, "4." + oneCount2 + " " + typeName + "幅值概率分布图", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + typeName + "概率分布图分成" + typeName + "幅值概率分布和持续时间概率分布图,中国电网在所选择的分析时间内" + typeName + "事件从幅值概率分布统计主要集中在幅值为" + amplitudeResult.get(0) + "~" + amplitudeResult.get(1) + "之间," + + "从持续时间统计主要集中在持续时间为" + amplitudeResult1.get(0) + "~" + amplitudeResult1.get(1) + "[持续时间排序,选择" + typeName + "记录发生最多的区域],如下表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "幅值的概率分布函数", "标题 3", 400, 11); + + + List ybardata = probabilityDistributionArea.getPereventvalue(); + List ylinedata = probabilityDistributionArea.getEventvalue(); + String fz = getFZ(ylinedata, ybardata); + createPic(doc, fz, "" + typeName + "幅值的概率分布函数"); + + + //序号计数进行++ + oneCount++; + + /** + * =======================================word结束========================================= + */ + + } + + //7.暂降持续时间 + if (areaReportParam.isDuration()) { + //持续时间概率分布 + + + AreaTableParam areaTableParam = new AreaTableParam(); + + //监测点id拼接 + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); + areaTableParam.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam.setStringBuilder(stringBuilder); + + + //创建结果集合 +// List info = TableInfo(areaTableParam); + List info = eventDetailList; + + //将sql结果集放入,共用一个sql,减少查询时间 + AreaTableParam areaTableParam1 = new AreaTableParam(); + areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime()); + areaTableParam1.setEndTime(areaReportParam.getSearchEndTime()); + areaTableParam1.setStringBuilder(stringBuilder); + areaTableParam1.setInfo(info); + ProbabilityVO probabilityDistributionArea = getProbabilityDistributionArea(areaTableParam1); + +// System.out.println(probabilityDistributionArea); + + List eventvalue = probabilityDistributionArea.getEventvalue(); + + List amplitudeList = new ArrayList<>(); + + List xName = new ArrayList<>(); + xName.add("0"); + xName.add("10%"); + xName.add("20%"); + xName.add("30%"); + xName.add("40%"); + xName.add("50%"); + xName.add("60%"); + xName.add("70%"); + xName.add("80%"); + xName.add("90%"); + //将幅值绑定对应的x值,放入集合 + for (int i = 0; i < eventvalue.size(); i++) { + AmplitudeCountParam amplitudeCountParam = new AmplitudeCountParam(); + amplitudeCountParam.setXName(xName.get(i)); + amplitudeCountParam.setYValue(eventvalue.get(i)); + amplitudeList.add(amplitudeCountParam); + } + //存储幅值结果集合 + List amplitudeResult = new ArrayList<>(); + for (int i = 1; i < amplitudeList.size(); i++) { + if (!amplitudeList.get(i).getYValue().equals(amplitudeList.get(i - 1).getYValue())) { + amplitudeResult.add(amplitudeList.get(i - 1).getXName()); + amplitudeResult.add(amplitudeList.get(i).getXName()); + break; + } else if (amplitudeList.get(0).getYValue().equals(amplitudeList.get(amplitudeList.size() - 1).getYValue())) { + amplitudeResult.add(amplitudeList.get(0).getXName()); + amplitudeResult.add(amplitudeList.get(amplitudeList.size() - 1).getXName()); + break; + } + } + + + List eventvalue1 = probabilityDistributionArea.getSisttime(); + + List amplitudeList1 = new ArrayList<>(); + + List xName1 = new ArrayList<>(); + xName1.add("0.01"); + xName1.add("0.1"); + xName1.add("0.25"); + xName1.add("0.5"); + xName1.add("1"); + xName1.add("3"); + xName1.add("20"); + xName1.add("60"); + xName1.add("180"); + //将幅值绑定对应的x值,放入集合 + for (int i = 0; i < eventvalue1.size(); i++) { + AmplitudeCountParam amplitudeCountParam = new AmplitudeCountParam(); + amplitudeCountParam.setXName(xName1.get(i)); + amplitudeCountParam.setYValue(eventvalue1.get(i)); + amplitudeList1.add(amplitudeCountParam); + } + //存储幅值结果集合 + List amplitudeResult1 = new ArrayList<>(); + for (int i = 1; i < amplitudeList1.size(); i++) { + if (!amplitudeList1.get(i).getYValue().equals(amplitudeList1.get(i - 1).getYValue())) { + amplitudeResult1.add(amplitudeList1.get(i - 1).getXName()); + amplitudeResult1.add(amplitudeList1.get(i).getXName()); + break; + } else if (amplitudeList1.get(0).getYValue().equals(amplitudeList1.get(amplitudeList1.size() - 1).getYValue())) { + amplitudeResult1.add(amplitudeList1.get(0).getXName()); + amplitudeResult1.add(amplitudeList1.get(amplitudeList1.size() - 1).getXName()); + break; + } + } + /** + * =========================续写word文档============================================== + */ + + //创建表题计数 + int twoCount = 1; + + //如果暂降幅值被勾选,就不需要进行写段落 + if (areaReportParam.isSagAmplitude()) { + twoCount++; + + //如果幅值图存在与幅值的序号保持同步 + createTitle(doc, "4." + oneCount2 + "." + twoCount + " 时序时间的概率分函数", "标题 3", 400, 11); + + + List ybardata = probabilityDistributionArea.getPersisttime(); + List ylinedata = probabilityDistributionArea.getSisttime(); + String sj = getSJ(ylinedata, ybardata); + createPic(doc, sj, "持续时间的概率分布函数"); + + + } else { + createTitle(doc, "4." + oneCount2 + " " + typeName + "幅值概率分布图", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + typeName + "概率分布图分成" + typeName + "幅值概率分布和持续时间概率分布图,中国电网在所选择的分析时间内" + typeName + "事件从幅值概率分布统计主要集中在幅值为" + amplitudeResult.get(0) + "~" + amplitudeResult.get(1) + "之间," + + "从持续时间统计主要集中在持续时间为" + amplitudeResult1.get(0) + "~" + amplitudeResult1.get(1) + "[持续时间排序,选择" + typeName + "记录发生最多的区域],如下表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " 时序时间的概率分函数", "标题 3", 400, 11); + + + //代码 + + + //序号计数进行++ + oneCount++; + } + /** + * =======================================word结束========================================= + */ + } + + //8.事件关联统计表格 + if (areaReportParam.isEventRelevanceCountTable()) { + //事件关联统计表格 + + //创建存储总次数的集合 + Map resultCount = new HashMap<>(); + + //创建存储time的集合 + Map timeCount = new HashMap<>(); + + /* + //提前创建line_id拼接工具,如:where id = '1' or id = '2' + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(lineIds); + + StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE). + append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ").append("time <= '") + .append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))) + .append("' and ").append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" and ") + .append("eventass_index != '' ").append(" tz('Asia/Shanghai')"); + ; + + //查询sql语句总条数 + StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") + .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); + stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" and ").append("eventass_index != '' ").append(" tz('Asia/Shanghai')"); + + //总条数 + QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); + //结果集 + QueryResult result = influxDbUtils.query(stringResult.toString()); + + //结果集映射到对象中 + eventDetailList = influxDBResultMapper.toPOJO(result, EventDetailNew.class); + + //如果返回的结果不为null,将count重新赋值 + if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) { + long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue(); + //count有默认值为0,不用进行非空判断,将结果集装入准备好的集合中 + resultCount.put("count", count); + } else { + long count = 0; + //count有默认值为0,不用进行非空判断,将结果集装入准备好的集合中 + resultCount.put("count", count); + } + */ + int resultCount1 = 0; + List resultList = new ArrayList<>(); + + List eventList = eventDetailList.stream().filter(e -> e.getEventassIndex() != "").collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(eventList)) { + //记录条数 + resultCount.put("count", eventList.size()); + + //将时间数存入集合Map集合(主数据) + for (EventDetailNew detail : eventList) { + timeCount.put(detail.getEventassIndex(), detail.getTimeId()); + } + + //时间拼接 event_time=getEventassIndex + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(new ArrayList<>(timeCount.keySet()), "event_time"); + StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE). + append("event_time = '").append(stringBuilder).append("' "); + + //结果集 + QueryResult result1 = influxDbUtils.query(stringResult1.toString()); + + //结果集映射到对象中 + List eventassList = influxDBResultMapper.toPOJO(result1, Eventass.class); + + for (Eventass eventass : eventassList) { + EventassCountParam eventassCountParam = new EventassCountParam(); + eventassCountParam.setAssTime(eventass.getTimeId().toString()); + //获取时间 + String eventTime = timeCount.get(eventass.getEventTime()); + eventassCountParam.setEventTime(eventTime); + eventassCountParam.setDescribe(eventass.getDescribe()); + resultList.add(eventassCountParam); + } + } else { + resultCount.put("count", 0); + } + + + /* + for (String s : timeCount.keySet()) { + + + StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE). + append("event_time = '").append(stringBuilder).append("' "); + + //结果集 + QueryResult result1 = influxDbUtils.query(stringResult1.toString()); + + + //结果集映射到对象中 + List eventassList = influxDBResultMapper.toPOJO(result1, Eventass.class); + + for (Eventass eventass : eventassList) { + EventassCountParam eventassCountParam = new EventassCountParam(); + eventassCountParam.setAssTime(eventass.getTimeId().toString()); + eventassCountParam.setEventTime(timeCount.get(s).toString()); + eventassCountParam.setDescribe(eventass.getDescribe()); + resultList.add(eventassCountParam); + } + resultCount1 = eventassList.size() + resultCount1; + + } + + +/** + * =========================续写word文档============================================== + */ + + + createTitle(doc, "4." + oneCount + " 事件关联分析", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + //归一化需要高级算法,先字符串代替 + r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:"); + r12.setFontSize(11);//字体大小 + + + //第三张表 + XWPFTable monitorInfo2 = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph2 = WordUtils.getCenterParagraph(doc); + + // 表格第一行 + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, true, "时间", "事件关联分析名称", "事件关联分析表述"); + + + //塞入数据 + for (int i = 0; i < resultList.size(); i++) { + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, false, resultList.get(i).getAssTime(), resultList.get(i).getEventTime(), resultList.get(i).getDescribe()); + } + //序号计数进行++ + oneCount++; + + /** + * =======================================word结束========================================= + */ + + } + + //9.暂降原因表和暂降原因图形生成 + if (areaReportParam.isEventReasonTable() || areaReportParam.isEventReasonChart()) { + //查询字典表 + List reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData(); + + //新建map集合装入参数 + Map reasonMap = reasonList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName)); + + //获得所有值 + Set typeSet = reasonMap.keySet(); + List listReason = new ArrayList<>(typeSet); + + //创建Map结果集合 + Map resultMap = new HashMap<>(); + + //优化数据(根据暂降原因,进行分组统计有多少条数据,key:暂降原因id,value:次数) + Map reasonMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getEventReason, Collectors.counting())); + //将数据重新整合为(key:暂降原因的名称,value:暂降原因测次数) + reasonMap.forEach((key, value) -> { + if (reasonMapCount.containsKey(key)) { + resultMap.put(value, Math.toIntExact(reasonMapCount.get(key))); + } else { + resultMap.put(value, 0); + } + }); + + //todo 还要对集合中哪个次数最多挑出第一位 + //获取entrySet + Map linkMap = getSort(resultMap); + //最多暂降事件名称 + Set topSet = linkMap.keySet(); + List topList = new ArrayList<>(topSet); + + //暂降原因表格 + if (areaReportParam.isEventReasonTable()) { + //暂降原因表格 + //创建表题计数 + int twoCount = 1; + + oneCount7 = oneCount; + createTitle(doc, "4." + oneCount + " 原因统计", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态原因为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " 原因统计表格", "标题 3", 400, 11); + + //第一张表 + XWPFTable monitorInfo = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); + + // 表格第一行 + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "暂态类型", "电压" + typeName + "次数"); + + //塞入数据 + for (String name : resultMap.keySet()) { + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, false, name, resultMap.get(name).toString()); + + } + + twoCount4 = twoCount; + //序号计数进行++ + oneCount++; + + } + + //暂降原因图表 + if (areaReportParam.isEventReasonChart()) { + if (areaReportParam.isEventReasonTable()) { + + createTitle(doc, "4." + oneCount7 + "." + twoCount4 + " 原因统计图", "标题 3", 400, 11); + + //创建x,y参数 + List xdata = new ArrayList<>(); + List ydata = new ArrayList<>(); + + List reason = new ArrayList<>(); + for (String name : resultMap.keySet()) { + xdata.add(name); + ydata.add(resultMap.get(name)); + + ReasonsVO reasonsVO = new ReasonsVO(); + reasonsVO.setReason(name); + reasonsVO.setTimes(resultMap.get(name)); + reason.add(reasonsVO); + } + + String tr = getR(xdata, reason, "bar9.ftl"); + createPic(doc, tr, "" + typeName + "原因图"); + } else { + //创建表题计数 + int twoCount = 1; + + createTitle(doc, "4." + oneCount + " 原因统计", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态原因为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " 原因统计图", "标题 3", 400, 11); + + //创建x,y参数 + List xdata = new ArrayList<>(); + List ydata = new ArrayList<>(); + + List reason = new ArrayList<>(); + + for (String name : resultMap.keySet()) { + xdata.add(name); + ydata.add(resultMap.get(name)); + + ReasonsVO reasonsVO = new ReasonsVO(); + reasonsVO.setReason(name); + reasonsVO.setTimes(resultMap.get(name)); + reason.add(reasonsVO); + } + + String tr = getR(xdata, reason, "bar9.ftl"); + createPic(doc, tr, "" + typeName + "原因图"); + + //序号计数进行++ + oneCount++; + } + } + } + + //10.暂降类型表格 和 暂降类型图表 + if (areaReportParam.isEventTypeTable() || areaReportParam.isEventTypeChart()) { + + //查询字典表(暂降类型) + List typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData(); + //新建map集合装入参数 + Map typeMap = typeList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName)); + + //获得所有值 + Set typeSet = typeMap.keySet(); + List listReason = new ArrayList<>(typeSet); + + //创建Map结果集合 + Map resultMap = new HashMap<>(); + + //优化数据(根据暂降类型,进行分组统计有多少条数据,key:暂降类型id,value:次数) + Map typeMapCount = eventDetailList.stream().collect(Collectors.groupingBy(EventDetailNew::getEventType, Collectors.counting())); + //将数据重新整合为(key:暂降类型的名称,value:暂降类型次数) + typeMap.forEach((key, value) -> { + if (typeMapCount.containsKey(key)) { + resultMap.put(value, Math.toIntExact(typeMapCount.get(key))); + } else { + resultMap.put(value, 0); + } + }); + + //todo 还要对集合中哪个次数最多挑出第一位 + //获取entrySet + Map linkMap = getSort(resultMap); + //最多暂降事件名称 + Set topSet = linkMap.keySet(); + List topList = new ArrayList<>(topSet); + + + //暂降类型表格 + if (areaReportParam.isEventTypeTable()) { + //创建表题计数 + int twoCount = 1; + oneCount6 = oneCount; + + createTitle(doc, "4." + oneCount + " 类型统计", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态类型为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setFontSize(11);//字体大小 + + + createTitle(doc, "4." + oneCount + "." + twoCount + " 类型统计表格", "标题 3", 400, 11); + + //第一张表 + XWPFTable monitorInfo = createTable(doc); + XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); + + // 表格第一行 + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "暂态类型", "电压" + typeName + "次数"); + + + //塞入数据 + for (String name : resultMap.keySet()) { + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, false, name, resultMap.get(name).toString()); + } + + twoCount3 = twoCount; + //序号计数进行++ + oneCount++; + } + //暂降类型图形 + if (areaReportParam.isEventTypeChart()) { + if (areaReportParam.isEventTypeTable()) { + twoCount3++; + createTitle(doc, "4." + oneCount6 + "." + twoCount3 + " 类型统计图", "标题 3", 400, 11); + + + //创建x,y参数 + List xdata = new ArrayList<>(); + List ydata = new ArrayList<>(); + + List types = new ArrayList<>(); + for (String name : resultMap.keySet()) { + xdata.add(name); + ydata.add(resultMap.get(name)); + + TypesVO typesVO = new TypesVO(); + typesVO.setType(name); + typesVO.setTimes(resultMap.get(name)); + types.add(typesVO); + } + + String tr = getT(xdata, types, "bar8.ftl"); + createPic(doc, tr, "" + typeName + "类型图"); + + } else { + //创建表题计数 + int twoCount = 1; + + + createTitle(doc, "4." + oneCount + " 类型统计", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网在所选择的分析时间内暂态事件主要的暂态类型为" + topList.get(0) + "[根据表格中的次数来进行分析],见下表(图):"); + r12.setFontSize(11);//字体大小 + + createTitle(doc, "4." + oneCount + "." + twoCount + " 类型统计图", "标题 3", 400, 11); + + //创建x,y参数 + List xdata = new ArrayList<>(); + List ydata = new ArrayList<>(); + + List types = new ArrayList<>(); + for (String name : resultMap.keySet()) { + xdata.add(name); + ydata.add(resultMap.get(name)); + + TypesVO typesVO = new TypesVO(); + typesVO.setType(name); + typesVO.setTimes(resultMap.get(name)); + types.add(typesVO); + } + + String tr = getT(xdata, types, "bar8.ftl"); + createPic(doc, tr, "" + typeName + "类型图"); + + //序号计数进行++ + oneCount++; + } + } + + } + + //11.暂降热力图 + if (areaReportParam.isThermodynamicChart()) { + //暂降热力图 + + createTitle(doc, "4." + oneCount + " " + typeName + "热力图", "标题 2", 200, 11); + + p = doc.createParagraph();// 新建一个段落 + p.setAlignment(ParagraphAlignment.BOTH); + XWPFRun r12 = p.createRun();//创建段落文本 + r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条,使用颜色将地图上按照" + typeName + "记录发生频率进行描绘,所形成的热力具体见下图:"); + r12.setFontSize(11);//字体大小 + + //所有的表结果装入集合 + Map areaCount1 = new HashMap<>(); + + //进行遍历集合获得子区域名及其所有监测点id + //根据省级获取部门下面的信息图 + for (PmsGeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { + + //当前子部门下所有id + List lineIndexes = generalDeviceDTO.getMonitorIdList(); + + + //如果集合中有id将id进行拼接 + if (CollectionUtil.isNotEmpty(lineIndexes)) { + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIndexes); + + + //查询sql语句总条数 + StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") + .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); + stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); + + //总条数 + QueryResult resultTotal = influxDbUtils.query(stringTotal.toString()); + + + if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { + areaCount1.put(generalDeviceDTO.getName(), 0); + + } else { + double count = Double.valueOf(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()); + + areaCount1.put(generalDeviceDTO.getName(), Integer.valueOf((int) count)); + } + + } else { + //为空put 0 + areaCount1.put(generalDeviceDTO.getName(), 0); + } + } + + +// System.out.println(areaCount1); + //转为List对象集合 + List areaCountList1 = new ArrayList<>(); + for (String s : areaCount1.keySet()) { + ReportCountParam reportCountParam = new ReportCountParam(); + reportCountParam.setName(s); + reportCountParam.setCount(areaCount1.get(s).toString()); + areaCountList1.add(reportCountParam); + } + +// System.out.println(areaCountList1); + + //序号计数进行++ + oneCount++; + } + + + //文件下载 + /* FileOutputStream out = new FileOutputStream("C:\\Users\\User\\Desktop\\中国热力图.docx"); + doc.write(out); + out.close();*/ + //文件下载 + ServletOutputStream outputStream = response.getOutputStream(); + String fileName = URLEncoder.encode(deptName + "热力图.docx", "UTF-8"); + response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); + response.setContentType("application/octet-stream;charset=UTF-8"); + doc.write(outputStream); + outputStream.close(); + //暂降事件 + } else { + + } + } + /** * zbj * @@ -6673,29 +9909,31 @@ public class ReportServiceImpl implements ReportService { /** * wr(初始化数据) + * * @param lineIds 监测点集合 * @return */ - private List getEventDetailListInfo(AreaReportParam areaReportParam,List lineIds){ - StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); + private List getEventDetailListInfo(AreaReportParam areaReportParam, List lineIds) { + StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); - //查询sql语句总条数 - StringBuilder stringResult = new StringBuilder("SELECT * FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") - .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); - stringResult.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); - // 结果集 - QueryResult result = influxDbUtils.query(stringResult.toString()); - //结果集映射到对象中 - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - return influxDBResultMapper.toPOJO(result, EventDetailNew.class); - } + //查询sql语句总条数 + StringBuilder stringResult = new StringBuilder("SELECT * FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") + .append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(areaReportParam.getSearchEndTime()))).append("' and "); + stringResult.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); + // 结果集 + QueryResult result = influxDbUtils.query(stringResult.toString()); + //结果集映射到对象中 + InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); + return influxDBResultMapper.toPOJO(result, EventDetailNew.class); + } /** * wr(公共查询条数) + * * @param lineIds 监测点集合 * @return */ - private QueryResult getEventDetailListInfoNum(AreaReportParam areaReportParam,List lineIds){ + private QueryResult getEventDetailListInfoNum(AreaReportParam areaReportParam, List lineIds) { StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds); //查询sql语句总条数 StringBuilder stringTotal = new StringBuilder("SELECT COUNT(num) as aa FROM ").append(Param.EVENT_DETAIL).append(" WHERE ").append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaReportParam.getSearchBeginTime()))).append("' and ") @@ -6703,15 +9941,16 @@ public class ReportServiceImpl implements ReportService { stringTotal.append(stringBuilder).append(" and ").append("(wave_type = 0 or wave_type = 1 or wave_type = 2 or wave_type = 3 or wave_type = 4)").append(" tz('Asia/Shanghai')"); //总条数 - return influxDbUtils.query(stringTotal.toString()); + return influxDbUtils.query(stringTotal.toString()); } /** * 报表结果排序提取 + * * @param voltageCount * @return */ - private Map getSort(Map voltageCount){ + private Map getSort(Map voltageCount) { //还要对集合中哪个电压暂降次数最多进行计算,挑选出前两位 //获取entrySet Set> mapEntries = voltageCount.entrySet(); diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/ReportService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/ReportService.java index 41d8b2012..b79f55649 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/ReportService.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/ReportService.java @@ -56,4 +56,12 @@ public interface ReportService { void getAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception; + /*** + * Pms获取区域报告 + * @author wr + * @date 2023-03-07 10:16 + * @param areaReportParam + * @param response + */ + void getPmsAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception; } diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/TerminalParam.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/TerminalParam.java index 2c43dd6de..ae9e4ed1c 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/TerminalParam.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/param/TerminalParam.java @@ -28,8 +28,16 @@ public class TerminalParam { @ApiModelProperty("单位id") private String id; + public String getStartTime() { + return startTime + " 00:00:00"; + } + + public String getEndTime() { + return endTime + " 23:59:59"; + } + @Data - public static class TerminalPageParam extends TerminalParam{ + public static class TerminalPageParam extends TerminalParam { @ApiModelProperty(value = "页码") private Integer PageNum; @@ -37,6 +45,9 @@ public class TerminalParam { @ApiModelProperty(value = "条数") private Integer PageSize; + @ApiModelProperty("终端名称") + private String name; + @ApiModelProperty(value = "是否周期检测列表") private Integer type; } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/PmsTerminalDetectionServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/PmsTerminalDetectionServiceImpl.java index 2c2201834..068a49054 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/PmsTerminalDetectionServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/PmsTerminalDetectionServiceImpl.java @@ -54,12 +54,17 @@ public class PmsTerminalDetectionServiceImpl extends ServiceImpl terminalPage(TerminalParam.TerminalPageParam param) { + List data = deptFeignClient.getDepSonDetailByDeptId(param.getId()).getData(); + List deptCodes = data.stream().map(DeptDTO::getCode).collect(Collectors.toList()); Page pageList = this.page(new Page<>(param.getPageNum(), param.getPageSize()) , new LambdaQueryWrapper() + .eq(CollectionUtil.isNotEmpty(deptCodes), PmsTerminalDetection::getOrgName, deptCodes) .eq(PmsTerminalDetection::getStatus, DataStateEnum.ENABLE.getCode()) -// .in(RMpWpPowerDetailQ::getMeasurementPointId, monitorIds) + .like(StrUtil.isNotBlank(param.getName()), PmsTerminalDetection::getName, param.getName()) .le(param.getType() != 0, PmsTerminalDetection::getNextInspectionTime, LocalDate.now()) -// .le(StrUtil.isNotBlank(param.getEndTime()), PmsTerminalDetection::getDataDate, param.getEndTime()) + .ge(StrUtil.isNotBlank(param.getStartTime()), PmsTerminalDetection::getInspectionTime, param.getStartTime()) + .le(StrUtil.isNotBlank(param.getEndTime()), PmsTerminalDetection::getInspectionTime, param.getEndTime()) + ); List rMpWpPowerDetailVOS2 = BeanUtil.copyToList(pageList.getRecords(), TerminalVO.class); @@ -131,7 +136,7 @@ public class PmsTerminalDetectionServiceImpl extends ServiceImpl data = new ArrayList<>(); - + //传入的文件格式(终端编号-检测报告.docx); for (int i = 0; i < files.length; i++) { detection = new PmsTerminalDetection(); //上传的文件名称