From cb3cd5ee05938921d4c43bced329085c6594b471 Mon Sep 17 00:00:00 2001
From: xiaowuler <xiaowuler@163.com>
Date: Fri, 6 May 2022 16:02:40 +0800
Subject: [PATCH 1/2] modify some codes
---
04.系统编码/Backend/pom.xml | 6 ++
.../controller/QualityCompareController.java | 3 +-
.../service/QualityCompareService.java | 52 +++++++-----
.../src/main/resources/application.yml | 20 ++---
04.系统编码/Backend/部署.md | 6 ++
.../Frontend/src/components/RamanLidar.vue | 84 ++++++++++++-------
.../Frontend/src/model/constant.ts | 4 +-
.../Frontend/src/model/heat-map-drawer.ts | 4 +-
04.系统编码/Frontend/src/uilts/Config.ts | 8 +-
9 files changed, 119 insertions(+), 68 deletions(-)
diff --git a/04.系统编码/Backend/pom.xml b/04.系统编码/Backend/pom.xml
index 1f413de..51e8f7f 100644
--- a/04.系统编码/Backend/pom.xml
+++ b/04.系统编码/Backend/pom.xml
@@ -101,6 +101,12 @@
<artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version>
</dependency>
+ <dependency>
+ <groupId>org.jetbrains</groupId>
+ <artifactId>annotations</artifactId>
+ <version>RELEASE</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/QualityCompareController.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/QualityCompareController.java
index 944cfa2..f22053a 100644
--- a/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/QualityCompareController.java
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/QualityCompareController.java
@@ -22,8 +22,7 @@ public class QualityCompareController {
}
@RequestMapping("findByTimeAndElement")
- public RequestResult findByTimeAndElement(String date, String var, String locate) throws IOException {
- date = "5_1_10";
+ public RequestResult findByTimeAndElement(String date, String var, String locate) throws IOException, IllegalAccessException {
return RequestResult.success(qualityCompareService.findByTimeAndElement(date, var, locate));
}
}
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
index 86e2026..1c1f6da 100644
--- a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
@@ -8,6 +8,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.Duration;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -22,21 +23,36 @@ import java.util.stream.Collectors;
@Service
public class QualityCompareService {
+ private static final String EXTINCTION = "MEXT";
private static final String SEPARATOR = ",";
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy_M_d_HH");
+ private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
@Value("${custom.quality-path}")
private String qualityPath;
- public List<Float[]> findByTimeAndElement(String date, String var, String locate) throws IOException {
+ public List<Float[]> findByTimeAndElement(String date, String var, String locate) throws IOException, IllegalAccessException {
// String filepath = qualityPath + var + "-" + date + ".CSV";
- String filepath = "C:\\Users\\xiaowuler\\Desktop\\原始产品数据\\MEXT-2021-05-01.CSV";
- LocalDateTime time = LocalDateTime.parse("2021_" + date, DATE_FORMATTER).withHour(0).plusDays(1);
- return read(filepath, time);
+ boolean isExtinction = var.equals(EXTINCTION);
+ String filepath = String.format("%s/%s/%s/%s-%s.CSV", qualityPath, getFilepathByLocate(locate), isExtinction ? var : "Raman Products/" + var, var, date);
+ LocalDateTime time = LocalDate.parse(date, DATE_FORMATTER).atStartOfDay().plusDays(1);
+ return read(filepath, time, isExtinction? 801 : 101);
}
- private List<Float[]> read(String filepath, LocalDateTime time) throws IOException {
+ private String getFilepathByLocate(String locate) throws IllegalAccessException {
+ switch (locate){
+ case "pk":
+ return "CloudOutPut2_PUKOU/R1W4201224002";
+ case "liuhe":
+ return "CloudOutPut1_LIUHE/R1W4201224001";
+ case "jn":
+ return "CloudOutPut_JIANGNING/R1W4210113003";
+ default:
+ throw new IllegalAccessException("未知的站点:" + locate);
+ }
+ }
+
+ private List<Float[]> read(String filepath, LocalDateTime time, int readCount) throws IOException {
List<String> lines = Files.readAllLines(Paths.get(filepath));
// 将文件数据进行反转,从最后一行开始读取
Collections.reverse(lines);
@@ -50,8 +66,8 @@ public class QualityCompareService {
continue;
}
- time = fillNaN(time, targetTime, data);
- data.add(getValues(rows));
+ time = fillNaN(time, targetTime, data, readCount);
+ data.add(getValues(rows, readCount));
time = time.minusMinutes(5);
}
@@ -61,24 +77,22 @@ public class QualityCompareService {
return data.stream().filter(values -> index.getAndIncrement() % 12 != 0).collect(Collectors.toList());
}
- private LocalDateTime fillNaN(LocalDateTime time, LocalDateTime targetTime, List<Float[]> data){
+ private LocalDateTime fillNaN(LocalDateTime time, LocalDateTime targetTime, List<Float[]> data, int readCount){
if (Duration.between(targetTime, time).toMinutes() > 5) {
- Float[] values = new Float[801];
+ Float[] values = new Float[readCount];
Arrays.fill(values, Float.NaN);
data.add(values);
time = time.minusMinutes(10);
- fillNaN(time, targetTime, data);
+ fillNaN(time, targetTime, data, readCount);
}
return time;
}
- private Float[] getValues(List<String> rows){
- Float[] values = rows.stream().skip(7).limit(801).map(row -> Float.parseFloat(row)).toArray(Float[]::new);
- int length = values.length;
- if (length != 801) {
- values = Arrays.copyOf(values, 801);
- Arrays.fill(values, length - 1, 800, Float.NaN);
- }
- return values;
+ private Float[] getValues(List<String> rows, int readCount){
+ Float[] values = rows.stream().skip(7).limit(readCount - 6).map(row -> Float.parseFloat(row)).toArray(Float[]::new);
+ Float[] targetValues = new Float[readCount];
+ Arrays.fill(targetValues, Float.NaN);
+ System.arraycopy(values, 0, targetValues, 6, values.length);
+ return targetValues;
}
}
diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml
index c330c12..6392bef 100644
--- a/04.系统编码/Backend/src/main/resources/application.yml
+++ b/04.系统编码/Backend/src/main/resources/application.yml
@@ -6,12 +6,12 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
datasource:
- url: jdbc:mysql://112.124.40.88:33306/user_information?useUnicode=true&characteEncoding=utf-8
- username: root
- password: 3cqscbr@only1
-# url: jdbc:mysql://10.124.102.10:3306/user_information?useUnicode=true&characteEncoding=utf-8
+# url: jdbc:mysql://112.124.40.88:33306/user_information?useUnicode=true&characteEncoding=utf-8
# username: root
-# password: Njsqxj_sthj@2021
+# password: 3cqscbr@only1
+ url: jdbc:mysql://10.124.102.10:3306/user_information?useUnicode=true&characteEncoding=utf-8
+ username: root
+ password: Njsqxj_sthj@2021
# url: jdbc:mysql://192.168.6.6:3306/njsthj?useUnicode=true&characteEncoding=utf-8
# username: njsthj
# password: Njsqxj_sthj@2021
@@ -20,11 +20,11 @@ custom:
image:
url: ${custom.parent-url}:${server.port}/product
gifPath: ${custom.image.path}/gif
- path: D:/Deployments/LamanRadar/product
- parent-url: http://localhost
- quality-path: C:/Users/xiaowuler/Desktop/原始产品数据
-# path: /home/project/NJEnvironmentPlatform/html/product
-# parent-url: http://10.124.102.10
+# path: D:/Deployments/LamanRadar/product
+# parent-url: http://localhost
# quality-path: C:/Users/xiaowuler/Desktop/原始产品数据
+ path: /home/project/NJEnvironmentPlatform/html/product
+ parent-url: http://10.124.102.10
+ quality-path: /share/win
# path: /home/develop/product
# parent-url: http://rdp.nagr.com.cn
diff --git a/04.系统编码/Backend/部署.md b/04.系统编码/Backend/部署.md
index 9ba5837..c08b5bd 100644
--- a/04.系统编码/Backend/部署.md
+++ b/04.系统编码/Backend/部署.md
@@ -14,3 +14,9 @@ ps -ef | grep UserInformation-0.0.1-SNAPSHOT.jar
kill -9 id
```
+挂载
+
+```
+mount -t cifs -o username=administrator,password=xxzx_211@LMJGLD //10.124.102.250/AllData /share/win
+```
+
diff --git a/04.系统编码/Frontend/src/components/RamanLidar.vue b/04.系统编码/Frontend/src/components/RamanLidar.vue
index 27873c0..a2ac98e 100644
--- a/04.系统编码/Frontend/src/components/RamanLidar.vue
+++ b/04.系统编码/Frontend/src/components/RamanLidar.vue
@@ -224,7 +224,7 @@
<div class="picture-container raman-picture-container" v-show="currentElement === 'extinction'">
<div class="picture special-picture">
- <div v-loading="loadingExtinctionStatus"
+ <div v-loading="loadingExtinctionBeforeStatus"
style="width: 100%;"
custom-class="loading"
element-loading-text="加载中">
@@ -243,7 +243,7 @@
<div class="picture-container raman-picture-container" v-show="currentElement === 'watervapor'">
<div class="picture special-picture">
- <div v-loading="loadingWaterVaporStatus"
+ <div v-loading="loadingWatervaporBeforeStatus"
style="width: 100%"
element-loading-text="加载中">
<canvas id='watervapor_chart-before'></canvas>
@@ -281,6 +281,9 @@ export default {
name: 'RamanLidar',
setup() {
let timer = null;
+ const quailtyTimes = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
+ "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
+
let creates: {
boundaryLayerHeight: HighChartCreate
cloudsHeight: HighChartCreate
@@ -291,6 +294,7 @@ export default {
extinctionBeforeDrawer: HeatMapDrawer,
extinctionDrawer: HeatMapDrawer,
watervaporDrawer: HeatMapDrawer,
+ watervaporBeforeDrawer: HeatMapDrawer,
opticsExtinctionDrawer: HeatMapDrawer,
singleWatervaporDrawer: HeatMapDrawer,
cloudSolDrawer: HeatMapDrawer,
@@ -307,6 +311,7 @@ export default {
extinctionDrawer: null,
extinctionBeforeDrawer: null,
watervaporDrawer: null,
+ watervaporBeforeDrawer: null,
singleWatervaporDrawer: null,
opticsExtinctionDrawer: null,
cloudSolDrawer: null,
@@ -343,6 +348,8 @@ export default {
loadingCloudSolStatus: false,
loadingCloudRecognitionStatus: false,
loadingExtinctionStatus: false,
+ loadingExtinctionBeforeStatus: false,
+ loadingWatervaporBeforeStatus: false,
loadingWaterVaporStatus: false,
loadingBackscatterStatus: false,
loadingLidarRatioStatus: false,
@@ -589,40 +596,72 @@ export default {
case 'extinction' :
// initTimeLineDay()
reloadExtinctionBefore();
- reloadCloudRecognition('extinction', 801, 'extinction', drawExtinctionAfter);
+ reloadCloudRecognition('extinction', 801, 'extinction', drawExtinctionAfter, true);
break;
case 'watervapor' :
// initTimeLineDay()
- reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporBefore);
- reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporAfter);
+ reloadWatervaporBefore();
+ reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporAfter, true);
break;
default:
throw new Error("无效的type类型");
}
}
+ const reloadWatervaporBefore = () => {
+ options.loadingWatervaporBeforeStatus = true;
+ let params = {
+ date: moment(options.date).add(-1, 'd').format('YYYY-MM-DD'),
+ var: 'Vapor Mixing Ratio',
+ locate: options.currentRegion
+ }
+ post("/qualityCompare/findByTimeAndElement", params).then((response: any) => {
+ options.loadingWatervaporBeforeStatus = false;
+ if (response.error != 0){
+ console.log("未找到质控前数据文件");
+ return;
+ }
+
+ if (creates.watervaporBeforeDrawer != null) {
+ creates.watervaporBeforeDrawer.close();
+ }
+
+ let matrix = convertValueToBox(response.data);
+ creates.watervaporBeforeDrawer = new HeatMapDrawer(800, 650, matrix, "watervapor_chart-before", 'g/kg','质控前');
+ creates.watervaporBeforeDrawer.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 500, 1000, 1500], true, true));
+ creates.watervaporBeforeDrawer.setColorChart(prepareWatervaporColors());
+ creates.watervaporBeforeDrawer.draw();
+ })
+ }
+
const reloadExtinctionBefore = () => {
+ options.loadingExtinctionBeforeStatus = true;
let params = {
- date: moment(options.date).format('YYYY-MM-DD'),
+ date: moment(options.date).add(-1, 'd').format('YYYY-MM-DD'),
var: 'MEXT',
locate: options.currentRegion
}
post("/qualityCompare/findByTimeAndElement", params).then((response: any) => {
+ options.loadingExtinctionBeforeStatus = false;
if (response.error != 0){
console.log("未找到质控前数据文件");
return;
}
+ if (creates.extinctionBeforeDrawer != null) {
+ creates.extinctionBeforeDrawer.close();
+ }
+
let matrix = convertValueToBox(response.data);
- creates.extinctionBeforeDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-before", 'km/sr','质控后');
- creates.extinctionBeforeDrawer.setAxis(new CoordinateScale(options.timeArray), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
+ creates.extinctionBeforeDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-before", 'km/sr','质控前');
+ creates.extinctionBeforeDrawer.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.extinctionBeforeDrawer.setColorChart(prepareExtinctionnColors());
creates.extinctionBeforeDrawer.draw();
})
}
const convertValueToBox = (data) => {
- let timeMoment = moment(options.date).add(-1, 'd');
+ let timeMoment = moment(options.date).set('h', 0).add(-1, 'd');
let timeFormat = timeMoment.format("MM月DD日HH时");
let boxes = new Array<Array<Box>>();
@@ -635,7 +674,7 @@ export default {
let rows = new Array<Box>(r.length);
for (let h = 0, len = r.length; h < len; h++) {
- rows[h] = new Box(index - 1, h, 0, 0, r[h], h * 15, timeFormat, "米");
+ rows[h] = new Box(index - 1, h, 0, 0, parseFloat(r[h]), h * 15, timeFormat, "米");
}
index++;
boxes.push(rows);
@@ -919,21 +958,6 @@ export default {
creates.singleWatervaporDrawer.draw();
}
- const drawWatervaporBefore = (result: CustomeArray<any>) => {
- if (result.length != 24) return;
-
- options.loadingWaterVaporStatus = false;
- if (creates.watervaporDrawer != null) {
- creates.watervaporDrawer.close();
- }
-
- let matrix = converCloudRecognition(101, result, 'watervapor');
- creates.watervaporDrawer = new HeatMapDrawer(800, 650, matrix, "watervapor_chart-before",'g/kg', '质控前');
- creates.watervaporDrawer.setAxis(new CoordinateScale(options.timeArray), new CoordinateScale([0, 500, 1000, 1500], true, true));
- creates.watervaporDrawer.setColorChart(prepareWatervaporColors());
- creates.watervaporDrawer.draw();
- }
-
const drawWatervaporAfter = (result: CustomeArray<any>) => {
if (result.length != 24) return;
@@ -943,8 +967,8 @@ export default {
}
let matrix = converCloudRecognition(101, result, 'watervapor');
- creates.watervaporDrawer = new HeatMapDrawer(800, 650, matrix, "watervapor_chart-after",'g/kg', '质控后');
- creates.watervaporDrawer.setAxis(new CoordinateScale(options.timeArray), new CoordinateScale([0, 500, 1000, 1500], true, true));
+ creates.watervaporDrawer = new HeatMapDrawer(800, 650, matrix, "watervapor_chart-after",'g/kg', '质控前');
+ creates.watervaporDrawer.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 500, 1000, 1500], true, true));
creates.watervaporDrawer.setColorChart(prepareWatervaporColors());
creates.watervaporDrawer.draw();
}
@@ -966,7 +990,7 @@ export default {
let matrix = converCloudRecognition(801, result, 'extinction');
creates.extinctionDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-after", 'km/sr','质控后');
- creates.extinctionDrawer.setAxis(new CoordinateScale(options.timeArray), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
+ creates.extinctionDrawer.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.extinctionDrawer.setColorChart(prepareExtinctionnColors());
creates.extinctionDrawer.draw();
}
@@ -980,10 +1004,12 @@ export default {
return colorChart;
}
- const reloadCloudRecognition = (type: string, capacity: number, element: string, callback: any) => {
+ const reloadCloudRecognition = (type: string, capacity: number, element: string, callback: any, isDay: boolean = false) => {
preprocessing(type);
let result = new CustomeArray(callback);
let time = moment(options.date);
+ if (isDay) time.set('h', 23).add(-1, 'd');
+
options.timeArray = []
for (let index = 0; index < 24; index++) {
reloadSingleCloudRecognition(capacity, time.clone().add(-index, 'h').format('M_D_H'), element, result);
diff --git a/04.系统编码/Frontend/src/model/constant.ts b/04.系统编码/Frontend/src/model/constant.ts
index 3f9b68c..90184dd 100644
--- a/04.系统编码/Frontend/src/model/constant.ts
+++ b/04.系统编码/Frontend/src/model/constant.ts
@@ -2,6 +2,6 @@ export class Constant{
public static readonly baseUrl: string = 'http://rdp.nagr.com.cn:18080';
}
export class ConstantRamanLidar{
- public static readonly baseUrl: string = 'http://112.124.40.88:5511';
- // public static readonly baseUrl: string = 'http://10.124.102.10:9998';
+ // public static readonly baseUrl: string = 'http://112.124.40.88:5511';
+ public static readonly baseUrl: string = 'http://10.124.102.10:9998';
}
\ No newline at end of file
diff --git a/04.系统编码/Frontend/src/model/heat-map-drawer.ts b/04.系统编码/Frontend/src/model/heat-map-drawer.ts
index a631e65..64f5062 100644
--- a/04.系统编码/Frontend/src/model/heat-map-drawer.ts
+++ b/04.系统编码/Frontend/src/model/heat-map-drawer.ts
@@ -381,11 +381,11 @@ export class HeatMapDrawer{
export class CoordinateScale {
- public scales: Array<number>;
+ public scales: Array<Object>;
public showStartValue: boolean;
public showEndValue: boolean;
- constructor(scales: Array<number>, showStartValue: boolean = false, showEndValue: boolean = false){
+ constructor(scales: Array<Object>, showStartValue: boolean = false, showEndValue: boolean = false){
this.scales = scales;
this.showEndValue = showEndValue;
this.showStartValue = showStartValue;
diff --git a/04.系统编码/Frontend/src/uilts/Config.ts b/04.系统编码/Frontend/src/uilts/Config.ts
index 6662a4e..115f322 100644
--- a/04.系统编码/Frontend/src/uilts/Config.ts
+++ b/04.系统编码/Frontend/src/uilts/Config.ts
@@ -2,10 +2,10 @@ import { Moment } from "moment";
import { format } from "./String";
export class Config {
- // public static url: string = "";
- // public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
- public static url: string = "http://localhost:8002";
- public static parentUrl: string = "http://112.124.40.88:8999/product/picture";
+ public static url: string = "";
+ public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
+ // public static url: string = "http://localhost:8002";
+ // public static parentUrl: string = "http://112.124.40.88:8999/product/picture";
// public static parentUrl: string = "http://rdp.nagr.com.cn:8082/product/picture";
}
From cc90aa2875fa6bf2034d70b35c40dc51a2b055ed Mon Sep 17 00:00:00 2001
From: xiaowuler <xiaowuler@163.com>
Date: Fri, 6 May 2022 18:20:53 +0800
Subject: [PATCH 2/2] modify some codes
---
.../service/QualityCompareService.java | 100 ++++++++++++++++--
.../src/main/resources/application.yml | 22 ++--
.../Frontend/src/components/RamanLidar.vue | 75 +++++++------
.../Frontend/src/model/constant.ts | 4 +-
04.系统编码/Frontend/src/uilts/Config.ts | 8 +-
5 files changed, 152 insertions(+), 57 deletions(-)
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
index 1c1f6da..394ec59 100644
--- a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
@@ -25,18 +25,104 @@ public class QualityCompareService {
private static final String EXTINCTION = "MEXT";
private static final String SEPARATOR = ",";
- private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+
+ private static final DateTimeFormatter NORMAL_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH");
+
+ private static List<Float[]> ONE_HOUR_INVALID_101 = new ArrayList<>(12);
+ private static List<Float[]> ONE_HOUR_INVALID_801 = new ArrayList<>(12);
+ static {
+ for(int i = 0; i < 12; i++) {
+ Float[] _101 = new Float[101];
+ Float[] _801 = new Float[801];
+ Arrays.fill(_101, Float.NaN);
+ Arrays.fill(_801, Float.NaN);
+ ONE_HOUR_INVALID_101.add(_101);
+ ONE_HOUR_INVALID_801.add(_801);
+ }
+ }
@Value("${custom.quality-path}")
private String qualityPath;
public List<Float[]> findByTimeAndElement(String date, String var, String locate) throws IOException, IllegalAccessException {
-// String filepath = qualityPath + var + "-" + date + ".CSV";
- boolean isExtinction = var.equals(EXTINCTION);
- String filepath = String.format("%s/%s/%s/%s-%s.CSV", qualityPath, getFilepathByLocate(locate), isExtinction ? var : "Raman Products/" + var, var, date);
- LocalDateTime time = LocalDate.parse(date, DATE_FORMATTER).atStartOfDay().plusDays(1);
- return read(filepath, time, isExtinction? 801 : 101);
+//// String filepath = qualityPath + var + "-" + date + ".CSV";
+// boolean isExtinction = var.equals(EXTINCTION);
+// String filepath = String.format("%s/%s/%s/%s-%s.CSV", qualityPath, getFilepathByLocate(locate), isExtinction ? var : "Raman Products/" + var, var, time.format(TIME_FORMATTER));
+//// return read(filepath, time, isExtinction? 801 : 101);
+//// List<Float[]> data = read(var, locate, time, isExtinction? 801 : 101);
+ int timeLength = 24;
+ LocalDateTime time = LocalDateTime.parse(date, DATE_FORMATTER).withMinute(59).withSecond(59);
+ LocalDateTime tempTime = time;
+ List<Float[]> data = new ArrayList<>(288);
+ int readCount = 101;
+ String fileSuffix = "Raman Products/" + var;
+ List<Float[]> invalid = ONE_HOUR_INVALID_101;
+
+ if (var.equals(EXTINCTION)){
+ tempTime = time;
+ timeLength = 12;
+ readCount = 801;
+ fileSuffix = var;
+ invalid = ONE_HOUR_INVALID_801;
+ }
+ LocalDateTime startTime = time.minusHours(timeLength);
+ data = read(var, locate, tempTime, startTime, data, readCount, fileSuffix, invalid, 0, timeLength);
+ Collections.reverse(data);
+ AtomicInteger index = new AtomicInteger(0);
+ // 匹配老师处理的数据
+ return data.stream().filter(values -> index.getAndIncrement() % 12 != 0).collect(Collectors.toList());
+ }
+
+ private List<Float[]> read(String var, String locate, LocalDateTime tempTime, LocalDateTime startTime, List<Float[]> data, int readCount, String fileSuffix, List<Float[]> invalid, int currentLength, int timeLength) throws IOException, IllegalAccessException {
+ String filepath = String.format("%s/%s/%s/%s-%s.CSV", qualityPath, getFilepathByLocate(locate), fileSuffix, var, tempTime.format(TIME_FORMATTER));
+ if (Files.notExists(Paths.get(filepath))) {
+ return addInvalidOrBlackFile(var, locate, tempTime, startTime, data, readCount, fileSuffix, invalid, data.size() / 12, timeLength);
+ }
+
+ List<String> lines = Files.readAllLines(Paths.get(filepath));
+ // 将文件数据进行反转,从最后一行开始读取
+ Collections.reverse(lines);
+
+ int addCount = 0;
+ for(String line : lines){
+ List<String> rows = Arrays.asList(line.split(SEPARATOR));
+ // 相关数据时间转换,以比较,并按照10分钟间隔过滤
+ LocalDateTime targetTime = LocalDateTime.parse(rows.get(0), NORMAL_TIME_FORMATTER);
+ if (targetTime.isAfter(tempTime)) {
+ continue;
+ }
+
+ addCount++;
+ tempTime = fillNaN(tempTime, targetTime, data, readCount);
+ data.add(getValues(rows, readCount));
+ tempTime = tempTime.minusMinutes(5);
+ if (tempTime.isBefore(startTime)) {
+ return data;
+ }
+ }
+
+ // 文件是空的
+ if (addCount == 0) {
+ return addInvalidOrBlackFile(var, locate, tempTime, startTime, data, readCount, fileSuffix, invalid, data.size() / 12, timeLength);
+ }
+
+ return read(var, locate, tempTime, startTime, data, readCount, fileSuffix, invalid, data.size() / 12, timeLength);
+ }
+
+ private List<Float[]> addInvalidOrBlackFile(String var, String locate, LocalDateTime tempTime, LocalDateTime startTime, List<Float[]> data, int readCount, String fileSuffix, List<Float[]> invalid, int currentLength, int timeLength) throws IOException, IllegalAccessException {
+ int hours = tempTime.getHour() + 1 - currentLength;
+ boolean isOut = hours > timeLength || hours <= 0;
+ for(int i = 0, len = isOut ? timeLength - currentLength : hours; i < len; i++) {
+ data.addAll(invalid);
+ }
+ if (isOut) {
+ return data;
+ }
+
+ tempTime = tempTime.minusDays(1).withHour(23);
+ return read(var, locate, tempTime, startTime, data, readCount, fileSuffix, invalid, data.size() / 12, timeLength);
}
private String getFilepathByLocate(String locate) throws IllegalAccessException {
diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml
index 6392bef..e5ce902 100644
--- a/04.系统编码/Backend/src/main/resources/application.yml
+++ b/04.系统编码/Backend/src/main/resources/application.yml
@@ -6,12 +6,12 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
datasource:
-# url: jdbc:mysql://112.124.40.88:33306/user_information?useUnicode=true&characteEncoding=utf-8
-# username: root
-# password: 3cqscbr@only1
- url: jdbc:mysql://10.124.102.10:3306/user_information?useUnicode=true&characteEncoding=utf-8
+ url: jdbc:mysql://112.124.40.88:33306/user_information?useUnicode=true&characteEncoding=utf-8
username: root
- password: Njsqxj_sthj@2021
+ password: 3cqscbr@only1
+# url: jdbc:mysql://10.124.102.10:3306/user_information?useUnicode=true&characteEncoding=utf-8
+# username: root
+# password: Njsqxj_sthj@2021
# url: jdbc:mysql://192.168.6.6:3306/njsthj?useUnicode=true&characteEncoding=utf-8
# username: njsthj
# password: Njsqxj_sthj@2021
@@ -20,11 +20,11 @@ custom:
image:
url: ${custom.parent-url}:${server.port}/product
gifPath: ${custom.image.path}/gif
-# path: D:/Deployments/LamanRadar/product
-# parent-url: http://localhost
-# quality-path: C:/Users/xiaowuler/Desktop/原始产品数据
- path: /home/project/NJEnvironmentPlatform/html/product
- parent-url: http://10.124.102.10
- quality-path: /share/win
+ path: D:/Deployments/LamanRadar/product
+ parent-url: http://localhost
+ quality-path: E:/Memorandum/VPN配置/南京/多曼雷达项目/AllData
+# path: /home/project/NJEnvironmentPlatform/html/product
+# parent-url: http://10.124.102.10
+# quality-path: /share/win
# path: /home/develop/product
# parent-url: http://rdp.nagr.com.cn
diff --git a/04.系统编码/Frontend/src/components/RamanLidar.vue b/04.系统编码/Frontend/src/components/RamanLidar.vue
index f8ff90e..631e7a0 100644
--- a/04.系统编码/Frontend/src/components/RamanLidar.vue
+++ b/04.系统编码/Frontend/src/components/RamanLidar.vue
@@ -51,7 +51,7 @@
</div>
<div class="container panel">
- <div class="toolbar day-toolbar" v-if="currentElement === 'singleWatervapor' || currentElement === 'aod-icot-wcot'
+ <div class="toolbar day-toolbar" v-if="currentElement === 'extinction' || currentElement === 'singleWatervapor' || currentElement === 'aod-icot-wcot'
|| currentElement === 'extinctionOptics' || currentElement === 'backscatter'
|| currentElement === 'pm2_5' || currentElement === 'pblh'
|| currentElement === 'cloudSol' || currentElement === 'cloudbaseheight'
@@ -72,7 +72,7 @@
</div>
</div>
- <div class="toolbar day-toolbar" v-if="currentElement === 'extinction' || currentElement=== 'lidarratio' || currentElement === 'watervapor'">
+ <div class="toolbar day-toolbar" v-if="currentElement=== 'lidarratio' || currentElement === 'watervapor'">
<div class="times">
<div class="time-item" v-for="(time, index) in times" :key="index"
:class="{'active': currentTime === time.date, 'first-hour': time.day === '01'}">
@@ -324,7 +324,7 @@ export default {
// currentElement: 'PBLH',
currentType: '边界层高度',
// date: moment('2022-04-01 12:00:00').format('YYYY-MM-DD HH:mm:ss'),
- date: moment().format('YYYY-MM-DD HH:mm:ss'),
+ date: moment().format('YYYY-MM-DD 00:00:00'),
times: [],
currentTime: null,
downloadImgUrl: '/images/default-picture.png',
@@ -374,13 +374,11 @@ export default {
label: '水汽'
}],
currentElement: 'layertype',
- timeLineFormat: 'hour'
+ timeLineFormat: 'day'
})
onMounted(() => {
- // initTimeLine();
- initTimeLineDay();
- // setTitle(moment(options.date, 'YYYY-MM-DD'));
+ initTimeLine(true);
setTimeout(() => {
initEcharts(options.currentTab)
reloadChangeData();
@@ -453,19 +451,23 @@ export default {
}
const onTabClick = (name) => {
- changeTimeLineFormat(name);
+ setAndChangeCurrentTime(name);
options.currentTab = name;
initEcharts(name)
reloadChangeData()
}
- const changeTimeLineFormat = (name) => {
- if (name === 'MWR'){
- initTimeLineDay();
- return;
+ const setAndChangeCurrentTime = (name) => {
+ options.index = 23;
+ if ("MWR" === name){
+ options.date = moment().format('YYYY-MM-DD 00:00:00');
+ options.timeLineFormat = "";
+ }else{
+ options.date = moment().format('YYYY-MM-DD HH:00:00');
+ options.timeLineFormat = "";
}
-
- initTimeLine();
+
+ options.currentTime = options.date;
}
const reloadChangeData = () => {
@@ -547,25 +549,25 @@ export default {
const elementChange = (code: string) => {
switch (code) {
case 'singleWatervapor' :
- // initTimeLine()
+ initTimeLine()
reloadCloudRecognition('singleWatervapor', 101, 'watervapor', drawSingleWatervapor);
break;
case 'aod-icot-wcot' :
- // initTimeLine()
+ initTimeLine()
reloadChartsRecognition('aod', drawAerosolCharts);
reloadChartsRecognition('icot', drawIceCloudsCharts);
reloadChartsRecognition('wcot', drawWaterCloud);
break;
case 'extinctionOptics' :
- // initTimeLine()
+ initTimeLine()
reloadCloudRecognition('extinctionOptics', 801, 'extinction', drawOpticsExtinction);
break;
case 'backscatter' :
- // initTimeLine()
+ initTimeLine()
reloadCloudRecognition('backscatter', 801, 'backscatter', drawBackscatter);
break;
case 'pm2_5' :
- // initTimeLine()
+ initTimeLine()
reloadCloudRecognition('pm2_5', 201, 'pm2_5', drawPm2Point5);
reloadCloudRecognition('pm2_5', 201, 'pm10', drawPm10);
break;
@@ -582,11 +584,11 @@ export default {
reloadCloudRecognition('cloudSol', 801, 'layertype', drawCloudSol);
break;
case 'cloudbaseheight' :
- // initTimeLine()
+ initTimeLine()
reloadChartsRecognition('cloudbaseheight', drawCloudsHeightCharts);
break;
case 'cloudtopheight' :
- // initTimeLine()
+ initTimeLine()
reloadChartsRecognition('cloudtopheight', drawCloudTopHeightCharts);
break;
// case 'layertype' :
@@ -594,11 +596,12 @@ export default {
// break;
case 'extinction' :
// initTimeLineDay()
+ initTimeLine(true);
reloadExtinctionBefore();
- reloadCloudRecognition('extinction', 801, 'extinction', drawExtinctionAfter, true);
+ reloadCloudRecognition('extinction', 801, 'extinction', drawExtinctionAfter, false, 12);
break;
case 'watervapor' :
- // initTimeLineDay()
+ initTimeLineDay()
reloadWatervaporBefore();
reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporAfter, true);
break;
@@ -610,7 +613,7 @@ export default {
const reloadWatervaporBefore = () => {
options.loadingWatervaporBeforeStatus = true;
let params = {
- date: moment(options.date).add(-1, 'd').format('YYYY-MM-DD'),
+ date: moment(options.date).format('YYYY-MM-DD 00'),
var: 'Vapor Mixing Ratio',
locate: options.currentRegion
}
@@ -636,7 +639,7 @@ export default {
const reloadExtinctionBefore = () => {
options.loadingExtinctionBeforeStatus = true;
let params = {
- date: moment(options.date).add(-1, 'd').format('YYYY-MM-DD'),
+ date: moment(options.date).format('YYYY-MM-DD HH'),
var: 'MEXT',
locate: options.currentRegion
}
@@ -653,14 +656,19 @@ export default {
let matrix = convertValueToBox(response.data);
creates.extinctionBeforeDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-before", 'km/sr','质控前');
- creates.extinctionBeforeDrawer.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
+ creates.extinctionBeforeDrawer.setAxis(new CoordinateScale(options.timeArray), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.extinctionBeforeDrawer.setColorChart(prepareExtinctionnColors());
creates.extinctionBeforeDrawer.draw();
})
}
const convertValueToBox = (data) => {
- let timeMoment = moment(options.date).set('h', 0).add(-1, 'd');
+ let timeMoment = moment(options.date).set('h', 1).add(-1, 'd');
+ console.log(options.currentElement)
+ if (options.currentElement === 'extinction'){
+ timeMoment.add(12, 'h');
+ }
+
let timeFormat = timeMoment.format("MM月DD日HH时");
let boxes = new Array<Array<Box>>();
@@ -980,7 +988,7 @@ export default {
}
const drawExtinctionAfter = (result: CustomeArray<any>) => {
- if (result.length != 24) return;
+ if (result.length != 12) return;
options.loadingExtinctionStatus = false;
if (creates.extinctionDrawer != null) {
@@ -989,7 +997,7 @@ export default {
let matrix = converCloudRecognition(801, result, 'extinction');
creates.extinctionDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-after", 'km/sr','质控后');
- creates.extinctionDrawer.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
+ creates.extinctionDrawer.setAxis(new CoordinateScale(options.timeArray), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.extinctionDrawer.setColorChart(prepareExtinctionnColors());
creates.extinctionDrawer.draw();
}
@@ -1003,14 +1011,14 @@ export default {
return colorChart;
}
- const reloadCloudRecognition = (type: string, capacity: number, element: string, callback: any, isDay: boolean = false) => {
+ const reloadCloudRecognition = (type: string, capacity: number, element: string, callback: any, isDay: boolean = false, length = 24) => {
preprocessing(type);
let result = new CustomeArray(callback);
let time = moment(options.date);
if (isDay) time.set('h', 23).add(-1, 'd');
options.timeArray = []
- for (let index = 0; index < 24; index++) {
+ for (let index = 0; index < length; index++) {
reloadSingleCloudRecognition(capacity, time.clone().add(-index, 'h').format('M_D_H'), element, result);
options.timeArray.push(time.clone().add(-index, 'h').format('HH'))
}
@@ -1291,12 +1299,13 @@ export default {
// }
//初始化时间轴
- const initTimeLine = () => {
+ const initTimeLine = (isQuality: boolean = false) => {
if (options.timeLineFormat == "hour") return;
options.timeLineFormat = "hour";
options.times = [];
options.currentTime = moment(options.date).format('YYYY-MM-DD HH');
- let now = moment(options.date).add(1, 'h')
+ let now = moment(options.date).add(1, 'h');
+ if (isQuality) now = now.set('h', 1);
for (let i = 0; i < 24; i++) {
options.times.push({
hour: now.add(-1, 'hour').format('HH'),
diff --git a/04.系统编码/Frontend/src/model/constant.ts b/04.系统编码/Frontend/src/model/constant.ts
index 90184dd..3f9b68c 100644
--- a/04.系统编码/Frontend/src/model/constant.ts
+++ b/04.系统编码/Frontend/src/model/constant.ts
@@ -2,6 +2,6 @@ export class Constant{
public static readonly baseUrl: string = 'http://rdp.nagr.com.cn:18080';
}
export class ConstantRamanLidar{
- // public static readonly baseUrl: string = 'http://112.124.40.88:5511';
- public static readonly baseUrl: string = 'http://10.124.102.10:9998';
+ public static readonly baseUrl: string = 'http://112.124.40.88:5511';
+ // public static readonly baseUrl: string = 'http://10.124.102.10:9998';
}
\ No newline at end of file
diff --git a/04.系统编码/Frontend/src/uilts/Config.ts b/04.系统编码/Frontend/src/uilts/Config.ts
index 115f322..6662a4e 100644
--- a/04.系统编码/Frontend/src/uilts/Config.ts
+++ b/04.系统编码/Frontend/src/uilts/Config.ts
@@ -2,10 +2,10 @@ import { Moment } from "moment";
import { format } from "./String";
export class Config {
- public static url: string = "";
- public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
- // public static url: string = "http://localhost:8002";
- // public static parentUrl: string = "http://112.124.40.88:8999/product/picture";
+ // public static url: string = "";
+ // public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
+ public static url: string = "http://localhost:8002";
+ public static parentUrl: string = "http://112.124.40.88:8999/product/picture";
// public static parentUrl: string = "http://rdp.nagr.com.cn:8082/product/picture";
}