files = new ArrayList<>();
+ for(String url : urls){
+ String filepath = url.replace(imageUrl, imagePath);
+ File file = new File(filepath);
+ if (file.exists()){
+ files.add(file);
+ }
+ }
+ return files;
+ }
+
+ private String toTargetPath(ImageVO image){
+ String targetFilePath = "%s/%s/%s/".formatted(gifPath, image.getModel(), image.getStation());
+ if (Objects.nonNull(image.getElementCode())){
+ targetFilePath += image.getElementCode() + '/';
+ }
+
+ if (Objects.nonNull(image.getType())){
+ targetFilePath += image.getType() + '/';
+ }
+
+ return "%s%s.gif".formatted(targetFilePath, image.getTime());
}
}
diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/util/FileUtil.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/util/FileUtil.java
new file mode 100644
index 0000000..42a584b
--- /dev/null
+++ b/04.系统编码/Backend/src/main/java/com/userinformation/backend/util/FileUtil.java
@@ -0,0 +1,19 @@
+package com.userinformation.backend.util;
+
+import java.io.File;
+
+/**
+ * @describe: 文件工具类
+ * @author: xiaowuler
+ * @createTime: 2021-12-05 19:36
+ */
+public class FileUtil {
+ public static void createFolder(String saveFilepath){
+ File file = new File(saveFilepath);
+ File parentFile = file.getParentFile();
+ if (parentFile.exists()){
+ return;
+ }
+ parentFile.mkdirs();
+ }
+}
diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml
index 6604633..ed6a5ad 100644
--- a/04.系统编码/Backend/src/main/resources/application.yml
+++ b/04.系统编码/Backend/src/main/resources/application.yml
@@ -2,17 +2,18 @@ server:
port: 8002
spring:
datasource:
-# url: jdbc:mysql://${custom.parent-url}: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://${custom.parent-url}: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
driver-class-name: com.mysql.cj.jdbc.Driver
custom:
image:
url: ${custom.parent-url}:8002/product
-# path: D:/Deployments/LamanRadar/product
- path: /home/project/NJEnvironmentPlatform/html/product
-# parent-url: http://112.124.40.88
- parent-url: http://10.124.102.10
+ path: D:/Deployments/LamanRadar/product
+ gifPath: ${custom.image.path}/gif
+ parent-url: http://112.124.40.88
+# path: /home/project/NJEnvironmentPlatform/html/product
+# parent-url: http://10.124.102.10
diff --git a/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java b/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java
index 0f00839..077638d 100644
--- a/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java
+++ b/04.系统编码/Backend/src/test/java/com/userinformation/backend/UserInformationApplicationTests.java
@@ -30,7 +30,7 @@ class UserInformationApplicationTests {
add("C:\\Users\\xiaowuler\\Desktop\\images (2)\\TFLD_TX.png");
}};
- imageController.createGif(files);
+// imageController.createGif(files);
// File inputFile = new File("C:\\Users\\xiaowuler\\Desktop\\images\\decision-support\\plan-advice\\control-experiment\\TFLD_Q2.tif");
// File outputFile = new File("C:\\Users\\xiaowuler\\Desktop\\output.png");
// BufferedImage image = ImageIO.read(inputFile);
diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
index b3bf72d..f52d8c2 100644
--- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
+++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
@@ -69,6 +69,7 @@
@@ -106,6 +107,7 @@
import { onMounted, reactive, toRefs } from 'vue';
import moment from "moment";
import { MicrowaveRadiationConfig } from '../uilts/Config';
+import { post } from '../uilts/axios';
export default {
name: 'MicrowaveRadiation',
@@ -127,7 +129,8 @@
srcList: [],
isPlay: false,
title: null,
- index: 0
+ index: 0,
+ downloadSrc: null
})
onMounted(() => {
@@ -200,16 +203,42 @@
}
const onDownloadClick = () => {
- let params = {
+
+ post("/image/createGif", prepareParams(), 'application/json').then((response: any) => {
+ if (response.error != 0){
+ console.log(response.message);
+ return;
+ }
+
+ options.downloadSrc = response.data;
+ console.log(response.data);
+ document.getElementById("weboDownload").click();
+ })
+ }
+
+ const prepareParams = () => {
+ return {
model: 'weibo',
station: options.currentRegion,
- element: options.currentElement,
+ elementCode: options.currentElement,
type: options.currentTab,
- time: [options.times[0].date, options.times[options.times.length - 1].date],
- urls: []
+ time: moment(options.times[0].date).format("YYYYMMDDHHmmss") + '-' + moment(options.times[options.times.length - 1].date).format("YYYYMMDDHHmmss"),
+ urls: prepareUrls()
}
}
+ const prepareUrls = () => {
+ let urls = [];
+ for(let index = 0, len = options.hours.length; index < len; index++){
+ let date = moment(options.times[options.index].date);
+ let time = moment(options.date).hour(date.hour()).minute(date.minute());
+ let type = (options.currentTab === 'T-logP' || options.currentTab === 'BPFY') ? options.currentTab : (options.currentTab + '_' + options.currentType);
+ urls.push(MicrowaveRadiationConfig.getUrl(options.currentRegion, type, time));
+ }
+
+ return urls;
+ }
+
const converToBase64 = (path) => {
let img = new Image();
img.src = path;
diff --git a/04.系统编码/Frontend/src/uilts/Config.ts b/04.系统编码/Frontend/src/uilts/Config.ts
index 7b1c10d..5bdd79a 100644
--- a/04.系统编码/Frontend/src/uilts/Config.ts
+++ b/04.系统编码/Frontend/src/uilts/Config.ts
@@ -2,8 +2,8 @@ import { Moment } from "moment";
import { format } from "./String";
export class Config {
- // public static parentUrl: string = "http://112.124.40.88:8002/product/picture";
- public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
+ public static parentUrl: string = "http://112.124.40.88:8002/product/picture";
+ // public static parentUrl: string = "http://10.124.102.10:8002/product/picture";
}
export class MicrowaveRadiationConfig {
diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts
index 47d73f7..d40b739 100644
--- a/04.系统编码/Frontend/src/uilts/axios.ts
+++ b/04.系统编码/Frontend/src/uilts/axios.ts
@@ -6,7 +6,8 @@ import { ElLoading } from 'element-plus'
let loading = null;
const service = axios.create({
// baseURL:"http://112.124.40.88:8002",
- baseURL:"",
+ baseURL: "http://localhost:8002",
+ // baseURL: "",
timeout: 500000
})