Browse Source

modify some codes

master
xiaowuler 3 years ago
parent
commit
cb3cd5ee05
  1. 6
      04.系统编码/Backend/pom.xml
  2. 3
      04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/QualityCompareController.java
  3. 52
      04.系统编码/Backend/src/main/java/com/userinformation/backend/service/QualityCompareService.java
  4. 20
      04.系统编码/Backend/src/main/resources/application.yml
  5. 6
      04.系统编码/Backend/部署.md
  6. 84
      04.系统编码/Frontend/src/components/RamanLidar.vue
  7. 4
      04.系统编码/Frontend/src/model/constant.ts
  8. 4
      04.系统编码/Frontend/src/model/heat-map-drawer.ts
  9. 8
      04.系统编码/Frontend/src/uilts/Config.ts

6
04.系统编码/Backend/pom.xml

@ -101,6 +101,12 @@
<artifactId>bcprov-jdk15on</artifactId> <artifactId>bcprov-jdk15on</artifactId>
<version>1.59</version> <version>1.59</version>
</dependency> </dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

3
04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/QualityCompareController.java

@ -22,8 +22,7 @@ public class QualityCompareController {
} }
@RequestMapping("findByTimeAndElement") @RequestMapping("findByTimeAndElement")
public RequestResult findByTimeAndElement(String date, String var, String locate) throws IOException { public RequestResult findByTimeAndElement(String date, String var, String locate) throws IOException, IllegalAccessException {
date = "5_1_10";
return RequestResult.success(qualityCompareService.findByTimeAndElement(date, var, locate)); return RequestResult.success(qualityCompareService.findByTimeAndElement(date, var, locate));
} }
} }

52
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.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
@ -22,21 +23,36 @@ import java.util.stream.Collectors;
@Service @Service
public class QualityCompareService { public class QualityCompareService {
private static final String EXTINCTION = "MEXT";
private static final String SEPARATOR = ","; private static final String SEPARATOR = ",";
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); 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}") @Value("${custom.quality-path}")
private String qualityPath; 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 = qualityPath + var + "-" + date + ".CSV";
String filepath = "C:\\Users\\xiaowuler\\Desktop\\原始产品数据\\MEXT-2021-05-01.CSV"; boolean isExtinction = var.equals(EXTINCTION);
LocalDateTime time = LocalDateTime.parse("2021_" + date, DATE_FORMATTER).withHour(0).plusDays(1); String filepath = String.format("%s/%s/%s/%s-%s.CSV", qualityPath, getFilepathByLocate(locate), isExtinction ? var : "Raman Products/" + var, var, date);
return read(filepath, time); 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)); List<String> lines = Files.readAllLines(Paths.get(filepath));
// 将文件数据进行反转,从最后一行开始读取 // 将文件数据进行反转,从最后一行开始读取
Collections.reverse(lines); Collections.reverse(lines);
@ -50,8 +66,8 @@ public class QualityCompareService {
continue; continue;
} }
time = fillNaN(time, targetTime, data); time = fillNaN(time, targetTime, data, readCount);
data.add(getValues(rows)); data.add(getValues(rows, readCount));
time = time.minusMinutes(5); time = time.minusMinutes(5);
} }
@ -61,24 +77,22 @@ public class QualityCompareService {
return data.stream().filter(values -> index.getAndIncrement() % 12 != 0).collect(Collectors.toList()); 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) { if (Duration.between(targetTime, time).toMinutes() > 5) {
Float[] values = new Float[801]; Float[] values = new Float[readCount];
Arrays.fill(values, Float.NaN); Arrays.fill(values, Float.NaN);
data.add(values); data.add(values);
time = time.minusMinutes(10); time = time.minusMinutes(10);
fillNaN(time, targetTime, data); fillNaN(time, targetTime, data, readCount);
} }
return time; return time;
} }
private Float[] getValues(List<String> rows){ private Float[] getValues(List<String> rows, int readCount){
Float[] values = rows.stream().skip(7).limit(801).map(row -> Float.parseFloat(row)).toArray(Float[]::new); Float[] values = rows.stream().skip(7).limit(readCount - 6).map(row -> Float.parseFloat(row)).toArray(Float[]::new);
int length = values.length; Float[] targetValues = new Float[readCount];
if (length != 801) { Arrays.fill(targetValues, Float.NaN);
values = Arrays.copyOf(values, 801); System.arraycopy(values, 0, targetValues, 6, values.length);
Arrays.fill(values, length - 1, 800, Float.NaN); return targetValues;
}
return values;
} }
} }

20
04.系统编码/Backend/src/main/resources/application.yml

@ -6,12 +6,12 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
datasource: datasource:
url: jdbc:mysql://112.124.40.88:33306/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: 3cqscbr@only1
# url: jdbc:mysql://10.124.102.10:3306/user_information?useUnicode=true&characteEncoding=utf-8
# username: root # 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 # url: jdbc:mysql://192.168.6.6:3306/njsthj?useUnicode=true&characteEncoding=utf-8
# username: njsthj # username: njsthj
# password: Njsqxj_sthj@2021 # password: Njsqxj_sthj@2021
@ -20,11 +20,11 @@ custom:
image: image:
url: ${custom.parent-url}:${server.port}/product url: ${custom.parent-url}:${server.port}/product
gifPath: ${custom.image.path}/gif gifPath: ${custom.image.path}/gif
path: D:/Deployments/LamanRadar/product # path: D:/Deployments/LamanRadar/product
parent-url: http://localhost # 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: C:/Users/xiaowuler/Desktop/原始产品数据 # 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 # path: /home/develop/product
# parent-url: http://rdp.nagr.com.cn # parent-url: http://rdp.nagr.com.cn

6
04.系统编码/Backend/部署.md

@ -14,3 +14,9 @@ ps -ef | grep UserInformation-0.0.1-SNAPSHOT.jar
kill -9 id kill -9 id
``` ```
挂载
```
mount -t cifs -o username=administrator,password=xxzx_211@LMJGLD //10.124.102.250/AllData /share/win
```

84
04.系统编码/Frontend/src/components/RamanLidar.vue

@ -224,7 +224,7 @@
<div class="picture-container raman-picture-container" v-show="currentElement === 'extinction'"> <div class="picture-container raman-picture-container" v-show="currentElement === 'extinction'">
<div class="picture special-picture"> <div class="picture special-picture">
<div v-loading="loadingExtinctionStatus" <div v-loading="loadingExtinctionBeforeStatus"
style="width: 100%;" style="width: 100%;"
custom-class="loading" custom-class="loading"
element-loading-text="加载中"> element-loading-text="加载中">
@ -243,7 +243,7 @@
<div class="picture-container raman-picture-container" v-show="currentElement === 'watervapor'"> <div class="picture-container raman-picture-container" v-show="currentElement === 'watervapor'">
<div class="picture special-picture"> <div class="picture special-picture">
<div v-loading="loadingWaterVaporStatus" <div v-loading="loadingWatervaporBeforeStatus"
style="width: 100%" style="width: 100%"
element-loading-text="加载中"> element-loading-text="加载中">
<canvas id='watervapor_chart-before'></canvas> <canvas id='watervapor_chart-before'></canvas>
@ -281,6 +281,9 @@ export default {
name: 'RamanLidar', name: 'RamanLidar',
setup() { setup() {
let timer = null; 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: { let creates: {
boundaryLayerHeight: HighChartCreate boundaryLayerHeight: HighChartCreate
cloudsHeight: HighChartCreate cloudsHeight: HighChartCreate
@ -291,6 +294,7 @@ export default {
extinctionBeforeDrawer: HeatMapDrawer, extinctionBeforeDrawer: HeatMapDrawer,
extinctionDrawer: HeatMapDrawer, extinctionDrawer: HeatMapDrawer,
watervaporDrawer: HeatMapDrawer, watervaporDrawer: HeatMapDrawer,
watervaporBeforeDrawer: HeatMapDrawer,
opticsExtinctionDrawer: HeatMapDrawer, opticsExtinctionDrawer: HeatMapDrawer,
singleWatervaporDrawer: HeatMapDrawer, singleWatervaporDrawer: HeatMapDrawer,
cloudSolDrawer: HeatMapDrawer, cloudSolDrawer: HeatMapDrawer,
@ -307,6 +311,7 @@ export default {
extinctionDrawer: null, extinctionDrawer: null,
extinctionBeforeDrawer: null, extinctionBeforeDrawer: null,
watervaporDrawer: null, watervaporDrawer: null,
watervaporBeforeDrawer: null,
singleWatervaporDrawer: null, singleWatervaporDrawer: null,
opticsExtinctionDrawer: null, opticsExtinctionDrawer: null,
cloudSolDrawer: null, cloudSolDrawer: null,
@ -343,6 +348,8 @@ export default {
loadingCloudSolStatus: false, loadingCloudSolStatus: false,
loadingCloudRecognitionStatus: false, loadingCloudRecognitionStatus: false,
loadingExtinctionStatus: false, loadingExtinctionStatus: false,
loadingExtinctionBeforeStatus: false,
loadingWatervaporBeforeStatus: false,
loadingWaterVaporStatus: false, loadingWaterVaporStatus: false,
loadingBackscatterStatus: false, loadingBackscatterStatus: false,
loadingLidarRatioStatus: false, loadingLidarRatioStatus: false,
@ -589,40 +596,72 @@ export default {
case 'extinction' : case 'extinction' :
// initTimeLineDay() // initTimeLineDay()
reloadExtinctionBefore(); reloadExtinctionBefore();
reloadCloudRecognition('extinction', 801, 'extinction', drawExtinctionAfter); reloadCloudRecognition('extinction', 801, 'extinction', drawExtinctionAfter, true);
break; break;
case 'watervapor' : case 'watervapor' :
// initTimeLineDay() // initTimeLineDay()
reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporBefore); reloadWatervaporBefore();
reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporAfter); reloadCloudRecognition('watervapor', 101, 'watervapor', drawWatervaporAfter, true);
break; break;
default: default:
throw new Error("无效的type类型"); 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 = () => { const reloadExtinctionBefore = () => {
options.loadingExtinctionBeforeStatus = true;
let params = { let params = {
date: moment(options.date).format('YYYY-MM-DD'), date: moment(options.date).add(-1, 'd').format('YYYY-MM-DD'),
var: 'MEXT', var: 'MEXT',
locate: options.currentRegion locate: options.currentRegion
} }
post("/qualityCompare/findByTimeAndElement", params).then((response: any) => { post("/qualityCompare/findByTimeAndElement", params).then((response: any) => {
options.loadingExtinctionBeforeStatus = false;
if (response.error != 0){ if (response.error != 0){
console.log("未找到质控前数据文件"); console.log("未找到质控前数据文件");
return; return;
} }
if (creates.extinctionBeforeDrawer != null) {
creates.extinctionBeforeDrawer.close();
}
let matrix = convertValueToBox(response.data); let matrix = convertValueToBox(response.data);
creates.extinctionBeforeDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-before", 'km/sr','质控后'); 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.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 2000, 4000, 6000, 8000, 10000, 12000], true, true));
creates.extinctionBeforeDrawer.setColorChart(prepareExtinctionnColors()); creates.extinctionBeforeDrawer.setColorChart(prepareExtinctionnColors());
creates.extinctionBeforeDrawer.draw(); creates.extinctionBeforeDrawer.draw();
}) })
} }
const convertValueToBox = (data) => { 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 timeFormat = timeMoment.format("MM月DD日HH时");
let boxes = new Array<Array<Box>>(); let boxes = new Array<Array<Box>>();
@ -635,7 +674,7 @@ export default {
let rows = new Array<Box>(r.length); let rows = new Array<Box>(r.length);
for (let h = 0, len = r.length; h < len; h++) { 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++; index++;
boxes.push(rows); boxes.push(rows);
@ -919,21 +958,6 @@ export default {
creates.singleWatervaporDrawer.draw(); 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>) => { const drawWatervaporAfter = (result: CustomeArray<any>) => {
if (result.length != 24) return; if (result.length != 24) return;
@ -943,8 +967,8 @@ export default {
} }
let matrix = converCloudRecognition(101, result, 'watervapor'); let matrix = converCloudRecognition(101, result, 'watervapor');
creates.watervaporDrawer = new HeatMapDrawer(800, 650, matrix, "watervapor_chart-after",'g/kg', '质控'); 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.setAxis(new CoordinateScale(quailtyTimes), new CoordinateScale([0, 500, 1000, 1500], true, true));
creates.watervaporDrawer.setColorChart(prepareWatervaporColors()); creates.watervaporDrawer.setColorChart(prepareWatervaporColors());
creates.watervaporDrawer.draw(); creates.watervaporDrawer.draw();
} }
@ -966,7 +990,7 @@ export default {
let matrix = converCloudRecognition(801, result, 'extinction'); let matrix = converCloudRecognition(801, result, 'extinction');
creates.extinctionDrawer = new HeatMapDrawer(800, 650, matrix, "extinction_chart-after", 'km/sr','质控后'); 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.setColorChart(prepareExtinctionnColors());
creates.extinctionDrawer.draw(); creates.extinctionDrawer.draw();
} }
@ -980,10 +1004,12 @@ export default {
return colorChart; 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); preprocessing(type);
let result = new CustomeArray(callback); let result = new CustomeArray(callback);
let time = moment(options.date); let time = moment(options.date);
if (isDay) time.set('h', 23).add(-1, 'd');
options.timeArray = [] options.timeArray = []
for (let index = 0; index < 24; index++) { for (let index = 0; index < 24; index++) {
reloadSingleCloudRecognition(capacity, time.clone().add(-index, 'h').format('M_D_H'), element, result); reloadSingleCloudRecognition(capacity, time.clone().add(-index, 'h').format('M_D_H'), element, result);

4
04.系统编码/Frontend/src/model/constant.ts

@ -2,6 +2,6 @@ export class Constant{
public static readonly baseUrl: string = 'http://rdp.nagr.com.cn:18080'; public static readonly baseUrl: string = 'http://rdp.nagr.com.cn:18080';
} }
export class ConstantRamanLidar{ export class ConstantRamanLidar{
public static readonly baseUrl: string = 'http://112.124.40.88:5511'; // 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://10.124.102.10:9998';
} }

4
04.系统编码/Frontend/src/model/heat-map-drawer.ts

@ -381,11 +381,11 @@ export class HeatMapDrawer{
export class CoordinateScale { export class CoordinateScale {
public scales: Array<number>; public scales: Array<Object>;
public showStartValue: boolean; public showStartValue: boolean;
public showEndValue: 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.scales = scales;
this.showEndValue = showEndValue; this.showEndValue = showEndValue;
this.showStartValue = showStartValue; this.showStartValue = showStartValue;

8
04.系统编码/Frontend/src/uilts/Config.ts

@ -2,10 +2,10 @@ import { Moment } from "moment";
import { format } from "./String"; import { format } from "./String";
export class Config { export class Config {
// public static url: string = ""; public static url: string = "";
// public static parentUrl: string = "http://10.124.102.10:8002/product/picture"; public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
public static url: string = "http://localhost:8002"; // public static url: string = "http://localhost:8002";
public static parentUrl: string = "http://112.124.40.88:8999/product/picture"; // public static parentUrl: string = "http://112.124.40.88:8999/product/picture";
// public static parentUrl: string = "http://rdp.nagr.com.cn:8082/product/picture"; // public static parentUrl: string = "http://rdp.nagr.com.cn:8082/product/picture";
} }

Loading…
Cancel
Save