@ -136,7 +136,7 @@ public class AcceptJSON implements ServletContextAware {
ex . printStackTrace ( ) ;
}
StringBuilder sb = new StringBuilder ( ) ;
StringBuilder sb = new StringBuilder ( 1024 ) ;
try
{
String strURL = " http://91.185.13.233:98/get_fito " ;
@ -546,8 +546,8 @@ public class AcceptJSON implements ServletContextAware {
locust . district = jsonObj . getString ( " townName " ) ;
if ( ! jsonObj . isNull ( " point " ) ) {
locust . lon = jsonObj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 0 ) ;
locust . lat = jsonObj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 1 ) ;
locust . lon_center = String . valueOf ( jsonObj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 0 ) ) ;
locust . lat_center = String . valueOf ( jsonObj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 1 ) ) ;
}
//Контур зоны распространения В О Polygon (geoJSON)
@ -720,7 +720,7 @@ public class AcceptJSON implements ServletContextAware {
for ( Object o2 : jsonArraySub ) {
JSONObject jsonObjSub = ( JSONObject ) o2 ;
locust . eid = jsonObjSub . getInt ( " id " ) ;
locust . eid = String . valueOf ( jsonObjSub. getInt ( " id " ) ) ;
locust . phytoType = jsonObjSub . getString ( " phytoType " ) ; //"Вредители" или "Обработка"
if ( locust . phytoType . equals ( " Обработка " ) ) {
locust . insecticide_name = jsonObjSub . getString ( " nameSubject " ) ; //Наименование действующего вещества
@ -852,9 +852,9 @@ public class AcceptJSON implements ServletContextAware {
}
try {
stmt . setLong ( 1 , locust . eid ) ;
stmt . setDouble ( 2 , locust . lat ) ;
stmt . setDouble ( 3 , locust . lon ) ;
if ( locust . eid = = null ) stmt . setNull ( 1 , Types . INTEGER ) ; else stmt . setLong ( 1 , Long . parseLong ( locust. eid ) ) ;
if ( locust . lat_center = = null ) stmt . setNull ( 2 , Types . DOUBLE ) ; else stmt . setDouble ( 2 , Double . parseDouble ( locust. lat_center ) ) ;
if ( locust . lon_center = = null ) stmt . setNull ( 3 , Types . DOUBLE ) ; else stmt . setDouble ( 3 , Double . parseDouble ( locust. lon_center ) ) ;
stmt . setInt ( 4 , 7 ) ; //country_id
stmt . setInt ( 5 , Integer . parseInt ( locust . region_id ) ) ; //region_id
stmt . setString ( 6 , locust . district ) ; //Пишу в поле "area"
@ -1017,7 +1017,7 @@ public class AcceptJSON implements ServletContextAware {
}
//Если те виды что нам нужны
if ( regionName = = null | | regionName . isEmpty ( ) | | locust . lat = = 0 | | locust . lon = = 0 | | locust . locust . equals ( " Совка ипсилон " ) | | locust . locust . equals ( " Восточный майский хрущ " ) | | locust . locust . equals ( " Кукурузный стеблевой мотылек " ) | | locust . locust . equals ( " Картофельная, или болотная совка, лиловатая яровая совка " ) | | locust . locust . equals ( " Луговой мотылёк " ) | | locust . locust . equals ( " Хлопковая совка " ) | | locust . locust . equals ( " Стеблевой кукурузный мотылек " ) | | locust . locust . equals ( " Восточная луговая совка " ) | | locust . locust . equals ( " Коричневая щитовка " ) | | locust . locust . equals ( " Продолговатая (чайная) подушечница " ) | | locust . locust . equals ( " Яблоневая запятовидная щитовка " ) | | locust . locust . equals ( " Виноградная филлоксера " ) | | locust . locust . equals ( " Бахчевая коровка " ) ) {
if ( regionName = = null | | regionName . isEmpty ( ) | | Double . parseDouble ( locust. lat_center ) = = 0 | | Double . parseDouble ( locust. lon_center ) = = 0 | | locust . locust . equals ( " Совка ипсилон " ) | | locust . locust . equals ( " Восточный майский хрущ " ) | | locust . locust . equals ( " Кукурузный стеблевой мотылек " ) | | locust . locust . equals ( " Картофельная, или болотная совка, лиловатая яровая совка " ) | | locust . locust . equals ( " Луговой мотылёк " ) | | locust . locust . equals ( " Хлопковая совка " ) | | locust . locust . equals ( " Стеблевой кукурузный мотылек " ) | | locust . locust . equals ( " Восточная луговая совка " ) | | locust . locust . equals ( " Коричневая щитовка " ) | | locust . locust . equals ( " Продолговатая (чайная) подушечница " ) | | locust . locust . equals ( " Яблоневая запятовидная щитовка " ) | | locust . locust . equals ( " Виноградная филлоксера " ) | | locust . locust . equals ( " Бахчевая коровка " ) ) {
} else {
@ -1076,7 +1076,7 @@ public class AcceptJSON implements ServletContextAware {
if ( locust . region_id = = null | | locust . region_id . isEmpty ( ) | | locust . district_id = = null | | locust . district_id . isEmpty ( ) | | locust . locust_type_id = = null | | locust . locust_type_id . isEmpty ( ) ) {
row = " <tr style= \" background-color:red; \" > " ;
}
row + = " <td> " + String . valueOf ( cntO + cntV ) + " </td><td> " + locust . eid + " </td><td> " + locust . lat + " </td><td> " + locust . lon + " </td><td> " + regionName + " = " + locust . region_id + " </td><td> " + locust . district + " = " + locust . district_id + " </td><td> " + locust . terrain + " </td><td> " + locust . village + " </td><td> " + locust . locust + " = " + locust . locust_type_id + " </td><td> " + locust . phase + " = " + locust . locust_have + " </td><td> " + locust . evp + " </td><td> " + locust . size + " = " + locust . drawPolygon + " </td><td> " + locust . date + " </td> " ;
row + = " <td> " + String . valueOf ( cntO + cntV ) + " </td><td> " + locust . eid + " </td><td> " + locust . lat_center + " </td><td> " + locust . lon_center + " </td><td> " + regionName + " = " + locust . region_id + " </td><td> " + locust . district + " = " + locust . district_id + " </td><td> " + locust . terrain + " </td><td> " + locust . village + " </td><td> " + locust . locust + " = " + locust . locust_type_id + " </td><td> " + locust . phase + " = " + locust . locust_have + " </td><td> " + locust . evp + " </td><td> " + locust . size + " = " + locust . drawPolygon + " </td><td> " + locust . date + " </td> " ;
row + = " </tr> \ n " ;
//Если записи не существует то вставляем если существует то обновляем
@ -1183,9 +1183,9 @@ public class AcceptJSON implements ServletContextAware {
}
try {
stmt . setLong ( 1 , locust . eid ) ;
stmt . setDouble ( 2 , locust . lat ) ;
stmt . setDouble ( 3 , locust . lon ) ;
stmt . setLong ( 1 , Long . parseLong ( locust. eid ) ) ;
stmt . setDouble ( 2 , Double . parseDouble ( locust. lat_center ) ) ;
stmt . setDouble ( 3 , Double . parseDouble ( locust. lon_center ) ) ;
stmt . setInt ( 4 , 7 ) ;
stmt . setInt ( 5 , Integer . parseInt ( locust . region_id ) ) ;
stmt . setString ( 6 , locust . district ) ; //Пишу в поле "area"
@ -1422,8 +1422,9 @@ public class AcceptJSON implements ServletContextAware {
lastDate = LocalDate . parse ( obj . getString ( " date " ) ) ;
}
}
if ( lastDate = = null ) lastDate = LocalDate . parse ( " 2024-10-01 " ) ;
if ( lastDate = = null )
lastDate = LocalDate . parse ( " 2025-02-11 " ) ;
//lastDate = LocalDate.parse("2024-10-01");
//By number of day downloading data and write result of downloading to database, try or false, after repair need repeat download
while ( lastDate . isBefore ( LocalDate . now ( ) . minusDays ( 3 ) ) ) {
@ -2322,7 +2323,6 @@ public class AcceptJSON implements ServletContextAware {
}
}
} catch ( CustomException e ) {
if ( e . isSaveToLog ( ) ) {
String uuid = UUID . randomUUID ( ) . toString ( ) ;
@ -2377,86 +2377,86 @@ public class AcceptJSON implements ServletContextAware {
FrmLocustModel result = new FrmLocustModel ( ) ;
result . company_uid = " dc271f2e-1a4b-4987-96ec-7afd91350684 " ; //Компания: "Узбекистан саранча"
result . eid = obj . getInt ( " id " ) ;
result . eid = String . valueOf ( obj. getInt ( " id " ) ) ;
result . seq = obj . getLong ( " seq " ) * 1000 ;
result . country_id = 10 ; //Uzbekistan
result . country_id = " 10 " ; //Uzbekistan
result . country_uid = " 05592f5a-1c8b-4d87-a47f-67697cc12c49 " ; //Uzbekistan
if ( ! obj . isNull ( " region_name " ) ) {
switch ( obj . ge tString( " region_name " ) ) {
case " Sirdaryo viloyati " :
if ( ! obj . isNull ( " region_name " ) & & ! obj . optString ( " region_name " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " region_name " , null ) . trim ( )) {
case " Sirdaryo viloyati " , " Сырдарьинская область " :
result . region_id = " 31 " ;
result . region_uid = " 8f4f586f-6159-4fbf-a627-2c8d637abb5e " ;
break ;
case " Toshkent shahri " :
case " Toshkent shahri " , " Город Ташкент " :
result . region_id = " 156 " ;
result . region_uid = " 1ed7b6f3-47a8-4128-ae0a-c160f5c3af08 " ;
break ;
case " Toshkent viloyati " :
case " Toshkent viloyati " , " Ташкентская область " :
result . region_id = " 157 " ;
result . region_uid = " c8fccdc4-256a-4699-ab09-16c51351bf28 " ;
break ;
case " Surxondaryo viloyati " :
case " Surxondaryo viloyati " , " Сурхандарьинская область " :
result . region_id = " 30 " ;
result . region_uid = " 369c296d-5ff5-4570-88ad-0e94ccf9cb7c " ;
break ;
case " Jizzax viloyati " :
case " Jizzax viloyati " , " Джизакская область " :
result . region_id = " 25 " ;
result . region_uid = " a7185680-7afc-47f1-954e-3d0f8b296592 " ;
break ;
case " Республики Каракалпакстан " :
case " Qoraqalpog‘ iston Respublikasi " , " Республики Каракалпакстан" :
result . region_id = " 22 " ;
result . region_uid = " 421ce759-b571-454e-b390-a73bee9b8b2c " ;
break ;
case " Xorazm viloyati " :
case " Xorazm viloyati " , " Хорезмская область " :
result . region_id = " 34 " ;
result . region_uid = " 8bc74ac4-ce06-4317-9982-b1492c72edb7 " ;
break ;
case " Andijon viloyati " :
case " Andijon viloyati " , " Андижанская область " :
result . region_id = " 23 " ;
result . region_uid = " a045faa8-eb12-40db-be30-be6e41e59bb2 " ;
break ;
case " Fargʻ ona viloyati " :
case " Fargʻ ona viloyati " , " Ферганская область " :
result . region_id = " 33 " ;
result . region_uid = " e97ac81d-dab5-4496-9e0f-0c5508972539 " ;
break ;
case " Namangan viloyati " :
case " Namangan viloyati " , " Наманганская область " :
result . region_id = " 28 " ;
result . region_uid = " e931af2e-0035-4149-b3b9-00895e4e1453 " ;
break ;
case " Buxoro viloyati " :
case " Buxoro viloyati " , " Бухарская область " :
result . region_id = " 24 " ;
result . region_uid = " 0caf3854-48ad-40ed-9602-302c28b1a5b8 " ;
break ;
case " Navoiy viloyati " :
case " Navoiy viloyati " , " Навоийская область " :
result . region_id = " 27 " ;
result . region_uid = " ef244a76-8e7c-4e16-ad80-058b740fa6ca " ;
break ;
case " Qashqadaryo viloyati " :
case " Qashqadaryo viloyati " , " Кашкадарьинская область " :
result . region_id = " 158 " ;
result . region_uid = " cf9a0a6e-18fa-41a0-bd9d-39c5fd1260c1 " ;
break ;
case " Samarqand viloyati " :
case " Samarqand viloyati " , " Самаркандская область " :
result . region_id = " 29 " ;
result . region_uid = " 2a6adb56-19a7-4f28-9a00-87559db91db9 " ;
break ;
default :
System . out . println ( obj . ge tString( " region_name " ) ) ;
throw new CustomException ( 10000 , " Not find region by region_name: " + obj . ge tString( " region_name " ) , null , true ) ;
System . out . println ( obj . op tString( " region_name " , null )) ;
throw new CustomException ( 10000 , " Not find region by region_name: " + obj . op tString( " region_name " , null ), null , true ) ;
}
}
result . district = obj . ge tString( " town_name " ) ;
result . date = obj . ge tString( " date " ) ;
result . district = obj . op tString( " town_name " , null );
result . date = obj . op tString( " date " , null );
result . bio_hectare = obj . ge tString( " surveyed_area " ) ;
result . bio_hectare = obj . op tString( " surveyed_area " , null );
if ( ! obj . isNull ( " point " ) ) {
result . lon = obj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 0 ) ;
result . lat = obj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 1 ) ;
result . lon_center = String . valueOf ( obj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 0 ) ) ;
result . lat_center = String . valueOf ( obj . getJSONObject ( " point " ) . getJSONArray ( " coordinates " ) . getDouble ( 1 ) ) ;
}
//Биотоп
if ( ! obj . isNull ( " biotope_type " ) ) {
switch ( obj . ge tString( " biotope_type " ) ) {
if ( ! obj . isNull ( " biotope_type " ) & & ! obj . optString ( " biotope_type " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " biotope_type " , null ) . trim ( )) {
case " CIT степь " , " CIT steppe " :
result . bio_biotope_id = " 1 " ;
result . bio_biotope_uid = " e6fa860a-ca2f-4cd7-8cfc-b97d86d2cd2d " ;
@ -2517,129 +2517,144 @@ public class AcceptJSON implements ServletContextAware {
result . bio_biotope_id = " 17 " ;
result . bio_biotope_uid = " c82f2609-b50a-4ca4-babc-ae3426f22b81 " ;
break ;
case " Другое " , " Other locust " :
case " Other locust " , " Другое " , " DAL большая саксоулная горбатка в саксаулах " , " Другие саранчовые " :
result . bio_biotope_id = " 18 " ;
result . bio_biotope_uid = " e99a8868-2582-41e8-9c01-bef5fca8f0d1 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find biotopee: " + obj . ge tString( " biotope_type " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find biotope_typ e: " + obj . op tString( " biotope_type " , null ), null , true ) ;
}
}
//растительность
if ( ! obj . isNull ( " vegetation " ) ) {
switch ( obj . ge tString( " vegetation " ) ) {
case " Plant absent " :
if ( ! obj . isNull ( " vegetation " ) & & ! obj . optString ( " vegetation " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " vegetation " , null ) . trim ( )) {
case " Plant absent " , " Растения отсутствуют " , " Отсутствует " :
result . bio_greenery_id = " 8 " ;
result . bio_greenery_uid = " 5621f2f2-56e8-486f-abc0-7eba996b6724 " ;
break ;
case " Plant dry " :
case " Plant dry " , " Засохшие трава " , " Высохшая трава " :
result . bio_greenery_id = " 7 " ;
result . bio_greenery_uid = " 04ba0a4a-0557-490f-a08b-0db51a83cf7c " ;
break ;
case " Желтеющая трава " : //Plant drying
case " Plant drying " , " Желтеющая трава" :
result . bio_greenery_id = " 6 " ;
result . bio_greenery_uid = " 99381409-ad1a-4ac8-95df-415ccb1334e1 " ;
break ;
case " Plant green " :
case " Plant green " , " Свежая проросщая трава " , " Зелёная трава " :
result . bio_greenery_id = " 5 " ;
result . bio_greenery_uid = " 8fab82b8-8924-458d-b3f1-90a18ed75f9b " ;
break ;
case " Plant greening " :
case " Plant greening " , " Всходы зеленых трав " :
result . bio_greenery_id = " 4 " ;
result . bio_greenery_uid = " 682993e1-3e5b-4aa0-9f11-c2a30a9c5908 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find vegetation: " + obj . ge tString( " vegetation " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find vegetation: " + obj . op tString( " vegetation " , null ), null , true ) ;
}
}
//Густота растительного покрова
if ( ! obj . isNull ( " vegetation_cover " ) ) {
switch ( obj . ge tString( " vegetation_cover " ) ) {
case " Sparse " : //Sparse
if ( ! obj . isNull ( " vegetation_cover " ) & & ! obj . optString ( " vegetation_cover " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " vegetation_cover " , null ) . trim ( )) {
case " Sparse " , " Редкая " : //Sparse
result . bio_greenery_cover_id = " 8 " ;
result . bio_greenery_cover_uid = " c70a145b-cfe4-4ad9-9ef8-814c9e3a1fac " ;
break ;
case " Medium " : //Medium
case " Medium " , " Средняя " : //Medium
result . bio_greenery_cover_id = " 9 " ;
result . bio_greenery_cover_uid = " d66bdde4-72a7-497f-b5e8-3174aebd7165 " ;
break ;
case " Густая " : //Dense
case " Dense " , " Густая" : //Dense
result . bio_greenery_cover_id = " 10 " ;
result . bio_greenery_cover_uid = " 4c12085b-4f42-4ba2-9236-465d5c5d0690 " ;
break ;
case " Absent " : //Absent
case " Absent " , " Отсутствует " : //Absent
result . bio_greenery_cover_id = " 0 " ;
result . bio_greenery_cover_uid = " f712fe9a-2e42-44b9-b3dc-a7a1dc4767e8 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find vegetation_cover: " + obj . ge tString( " vegetation_cover " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find vegetation_cover: " + obj . op tString( " vegetation_cover " , null ), null , true ) ;
}
}
result . bio_temperature = obj . ge tString( " air_temperature " ) ;
if ( result . bio_temperature . isEmpty ( ) ) result . bio_temperature = null ;
result . bio_temperature = obj . op tString( " air_temperature " , null );
if ( result . bio_temperature ! = null & & result . bio_temperature . isEmpty ( ) ) result . bio_temperature = null ;
result . bio_wind = obj . ge tString( " wind_speed " ) ;
if ( result . bio_wind . isEmpty ( ) ) result . bio_wind = null ;
result . bio_wind = obj . op tString( " wind_speed " , null );
if ( result . bio_wind ! = null & & result . bio_wind . isEmpty ( ) ) result . bio_wind = null ;
//Вид саранчи
if ( ! obj . isNull ( " subject_name " ) ) {
switch ( obj . ge tString( " subject_name " ) ) {
case " Мароккская саранча " :
result . locust_type_id = " 2 " ;
break ;
case " Итальянский прус " :
if ( ! obj . isNull ( " subject_name " ) & & ! obj . optString ( " subject_name " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " subject_name " , null ) . replace ( " ' " , " " ) . trim ( )) {
case " CIT - Italian locust " , " CIT - итальянский прус " , " Итальянский прус " , " Итальянский прус, Кузнечики " :
result . locust_type_id = " 1 " ;
result . locust_type_uid = " 688e484b-babd-4a48-b318-be85e40682b0 " ;
break ;
case " Азиатская саранча " :
case " DMA - Moroccan locust " , " DMA - мароккская саранча " , " Мароккская саранча " , " Мароккская саранча, Азиаткая саранча " , " Мароккская саранча, Атбасарка " , " Мароккская саранча, Туранский прус " , " Мароккская саранча, Кузнечики " :
result . locust_type_id = " 2 " ;
result . locust_type_uid = " 8dd9e74f-d7ba-492a-8c75-7aed4f0847c6 " ;
break ;
case " LMI - Asian migratory locust " , " LMI - азиатская перелетная саранча " , " Азиаткая саранча " :
result . locust_type_id = " 3 " ;
result . locust_type_uid = " d61a5325-e8c7-497a-9cff-7ee4c4e1e37d " ;
break ;
case " CIT & DMA " , " Пустынная саранча, Мароккская саранча " , " Итальянский прус, Мароккская саранча, Атбасарка, Кузнечики " , " Итальянский прус, Мароккская саранча, Туранский прус " , " Итальянский прус, Мароккская саранча, Кузнечики " :
result . locust_type_id = " 5 " ;
result . locust_type_uid = " a85e8007-2303-4797-9f74-6cdc07da553f " ;
break ;
case " CIT & LMI " , " Пустынная саранча, Итальянский прус, Мароккская саранча " , " Итальянский прус, Мароккская саранча " :
result . locust_type_id = " 6 " ;
result . locust_type_uid = " 4effd7bb-f19e-4a98-a724-691da12c163e " ;
break ;
case " Other " , " Другое " , " Другие саранчовые " , " Другие саранчовые, Пустынная саранча " , " Другие саранчовые, Атбасарка, Кузнечики " , " Большая саксаульная горбатка, Мароккская саранча " , " Большая саксаульная горбатка, Туранский прус " , " Другие саранчовые, Туранский прус " , " Пустынная саранча, Итальянский прус " , " Кузнечики " , " Другие саранчовые, Атбасарка " , " Другие саранчовые, Итальянский прус " , " Другие саранчовые, Мароккская саранча " , " Большая саксаульная горбатка " , " Пустынная саранча " , " Атбасарка " , " Туранский прус " , " Другие саранчовые, Большая саксаульная горбатка " , " Другие саранчовые, Итальянский прус, Мароккская саранча " , " Другие саранчовые, Кузнечики " , " Другие саранчовые, Итальянский прус, Кузнечики " , " Другие саранчовые, Мароккская саранча, Атбасарка " , " Другие саранчовые, Мароккская саранча, Азиаткая саранча " :
result . locust_type_id = " 4 " ;
result . locust_type_uid = " bf79cae1-1e01-4e7f-8ec1-deb06936a58e " ;
break ;
default :
throw new CustomException ( 10000 , " Not find vegetation_cover : " + obj . ge tString( " vegetation_cover " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find subject_name : " + obj . op tString( " subject_name " , null ) , null , true ) ;
}
}
//Area infested (ha)
result . locust_populated = obj . ge tString( " infested_area " ) ;
result . locust_populated = obj . op tString( " infested_area " , null );
result . eggs_capsules_area = obj . ge tString( " eggs_bed_area " ) ;
result . eggs_capsules_density = obj . ge tString( " eggs_pods_density_from_m2 " ) ;
result . eggs_capsules_density_to = obj . ge tString( " eggs_pods_density_to_m2 " ) ;
result . eggs_capsules = obj . ge tString( " eggs_average_number_egg_pod " ) ;
result . eggs_live = obj . ge tString( " eggs_viable " ) ;
if ( ! obj . isNull ( " eggs_natural_enemies " ) ) {
switch ( obj . ge tString( " eggs_natural_enemies " ) ) {
case " not " , " Нет " :
result . eggs_capsules_area = obj . op tString( " eggs_bed_area " , null );
result . eggs_capsules_density = obj . op tString( " eggs_pods_density_from_m2 " , null );
result . eggs_capsules_density_to = obj . op tString( " eggs_pods_density_to_m2 " , null );
result . eggs_capsules = obj . op tString( " eggs_average_number_egg_pod " , null );
result . eggs_live = obj . op tString( " eggs_viable " , null );
if ( ! obj . isNull ( " eggs_natural_enemies " ) & & ! obj . optString ( " eggs_natural_enemies " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " eggs_natural_enemies " , null ) . replace ( " ' " , " " ) . trim ( )) {
case " not " , " Нет " , " Нет, Грибные заболевание " :
result . eggs_enemies_id = " 5 " ;
result . eggs_enemies_uid = " 52580c53-3d13-4b93-b84e-fcf9cbd50e01 " ;
break ;
case " Other " , " Другое " :
case " Other " , " Другое " , " Другое, Нет " , " Другое, Личинки мух, Личинки жуков " , " Другое, Личинки мух " , " Другое, Естественные враги 2 ru " :
result . eggs_enemies_id = " 4 " ;
result . eggs_enemies_uid = " d13c793f-f65e-4a34-9307-940289cd4265 " ;
break ;
case " Larvae of beetles " , " Личинки жуков " :
case " Larvae of beetles " , " Личинки жуков " , " Другое, Личинки жуков " , " Личинки жуков, Нет " :
result . eggs_enemies_id = " 3 " ;
result . eggs_enemies_uid = " 76cf72d8-8ac5-44de-98f3-a7221d2c7985 " ;
break ;
case " Larvae of flies " , " Личинки мух " :
case " Larvae of flies " , " Личинки мух " , " Личинки мух, Личинки жуков " :
result . eggs_enemies_id = " 2 " ;
result . eggs_enemies_uid = " e2e573a3-9859-46f9-99e6-f97d7fc37ea2 " ;
break ;
case " Fungal diseases " , " Грибные заболевания " :
case " Fungal diseases " , " Грибные заболевания " , " Грибные заболевание " :
result . eggs_enemies_id = " 1 " ;
result . eggs_enemies_uid = " d0cf06f4-6e1f-4da2-b836-45dfdef5da98 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find eggs_natural_enemies: " + obj . ge tString( " eggs_natural_enemies " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find eggs_natural_enemies: " + obj . op tString( " eggs_natural_enemies " , null ), null , true ) ;
}
}
result . larva_born = null ; // not used
if ( ! obj . isNull ( " hoppers_hatching " ) ) {
switch ( obj . ge tString( " hoppers_hatching " ) ) {
case " Beginning " , " Начало " :
if ( ! obj . isNull ( " hoppers_hatching " ) & & ! obj . optString ( " hoppers_hatching " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " hoppers_hatching " , null ) . replace ( " ' " , " " ) . trim ( ) . trim ( )) {
case " Beginning " , " Начало " :
result . larva_born_id = " 1 " ;
result . larva_born_uid = " 392db9f2-bfaa-44e0-8ca3-bb3cf1ff937a " ;
break ;
@ -2648,13 +2663,13 @@ public class AcceptJSON implements ServletContextAware {
result . larva_born_uid = " 3210fcfb-3885-4b0e-92c7-3c6f6a0b7134 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find hoppers_hatching: " + obj . ge tString( " hoppers_hatching " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find hoppers_hatching: " + obj . op tString( " hoppers_hatching " , null ), null , true ) ;
}
}
//Hopper stages
if ( ! obj . isNull ( " hoppers_stages " ) ) {
switch ( obj . getString ( " hoppers_stages " ) ) {
/*if(!obj.isNull("hoppers_appearance") && !obj.optString("hoppers_appearance","").isBlank()){
switch (obj.optString("hoppers_appearance",null).replace("'", "").trim()) {
case "Early","Младшие":
result.larva_age_id="1";
result.larva_age_uid="becdbc31-094e-48bb-aef0-93f88abff12d";
@ -2676,13 +2691,13 @@ public class AcceptJSON implements ServletContextAware {
result.larva_age_uid="5acd65b3-e32f-4984-83ad-dfba2b7f0205";
break;
default:
throw new CustomException( 10000 , " Not find hoppers_hatching: " + obj . getString ( " hoppers_hatching " ) , null , true ) ;
}
throw new CustomException(10000, "Not find hoppers_appearance: " + obj.optString("hoppers_appearance",null),null,true);
}
}*/
//Appearance
if ( ! obj . isNull ( " hoppers_appearance " ) ) {
switch ( obj . ge tString( " hoppers_appearance " ) ) {
if ( ! obj . isNull ( " hoppers_stages " ) & & ! obj . optString ( " hoppers_stages " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " hoppers_stages " , null ) . replace ( " ' " , " " ) . trim ( ) ) {
case " Solitary " , " Одиночная " :
result . larva_age_id = " 1 " ;
result . larva_age_uid = " 30fa1f49-166e-4a17-9cd8-d611b36844f8 " ;
@ -2696,13 +2711,13 @@ public class AcceptJSON implements ServletContextAware {
result . larva_age_uid = " 683cdba3-2f4c-4e61-b667-936c524136b4 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find hoppers_hatching : " + obj . ge tString( " hoppers_hatching " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find hoppers_stages : " + obj . op tString( " hoppers_stages " , null ) , null , true ) ;
}
}
//Spatial distribution
if ( ! obj . isNull ( " hoppers_spatial_distribution " ) ) {
switch ( obj . ge tString( " hoppers_spatial_distribution " ) ) {
if ( ! obj . isNull ( " hoppers_spatial_distribution " ) & & ! obj . optString ( " hoppers_spatial_distribution " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " hoppers_spatial_distribution " , null ) . replace ( " ' " , " " ) . trim ( )) {
case " Isolated " , " Одиночные " :
result . larva_behavior_id = " 1 " ;
result . larva_behavior_uid = " 64a7a8f5-b44d-4fd7-b78c-3c0837f57b99 " ;
@ -2716,19 +2731,19 @@ public class AcceptJSON implements ServletContextAware {
result . larva_behavior_uid = " bc8c7de0-0e79-4b40-8260-a74787e19902 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find hoppers_spatial_distribution: " + obj . ge tString( " hoppers_spatial_distribution " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find hoppers_spatial_distribution: " + obj . op tString( " hoppers_spatial_distribution " , null ), null , true ) ;
}
}
result . larva_density = obj . ge tString( " hoppers_density_from_m2 " ) ; //Hopper density numeric,
result . larva_density_to = obj . ge tString( " hoppers_density_to_m2 " ) ; //Hopper density to numeric,
result . larva_density = obj . op tString( " hoppers_density_from_m2 " , null ); //Hopper density numeric,
result . larva_density_to = obj . op tString( " hoppers_density_to_m2 " , null ); //Hopper density to numeric,
result . kuliguli_density = obj . ge tString( " bands_density_from_m2 " ) ;
result . kuliguli_density_to = obj . ge tString( " bands_density_to_m2 " ) ;
result . kuliguli_size = obj . ge tString( " bands_sizes_m2 " ) ;
result . kuliguli_count = obj . ge tString( " bands_number_in_ha " ) ;
if ( ! obj . isNull ( " bands_behaviour " ) ) {
switch ( obj . ge tString( " bands_behaviour " ) ) {
case " Marching " , " Миграция " :
result . kuliguli_density = obj . op tString( " bands_density_from_m2 " , null );
result . kuliguli_density_to = obj . op tString( " bands_density_to_m2 " , null );
result . kuliguli_size = obj . op tString( " bands_sizes_m2 " , null );
result . kuliguli_count = obj . op tString( " bands_number_in_ha " , null );
if ( ! obj . isNull ( " bands_behaviour " ) & & ! obj . optString ( " bands_behaviour " , " " ) . isBlank ( ) ) {
switch ( obj . op tString( " bands_behaviour " , null ) . replace ( " ' " , " " ) . trim ( )) {
case " Marching " , " Миграция " , " Миргация " :
result . kuliguli_action_id = " 1 " ;
result . kuliguli_action_uid = " 4399f28c-b1ed-44f6-8af5-351cd944d408 " ;
break ;
@ -2740,7 +2755,7 @@ public class AcceptJSON implements ServletContextAware {
result . kuliguli_action_id = " 3 " ;
result . kuliguli_action_uid = " 0fca9acd-9447-4653-9ca7-7dcac7cb495e " ;
break ;
case " Stupor " , " Оцепенение " :
case " Stupor " , " Оцепенение " , " Оцепененине " :
result . kuliguli_action_id = " 4 " ;
result . kuliguli_action_uid = " 63bb9eba-c4ad-4e2d-a1cd-ada1695abac5 " ;
break ;
@ -2749,11 +2764,11 @@ public class AcceptJSON implements ServletContextAware {
result . kuliguli_action_uid = " 65bf377f-040b-4b5f-8dca-581e1d5d679f " ;
break ;
default :
throw new CustomException ( 10000 , " Not find bands_behaviour: " + obj . ge tString( " bands_behaviour " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find bands_behaviour: " + obj . op tString( " bands_behaviour " , null ), null , true ) ;
}
}
if ( ! obj . isNull ( " bands_stages " ) ) {
switch ( obj . getString ( " bands_stages " ) ) {
/*if(!obj.isNull("bands_stages") && !obj.optString("bands_stages","").isBlank()){
switch (obj.optString("bands_stages",null).replace("'", "").trim()) {
case "Early","Младшие":
result.kuliguli_age_id="1";
result.kuliguli_age_uid="becdbc31-094e-48bb-aef0-93f88abff12d";
@ -2775,39 +2790,11 @@ public class AcceptJSON implements ServletContextAware {
result.kuliguli_age_uid="5acd65b3-e32f-4984-83ad-dfba2b7f0205";
break;
default:
throw new CustomException( 10000 , " Not find bands_behaviour: " + obj . getString ( " bands_behaviour " ) , null , true ) ;
throw new CustomException(10000, "Not find bands_stages: " + obj.optString("bands_stages",null),null,true);
}
}
//Adults (Имаго)
if ( ! obj . isNull ( " adults_fledging " ) ) {
switch ( obj . getString ( " adults_fledging " ) ) {
case " Beginning " , " Начало " :
result . imago_wing_id = " 7 " ;
result . imago_wing_uid = " 312bf2ac-dbdb-40be-b716-7f02f751a65e " ;
break ;
case " Mass " , " Массовое " :
result . imago_wing_id = " 6 " ;
result . imago_wing_uid = " 97d5a02c-c3ed-4627-ae14-4f92d6eb2945 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_fledging: " + obj . getString ( " adults_fledging " ) , null , true ) ;
}
}
if ( ! obj . isNull ( " adults_maturity " ) ) { //Половозрелость (да, нет)
switch ( obj . getString ( " adults_maturity " ) . toLowerCase ( ) ) {
case " yes " , " да " :
result . imago_maturity = " true " ;
break ;
case " no " , " нет " :
result . imago_maturity = " false " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_maturity: " + obj . getString ( " adults_maturity " ) , null , true ) ;
}
}
if ( ! obj . isNull ( " bands_stages " ) ) { // Bands stages
switch ( obj . getString ( " bands_stages " ) ) {
}*/
if ( ! obj . isNull ( " bands_stages " ) & & ! obj . optString ( " bands_stages " , " " ) . isBlank ( ) ) { // Bands stages
switch ( obj . optString ( " bands_stages " , null ) . replace ( " ' " , " " ) . trim ( ) ) {
case " Solitary " , " Стадная " :
result . imago_phase_id = " 4 " ;
result . imago_phase_uid = " a1325ab8-15f5-406a-be8d-d6ba78b18d11 " ;
@ -2821,12 +2808,35 @@ public class AcceptJSON implements ServletContextAware {
result . imago_phase_uid = " 5a7cacb9-c0f5-48e1-aa8c-c354565bf2f1 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find bands_stages: " + obj . ge tString( " bands_stages " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find bands_stages: " + obj . op tString( " bands_stages " , null ), null , true ) ;
}
}
if ( ! obj . isNull ( " adults_spatial_distribution " ) ) { // Bands stages
switch ( obj . ge tString( " adults_spatial_distribution " ) ) {
//Adults (Имаго)
if ( ! obj . isNull ( " adults_fledging " ) & & ! obj . op tString( " adults_fledging " , " " ) . isBlank ( ) ) {
switch ( obj . optString ( " adults_fledging " , null ) . replace ( " ' " , " " ) . trim ( ) ) {
case " Beginning " , " Начало " :
result . imago_wing_id = " 7 " ;
result . imago_wing_uid = " 312bf2ac-dbdb-40be-b716-7f02f751a65e " ;
break ;
case " Mass " , " Массовое " :
result . imago_wing_id = " 6 " ;
result . imago_wing_uid = " 97d5a02c-c3ed-4627-ae14-4f92d6eb2945 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_fledging: " + obj . optString ( " adults_fledging " , null ) , null , true ) ;
}
}
if ( ! obj . isNull ( " adults_maturity " ) & & ! obj . optString ( " adults_maturity " , " " ) . isBlank ( ) ) { //Половозрелость (да, нет)
if ( obj . getBoolean ( " adults_maturity " ) )
result . imago_maturity = " true " ;
else
result . imago_maturity = " false " ;
}
if ( ! obj . isNull ( " adults_spatial_distribution " ) & & ! obj . optString ( " adults_spatial_distribution " , " " ) . isBlank ( ) ) { // Bands stages
switch ( obj . optString ( " adults_spatial_distribution " , null ) . replace ( " ' " , " " ) . trim ( ) ) {
case " Isolated " , " Одиночные " :
result . imago_action_id = " 1 " ;
result . imago_action_uid = " c0b25ce8-7454-459a-9a54-b459eea1573a " ;
@ -2840,72 +2850,51 @@ public class AcceptJSON implements ServletContextAware {
result . imago_action_uid = " c120254b-cbb9-415a-8e41-fc4bb0ffe983 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_spatial_distribution: " + obj . ge tString( " adults_spatial_distribution " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find adults_spatial_distribution: " + obj . op tString( " adults_spatial_distribution " , null ), null , true ) ;
}
}
result . imago_density = obj . ge tString( " adults_density_m2 " ) ;
result . imago_density_ga = obj . ge tString( " adults_density_ha " ) ;
if ( ! obj . isNull ( " adults_roosting " ) ) { //Половозрелость (да, нет)
switch ( obj . getString ( " adults_roosting " ) . toLowerCase ( ) ) {
case " yes " , " да " :
result . imago_density = obj . op tString( " adults_density_m2 " , null );
result . imago_density_ga = obj . op tString( " adults_density_ha " , null );
if ( ! obj . isNull ( " adults_roosting " ) & & ! obj . optString ( " adults_roosting " , " " ) . isBlank ( ) ) { //Половозрелость (да, нет)
if ( obj . getBoolean ( " adults_roosting " ) )
result . imago_feeding = " true " ;
break ;
case " no " , " нет " :
else
result . imago_feeding = " false " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_roosting: " + obj . getString ( " adults_roosting " ) , null , true ) ;
}
}
if ( ! obj . isNull ( " adults_copulation " ) ) { // Спаривание
switch ( obj . getString ( " adults_copulation " ) . toLowerCase ( ) ) {
case " yes " , " да " :
if ( ! obj . isNull ( " adults_copulation " ) & & ! obj . optString ( " adults_copulation " , " " ) . isBlank ( ) ) { // Спаривание
if ( obj . getBoolean ( " adults_copulation " ) ) {
result . imago_copulation = " true " ;
break ;
case " no " , " нет " :
} else {
result . imago_copulation = " false " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_copulation: " + obj . getString ( " adults_copulation " ) , null , true ) ;
}
}
//result.imago_laying = obj.getString("adults_laying");
if ( ! obj . isNull ( " adults_laying " ) ) { // Яйцекладка
switch ( obj . getString ( " adults_laying " ) . toLowerCase ( ) ) {
case " yes " , " да " :
result . imago_laying = " true " ;
break ;
case " no " , " нет " :
result . imago_laying = " false " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_laying: " + obj . getString ( " adults_laying " ) , null , true ) ;
}
}
//result.imago_flying = obj.getString("adults_flying");
if ( ! obj . isNull ( " adults_flying " ) ) { // Полёты
switch ( obj . getString ( " adults_flying " ) . toLowerCase ( ) ) {
case " yes " , " да " :
result . imago_flying = " true " ;
break ;
case " no " , " нет " :
result . imago_flying = " false " ;
break ;
default :
throw new CustomException ( 10000 , " Not find adults_flying: " + obj . getString ( " adults_flying " ) , null , true ) ;
}
}
result . swarm_maturity = obj . ge tString( " swarms_maturity " ) ; // boolean,
result . swarm_density_id = obj . getString ( " swarms_density " ) ; // integer,
result . swarm_size = obj . getStr ing( " swarms_siz e" ) ; // double precision,
result . swarm_count = obj . getString ( " swarms_count " ) ; // double precision,
// result.swarm_copulation = obj.getString(""); // boolean,
//result.swarm_laying = obj.getString(""); // boolean,
result . swarm_flying_direction_id = obj . getString ( " swarms_flying_direction " ) ; // integer,
if ( obj . getString ( " swarms_height " ) ! = null ) {
switch ( obj . ge tString( " swarms_height " ) ) {
if ( ! obj . isNull ( " adults_laying " ) & & ! obj . op tString( " adults_laying " , " " ) . isBlank ( ) ) { // Яйцекладка
if ( obj . getBoolean ( " adults_laying " ) ) {
result . imago_lay ing= " tru e" ;
} else {
result. imago_laying = " false " ;
}
}
if ( ! obj . isNull ( " adults_flying " ) & & ! obj . op tString( " adults_flying " , " " ) . isBlank ( ) ) { // Полёты
if ( obj . getBoolean ( " adults_flying " ) ) {
result . imago_flying = " true " ;
} else {
result . imago_flying = " false " ;
}
}
result . swarm_maturity = obj . optString ( " swarms_maturity " , null ) ; // boolean,
result . swarm_density_id = obj . optString ( " swarms_density " , null ) ; // integer,
result . swarm_size = obj . optString ( " swarms_size " , null ) ; // double precision,
result . swarm_count = obj . optString ( " swarms_count " , null ) ; // double precision,
//result.swarm_copulation = obj.optString("",null); // boolean,
//result.swarm_laying = obj.optString("",null); // boolean,
result . swarm_flying_direction_id = obj . optString ( " swarms_flying_direction " , null ) ; // integer,
if ( ! obj . isNull ( " swarms_height " ) & & ! obj . optString ( " swarms_height " , " " ) . isBlank ( ) ) {
switch ( obj . optString ( " swarms_height " , null ) . replace ( " ' " , " " ) . trim ( ) ) {
case " Low height " , " Низкая " :
result . swarm_height_id = " 1 " ;
result . swarm_height_uid = " 0d60a2d7-d732-4199-b966-bd72870a07cc " ;
@ -2919,10 +2908,10 @@ public class AcceptJSON implements ServletContextAware {
result . swarm_height_uid = " 305d3224-ac2e-4abe-8adc-058373f20127 " ;
break ;
default :
throw new CustomException ( 10000 , " Not find swarms_height: " + obj . ge tString( " swarms_height " ) , null , true ) ;
throw new CustomException ( 10000 , " Not find swarms_height: ( " + obj . op tString( " swarms_height " , null ) + " ) " , null , true ) ;
}
}
result . description = obj . ge tString( " description " ) ;
result . description = obj . op tString( " description " , null );
//"status":2 не знаю что за поле
result . update ( ) ;