diff --git a/org-ccalm-main.yml b/org-ccalm-main.yml index f73da5a..8b9683f 100644 --- a/org-ccalm-main.yml +++ b/org-ccalm-main.yml @@ -10,9 +10,9 @@ spring: application: name: org-ccalm-main datasource: - url: jdbc:postgresql://almaty.ccalm.org:5432/CCALM?ApplicationName=org_ccalm_main&ssl=true&sslmode=require&connectTimeout=10000&socketTimeout=10000 + #url: jdbc:postgresql://almaty.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 password: 309A86FF65A78FB428F4E38DFE35F730 driver-class-name: org.postgresql.Driver diff --git a/src/main/java/org/ccalm/main/AcceptASDCController.java b/src/main/java/org/ccalm/main/AcceptASDCController.java index f0a1194..11f4479 100644 --- a/src/main/java/org/ccalm/main/AcceptASDCController.java +++ b/src/main/java/org/ccalm/main/AcceptASDCController.java @@ -1182,7 +1182,7 @@ public class AcceptASDCController implements ServletContextAware { if(exists) { String sql="update main.frmlocust set\n" - +" uid = ?,\n" + +" uid = main.strtouuid(?),\n" +" changed = false,\n" +" user_id=?,\n" +" device_id=?,\n" @@ -1351,7 +1351,7 @@ public class AcceptASDCController implements ServletContextAware { +" geom,\n" +" test\n" +")values(\n" - +" ?,\n" //1 uid + +" main.strtouuid(?),\n" //1 uid +" false,\n" +" ?,\n" //2 user_id +" ?,\n" //3 device_id diff --git a/src/main/java/org/ccalm/main/AcceptJSON.java b/src/main/java/org/ccalm/main/AcceptJSON.java index 6fc5658..6ec01e5 100644 --- a/src/main/java/org/ccalm/main/AcceptJSON.java +++ b/src/main/java/org/ccalm/main/AcceptJSON.java @@ -1398,7 +1398,7 @@ public class AcceptJSON implements ServletContextAware { return "json"; } //--------------------------------------------------------------------------- - //https://127.0.0.1:8081/AcceptJSON_UZB + //https://127.0.0.1:8083/AcceptJSON_UZB @ResponseBody @RequestMapping(value = {"/AcceptJSON_UZB", "/api/locust/v01/AcceptJSON_UZB"}, method = { RequestMethod.GET, RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE) public String acceptUZB(@ModelAttribute User user) { @@ -1425,9 +1425,11 @@ public class AcceptJSON implements ServletContextAware { } } if(lastDate==null) - lastDate = LocalDate.parse("2025-02-11"); + lastDate = LocalDate.parse("2025-03-03"); + //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))){ lastDate=lastDate.plusDays(1); @@ -1455,874 +1457,33 @@ public class AcceptJSON implements ServletContextAware { throw new CustomException(200, 10000, "Error download data from: " + strURL,null,true); } + int count=0; if(content!=null && !content.isEmpty()) { - JSONArray jsonArray = new JSONArray(content); for (Object o : jsonArray) { JSONObject jsonObj = (JSONObject) o; FrmLocustModel locust = convertUZBJSONToLocustModel(jsonObj); - - //Проверяю есть ли уже такая запись в базе данных - - - - -// -// locust.date = jsonObj.getString("date"); -// String regionName=""; -// if (!jsonObj.isNull("region_name")) -// regionName = jsonObj.getString("region_name"); -// -// if (!jsonObj.isNull("town_name")) -// locust.district = jsonObj.getString("town_name"); -// -// if (!jsonObj.isNull("point")) { -// locust.lon = jsonObj.getJSONObject("point").getJSONArray("coordinates").getDouble(0); -// locust.lat = jsonObj.getJSONObject("point").getJSONArray("coordinates").getDouble(1); -// } -// -// //Контур зоны распространения ВО Polygon (geoJSON) -// locust.drawPolygon = null; -// if (!jsonObj.isNull("drawPolygon")) { -// locust.drawPolygon = jsonObj.getJSONObject("drawPolygon").toString(); -// } -// -// //Площадь контура зоны распространения, в случае если специалист указал его -// locust.size = "null"; -// if (!jsonObj.isNull("polygonArea")) -// locust.size = String.valueOf(jsonObj.getDouble("polygonArea")); -// -// //jsonObj.drawPolygon Краснодар -// -// if (locust.region.length() > 0) { -// //Выбираю ID области -// locust.region_id = ""; -// //Statement stt = null; -// //ResultSet rs = null; -// try { -// -// stt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); -// String sql_query = "select id from main.countriesregions where name like '%" + locust.region + "%';"; -// rs = stt.executeQuery(sql_query); -// if (rs != null) { -// try { -// if (rs.next()) { -// locust.region_id = rs.getString(1); -// } -// rs.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } -// } -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } finally { -// if (rs != null) try { -// rs.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } -// if (stt != null) try { -// stt.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } -// } -// -// -// /*if(locust.region_id.isEmpty()){ -// if(locust.region.indexOf("Воронежс��ая область")>=0) locust.region_id="110"; -// if(locust.region.indexOf("Кра��нодарский край")>=0) locust.region_id="164"; -// if(locust.region.indexOf("Астраха��ская область")>=0) locust.region_id="68"; //dayOfYear: 97 at year: 2022 = 07.04.2022 -// if(locust.region.indexOf("Астраханская област��")>=0) locust.region_id="68"; // dayOfYear: 101 at year: 2022 = 11.04.2022 -// }*/ -// -// if (locust.region_id.length() > 0) { -// //Выбираю id региона (main.countriesdistricts) -// locust.district_id = ""; -// stt = null; -// rs = null; -// try { -// -// if (locust.district.equals("Алапаевский район")) -// locust.district = "городской округ Алапаевское"; -// if (locust.district.equals("Сухоложский район")) -// locust.district = "городской округ Сухой Лог"; -// if (locust.district.equals("Талицкий район")) -// locust.district = "Талицкий городской округ"; -// if (locust.district.equals("Артинский район")) -// locust.district = "Талицкий городской округ"; -// if (locust.district.equals("Богдановичский район")) -// locust.district = "городской округ Богданович"; -// if (locust.district.equals("Красноуфимский район")) -// locust.district = "Красноуфимский округ"; -// if (locust.district.equals("Белоярский район")) locust.region_id = "210"; -// if (locust.district.equals("Пышминский район")) -// locust.district = "Пышминский городской округ"; -// if (locust.district.equals("Ирбитский район")) -// locust.district = "городской округ Ирбитское"; -// if (locust.district.equals("Фрязино г.о.")) locust.district = "городской округ Фрязино"; -// if (locust.district.equals("Коломенский г.о.")) locust.district = "Коломенский район"; -// if (locust.district.equals("Протвино г.о.")) -// locust.district = "городской округ Протвино"; -// if (locust.district.equals("Зарайск г.о.")) locust.district = "Зарайский район"; -// if (locust.district.equals("Анапский район")) locust.district = "городской округ Анапа"; -// if (locust.district.equals("Луховицы г.о.")) locust.district = "Луховицкий район"; -// if (locust.district.equals("Дергачевский район")) -// locust.district = "Дергачёвский район"; -// if (locust.district.equals("Чистоозерный район")) -// locust.district = "Чистоозёрный район"; -// if (locust.district.equals("Сунжа город")) locust.district = "Сунженский район"; -// if (locust.district.equals("Буденновский район")) -// locust.district = "Будённовский район"; -// if (locust.district.equals("Новоселовский район")) { -// locust.district = "Новоселицкий район"; -// locust.region_id = "168"; -// } -// if (locust.district.equals("Тимашевский район")) locust.district = "Тимашёвский район"; -// if (locust.district.equals("Славгородский район")) -// locust.district = "городской округ Славгород"; -// if (locust.district.equals("Режевский район")) -// locust.district = "Режевской городской округ"; -// if (locust.district.equals("Веселовский район")) locust.district = "Весёловский район"; -// if (locust.district.equals("Карабулак город")) -// locust.district = "городской округ Карабулак"; -// if (locust.district.equals("Пугачевский район")) locust.district = "Пугачёвский район"; -// if (locust.district.equals("Кущевский район")) locust.district = "Кущёвский район"; -// if (locust.district.equals("Репьевский район")) locust.district = "Репьёвский район"; -// if (locust.district.equals("Калачевский район")) locust.district = "Калачёвский район"; -// if (locust.district.equals("Гайский район")) -// locust.district = "Гайский городской округ"; -// if (locust.district.equals("Новохоперский район")) -// locust.district = "Новохопёрский район"; -// if (locust.district.equals("Федоровский район")) locust.district = "Фёдоровский район"; -// if (locust.district.equals("Серебряные Пруды г.о.")) -// locust.district = "городской округ Серебряные Пруды"; -// if (locust.district.equals("Минераловодский район")) -// locust.district = "Минераловодский городской округ"; -// if (locust.district.equals("Рузский г.о.")) locust.district = "Рузский район"; -// if (locust.district.equals("Воробьевский район")) -// locust.district = "Воробьёвский район"; -// if (locust.district.equals("Ачитский район")) -// locust.district = "Ачитский городской округ"; -// if (locust.district.equals("Грачевский район")) locust.district = "Грачёвский район"; -// if (locust.district.equals("Уссурийский район")) -// locust.district = "Уссурийский городской округ"; -// if (locust.district.equals("Сорочинский район")) -// locust.district = "Сорочинский городской округ"; -// if (locust.district.equals("Ясненский район")) -// locust.district = "Ясненский городской округ"; -// -// stt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); -// String sql_query = "select id from main.countriesdistricts where region_id=" + locust.region_id + " and name like '%" + locust.district + "%';"; -// rs = stt.executeQuery(sql_query); -// if (rs != null) { -// try { -// if (rs.next()) { -// locust.district_id = rs.getString(1); -// } -// rs.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } -// } -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } finally { -// if (rs != null) try { -// rs.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } -// if (stt != null) try { -// stt.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// } -// } -// } -// } -// -// String row = ""; -// -// if (!jsonObj.isNull("subjectList")) { -// JSONArray jsonArraySub = jsonObj.getJSONArray("subjectList"); -// -// for (Object o2 : jsonArraySub) { -// JSONObject jsonObjSub = (JSONObject) o2; -// -// locust.eid = jsonObjSub.getInt("id"); -// locust.phytoType = jsonObjSub.getString("phytoType"); //"Вредители" или "Обработка" -// if (locust.phytoType.equals("Обработка")) { -// /* -// locust.insecticide_name = jsonObjSub.getString("nameSubject"); //Наименование действующего вещества -// if (!jsonObjSub.isNull("nameLatSubject")) -// locust.insecticide_active_substance = jsonObjSub.getString("nameLatSubject"); //Латинское наименование действующего вещества -// if (!jsonObjSub.isNull("protectionDoze")) -// locust.insecticide_dose = String.valueOf(jsonObjSub.getFloat("protectionDoze")); //Доза внесения препарата (л/га) -// -// if (!jsonObjSub.isNull("agroTreatmentType")) { -// String agroTreatmentType = jsonObjSub.getString("agroTreatmentType"); //Тип обработки (Агротехнический, Авиационный, Наземный) -// if (agroTreatmentType != null && !agroTreatmentType.isEmpty()) { -// if (agroTreatmentType.equals("GROUND")) { -// locust.spray_platform = "3"; -// } else if (agroTreatmentType.equals("AGROTECHNICAL")) { -// locust.spray_platform = "5"; -// } else if (agroTreatmentType.equals("AVIATION")) { -// locust.spray_platform = "1"; -// } -// } -// if (locust.spray_platform == null || locust.spray_platform.isEmpty()) { -// //model.addAttribute("PreviewTable", "Error spray_platform"); -// return "json"; -// } -// } -// -// //То что не знаю куда записывать записываю в description -// locust.description = ""; -// if (!jsonObjSub.isNull("agroTreatmentPercentage")) -// locust.description += "Процент обработанной площади: " + String.valueOf(jsonObjSub.getFloat("agroTreatmentPercentage")) + "\n"; -// if (!jsonObjSub.isNull("agroTreatmentPow")) -// locust.description += "Степень обработки: " + jsonObjSub.getString("agroTreatmentPow") + "\n"; -// -// //Если записи не существует то вставляем если существует то обновляем -// boolean exists = false; //Is there a record. -// Statement st; -// try { -// st = conn.createStatement(); -// //ResultSet rs=null; -// try { -// String sql = "select 1 from main.frmlocustdel where eid=" + String.valueOf(locust.eid); -// rs = st.executeQuery(sql); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// //model.addAttribute("PreviewTable", "Error select"); -// return "json"; -// } -// if (rs != null) { -// if (rs.next()) -// exists = true; -// } -// st.close(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// //model.addAttribute("PreviewTable", "Error select 2"); -// return "json"; -// } -// -// PreparedStatement stmt = null; -// String sql = ""; -// if (exists) { -// System.out.println(String.valueOf(cntV)+") update main.frmlocustdel"); -// sql = "update main.frmlocustdel set\n" -// + " eid=?,\n" -// + " lat_center=?,\n" -// + " lon_center=?,\n" -// + " country_id=?,\n" -// + " region_id=?,\n" -// + " area=?,\n" -// + " district=?,\n" -// + " date=TO_TIMESTAMP(?, 'DD.MM.YYYY HH24:MI'),\n" -// + " description=?,\n" -// + " geom=ST_SetSRID(ST_GeomFromGeoJSON(?),4326),\n" -// -// + " insecticide_name=?,\n" -// + " insecticide_active_substance=?,\n" -// + " insecticide_dose=?,\n" -// + " spray_platform=?\n" -// + " where eid='" + locust.eid + "'"; -// try { -// stmt = conn.prepareStatement(sql); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// //model.addAttribute("PreviewTable", "Error prepare 1"); -// return "json"; -// } -// } else { -// System.out.println(String.valueOf(cntV)+") insert into main.frmlocustdel"); -// sql = "insert into main.frmlocustdel(\n" -// + " eid,\n" //1 -// + " lat_center,\n" //2 -// + " lon_center,\n" //3 -// + " country_id,\n" //4 -// + " region_id,\n" //5 -// + " area,\n" //6 -// + " district,\n" //7 -// + " date,\n" //8 -// + " description,\n" //9 -// + " geom,\n" //10 -// -// + " insecticide_name,\n" //11 -// + " insecticide_active_substance,\n" //12 -// + " insecticide_dose,\n" //13 -// + " spray_platform\n" //14 -// -// + ")values(\n" -// + " ?,\n" //1 eid -// + " ?,\n" //2 lat1 -// + " ?,\n" //3 lon1 -// + " ?,\n" //4 country_id -// + " ?,\n" //5 region_id -// + " ?,\n" //6 district (area) -// + " ?,\n" //7 district (area) -// + " TO_TIMESTAMP(?, 'DD.MM.YYYY HH24:MI'),\n" //8 date -// + " ?,\n" //9 description -// + " ST_SetSRID(ST_GeomFromGeoJSON(?),4326),\n" //10 geom -// -// + " ?,\n" //11 insecticide_name -// + " ?,\n" //12 insecticide_active_substance -// + " ?,\n" //13 insecticide_dose -// + " ?\n" //14 spray_platform -// + ")"; -// try { -// stmt = conn.prepareStatement(sql); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// //model.addAttribute("PreviewTable", "Error prepare 2"); -// return "json"; -// } -// } -// -// try { -// stmt.setInt(1, locust.eid); -// stmt.setDouble(2, locust.lat); -// stmt.setDouble(3, locust.lon); -// stmt.setInt(4, 7); //country_id -// stmt.setInt(5, Integer.parseInt(locust.region_id)); //region_id -// stmt.setString(6, locust.district); //Пишу в поле "area" -// stmt.setString(7, null); -// stmt.setString(8, locust.date); //27.04.2020 09:17 -// stmt.setString(9, locust.description); -// stmt.setString(10, locust.drawPolygon); -// -// stmt.setString(11, locust.insecticide_name); -// stmt.setString(12, locust.insecticide_active_substance); -// if (locust.insecticide_dose == null || locust.insecticide_dose.isEmpty()) -// stmt.setNull(13, Types.DOUBLE); -// else -// stmt.setDouble(13, Double.parseDouble(locust.insecticide_dose)); -// -// if (locust.spray_platform == null || locust.spray_platform.isEmpty()) -// stmt.setNull(14, Types.INTEGER); -// else -// stmt.setInt(14, Integer.parseInt(locust.spray_platform)); -// -// } catch (SQLException ex) { -// ex.printStackTrace(); -// //model.addAttribute("PreviewTable", "Error set data"); -// return "json"; -// } -// -// //Выпоняю запрос на свтавку либо обновление -// try { -// stmt.execute(); -// } catch (SQLException ex) { -// ex.printStackTrace(); -// //model.addAttribute("PreviewTable", "Error execute frmlocustdel"); -// return "json"; -// } -// cntO++; -// */ -// } else if (locust.phytoType.equals("Вредители")) { -// if (!jsonObjSub.isNull("nameSubject")) -// locust.locust = jsonObjSub.getString("nameSubject"); -// -// //Вид саранчи -// locust.locust_type_id = ""; -// if (locust.locust.equals("Короткокрылый зеленчук")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Среднерусская перелётная саранча")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Сибирская кобылка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка изменчивая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка пёстрая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка крестовая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка сибирская")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка голубокрылая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка бескрылая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка чернополосая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка трескучая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка египетская")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Трещотка ширококрылая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Бахчевая кобылка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Малая крестовичка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Конёк белополосый (белополосая кобылка)")) -// locust.locust_type_id = "4"; -// if (locust.locust.equals("Конек обыкновенный")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Конек обыкновенный")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Кобылка темнокрылая")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Краснокрылая кобылка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Краснокрылая кобылка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Степная кобылка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Гребневка")) locust.locust_type_id = "4"; -// if (locust.locust.equals("Азиатская перелётная саранча")) locust.locust_type_id = "3"; -// if (locust.locust.equals("Итальянский прус")) locust.locust_type_id = "1"; -// if (locust.locust.equals("Мароккская саранча, мароккская кобылка, марокканка")) -// locust.locust_type_id = "2"; -// -// //фаза саранчи -// if (!jsonObjSub.isNull("phaseEvolutionName")) -// locust.phase = jsonObjSub.getString("phaseEvolutionName"); -// -// locust.locust_have = "3"; -// if (locust.phase != null) { -// if (locust.phase.equals("Кубышка")) locust.locust_have = "2"; //Кубышка = Яйца -// if (locust.phase.equals("Гусеница")) locust.locust_have = "3"; -// if (locust.phase.equals("Личинка 2-го возраста")) locust.locust_have = "3"; -// if (locust.phase.equals("Личинка 3-го возраста")) locust.locust_have = "3"; -// if (locust.phase.equals("Личинка 4-го возраста")) locust.locust_have = "3"; -// if (locust.phase.equals("Личинка 5-го возраста")) locust.locust_have = "3"; -// if (locust.phase.equals("Имаго")) locust.locust_have = "5"; -// } -// //Если эта анкета "Имаго" то записываем плотность имаго на m2 -// if (locust.locust_have.equals("5")) { -// if (!jsonObjSub.isNull("subPestCount")) -// locust.imago_density = String.valueOf(jsonObjSub.getFloat("subPestCount")); -// } -// //Если эта анкета "Кубышка"="Яйца" то записываем плотность кулиг на m2 -// if (locust.locust_have.equals("2")) { -// if (!jsonObjSub.isNull("subPestCount")) -// locust.eggs_capsules_density = String.valueOf(jsonObjSub.getFloat("subPestCount")); -// } -// //Если эта анкета "Кулиги" то записываем плотность кулиг на m2 -// if (locust.locust_have.equals("4")) { -// if (!jsonObjSub.isNull("subPestCount")) -// locust.kuliguli_density = String.valueOf(jsonObjSub.getFloat("subPestCount")); -// } -// //Если эта анкета "Личинок" то записываем плотность личинок на m2 -// if (locust.locust_have.equals("3")) { -// if (!jsonObjSub.isNull("subPestCount")) -// locust.larva_density = String.valueOf(jsonObjSub.getFloat("subPestCount")); -// } -// -// //Биотоп -// switch (jsonObjSub.getString("faoBiotopeName")) { -// case "CIT степь": -// locust.bio_biotope_id = "1"; -// break; -// case "CIT залежь": -// locust.bio_biotope_id = "2"; -// break; -// case "CIT посевы": -// locust.bio_biotope_id = "3"; -// break; -// case "CIT пастбища": -// locust.bio_biotope_id = "11"; -// break; -// case "CIT холмы, горы": -// locust.bio_biotope_id = "19"; -// break; -// case "DMA равнины": -// locust.bio_biotope_id = "4"; -// break; -// case "DMA посевы": -// locust.bio_biotope_id = "6"; -// break; -// case "DMA пастбища": -// locust.bio_biotope_id = "13"; -// break; -// case "DMA холмы, горы": -// locust.bio_biotope_id = "14"; -// break; -// case "LMI низкие сухие тростники": -// locust.bio_biotope_id = "7"; -// break; -// case "LMI высокие влажные тростники": -// locust.bio_biotope_id = "8"; -// break; -// case "LMI другое": -// locust.bio_biotope_id = "10"; -// break; -// case "Другие саранчовые на посевах": -// locust.bio_biotope_id = "15"; -// break; -// case "Другие саранчовые на равнине": -// locust.bio_biotope_id = "16"; -// break; -// case "Другие саранчовые на холмах": -// locust.bio_biotope_id = "17"; -// break; -// case "Другое": -// locust.bio_biotope_id = "18"; -// break; -// default: -// locust.bio_biotope_id = null; -// break; -// } -// -// //Если те виды что нам нужны -// if (locust.region == null || locust.region.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("Бахчевая коровка")) { -// -// } else { -// -// if (locust.locust_type_id.isEmpty()) { -// System.out.println("locust.locust = "+locust.locust); -// //model.addAttribute("PreviewTable", "locust.locust_type_id == 0 locust name = " + locust.locust); -// logger.error("Error, not find locust.locust = "+locust.locust); -// return "json"; -// } -// if (locust.region_id.isEmpty()) { -// System.out.println("locust.region = "+locust.region); -// //model.addAttribute("PreviewTable", "locust.region_id == 0 region name = " + locust.region); -// logger.error("Error, not find locust.region = "+locust.region); -// return "json"; -// } -// -// //Тех полей что нет в анкете вствляю в комментарии -// try { -// locust.description = ""; -// -// if (jsonObjSub.getBoolean("notFound")) -// locust.description += "Вредитель не обнаружен: " + jsonObjSub.getString("nameSubject") + "\n"; -// else -// locust.description += "Вредитель обнаружен: " + jsonObjSub.getString("nameSubject") + "\n"; -// -// if (!jsonObjSub.isNull("phaseEvolutionName")) -// locust.description += "Фаза: " + jsonObjSub.getString("phaseEvolutionName") + "\n"; //Так как фаза у росиян более подробная -// if (!jsonObjSub.isNull("subPestCount")) { -// locust.description += "Вредителей: " + jsonObjSub.getFloat("subPestCount"); -// if (!jsonObjSub.isNull("unitName")) -// locust.description += " " + jsonObjSub.getString("unitName"); -// locust.description += "\n"; -// } -// -// if (!jsonObj.isNull("cropCurrentType")) -// locust.description += "Тип сева: " + jsonObj.getString("cropCurrentType") + "\n"; -// if (!jsonObj.isNull("cropCurrentCulture")) -// locust.description += "Наименование культуры: " + jsonObj.getString("cropCurrentCulture") + "\n"; -// if (!jsonObj.isNull("cropCurrentCultureSort")) -// locust.description += "Наименование сорта культуры: " + jsonObj.getString("cropCurrentCultureSort") + "\n"; -// if (!jsonObj.isNull("cropCurrentGrowthPhase")) -// locust.description += "Фаза роста культуры: " + jsonObj.getString("cropCurrentGrowthPhase") + "\n"; -// if (!jsonObj.isNull("cropFieldArea")) { -// locust.description += "Площадь поля: " + jsonObj.getFloat("cropFieldArea") + "\n"; -// locust.bio_hectare = String.valueOf(jsonObj.getFloat("cropFieldArea")); -// } -// -// -// } catch (Exception ex) { -// ex.printStackTrace(); -// } -// -// locust.terrain = "null"; //У росиян нет сельского округа -// -// row = "