Compare commits
4 Commits
715f9881a6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 17d0649cee | |||
| 068597b414 | |||
| 29fa1e5860 | |||
| fe4ca18541 |
@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8083
|
port: 8085
|
||||||
ssl:
|
ssl:
|
||||||
key-store: classpath:keystore.jks
|
key-store: classpath:keystore.jks
|
||||||
key-store-password: QyKtWPZB
|
key-store-password: QyKtWPZB
|
||||||
@ -22,16 +22,16 @@ custom:
|
|||||||
data_dir: /data/
|
data_dir: /data/
|
||||||
db_all:
|
db_all:
|
||||||
#url: jdbc:postgresql://92.46.48.43:5444/weather?ApplicationName=kz_mcp_weather&sslmode=require
|
#url: jdbc:postgresql://92.46.48.43:5444/weather?ApplicationName=kz_mcp_weather&sslmode=require
|
||||||
url: jdbc:postgresql://192.168.0.90:5432/weather?ApplicationName=kz_mcp_weather&sslmode=require
|
#url: jdbc:postgresql://192.168.0.90:5432/weather?ApplicationName=kz_mcp_weather&sslmode=require
|
||||||
#url: jdbc:postgresql://127.0.0.1:5432/weather?ApplicationName=kz_mcp_weather&sslmode=require
|
url: jdbc:postgresql://127.0.0.1:5432/weather?ApplicationName=kz_mcp_weather&sslmode=require
|
||||||
login: postgres
|
login: postgres
|
||||||
password: PasSecrKey1
|
password: 309A86FF65A78FB428F4E38DFE35F730
|
||||||
db_ru:
|
db_ru:
|
||||||
#url: jdbc:postgresql://92.46.48.43:5444/weather_ru?ApplicationName=kz_mcp_weather&sslmode=require
|
#url: jdbc:postgresql://92.46.48.43:5444/weather_ru?ApplicationName=kz_mcp_weather&sslmode=require
|
||||||
url: jdbc:postgresql://192.168.0.90:5432/weather_ru?ApplicationName=kz_mcp_weather&sslmode=require
|
#url: jdbc:postgresql://192.168.0.90:5432/weather_ru?ApplicationName=kz_mcp_weather&sslmode=require
|
||||||
#url: jdbc:postgresql://127.0.0.1:5432/weather_ru?ApplicationName=kz_mcp_weather&sslmode=require
|
url: jdbc:postgresql://127.0.0.1:5432/weather_ru?ApplicationName=kz_mcp_weather&sslmode=require
|
||||||
login: postgres
|
login: postgres
|
||||||
password: PasSecrKey1
|
password: 309A86FF65A78FB428F4E38DFE35F730
|
||||||
|
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
|
|||||||
17
pom.xml
17
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.4.2</version>
|
<version>3.5.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.ccalm</groupId>
|
<groupId>org.ccalm</groupId>
|
||||||
@ -40,11 +40,7 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.logstash.logback</groupId>
|
|
||||||
<artifactId>logstash-logback-encoder</artifactId>
|
|
||||||
<version>6.6</version>
|
|
||||||
</dependency>
|
|
||||||
<!--dependency>
|
<!--dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
@ -95,12 +91,16 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.logstash.logback</groupId>
|
||||||
|
<artifactId>logstash-logback-encoder</artifactId>
|
||||||
|
<version>8.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>org-ccalm-weather</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -127,4 +127,5 @@
|
|||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -91,7 +91,10 @@ public class AirTemperature implements ServletContextAware {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/geodatalist/AirTemperature",method = RequestMethod.GET,produces = "text/html;charset=UTF-8")
|
@RequestMapping(value = "/geodatalist/AirTemperature",method = RequestMethod.GET,produces = "text/html;charset=UTF-8")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object ajaxTamer(/*@RequestParam(required=true,name="forecast") String forecast,*/@RequestParam(required=false,name="date") String date) {
|
public Object ajaxTamer(
|
||||||
|
/*@RequestParam(required=true,name="forecast") String forecast,*/
|
||||||
|
@RequestParam(required=false,name="date") String date
|
||||||
|
) {
|
||||||
String forecast = "000";
|
String forecast = "000";
|
||||||
|
|
||||||
String result="";
|
String result="";
|
||||||
@ -142,7 +145,8 @@ public class AirTemperature implements ServletContextAware {
|
|||||||
String measurement = "TMP:2 m above ground";
|
String measurement = "TMP:2 m above ground";
|
||||||
|
|
||||||
//Build URL to download
|
//Build URL to download
|
||||||
String URL = "https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
//String URL = "https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
||||||
|
String URL = "https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
||||||
|
|
||||||
File f1 = new File(data_dir+"temp"+File.separator+"air_text.idx");
|
File f1 = new File(data_dir+"temp"+File.separator+"air_text.idx");
|
||||||
if(f1.exists()) {
|
if(f1.exists()) {
|
||||||
|
|||||||
@ -2,13 +2,13 @@ package org.ccalm.weather;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
import java.time.LocalDate;
|
||||||
import java.util.Calendar;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.http.CacheControl;
|
import org.springframework.http.CacheControl;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
@ -64,6 +64,7 @@ public class GeoTIFFList {
|
|||||||
String NDWIPath="/opt/tomcat/geoserver/ROOT/data/GeoTIFF/NDWI";
|
String NDWIPath="/opt/tomcat/geoserver/ROOT/data/GeoTIFF/NDWI";
|
||||||
String NDSIPath="/opt/tomcat/geoserver/ROOT/data/GeoTIFF/NDSI";
|
String NDSIPath="/opt/tomcat/geoserver/ROOT/data/GeoTIFF/NDSI";
|
||||||
String SMAPPath="/opt/tomcat/geoserver/ROOT/data/GeoTIFF/SMAP";
|
String SMAPPath="/opt/tomcat/geoserver/ROOT/data/GeoTIFF/SMAP";
|
||||||
|
String SMAPPath2="/opt/geodata/SMAP";
|
||||||
String osName=System.getProperty("os.name");
|
String osName=System.getProperty("os.name");
|
||||||
if(osName.indexOf("Windows")>=0){
|
if(osName.indexOf("Windows")>=0){
|
||||||
NDVIPath="O:\\temp\\CCALM\\NDVI";
|
NDVIPath="O:\\temp\\CCALM\\NDVI";
|
||||||
@ -227,6 +228,47 @@ public class GeoTIFFList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fn.equals("smap_list2")) {
|
||||||
|
List<LocalDate> dateList = new ArrayList<>();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
File root = new File(SMAPPath2);
|
||||||
|
File[] yearDirs = root.listFiles(File::isDirectory);
|
||||||
|
if (yearDirs != null) {
|
||||||
|
for (File yearDir : yearDirs) {
|
||||||
|
File[] files = yearDir.listFiles((dir, name) -> name.toLowerCase().endsWith(".tiff"));
|
||||||
|
if (files != null) {
|
||||||
|
for (File file : files) {
|
||||||
|
String fileName = file.getName(); // "2025-01-30.tiff"
|
||||||
|
String datePart = fileName.substring(0, fileName.indexOf('.')); // "2025-01-30"
|
||||||
|
try {
|
||||||
|
LocalDate date = LocalDate.parse(datePart, formatter);
|
||||||
|
dateList.add(date);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// если имя файла не в формате даты — пропускаем
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Убираем дубликаты и сортируем
|
||||||
|
TreeSet<LocalDate> uniqueSorted = new TreeSet<>(dateList);
|
||||||
|
|
||||||
|
if (!uniqueSorted.isEmpty()) {
|
||||||
|
StringBuilder sb = new StringBuilder("[");
|
||||||
|
for (LocalDate date : uniqueSorted) {
|
||||||
|
String strDate = date.format(formatter);
|
||||||
|
sb.append("{\"date\":\"").append(strDate).append("\"},");
|
||||||
|
}
|
||||||
|
sb.setLength(sb.length() - 1); // убрать последнюю запятую
|
||||||
|
sb.append("]");
|
||||||
|
result = sb.toString();
|
||||||
|
} else {
|
||||||
|
result = "[]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,7 +159,8 @@ public class Precipitation implements ServletContextAware {
|
|||||||
String measurement = "APCP:surface:0-1 day acc fcst";
|
String measurement = "APCP:surface:0-1 day acc fcst";
|
||||||
|
|
||||||
//Build URL to download
|
//Build URL to download
|
||||||
String URL = "https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
//String URL = "https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
||||||
|
String URL = "https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
||||||
|
|
||||||
File f1 = new File(data_dir+"temp"+File.separator+"pre_text.idx");
|
File f1 = new File(data_dir+"temp"+File.separator+"pre_text.idx");
|
||||||
if(f1.exists()) {
|
if(f1.exists()) {
|
||||||
|
|||||||
@ -101,7 +101,7 @@ public class SoilTmperature implements ServletContextAware {
|
|||||||
}*/
|
}*/
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* Example: http://127.0.0.1:8081/geodatalist/DownloadSoil?forecast=000
|
* Example: https://127.0.0.1:8083/geodatalist/DownloadSoil?forecast=000
|
||||||
* @param response
|
* @param response
|
||||||
* @param forecast
|
* @param forecast
|
||||||
* @param date
|
* @param date
|
||||||
@ -165,7 +165,8 @@ public class SoilTmperature implements ServletContextAware {
|
|||||||
//String measurement = "TSOIL:0.1-0.4 m below ground";
|
//String measurement = "TSOIL:0.1-0.4 m below ground";
|
||||||
|
|
||||||
//Build URL to download
|
//Build URL to download
|
||||||
String URL = "https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
//String URL = "https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
||||||
|
String URL = "https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs."+date+"/"+time+"/atmos/gfs.t"+time+"z.pgrb2.0p25.f"+forecast;
|
||||||
|
|
||||||
File f1 = new File(data_dir+"temp"+File.separator+"text.idx");
|
File f1 = new File(data_dir+"temp"+File.separator+"text.idx");
|
||||||
if(f1.exists()) {
|
if(f1.exists()) {
|
||||||
@ -550,7 +551,7 @@ public class SoilTmperature implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//Weighted interpolation
|
//Weighted interpolation
|
||||||
@RequestMapping(value = "/geodatalist/getSoil",method = {RequestMethod.POST,RequestMethod.GET},produces = "application/json;charset=utf-8")
|
@RequestMapping(value = "/geodatalist/getSoilTemperature",method = {RequestMethod.POST,RequestMethod.GET},produces = "application/json;charset=utf-8")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity<Object> getSoil(HttpServletResponse response, HttpServletRequest request, @RequestBody PointModel pointModel, @CookieValue(value = "lng", defaultValue = "1") String language_id) {
|
public ResponseEntity<Object> getSoil(HttpServletResponse response, HttpServletRequest request, @RequestBody PointModel pointModel, @CookieValue(value = "lng", defaultValue = "1") String language_id) {
|
||||||
String headerValue = CacheControl.maxAge(60, TimeUnit.SECONDS).getHeaderValue();
|
String headerValue = CacheControl.maxAge(60, TimeUnit.SECONDS).getHeaderValue();
|
||||||
|
|||||||
@ -1,32 +1,65 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
|
||||||
<!-- Please check if the user has access to the directory from which the application is being executed -->
|
<!-- Ваш кастомный conversionRule для single-line исключений -->
|
||||||
|
<conversionRule conversionWord="exOneLine" converterClass="org.ccalm.dbms.SingleLineThrowableProxyConverter"/>
|
||||||
|
|
||||||
<property name="LOGS" value="logs" />
|
<property name="LOGS" value="logs" />
|
||||||
<springProperty scope="context" name="appName" source="spring.application.name"/>
|
<springProperty scope="context" name="appName" source="spring.application.name"/>
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>${LOGS}/${appName}.log</file>
|
<file>${LOGS}/${appName}.log</file>
|
||||||
<encoder>
|
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
|
||||||
<pattern>{"timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}","thread":"[%thread]","level":"%level","logger":"%logger{36}","marker":"%X{marker}","message":"%msg"}%n</pattern>
|
<!-- Кастомные имена полей -->
|
||||||
|
<fieldNames>
|
||||||
|
<timestamp>timestamp</timestamp> <!-- Без @ -->
|
||||||
|
<level>level</level>
|
||||||
|
<message>message</message>
|
||||||
|
<stack_trace>exception</stack_trace>
|
||||||
|
<version>[ignore]</version>
|
||||||
|
<threadName>[ignore]</threadName>
|
||||||
|
<loggerName>[ignore]</loggerName>
|
||||||
|
<levelValue>[ignore]</levelValue>
|
||||||
|
<mdc>[ignore]</mdc>
|
||||||
|
</fieldNames>
|
||||||
|
|
||||||
|
<!-- Формат timestamp -->
|
||||||
|
<timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampPattern>
|
||||||
|
<timestampTimeZone>UTC</timestampTimeZone>
|
||||||
|
|
||||||
|
<!-- Включаем маркеры (tags для MarkerFactory) -->
|
||||||
|
<includeTags>true</includeTags>
|
||||||
|
|
||||||
|
<!-- Отключаем лишние данные -->
|
||||||
|
<includeCallerData>false</includeCallerData>
|
||||||
|
<includeContext>false</includeContext>
|
||||||
|
|
||||||
|
<!-- Single-line исключения -->
|
||||||
|
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
|
||||||
|
<maxDepthPerThrowable>1</maxDepthPerThrowable>
|
||||||
|
<maxLength>1024</maxLength>
|
||||||
|
<shortenedClassNameLength>20</shortenedClassNameLength>
|
||||||
|
<exclude>$$FastClassByCGLIB$$</exclude>
|
||||||
|
<exclude>$$EnhancerBySpringCGLIB$$</exclude>
|
||||||
|
</throwableConverter>
|
||||||
</encoder>
|
</encoder>
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<fileNamePattern>${LOGS}/${appName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
<fileNamePattern>${LOGS}/${appName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<maxFileSize>100MB</maxFileSize>
|
||||||
<maxHistory>30</maxHistory>
|
<maxHistory>30</maxHistory>
|
||||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
<totalSizeCap>3GB</totalSizeCap>
|
||||||
<maxFileSize>100MB</maxFileSize>
|
|
||||||
</timeBasedFileNamingAndTriggeringPolicy>
|
|
||||||
</rollingPolicy>
|
</rollingPolicy>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} | %level | %logger{36} | %X{marker} | %msg%n</pattern>
|
<pattern>
|
||||||
|
%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'} | %level | %logger{36} | %marker | %msg%n
|
||||||
|
</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!--root level="info"-->
|
<root level="info">
|
||||||
<root level="warn">
|
|
||||||
<appender-ref ref="FILE" />
|
<appender-ref ref="FILE" />
|
||||||
<appender-ref ref="CONSOLE" />
|
<appender-ref ref="CONSOLE" />
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
Reference in New Issue
Block a user