This commit is contained in:
2025-03-19 07:26:54 +05:00
parent 721b4cac26
commit afd6abd9e3
2 changed files with 74 additions and 74 deletions

View File

@ -1,5 +1,5 @@
server: server:
port: 8081 port: 8082
ssl: ssl:
enabled: true enabled: true
key-store: classpath:keystore.jks key-store: classpath:keystore.jks

View File

@ -2383,7 +2383,7 @@ public class AcceptJSON implements ServletContextAware {
result.country_uid = "05592f5a-1c8b-4d87-a47f-67697cc12c49"; //Uzbekistan result.country_uid = "05592f5a-1c8b-4d87-a47f-67697cc12c49"; //Uzbekistan
if(!obj.isNull("region_name")) { if(!obj.isNull("region_name")) {
switch (obj.getString("region_name")) { switch (obj.optString("region_name",null)) {
case "Sirdaryo viloyati": case "Sirdaryo viloyati":
result.region_id = "31"; result.region_id = "31";
result.region_uid = "8f4f586f-6159-4fbf-a627-2c8d637abb5e"; result.region_uid = "8f4f586f-6159-4fbf-a627-2c8d637abb5e";
@ -2441,14 +2441,14 @@ public class AcceptJSON implements ServletContextAware {
result.region_uid = "2a6adb56-19a7-4f28-9a00-87559db91db9"; result.region_uid = "2a6adb56-19a7-4f28-9a00-87559db91db9";
break; break;
default: default:
System.out.println(obj.getString("region_name")); System.out.println(obj.optString("region_name",null));
throw new CustomException(10000, "Not find region by region_name: " + obj.getString("region_name"), null, true); throw new CustomException(10000, "Not find region by region_name: " + obj.optString("region_name",null), null, true);
} }
} }
result.district = obj.getString("town_name"); result.district = obj.optString("town_name",null);
result.date = obj.getString("date"); result.date = obj.optString("date",null);
result.bio_hectare = obj.getString("surveyed_area"); result.bio_hectare = obj.optString("surveyed_area",null);
if (!obj.isNull("point")) { if (!obj.isNull("point")) {
result.lon_center = String.valueOf(obj.getJSONObject("point").getJSONArray("coordinates").getDouble(0)); result.lon_center = String.valueOf(obj.getJSONObject("point").getJSONArray("coordinates").getDouble(0));
result.lat_center = String.valueOf(obj.getJSONObject("point").getJSONArray("coordinates").getDouble(1)); result.lat_center = String.valueOf(obj.getJSONObject("point").getJSONArray("coordinates").getDouble(1));
@ -2456,7 +2456,7 @@ public class AcceptJSON implements ServletContextAware {
//Биотоп //Биотоп
if(!obj.isNull("biotope_type")) { if(!obj.isNull("biotope_type")) {
switch (obj.getString("biotope_type")) { switch (obj.optString("biotope_type",null)) {
case "CIT степь","CIT steppe": case "CIT степь","CIT steppe":
result.bio_biotope_id = "1"; result.bio_biotope_id = "1";
result.bio_biotope_uid = "e6fa860a-ca2f-4cd7-8cfc-b97d86d2cd2d"; result.bio_biotope_uid = "e6fa860a-ca2f-4cd7-8cfc-b97d86d2cd2d";
@ -2522,13 +2522,13 @@ public class AcceptJSON implements ServletContextAware {
result.bio_biotope_uid = "e99a8868-2582-41e8-9c01-bef5fca8f0d1"; result.bio_biotope_uid = "e99a8868-2582-41e8-9c01-bef5fca8f0d1";
break; break;
default: default:
throw new CustomException(10000, "Not find biotopee: " + obj.getString("biotope_type"), null, true); throw new CustomException(10000, "Not find biotopee: " + obj.optString("biotope_type",null), null, true);
} }
} }
//растительность //растительность
if(!obj.isNull("vegetation")) { if(!obj.isNull("vegetation")) {
switch (obj.getString("vegetation")) { switch (obj.optString("vegetation",null)) {
case "Plant absent": case "Plant absent":
result.bio_greenery_id = "8"; result.bio_greenery_id = "8";
result.bio_greenery_uid = "5621f2f2-56e8-486f-abc0-7eba996b6724"; result.bio_greenery_uid = "5621f2f2-56e8-486f-abc0-7eba996b6724";
@ -2550,13 +2550,13 @@ public class AcceptJSON implements ServletContextAware {
result.bio_greenery_uid = "682993e1-3e5b-4aa0-9f11-c2a30a9c5908"; result.bio_greenery_uid = "682993e1-3e5b-4aa0-9f11-c2a30a9c5908";
break; break;
default: default:
throw new CustomException(10000, "Not find vegetation: " + obj.getString("vegetation"), null, true); throw new CustomException(10000, "Not find vegetation: " + obj.optString("vegetation",null), null, true);
} }
} }
//Густота растительного покрова //Густота растительного покрова
if(!obj.isNull("vegetation_cover")) { if(!obj.isNull("vegetation_cover")) {
switch (obj.getString("vegetation_cover")) { switch (obj.optString("vegetation_cover",null)) {
case "Sparse": //Sparse case "Sparse": //Sparse
result.bio_greenery_cover_id = "8"; result.bio_greenery_cover_id = "8";
result.bio_greenery_cover_uid = "c70a145b-cfe4-4ad9-9ef8-814c9e3a1fac"; result.bio_greenery_cover_uid = "c70a145b-cfe4-4ad9-9ef8-814c9e3a1fac";
@ -2574,19 +2574,19 @@ public class AcceptJSON implements ServletContextAware {
result.bio_greenery_cover_uid = "f712fe9a-2e42-44b9-b3dc-a7a1dc4767e8"; result.bio_greenery_cover_uid = "f712fe9a-2e42-44b9-b3dc-a7a1dc4767e8";
break; break;
default: default:
throw new CustomException(10000, "Not find vegetation_cover: " + obj.getString("vegetation_cover"), null, true); throw new CustomException(10000, "Not find vegetation_cover: " + obj.optString("vegetation_cover",null), null, true);
} }
} }
result.bio_temperature = obj.getString("air_temperature"); result.bio_temperature = obj.optString("air_temperature",null);
if(result.bio_temperature.isEmpty()) result.bio_temperature = null; if(result.bio_temperature.isEmpty()) result.bio_temperature = null;
result.bio_wind = obj.getString("wind_speed"); result.bio_wind = obj.optString("wind_speed",null);
if(result.bio_wind.isEmpty()) result.bio_wind = null; if(result.bio_wind.isEmpty()) result.bio_wind = null;
//Вид саранчи //Вид саранчи
if(!obj.isNull("subject_name")) { if(!obj.isNull("subject_name")) {
switch (obj.getString("subject_name")) { switch (obj.optString("subject_name",null).replace("'", "")) {
case "Мароккская саранча": case "Мароккская саранча":
result.locust_type_id = "2"; result.locust_type_id = "2";
break; break;
@ -2597,20 +2597,20 @@ public class AcceptJSON implements ServletContextAware {
result.locust_type_id = "3"; result.locust_type_id = "3";
break; break;
default: default:
throw new CustomException(10000, "Not find vegetation_cover: " + obj.getString("vegetation_cover"), null, true); throw new CustomException(10000, "Not find subject_name: " + obj.optString("subject_name",null), null, true);
} }
} }
//Area infested (ha) //Area infested (ha)
result.locust_populated = obj.getString("infested_area"); result.locust_populated = obj.optString("infested_area",null);
result.eggs_capsules_area = obj.getString("eggs_bed_area"); result.eggs_capsules_area = obj.optString("eggs_bed_area",null);
result.eggs_capsules_density = obj.getString("eggs_pods_density_from_m2"); result.eggs_capsules_density = obj.optString("eggs_pods_density_from_m2",null);
result.eggs_capsules_density_to = obj.getString("eggs_pods_density_to_m2"); result.eggs_capsules_density_to = obj.optString("eggs_pods_density_to_m2",null);
result.eggs_capsules = obj.getString("eggs_average_number_egg_pod"); result.eggs_capsules = obj.optString("eggs_average_number_egg_pod",null);
result.eggs_live = obj.getString("eggs_viable"); result.eggs_live = obj.optString("eggs_viable",null);
if(!obj.isNull("eggs_natural_enemies")) { if(!obj.isNull("eggs_natural_enemies")) {
switch (obj.getString("eggs_natural_enemies")) { switch (obj.optString("eggs_natural_enemies",null).replace("'", "")) {
case "not", "Нет": case "not", "Нет":
result.eggs_enemies_id = "5"; result.eggs_enemies_id = "5";
result.eggs_enemies_uid = "52580c53-3d13-4b93-b84e-fcf9cbd50e01"; result.eggs_enemies_uid = "52580c53-3d13-4b93-b84e-fcf9cbd50e01";
@ -2632,13 +2632,13 @@ public class AcceptJSON implements ServletContextAware {
result.eggs_enemies_uid = "d0cf06f4-6e1f-4da2-b836-45dfdef5da98"; result.eggs_enemies_uid = "d0cf06f4-6e1f-4da2-b836-45dfdef5da98";
break; break;
default: default:
throw new CustomException(10000, "Not find eggs_natural_enemies: " + obj.getString("eggs_natural_enemies"), null, true); throw new CustomException(10000, "Not find eggs_natural_enemies: " + obj.optString("eggs_natural_enemies",null), null, true);
} }
} }
result.larva_born = null; // not used result.larva_born = null; // not used
if(!obj.isNull("hoppers_hatching")){ if(!obj.isNull("hoppers_hatching")){
switch (obj.getString("hoppers_hatching")) { switch (obj.optString("hoppers_hatching",null).replace("'", "")) {
case "Beginning","Начало": case "Beginning","Начало":
result.larva_born_id="1"; result.larva_born_id="1";
result.larva_born_uid="392db9f2-bfaa-44e0-8ca3-bb3cf1ff937a"; result.larva_born_uid="392db9f2-bfaa-44e0-8ca3-bb3cf1ff937a";
@ -2648,13 +2648,13 @@ public class AcceptJSON implements ServletContextAware {
result.larva_born_uid="3210fcfb-3885-4b0e-92c7-3c6f6a0b7134"; result.larva_born_uid="3210fcfb-3885-4b0e-92c7-3c6f6a0b7134";
break; break;
default: default:
throw new CustomException(10000, "Not find hoppers_hatching: " + obj.getString("hoppers_hatching"),null,true); throw new CustomException(10000, "Not find hoppers_hatching: " + obj.optString("hoppers_hatching",null),null,true);
} }
} }
//Hopper stages //Hopper stages
if(!obj.isNull("hoppers_stages")){ if(!obj.isNull("hoppers_stages")){
switch (obj.getString("hoppers_stages")) { switch (obj.optString("hoppers_stages",null).replace("'", "")) {
case "Early","Младшие": case "Early","Младшие":
result.larva_age_id="1"; result.larva_age_id="1";
result.larva_age_uid="becdbc31-094e-48bb-aef0-93f88abff12d"; result.larva_age_uid="becdbc31-094e-48bb-aef0-93f88abff12d";
@ -2676,13 +2676,13 @@ public class AcceptJSON implements ServletContextAware {
result.larva_age_uid="5acd65b3-e32f-4984-83ad-dfba2b7f0205"; result.larva_age_uid="5acd65b3-e32f-4984-83ad-dfba2b7f0205";
break; break;
default: default:
throw new CustomException(10000, "Not find hoppers_hatching: " + obj.getString("hoppers_hatching"),null,true); throw new CustomException(10000, "Not find hoppers_hatching: " + obj.optString("hoppers_hatching",null),null,true);
} }
} }
//Appearance //Appearance
if(!obj.isNull("hoppers_appearance")){ if(!obj.isNull("hoppers_appearance")){
switch (obj.getString("hoppers_appearance")) { switch (obj.optString("hoppers_appearance",null).replace("'", "")) {
case "Solitary","Одиночная": case "Solitary","Одиночная":
result.larva_age_id="1"; result.larva_age_id="1";
result.larva_age_uid="30fa1f49-166e-4a17-9cd8-d611b36844f8"; result.larva_age_uid="30fa1f49-166e-4a17-9cd8-d611b36844f8";
@ -2696,13 +2696,13 @@ public class AcceptJSON implements ServletContextAware {
result.larva_age_uid="683cdba3-2f4c-4e61-b667-936c524136b4"; result.larva_age_uid="683cdba3-2f4c-4e61-b667-936c524136b4";
break; break;
default: default:
throw new CustomException(10000, "Not find hoppers_hatching: " + obj.getString("hoppers_hatching"),null,true); throw new CustomException(10000, "Not find hoppers_hatching: " + obj.optString("hoppers_hatching",null),null,true);
} }
} }
//Spatial distribution //Spatial distribution
if(!obj.isNull("hoppers_spatial_distribution")){ if(!obj.isNull("hoppers_spatial_distribution")){
switch (obj.getString("hoppers_spatial_distribution")) { switch (obj.optString("hoppers_spatial_distribution",null).replace("'", "")) {
case "Isolated","Одиночные": case "Isolated","Одиночные":
result.larva_behavior_id="1"; result.larva_behavior_id="1";
result.larva_behavior_uid="64a7a8f5-b44d-4fd7-b78c-3c0837f57b99"; result.larva_behavior_uid="64a7a8f5-b44d-4fd7-b78c-3c0837f57b99";
@ -2716,18 +2716,18 @@ public class AcceptJSON implements ServletContextAware {
result.larva_behavior_uid="bc8c7de0-0e79-4b40-8260-a74787e19902"; result.larva_behavior_uid="bc8c7de0-0e79-4b40-8260-a74787e19902";
break; break;
default: default:
throw new CustomException(10000, "Not find hoppers_spatial_distribution: " + obj.getString("hoppers_spatial_distribution"),null,true); throw new CustomException(10000, "Not find hoppers_spatial_distribution: " + obj.optString("hoppers_spatial_distribution",null),null,true);
} }
} }
result.larva_density = obj.getString("hoppers_density_from_m2"); //Hopper density numeric, result.larva_density = obj.optString("hoppers_density_from_m2",null); //Hopper density numeric,
result.larva_density_to = obj.getString("hoppers_density_to_m2"); //Hopper density to numeric, result.larva_density_to = obj.optString("hoppers_density_to_m2",null); //Hopper density to numeric,
result.kuliguli_density = obj.getString("bands_density_from_m2"); result.kuliguli_density = obj.optString("bands_density_from_m2",null);
result.kuliguli_density_to = obj.getString("bands_density_to_m2"); result.kuliguli_density_to = obj.optString("bands_density_to_m2",null);
result.kuliguli_size = obj.getString("bands_sizes_m2"); result.kuliguli_size = obj.optString("bands_sizes_m2",null);
result.kuliguli_count = obj.getString("bands_number_in_ha"); result.kuliguli_count = obj.optString("bands_number_in_ha",null);
if(!obj.isNull("bands_behaviour")){ if(!obj.isNull("bands_behaviour")){
switch (obj.getString("bands_behaviour")) { switch (obj.optString("bands_behaviour",null).replace("'", "")) {
case "Marching","Миграция": case "Marching","Миграция":
result.kuliguli_action_id="1"; result.kuliguli_action_id="1";
result.kuliguli_action_uid="4399f28c-b1ed-44f6-8af5-351cd944d408"; result.kuliguli_action_uid="4399f28c-b1ed-44f6-8af5-351cd944d408";
@ -2749,11 +2749,11 @@ public class AcceptJSON implements ServletContextAware {
result.kuliguli_action_uid="65bf377f-040b-4b5f-8dca-581e1d5d679f"; result.kuliguli_action_uid="65bf377f-040b-4b5f-8dca-581e1d5d679f";
break; break;
default: default:
throw new CustomException(10000, "Not find bands_behaviour: " + obj.getString("bands_behaviour"),null,true); throw new CustomException(10000, "Not find bands_behaviour: " + obj.optString("bands_behaviour",null),null,true);
} }
} }
if(!obj.isNull("bands_stages")){ if(!obj.isNull("bands_stages")){
switch (obj.getString("bands_stages")) { switch (obj.optString("bands_stages",null).replace("'", "")) {
case "Early","Младшие": case "Early","Младшие":
result.kuliguli_age_id="1"; result.kuliguli_age_id="1";
result.kuliguli_age_uid="becdbc31-094e-48bb-aef0-93f88abff12d"; result.kuliguli_age_uid="becdbc31-094e-48bb-aef0-93f88abff12d";
@ -2775,13 +2775,13 @@ public class AcceptJSON implements ServletContextAware {
result.kuliguli_age_uid="5acd65b3-e32f-4984-83ad-dfba2b7f0205"; result.kuliguli_age_uid="5acd65b3-e32f-4984-83ad-dfba2b7f0205";
break; break;
default: default:
throw new CustomException(10000, "Not find bands_behaviour: " + obj.getString("bands_behaviour"),null,true); throw new CustomException(10000, "Not find bands_behaviour: " + obj.optString("bands_behaviour",null),null,true);
} }
} }
//Adults (Имаго) //Adults (Имаго)
if(!obj.isNull("adults_fledging")){ if(!obj.isNull("adults_fledging")){
switch (obj.getString("adults_fledging")) { switch (obj.optString("adults_fledging",null).replace("'", "")) {
case "Beginning","Начало": case "Beginning","Начало":
result.imago_wing_id="7"; result.imago_wing_id="7";
result.imago_wing_uid="312bf2ac-dbdb-40be-b716-7f02f751a65e"; result.imago_wing_uid="312bf2ac-dbdb-40be-b716-7f02f751a65e";
@ -2791,11 +2791,11 @@ public class AcceptJSON implements ServletContextAware {
result.imago_wing_uid="97d5a02c-c3ed-4627-ae14-4f92d6eb2945"; result.imago_wing_uid="97d5a02c-c3ed-4627-ae14-4f92d6eb2945";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_fledging: " + obj.getString("adults_fledging"),null,true); throw new CustomException(10000, "Not find adults_fledging: " + obj.optString("adults_fledging",null),null,true);
} }
} }
if(!obj.isNull("adults_maturity")){ //Половозрелость (да, нет) if(!obj.isNull("adults_maturity")){ //Половозрелость (да, нет)
switch (obj.getString("adults_maturity").toLowerCase()) { switch (obj.optString("adults_maturity",null).toLowerCase().replace("'", "")) {
case "yes","да": case "yes","да":
result.imago_maturity="true"; result.imago_maturity="true";
break; break;
@ -2803,11 +2803,11 @@ public class AcceptJSON implements ServletContextAware {
result.imago_maturity="false"; result.imago_maturity="false";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_maturity: " + obj.getString("adults_maturity"),null,true); throw new CustomException(10000, "Not find adults_maturity: " + obj.optString("adults_maturity",null),null,true);
} }
} }
if(!obj.isNull("bands_stages")){ // Bands stages if(!obj.isNull("bands_stages")){ // Bands stages
switch (obj.getString("bands_stages")) { switch (obj.optString("bands_stages",null).replace("'", "")) {
case "Solitary","Стадная": case "Solitary","Стадная":
result.imago_phase_id="4"; result.imago_phase_id="4";
result.imago_phase_uid="a1325ab8-15f5-406a-be8d-d6ba78b18d11"; result.imago_phase_uid="a1325ab8-15f5-406a-be8d-d6ba78b18d11";
@ -2821,12 +2821,12 @@ public class AcceptJSON implements ServletContextAware {
result.imago_phase_uid="5a7cacb9-c0f5-48e1-aa8c-c354565bf2f1"; result.imago_phase_uid="5a7cacb9-c0f5-48e1-aa8c-c354565bf2f1";
break; break;
default: default:
throw new CustomException(10000, "Not find bands_stages: " + obj.getString("bands_stages"),null,true); throw new CustomException(10000, "Not find bands_stages: " + obj.optString("bands_stages",null),null,true);
} }
} }
if(!obj.isNull("adults_spatial_distribution")){ // Bands stages if(!obj.isNull("adults_spatial_distribution")){ // Bands stages
switch (obj.getString("adults_spatial_distribution")) { switch (obj.optString("adults_spatial_distribution",null).replace("'", "")) {
case "Isolated","Одиночные": case "Isolated","Одиночные":
result.imago_action_id="1"; result.imago_action_id="1";
result.imago_action_uid="c0b25ce8-7454-459a-9a54-b459eea1573a"; result.imago_action_uid="c0b25ce8-7454-459a-9a54-b459eea1573a";
@ -2840,13 +2840,13 @@ public class AcceptJSON implements ServletContextAware {
result.imago_action_uid="c120254b-cbb9-415a-8e41-fc4bb0ffe983"; result.imago_action_uid="c120254b-cbb9-415a-8e41-fc4bb0ffe983";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_spatial_distribution: " + obj.getString("adults_spatial_distribution"),null,true); throw new CustomException(10000, "Not find adults_spatial_distribution: " + obj.optString("adults_spatial_distribution",null),null,true);
} }
} }
result.imago_density = obj.getString("adults_density_m2"); result.imago_density = obj.optString("adults_density_m2",null);
result.imago_density_ga = obj.getString("adults_density_ha"); result.imago_density_ga = obj.optString("adults_density_ha",null);
if(!obj.isNull("adults_roosting")){ //Половозрелость (да, нет) if(!obj.isNull("adults_roosting")){ //Половозрелость (да, нет)
switch (obj.getString("adults_roosting").toLowerCase()) { switch (obj.optString("adults_roosting",null).toLowerCase().replace("'", "")) {
case "yes","да": case "yes","да":
result.imago_feeding="true"; result.imago_feeding="true";
break; break;
@ -2854,12 +2854,12 @@ public class AcceptJSON implements ServletContextAware {
result.imago_feeding="false"; result.imago_feeding="false";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_roosting: " + obj.getString("adults_roosting"),null,true); throw new CustomException(10000, "Not find adults_roosting: " + obj.optString("adults_roosting",null),null,true);
} }
} }
if(!obj.isNull("adults_copulation")){ // Спаривание if(!obj.isNull("adults_copulation")){ // Спаривание
switch (obj.getString("adults_copulation").toLowerCase()) { switch (obj.optString("adults_copulation",null).toLowerCase().replace("'", "")) {
case "yes","да": case "yes","да":
result.imago_copulation = "true"; result.imago_copulation = "true";
break; break;
@ -2867,12 +2867,12 @@ public class AcceptJSON implements ServletContextAware {
result.imago_copulation = "false"; result.imago_copulation = "false";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_copulation: " + obj.getString("adults_copulation"),null,true); throw new CustomException(10000, "Not find adults_copulation: " + obj.optString("adults_copulation",null),null,true);
} }
} }
//result.imago_laying = obj.getString("adults_laying"); //result.imago_laying = obj.optString("adults_laying",null);
if(!obj.isNull("adults_laying")){ // Яйцекладка if(!obj.isNull("adults_laying")){ // Яйцекладка
switch (obj.getString("adults_laying").toLowerCase()) { switch (obj.optString("adults_laying",null).toLowerCase().replace("'", "")) {
case "yes","да": case "yes","да":
result.imago_laying="true"; result.imago_laying="true";
break; break;
@ -2880,12 +2880,12 @@ public class AcceptJSON implements ServletContextAware {
result.imago_laying="false"; result.imago_laying="false";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_laying: " + obj.getString("adults_laying"),null,true); throw new CustomException(10000, "Not find adults_laying: " + obj.optString("adults_laying",null),null,true);
} }
} }
//result.imago_flying = obj.getString("adults_flying"); //result.imago_flying = obj.optString("adults_flying",null);
if(!obj.isNull("adults_flying")){ // Полёты if(!obj.isNull("adults_flying")){ // Полёты
switch (obj.getString("adults_flying").toLowerCase()) { switch (obj.optString("adults_flying",null).toLowerCase().replace("'", "")) {
case "yes","да": case "yes","да":
result.imago_flying="true"; result.imago_flying="true";
break; break;
@ -2893,19 +2893,19 @@ public class AcceptJSON implements ServletContextAware {
result.imago_flying="false"; result.imago_flying="false";
break; break;
default: default:
throw new CustomException(10000, "Not find adults_flying: " + obj.getString("adults_flying"),null,true); throw new CustomException(10000, "Not find adults_flying: " + obj.optString("adults_flying",null),null,true);
} }
} }
result.swarm_maturity = obj.getString("swarms_maturity"); // boolean, result.swarm_maturity = obj.optString("swarms_maturity",null); // boolean,
result.swarm_density_id = obj.getString("swarms_density"); // integer, result.swarm_density_id = obj.optString("swarms_density",null); // integer,
result.swarm_size = obj.getString("swarms_size"); // double precision, result.swarm_size = obj.optString("swarms_size",null); // double precision,
result.swarm_count = obj.getString("swarms_count"); // double precision, result.swarm_count = obj.optString("swarms_count",null); // double precision,
//result.swarm_copulation = obj.getString(""); // boolean, //result.swarm_copulation = obj.optString("",null); // boolean,
//result.swarm_laying = obj.getString(""); // boolean, //result.swarm_laying = obj.optString("",null); // boolean,
result.swarm_flying_direction_id = obj.getString("swarms_flying_direction"); // integer, result.swarm_flying_direction_id = obj.optString("swarms_flying_direction",null); // integer,
if(obj.getString("swarms_height")!=null) { if(!obj.isNull("swarms_height")) {
switch (obj.getString("swarms_height")) { switch (obj.optString("swarms_height",null).replace("'", "")) {
case "Low height", "Низкая": case "Low height", "Низкая":
result.swarm_height_id = "1"; result.swarm_height_id = "1";
result.swarm_height_uid = "0d60a2d7-d732-4199-b966-bd72870a07cc"; result.swarm_height_uid = "0d60a2d7-d732-4199-b966-bd72870a07cc";
@ -2919,10 +2919,10 @@ public class AcceptJSON implements ServletContextAware {
result.swarm_height_uid = "305d3224-ac2e-4abe-8adc-058373f20127"; result.swarm_height_uid = "305d3224-ac2e-4abe-8adc-058373f20127";
break; break;
default: default:
throw new CustomException(10000, "Not find swarms_height: " + obj.getString("swarms_height"), null, true); throw new CustomException(10000, "Not find swarms_height: (" + obj.optString("swarms_height",null)+")", null, true);
} }
} }
result.description = obj.getString("description"); result.description = obj.optString("description",null);
//"status":2 не знаю что за поле //"status":2 не знаю что за поле
result.update(); result.update();