From 2f4d0be940f570ced4738a37a3338461355229dd Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Tue, 6 Jun 2023 16:41:15 +0800 Subject: [PATCH] =?UTF-8?q?=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 --- .../majornetwork/EventReportService.java | 6 + .../Impl/EventReportServiceImpl.java | 220 ++++++++++++++++++ .../majornetwork/Impl/ReportServiceImpl.java | 10 +- .../src/main/resources/templates/bar10.ftl | 149 ++++++++++++ 4 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 pqs-event/event-boot/src/main/resources/templates/bar10.ftl diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventReportService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventReportService.java index 518f5cebd..0c6a363ec 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventReportService.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventReportService.java @@ -69,4 +69,10 @@ public interface EventReportService { */ StatisticVO getStatistic(List info,List reasonData,ListtypeData); + /** + * 获取密度点图 + * @param info + * @return + */ + List getCoords(List info); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java index 3d45b8fb6..ec9f6dd80 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventReportServiceImpl.java @@ -1002,6 +1002,226 @@ public class EventReportServiceImpl implements EventReportService { return result; } + @Override + public List getCoords(List info) { + List result = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 9; j++) { + result.add(new CoordsVO(i, j, 0)); + } + } + for (int i = 0; i < info.size(); i++) { + Integer index = null; + CoordsVO dto = new CoordsVO(); + if (info.get(i).getFeatureAmplitude() >= 0 && info.get(i).getFeatureAmplitude() <= 0.1) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 0; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 1; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 2; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 3; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 4; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 5; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 6; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 7; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 8; + } + } else if (info.get(i).getFeatureAmplitude() > 0.1 && info.get(i).getFeatureAmplitude() <= 0.2) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 9; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 10; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 11; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 12; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 13; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 14; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 15; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 16; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 17; + } + } else if (info.get(i).getFeatureAmplitude() > 0.2 && info.get(i).getFeatureAmplitude() <= 0.3) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 18; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 19; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 20; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 21; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 22; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 23; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 24; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 25; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 26; + } + } else if (info.get(i).getFeatureAmplitude() > 0.3 && info.get(i).getFeatureAmplitude() <= 0.4) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 27; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 28; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 29; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 30; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 31; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 32; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 33; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 34; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 35; + } + } else if (info.get(i).getFeatureAmplitude() > 0.4 && info.get(i).getFeatureAmplitude() <= 0.5) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 36; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 37; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 38; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 39; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 40; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 41; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 42; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 43; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 44; + } + } else if (info.get(i).getFeatureAmplitude() > 0.5 && info.get(i).getFeatureAmplitude() <= 0.6) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 45; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 46; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 47; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 48; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 49; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 50; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 51; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 52; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 53; + } + } else if (info.get(i).getFeatureAmplitude() > 0.6 && info.get(i).getFeatureAmplitude() <= 0.7) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 54; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 55; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 56; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 57; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 58; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 59; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 60; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 61; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 62; + } + } else if (info.get(i).getFeatureAmplitude() > 0.7 && info.get(i).getFeatureAmplitude() <= 0.8) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 63; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 64; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 65; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 66; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 67; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 68; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 69; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 70; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 71; + } + } else if (info.get(i).getFeatureAmplitude() > 0.8 && info.get(i).getFeatureAmplitude() <= 0.9) { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 72; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 73; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 74; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 75; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 76; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 77; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 78; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 79; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 80; + } + } else { + if (info.get(i).getDuration() / 1000 > 0 && info.get(i).getDuration() / 1000 <= 0.020) { + index = 81; + } else if (info.get(i).getDuration() / 1000 <= 0.040 && info.get(i).getDuration() / 1000 > 0.020) { + index = 82; + } else if (info.get(i).getDuration() / 1000 <= 0.060 && info.get(i).getDuration() / 1000 > 0.040) { + index = 83; + } else if (info.get(i).getDuration() / 1000 <= 0.080 && info.get(i).getDuration() / 1000 > 0.060) { + index = 84; + } else if (info.get(i).getDuration() / 1000 <= 0.120 && info.get(i).getDuration() / 1000 > 0.080) { + index = 85; + } else if (info.get(i).getDuration() / 1000 > 0.120 && info.get(i).getDuration() / 1000 < 0.200) { + index = 86; + } else if (info.get(i).getDuration() / 1000 >= 0.200 && info.get(i).getDuration() / 1000 < 0.400) { + index = 87; + } else if (info.get(i).getDuration() / 1000 >= 0.400 && info.get(i).getDuration() / 1000 < 0.600) { + index = 88; + } else if (info.get(i).getDuration() / 1000 >= 0.600 && info.get(i).getDuration() / 1000 <= 1.200) { + index = 89; + } + } + if (Objects.nonNull(index)) { + CoordsVO coordsVO = result.get(index); + coordsVO.setZ(coordsVO.getZ() + 1); + } + } + return result; + } + /** * @return * @author xxy 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 e35103909..096b5e5c3 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 @@ -1829,12 +1829,12 @@ public class ReportServiceImpl implements ReportService { createTitle(doc, "4." + i + " 暂降事件列表", "标题 2", 200, 15); XWPFTable table = createTable(doc); XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc); - insertRow(doc, table, centerParagraph, true, "序号", "暂降发生时刻", "暂降赋值(%)", "持续时间(s)", "暂降类型", "暂降原因", "严重度"); + insertRow(doc, table, centerParagraph, true, "序号", "暂降发生时刻", "暂降幅值(%)", "持续时间(s)", "暂降类型", "暂降原因", "严重度"); for (int j = 0; j < plot.size(); j++) { EventDetail eventDetail = plot.get(j); String s = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")); - insertRow(doc, table, centerParagraph, false, j + 1 + "", s, eventDetail.getFeatureAmplitude()*100 + "", eventDetail.getDuration() + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + ""); + insertRow(doc, table, centerParagraph, false, j + 1 + "", s, BigDecimal.valueOf(eventDetail.getFeatureAmplitude()*100).setScale(2, RoundingMode.HALF_UP).toString(), eventDetail.getDuration() + "", eventDetail.getAdvanceType(), eventDetail.getAdvanceReason(), eventDetail.getSeverity() + ""); } i++; } @@ -1866,6 +1866,12 @@ public class ReportServiceImpl implements ReportService { int two = 1; if (exportParam.isMdtx()) { createTitle(doc, "4." + i + "." + two + " 暂降密度点图", "标题 3", 400, 15); + List coords = eventReportService.getCoords(info); + Integer[][] a=new Integer[87][]; + HashMap map = new HashMap<>(); + map.put("data", JSONArray.fromObject(coords).toString()); + String str = getStr("bar10.ftl", map); + createPic(doc, str, "暂降密度图"); two++; } if (exportParam.isMdbg()) { diff --git a/pqs-event/event-boot/src/main/resources/templates/bar10.ftl b/pqs-event/event-boot/src/main/resources/templates/bar10.ftl new file mode 100644 index 000000000..0ef4371c8 --- /dev/null +++ b/pqs-event/event-boot/src/main/resources/templates/bar10.ftl @@ -0,0 +1,149 @@ +<#--暂降密度点图专用模板--> +{ +backgroundColor: "#fff", +tooltip: { +trigger: "axis", +}, +title: { +text: "暂降密度图", +x: "center", +}, +toolbox: { +show: true, +feature: { + + +myFull: { +show: true, +title: "全屏查看", +icon: "path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891", +onclick: (e) => { +this.fullFlag = true; +let element = document.getElementById("main"); +// element.setOption(pacchartOption4); +if (element.requestFullScreen) { +// HTML W3C 提议 +element.requestFullScreen(); +} else if (element.msRequestFullscreen) { +// IE11 +element.msRequestFullScreen(); +} else if (element.webkitRequestFullScreen) { +// Webkit (works in Safari5.1 and Chrome 15) +element.webkitRequestFullScreen(); +} else if (element.mozRequestFullScreen) { +// Firefox (works in nightly) +element.mozRequestFullScreen(); +} +// 退出全屏 +if (element.requestFullScreen) { +document.exitFullscreen(); +} else if (element.msRequestFullScreen) { +document.msExitFullscreen(); +} else if (element.webkitRequestFullScreen) { +document.webkitCancelFullScreen(); +} else if (element.mozRequestFullScreen) { +document.mozCancelFullScreen(); +} +}, +}, +}, +}, +visualMap: { +max: 20, +show: false, +inRange: { +color: ["#313695", "#00BB00", "#ff8000", "#a50026"], +}, +}, +xAxis3D: { +type: "category", +name: "剩余电压(%)", +data: [ +"0-10", +"10-20", +"20-30", +"30-40", +"40-50", +"50-60", +"60-70", +"70-80", +"80-90", +"90-100", +], + +}, +yAxis3D: { +type: "category", +name: "持续时间(cyc)", +data: [ +"1cyc", +"2cyc", +"3cyc", +"4cyc", +"5cyc", +"6~10cyc", +"10~20cyc", +"20~30cyc", +"30~60cyc", +], + +splitLine: { +lineStyle: { +// 使用深浅的间隔色 +color: ["#"], +type: "dashed", +opacity: 0.5, +}, +}, +}, +zAxis3D: { +type: "value", +splitNumber: 10, +minInterval: 10, +name: "次数", + +}, +grid3D: { +boxWidth: 200, +boxDepth: 80, +light: { +main: { +intensity: 1.2, +}, +ambient: { +intensity: 0.3, +}, +}, +}, +series: [{ +type: "bar3D", +data: ${data}.map(function(item) { +return { +value: [item.x, item.y, item.z], +}; +}), +shading: "realistic", +label: { +show: false, +textStyle: { +fontSize: 16, +borderWidth: 1, +}, +}, + +itemStyle: { +opacity: 1, +}, +emphasis: { +label: { +textStyle: { +fontSize: 20, +color: "#900", +}, +}, +itemStyle: { +color: "#900", +}, +}, +}, ], +}; \ No newline at end of file