GeoJSON from SQL
This commit is contained in:
@ -10,8 +10,8 @@ spring:
|
||||
application:
|
||||
name: org-ccalm-main
|
||||
datasource:
|
||||
#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://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://127.0.0.1:5432/CCALM?ApplicationName=org_ccalm_main&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000
|
||||
username: postgres
|
||||
password: 309A86FF65A78FB428F4E38DFE35F730
|
||||
|
||||
@ -268,18 +268,14 @@ public class GeoGSON implements ServletContextAware {
|
||||
try {
|
||||
String sql = """
|
||||
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,
|
||||
ST_AsGeoJSON(st_setsrid(st_makepoint(fl.lon_center, fl.lat_center), 4326)) AS geometry
|
||||
FROM main.frmlocust fl
|
||||
WHERE 1=1
|
||||
AND fl.lon_center IS NOT NULL
|
||||
AND fl.lat_center IS NOT NULL
|
||||
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))
|
||||
*
|
||||
FROM main.get_frmlocust_pods_density(
|
||||
:countryId,
|
||||
:regionId,
|
||||
:locustTypeId,
|
||||
cast(to_timestamp(:dateFrom) as timestamp without time zone),
|
||||
cast(to_timestamp(:dateTo) as timestamp without time zone)
|
||||
)
|
||||
""";
|
||||
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
|
||||
@ -1015,7 +1015,10 @@ public class Products implements ServletContextAware {
|
||||
}
|
||||
|
||||
//Получить плотность имаго за последние 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
|
||||
public ResponseEntity<Object> getDensityImago(
|
||||
@ModelAttribute User user,
|
||||
|
||||
@ -526,7 +526,7 @@ class TCharFRMDensityImago
|
||||
this.m_win.setCenter();
|
||||
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)=>{
|
||||
if(ok){
|
||||
if(data.error_code=='0')
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
<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('Average_density')</th>
|
||||
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Number_of_forms')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<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.imago_density }}</td>
|
||||
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.count }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -9,12 +9,14 @@
|
||||
<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('Average_density')</th>
|
||||
<th style="border: 1px solid #999999; padding: 2px 16px; background-color: var(--header-color);">trt('Number_of_forms')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<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.larva_density }}</td>
|
||||
<td style="border: 1px solid #999999; padding: 2px 16px;">{{ item.count }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user