From 2eb2a417448444573e3b78bc534b277fb982377a Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Wed, 28 Jun 2023 15:30:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E9=99=8D=E6=A8=A1=E5=9D=97=EF=BC=8C?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E7=94=9F=E6=88=90=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/echarts/json/LineGenerator.java | 239 ++++- .../com/njcn/echarts/util/DrawPicUtil.java | 105 ++ pqs-event/event-boot/pom.xml | 19 - .../majornetwork/ReportController.java | 34 - .../majornetwork/Impl/ReportServiceImpl.java | 913 +++--------------- .../src/main/resources/templates/bar.ftl | 86 -- .../src/main/resources/templates/bar10.ftl | 149 --- .../src/main/resources/templates/bar2.ftl | 103 -- .../src/main/resources/templates/bar3.ftl | 88 -- .../src/main/resources/templates/bar4.ftl | 64 -- .../src/main/resources/templates/bar5.ftl | 93 -- .../src/main/resources/templates/bar6.ftl | 71 -- .../src/main/resources/templates/bar7.ftl | 59 -- .../src/main/resources/templates/bar8.ftl | 50 - .../src/main/resources/templates/bar9.ftl | 49 - .../src/main/resources/templates/dydj.ftl | 66 -- .../src/main/resources/templates/qytj.ftl | 68 -- .../src/main/resources/templates/test.ftl | 12 - .../src/main/resources/templates/yftj.ftl | 76 -- 19 files changed, 500 insertions(+), 1844 deletions(-) delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar10.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar2.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar3.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar4.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar5.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar6.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar7.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar8.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/bar9.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/dydj.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/qytj.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/test.ftl delete mode 100644 pqs-event/event-boot/src/main/resources/templates/yftj.ftl diff --git a/pqs-common/common-echarts/src/main/java/com/njcn/echarts/json/LineGenerator.java b/pqs-common/common-echarts/src/main/java/com/njcn/echarts/json/LineGenerator.java index c7dc3f489..08d2f44f8 100644 --- a/pqs-common/common-echarts/src/main/java/com/njcn/echarts/json/LineGenerator.java +++ b/pqs-common/common-echarts/src/main/java/com/njcn/echarts/json/LineGenerator.java @@ -4,15 +4,14 @@ import cn.hutool.core.lang.Console; import com.njcn.echarts.pojo.bo.TolerateData; import com.njcn.echarts.pojo.constant.PicCommonData; import org.icepear.echarts.Option; +import org.icepear.echarts.charts.bar.BarItemStyle; import org.icepear.echarts.charts.bar.BarLabel; import org.icepear.echarts.charts.bar.BarSeries; import org.icepear.echarts.charts.line.LineSeries; import org.icepear.echarts.charts.pie.PieLabel; import org.icepear.echarts.charts.pie.PieSeries; import org.icepear.echarts.charts.scatter.ScatterSeries; -import org.icepear.echarts.components.coord.AxisNameTextStyle; -import org.icepear.echarts.components.coord.SplitLine; -import org.icepear.echarts.components.coord.ValueAxisLabel; +import org.icepear.echarts.components.coord.*; import org.icepear.echarts.components.coord.cartesian.CategoryAxis; import org.icepear.echarts.components.coord.cartesian.LogAxis; import org.icepear.echarts.components.coord.cartesian.ValueAxis; @@ -21,6 +20,8 @@ import org.icepear.echarts.components.legend.Legend; import org.icepear.echarts.components.title.Title; import org.icepear.echarts.components.tooltip.Tooltip; import org.icepear.echarts.components.visualMap.ContinousVisualMap; +import org.icepear.echarts.origin.chart.bar.BarItemStyleOption; +import org.icepear.echarts.origin.coord.AxisLabelBaseOption; import org.icepear.echarts.origin.util.SeriesOption; import org.icepear.echarts.render.Engine; @@ -222,5 +223,237 @@ public class LineGenerator { return ENGINE.renderJsonOption(persistentTimeOption); } + /*** + * 生成区域统计 + * @author hongawen + * @date 2023/6/21 10:06 + */ + public static String generateRegionOption(List xData, List yData) { + Option persistentTimeOption = new Option(); + //取消渲染动画 + persistentTimeOption.setAnimation(false); + //背景色 + persistentTimeOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR); + //标题 + persistentTimeOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("区域统计")); + //设置图例 + persistentTimeOption.setLegend(new Legend().setData(new String[]{"暂降次数"}).setLeft(10).setShow(true)); + //颜色 + persistentTimeOption.setColor("orange"); + //横坐标 + persistentTimeOption.setXAxis(new CategoryAxis() + .setBoundaryGap(true) + .setName("地区\n(监测点数)") + .setAxisLabel(new LogAxisLabel().setShow(true).setFontSize(10).setRotate(0)) + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + .setData(xData.toArray()) + ); + //纵坐标 + persistentTimeOption.setYAxis(new ValueAxis() + .setName("(次)") + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + ); + + //配置占比 + BarSeries proportion = new BarSeries() + .setName("暂降次数") + .setBarWidth(30) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(yData); + persistentTimeOption.setSeries(new SeriesOption[]{proportion}); + return ENGINE.renderJsonOption(persistentTimeOption); + } + /*** + * 生成电压暂降,已关联未关联得次数 + * @author hongawen + * @date 2023/6/21 10:06 + */ + public static String generateAssociatedUnassociatedOption(List eventValue, List pereventValue, List pereventValue1, String xName) { + Option persistentTimeOption = new Option(); + //取消渲染动画 + persistentTimeOption.setAnimation(false); + //背景色 + persistentTimeOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR); + //标题 + persistentTimeOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText(xName)); + //设置图例 + persistentTimeOption.setLegend(new Legend().setData(new String[]{"未关联暂降次数", "已关联处理事件"}).setLeft(10).setShow(true)); + //横坐标 + persistentTimeOption.setXAxis(new CategoryAxis() + .setBoundaryGap(true) + .setName(xName) + .setAxisLabel(new LogAxisLabel().setShow(true).setFontSize(7).setRotate(0)) + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + .setData(eventValue.toArray()) + ); + //纵坐标 + persistentTimeOption.setYAxis(new ValueAxis() + .setName("(次)") + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + ); + + + //配置占比 + BarSeries proportion = new BarSeries() + .setName("未关联暂降次数") + .setStack("事件总数") + .setItemStyle(new BarItemStyle().setColor("orange").setBorderColor("orange").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(pereventValue); + BarSeries proportion2 = new BarSeries() + .setName("已关联处理事件") + .setStack("事件总数") + .setItemStyle(new BarItemStyle().setColor("#ccc").setBorderColor("#ccc").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(pereventValue1); + persistentTimeOption.setSeries(new SeriesOption[]{proportion,proportion2}); + return ENGINE.renderJsonOption(persistentTimeOption); + } + + /*** + * 生成电压等级统计 + * @author hongawen + * @date 2023/6/21 10:06 + */ + public static String generateVoltageLevelOption(List xData, List yData) { + Option persistentTimeOption = new Option(); + //取消渲染动画 + persistentTimeOption.setAnimation(false); + //背景色 + persistentTimeOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR); + //标题 + persistentTimeOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("电压等级")); + //设置图例 + persistentTimeOption.setLegend(new Legend().setData(new String[]{"暂降次数"}).setLeft(10).setShow(true)); + //颜色 + persistentTimeOption.setColor("orange"); + //横坐标 + persistentTimeOption.setXAxis(new CategoryAxis() + .setBoundaryGap(true) + .setName("电压等级\n(监测点数)") + .setAxisLabel(new LogAxisLabel().setShow(true).setFontSize(8).setRotate(0).setFontWeight("bold")) + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + .setData(xData.toArray()) + ); + //纵坐标 + persistentTimeOption.setYAxis(new ValueAxis() + .setName("(次)") + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + ); + + //配置占比 + BarSeries proportion = new BarSeries() + .setName("暂降次数") + .setBarWidth(30) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(yData); + persistentTimeOption.setSeries(new SeriesOption[]{proportion}); + return ENGINE.renderJsonOption(persistentTimeOption); + } + + + /*** + * 生成设备运行情况 + * @author hongawen + * @date 2023/6/21 10:06 + */ + public static String generateRegionDeviceOption(List xData, List onlineData,List offlineData,String subtext,String xName) { + Option persistentTimeOption = new Option(); + //取消渲染动画 + persistentTimeOption.setAnimation(false); + //背景色 + persistentTimeOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR); + //标题 + persistentTimeOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("设备运行情况") + .setSubtext(subtext) + ); + //设置图例 + persistentTimeOption.setLegend(new Legend().setData(new String[]{"在线", "离线"}).setLeft(10).setShow(true)); + //横坐标 + persistentTimeOption.setXAxis(new CategoryAxis() + .setBoundaryGap(true) + .setName(xName) + .setAxisLabel(new LogAxisLabel().setShow(true).setFontSize(7).setRotate(0).setFontWeight("bold")) + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + .setData(xData.toArray()) + ); + //纵坐标 + persistentTimeOption.setYAxis(new ValueAxis() + .setName("(次)") + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + ); + + + //配置占比 + BarSeries proportion = new BarSeries() + .setName("在线") + .setStack("account") + .setItemStyle(new BarItemStyle().setColor("green").setBorderColor("green").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(onlineData); + BarSeries proportion2 = new BarSeries() + .setName("离线") + .setStack("account") + .setItemStyle(new BarItemStyle().setColor("orange").setBorderColor("orange").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(offlineData); + persistentTimeOption.setSeries(new SeriesOption[]{proportion,proportion2}); + return ENGINE.renderJsonOption(persistentTimeOption); + } + + /*** + * 生成暂态事件次数 + * @author hongawen + * @date 2023/6/21 10:06 + */ + public static String generateFrequencyOption(List xData, List dip,List interruptions,List rise,String subtext,String xName) { + Option persistentTimeOption = new Option(); + //取消渲染动画 + persistentTimeOption.setAnimation(false); + //背景色 + persistentTimeOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR); + //标题 + persistentTimeOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("暂态事件次数") + .setSubtext(subtext) + ); + //设置图例 + persistentTimeOption.setLegend(new Legend().setData(new String[]{"暂降次数", "中断次数","暂升次数"}).setLeft(10).setShow(true)); + //横坐标 + persistentTimeOption.setXAxis(new CategoryAxis() + .setBoundaryGap(true) + .setName(xName) + .setAxisLabel(new LogAxisLabel().setShow(true).setFontSize(7).setRotate(0).setFontWeight("bold")) + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + .setData(xData.toArray()) + ); + //纵坐标 + persistentTimeOption.setYAxis(new ValueAxis() + .setName("(次)") + .setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px")) + ); + + + //配置占比 + BarSeries proportion = new BarSeries() + .setName("暂降次数") + .setStack("account") + .setItemStyle(new BarItemStyle().setColor("#ff9966").setBorderColor("#ff9966").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(dip); + BarSeries proportion2 = new BarSeries() + .setName("中断次数") + .setStack("account") + .setItemStyle(new BarItemStyle().setColor("#00dd00").setBorderColor("#00dd00").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(interruptions); + BarSeries proportion3 = new BarSeries() + .setName("暂升次数") + .setStack("account") + .setItemStyle(new BarItemStyle().setColor("#0066ff").setBorderColor("#0066ff").setBorderWidth(2).setBorderRadius(0)) + .setLabel(new BarLabel().setShow(true).setColor("#8B008B")) + .setData(rise); + persistentTimeOption.setSeries(new SeriesOption[]{proportion,proportion2,proportion3}); + return ENGINE.renderJsonOption(persistentTimeOption); + } } diff --git a/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java b/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java index b9217a4e7..43a944039 100644 --- a/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java +++ b/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java @@ -229,4 +229,109 @@ public class DrawPicUtil { String eventDensityJson = BarGenerator.generateEventDensity(data); return drawPic(eventDensityJson, width, height); } + + /*** + * 绘制生成区域统计图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventRegion(List xData, List yData) { + return drawEventRegion(xData,yData, 0, 0); + } + + /*** + * 绘制生成区域统计图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventRegion(List xData, List yData, int width, int height) { + String eventDensityJson = LineGenerator.generateRegionOption(xData,yData); + return drawPic(eventDensityJson, width, height); + } + + /*** + * 绘制生成电压暂降,已关联未关联得次数图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventAssociatedUnassociated(List eventValue, List pereventValue, List pereventValue1, String xName) { + return drawEventAssociatedUnassociated(eventValue,pereventValue,pereventValue1,xName, 0, 0); + } + + /*** + * 绘制生成电压暂降,已关联未关联得次数图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventAssociatedUnassociated(List eventValue, List pereventValue, List pereventValue1, String xName, int width, int height) { + String eventDensityJson = LineGenerator.generateAssociatedUnassociatedOption(eventValue,pereventValue,pereventValue1,xName); + return drawPic(eventDensityJson, width, height); + } + + /*** + * 绘制生成区域统计图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventVoltageLevel(List xData, List yData) { + return drawEventVoltageLevel(xData,yData, 0, 0); + } + + /*** + * 绘制生成区域统计图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventVoltageLevel(List xData, List yData, int width, int height) { + String eventDensityJson = LineGenerator.generateVoltageLevelOption(xData,yData); + return drawPic(eventDensityJson, width, height); + } + + /*** + * 绘制生成设备运行情况图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventRegionDevice(List xData, List onlineData,List offlineData,String subtext,String xName) { + return drawEventRegionDevice(xData,onlineData,offlineData,subtext,xName, 0, 0); + } + + /*** + * 绘制生成设备运行情况图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventRegionDevice(List xData, List onlineData,List offlineData,String subtext,String xName, int width, int height) { + String eventDensityJson = LineGenerator.generateRegionDeviceOption(xData,onlineData,offlineData,subtext,xName); + return drawPic(eventDensityJson, width, height); + } + + /*** + * 绘制生成暂态事件次数图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventFrequency(List xData, List dip,List interruptions,List rise,String subtext,String xName) { + return drawEventFrequency(xData,dip,interruptions,rise,subtext,xName, 0, 0); + } + + /*** + * 绘制生成暂态事件次数图 + * @author hongawen + * @date 2023/6/21 11:01 + * @return String base64数据 + */ + public String drawEventFrequency(List xData, List dip,List interruptions,List rise,String subtext,String xName, int width, int height) { + String eventDensityJson = LineGenerator.generateFrequencyOption(xData,dip,interruptions,rise,subtext,xName); + return drawPic(eventDensityJson, width, height); + } } diff --git a/pqs-event/event-boot/pom.xml b/pqs-event/event-boot/pom.xml index 5d99a0dee..390f9241c 100644 --- a/pqs-event/event-boot/pom.xml +++ b/pqs-event/event-boot/pom.xml @@ -88,25 +88,6 @@ eventboot - - - - - src/main/resources - - **/*.ftl - **/*.yml - - true - - - src/main/java - - **/*.xml - - - - org.apache.maven.plugins 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 04b39cb4f..c8e29d2b1 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 @@ -138,40 +138,6 @@ public class ReportController extends BaseController { @ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true) public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException { 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); -// exportParam.setLb(true); -// exportParam.setMdbg(true); -// exportParam.setMdtx(true); -// exportParam.setSjdF47(true); -// exportParam.setSjdITIC(true); -// exportParam.setGlfbfz(true); -// exportParam.setGlfbsj(true); -// exportParam.setTjbg(true); -// exportParam.setTjtx(true); -// exportParam.setYybg(true); -// exportParam.setYytx(true); -// exportParam.setLxbg(true); -// exportParam.setLxtx(true); -// -// exportParam.setLineName("江苏省->常熟市->常熟森泉印染厂_6600087524->10kV I母_电源总进线1"); -// exportParam.setSearchBeginTime(startTime); -// exportParam.setSearchEndTime(endTime); -// exportParam.setDeptIndex("5699e5916a18a6381e1ac92da5bd2628"); -// exportParam.setMonitorFlag(0); -// exportParam.setLineId(lineIndex); -// exportParam.setStatFlag(false); -// exportParam.setServerName("event-boot"); -// exportParam.setPowerFlag(1); -// SimpleDTO simpleDTO = new SimpleDTO(); -// simpleDTO.setName("电网拓扑"); -// simpleDTO.setSort(0); -// simpleDTO.setCode("Power_Network"); -// exportParam.setStatisticalType(simpleDTO); - } /** 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 5cb19cd33..18f093bc6 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 @@ -5,8 +5,6 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.text.CharPool; -import cn.hutool.core.text.StrPool; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -44,8 +42,6 @@ import com.njcn.event.service.majornetwork.EventAnalysisService; import com.njcn.event.service.majornetwork.EventDetailService; 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; import com.njcn.event.utils.WordUtils; import com.njcn.influxdb.utils.InfluxDBCommUtils; import com.njcn.influxdb.utils.InfluxDbUtils; @@ -67,7 +63,6 @@ import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.*; @@ -77,7 +72,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; -import net.sf.json.JSONArray; import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; @@ -91,7 +85,6 @@ import org.influxdb.dto.QueryResult; import org.influxdb.impl.InfluxDBResultMapper; import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.springframework.beans.BeanUtils; -import org.springframework.http.*; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import sun.misc.BASE64Decoder; @@ -129,8 +122,6 @@ public class ReportServiceImpl implements ReportService { private final EventDetailService eventDetailService; private final EventDetailMapper eventDetailMapper; - private final FreemarkerUtil freemarkerUtil; - private final ReportMapper reportMapper; private final DrawPicUtil drawPicUtil; @@ -493,7 +484,6 @@ public class ReportServiceImpl implements ReportService { */ @Override public Page getSagTimes(WaveTypeParam waveTypeParam) { - //List result = new ArrayList<>(); //获取暂降字典信息 DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); @@ -505,30 +495,6 @@ public class ReportServiceImpl implements ReportService { Page detail = reportMapper.getSagTimes(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), lineIds, waveTypeParam.getSearchBeginTime(), waveTypeParam.getSearchEndTime(), dictdata.getId()); List detailVO = detail.getRecords(); - /*Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() - .in(RmpEventDetailPO::getMeasurementPointId, lineIds) - .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) - .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) - ); - List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); - HashMap countMap = new HashMap<>(); - for (EventDetailNew eventDetail : info) { - countMap.put(eventDetail.getLineId(), 0); - } - Set keySet = countMap.keySet(); - //id集合 - ArrayList idlist = new ArrayList<>(); - for (EventDetailNew eventDetail : info) { - for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && dictdata.getId().equals(eventDetail.getEventType()) ) { - countMap.put(s, countMap.get(s) + 1); - } - } - DetailVO vo = new DetailVO(); - BeanUtils.copyProperties(eventDetail, vo); - result.add(vo); - idlist.add(eventDetail.getLineId()); - }*/ ArrayList idlist = new ArrayList<>(); for (DetailVO vo : detailVO) { idlist.add(vo.getLineId()); @@ -536,18 +502,6 @@ public class ReportServiceImpl implements ReportService { if (CollUtil.isNotEmpty(idlist)) { HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); List data = AreaInfo.getData(); - /*for (DetailVO detailVO : result) { - for (AreaLineInfoVO vo : data) { - if (vo.getLineId().equals(detailVO.getLineId())) { - BeanUtils.copyProperties(vo, detailVO); - } - } - for (String s : keySet) { - if (s.equals(detailVO.getLineId())) { - detailVO.setTimes(countMap.get(s)); - } - } - }*/ for (DetailVO v : detailVO) { for (AreaLineInfoVO vo : data) { if (vo.getLineId().equals(v.getLineId())) { @@ -560,8 +514,6 @@ public class ReportServiceImpl implements ReportService { Page page = BeanUtil.copyProperties(detail, Page.class); page.setRecords(detailVO); return page; - - } /** @@ -584,33 +536,6 @@ public class ReportServiceImpl implements ReportService { Page detail = reportMapper.getUpTimes(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), lineIds, waveTypeParam.getSearchBeginTime(), waveTypeParam.getSearchEndTime(), dictdata.getId()); List detailVO = detail.getRecords(); - /*Page pageInfo = eventDetailService.page( - new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), - new LambdaQueryWrapper() - .in(RmpEventDetailPO::getMeasurementPointId, lineIds) - .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) - .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) - .eq(RmpEventDetailPO::getEventType,dictdata.getId()) - ); - List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); - HashMap countMap = new HashMap<>(); - for (EventDetailNew eventDetail : info) { - countMap.put(eventDetail.getLineId(), 0); - } - Set keySet = countMap.keySet(); - //id集合 - ArrayList idlist = new ArrayList<>(); - for (EventDetailNew eventDetail : info) { - for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && dictdata.getId().equals(eventDetail.getEventType())) { - countMap.put(s, countMap.get(s) + 1); - } - } - DetailVO vo = new DetailVO(); - BeanUtils.copyProperties(eventDetail, vo); - result.add(vo); - idlist.add(eventDetail.getLineId()); - }*/ //id集合 ArrayList idlist = new ArrayList<>(); @@ -620,18 +545,6 @@ public class ReportServiceImpl implements ReportService { if (CollUtil.isNotEmpty(idlist)) { HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); List data = AreaInfo.getData(); - /*for (DetailVO detailVO : result) { - for (AreaLineInfoVO vo : data) { - if (vo.getLineId().equals(detailVO.getLineId())) { - BeanUtils.copyProperties(vo, detailVO); - } - } - for (String s : keySet) { - if (s.equals(detailVO.getLineId())) { - detailVO.setTimes(countMap.get(s)); - } - } - }*/ for (DetailVO v : detailVO) { for (AreaLineInfoVO vo : data) { if (vo.getLineId().equals(v.getLineId())) { @@ -669,32 +582,6 @@ public class ReportServiceImpl implements ReportService { Page detail = reportMapper.getBreakTimes(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), lineIds, waveTypeParam.getSearchBeginTime(), waveTypeParam.getSearchEndTime(), dictdata.getId()); List detailVO = detail.getRecords(); - /* Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() - .in(RmpEventDetailPO::getMeasurementPointId, lineIds) - .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) - .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) - ); - - List info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class); - HashMap countMap = new HashMap<>(); - for (EventDetailNew eventDetail : info) { - countMap.put(eventDetail.getLineId(), 0); - } - Set keySet = countMap.keySet(); - //id集合 - ArrayList idlist = new ArrayList<>(); - for (EventDetailNew eventDetail : info) { - for (String s : keySet) { - if (eventDetail.getLineId().equals(s) && dictdata.getId().equals(eventDetail.getEventType())) { - countMap.put(s, countMap.get(s) + 1); - } - } - DetailVO vo = new DetailVO(); - BeanUtils.copyProperties(eventDetail, vo); - result.add(vo); - idlist.add(eventDetail.getLineId()); - }*/ - //id集合 ArrayList idlist = new ArrayList<>(); for (DetailVO vo : detailVO) { @@ -703,18 +590,7 @@ public class ReportServiceImpl implements ReportService { if (CollUtil.isNotEmpty(idlist)) { HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); List data = AreaInfo.getData(); - /* for (DetailVO detailVO : result) { - for (AreaLineInfoVO vo : data) { - if (vo.getLineId().equals(detailVO.getLineId())) { - BeanUtils.copyProperties(vo, detailVO); - } - } - for (String s : keySet) { - if (s.equals(detailVO.getLineId())) { - detailVO.setTimes(countMap.get(s)); - } - } - }*/ + for (DetailVO v : detailVO) { for (AreaLineInfoVO vo : data) { if (vo.getLineId().equals(v.getLineId())) { @@ -727,64 +603,6 @@ public class ReportServiceImpl implements ReportService { Page page = BeanUtil.copyProperties(detail, Page.class); page.setRecords(detailVO); return page; - - -// List count = getED2(waveTypeParam); -// StringBuilder stringBuilder = new StringBuilder(Param.SELECT + Param.EVENT_DETAIL + Param.WHERE + " 1=1 "); -// List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); -// String substring = ""; -// for (GeneralDeviceDTO dto : deviceDTOList) { -// if (dto.getLineIndexes().size() > 0) { -// stringBuilder.append(" or "); -// dto.getLineIndexes().stream().forEach(line -> { -// stringBuilder.append("line_id = '").append(line + "' ").append("or "); -// }); -// stringBuilder.delete(stringBuilder.length() - 3, stringBuilder.length() + 1); -// } -// } -// Integer i = (waveTypeParam.getPageNum() - 1) * waveTypeParam.getPageSize(); -// substring = stringBuilder.toString() + "limit " + waveTypeParam.getPageSize() + " offset " + i + Param.TZ_ASIA_SHANGHAI; -// QueryResult query = influxDbUtils.query(substring); -// InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn(); -// List info = influxDBResultMapper.toPOJO(query, EventDetailNew.class); -// HashMap countMap = new HashMap<>(); -// for (EventDetailNew eventDetail : info) { -// countMap.put(eventDetail.getLineId(), 0); -// } -// Set keySet = countMap.keySet(); -// //id集合 -// ArrayList idlist = new ArrayList<>(); -// for (EventDetailNew eventDetail : info) { -// for (String s : keySet) { -// if (eventDetail.getLineId().equals(s) && eventDetail.getWaveType() == "3") { -// countMap.put(s, countMap.get(s) + 1); -// } -// } -// DetailVO vo = new DetailVO(); -// BeanUtils.copyProperties(eventDetail, vo); -// result.add(vo); -// idlist.add(eventDetail.getLineId()); -// } -// HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); -// List data = AreaInfo.getData(); -// for (DetailVO detailVO : result) { -// for (AreaLineInfoVO vo : data) { -// if (vo.getLineId().equals(detailVO.getLineId())) { -// BeanUtils.copyProperties(vo, detailVO); -// } -// } -// for (String s : keySet) { -// if (s.equals(detailVO.getLineId())) { -// detailVO.setTimes(countMap.get(s)); -// } -// } -// } -// Page page = new Page<>(); -// page.setTotal(count.size()); -// page.setRecords(result); -// page.setCurrent(waveTypeParam.getPageNum()); -// page.setSize(waveTypeParam.getPageSize()); -// return page; } @Override @@ -984,39 +802,13 @@ public class ReportServiceImpl implements ReportService { cell5.setCellValue(vo.getUpCount()); } - HashMap map1 = new HashMap<>(); - map1.put("onlineData", JSONArray.fromObject(online).toString()); - map1.put("offlineData", JSONArray.fromObject(offline).toString()); - map1.put("xname", "(区域)"); - map1.put("subtext", "区域统计"); - map1.put("area", JSONArray.fromObject(xdata).toString()); - String str1 = getStr("bar.ftl", map1); + String str1 = drawPicUtil.drawEventRegionDevice(xdata, online, offline, "区域统计", "(区域)"); - HashMap map2 = new HashMap<>(); - map2.put("onlineData", JSONArray.fromObject(online2).toString()); - map2.put("offlineData", JSONArray.fromObject(offline2).toString()); - map2.put("xname", "(电压等级)"); - map2.put("subtext", "电压等级统计"); - map2.put("area", JSONArray.fromObject(xdata2).toString()); - String str2 = getStr("bar.ftl", map2); + String str2 = drawPicUtil.drawEventRegionDevice(xdata2, online2, offline2, "电压等级统计", "(电压等级)"); - HashMap map3 = new HashMap<>(); - map3.put("xname", "(区域)"); - map3.put("subtext", "区域等级"); - map3.put("area", JSONArray.fromObject(xdata).toString()); - map3.put("sag", JSONArray.fromObject(sag1).toString()); - map3.put("break", JSONArray.fromObject(break1).toString()); - map3.put("up", JSONArray.fromObject(up1).toString()); - String str3 = getStr("bar2.ftl", map3); + String str3 = drawPicUtil.drawEventFrequency(xdata, sag1, break1, up1, "区域等级", "(区域)"); - HashMap map4 = new HashMap<>(); - map4.put("xname", "(电压等级)"); - map4.put("subtext", "电压等级统计"); - map4.put("area", JSONArray.fromObject(xdata2).toString()); - map4.put("sag", JSONArray.fromObject(sag2).toString()); - map4.put("break", JSONArray.fromObject(break2).toString()); - map4.put("up", JSONArray.fromObject(up2).toString()); - String str4 = getStr("bar2.ftl", map4); + String str4 = drawPicUtil.drawEventFrequency(xdata2, sag2, break2, up2, "电压等级统计", "(电压等级)"); HSSFPatriarch drawingPatriarch = sheetAt.createDrawingPatriarch(); //区域信息 @@ -1033,27 +825,22 @@ public class ReportServiceImpl implements ReportService { anchor2.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE); anchor3.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE); - BASE64Decoder decoder = new BASE64Decoder(); - byte[] bytes1 = new byte[0]; - byte[] bytes2 = new byte[0]; - byte[] bytes3 = new byte[0]; - byte[] bytes4 = new byte[0]; - try { - bytes1 = decoder.decodeBuffer(str1); - bytes2 = decoder.decodeBuffer(str2); - bytes3 = decoder.decodeBuffer(str3); - bytes4 = decoder.decodeBuffer(str4); - } catch (IOException e) { - throw new RuntimeException(e); - } - - drawingPatriarch.createPicture(anchor, sheets.addPicture(bytes1, HSSFWorkbook.PICTURE_TYPE_JPEG)); - drawingPatriarch.createPicture(anchor1, sheets.addPicture(bytes2, HSSFWorkbook.PICTURE_TYPE_JPEG)); - drawingPatriarch.createPicture(anchor2, sheets.addPicture(bytes3, HSSFWorkbook.PICTURE_TYPE_JPEG)); - drawingPatriarch.createPicture(anchor3, sheets.addPicture(bytes4, HSSFWorkbook.PICTURE_TYPE_JPEG)); + drawingPatriarch.createPicture(anchor, addPicture(str1, sheets)); + drawingPatriarch.createPicture(anchor1, addPicture(str2, sheets)); + drawingPatriarch.createPicture(anchor2, addPicture(str3, sheets)); + drawingPatriarch.createPicture(anchor3, addPicture(str4, sheets)); PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response); } + public Integer addPicture(String str, HSSFWorkbook sheets) throws IOException { + BASE64Decoder decoder = new BASE64Decoder(); + if (str.contains(PicCommonData.PNG_PREFIX)) { + str = str.replace(PicCommonData.PNG_PREFIX, ""); + } + byte[] bytes = decoder.decodeBuffer(str); + return sheets.addPicture(bytes, HSSFWorkbook.PICTURE_TYPE_PNG); + } + public void sheet2(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) { sheets.createSheet("暂态严重度统计"); HSSFSheet sheetAt = sheets.getSheetAt(1); @@ -1239,17 +1026,20 @@ public class ReportServiceImpl implements ReportService { HSSFClientAnchor anchor = new HSSFClientAnchor(0, 10, 10, 6, (short) 0.5, (short) 6, (short) 6, (short) 36); + List xdata = new ArrayList<>(); + List> reasonList = new ArrayList<>(); + + for (ReasonsVO reasonsVO : reason) { + Map map = new LinkedHashMap<>(); + map.put("value", reasonsVO.getTimes()); + map.put("name", reasonsVO.getReason()); + reasonList.add(map); xdata.add(reasonsVO.getReason()); } - String tr = getR(xdata, reason, "bar9.ftl"); - BASE64Decoder decoder = new BASE64Decoder(); - - byte[] bytes = decoder.decodeBuffer(tr); - drawingPatriarch.createPicture(anchor, sheets.addPicture(bytes, HSSFWorkbook.PICTURE_TYPE_JPEG)); - - + String tr = drawPicUtil.drawReason(xdata, reasonList); + drawingPatriarch.createPicture(anchor, addPicture(tr, sheets)); } public void sheet4(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) { @@ -1833,7 +1623,7 @@ public class ReportServiceImpl implements ReportService { } if (exportParam.isSjdF47()) { createTitle(doc, "4." + i + "." + two + " F47 曲线", "标题 3", 400, 15); - String f47 = drawPicUtil.drawF47(ass); + String f47 = drawPicUtil.drawF47(ass); createPic(doc, f47, "SEMI F47曲线"); two++; } @@ -1980,18 +1770,17 @@ public class ReportServiceImpl implements ReportService { if (exportParam.isYytx()) { createTitle(doc, "4." + i + "." + two + " 原因统计图", "标题 3", 400, 15); List xdata = new ArrayList<>(); - List> reasonList = new ArrayList<>(); + List> reasonList = new ArrayList<>(); List reason = statistic.getReason(); for (ReasonsVO reasonsVO : reason) { - Map map=new LinkedHashMap<>(); - map.put("value",reasonsVO.getTimes()); - map.put("name",reasonsVO.getReason()); + Map map = new LinkedHashMap<>(); + map.put("value", reasonsVO.getTimes()); + map.put("name", reasonsVO.getReason()); reasonList.add(map); -// reasonList.add("{value:"+reasonsVO.getTimes()+",name:'"+reasonsVO.getReason()+"'}"); xdata.add(reasonsVO.getReason()); } - String tr = drawPicUtil.drawReason(xdata,reasonList); + String tr = drawPicUtil.drawReason(xdata, reasonList); createPic(doc, tr, "暂降原因图"); two++; } @@ -2019,15 +1808,15 @@ public class ReportServiceImpl implements ReportService { List xdata = new ArrayList<>(); List types = statistic.getTypes(); - List> reasonList = new ArrayList<>(); + List> reasonList = new ArrayList<>(); for (TypesVO type : types) { - Map map=new LinkedHashMap<>(); - map.put("value",type.getTimes()); - map.put("name",type.getType()); + Map map = new LinkedHashMap<>(); + map.put("value", type.getTimes()); + map.put("name", type.getType()); reasonList.add(map); xdata.add(type.getType()); } - String tr = drawPicUtil.drawType(xdata,reasonList); + String tr = drawPicUtil.drawType(xdata, reasonList); createPic(doc, tr, "暂降类型图"); two++; } @@ -2093,56 +1882,6 @@ public class ReportServiceImpl implements ReportService { ); return BeanUtil.copyToList(info, EventDetail.class); -// //构建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 = 1 or wave_type = 3)").append(Param.TZ_ASIA_SHANGHAI); -// //结果集映射到对象中 -// 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/templates", map); - return EchartsUtil.generateEchartsBase64(s, "8910"); - } - - - public String getR(List xname, List map2, String barname) throws TemplateException, IOException { - HashMap map = new HashMap<>(); - map.put("typeArray", JSONArray.fromObject(xname).toString()); - map.put("valueArray", map2); - String str = getStr(barname, map); - return str; - } - - public String getT(List xname, List map2, String barname) throws TemplateException, IOException { - HashMap map = new HashMap<>(); - map.put("typeArray", JSONArray.fromObject(xname).toString()); - map.put("valueArray", map2); - String str = getStr(barname, map); - return str; - } - - public String getYFTJ(List xname, List times, String year, Integer flag) throws TemplateException, IOException { - HashMap map = new HashMap<>(); - xname.set(0, xname.get(0) + "\n" + "(" + year + ")"); - if (flag == 0) { - map.put("text", "月份统计"); - map.put("xname", "月份"); - } else { - map.put("text", "天数统计"); - map.put("xname", "天数"); - } - map.put("months", JSONArray.fromObject(xname).toString()); - map.put("handle", JSONArray.fromObject(times).toString()); - String str = getStr("bar7.ftl", map); - return str; } @@ -2370,10 +2109,7 @@ public class ReportServiceImpl implements ReportService { throw new BusinessException(EventResponseEnum.NOT_FOUND); } List eventDetailList = getEventDetailListInfo(areaReportParam, lineIds); - List voltageParamList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaReportParam).getData(); - - -// List eventDetailList=new ArrayList<>(); + List voltageParamList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaParam).getData(); //创建幅值计数器 @@ -2564,7 +2300,7 @@ public class ReportServiceImpl implements ReportService { * =======================================word结束========================================= */ } - + List lindIds = eventDetailList.stream().map(EventDetailNew::getLineId).collect(Collectors.toList()); //2.暂降事件三表季图像判断 if (areaReportParam.isEventCountTable() || areaReportParam.isEventCountChart()) { @@ -2583,16 +2319,13 @@ public class ReportServiceImpl implements ReportService { List lineIndexes = generalDeviceDTO.getLineIndexes(); //如果集合中有id将id进行拼接 if (CollectionUtil.isNotEmpty(lineIndexes)) { - //总条数 - QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); - if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { - areaCount.put(generalDeviceDTO.getName(), 0); + List countSize = lindIds.stream().filter(x -> lineIndexes.contains(x)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(countSize)) { + areaCount.put(generalDeviceDTO.getName(), countSize.size()); } 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)); + areaCount.put(generalDeviceDTO.getName(), 0); } } else { @@ -2613,15 +2346,12 @@ public class ReportServiceImpl implements ReportService { if (CollectionUtil.isNotEmpty(lineIndexes)) { //总条数 - QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); - - if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { - voltageCount.put(generalDeviceDTO.getName(), 0); + List countSize = lindIds.stream().filter(x -> lineIndexes.contains(x)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(countSize)) { + voltageCount.put(generalDeviceDTO.getName(), countSize.size()); } 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)); + voltageCount.put(generalDeviceDTO.getName(), 0); } } else { @@ -2752,7 +2482,6 @@ public class ReportServiceImpl implements ReportService { timeVO.setYear(String.valueOf(beginTime.getYear())); //todo 不知道代码是否是写错了,时间判断有问题 -// if (beginTime.getDayOfMonth() < 10) { if (beginTime.getMonthValue() < 10) { timeVO.setMonth("0" + beginTime.getMonthValue() + ""); } else { @@ -2801,9 +2530,6 @@ public class ReportServiceImpl implements ReportService { //进行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.getStartTime()))); //创建对象 @@ -3045,7 +2771,7 @@ public class ReportServiceImpl implements ReportService { ydata.add(areaCount.get(name)); } - String qytj = getQYTJ(xdata, ydata); + String qytj = drawPicUtil.drawEventRegion(xdata, ydata); createPic(doc, qytj, "" + typeName + "事件图形"); @@ -3055,18 +2781,15 @@ public class ReportServiceImpl implements ReportService { List ydata1 = new ArrayList<>(); List ydata2 = new ArrayList<>(); for (TimeSVO timeSVO : timeSVoList) { - xdata1.add(timeSVO.getFulltime()); + if ("天数".equals(table)) { + xdata1.add(timeSVO.getFulltime().substring(5)); + } else { + 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); + String yftj = drawPicUtil.drawEventAssociatedUnassociated(xdata1, ydata1, ydata2, table); createPic(doc, yftj, "" + typeName + "事件图形"); @@ -3090,7 +2813,7 @@ public class ReportServiceImpl implements ReportService { ydata3.add(voltageCount.get(name)); } - String dydj = getDYDJ(xdata3, ydata3); + String dydj = drawPicUtil.drawEventVoltageLevel(xdata3, ydata3); createPic(doc, dydj, "" + typeName + "事件图形"); @@ -4543,7 +4266,10 @@ public class ReportServiceImpl implements ReportService { createTitle(doc, "4." + oneCount4 + "." + twoCount1 + " " + typeName + "密度图", "标题 3", 400, 11); //代码 - + List eventDetails = BeanUtil.copyToList(info, EventDetail.class); + Integer[][] eventDensityData = eventReportService.getCoords(eventDetails); + String str = drawPicUtil.drawEventDensity(eventDensityData); + createPic(doc, str, "" + typeName + "密度图形"); } else { int twoCount = 1; createTitle(doc, "4." + oneCount + " " + typeName + "密度", "标题 2", 200, 11); @@ -4560,7 +4286,10 @@ public class ReportServiceImpl implements ReportService { //代码 - + List eventDetails = BeanUtil.copyToList(info, EventDetail.class); + Integer[][] eventDensityData = eventReportService.getCoords(eventDetails); + String str = drawPicUtil.drawEventDensity(eventDensityData); + createPic(doc, str, "" + typeName + "密度图形"); //序号计数进行++ oneCount++; @@ -4654,30 +4383,6 @@ public class ReportServiceImpl implements ReportService { //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<>(); @@ -4740,7 +4445,7 @@ public class ReportServiceImpl implements ReportService { r13.setFontSize(11);//字体大小 - String f47 = drawPicUtil.drawF47(list); + String f47 = drawPicUtil.drawF47(list); createPic(doc, f47, "SEMI F47曲线"); @@ -4758,25 +4463,13 @@ public class ReportServiceImpl implements ReportService { //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); @@ -5001,7 +4694,7 @@ public class ReportServiceImpl implements ReportService { twoCount++; //如果幅值图存在与幅值的序号保持同步 - createTitle(doc, "4." + oneCount2 + "." + twoCount + " 时序时间的概率分函数", "标题 3", 400, 11); + createTitle(doc, "4." + oneCount2 + "." + twoCount + " 持续时间的概率分函数", "标题 3", 400, 11); List ybardata = probabilityDistributionArea.getPersisttime(); @@ -5024,7 +4717,10 @@ public class ReportServiceImpl implements ReportService { createTitle(doc, "4." + oneCount + "." + twoCount + " 时序时间的概率分函数", "标题 3", 400, 11); - //代码 + List ybardata = probabilityDistributionArea.getPersisttime(); + List ylinedata = probabilityDistributionArea.getSisttime(); + String sj = drawPicUtil.drawPersistentTime(ylinedata, ybardata); + createPic(doc, sj, "持续时间的概率分布函数"); //序号计数进行++ @@ -5045,41 +4741,6 @@ public class ReportServiceImpl implements ReportService { //创建存储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<>(); @@ -5118,38 +4779,6 @@ public class ReportServiceImpl implements ReportService { 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();// 新建一个段落 @@ -5259,20 +4888,19 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - List reason = new ArrayList<>(); + List> list = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + list.add(map); } - String tr = getR(xdata, reason, "bar9.ftl"); + String tr = drawPicUtil.drawReason(xdata, list); createPic(doc, tr, "" + typeName + "原因图"); } else { //创建表题计数 @@ -5291,21 +4919,19 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - - List reason = new ArrayList<>(); + List> list = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + list.add(map); } - String tr = getR(xdata, reason, "bar9.ftl"); + String tr = drawPicUtil.drawReason(xdata, list); createPic(doc, tr, "" + typeName + "原因图"); //序号计数进行++ @@ -5391,20 +5017,19 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - List types = new ArrayList<>(); + List> reasonList = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + reasonList.add(map); } - String tr = getT(xdata, types, "bar8.ftl"); + String tr = drawPicUtil.drawType(xdata, reasonList); createPic(doc, tr, "" + typeName + "类型图"); } else { @@ -5424,20 +5049,19 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - List types = new ArrayList<>(); + List> reasonList = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + reasonList.add(map); } - String tr = getT(xdata, types, "bar8.ftl"); + String tr = drawPicUtil.drawType(xdata, reasonList); createPic(doc, tr, "" + typeName + "类型图"); //序号计数进行++ @@ -5475,26 +5099,6 @@ public class ReportServiceImpl implements ReportService { //数据统计 Integer eventDetailCount = getEventDetailCount(areaReportParam, lineIndexes); areaCount1.put(generalDeviceDTO.getName(), eventDetailCount); - -// 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); @@ -5502,7 +5106,6 @@ public class ReportServiceImpl implements ReportService { } -// System.out.println(areaCount1); //转为List对象集合 List areaCountList1 = new ArrayList<>(); for (String s : areaCount1.keySet()) { @@ -5512,17 +5115,11 @@ public class ReportServiceImpl implements ReportService { 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"); @@ -5555,7 +5152,7 @@ public class ReportServiceImpl implements ReportService { // generalDeviceDTOList.get(0).getMonitorIdList().add("97ec50b62c84d39d1e15d83e61e06844"); // } //这是总的监测点id - List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getMonitorIdList().stream()).collect(Collectors.toList()); + List lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getMonitorIdList().stream()).distinct().collect(Collectors.toList()); InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); @@ -5781,7 +5378,7 @@ public class ReportServiceImpl implements ReportService { * =======================================word结束========================================= */ } - + List lindIds = eventDetailList.stream().map(EventDetailNew::getLineId).collect(Collectors.toList()); //2.暂降事件三表季图像判断 if (areaReportParam.isEventCountTable() || areaReportParam.isEventCountChart()) { @@ -5801,15 +5398,12 @@ public class ReportServiceImpl implements ReportService { //如果集合中有id将id进行拼接 if (CollectionUtil.isNotEmpty(lineIndexes)) { //总条数 - QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); - - if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { - areaCount.put(generalDeviceDTO.getName(), 0); + List countSize = lindIds.stream().filter(x -> lineIndexes.contains(x)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(countSize)) { + areaCount.put(generalDeviceDTO.getName(), countSize.size()); } 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)); + areaCount.put(generalDeviceDTO.getName(), 0); } } else { @@ -5829,16 +5423,12 @@ public class ReportServiceImpl implements ReportService { //如果集合中有id将id进行拼接 if (CollectionUtil.isNotEmpty(lineIndexes)) { - //总条数 - QueryResult resultTotal = getEventDetailListInfoNum(areaReportParam, lineIndexes); - - if (ObjectUtil.isNull(resultTotal.getResults().get(0).getSeries())) { - voltageCount.put(generalDeviceDTO.getName(), 0); + List countSize = lindIds.stream().filter(x -> lineIndexes.contains(x)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(countSize)) { + voltageCount.put(generalDeviceDTO.getName(), countSize.size()); } 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)); + voltageCount.put(generalDeviceDTO.getName(), 0); } } else { @@ -6262,7 +5852,7 @@ public class ReportServiceImpl implements ReportService { ydata.add(areaCount.get(name)); } - String qytj = getQYTJ(xdata, ydata); + String qytj = drawPicUtil.drawEventRegion(xdata, ydata); createPic(doc, qytj, "" + typeName + "事件图形"); @@ -6272,18 +5862,17 @@ public class ReportServiceImpl implements ReportService { List ydata1 = new ArrayList<>(); List ydata2 = new ArrayList<>(); for (TimeSVO timeSVO : timeSVoList) { - xdata1.add(timeSVO.getFulltime()); + if ("天数".equals(table)) { + xdata1.add(timeSVO.getFulltime().substring(5)); + } else { + 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); + String yftj = drawPicUtil.drawEventAssociatedUnassociated(xdata1, ydata1, ydata2, table); createPic(doc, yftj, "" + typeName + "事件图形"); @@ -6307,7 +5896,7 @@ public class ReportServiceImpl implements ReportService { ydata3.add(voltageCount.get(name)); } - String dydj = getDYDJ(xdata3, ydata3); + String dydj = drawPicUtil.drawEventVoltageLevel(xdata3, ydata3); createPic(doc, dydj, "" + typeName + "事件图形"); @@ -7759,8 +7348,10 @@ public class ReportServiceImpl implements ReportService { //如果幅值图存在与幅值的序号保持同步 createTitle(doc, "4." + oneCount4 + "." + twoCount1 + " " + typeName + "密度图", "标题 3", 400, 11); - //代码 - + List eventDetails = BeanUtil.copyToList(info, EventDetail.class); + Integer[][] eventDensityData = eventReportService.getCoords(eventDetails); + String str = drawPicUtil.drawEventDensity(eventDensityData); + createPic(doc, str, "" + typeName + "密度图形"); } else { int twoCount = 1; createTitle(doc, "4." + oneCount + " " + typeName + "密度", "标题 2", 200, 11); @@ -7777,7 +7368,10 @@ public class ReportServiceImpl implements ReportService { //代码 - + List eventDetails = BeanUtil.copyToList(info, EventDetail.class); + Integer[][] eventDensityData = eventReportService.getCoords(eventDetails); + String str = drawPicUtil.drawEventDensity(eventDensityData); + createPic(doc, str, "" + typeName + "密度图形"); //序号计数进行++ oneCount++; @@ -7788,29 +7382,7 @@ public class ReportServiceImpl implements ReportService { //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<>(); @@ -7871,30 +7443,6 @@ public class ReportServiceImpl implements ReportService { //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<>(); @@ -7928,7 +7476,7 @@ public class ReportServiceImpl implements ReportService { r13.setFontSize(11);//字体大小 - String f47 = drawPicUtil.drawF47(list); + String f47 = drawPicUtil.drawF47(list); createPic(doc, f47, "SEMI F47曲线"); /** @@ -7957,7 +7505,7 @@ public class ReportServiceImpl implements ReportService { r13.setText(" F47曲线中可容忍" + typeName + "降记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):"); r13.setFontSize(11);//字体大小 - String f47 = drawPicUtil.drawF47(list); + String f47 = drawPicUtil.drawF47(list); createPic(doc, f47, "SEMI F47曲线"); @@ -7975,25 +7523,12 @@ public class ReportServiceImpl implements ReportService { //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); @@ -8241,7 +7776,10 @@ public class ReportServiceImpl implements ReportService { createTitle(doc, "4." + oneCount + "." + twoCount + " 时序时间的概率分函数", "标题 3", 400, 11); - //代码 + List ybardata = probabilityDistributionArea.getPersisttime(); + List ylinedata = probabilityDistributionArea.getSisttime(); + String sj = drawPicUtil.drawPersistentTime(ylinedata, ybardata); + createPic(doc, sj, "持续时间的概率分布函数"); //序号计数进行++ @@ -8262,41 +7800,6 @@ public class ReportServiceImpl implements ReportService { //创建存储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<>(); @@ -8335,37 +7838,6 @@ public class ReportServiceImpl implements ReportService { } - /* - 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();// 新建一个段落 @@ -8475,20 +7947,18 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - - List reason = new ArrayList<>(); + List> list = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + list.add(map); } - String tr = getR(xdata, reason, "bar9.ftl"); + String tr = drawPicUtil.drawReason(xdata, list); createPic(doc, tr, "" + typeName + "原因图"); } else { //创建表题计数 @@ -8507,21 +7977,18 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - - List reason = new ArrayList<>(); - + List> list = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + list.add(map); } - String tr = getR(xdata, reason, "bar9.ftl"); + String tr = drawPicUtil.drawReason(xdata, list); createPic(doc, tr, "" + typeName + "原因图"); //序号计数进行++ @@ -8607,20 +8074,18 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - - List types = new ArrayList<>(); + List> reasonList = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + reasonList.add(map); } - String tr = getT(xdata, types, "bar8.ftl"); + String tr = drawPicUtil.drawType(xdata, reasonList); createPic(doc, tr, "" + typeName + "类型图"); } else { @@ -8640,20 +8105,18 @@ public class ReportServiceImpl implements ReportService { //创建x,y参数 List xdata = new ArrayList<>(); - List ydata = new ArrayList<>(); - - List types = new ArrayList<>(); + List> reasonList = new ArrayList<>(); + Map map; 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); + map = new LinkedHashMap<>(); + map.put("value", resultMap.get(name)); + map.put("name", name); + reasonList.add(map); } - String tr = getT(xdata, types, "bar8.ftl"); + String tr = drawPicUtil.drawType(xdata, reasonList); createPic(doc, tr, "" + typeName + "类型图"); //序号计数进行++ @@ -8737,10 +8200,6 @@ public class ReportServiceImpl implements ReportService { } - //文件下载 - /* 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"); @@ -9719,32 +9178,6 @@ public class ReportServiceImpl implements ReportService { return list; } - public String getDYDJ(List eventvalue, List pereventvalue) throws TemplateException, IOException { - HashMap map = new HashMap<>(); - map.put("xvalue", JSONArray.fromObject(eventvalue).toString()); - map.put("yvalue", JSONArray.fromObject(pereventvalue).toString()); - String str = getStr("dydj.ftl", map); - return str; - } - - public String getQYTJ(List eventvalue, List pereventvalue) throws TemplateException, IOException { - HashMap map = new HashMap<>(); - map.put("xvalue", JSONArray.fromObject(eventvalue).toString()); - map.put("yvalue", JSONArray.fromObject(pereventvalue).toString()); - String str = getStr("qytj.ftl", map); - return str; - } - - public String getYFTJ1(List eventvalue, List pereventvalue, List pereventvalue1, String year, List test) throws TemplateException, IOException { - HashMap map = new HashMap<>(); - eventvalue.set(0, eventvalue.get(0) + "\n" + "(" + year + ")"); - map.put("xvalue", JSONArray.fromObject(eventvalue).toString()); - map.put("yvalue1", JSONArray.fromObject(pereventvalue).toString()); - map.put("yvalue2", JSONArray.fromObject(pereventvalue1).toString()); - map.put("test", JSONArray.fromObject(test).toString()); - String str = getStr("yftj.ftl", map); - return str; - } /** * wr(初始化数据) @@ -9776,16 +9209,6 @@ public class ReportServiceImpl implements ReportService { } return BeanUtil.copyToList(info, EventDetailNew.class); -// 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); } /** @@ -9818,24 +9241,6 @@ public class ReportServiceImpl implements ReportService { } - /** - * wr(公共查询条数) - * - * @param lineIds 监测点集合 - * @return - */ - 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 ") - .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')"); - - //总条数 - return influxDbUtils.query(stringTotal.toString()); - } - /** * 报表结果排序提取 * diff --git a/pqs-event/event-boot/src/main/resources/templates/bar.ftl b/pqs-event/event-boot/src/main/resources/templates/bar.ftl deleted file mode 100644 index 4e61d097a..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar.ftl +++ /dev/null @@ -1,86 +0,0 @@ -<#--区域统计和电压等级共用模板--> -{ -title: { -text: '设备运行情况', -left:'center', -subtext:'${subtext}', -}, -tooltip: { -trigger: 'axis', -axisPointer: { -type: 'shadow' -} -}, -legend: { -data: ['在线', '离线',], -left: '10%', -top:'5%', -textStyle: { -color: "#666666" -}, -itemWidth: 15, -itemHeight: 10, -itemGap: 25 -}, -grid: { -left: '3%', -right: '8%', -bottom: '5%', -top: '20%', -containLabel: true -}, -xAxis: { -name: '${xname}', -nameTextStyle: { -color: '#666666', -}, -type: 'category', -data: ${area} -}, -yAxis: { -name: '(个)', -nameTextStyle: { -color: '#666666', -}, -type: 'value', -axisLine: { show: true, lineStyle: { color: '#666666' } }, -axisLabel: { color: '#666666' }, -splitLine: { lineStyle: { color: ['#ccc'], type: [5, 8], dashOffset: 3 } }, -}, -series: [ -{ -name: '在线', -type: 'bar', -stack: 'account', -barWidth: 20, -label: { -show: true, -color:'purple', -verticalAlign: 'middle', -rotate: 0, -fontSize: 12, -}, -color:'green', -itemStyle: { -}, -data: ${onlineData} -}, -{ -name: '离线', -type: 'bar', -stack: 'account', -barWidth: 20, -label: { -show: true, -color:'purple', -verticalAlign: 'middle', -rotate: 0, -fontSize: 12, -}, -color:'orange', -itemStyle: { -}, -data: ${offlineData} -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar10.ftl b/pqs-event/event-boot/src/main/resources/templates/bar10.ftl deleted file mode 100644 index 0ef4371c8..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar10.ftl +++ /dev/null @@ -1,149 +0,0 @@ -<#--暂降密度点图专用模板--> -{ -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 diff --git a/pqs-event/event-boot/src/main/resources/templates/bar2.ftl b/pqs-event/event-boot/src/main/resources/templates/bar2.ftl deleted file mode 100644 index a570e9bda..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar2.ftl +++ /dev/null @@ -1,103 +0,0 @@ -<#--区域和电压等级统计次数共用模板--> -{ -title: { -text: '暂态事件次数', -left:'center', -subtext:'${subtext}', -}, -tooltip: { -trigger: 'axis', -axisPointer: { -type: 'shadow' -} -}, -legend: { -data: ['暂降次数', '中断次数', '暂升次数'], -left: '7%', -top:'5%', -textStyle: { -color: "#666666" -}, -itemWidth: 10, -itemHeight: 10, -itemGap: 15 -}, -grid: { -left: '3%', -right: '8%', -bottom: '5%', -top: '20%', -containLabel: true -}, -xAxis: { -name: '${xname}', -nameTextStyle: { -color: '#666666', -}, -type: 'category', -data: ${area} -}, -yAxis: { -name: '(次)', -nameTextStyle: { -color: '#666666', -}, -type: 'value', -axisLine: { show: true, lineStyle: { color: '#666666' } }, -axisLabel: { color: '#666666' }, -splitLine: { lineStyle: { color: ['#ccc'], type: [5, 8], dashOffset: 3 } }, -}, -series: [ -{ -name: '暂降次数', -type: 'bar', -stack: 'account', -barWidth: 20, -label: { -show: true, -color:'purple', -verticalAlign: 'middle', -rotate: 0, -fontSize: 12, -}, -color:'#ff9966', -itemStyle: { -}, -data: ${sag} -}, -{ -name: '中断次数', -type: 'bar', -stack: 'account', -barWidth: 20, -label: { -show: true, -color:'purple', -verticalAlign: 'middle', -rotate: 0, -fontSize: 12, -}, -color:'#00dd00', -itemStyle: { -}, -data: ${break} -}, -{ -name: '暂升次数', -type: 'bar', -stack: 'account', -barWidth: 20, -label: { -show: true, -color:'purple', -verticalAlign: 'middle', -rotate: 0, -fontSize: 12, -}, -color:'#0066ff', -itemStyle: { -}, -data: ${up} -}, -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar3.ftl b/pqs-event/event-boot/src/main/resources/templates/bar3.ftl deleted file mode 100644 index 16a87cf49..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar3.ftl +++ /dev/null @@ -1,88 +0,0 @@ -<#--ITIC曲线专用--> -{ -backgroundColor: "#FFF", -title: { -text: "ITIC曲线", -left: "center", -}, -grid: { -top: "80px", -left: "40px", -right: "40px", -bottom: "10%", -}, -legend: { -data: ["上限", "下限", "可容忍事件", "不可容忍事件"], -top:"26px", -left: "0px", -bottom: "94%", -}, -color: ["#FF8C00", "#00BFFF", "green", "red"], -xAxis: [ -{ -type: "log", -min: "0.001", -max: "1000", -splitLine: { -show: false, -}, -name: "s", -}, -], -yAxis: [ -{ -type: "value", -splitNumber: 10, -minInterval: 3, -name: "%" -}, -], -series: [ -{ -name: "上限", -type: "line", -data: [ -[0.001, 200], -[0.003, 140], -[0.003, 120], -[0.5, 120], -[0.5, 110], -[10, 110], -[1000, 110] -], -showSymbol: false, -tooltips: { -show: false -}, -}, -{ -name: "下限", -type: "line", -data: [ -[0.02, 0], -[0.02, 70], -[0.5, 70], -[0.5, 80], -[10, 80], -[10, 90], -[1000, 90] -], -showSymbol: false, -tooltips: { -show: false -}, -}, -{ -name: "可容忍事件", -type: "scatter", -symbol: "circle", -data: ${point} -}, -{ -name: "不可容忍事件", -type: "scatter", -symbol: "circle", -data: ${pointno} -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar4.ftl b/pqs-event/event-boot/src/main/resources/templates/bar4.ftl deleted file mode 100644 index 6a83e4cd1..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar4.ftl +++ /dev/null @@ -1,64 +0,0 @@ -<#--F47曲线图专用模板--> -{ -backgroundColor: "#fff", -title: { -text: "SEMI F47曲线", -left: "center", -}, -grid: { -top: "80px", -left: "40px", -right: "40px", -bottom: "10%", -}, -legend: { -data: ["边界线", "可容忍事件", "不可容忍事件"], -top:"26px", -left: "0px", -bottom: "94%", -}, -color: ["yellow", "green", "red"], -xAxis: [ -{ -type: "log", -min: "0.001", -max: "1000", -splitLine: { -show: false, -}, -name: "s", -}, -], -yAxis: [ -{ -type: "value", -max: ${zdz} + 20, -splitNumber: 10, -minInterval: 0.1, -name: "%", -}, -], -series: [ -{ -name: "边界线", -type: "line", -data: ${bjx}, -showSymbol: false, -tooltips: { -show: false, -}, -}, -{ -name: "可容忍事件", -type: "scatter", -symbol: "circle", -data: ${point} -}, -{ -name: "不可容忍事件", -type: "scatter", -symbol: "circle", -data: ${pointno} -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar5.ftl b/pqs-event/event-boot/src/main/resources/templates/bar5.ftl deleted file mode 100644 index 568d8eb01..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar5.ftl +++ /dev/null @@ -1,93 +0,0 @@ -<#--暂降幅值的概率分布函数专用模板--> -{ - backgroundColor: "#fff", - title: { - text: "暂降幅值的概率分布函数", - x: "center" - }, - grid: { - left: "10%", - right: "10%", - bottom: "15%" - }, - toolbox: { - show: true, - feature: { - restore: { show: true }, - saveAsImage: { show: true }, - }, - }, - tooltip: { - trigger: "axis", - formatter: "暂降幅值: {b0}
概率分布: {c0}%", - }, - legend: { - show: true, - left: 10, - data: ["概率分布", "占比"], - }, - calculable: true, - xAxis: [ - { - type: "category", - boundaryGap: true, - name: "暂降幅值", - nameLocation: "center", - nameGap: 40, - nameTextStyle: { - fontSize: 15, - }, - data: [ - "0", - "10%", - "20%", - "30%", - "40%", - "50%", - "60%", - "70%", - "80%", - "90%", - ], - }, - ], - yAxis: [ - { - type: "value", - name: "布分率概", - nameLocation: "center", - nameGap: 60, - nameTextStyle: { - fontSize: 15, - }, - axisLabel: { - formatter: "{value} %", - }, - }, - { - type: "value", - name: "比占", - nameLocation: "center", - nameGap: 20, - nameTextStyle: { - fontSize: 15, - }, - axisLabel: { - formatter: "{value} %", - }, - }, - ], - series: [ - { - name: "概率分布", - type: "line", - data: ${eventValue}, - }, - { - name: "占比", - type: "bar", - data: ${pereventValue}, - barWidth: 30 - } - ] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar6.ftl b/pqs-event/event-boot/src/main/resources/templates/bar6.ftl deleted file mode 100644 index 4afad6b4c..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar6.ftl +++ /dev/null @@ -1,71 +0,0 @@ -<#--持续时间的概率分布函数专用模板--> -{ -backgroundColor: "#fff", -title: { -text: "持续时间的概率分布函数", -x: "center", -}, -legend: { - show: true, - left: 10, - data: ["概率分布", "占比"], -}, -calculable: true, -grid: { -left: "10%", -right: "10%", -bottom: "15%" -}, -xAxis: [ -{ -type: "category", -boundaryGap: true, -name: "暂降持续时间(s)", -nameLocation: "center", -nameGap: 40, -nameTextStyle: { -fontSize: 15, -}, -data: ["0.01", "0.1", "0.25", "0.5", "1", "3", "20", "60", "180"], -}, -], -yAxis: [ -{ -type: "value", -name: "布分率概", -nameLocation: "center", -nameGap: 60, -nameTextStyle: { -fontSize: 15, -}, -axisLabel: { -formatter: "{value} %", -}, -}, -{ -type: "value", -name: "比占", -nameLocation: "center", -nameGap: 20, -nameTextStyle: { -fontSize: 15, -}, -axisLabel: { -formatter: "{value} %", -}, -}, -], -series: [ -{ -name: "概率分布", -type: "line", -data: ${sisttime}, -}, -{ -name: "占比", -type: "bar", -data: ${persisttime}, -barWidth: 30, -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar7.ftl b/pqs-event/event-boot/src/main/resources/templates/bar7.ftl deleted file mode 100644 index 8ae8d3640..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar7.ftl +++ /dev/null @@ -1,59 +0,0 @@ -<#--月份统计专用模板--> -{ -backgroundColor: "#fff", -title: { -text: "${text}", -x: "center", -}, -color: ["#FF8C00"], -legend: { -data: ["暂降次数"], -x: "left", -}, -grid: { -top: "80px", -left: "40px", -right: "60px", -bottom:"20px", -containLabel: true, -}, -xAxis: [ -{ -type: "category", -data: ${months}, -name: "${xname}", -splitLine: { -show: false, -}, -axisLabel: { -show: true, -interval: 0, -}, -}, -], -yAxis: [ -{ -type: "value", -name: "次", -}, -], -series: [ -{ -name: "暂降次数", -type: "bar", -barMaxWidth: 45, -itemStyle: { -normal: { -label: { -show: true, -textStyle: { -label: { show: true, position: "top" }, -color: "#8B008B", -}, -}, -}, -}, -data: ${handle}, -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar8.ftl b/pqs-event/event-boot/src/main/resources/templates/bar8.ftl deleted file mode 100644 index 953fa0dbf..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar8.ftl +++ /dev/null @@ -1,50 +0,0 @@ -<#--类型专用模板--> -{ -backgroundColor: '#fff', -animation: false, -title: { -text: '暂降类型', -x: '51%', -}, -legend: { -orient: 'vertical', -left: 'left', -data: ${typeArray} -}, -series: [ -{ -name: '暂降类型', -type: 'pie', -radius: '70%', -center: ['55%', '53%'], -label: { -normal: { -show: true, -formatter: '{b}:{d}%' -}, -emphasis: { -show: true -} -}, -lableLine: { -normal: { -show: false -}, -emphasis: { -show: true -} -}, -data: [<#list valueArray as a> - {value:${a.times?c}, - name:'${a.type}'}, -], -itemStyle: { -emphasis: { -shadowBlur: 10, -shadowOffsetX: 0, -shadowColor: 'rgba(0, 0, 0, 0.5)' -} -} -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/bar9.ftl b/pqs-event/event-boot/src/main/resources/templates/bar9.ftl deleted file mode 100644 index c013cbc01..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/bar9.ftl +++ /dev/null @@ -1,49 +0,0 @@ -<#--暂降原因专用模板--> -{ -backgroundColor: '#fff', -animation: false, -title: { -text: '暂降原因', -x: '51%' -}, -legend: { -orient: 'vertical', -left: 'left', -data: ${typeArray} -}, -series: [ -{ -name: '暂降原因', -type: 'pie', -radius: '70%', -center: ['55%', '53%'], -label: { -normal: { -formatter: '{b}:{d}%' -}, -emphasis: { -show: true -} -}, -lableLine: { -normal: { -show: false -}, -emphasis: { -show: true -} -}, -data: [<#list valueArray as a> - {value:${a.times?c}, - name:'${a.reason}'}, -], -itemStyle: { -emphasis: { -shadowBlur: 10, -shadowOffsetX: 0, -shadowColor: 'rgba(0, 0, 0, 0.5)' -} -} -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/dydj.ftl b/pqs-event/event-boot/src/main/resources/templates/dydj.ftl deleted file mode 100644 index d8297f4b1..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/dydj.ftl +++ /dev/null @@ -1,66 +0,0 @@ - { -backgroundColor: "#FFF", -title: { -text: '电压等级', -x: 'center' -}, -tooltip: { -trigger: 'axis', -axisPointer: { -type: 'shadow' -}, -formatter: function (params) { -var tips = ""; -tips += params[0].name ; -for (var i = 0; i < params.length; i++) { -tips += params[i].seriesName + ":" + params[i].value ; -} -return tips; -} -}, -color: ['orange'], -legend: { -data: ['暂降次数'], -selectedMode: false, -x: 'left' -}, -grid: { -left: '3%', -right: '12%', -bottom: '6%', -containLabel: true -}, -xAxis: [{ -type: 'category', -data: ${xvalue}, -splitLine: { -show: false -}, -name: '电压等级\n(监测点数)', -axisLabel: { -interval: 0, -show: true, -fontSize:10 -} -}], -yAxis: [{ -type: 'value', -name: '(次)' -}], -series: [{ -name: '暂降次数', -type: 'bar', -itemStyle: { -normal: { -label: { -show: true, -textStyle: { -color: 'purple' -} -} -} -}, -data: ${yvalue}, -barMaxWidth: 45 -}] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/qytj.ftl b/pqs-event/event-boot/src/main/resources/templates/qytj.ftl deleted file mode 100644 index b9079cbca..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/qytj.ftl +++ /dev/null @@ -1,68 +0,0 @@ -{ -backgroundColor: '#FFF', -title: { -text: '区域统计', -x: 'center' -}, -tooltip: { -trigger: 'axis', -axisPointer: { -type: 'shadow' -}, -formatter: function (params) { -var tips = ""; -tips += params[0].name ; -for (var i = 0; i < params.length; i++) { -tips += params[i].seriesName + ":" + params[i].value ; -} -return tips; -} -}, -color: ['orange'], - -grid: { -left: '1%', -right: '7%', -bottom: '8%', -containLabel: true -}, -legend: { -data: ['暂降次数'], -selectedMode: false, -x: 'left' -}, -xAxis: [{ -type: 'category', -data: ${xvalue}, -splitLine: { -show: false -}, -name: '地区\n(监测点数)', -axisLabel: { -interval: 0, -show: true, -rotate:0, -fontSize:10 -} -}], -yAxis: [{ -type: 'value', -name: '(次)' -}], -series: [{ -name: '暂降次数', -type: 'bar', -itemStyle: { -normal: { -label: { -show: true, -textStyle: { -color: 'purple' -} -} -} -}, -data: ${yvalue}, -barMaxWidth: 45 -}], -} diff --git a/pqs-event/event-boot/src/main/resources/templates/test.ftl b/pqs-event/event-boot/src/main/resources/templates/test.ftl deleted file mode 100644 index e2e8644d9..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/test.ftl +++ /dev/null @@ -1,12 +0,0 @@ -{ -animation:false, -xAxis: {}, -yAxis: {}, -series: [ -{ -symbolSize: 2, -data: ${bdata}, -type: 'scatter' -} -] -} diff --git a/pqs-event/event-boot/src/main/resources/templates/yftj.ftl b/pqs-event/event-boot/src/main/resources/templates/yftj.ftl deleted file mode 100644 index bf46d0a35..000000000 --- a/pqs-event/event-boot/src/main/resources/templates/yftj.ftl +++ /dev/null @@ -1,76 +0,0 @@ -{ -backgroundColor: "#FFF", -title: { -text: ${test}, -x: 'center' -}, -tooltip: { -trigger: 'axis', -axisPointer: { -type: 'shadow' -}, -formatter: function (params) { -var tips = ""; -tips += params[0].name ; -for (var i = 0; i < params.length; i++) { -tips += params[i].seriesName + ":" + params[i].value; -} -return tips; -} -}, -grid: { -left: '3%', -bottom: '6%', -containLabel: true -}, -legend: { -data: ['未关联暂降次数', '已关联处理事件'], -x: 'left' -}, -xAxis: [{ -type: 'category', -data:${xvalue}, -name: ${test}, -splitLine: { -show: false -}, -axisLabel: { -show: true, -interval: 0, -fontSize:10 -} -}], -yAxis: [{ -type: 'value', -name: '次' -}], -series: [{ -name: '未关联暂降次数', -type: 'bar', -stack: '事件总数', -barMaxWidth: 45, -itemStyle: { -normal: { -color: 'orange', -barBorderColor: 'orange', -barBorderWidth: 2, -barBorderRadius: 0 -} -}, -data: ${yvalue1} -}, { -name: '已关联处理事件', -type: 'bar', -stack: '事件总数', -barMaxWidth: 45, -itemStyle: { -normal: { -color: "#ccc", -barBorderColor: '#ccc', -barBorderWidth: 2, -barBorderRadius: 0 -} -}, -data: ${yvalue2} -}] -}