GeoJSON from SQL

This commit is contained in:
2025-09-24 07:38:49 +05:00
parent 57b8d8eca7
commit bfc5c22c95
6 changed files with 19 additions and 16 deletions

View File

@ -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

View File

@ -268,18 +268,14 @@ public class GeoGSON implements ServletContextAware {
try { try {
String sql = """ String sql = """
SELECT SELECT
fl.id, *
COALESCE(fl.eggs_capsules_density, fl.eggs_capsules_density_to)::double precision + COALESCE(fl.eggs_capsules_density_to, fl.eggs_capsules_density)::double precision / 2::double precision AS pods, FROM main.get_frmlocust_pods_density(
ST_AsGeoJSON(st_setsrid(st_makepoint(fl.lon_center, fl.lat_center), 4326)) AS geometry :countryId,
FROM main.frmlocust fl :regionId,
WHERE 1=1 :locustTypeId,
AND fl.lon_center IS NOT NULL cast(to_timestamp(:dateFrom) as timestamp without time zone),
AND fl.lat_center IS NOT NULL cast(to_timestamp(:dateTo) as timestamp without time zone)
AND (:countryId IS NULL OR fl.country_id = :countryId) )
AND (:regionId IS NULL OR fl.region_id = :regionId)
AND (:locustTypeId IS NULL OR fl.locust_type_id = :locustTypeId)
AND (:dateFrom IS NULL OR fl.date >= to_timestamp(:dateFrom))
AND (:dateTo IS NULL OR fl.date <= to_timestamp(:dateTo))
"""; """;
MapSqlParameterSource params = new MapSqlParameterSource(); MapSqlParameterSource params = new MapSqlParameterSource();

View File

@ -1015,7 +1015,10 @@ public class Products implements ServletContextAware {
} }
//Получить плотность имаго за последние 5 лет //Получить плотность имаго за последние 5 лет
@RequestMapping(value = {"/get_density_imago", "/api/locust/v01/get_density_imago"},method = RequestMethod.POST, produces = "application/json;charset=UTF-8") @RequestMapping(
value = {"/get_density_imago", "/api/locust/v01/get_density_imago"},
method = {RequestMethod.POST, RequestMethod.GET},
produces = "application/json;charset=UTF-8")
@ResponseBody @ResponseBody
public ResponseEntity<Object> getDensityImago( public ResponseEntity<Object> getDensityImago(
@ModelAttribute User user, @ModelAttribute User user,

View File

@ -526,7 +526,7 @@ class TCharFRMDensityImago
this.m_win.setCenter(); this.m_win.setCenter();
this.m_win.loadBody("./resources/vue/density_imago.html?v=03","GET",null, this.m_win.loadBody("./resources/vue/density_imago.html?v=03","GET",null,
()=>{ ()=>{
postJsonData("./get_density_imago?id="+id,null, postJsonData("./api/locust/v01/get_density_imago?id="+id,null,
(ok,data)=>{ (ok,data)=>{
if(ok){ if(ok){
if(data.error_code=='0') if(data.error_code=='0')

View File

@ -9,12 +9,14 @@
<tr> <tr>
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Year')</th> <th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Year')</th>
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Average_density')</th> <th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Average_density')</th>
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Number_of_forms')</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in data" :key="item.year"> <tr v-for="item in data" :key="item.year">
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.year }}</td> <td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.year }}</td>
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.imago_density }}</td> <td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.imago_density }}</td>
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.count }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -9,12 +9,14 @@
<tr> <tr>
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Year')</th> <th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Year')</th>
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Average_density')</th> <th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Average_density')</th>
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Number_of_forms')</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in data" :key="item.year"> <tr v-for="item in data" :key="item.year">
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.year }}</td> <td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.year }}</td>
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.larva_density }}</td> <td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.larva_density }}</td>
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.count }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>