Browse Source

1、解决导出报告大气数据为空问题;2、解决导出报告图片太大问题;

tags/V1.0.1^2
wanjing 1 year ago
parent
commit
8ef496f210
2 changed files with 22 additions and 22 deletions
  1. +21
    -21
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/ExportReportService.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/GenerateReportWordService.java

+ 21
- 21
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/ExportReportService.java View File

@@ -179,45 +179,45 @@ public class ExportReportService {
String singlePointConcentrationMax = "";
String singlePointConcentrationMin = "";
if ("co".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getCo())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getCo()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getCo()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getCo().isEmpty()).map(p -> Double.parseDouble(p.getCo())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getCo().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getCo()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getCo().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getCo()))).get();
singlePointConcentrationMax = airDataMax.getCo();
singlePointConcentrationMin = airDataMin.getCo();
} else if ("pm_10".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getPm10())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getPm10()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getPm10()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getPm10().isEmpty()).map(p -> Double.parseDouble(p.getPm10())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getPm10().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getPm10()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getPm10().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getPm10()))).get();
singlePointConcentrationMax = airDataMax.getPm10();
singlePointConcentrationMin = airDataMin.getPm10();
} else if ("pm_2_5".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getPm25())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getPm25()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getPm25()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getPm25().isEmpty()).map(p -> Double.parseDouble(p.getPm25())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getPm25().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getPm25()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getPm25().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getPm25()))).get();
singlePointConcentrationMax = airDataMax.getPm25();
singlePointConcentrationMin = airDataMin.getPm25();
} else if ("so2".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getSo2())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getSo2()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getSo2()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getSo2().isEmpty()).map(p -> Double.parseDouble(p.getSo2())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getSo2().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getSo2()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getSo2().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getSo2()))).get();
singlePointConcentrationMax = airDataMax.getSo2();
singlePointConcentrationMin = airDataMin.getSo2();
} else if ("vocs".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getVocs())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getVocs()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getVocs()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getVocs().isEmpty()).map(p -> Double.parseDouble(p.getVocs())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getVocs().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getVocs()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getVocs().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getVocs()))).get();
singlePointConcentrationMax = airDataMax.getVocs();
singlePointConcentrationMin = airDataMin.getVocs();
} else if ("no2".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getNo2())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getNo2()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getNo2()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getNo2().isEmpty()).map(p -> Double.parseDouble(p.getNo2())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getNo2().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getNo2()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getNo2().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getNo2()))).get();
singlePointConcentrationMax = airDataMax.getNo2();
singlePointConcentrationMin = airDataMin.getNo2();
} else if ("o3".equals(airDataType.getDataType())) {
list = airDataList.stream().map(p -> Double.parseDouble(p.getO3())).collect(Collectors.toList());
airDataMax = airDataList.stream().max(Comparator.comparing(x -> Double.parseDouble(x.getO3()))).get();
airDataMin = airDataList.stream().min(Comparator.comparing(x -> Double.parseDouble(x.getO3()))).get();
list = airDataList.stream().filter(x -> x != null && !x.getO3().isEmpty()).map(p -> Double.parseDouble(p.getO3())).collect(Collectors.toList());
airDataMax = airDataList.stream().filter(x -> x != null && !x.getO3().isEmpty()).max(Comparator.comparing(x -> Double.parseDouble(x.getO3()))).get();
airDataMin = airDataList.stream().filter(x -> x != null && !x.getO3().isEmpty()).min(Comparator.comparing(x -> Double.parseDouble(x.getO3()))).get();
singlePointConcentrationMax = airDataMax.getO3();
singlePointConcentrationMin = airDataMin.getO3();
} else {

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airData/report/GenerateReportWordService.java View File

@@ -52,7 +52,7 @@ public class GenerateReportWordService {
wordUtils.insertContext(airDataType.getDataType() + "网格浓度最小值:" + request.getGridConcentrationMix(), 10, Font.NORMAL, Element.ALIGN_LEFT, 20, 2, 2);
wordUtils.insertContext(airDataType.getDataType() + "单点浓度最高值:" + request.getSinglePointConcentrationMax(), 10, Font.NORMAL, Element.ALIGN_LEFT, 20, 2, 2);
wordUtils.insertContext(airDataType.getDataType() + "单点浓度最低值:" + request.getSinglePointConcentrationMin(), 10, Font.NORMAL, Element.ALIGN_LEFT, 20, 2, 2);
wordUtils.insertImg(request.getOssUrl(), Image.ALIGN_CENTER, 500, 400, 100, 100, 100, 0);
wordUtils.insertImg(request.getOssUrl(), Image.ALIGN_CENTER, 500, 400, 100, 40, 40, 0);
wordUtils.insertImg(airDataType.getReferenceIndicatorHorizontalImage(), Image.ALIGN_CENTER, 500, 10, 100, 10, 10, 0);
} catch (DocumentException e) {
log.info("生成报告word异常");

Loading…
Cancel
Save