Browse Source

commit some codes

master
xiaowuler 3 years ago
parent
commit
d4425968d6
  1. 28
      04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/TLogPController.java
  2. 60
      04.系统编码/Backend/src/main/java/com/userinformation/backend/service/TLogPService.java
  3. 21
      04.系统编码/Backend/src/main/resources/application.yml
  4. BIN
      04.系统编码/Frontend/public/images/no-data.png
  5. 23
      04.系统编码/Frontend/src/components/MicrowaveRadiation.vue
  6. 4
      04.系统编码/Frontend/src/uilts/Config.ts
  7. 5
      04.系统编码/Frontend/src/uilts/axios.ts

28
04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/TLogPController.java

@ -0,0 +1,28 @@
package com.userinformation.backend.controller;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.userinformation.backend.service.TLogPService;
/**
* @describe: t-logp image control
* @author: xiaowuler
* @createTime: 2022-02-28 13:48
*/
@RestController
@RequestMapping("tLogP")
public class TLogPController {
private final TLogPService tLogPService;
public TLogPController(TLogPService tLogPService){
this.tLogPService = tLogPService;
}
@RequestMapping("findLater")
public String findLater(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime){
return tLogPService.findLater(startTime, endTime);
}
}

60
04.系统编码/Backend/src/main/java/com/userinformation/backend/service/TLogPService.java

@ -0,0 +1,60 @@
package com.userinformation.backend.service;
import java.io.File;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
/**
* @describe: t-logp image read
* @author: xiaowuler
* @createTime: 2022-02-28 14:12
*/
@Service
public class TLogPService {
@Value("${custom.image.path}")
private String parentPath;
@Value("${custom.parent-url}")
private String parentUrl;
@Value("${server.port}")
private Integer port;
private static final DateTimeFormatter COMMON_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy/yyyyMM/yyyyMMdd");
private static final DateTimeFormatter FILE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
public String findLater(LocalDateTime startTime, LocalDateTime endTime){
String path = "%s/picture/weibo/jiangning/T-logP/%s".formatted(parentPath, endTime.format(COMMON_TIME_FORMAT));
File file = new File(path);
if (file.exists()){
File[] files = file.listFiles((File dir, String name) -> name.startsWith("T_logP_") && name.toLowerCase(Locale.ROOT).endsWith(".png"));
List<String> names = Arrays.stream(files).map(f -> f.getName()).sorted(Comparator.reverseOrder()).collect(Collectors.toList());
for(String name : names){
if (!isAfter(startTime, endTime, name)){
continue;
}
return "%s/%s".formatted(path, name).replace(parentPath, "%s:%s/product".formatted(parentUrl, port));
}
}
if (endTime.getDayOfMonth() == startTime.getDayOfMonth()){
return null;
}
return findLater(startTime.minusMinutes(Duration.between(startTime, endTime).toMinutes()), startTime);
}
private boolean isAfter(LocalDateTime startTime, LocalDateTime endTime, String name){
LocalDateTime fileTime = LocalDateTime.parse(name.toLowerCase(Locale.ROOT).replace("t_logp_", "").replace(".png", ""), FILE_FORMAT);
return fileTime.isBefore(endTime) && fileTime.isAfter(startTime);
}
}

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

@ -2,13 +2,16 @@ server:
port: 8002
# port: 8082
spring:
jackson:
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
@ -17,9 +20,9 @@ custom:
image:
url: ${custom.parent-url}:${server.port}/product
gifPath: ${custom.image.path}/gif
# path: D:/Deployments/LamanRadar/product
# parent-url: http://112.124.40.88
path: /home/project/NJEnvironmentPlatform/html/product
parent-url: http://10.124.102.10
path: D:/Deployments/LamanRadar/product
parent-url: http://localhost
# path: /home/project/NJEnvironmentPlatform/html/product
# parent-url: http://10.124.102.10
# path: /home/develop/product
# parent-url: http://rdp.nagr.com.cn

BIN
04.系统编码/Frontend/public/images/no-data.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

23
04.系统编码/Frontend/src/components/MicrowaveRadiation.vue

@ -184,7 +184,7 @@
</div>
<div v-if="currentTab === 'T-logP'" class="picture-container contrast-picture-container">
<img src="/images/T-logP.png" style="width: 80%;height: 80%">
<img :src="tLogPPicture" style="width: 50%">
</div>
</div>
@ -195,7 +195,7 @@
<script lang="ts">
import {onMounted, reactive, toRefs} from 'vue';
import moment from "moment";
import {get} from '../uilts/axios';
import {get, post} from '../uilts/axios';
import {BoxDrawer, ColorChart, createEmptyCanvas} from "../uilts/box-drawer";
import {Constant} from "../model/constant";
import {HighChartCreate} from "../model/high-chart-create";
@ -257,7 +257,8 @@ export default {
// onPitchTime: 0,
BPTitleTime: null,
highChartXAxis: [],
specialStartTime: null
specialStartTime: null,
tLogPPicture: "/images/no-data.png"
});
let drawers = {
@ -579,9 +580,23 @@ export default {
deltaTApi()
zeroHeightApi()
NegativeTwentyHeightApi()
}else if (options.currentTab === 'T-logP'){
reloadTLogPData();
}
}
const reloadTLogPData = () => {
let params = {
startTime: moment(options.titleEndTime).add(-options.apiTimeInterval, 'm').format('YYYY-MM-DD HH:mm:00'),
endTime: options.titleEndTime
}
post("/tLogP/findLater", params).then((response: any) => {
console.log(response)
response == "" ? options.tLogPPicture = "/images/no-data.png" : options.tLogPPicture = response ;
})
}
const changeColor = () => {
let timeLine = document.querySelectorAll('.time-item')
timeLine.forEach((item: any, index) => {
@ -935,7 +950,7 @@ export default {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
// justify-content: space-between;
.picture {
width: 45%;

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

@ -2,8 +2,10 @@ import { Moment } from "moment";
import { format } from "./String";
export class Config {
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";
}

5
04.系统编码/Frontend/src/uilts/axios.ts

@ -1,14 +1,15 @@
import * as qs from "qs"
import axios from "axios"
import { ElLoading } from 'element-plus'
import { Config } from "./Config";
let loading = null;
const service = axios.create({
baseURL:"http://112.124.40.88:8999",
// baseURL:"http://112.124.40.88:8999",
// baseURL:'http://rdp.nagr.com.cn:18080',
// baseURL:"http://localhost:8002",
// baseURL: '',
baseURL: Config.url,
// baseURL: 'http://localhost:8002',
timeout: 500000

Loading…
Cancel
Save