diff --git a/pom.xml b/pom.xml index f1078fd1b..76531d928 100644 --- a/pom.xml +++ b/pom.xml @@ -42,19 +42,19 @@ - 192.168.1.31 + 192.168.1.18 - 192.168.1.111 + 192.168.1.117 - 192.168.1.13 + 192.168.1.18 ${middle.server.url}:18848 - + - + a4165300-4f0e-4042-8a2a-e49ceba0644a ${middle.server.url}:8080 @@ -81,6 +81,7 @@ 2.1.3 1.2.5 8.0.19 + 2.4.0 21.6.0.0 21.1.0.0 3.4.2 diff --git a/pqs-device/device-boot/pom.xml b/pqs-device/device-boot/pom.xml index e068e8a2e..84f608761 100644 --- a/pqs-device/device-boot/pom.xml +++ b/pqs-device/device-boot/pom.xml @@ -19,18 +19,18 @@ - - - - - - com.njcn - pms-device-boot + pq-device-boot ${project.version} + + + + + + com.njcn common-swagger diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/DeviceInfoParam.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/DeviceInfoParam.java index 48511986a..ce6ea207e 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/DeviceInfoParam.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/param/DeviceInfoParam.java @@ -139,7 +139,7 @@ public class DeviceInfoParam implements Serializable { @ApiModelProperty("时间范围标志 0.查询展示天 1.查询展示月") private Integer timeFlag; - @ApiModelProperty("报表统计类型 1.年 2.季 3.月 4.周 5.天") + @ApiModelProperty("统计类型 1.年 2.季 3.月 4.周 5.天") private String reportFlag; } diff --git a/pqs-event/event-boot/pom.xml b/pqs-event/event-boot/pom.xml index f463f5194..717c68071 100644 --- a/pqs-event/event-boot/pom.xml +++ b/pqs-event/event-boot/pom.xml @@ -77,11 +77,11 @@ eventboot - + 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 1f453707d..c12183c0c 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 @@ -137,7 +137,9 @@ public class ReportController extends BaseController { @ApiOperation("监测点报告导出") @ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true) public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException { -// @RequestParam(name = "lineIndex") String lineIndex,@RequestParam(name = "startTime") String startTime,@RequestParam(name = "endTime") String endTime,@RequestParam("flag")Integer flag + reportService.getLineExport(exportParam,response); + + // @RequestParam(name = "lineIndex") String lineIndex,@RequestParam(name = "startTime") String startTime,@RequestParam(name = "endTime") String endTime,@RequestParam("flag")Integer flag // ExportParam exportParam = new ExportParam(); // exportParam.setFlag(flag); // exportParam.setXq(true); @@ -169,7 +171,7 @@ public class ReportController extends BaseController { // simpleDTO.setSort(0); // simpleDTO.setCode("Power_Network"); // exportParam.setStatisticalType(simpleDTO); - reportService.getLineExport(exportParam,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 7d6f6489c..5ef5013c0 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 @@ -37,6 +37,7 @@ import com.njcn.event.pojo.po.EventDetailNew; import com.njcn.event.pojo.po.Eventass; import com.njcn.event.pojo.vo.*; import com.njcn.event.service.majornetwork.EventAnalysisService; +import com.njcn.event.service.majornetwork.EventReportService; import com.njcn.event.service.majornetwork.ReportService; import com.njcn.event.utils.EchartsUtil; import com.njcn.event.utils.FreemarkerUtil; @@ -109,6 +110,7 @@ public class ReportServiceImpl implements ReportService { private final RestTemplate restTemplate; + private final EventReportService eventReportService; //调用暂降密度接口 private final EventAnalysisService eventAnalysisService; @@ -1042,254 +1044,274 @@ public class ReportServiceImpl implements ReportService { p.setAlignment(ParagraphAlignment.LEFT); createTitle(doc, "4. 总汇信息", "标题 1", 0, 15); + //查询参数 + StatisticsParam param = new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()); + //获取暂降原因字典 + List reasonData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData(); + //获取暂降类型字典 + List typeData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData(); + //influxdb查询结果(pqs_eventdetail表) + List info = info(param); + + //记录数 int i = 1; - //监测点信息 - if (exportParam.isXq()) { - createTitle(doc, "4." + i + " 监测点信息", "标题 2", 200, 15); + //1.监测点信息 + if (exportParam.isXq()){ + 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)) { + 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()); + 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++; } - //暂降事件列表 - if (exportParam.isLb()) { - createTitle(doc, "4." + i + " 暂降事件列表", "标题 2", 200, 15); - XWPFTable table = createTable(doc); - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - List plot = eventAnalysisService.getPlot(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); - insertRow(doc, table, centerParagraph, true, "序号", "暂降发生时刻", "暂降赋值(%)", "持续时间(s)", "暂降类型", "暂降原因", "严重度"); - for (int j = 0; j < plot.size(); j++) { - EventDetail eventDetail = plot.get(j); - long l = eventDetail.getTimeId().toEpochMilli(); - Date date1 = new Date(l); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - String s = simpleDateFormat.format(date1); - insertRow(doc, table, centerParagraph, false, j + 1 + "", s, eventDetail.getEventValue() + "", eventDetail.getPersistTime() / 1000.0 + "", eventDetail.getEventType(), eventDetail.getEventReason(), eventDetail.getSeverity() + ""); - } - i++; - } - //暂降事件点图 - if (exportParam.isSjdF47() || exportParam.isSjdITIC()) { - List detailList = eventAnalysisService.getPlot(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); - createTitle(doc, "4." + i + " 暂降事件点图", "标题 2", 200, 15); - int two = 1; - if (exportParam.isSjdITIC()) { - createTitle(doc, "4." + i + "." + two + " ITIC 曲线", "标题 3", 400, 15); - ArrayList> list = new ArrayList<>(); - for (EventDetail eventDetail : detailList) { - ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); - list.add(doubles); - } - String itic = getITIC(list); - createPic(doc, itic, "ITIC曲线"); - two++; - } - if (exportParam.isSjdF47()) { - createTitle(doc, "4." + i + "." + two + " F47 曲线", "标题 3", 400, 15); - ArrayList> list = new ArrayList<>(); - for (EventDetail eventDetail : detailList) { - ArrayList doubles = new ArrayList<>(); - doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + "")); - doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100))); - list.add(doubles); - } - String f47 = getF47(list); - createPic(doc, f47, "SEMI F47曲线"); - two++; - } - i++; - } - //暂降密度 - if (exportParam.isMdbg() || exportParam.isMdtx()) { - createTitle(doc, "4." + i + " 暂降密度", "标题 2", 200, 15); - int two = 1; - if (exportParam.isMdtx()) { - createTitle(doc, "4." + i + "." + two + " 暂降密度点图", "标题 3", 400, 15); - two++; - } - if (exportParam.isMdbg()) { + //2.暂降事件暂降事件列表和暂降点图 + //2.1.判断列表和点图是否是要导出 + if(exportParam.isLb()||exportParam.isSjdF47() || exportParam.isSjdITIC()){ +// List plot = eventAnalysisService.getPlot(param); + List plot = eventReportService.getPlot(info,reasonData,typeData); + //暂降事件列表 + if (exportParam.isLb()){ + createTitle(doc,"4."+i+" 暂降事件列表","标题 2",200,15); + XWPFTable table = createTable(doc); XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - createTitle(doc, "4." + i + "." + two + " DISDIP 表格:国际发配电联盟(UNIPEDE)", "标题 3", 400, 15); - List eventDisdip = eventAnalysisService.eventDisdip(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); + insertRow(doc,table,centerParagraph,true,"序号","暂降发生时刻","暂降赋值(%)","持续时间(s)","暂降类型","暂降原因","严重度"); + for (int j = 0; j < plot.size(); j++) { + EventDetail eventDetail = plot.get(j); + long l = eventDetail.getTimeId().toEpochMilli(); + Date date1 = new Date(l); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + String s = simpleDateFormat.format(date1); + insertRow(doc,table,centerParagraph,false,j+1+"",s,eventDetail.getEventValue()+"",eventDetail.getPersistTime()/1000.0+"",eventDetail.getEventType(),eventDetail.getEventReason(),eventDetail.getSeverity()+""); + } + i++; + } + //暂降事件点图 + if (exportParam.isSjdF47() || exportParam.isSjdITIC()){ + ArrayList> ass = getAss(plot); + createTitle(doc,"4."+i+" 暂降事件点图","标题 2",200,15); + int two = 1; + if (exportParam.isSjdITIC()){ + createTitle(doc,"4."+i+"."+two+" ITIC 曲线","标题 3",400,15); + String itic = getITIC(ass); + createPic(doc,itic,"ITIC曲线"); + two++; + } + if (exportParam.isSjdF47()){ + createTitle(doc,"4."+i+"."+two+" F47 曲线","标题 3",400,15); + String f47 = getF47(ass); + createPic(doc,f47,"SEMI F47曲线"); + two++; + } + i++; + } + } + + + //3.暂降密度 + if (exportParam.isMdbg() || exportParam.isMdtx()){ + createTitle(doc,"4."+i+" 暂降密度","标题 2",200,15); + int two = 1; + if (exportParam.isMdtx()){ + createTitle(doc,"4."+i+"."+two+" 暂降密度点图","标题 3",400,15); + two++; + } + if (exportParam.isMdbg()){ + XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); + createTitle(doc,"4."+i+"."+two+" DISDIP 表格:国际发配电联盟(UNIPEDE)","标题 3",400,15); +// List eventDisdip = eventAnalysisService.eventDisdip(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); + List eventDisdip = eventReportService.eventDisdip(info); + XWPFTable table1 = createTable(doc); - insertRow(doc, table1, centerParagraph, true, "剩余电压", "20ms", "100ms", "500ms", "1s", "3s", "20s", "60s", "180s"); + insertRow(doc,table1,centerParagraph,true,"剩余电压","20ms","100ms","500ms","1s","3s","20s","60s","180s"); for (int j = 0; j < eventDisdip.size(); j++) { DISDIPVO disdipvo = eventDisdip.get(j); - insertRow(doc, table1, centerParagraph, false, disdipvo.getName(), disdipvo.getTwentyMs(), disdipvo.getOneHundredMs(), disdipvo.getFiveHundredMs(), disdipvo.getOneS(), disdipvo.getThreeS(), disdipvo.getTwentyS(), disdipvo.getSixtyS(), disdipvo.getOneEightyS()); + insertRow(doc,table1,centerParagraph,false,disdipvo.getName(),disdipvo.getTwentyMs(),disdipvo.getOneHundredMs(),disdipvo.getFiveHundredMs(),disdipvo.getOneS(),disdipvo.getThreeS(),disdipvo.getTwentyS(),disdipvo.getSixtyS(),disdipvo.getOneEightyS()); } two++; - createTitle(doc, "4." + i + "." + two + " IEC 61000-4-11:(用电终端的电压暂降抗度)", "标题 3", 400, 15); - List iec411VOS = eventAnalysisService.IEC411(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); + createTitle(doc,"4."+i+"."+two+" IEC 61000-4-11:(用电终端的电压暂降抗度)","标题 3",400,15); +// List iec411VOS = eventAnalysisService.IEC411(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); + List iec411VOS = eventReportService.IEC411(info); XWPFTable table2 = createTable(doc); - insertRow(doc, table2, centerParagraph, true, "剩余电压", "10~20ms", "20~100ms", "0.1~0.2s", "0.2~0.5s", "0.5~1s", ">1s"); + insertRow(doc,table2,centerParagraph,true,"剩余电压","10~20ms","20~100ms","0.1~0.2s","0.2~0.5s","0.5~1s",">1s"); for (int j = 0; j < iec411VOS.size(); j++) { IEC411VO iec411VO = iec411VOS.get(j); - insertRow(doc, table2, centerParagraph, false, iec411VO.getName(), iec411VO.getTenTwentyMs(), iec411VO.getTwentyOneHundredMs(), iec411VO.getZeroPiontOneTwoS(), iec411VO.getZeroPiontTwoFiveS(), iec411VO.getZeroPiontFive1S(), iec411VO.getGreater1S()); + insertRow(doc,table2,centerParagraph,false,iec411VO.getName(),iec411VO.getTenTwentyMs(),iec411VO.getTwentyOneHundredMs(),iec411VO.getZeroPiontOneTwoS(),iec411VO.getZeroPiontTwoFiveS(),iec411VO.getZeroPiontFive1S(),iec411VO.getGreater1S()); } two++; - createTitle(doc, "4." + i + "." + two + " IEC 61000-2-8:(公共电网电压暂降测量统计)", "标题 3", 400, 15); - List iec28VOS = eventAnalysisService.IEC28(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); + createTitle(doc,"4."+i+"."+two+" IEC 61000-2-8:(公共电网电压暂降测量统计)","标题 3",400,15); +// List iec28VOS = eventAnalysisService.IEC28(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); + List iec28VOS = eventReportService.IEC28(info); XWPFTable table3 = createTable(doc); - insertRow(doc, table3, centerParagraph, true, "剩余电压", "0.02~0.1s", "0.1~0.25s", "0.25~0.5s", "0.5s~1s", "1~3s", "3~20s", "20~60s", "60~180s"); + insertRow(doc,table3,centerParagraph,true,"剩余电压","0.02~0.1s","0.1~0.25s","0.25~0.5s","0.5s~1s","1~3s","3~20s","20~60s","60~180s"); for (int j = 0; j < iec28VOS.size(); j++) { IEC28VO iec28VO = iec28VOS.get(j); - insertRow(doc, table3, centerParagraph, false, iec28VO.getName(), iec28VO.getQ(), iec28VO.getW(), iec28VO.getE(), iec28VO.getR(), iec28VO.getT(), iec28VO.getY(), iec28VO.getU(), iec28VO.getI()); + insertRow(doc,table3,centerParagraph,false,iec28VO.getName(),iec28VO.getQ(),iec28VO.getW(),iec28VO.getE(),iec28VO.getR(),iec28VO.getT(),iec28VO.getY(),iec28VO.getU(),iec28VO.getI()); } two++; } i++; } - //暂降幅值概率分布 - if (exportParam.isGlfbfz() || exportParam.isGlfbsj()) { - createTitle(doc, "4." + i + " 暂降幅值概率分布图", "标题 2", 200, 15); - ProbabilityVO probabilityVO = eventAnalysisService.getProbabilityDistribution(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); + //4.暂降幅值概率分布 + if (exportParam.isGlfbfz() || exportParam.isGlfbsj()){ + createTitle(doc,"4."+i+" 暂降幅值概率分布图","标题 2",200,15); +// ProbabilityVO probabilityVO = eventAnalysisService.getProbabilityDistribution(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); + ProbabilityVO probabilityVO = eventReportService.getProbabilityDistribution(info); int two = 1; - if (exportParam.isGlfbfz()) { - createTitle(doc, "4." + i + "." + two + " 暂降幅值的概率分函数", "标题 3", 400, 15); + if (exportParam.isGlfbfz()){ + createTitle(doc,"4."+i+"."+two+" 暂降幅值的概率分函数","标题 3",400,15); List ybardata = probabilityVO.getPereventvalue(); List ylinedata = probabilityVO.getEventvalue(); String fz = getFZ(ylinedata, ybardata); - createPic(doc, fz, "暂降幅值的概率分布函数"); + createPic(doc,fz,"暂降幅值的概率分布函数"); two++; } - if (exportParam.isGlfbsj()) { - createTitle(doc, "4." + i + "." + two + " 持续时间的概率分函数", "标题 3", 400, 15); + if (exportParam.isGlfbsj()){ + createTitle(doc,"4."+i+"."+two+" 持续时间的概率分函数","标题 3",400,15); List ybardata = probabilityVO.getPersisttime(); List ylinedata = probabilityVO.getSisttime(); String sj = getSJ(ylinedata, ybardata); - createPic(doc, sj, "持续时间的概率分布函数"); + createPic(doc,sj,"持续时间的概率分布函数"); two++; } i++; } - //月份统计 - if (exportParam.isTjbg() || exportParam.isTjtx()) { - createTitle(doc, "4." + i + " 月份统计", "标题 2", 200, 15); + + + //5.月份统计 + if (exportParam.isTjbg() || exportParam.isTjtx()){ + createTitle(doc,"4."+i+" 月份统计","标题 2",200,15); int two = 1; - List reasonTypeTime = eventAnalysisService.getReasonTypeTime(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); - if (exportParam.isTjtx()) { - createTitle(doc, "4." + i + "." + two + " 月份统计图", "标题 3", 400, 15); + List reasonTypeTime = eventAnalysisService.getReasonTypeTime(param); + //暂时时间端按月查询不能查询 +// List reasonTypeTime = eventReportService.getReasonTypeTime(param,null); + if (exportParam.isTjtx()){ + createTitle(doc,"4."+i+"."+two+" 月份统计图","标题 3",400,15); List count = new ArrayList<>(); List name = new ArrayList<>(); - if (exportParam.getFlag() == 0) { + if (exportParam.getFlag()==0){ for (TimeVO timeVO : reasonTypeTime) { - name.add(timeVO.getMonth() + ""); + name.add(timeVO.getMonth()+""); count.add(Integer.parseInt(timeVO.getTimes())); } - } else { + }else { for (TimeVO timeVO : reasonTypeTime) { - name.add(timeVO.getDay() + ""); + name.add(timeVO.getDay()+""); count.add(Integer.parseInt(timeVO.getTimes())); } } - String yftj = getYFTJ(name, count, reasonTypeTime.get(0).getYear(), exportParam.getFlag()); - createPic(doc, yftj, "月份统计图"); + String yftj = getYFTJ(name, count, reasonTypeTime.get(0).getYear(),exportParam.getFlag()); + createPic(doc,yftj,"月份统计图"); two++; } - if (exportParam.isTjbg()) { + if (exportParam.isTjbg()){ XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - createTitle(doc, "4." + i + "." + two + " 时间统计表格", "标题 3", 400, 15); + createTitle(doc,"4."+i+"."+two+" 时间统计表格","标题 3",400,15); XWPFTable table1 = createTable(doc); - if (exportParam.getFlag() == 0) { - insertRow(doc, table1, centerParagraph, true, "时间(月)", "电压暂降次数"); - } else { - insertRow(doc, table1, centerParagraph, true, "时间(天)", "电压暂降次数"); + if (exportParam.getFlag() == 0){ + insertRow(doc,table1,centerParagraph,true,"时间(月)","电压暂降次数"); + }else { + insertRow(doc,table1,centerParagraph,true,"时间(天)","电压暂降次数"); } - if (exportParam.getFlag() == 0) { + if (exportParam.getFlag()==0){ for (int j = 0; j < reasonTypeTime.size(); j++) { TimeVO timeVO = reasonTypeTime.get(j); - insertRow(doc, table1, centerParagraph, false, timeVO.getMonth(), timeVO.getTimes()); + insertRow(doc,table1,centerParagraph,false,timeVO.getMonth(),timeVO.getTimes()); } - } else { + }else { for (int j = 0; j < reasonTypeTime.size(); j++) { TimeVO timeVO = reasonTypeTime.get(j); - insertRow(doc, table1, centerParagraph, false, timeVO.getDay(), timeVO.getTimes()); + insertRow(doc,table1,centerParagraph,false,timeVO.getDay(),timeVO.getTimes()); } } two++; } i++; } - //原因统计 - if (exportParam.isYybg() || exportParam.isYytx()) { - createTitle(doc, "4." + i + " 原因统计", "标题 2", 200, 15); - StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); - int two = 1; - if (exportParam.isYytx()) { - createTitle(doc, "4." + i + "." + two + " 原因统计图", "标题 3", 400, 15); - List xdata = new ArrayList<>(); - List reason = statistic.getReason(); - for (ReasonsVO reasonsVO : reason) { - xdata.add(reasonsVO.getReason()); - } - String tr = getR(xdata, reason, "bar9.ftl"); - createPic(doc, tr, "暂降原因图"); - two++; - } - if (exportParam.isYybg()) { - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - createTitle(doc, "4." + i + "." + two + " 原因统计表格", "标题 3", 400, 15); - XWPFTable table1 = createTable(doc); - insertRow(doc, table1, centerParagraph, true, "暂降原因", "电压暂降次数"); - List reason = statistic.getReason(); - for (int j = 0; j < reason.size(); j++) { - ReasonsVO reasonsVO = reason.get(j); - insertRow(doc, table1, centerParagraph, false, reasonsVO.getReason(), reasonsVO.getTimes() + ""); - } - two++; - } - i++; - } - //类型统计 - if (exportParam.isLxbg() || exportParam.isLxtx()) { - createTitle(doc, "4." + i + " 类型统计", "标题 2", 200, 15); - StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag())); - int two = 1; - if (exportParam.isLxtx()) { - createTitle(doc, "4." + i + "." + two + " 类型统计图", "标题 3", 400, 15); - List xdata = new ArrayList<>(); - List types = statistic.getTypes(); - for (TypesVO type : types) { - if (type.getTimes() > 0) { - xdata.add(type.getType()); + + + //6.原因统计 + //6.1整合提出查询语句 + Boolean fly=exportParam.isYybg() || exportParam.isYytx()||exportParam.isLxbg() || exportParam.isLxtx(); + if(fly){ + StatisticVO statistic = eventReportService.getStatistic(info,reasonData,typeData); + if (exportParam.isYybg() || exportParam.isYytx()){ + createTitle(doc,"4."+i+" 原因统计","标题 2",200,15); +// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); + int two = 1; + if (exportParam.isYytx()){ + createTitle(doc,"4."+i+"."+two+" 原因统计图","标题 3",400,15); + List xdata = new ArrayList<>(); + List reason = statistic.getReason(); + for (ReasonsVO reasonsVO : reason) { + xdata.add(reasonsVO.getReason()); } + String tr = getR(xdata, reason,"bar9.ftl"); + createPic(doc,tr,"暂降原因图"); + two++; } - String tr = getT(xdata, types, "bar8.ftl"); - createPic(doc, tr, "暂降类型图"); - two++; - } - if (exportParam.isLxbg()) { - createTitle(doc, "4." + i + "." + two + " 类型统计表格", "标题 3", 400, 15); - XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - XWPFTable table1 = createTable(doc); - insertRow(doc, table1, centerParagraph, true, "暂降原因", "电压暂降次数"); - List types = statistic.getTypes(); - for (int j = 0; j < types.size(); j++) { - TypesVO typesVO = types.get(j); - insertRow(doc, table1, centerParagraph, false, typesVO.getType(), typesVO.getTimes() + ""); + if (exportParam.isYybg()){ + XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); + createTitle(doc,"4."+i+"."+two+" 原因统计表格","标题 3",400,15); + XWPFTable table1 = createTable(doc); + insertRow(doc,table1,centerParagraph,true,"暂降原因","电压暂降次数"); + List reason = statistic.getReason(); + for (int j = 0; j < reason.size(); j++) { + ReasonsVO reasonsVO = reason.get(j); + insertRow(doc,table1,centerParagraph,false,reasonsVO.getReason(),reasonsVO.getTimes()+""); + } + two++; } - two++; + i++; + } + //7.类型统计 + if (exportParam.isLxbg() || exportParam.isLxtx()){ + createTitle(doc,"4."+i+" 类型统计","标题 2",200,15); +// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag())); + int two = 1; + if (exportParam.isLxtx()){ + createTitle(doc,"4."+i+"."+two+" 类型统计图","标题 3",400,15); + List xdata = new ArrayList<>(); + List types = statistic.getTypes(); + for (TypesVO type : types) { + if (type.getTimes()>0){ + xdata.add(type.getType()); + } + } + String tr = getT(xdata, types, "bar8.ftl"); + createPic(doc,tr,"暂降类型图"); + two++; + } + if (exportParam.isLxbg()){ + createTitle(doc,"4."+i+"."+two+" 类型统计表格","标题 3",400,15); + XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); + XWPFTable table1 = createTable(doc); + insertRow(doc,table1,centerParagraph,true,"暂降原因","电压暂降次数"); + List types = statistic.getTypes(); + for (int j = 0; j < types.size(); j++) { + TypesVO typesVO = types.get(j); + insertRow(doc,table1,centerParagraph,false,typesVO.getType(),typesVO.getTimes()+""); + } + two++; + } + i++; } - i++; } + ServletOutputStream outputStream = response.getOutputStream(); String fileName = URLEncoder.encode(exportParam.getLineName() + ".docx", "UTF-8"); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); @@ -1298,7 +1320,46 @@ public class ReportServiceImpl implements ReportService { outputStream.close(); } - public String getStr(String barName, Map map) throws TemplateException, IOException { + /** + * 监测点暂降事件点图赋值 + * @param plot + * @return + */ + private ArrayList> getAss(List plot){ + ArrayList> list = new ArrayList<>(); + for (EventDetail eventDetail : plot) { + ArrayList doubles = new ArrayList<>(); + doubles.add(Double.parseDouble(eventDetail.getPersistTime()/1000+"")); + doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue()*100))); + list.add(doubles); + } + return list; + } + + /** + * influxdb查询结果集 + * @param statisticsParam + * @return + */ + private List info (StatisticsParam statisticsParam){ + //构建sql语句 + StringBuffer stringResult=new StringBuffer(); + stringResult.append(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE) + .append("time >= '").append( DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))+"'") + .append(" and time <= '").append(DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getEndTime()))+"'") + .append(" and line_id = '").append(statisticsParam.getLineIndex()+"'") + .append(" and wave_type = 5 ").append(Param.TZ_ASIA_SHANGHAI); + //结果集映射到对象中 + System.out.println(stringResult); + QueryResult query = influxDbUtils.query(stringResult.toString()); + InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); + return influxDBResultMapper.toPOJO(query, EventDetail.class); + } + + + + + public String getStr(String barName,Map map) throws TemplateException, IOException { String s = FreemarkerUtil.generateString(barName, "com/njcn/event/template", map); return EchartsUtil.generateEchartsBase64(s, "8910"); } @@ -2496,7 +2557,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.CENTER); XWPFRun r1 = p.createRun();//创建段落文本 - r1.setText("电压" + typeName + "事件区域报告"); + r1.setText("电压"+typeName+"事件区域报告"); r1.setBold(true);//设置为粗体 r1.setFontSize(36);//字体大小 r1.addBreak(); @@ -2528,7 +2589,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.CENTER); XWPFRun r3 = p.createRun();//创建段落文本 - r3.setText("电压" + typeName + "事件区域报告"); + r3.setText("电压"+typeName+"事件区域报告"); r3.setFontSize(24);//字体大小 @@ -2539,7 +2600,7 @@ public class ReportServiceImpl implements ReportService { p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r5 = p.createRun();//创建段落文本 r5.setText(" 中国电网总共有" + size + "个监测点。中国电网在所选择时间段" + areaReportParam.getSearchBeginTime() + " 至 " + areaReportParam.getSearchEndTime() + - "累计监测到" + typeName + "事件" + eventCount + "条,本报告按照监测点分布," + typeName + "事件统计," + typeName + "事件点图," + typeName + "热力图," + typeName + "密度图," + typeName + "概率分布图,事件关联统计," + typeName + "类型统计," + typeName + "原因统计等方面进行数据分析。"); + "累计监测到"+typeName+"事件" + eventCount + "条,本报告按照监测点分布,"+typeName+"事件统计,"+typeName+"事件点图,"+typeName+"热力图,"+typeName+"密度图,"+typeName+"概率分布图,事件关联统计,"+typeName+"类型统计,"+typeName+"原因统计等方面进行数据分析。"); r5.setFontSize(11);//字体大小 @@ -3178,17 +3239,17 @@ public class ReportServiceImpl implements ReportService { oneCount5 = oneCount; - createTitle(doc, "4." + oneCount + " " + typeName + "事件列表", "标题 2", 200, 11); + createTitle(doc, "4." + oneCount + " "+typeName+"事件列表", "标题 2", 200, 11); p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" 中国电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + "" + typeName + "事件居多," + - "第" + dayOfMonth + "" + table + "" + typeName + "事件居多,具体见下表(图):"); + r12.setText(" 中国电网在所选择的分析时间段内累计监测"+typeName+"记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + ""+typeName+"事件居多," + + "第" + dayOfMonth + "" + table + ""+typeName+"事件居多,具体见下表(图):"); r12.setFontSize(11);//字体大小 - createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "事件表格", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount + "." + twoCount + " "+typeName+"事件表格", "标题 3", 400, 11); twoCount2 = twoCount; @@ -3197,7 +3258,7 @@ public class ReportServiceImpl implements ReportService { XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); // 表格第一行 - insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "区域", "电压" + typeName + "次数"); + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "区域", "电压"+typeName+"次数"); //塞入数据 @@ -3210,7 +3271,7 @@ public class ReportServiceImpl implements ReportService { XWPFParagraph monitorInfoExcelParagraph1 = WordUtils.getCenterParagraph(doc); // 表格第一行 - insertRow(doc, monitorInfo1, monitorInfoExcelParagraph1, true, "电压等级", "电压" + typeName + "次数"); + insertRow(doc, monitorInfo1, monitorInfoExcelParagraph1, true, "电压等级", "电压"+typeName+"次数"); //塞入数据 @@ -3223,7 +3284,7 @@ public class ReportServiceImpl implements ReportService { XWPFParagraph monitorInfoExcelParagraph2 = WordUtils.getCenterParagraph(doc); // 表格第一行 - insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, true, "" + table + "", "电压" + typeName + "次数"); + insertRow(doc, monitorInfo2, monitorInfoExcelParagraph2, true, "" + table + "", "电压"+typeName+"次数"); //塞入数据 @@ -3782,7 +3843,7 @@ public class ReportServiceImpl implements ReportService { */ if (areaReportParam.isEventCountTable()) { twoCount2++; - createTitle(doc, "4." + oneCount5 + "." + twoCount2 + " " + typeName + "事件图形", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount5 + "." + twoCount2 + " "+typeName+"事件图形", "标题 3", 400, 11); //创建部门与监测点次数的map集合 @@ -3807,7 +3868,7 @@ public class ReportServiceImpl implements ReportService { } String qytj = getQYTJ(xdata, ydata); - createPic(doc, qytj, "" + typeName + "事件图形"); + createPic(doc, qytj, ""+typeName+"事件图形"); //月份统计 @@ -3828,7 +3889,8 @@ public class ReportServiceImpl implements ReportService { tableList.add(table); String yftj = getYFTJ1(xdata1, ydata1, ydata2, year, tableList); - createPic(doc, yftj, "" + typeName + "事件图形"); + createPic(doc, yftj, ""+typeName+"事件图形"); + //创建部门与监测点次数的map集合 @@ -3852,7 +3914,7 @@ public class ReportServiceImpl implements ReportService { ydata3.add(Integer.parseInt(reportCountParam.getCount())); } String dydj = getDYDJ(xdata3, ydata3); - createPic(doc, dydj, "" + typeName + "事件图形"); + createPic(doc, dydj, ""+typeName+"事件图形"); /** @@ -3864,17 +3926,17 @@ public class ReportServiceImpl implements ReportService { int twoCount = 1; - createTitle(doc, "4." + oneCount + " " + typeName + "事件列表", "标题 2", 200, 11); + createTitle(doc, "4." + oneCount + " "+typeName+"事件列表", "标题 2", 200, 11); p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 - r12.setText(" 中国电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + "" + typeName + "事件居多," + - "第" + dayOfMonth + "" + table + "" + typeName + "事件居多,具体见下表(图):"); + r12.setText(" 中国电网在所选择的分析时间段内累计监测"+typeName+"记录" + eventCount + "条," + topVoltageList.get(0) + "、" + topVoltageList.get(1) + ""+typeName+"事件居多," + + "第" + dayOfMonth + "" + table + ""+typeName+"事件居多,具体见下表(图):"); r12.setFontSize(11);//字体大小 - createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "事件图形", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount + "." + twoCount + " "+typeName+"事件图形", "标题 3", 400, 11); //创建部门与监测点次数的map集合 @@ -3899,7 +3961,7 @@ public class ReportServiceImpl implements ReportService { } String qytj = getQYTJ(xdata, ydata); - createPic(doc, qytj, "" + typeName + "事件图形"); + createPic(doc, qytj, ""+typeName+"事件图形"); //月份统计 @@ -3920,7 +3982,8 @@ public class ReportServiceImpl implements ReportService { tableList.add(table); String yftj = getYFTJ1(xdata1, ydata1, ydata2, year, tableList); - createPic(doc, yftj, "" + typeName + "事件图形"); + createPic(doc, yftj, ""+typeName+"事件图形"); + //创建部门与监测点次数的map集合 @@ -3946,7 +4009,7 @@ public class ReportServiceImpl implements ReportService { String dydj = getDYDJ(xdata3, ydata3); - createPic(doc, dydj, "" + typeName + "事件图形"); + createPic(doc, dydj, ""+typeName+"事件图形"); //序号计数进行++ @@ -5337,13 +5400,13 @@ public class ReportServiceImpl implements ReportService { //同步给暂降密度图 oneCount4 = oneCount; - createTitle(doc, "4." + oneCount + " " + typeName + "密度", "标题 2", 200, 11); + 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.setText(" "+typeName+"密度统计可以从幅值和持续时间两个维度直接地反映"+typeName+"事件发生情况,主要反应事件的发生次数," + + "中国电网在所选择的分析时间内"+typeName+"事件主要集中在幅值为" + resultList.get(0) + ",持续时间为" + resultList.get(2) + "[根据 IEC 61000-2-8:(公共电网电压"+typeName+"测量统计)算出"+typeName+"事件发生最多的区间],具体见表(图):"); r12.setFontSize(11);//字体大小 @@ -5367,7 +5430,7 @@ public class ReportServiceImpl implements ReportService { twoCount++; - createTitle(doc, "4." + oneCount + "." + twoCount + " IEC 61000-4-11:(用电终端的电压" + typeName + "抗度)", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount + "." + twoCount + " IEC 61000-4-11:(用电终端的电压"+typeName+"抗度)", "标题 3", 400, 11); //第二张表 XWPFTable monitorInfo1 = createTable(doc); @@ -5386,7 +5449,7 @@ public class ReportServiceImpl implements ReportService { twoCount++; - createTitle(doc, "4." + oneCount + "." + twoCount + " IEC 61000-2-8:(公共电网电压" + typeName + "测量统计)", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount + "." + twoCount + " IEC 61000-2-8:(公共电网电压"+typeName+"测量统计)", "标题 3", 400, 11); //第二张表 XWPFTable monitorInfo2 = createTable(doc); @@ -6789,24 +6852,24 @@ public class ReportServiceImpl implements ReportService { twoCount1++; //如果幅值图存在与幅值的序号保持同步 - createTitle(doc, "4." + oneCount4 + "." + twoCount1 + " " + typeName + "密度图", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount4 + "." + twoCount1 + " "+typeName+"密度图", "标题 3", 400, 11); //代码 } else { int twoCount = 1; - createTitle(doc, "4." + oneCount + " " + typeName + "密度", "标题 2", 200, 11); + 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.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); + createTitle(doc, "4." + oneCount + "." + twoCount + " "+typeName+"密度图", "标题 3", 400, 11); //代码 @@ -6866,12 +6929,12 @@ public class ReportServiceImpl implements ReportService { oneCount3 = oneCount; - createTitle(doc, "4." + oneCount3 + " " + typeName + "事件点图", "标题 2", 200, 11); + 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.setText(" "+typeName+"事件点图统计分成ITIC曲线和F47曲线展示。"); r12.setFontSize(11);//字体大小 @@ -6880,7 +6943,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r13 = p.createRun();//创建段落文本 - r13.setText(" ITIC曲线中可容忍" + typeName + "记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); + r13.setText(" ITIC曲线中可容忍"+typeName+"记录为:" + result.get(0) + "条;不可容忍"+typeName+"记录为:" + result.get(1) + "条,具体见下表(图):"); r13.setFontSize(11);//字体大小 @@ -6950,7 +7013,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r13 = p.createRun();//创建段落文本 - r13.setText(" F47曲线中可容忍" + typeName + "记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); + r13.setText(" F47曲线中可容忍"+typeName+"记录为:" + result.get(0) + "条;不可容忍"+typeName+"记录为:" + result.get(1) + "条,具体见下表(图):"); r13.setFontSize(11);//字体大小 @@ -6966,12 +7029,12 @@ public class ReportServiceImpl implements ReportService { oneCount3 = oneCount; - createTitle(doc, "4." + oneCount + " " + typeName + "事件点图", "标题 2", 200, 11); + 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.setText(" "+typeName+"事件点图统计分成ITIC曲线和F47曲线展示。"); r12.setFontSize(11);//字体大小 @@ -6980,7 +7043,7 @@ public class ReportServiceImpl implements ReportService { p = doc.createParagraph();// 新建一个段落 p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r13 = p.createRun();//创建段落文本 - r13.setText(" F47曲线中可容忍" + typeName + "降记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); + r13.setText(" F47曲线中可容忍"+typeName+"降记录为:" + result.get(0) + "条;不可容忍"+typeName+"记录为:" + result.get(1) + "条,具体见下表(图):"); r13.setFontSize(11);//字体大小 @@ -7102,23 +7165,23 @@ public class ReportServiceImpl implements ReportService { oneCount2 = oneCount; - createTitle(doc, "4." + oneCount2 + " " + typeName + "幅值概率分布图", "标题 2", 200, 11); + 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.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); + 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 + "幅值的概率分布函数"); + createPic(doc, fz, ""+typeName+"幅值的概率分布函数"); //序号计数进行++ @@ -7248,13 +7311,13 @@ public class ReportServiceImpl implements ReportService { } else { - createTitle(doc, "4." + oneCount2 + " " + typeName + "幅值概率分布图", "标题 2", 200, 11); + 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.setText(" "+typeName+"概率分布图分成"+typeName+"幅值概率分布和持续时间概率分布图,中国电网在所选择的分析时间内"+typeName+"事件从幅值概率分布统计主要集中在幅值为" + amplitudeResult.get(0) + "~" + amplitudeResult.get(1) + "之间," + + "从持续时间统计主要集中在持续时间为" + amplitudeResult1.get(0) + "~" + amplitudeResult1.get(1) + "[持续时间排序,选择"+typeName+"记录发生最多的区域],如下表(图):"); r12.setFontSize(11);//字体大小 @@ -7361,7 +7424,7 @@ public class ReportServiceImpl implements ReportService { p.setAlignment(ParagraphAlignment.BOTH); XWPFRun r12 = p.createRun();//创建段落文本 //归一化需要高级算法,先字符串代替 - r12.setText(" 中国电网在所选择的分析时间段内累计监测" + typeName + "记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:"); + r12.setText(" 中国电网在所选择的分析时间段内累计监测"+typeName+"记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:"); r12.setFontSize(11);//字体大小 @@ -7519,7 +7582,7 @@ public class ReportServiceImpl implements ReportService { XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); // 表格第一行 - insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "暂态类型", "电压" + typeName + "次数"); + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "暂态类型", "电压"+typeName+"次数"); //塞入数据 @@ -7672,7 +7735,7 @@ public class ReportServiceImpl implements ReportService { String tr = getR(xdata, reason, "bar9.ftl"); - createPic(doc, tr, "" + typeName + "原因图"); + createPic(doc, tr, ""+typeName+"原因图"); } else { @@ -7711,7 +7774,7 @@ public class ReportServiceImpl implements ReportService { String tr = getR(xdata, reason, "bar9.ftl"); - createPic(doc, tr, "" + typeName + "原因图"); + createPic(doc, tr, ""+typeName+"原因图"); //序号计数进行++ oneCount++; @@ -7852,7 +7915,7 @@ public class ReportServiceImpl implements ReportService { XWPFParagraph monitorInfoExcelParagraph = WordUtils.getCenterParagraph(doc); // 表格第一行 - insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "暂态类型", "电压" + typeName + "次数"); + insertRow(doc, monitorInfo, monitorInfoExcelParagraph, true, "暂态类型", "电压"+typeName+"次数"); //塞入数据 @@ -8002,7 +8065,7 @@ public class ReportServiceImpl implements ReportService { } String tr = getT(xdata, types, "bar8.ftl"); - createPic(doc, tr, "" + typeName + "类型图"); + createPic(doc, tr, ""+typeName+"类型图"); } else { //创建表题计数 @@ -8037,7 +8100,7 @@ public class ReportServiceImpl implements ReportService { } String tr = getT(xdata, types, "bar8.ftl"); - createPic(doc, tr, "" + typeName + "类型图"); + createPic(doc, tr, ""+typeName+"类型图"); //序号计数进行++ oneCount++; 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 911e26c1b..14d432897 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 @@ -3,12 +3,11 @@ package com.njcn.event.service.majornetwork; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.event.pojo.param.*; -import com.njcn.event.pojo.vo.DetailVO; -import com.njcn.event.pojo.vo.GeneralVO; -import com.njcn.event.pojo.vo.ReasonsVO; -import com.njcn.event.pojo.vo.WaveTypeVO; +import com.njcn.event.pojo.po.EventDetail; +import com.njcn.event.pojo.vo.*; import freemarker.template.TemplateException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.influxdb.dto.QueryResult; import javax.servlet.http.HttpServletResponse; import java.io.FileNotFoundException; @@ -58,4 +57,5 @@ public interface ReportService { void getAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception; + }