Merge branch 'develop' of https://git.ccalm.org/igor/org.ccalm.main into develop
# Conflicts: # src/main/resources/templates/engine/index.html
This commit is contained in:
@ -10,8 +10,8 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: org-ccalm-main
|
name: org-ccalm-main
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:postgresql://10.0.0.1:5432/CCALM?ApplicationName=org_ccalm_main&connectTimeout=10000&socketTimeout=30000
|
#url: jdbc:postgresql://10.0.0.1:5432/CCALM?ApplicationName=org_ccalm_main&connectTimeout=10000&socketTimeout=30000
|
||||||
#url: jdbc:postgresql://ccalm.org:5432/CCALM?ApplicationName=org_ccalm_main&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
|
url: jdbc:postgresql://ccalm.org:5432/CCALM?ApplicationName=org_ccalm_main&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
|
||||||
#url: jdbc:postgresql://127.0.0.1:5432/CCALM?ApplicationName=org_ccalm_main&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
|
#url: jdbc:postgresql://127.0.0.1:5432/CCALM?ApplicationName=org_ccalm_main&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
|
||||||
username: postgres
|
username: postgres
|
||||||
password: 309A86FF65A78FB428F4E38DFE35F730
|
password: 309A86FF65A78FB428F4E38DFE35F730
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>org.ccalm</groupId>
|
<groupId>org.ccalm</groupId>
|
||||||
<artifactId>main</artifactId>
|
<artifactId>main</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.7</version>
|
||||||
<name>main</name>
|
<name>main</name>
|
||||||
<description>main</description>
|
<description>main</description>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@ -2508,6 +2508,9 @@ public class AcceptASDCController implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* reqS - Миллисекунд сначала 1970 года
|
||||||
|
* */
|
||||||
@RequestMapping(value = {"/get/", "/api/locust/v01/get/"},params = {"fn"},method = { RequestMethod.GET, RequestMethod.POST })
|
@RequestMapping(value = {"/get/", "/api/locust/v01/get/"},params = {"fn"},method = { RequestMethod.GET, RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object uploadFILE(HttpServletResponse response,@RequestHeader(required=false,name="Content-Type") String contentType,@RequestBody(required=false) String reqData,@RequestParam(required=false,name="file") MultipartFile file,@RequestParam(required=false,name="fn") String fn,@RequestParam(required=false,name="r") String reqR,@RequestParam(required=false,name="n") String reqN,@RequestParam(required=false,name="s") String reqS,@RequestParam(required=false,name="l") String reqL,@RequestParam(required=false,name="days",defaultValue = "0") int days,@RequestParam(required=false,name="country_id",defaultValue = "0") int country_id,@RequestParam(required=false,name="android_id",defaultValue = "") String device_id) {
|
public Object uploadFILE(HttpServletResponse response,@RequestHeader(required=false,name="Content-Type") String contentType,@RequestBody(required=false) String reqData,@RequestParam(required=false,name="file") MultipartFile file,@RequestParam(required=false,name="fn") String fn,@RequestParam(required=false,name="r") String reqR,@RequestParam(required=false,name="n") String reqN,@RequestParam(required=false,name="s") String reqS,@RequestParam(required=false,name="l") String reqL,@RequestParam(required=false,name="days",defaultValue = "0") int days,@RequestParam(required=false,name="country_id",defaultValue = "0") int country_id,@RequestParam(required=false,name="android_id",defaultValue = "") String device_id) {
|
||||||
@ -2562,7 +2565,13 @@ public class AcceptASDCController implements ServletContextAware {
|
|||||||
//if(val!=null) pR=Integer.parseInt(val);
|
//if(val!=null) pR=Integer.parseInt(val);
|
||||||
pN = reqN;
|
pN = reqN;
|
||||||
val = reqS;
|
val = reqS;
|
||||||
if(val!=null) pS=Long.parseLong(val);
|
if(val!=null && !val.isEmpty()) {
|
||||||
|
try {
|
||||||
|
pS = Long.parseLong(val);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error(UUID.randomUUID().toString(), ex.getMessage()+" val="+val, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
val = reqL;
|
val = reqL;
|
||||||
//if(val!=null) pL=100;
|
//if(val!=null) pL=100;
|
||||||
|
|
||||||
@ -3072,7 +3081,7 @@ public class AcceptASDCController implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//@RequestMapping(value = {"/get", "/api/locust/v01/"},params = {"fn"},method = { RequestMethod.GET, RequestMethod.POST })
|
//@RequestMapping(value = {"/get", "/api/locust/v01/"},params = {"fn"},method = { RequestMethod.GET, RequestMethod.POST })
|
||||||
//Для проверки какие фото есть на сервере а каких нет чтобы удалить из имена фотографий которых нет в базе
|
//Для проверки какие фото есть на сервере а каких нет чтобы удалить имена фотографий которых нет в базе
|
||||||
@RequestMapping(value = {"/photolist", "/api/locust/v01/"},method = RequestMethod.GET, produces = "text/html")
|
@RequestMapping(value = {"/photolist", "/api/locust/v01/"},method = RequestMethod.GET, produces = "text/html")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object getPhotoList() {
|
public Object getPhotoList() {
|
||||||
|
|||||||
@ -66,9 +66,11 @@ public class QGIS implements ServletContextAware {
|
|||||||
// return new User("none");
|
// return new User("none");
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//TEST https://127.0.0.1:8083/api/locust/v01/QGIS?name=SMAP&date=2025-05-30
|
||||||
|
//TEST https://ccalm.org/api/locust/v01/QGIS?name=SMAP&day=150
|
||||||
@RequestMapping(value = {"/QGIS", "/api/locust/v01/QGIS"},method = RequestMethod.GET,produces = "application/octet-stream")
|
@RequestMapping(value = {"/QGIS", "/api/locust/v01/QGIS"},method = RequestMethod.GET,produces = "application/octet-stream")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public HttpEntity<byte[]> ajaxTamer(@ModelAttribute User user, @RequestParam(required=false,name="day") String day, @RequestParam(required=false,name="name") String name, @RequestParam(required=false,name="time") String time, @RequestParam(required=false,name="time_start") String time_start, @RequestParam(required=false,name="time_end") String time_end, @RequestParam(required=false,name="country_id") String country_id, @RequestParam(required=false,name="locust_type_id") String locust_type_id, @RequestParam(required=false,name="date_start") String date_start, @RequestParam(required=false,name="date_end") String date_end, @RequestParam(required=false,name="registered") String registered, @RequestParam(required=false,name="year") String year, @RequestParam(required=false,name="region_id") String region_id, @RequestParam(required=false,name="country_name") String country_name, @RequestParam(required=false,name="lng") String language_id, HttpServletResponse response)
|
public HttpEntity<byte[]> ajaxTamer(@ModelAttribute User user, @RequestParam(required=false,name="day") String day,@RequestParam(required=false,name="date") String date, @RequestParam(required=false,name="name") String name, @RequestParam(required=false,name="time") String time, @RequestParam(required=false,name="time_start") String time_start, @RequestParam(required=false,name="time_end") String time_end, @RequestParam(required=false,name="country_id") String country_id, @RequestParam(required=false,name="locust_type_id") String locust_type_id, @RequestParam(required=false,name="date_start") String date_start, @RequestParam(required=false,name="date_end") String date_end, @RequestParam(required=false,name="registered") String registered, @RequestParam(required=false,name="year") String year, @RequestParam(required=false,name="region_id") String region_id, @RequestParam(required=false,name="country_name") String country_name, @RequestParam(required=false,name="lng") String language_id, HttpServletResponse response)
|
||||||
{
|
{
|
||||||
if(language_id!=null && !language_id.isEmpty()) user.language_id=language_id;
|
if(language_id!=null && !language_id.isEmpty()) user.language_id=language_id;
|
||||||
logger.info("user.id="+user.id+" user.name="+user.name+" user.language_id="+user.language_id);
|
logger.info("user.id="+user.id+" user.name="+user.name+" user.language_id="+user.language_id);
|
||||||
@ -96,7 +98,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
//Pods (кубышки)
|
//Pods (кубышки)
|
||||||
if(name!=null && (name.equals("frmlocust_pods_density") || name.equals("frmlocust_hoppers_density") || name.equals("frmlocust_bands") || name.equals("frmlocust_adults_density") || name.equals("frmlocust_swarms")))
|
if(name!=null && (name.equals("frmlocust_pods_density") || name.equals("frmlocust_hoppers_density") || name.equals("frmlocust_bands") || name.equals("frmlocust_adults_density") || name.equals("frmlocust_swarms")))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
|
|
||||||
//String country_id=request.getParameter("country_id");
|
//String country_id=request.getParameter("country_id");
|
||||||
//String locust_type_id=request.getParameter("locust_type_id");
|
//String locust_type_id=request.getParameter("locust_type_id");
|
||||||
@ -154,7 +156,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
|
|
||||||
if(name!=null && name.equals("frmlocustdel"))
|
if(name!=null && name.equals("frmlocustdel"))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
|
|
||||||
//String country_id=request.getParameter("country_id");
|
//String country_id=request.getParameter("country_id");
|
||||||
//String date_start=request.getParameter("date_start");
|
//String date_start=request.getParameter("date_start");
|
||||||
@ -231,7 +233,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
sql+=" and locust_type_id="+locust_type_id;
|
sql+=" and locust_type_id="+locust_type_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
//Apply variables to text
|
//Apply variables to text
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{year\\}",year);
|
fileAsString=fileAsString.replaceAll("\\$\\{year\\}",year);
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{sql\\}",sql);
|
fileAsString=fileAsString.replaceAll("\\$\\{sql\\}",sql);
|
||||||
@ -254,7 +256,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
sql+=" and locust_type_id="+locust_type_id;
|
sql+=" and locust_type_id="+locust_type_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
//Apply variables to text
|
//Apply variables to text
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{year\\}",year);
|
fileAsString=fileAsString.replaceAll("\\$\\{year\\}",year);
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{sql\\}",sql);
|
fileAsString=fileAsString.replaceAll("\\$\\{sql\\}",sql);
|
||||||
@ -277,7 +279,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
//Apply variables to text
|
//Apply variables to text
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
||||||
@ -301,7 +303,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
//Apply variables to text
|
//Apply variables to text
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
||||||
@ -325,7 +327,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
//Apply variables to text
|
//Apply variables to text
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
||||||
@ -349,7 +351,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/" + name + ".qgs"));
|
fileAsString = fileToString("static/resources/QGIS/" + name + ".qgs");
|
||||||
//Apply variables to text
|
//Apply variables to text
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
fileAsString=fileAsString.replaceAll("\\$\\{country\\}",country_name);
|
||||||
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
fileAsString=fileAsString.replaceAll("\\$\\{sql2\\}",sql2);
|
||||||
@ -358,7 +360,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
if(name!=null && name.equals("NDVI"))
|
if(name!=null && name.equals("NDVI"))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/NDVI.qgs"));
|
fileAsString = fileToString("static/resources/QGIS/NDVI.qgs");
|
||||||
if(day!=null && day.length()>0)
|
if(day!=null && day.length()>0)
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
||||||
else
|
else
|
||||||
@ -366,7 +368,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
if(name!=null && name.equals("NDWI"))
|
if(name!=null && name.equals("NDWI"))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/NDWI.qgs"));
|
fileAsString = fileToString("static/resources/QGIS/NDWI.qgs");
|
||||||
if(day!=null && day.length()>0)
|
if(day!=null && day.length()>0)
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
||||||
else
|
else
|
||||||
@ -374,7 +376,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
if(name!=null && name.equals("IVI"))
|
if(name!=null && name.equals("IVI"))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/IVI.qgs"));
|
fileAsString = fileToString("static/resources/QGIS/IVI.qgs");
|
||||||
if(year!=null && year.length()>0)
|
if(year!=null && year.length()>0)
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{year\\}",year+"_");
|
fileAsString = fileAsString.replaceAll("\\$\\{year\\}",year+"_");
|
||||||
else
|
else
|
||||||
@ -382,7 +384,7 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
if(name!=null && name.equals("NDWI_CMP"))
|
if(name!=null && name.equals("NDWI_CMP"))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/NDWI_CMP.qgs"));
|
fileAsString = fileToString("static/resources/QGIS/NDWI_CMP.qgs");
|
||||||
if(day!=null && day.length()>0)
|
if(day!=null && day.length()>0)
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
||||||
else
|
else
|
||||||
@ -390,19 +392,19 @@ public class QGIS implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
if(name!=null && name.equals("NDSI"))
|
if(name!=null && name.equals("NDSI"))
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/NDSI.qgs"));
|
fileAsString = fileToString("static/resources/QGIS/NDSI.qgs");
|
||||||
if(day!=null && day.length()>0)
|
if(day!=null && day.length()>0)
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
||||||
else
|
else
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}","");
|
fileAsString = fileAsString.replaceAll("\\$\\{day\\}","");
|
||||||
}
|
}
|
||||||
if(name!=null && name.equals("SMAP"))
|
if(name!=null && name.equals("SMAP")) //https://127.0.0.1:8083/api/locust/v01/QGIS?name=SMAP&date=2025-05-30
|
||||||
{
|
{
|
||||||
fileAsString = fileToString(context.getRealPath("/resources/QGIS/SMAP.qgs"));
|
fileAsString = fileToString("static/resources/QGIS/SMAP.qgs");
|
||||||
if(day!=null && day.length()>0)
|
if(date!=null && !date.isEmpty())
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}",day+"_");
|
fileAsString = fileAsString.replaceAll("\\$\\{date\\}",date);
|
||||||
else
|
else
|
||||||
fileAsString = fileAsString.replaceAll("\\$\\{day\\}","");
|
fileAsString = fileAsString.replaceAll("\\$\\{date\\}","");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send data
|
//Send data
|
||||||
@ -415,27 +417,42 @@ public class QGIS implements ServletContextAware {
|
|||||||
this.context=servletContext;
|
this.context=servletContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String fileToString(String fName)
|
|
||||||
{
|
public String fileToString(String fName) {
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
try
|
|
||||||
{
|
// 1. Сначала пробуем как внешний файл
|
||||||
InputStream is = new FileInputStream(fName);
|
try (InputStream is = new FileInputStream(fName);
|
||||||
BufferedReader buf = new BufferedReader(new InputStreamReader(is));
|
BufferedReader buf = new BufferedReader(new InputStreamReader(is))) {
|
||||||
String line = buf.readLine();
|
|
||||||
while(line != null)
|
String line;
|
||||||
{
|
while ((line = buf.readLine()) != null) {
|
||||||
sb.append(line).append("\n");
|
sb.append(line).append("\n");
|
||||||
line = buf.readLine();
|
|
||||||
}
|
}
|
||||||
buf.close();
|
return sb.toString();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Не найден внешний файл, пробую искать в ресурсах: " + fName);
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
|
||||||
System.out.println("Error: "+e.getMessage());
|
// 2. Если файла нет, пробуем как ресурс из classpath
|
||||||
|
try (InputStream is = new ClassPathResource(fName).getInputStream();
|
||||||
|
BufferedReader buf = new BufferedReader(new InputStreamReader(is))) {
|
||||||
|
|
||||||
|
String line;
|
||||||
|
while ((line = buf.readLine()) != null) {
|
||||||
|
sb.append(line).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Ошибка при чтении из ресурсов: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String trt(Connection conn,String key,User user)
|
public String trt(Connection conn,String key,User user)
|
||||||
{
|
{
|
||||||
String result="";
|
String result="";
|
||||||
|
|||||||
Reference in New Issue
Block a user