代码调整
This commit is contained in:
@@ -33,8 +33,9 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.abel533</groupId>
|
||||
<artifactId>ECharts</artifactId>
|
||||
<groupId>org.icepear.echarts</groupId>
|
||||
<artifactId>echarts-java</artifactId>
|
||||
<version>1.0.7</version>
|
||||
</dependency>
|
||||
<!-- echarts绘图所需,可以将包含function的对象转为json -->
|
||||
<dependency>
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.njcn.echarts.bar;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.github.abel533.echarts.Grid;
|
||||
import com.github.abel533.echarts.axis.AxisLabel;
|
||||
import com.github.abel533.echarts.axis.CategoryAxis;
|
||||
import com.github.abel533.echarts.axis.SplitLine;
|
||||
import com.github.abel533.echarts.axis.ValueAxis;
|
||||
import com.github.abel533.echarts.code.AxisType;
|
||||
import com.github.abel533.echarts.code.SeriesType;
|
||||
import com.github.abel533.echarts.json.GsonOption;
|
||||
import com.github.abel533.echarts.series.Bar;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
*
|
||||
* 用于组装柱状图的option数据
|
||||
*
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 10:58
|
||||
*/
|
||||
public class BarOptionUtil {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
JSONObject optionJson = testEchart();
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<HttpResult> forEntity = restTemplate.getForEntity("http://192.168.1.13:8910?opt={1}&width={2}&height={3}", HttpResult.class, optionJson.toString(), 714, 300);
|
||||
//返回图片对应的base64
|
||||
System.out.println(forEntity.getBody().getData());
|
||||
System.out.println(1);
|
||||
|
||||
}
|
||||
|
||||
public static JSONObject testEchart() {
|
||||
List<String> xName = Stream.of("江苏省", "四川省", "海南省").collect(Collectors.toList());
|
||||
GsonOption option = new GsonOption();
|
||||
// 大标题、位置
|
||||
String title = "区域统计";
|
||||
option.title().text(title).x("center");
|
||||
// 提示工具
|
||||
// 在轴上触发提示数据
|
||||
option.tooltip().show(false);
|
||||
// 工具栏
|
||||
// 显示,保存为图片
|
||||
option.toolbox().show(false);
|
||||
// 图例
|
||||
option.color("#FF7E50");
|
||||
option.legend("暂降次数");
|
||||
//控制图标在dataroom中的位置大小
|
||||
option.grid(new Grid().left("3%").right("15%").bottom("5%").containLabel(true));
|
||||
// 轴分类
|
||||
CategoryAxis xAxis = new CategoryAxis();
|
||||
xAxis.data(xName.toArray());
|
||||
xAxis.splitLine(new SplitLine().show(false));
|
||||
xAxis.name("地区\n(监测点数)");
|
||||
xAxis.axisLabel(new AxisLabel().interval(0).show(true));
|
||||
// 起始和结束两端空白策略
|
||||
xAxis.boundaryGap(true);
|
||||
// x轴
|
||||
option.xAxis(xAxis);
|
||||
//循环数据
|
||||
Bar bar = new Bar();
|
||||
bar.setType(SeriesType.bar);
|
||||
bar.barMaxWidth(30);
|
||||
bar.data(30, 48, 66);
|
||||
option.series(bar);
|
||||
// y轴
|
||||
ValueAxis yAxis = new ValueAxis();
|
||||
yAxis.name("(次)").type(AxisType.value);
|
||||
option.yAxis(yAxis);
|
||||
String optionStr = option.toString().replace(" ", "");
|
||||
return new JSONObject(optionStr);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.njcn.echarts.json;
|
||||
|
||||
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.BarSeries;
|
||||
import org.icepear.echarts.charts.line.LineSeries;
|
||||
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.cartesian.CategoryAxis;
|
||||
import org.icepear.echarts.components.coord.cartesian.LogAxis;
|
||||
import org.icepear.echarts.components.coord.cartesian.ValueAxis;
|
||||
import org.icepear.echarts.components.grid.Grid;
|
||||
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.origin.util.SeriesOption;
|
||||
import org.icepear.echarts.render.Engine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年06月21日 10:05
|
||||
*/
|
||||
public class LineGenerator {
|
||||
|
||||
private final static Engine ENGINE = new Engine();
|
||||
|
||||
|
||||
/***
|
||||
* 生成ITIC曲线
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 10:06
|
||||
*/
|
||||
public static String generateIticOption(TolerateData tolerateData) {
|
||||
Option iticOption = new Option();
|
||||
//取消渲染动画
|
||||
iticOption.setAnimation(false);
|
||||
//背景色
|
||||
iticOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
|
||||
//标题
|
||||
iticOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("ITIC曲线"));
|
||||
//上下左右的图内间距
|
||||
iticOption.setGrid(new Grid().setTop("80px").setLeft("40px").setRight("40px").setBottom("10%"));
|
||||
//设置图例
|
||||
iticOption.setLegend(new Legend().setData(new String[]{"上限", "下限", "可容忍事件", "不可容忍事件"}).setTop("26px").setLeft(0).setBottom("94%"));
|
||||
//设置图例对应的颜色
|
||||
iticOption.setColor(new String[]{"#FF8C00", "#00BFFF", "green", "red"});
|
||||
//横坐标
|
||||
iticOption.setXAxis(new LogAxis().setMin("0.001").setMax("1000").setSplitLine(new SplitLine().setShow(false)).setName("s"));
|
||||
//纵坐标
|
||||
iticOption.setYAxis(new ValueAxis().setName("%").setMinInterval(3).setSplitNumber(10));
|
||||
//处理上限配置
|
||||
LineSeries upperLimit = new LineSeries()
|
||||
.setName("上限")
|
||||
.setData(new float[][]{{0.001f, 200}, {0.003f, 140}, {0.003f, 120}, {0.5f, 120}, {0.5f, 110}, {10, 110}, {1000, 110}})
|
||||
.setShowSymbol(false)
|
||||
.setTooltip(new Tooltip().setShow(false));
|
||||
|
||||
//处理下限配置
|
||||
LineSeries lowerLimit = new LineSeries()
|
||||
.setName("下限")
|
||||
.setData(new float[][]{{0.02f, 0}, {0.02f, 70}, {0.5f, 70}, {0.5f, 80}, {10, 80}, {10, 90}, {1000, 90}})
|
||||
.setShowSymbol(false)
|
||||
.setTooltip(new Tooltip().setShow(false));
|
||||
//配置可容忍点数据
|
||||
ScatterSeries tolerate = new ScatterSeries()
|
||||
.setName("可容忍事件")
|
||||
.setSymbol("circle")
|
||||
.setData(tolerateData.getTolerateData());
|
||||
//配置不可容忍点数据
|
||||
ScatterSeries unTolerate = new ScatterSeries()
|
||||
.setName("不可容忍事件")
|
||||
.setSymbol("circle")
|
||||
.setData(tolerateData.getUnTolerateData());
|
||||
iticOption.setSeries(new SeriesOption[]{upperLimit, lowerLimit, tolerate, unTolerate});
|
||||
return ENGINE.renderJsonOption(iticOption);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 生成F47曲线
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 10:06
|
||||
*/
|
||||
public static String generateF47Option(TolerateData tolerateData) {
|
||||
Option iticOption = new Option();
|
||||
//取消渲染动画
|
||||
iticOption.setAnimation(false);
|
||||
//背景色
|
||||
iticOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
|
||||
//标题
|
||||
iticOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("SEMI F47曲线"));
|
||||
//上下左右的图内间距
|
||||
iticOption.setGrid(new Grid().setTop("80px").setLeft("40px").setRight("40px").setBottom("10%"));
|
||||
//设置图例
|
||||
iticOption.setLegend(new Legend().setData(new String[]{"边界线", "可容忍事件", "不可容忍事件"}).setTop("26px").setLeft(0).setBottom("94%"));
|
||||
//设置图例对应的颜色
|
||||
iticOption.setColor(new String[]{"yellow", "green", "red"});
|
||||
//横坐标
|
||||
iticOption.setXAxis(new LogAxis().setMin("0.001").setMax("1000").setSplitLine(new SplitLine().setShow(false)).setName("s"));
|
||||
//纵坐标
|
||||
iticOption.setYAxis(new ValueAxis().setName("%").setMinInterval(0.1).setSplitNumber(10).setMax(100));
|
||||
//处理边界线
|
||||
LineSeries borderLimit = new LineSeries()
|
||||
.setName("边界线")
|
||||
.setData(new float[][]{{0.05f, 0}, {0.05f, 50}, {0.2f, 50}, {0.2f, 70}, {0.5f, 70}, {0.5f, 80}, {10, 80}, {10, 90}, {1000, 90}})
|
||||
.setShowSymbol(false)
|
||||
.setTooltip(new Tooltip().setShow(false));
|
||||
//配置可容忍点数据
|
||||
ScatterSeries tolerate = new ScatterSeries()
|
||||
.setName("可容忍事件")
|
||||
.setSymbol("circle")
|
||||
.setData(tolerateData.getTolerateData());
|
||||
//配置不可容忍点数据
|
||||
ScatterSeries unTolerate = new ScatterSeries()
|
||||
.setName("不可容忍事件")
|
||||
.setSymbol("circle")
|
||||
.setData(tolerateData.getUnTolerateData());
|
||||
iticOption.setSeries(new SeriesOption[]{borderLimit, tolerate, unTolerate});
|
||||
return ENGINE.renderJsonOption(iticOption);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 生成暂降幅值
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 10:06
|
||||
*/
|
||||
public static String generateEventAmplitudeOption(List<String> ylinedata, List<String> ybardata) {
|
||||
Option iticOption = new Option();
|
||||
//取消渲染动画
|
||||
iticOption.setAnimation(false);
|
||||
//背景色
|
||||
iticOption.setBackgroundColor(PicCommonData.PIC_BACK_COLOR);
|
||||
//标题
|
||||
iticOption.setTitle(new Title().setLeft(PicCommonData.CENTER).setText("暂降幅值的概率分布"));
|
||||
//设置图例
|
||||
iticOption.setLegend(new Legend().setData(new String[]{"概率分布", "占比"}).setLeft(10).setShow(true));
|
||||
//横坐标
|
||||
iticOption.setXAxis(new CategoryAxis()
|
||||
.setBoundaryGap(true)
|
||||
.setName("暂降幅值")
|
||||
.setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px"))
|
||||
.setData(new String[]{"0", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%"})
|
||||
);
|
||||
//纵坐标
|
||||
iticOption.setYAxis(new ValueAxis[]{
|
||||
new ValueAxis()
|
||||
.setName("%")
|
||||
.setNameTextStyle(new AxisNameTextStyle().setFontStyle("15px"))
|
||||
.setAxisLabel(new ValueAxisLabel().setFormatter("{value}%"))
|
||||
});
|
||||
|
||||
//配置概率分布
|
||||
LineSeries probability = new LineSeries()
|
||||
.setName("概率分布")
|
||||
.setData(ylinedata);
|
||||
//配置占比
|
||||
BarSeries proportion = new BarSeries()
|
||||
.setName("占比")
|
||||
.setBarWidth(30)
|
||||
.setData(ybardata);
|
||||
|
||||
iticOption.setSeries(new SeriesOption[]{probability, proportion});
|
||||
return ENGINE.renderJsonOption(iticOption);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.njcn.echarts.line;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.github.abel533.echarts.Grid;
|
||||
import com.github.abel533.echarts.axis.AxisLabel;
|
||||
import com.github.abel533.echarts.axis.CategoryAxis;
|
||||
import com.github.abel533.echarts.axis.SplitLine;
|
||||
import com.github.abel533.echarts.axis.ValueAxis;
|
||||
import com.github.abel533.echarts.code.AxisType;
|
||||
import com.github.abel533.echarts.code.NameLocation;
|
||||
import com.github.abel533.echarts.code.SeriesType;
|
||||
import com.github.abel533.echarts.json.GsonOption;
|
||||
import com.github.abel533.echarts.series.Bar;
|
||||
import com.github.abel533.echarts.series.Line;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 14:39
|
||||
*/
|
||||
public class LineOptionUtil {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
JSONObject optionJson = testEchart();
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<HttpResult> forEntity = restTemplate.getForEntity("http://192.168.1.13:8910?opt={1}&width={2}&height={3}", HttpResult.class, optionJson.toString(), 714, 300);
|
||||
//返回图片对应的base64
|
||||
System.out.println(forEntity.getBody().getData());
|
||||
System.out.println(1);
|
||||
|
||||
}
|
||||
|
||||
public static JSONObject testEchart() {
|
||||
List<String> xName = Stream.of("0", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%").collect(Collectors.toList());
|
||||
GsonOption option = new GsonOption();
|
||||
option.backgroundColor("#F9F9F9");
|
||||
// 大标题、位置
|
||||
String title = "暂降幅值的概率分布函数";
|
||||
option.title().text(title).x("center");
|
||||
// 提示工具
|
||||
// 在轴上触发提示数据
|
||||
option.tooltip().show(false);
|
||||
// 工具栏
|
||||
// 显示,保存为图片
|
||||
option.toolbox().show(false);
|
||||
// 图例
|
||||
option.color("#FF7E50");
|
||||
//控制图标在dataroom中的位置大小
|
||||
option.grid(new Grid().left("3%").right("11%").bottom("5%").containLabel(true));
|
||||
// 轴分类
|
||||
CategoryAxis xAxis = new CategoryAxis();
|
||||
xAxis.data(xName.toArray());
|
||||
xAxis.nameGap(5);
|
||||
xAxis.name("暂降幅值");
|
||||
// 起始和结束两端空白策略
|
||||
xAxis.boundaryGap(false);
|
||||
// x轴
|
||||
option.xAxis(xAxis);
|
||||
Line line = new Line("暂降幅值");
|
||||
line.setType(SeriesType.line);
|
||||
line.data(0, 10, 11, 15, 16, 30, 48, 66, 75, 89);
|
||||
option.series(line);
|
||||
// y轴
|
||||
ValueAxis yAxis = new ValueAxis();
|
||||
yAxis.name("概率分布").type(AxisType.value).nameGap(50).nameLocation(NameLocation.middle).axisLabel(new AxisLabel().formatter("{value} %"));
|
||||
option.yAxis(yAxis);
|
||||
String optionStr = option.toString().replace(" ", "");
|
||||
return new JSONObject(optionStr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.echarts.pojo.bo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年06月21日 11:05
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TolerateData {
|
||||
|
||||
/***
|
||||
* 可容忍数据
|
||||
*/
|
||||
List<List<Double>> tolerateData = new ArrayList<>();
|
||||
|
||||
/***
|
||||
* 不可容忍数据
|
||||
*/
|
||||
List<List<Double>> unTolerateData = new ArrayList<>();
|
||||
}
|
||||
@@ -33,8 +33,22 @@ public interface PicCommonData {
|
||||
Integer COMMON_POI_MAP_HEIGHT = 210;
|
||||
|
||||
|
||||
/**
|
||||
* 图片背景色
|
||||
*/
|
||||
String PIC_BACK_COLOR = "#FFF";
|
||||
|
||||
|
||||
/**
|
||||
* 绘图定位
|
||||
*/
|
||||
String CENTER = "center";
|
||||
|
||||
|
||||
/***
|
||||
* png base64固定前缀
|
||||
*/
|
||||
String PNG_PREFIX = "data:image/png;base64,";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.njcn.echarts.util;
|
||||
|
||||
import com.njcn.echarts.pojo.bo.TolerateData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务数据处理方法
|
||||
*
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年06月21日 11:04
|
||||
*/
|
||||
public class BusinessDataUtil {
|
||||
|
||||
|
||||
/***
|
||||
* 处理itic数据
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:05
|
||||
*/
|
||||
public static TolerateData dealIticData(List<List<Double>> originData) {
|
||||
List<List<Double>> tolerateData = new ArrayList<>();
|
||||
List<List<Double>> unTolerateData = new ArrayList<>();
|
||||
for (List<Double> list : originData) {
|
||||
//是否超过上限
|
||||
if (list.get(0) <= 0.03) {
|
||||
int line = 230 - 30000 * list.get(0).intValue();
|
||||
if (list.get(1) > line) {
|
||||
unTolerateData.add(list);
|
||||
} else {
|
||||
tolerateData.add(list);
|
||||
}
|
||||
} else if (list.get(0) <= 0.02) {
|
||||
if (list.get(1) > 120) {
|
||||
unTolerateData.add(list);
|
||||
} else {
|
||||
tolerateData.add(list);
|
||||
}
|
||||
} else if (list.get(0) <= 0.5) {
|
||||
if (list.get(1) > 120 || list.get(1) < 70) {
|
||||
unTolerateData.add(list);
|
||||
} else {
|
||||
tolerateData.add(list);
|
||||
}
|
||||
} else if (list.get(0) <= 10) {
|
||||
if (list.get(1) > 110 || list.get(1) < 80) {
|
||||
unTolerateData.add(list);
|
||||
} else {
|
||||
tolerateData.add(list);
|
||||
}
|
||||
} else {
|
||||
if (list.get(1) > 110 || list.get(1) < 90) {
|
||||
unTolerateData.add(list);
|
||||
} else {
|
||||
tolerateData.add(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new TolerateData(tolerateData, unTolerateData);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 处理F47数据
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:05
|
||||
*/
|
||||
public static TolerateData dealF47Data(List<List<Double>> originData) {
|
||||
List<List<Double>> tolerateData = new ArrayList<>();
|
||||
List<List<Double>> unTolerateData = new ArrayList<>();
|
||||
for (int i = 0; i < originData.size(); i++) {
|
||||
List<Double> list = originData.get(i);
|
||||
//是否超过上限
|
||||
if (list.get(0) < 0.05) {
|
||||
tolerateData.add(list);
|
||||
} else if (list.get(0) < 0.2) {
|
||||
if (list.get(1) > 50) {
|
||||
tolerateData.add(list);
|
||||
} else {
|
||||
unTolerateData.add(list);
|
||||
}
|
||||
} else if (list.get(0) < 0.5) {
|
||||
if (list.get(1) > 70) {
|
||||
tolerateData.add(list);
|
||||
} else {
|
||||
unTolerateData.add(list);
|
||||
}
|
||||
} else if (list.get(0) < 10) {
|
||||
if (list.get(1) > 80) {
|
||||
tolerateData.add(list);
|
||||
} else {
|
||||
unTolerateData.add(list);
|
||||
}
|
||||
} else {
|
||||
if (list.get(1) > 90) {
|
||||
tolerateData.add(list);
|
||||
} else {
|
||||
unTolerateData.add(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new TolerateData(tolerateData, unTolerateData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.njcn.echarts.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.echarts.pojo.enums.EchartResponseEnum;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.njcn.echarts.json.LineGenerator;
|
||||
import com.njcn.web.utils.RestTemplateUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -22,25 +21,104 @@ import java.util.Objects;
|
||||
@RequiredArgsConstructor
|
||||
public class DrawPicUtil {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
//目前写死,后续作为配置
|
||||
private final String URL = "http://192.168.1.18:5174/picture";
|
||||
|
||||
|
||||
/**
|
||||
* 请求目标服务器绘制echart图
|
||||
* @param url 目标url,例:http://192.168.1.13:8910?opt={1}&width={2}&height={3}
|
||||
*
|
||||
* @param option 图形参数
|
||||
* @return 图形的base64数据
|
||||
*/
|
||||
private String drawPic(String option) {
|
||||
return drawPic(option, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求目标服务器绘制echart图
|
||||
*
|
||||
* @param option 图形参数
|
||||
* @param width 图形宽度
|
||||
* @param height 图形高度
|
||||
* @return 图形的base64数据
|
||||
*/
|
||||
public String drawPic(String url,String option,int width,int height){
|
||||
ResponseEntity<HttpResult> result = restTemplate.getForEntity(url, HttpResult.class, option, width, height);
|
||||
if(result.getStatusCodeValue() != HttpStatus.HTTP_OK || Objects.isNull(Objects.requireNonNull(result.getBody()).getData())){
|
||||
throw new BusinessException(EchartResponseEnum.ECHART_COMMON_ERROR);
|
||||
}
|
||||
return result.getBody().getData().toString();
|
||||
private String drawPic(String option, int width, int height) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set("width", width == 0 ? 925 : width);
|
||||
jsonObject.set("height", height == 0 ? 300 : width);
|
||||
jsonObject.set("option", JSONUtil.parseObj(option));
|
||||
ResponseEntity<String> picResult = RestTemplateUtil.post(URL, jsonObject, String.class);
|
||||
return Objects.requireNonNull(picResult.getBody()).indexOf("image/png") > 0 ? picResult.getBody() : "";
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 绘制itic曲线图
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:01
|
||||
* @return String base64数据
|
||||
* @param originData 原始数据
|
||||
*/
|
||||
public String drawItic(List<List<Double>> originData) {
|
||||
return drawItic(originData, 0, 0);
|
||||
}
|
||||
|
||||
/***
|
||||
* 绘制itic曲线图
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:01
|
||||
* @return String base64数据
|
||||
* @param originData 原始数据
|
||||
*/
|
||||
public String drawItic(List<List<Double>> originData, int width, int height) {
|
||||
String iticJson = LineGenerator.generateIticOption(BusinessDataUtil.dealIticData(originData));
|
||||
return drawPic(iticJson, width, height);
|
||||
}
|
||||
|
||||
/***
|
||||
* 绘制f47曲线图
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:01
|
||||
* @return String base64数据
|
||||
* @param originData 原始数据
|
||||
*/
|
||||
public String drawF47(List<List<Double>> originData) {
|
||||
return drawF47(originData, 0, 0);
|
||||
}
|
||||
|
||||
/***
|
||||
* 绘制f47曲线图
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:01
|
||||
* @return String base64数据
|
||||
* @param originData 原始数据
|
||||
*/
|
||||
public String drawF47(List<List<Double>> originData, int width, int height) {
|
||||
String f47Json = LineGenerator.generateF47Option(BusinessDataUtil.dealF47Data(originData));
|
||||
return drawPic(f47Json, width, height);
|
||||
}
|
||||
|
||||
/***
|
||||
* 绘制概率分布图
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:01
|
||||
* @return String base64数据
|
||||
*/
|
||||
public String drawEventAmplitude(List<String> ylinedata, List<String> ybardata) {
|
||||
return drawEventAmplitude(ylinedata, ybardata, 0, 0);
|
||||
}
|
||||
|
||||
/***
|
||||
* 绘制概率分布图
|
||||
* @author hongawen
|
||||
* @date 2023/6/21 11:01
|
||||
* @return String base64数据
|
||||
*/
|
||||
public String drawEventAmplitude(List<String> ylinedata, List<String> ybardata, int width, int height) {
|
||||
String eventAmplitudeJson = LineGenerator.generateEventAmplitudeOption(ylinedata, ybardata);
|
||||
return drawPic(eventAmplitudeJson, width, height);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -5,24 +5,12 @@ 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 cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.abel533.echarts.Label;
|
||||
import com.github.abel533.echarts.Title;
|
||||
import com.github.abel533.echarts.axis.AxisLabel;
|
||||
import com.github.abel533.echarts.axis.CategoryAxis;
|
||||
import com.github.abel533.echarts.axis.SplitLine;
|
||||
import com.github.abel533.echarts.axis.ValueAxis;
|
||||
import com.github.abel533.echarts.code.AxisType;
|
||||
import com.github.abel533.echarts.code.SeriesType;
|
||||
import com.github.abel533.echarts.json.GsonOption;
|
||||
import com.github.abel533.echarts.series.Bar;
|
||||
import com.github.abel533.echarts.style.ItemStyle;
|
||||
import com.github.abel533.echarts.style.TextStyle;
|
||||
import com.github.abel533.echarts.style.itemstyle.Normal;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -40,6 +28,8 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.echarts.pojo.constant.PicCommonData;
|
||||
import com.njcn.echarts.util.DrawPicUtil;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.mapper.majornetwork.EventDetailMapper;
|
||||
import com.njcn.event.mapper.majornetwork.ReportMapper;
|
||||
@@ -67,6 +57,7 @@ import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
@@ -84,6 +75,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.sf.json.JSONArray;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -141,6 +133,8 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
private final ReportMapper reportMapper;
|
||||
|
||||
private final DrawPicUtil drawPicUtil;
|
||||
|
||||
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam, String id) {
|
||||
List<EventDetail> info = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
|
||||
@@ -161,24 +155,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
return info;
|
||||
}
|
||||
|
||||
public List<EventDetailNew> getED2(DeviceInfoParam.BusinessParam businessParam) {
|
||||
List<EventDetailNew> info = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
|
||||
List<String> lineIds = deviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
if(CollectionUtil.isNotEmpty(lineIds)){
|
||||
//数据暂降查询
|
||||
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||
.ge(StrUtil.isNotBlank(businessParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(businessParam.getSearchBeginTime())))
|
||||
.le(StrUtil.isNotBlank(businessParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(businessParam.getSearchEndTime())))
|
||||
);
|
||||
info = BeanUtil.copyToList(eventDetails, EventDetailNew.class);
|
||||
}else{
|
||||
throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂态统计(区域)
|
||||
@@ -1077,6 +1053,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
drawingPatriarch.createPicture(anchor3, sheets.addPicture(bytes4, HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||
PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response);
|
||||
}
|
||||
|
||||
public void sheet2(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) {
|
||||
sheets.createSheet("暂态严重度统计");
|
||||
HSSFSheet sheetAt = sheets.getSheetAt(1);
|
||||
@@ -1168,6 +1145,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sheet3(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException {
|
||||
sheets.createSheet("暂态原因统计");
|
||||
HSSFSheet sheetAt = sheets.getSheetAt(2);
|
||||
@@ -1273,6 +1251,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void sheet4(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) {
|
||||
sheets.createSheet("详细事件列表");
|
||||
HSSFSheet sheetAt = sheets.getSheetAt(3);
|
||||
@@ -1367,6 +1346,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sheet5(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) {
|
||||
sheets.createSheet("暂降次数统计");
|
||||
HSSFSheet sheetAt = sheets.getSheetAt(4);
|
||||
@@ -1434,6 +1414,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sheet6(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) {
|
||||
sheets.createSheet("暂升次数统计");
|
||||
HSSFSheet sheetAt = sheets.getSheetAt(5);
|
||||
@@ -1501,6 +1482,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sheet7(HSSFWorkbook sheets, HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle, DeviceInfoParam.BusinessParam businessParam) {
|
||||
sheets.createSheet("短时中断次数统计");
|
||||
HSSFSheet sheetAt = sheets.getSheetAt(6);
|
||||
@@ -1568,6 +1550,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<DetailVO> sheetList(DeviceInfoParam.BusinessParam businessParam, String id) {
|
||||
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData();
|
||||
List<String> lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
@@ -1595,7 +1578,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* sheet 详细数据列表
|
||||
*/
|
||||
@@ -1845,13 +1827,13 @@ public class ReportServiceImpl implements ReportService {
|
||||
int two = 1;
|
||||
if (exportParam.isSjdITIC()) {
|
||||
createTitle(doc, "4." + i + "." + two + " ITIC 曲线", "标题 3", 400, 15);
|
||||
String itic = getITIC(ass);
|
||||
String itic = drawPicUtil.drawItic(ass);
|
||||
createPic(doc, itic, "ITIC曲线");
|
||||
two++;
|
||||
}
|
||||
if (exportParam.isSjdF47()) {
|
||||
createTitle(doc, "4." + i + "." + two + " F47 曲线", "标题 3", 400, 15);
|
||||
String f47 = getF47(ass);
|
||||
String f47 = drawPicUtil.drawF47(ass);
|
||||
createPic(doc, f47, "SEMI F47曲线");
|
||||
two++;
|
||||
}
|
||||
@@ -1920,7 +1902,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
createTitle(doc, "4." + i + "." + two + " 暂降幅值的概率分函数", "标题 3", 400, 15);
|
||||
List<String> ybardata = probabilityVO.getPereventvalue();
|
||||
List<String> ylinedata = probabilityVO.getEventvalue();
|
||||
String fz = getFZ(ylinedata, ybardata);
|
||||
String fz = drawPicUtil.drawEventAmplitude(ylinedata, ybardata);
|
||||
createPic(doc, fz, "暂降幅值的概率分布函数");
|
||||
two++;
|
||||
}
|
||||
@@ -2122,10 +2104,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
return EchartsUtil.generateEchartsBase64(s, "8910");
|
||||
}
|
||||
|
||||
public String getPicName(JSONObject jsonObject) {
|
||||
ResponseEntity<HttpResult> forEntity = restTemplate.getForEntity("http://192.168.1.13:8910?opt={1}&width={2}&height={3}", HttpResult.class, jsonObject.toString(), 714, 300);
|
||||
return forEntity.getBody().getData().toString();
|
||||
}
|
||||
|
||||
public String getR(List<String> xname, List<ReasonsVO> map2, String barname) throws TemplateException, IOException {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
@@ -2175,177 +2153,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
return str;
|
||||
}
|
||||
|
||||
public JSONObject getBar1(List<String> xdata, List<Integer> ydata, String tl, String title, String xname, String yname) {
|
||||
//初始化option
|
||||
GsonOption option = new GsonOption();
|
||||
//设置标头
|
||||
Title title1 = new Title();
|
||||
TextStyle textStyle1 = new TextStyle();
|
||||
|
||||
textStyle1.setFontWeight(700);
|
||||
title1.text(title).x("center");
|
||||
title1.setTextStyle(textStyle1);
|
||||
option.title(title1);
|
||||
//图例
|
||||
option.legend().data(tl).x("left");
|
||||
option.color("#FF7E50");
|
||||
|
||||
CategoryAxis axis = new CategoryAxis();
|
||||
axis.data(xdata.toArray());
|
||||
axis.axisLabel(new AxisLabel().interval(0).show(true));
|
||||
// 起始和结束两端空白策略
|
||||
axis.boundaryGap(true);
|
||||
axis.splitLine(new SplitLine().show(false));
|
||||
axis.name(xname);
|
||||
option.xAxis(axis);
|
||||
|
||||
Bar bar = new Bar(tl);
|
||||
bar.setType(SeriesType.bar);
|
||||
bar.data(ydata.toArray());
|
||||
bar.barMaxWidth(30);
|
||||
setPosition(bar, "top", "#FF7E50");
|
||||
option.series(bar);
|
||||
|
||||
ValueAxis valueAxis = new ValueAxis();
|
||||
valueAxis.name(yname).type(AxisType.value);
|
||||
option.yAxis(valueAxis);
|
||||
|
||||
String replace = option.toString().replace(" ", "");
|
||||
|
||||
return new JSONObject(replace);
|
||||
}
|
||||
|
||||
public String getITIC(List<List<Double>> xbardata) throws TemplateException, IOException {
|
||||
List<List<Double>> point = new ArrayList<>();
|
||||
List<List<Double>> pointno = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < xbardata.size(); i++) {
|
||||
List<Double> list = xbardata.get(i);
|
||||
//是否超过上限
|
||||
if (list.get(0) <= 0.03) {
|
||||
int line = 230 - 30000 * list.get(0).intValue();
|
||||
if (list.get(1) > line) {
|
||||
pointno.add(list);
|
||||
} else {
|
||||
point.add(list);
|
||||
}
|
||||
} else if (list.get(0) <= 0.02) {
|
||||
if (list.get(1) > 120) {
|
||||
pointno.add(list);
|
||||
} else {
|
||||
point.add(list);
|
||||
}
|
||||
} else if (list.get(0) <= 0.5) {
|
||||
if (list.get(1) > 120 || list.get(1) < 70) {
|
||||
pointno.add(list);
|
||||
} else {
|
||||
point.add(list);
|
||||
}
|
||||
} else if (list.get(0) <= 10) {
|
||||
if (list.get(1) > 110 || list.get(1) < 80) {
|
||||
pointno.add(list);
|
||||
} else {
|
||||
point.add(list);
|
||||
}
|
||||
} else {
|
||||
if (list.get(1) > 110 || list.get(1) < 90) {
|
||||
pointno.add(list);
|
||||
} else {
|
||||
point.add(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("point", JSONArray.fromObject(point).toString());
|
||||
map.put("pointno", JSONArray.fromObject(pointno).toString());
|
||||
String str = getStr("bar3.ftl", map);
|
||||
return str;
|
||||
}
|
||||
|
||||
public String getF47(List<List<Double>> xbardata) throws TemplateException, IOException {
|
||||
List<List<Double>> point = new ArrayList<>();
|
||||
double[][] part = new double[8][2];
|
||||
part[0][0] = 0.05;
|
||||
part[0][1] = 0;
|
||||
part[1][0] = 0.05;
|
||||
part[1][1] = 50;
|
||||
part[2][0] = 0.2;
|
||||
part[2][1] = 50;
|
||||
part[3][0] = 0.2;
|
||||
part[3][1] = 70;
|
||||
part[4][0] = 0.5;
|
||||
part[4][1] = 70;
|
||||
part[5][0] = 0.5;
|
||||
part[5][1] = 80;
|
||||
part[6][0] = 10;
|
||||
part[6][1] = 80;
|
||||
part[7][0] = 1000;
|
||||
part[7][1] = 80;
|
||||
|
||||
double max = 0.0;
|
||||
for (int i = 0; i < part.length; i++) {
|
||||
if (part[i][1] > max) {
|
||||
max = part[i][1];
|
||||
}
|
||||
}
|
||||
|
||||
List<List<Double>> pointno = new ArrayList<>();
|
||||
for (int i = 0; i < xbardata.size(); i++) {
|
||||
List<Double> list = xbardata.get(i);
|
||||
//是否超过上限
|
||||
if (list.get(0) < 0.05) {
|
||||
pointno.add(list);
|
||||
} else if (list.get(0) < 0.2) {
|
||||
if (list.get(1) > 50) {
|
||||
point.add(list);
|
||||
} else {
|
||||
pointno.add(list);
|
||||
}
|
||||
} else if (list.get(0) < 0.5) {
|
||||
if (list.get(1) > 70) {
|
||||
point.add(list);
|
||||
} else {
|
||||
pointno.add(list);
|
||||
}
|
||||
} else {
|
||||
if (list.get(1) > 80) {
|
||||
point.add(list);
|
||||
} else {
|
||||
pointno.add(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("zdz", max);
|
||||
map.put("bjx", JSONArray.fromObject(part).toString());
|
||||
map.put("point", JSONArray.fromObject(point).toString());
|
||||
map.put("pointno", JSONArray.fromObject(pointno).toString());
|
||||
String str = getStr("bar4.ftl", map);
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bar
|
||||
* @param position 位置
|
||||
* @param color 颜色
|
||||
*/
|
||||
public void setPosition(Bar bar, String position, String color) {
|
||||
//设置标签
|
||||
Label label = new Label();
|
||||
label.show(true);
|
||||
label.position(position);
|
||||
TextStyle textStyle = new TextStyle();
|
||||
textStyle.setColor(color);
|
||||
ItemStyle itemStyle = new ItemStyle();
|
||||
label.setTextStyle(textStyle);
|
||||
Normal normal = new Normal();
|
||||
normal.label(label);
|
||||
itemStyle.setNormal(normal);
|
||||
bar.setItemStyle(itemStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格插入行数据
|
||||
*
|
||||
@@ -2377,8 +2184,10 @@ public class ReportServiceImpl implements ReportService {
|
||||
public void createPic(XWPFDocument document, String image, String name) throws IOException, InvalidFormatException, InvalidFormatException {
|
||||
XWPFParagraph picParagraph = WordUtils.getCenterParagraph(document);
|
||||
XWPFRun createRun = picParagraph.createRun();
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
byte[] bytes = decoder.decodeBuffer(image);
|
||||
if (image.contains(PicCommonData.PNG_PREFIX)) {
|
||||
image = image.replace(PicCommonData.PNG_PREFIX, "");
|
||||
}
|
||||
byte[] bytes = Base64.getDecoder().decode(image);
|
||||
InputStream in = new ByteArrayInputStream(bytes);
|
||||
createRun.addPicture(in, 5, name, Units.toEMU(410), Units.toEMU(170));
|
||||
}
|
||||
@@ -2521,7 +2330,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取区域报告
|
||||
*
|
||||
@@ -4835,7 +4643,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
r13.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
String itic = getITIC(list);
|
||||
String itic = drawPicUtil.drawItic(list);
|
||||
createPic(doc, itic, "ITIC曲线");
|
||||
|
||||
|
||||
@@ -4909,8 +4717,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
r13.setText(" F47曲线中可容忍" + typeName + "记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):");
|
||||
r13.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
String f47 = getF47(list);
|
||||
String f47 = drawPicUtil.drawF47(list);
|
||||
createPic(doc, f47, "SEMI F47曲线");
|
||||
|
||||
/**
|
||||
@@ -4940,7 +4747,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
r13.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
String f47 = getF47(list);
|
||||
String f47 = drawPicUtil.drawF47(list);
|
||||
createPic(doc, f47, "SEMI F47曲线");
|
||||
|
||||
|
||||
@@ -5072,13 +4879,13 @@ public class ReportServiceImpl implements ReportService {
|
||||
r12.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "幅值的概率分布函数", "标题 3", 400, 11);
|
||||
createTitle(doc, "4." + oneCount + "." + twoCount + " " + typeName + "幅值的概率分布", "标题 3", 400, 11);
|
||||
|
||||
|
||||
List<String> ybardata = probabilityDistributionArea.getPereventvalue();
|
||||
List<String> ylinedata = probabilityDistributionArea.getEventvalue();
|
||||
String fz = getFZ(ylinedata, ybardata);
|
||||
createPic(doc, fz, "" + typeName + "幅值的概率分布函数");
|
||||
createPic(doc, fz, "" + typeName + "幅值的概率分布");
|
||||
|
||||
|
||||
//序号计数进行++
|
||||
@@ -8053,7 +7860,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
r13.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
String itic = getITIC(list);
|
||||
String itic = drawPicUtil.drawItic(list);
|
||||
createPic(doc, itic, "ITIC曲线");
|
||||
|
||||
|
||||
@@ -8128,7 +7935,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
r13.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
String f47 = getF47(list);
|
||||
String f47 = drawPicUtil.drawF47(list);
|
||||
createPic(doc, f47, "SEMI F47曲线");
|
||||
|
||||
/**
|
||||
@@ -8157,8 +7964,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
r13.setText(" F47曲线中可容忍" + typeName + "降记录为:" + result.get(0) + "条;不可容忍" + typeName + "记录为:" + result.get(1) + "条,具体见下表(图):");
|
||||
r13.setFontSize(11);//字体大小
|
||||
|
||||
|
||||
String f47 = getF47(list);
|
||||
String f47 = drawPicUtil.drawF47(list);
|
||||
createPic(doc, f47, "SEMI F47曲线");
|
||||
|
||||
|
||||
@@ -9476,49 +9282,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
return result;
|
||||
}
|
||||
|
||||
//区域sql结果集(暂态)
|
||||
public List<EventDetailNew> TableInfo(AreaTableParam areaTableParam) {
|
||||
|
||||
StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE).
|
||||
append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaTableParam.getStartTime()))).append("' and ").append("time <= '")
|
||||
.append(DateUtil.endOfDay(DateUtil.parse(areaTableParam.getEndTime())))
|
||||
.append("' and ").append(areaTableParam.getStringBuilder()).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 query = influxDbUtils.query(stringResult.toString());
|
||||
|
||||
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetailNew> info = influxDBResultMapper.toPOJO(query, EventDetailNew.class);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
//区域sql结果集(暂降)
|
||||
public List<EventDetailNew> TableInfo1(AreaTableParam areaTableParam) {
|
||||
|
||||
StringBuilder stringResult = new StringBuilder(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE).
|
||||
append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(areaTableParam.getStartTime()))).append("' and ").append("time <= '")
|
||||
.append(DateUtil.endOfDay(DateUtil.parse(areaTableParam.getEndTime())))
|
||||
.append("' and ").append(areaTableParam.getStringBuilder()).append(" tz('Asia/Shanghai')");
|
||||
|
||||
|
||||
//结果集
|
||||
QueryResult query = influxDbUtils.query(stringResult.toString());
|
||||
|
||||
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetailNew> info = influxDBResultMapper.toPOJO(query, EventDetailNew.class);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
//重写ITIC曲线图
|
||||
public List<EventDetailNew> getPlotArea(AreaTableParam areaTableParam) {
|
||||
|
||||
return areaTableParam.getInfo();
|
||||
}
|
||||
|
||||
//获取区域幅值
|
||||
public ProbabilityVO getProbabilityDistributionArea(AreaTableParam areaTableParam) {
|
||||
@@ -10062,8 +9825,6 @@ public class ReportServiceImpl implements ReportService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* wr(公共查询条数)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user