diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/TLogPController.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/controller/TLogPController.java new file mode 100644 index 0000000..5796eb9 --- /dev/null +++ b/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); + } +} diff --git a/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/TLogPService.java b/04.系统编码/Backend/src/main/java/com/userinformation/backend/service/TLogPService.java new file mode 100644 index 0000000..fdeaadd --- /dev/null +++ b/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 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); + } +} diff --git a/04.系统编码/Backend/src/main/resources/application.yml b/04.系统编码/Backend/src/main/resources/application.yml index 6739d95..73b78c0 100644 --- a/04.系统编码/Backend/src/main/resources/application.yml +++ b/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 diff --git a/04.系统编码/Frontend/public/images/no-data.png b/04.系统编码/Frontend/public/images/no-data.png new file mode 100644 index 0000000..c97245e Binary files /dev/null and b/04.系统编码/Frontend/public/images/no-data.png differ diff --git a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue index 5c3e94e..22dc3f4 100644 --- a/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue +++ b/04.系统编码/Frontend/src/components/MicrowaveRadiation.vue @@ -184,7 +184,7 @@
- +
@@ -195,7 +195,7 @@