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>
<version>1.59</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

3
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));
}
}

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.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;
}
}

20
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

6
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
```

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 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);

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';
}
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';
}

4
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;

8
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";
}

Loading…
Cancel
Save