Контрольные точки
This commit is contained in:
@ -474,6 +474,8 @@ public class AcceptASDC implements ServletContextAware {
|
|||||||
+" observer=?,\n"
|
+" observer=?,\n"
|
||||||
+" date=?,\n"
|
+" date=?,\n"
|
||||||
+" timezone=?::interval,\n"
|
+" timezone=?::interval,\n"
|
||||||
|
+" lat_center=?,\n"
|
||||||
|
+" lon_center=?,\n"
|
||||||
+" lat1=?,\n"
|
+" lat1=?,\n"
|
||||||
+" lon1=?,\n"
|
+" lon1=?,\n"
|
||||||
+" lat2=?,\n"
|
+" lat2=?,\n"
|
||||||
@ -563,6 +565,8 @@ public class AcceptASDC implements ServletContextAware {
|
|||||||
+" observer,\n"
|
+" observer,\n"
|
||||||
+" date,\n"
|
+" date,\n"
|
||||||
+" timezone,\n"
|
+" timezone,\n"
|
||||||
|
+" lat_center,\n"
|
||||||
|
+" lon_center,\n"
|
||||||
+" lat1,\n"
|
+" lat1,\n"
|
||||||
+" lon1,\n"
|
+" lon1,\n"
|
||||||
+" lat2,\n"
|
+" lat2,\n"
|
||||||
@ -640,66 +644,68 @@ public class AcceptASDC implements ServletContextAware {
|
|||||||
+" ?,\n" //13 observer
|
+" ?,\n" //13 observer
|
||||||
+" ?,\n" //14 date
|
+" ?,\n" //14 date
|
||||||
+" ?::interval,\n" //15 timezone
|
+" ?::interval,\n" //15 timezone
|
||||||
+" ?,\n" //16 lat1
|
+" ?,\n" //16 lat_center
|
||||||
+" ?,\n" //17 lon1
|
+" ?,\n" //17 lon_center
|
||||||
+" ?,\n" //18 lat2
|
+" ?,\n" //18 lat1
|
||||||
+" ?,\n" //19 lon2
|
+" ?,\n" //19 lon1
|
||||||
+" ?,\n" //20 lat3
|
+" ?,\n" //20 lat2
|
||||||
+" ?,\n" //21 lon3
|
+" ?,\n" //21 lon2
|
||||||
+" ?,\n" //22 lat4
|
+" ?,\n" //22 lat3
|
||||||
+" ?,\n" //23 lon4
|
+" ?,\n" //23 lon3
|
||||||
+" ?,\n" //24 lat5
|
+" ?,\n" //24 lat4
|
||||||
+" ?,\n" //25 lon5
|
+" ?,\n" //25 lon4
|
||||||
+" ?,\n" //26 lat6
|
+" ?,\n" //26 lat5
|
||||||
+" ?,\n" //27 lon6
|
+" ?,\n" //27 lon5
|
||||||
+" ?,\n" //28 bio_hectare
|
+" ?,\n" //28 lat6
|
||||||
+" ?,\n" //29 bio_biotope_id
|
+" ?,\n" //29 lon6
|
||||||
+" ?,\n" //30 bio_greenery_id
|
+" ?,\n" //30 bio_hectare
|
||||||
+" ?,\n" //31 bio_greenery_cover_id
|
+" ?,\n" //31 bio_biotope_id
|
||||||
+" ?,\n" //32 bio_temperature
|
+" ?,\n" //32 bio_greenery_id
|
||||||
+" ?,\n" //33 bio_wind
|
+" ?,\n" //33 bio_greenery_cover_id
|
||||||
+" ?,\n" //34 locust_have
|
+" ?,\n" //34 bio_temperature
|
||||||
+" ?,\n" //35 locust_type_id
|
+" ?,\n" //35 bio_wind
|
||||||
+" ?,\n" //36 locust_populated
|
+" ?,\n" //36 locust_have
|
||||||
+" ?,\n" //37 eggs_capsules_area
|
+" ?,\n" //37 locust_type_id
|
||||||
+" ?,\n" //38 eggs_capsules_density
|
+" ?,\n" //38 locust_populated
|
||||||
+" ?,\n" //39 eggs_capsules_density_to
|
+" ?,\n" //39 eggs_capsules_area
|
||||||
+" ?,\n" //40 eggs_capsules
|
+" ?,\n" //40 eggs_capsules_density
|
||||||
+" ?,\n" //41 eggs_live
|
+" ?,\n" //41 eggs_capsules_density_to
|
||||||
+" ?,\n" //42 eggs_enemies_id
|
+" ?,\n" //42 eggs_capsules
|
||||||
+" ?,\n" //43 larva_born_id
|
+" ?,\n" //43 eggs_live
|
||||||
+" ?,\n" //44 larva_age_id
|
+" ?,\n" //44 eggs_enemies_id
|
||||||
+" ?,\n" //45 larva_painting_id
|
+" ?,\n" //45 larva_born_id
|
||||||
+" ?,\n" //46 larva_behavior_id
|
+" ?,\n" //46 larva_age_id
|
||||||
+" ?,\n" //47 larva_density
|
+" ?,\n" //47 larva_painting_id
|
||||||
+" ?,\n" //48 larva_density_to
|
+" ?,\n" //48 larva_behavior_id
|
||||||
+" ?,\n" //49 kuliguli_age_id
|
+" ?,\n" //49 larva_density
|
||||||
+" ?,\n" //50 kuliguli_density
|
+" ?,\n" //50 larva_density_to
|
||||||
+" ?,\n" //51 kuliguli_density_to
|
+" ?,\n" //51 kuliguli_age_id
|
||||||
+" ?,\n" //52 kuliguli_size
|
+" ?,\n" //52 kuliguli_density
|
||||||
+" ?,\n" //53 kuliguli_count
|
+" ?,\n" //53 kuliguli_density_to
|
||||||
+" ?,\n" //54 kuliguli_action_id
|
+" ?,\n" //54 kuliguli_size
|
||||||
+" ?,\n" //55 imago_wing_id
|
+" ?,\n" //55 kuliguli_count
|
||||||
+" ?,\n" //56 imago_maturity
|
+" ?,\n" //56 kuliguli_action_id
|
||||||
+" ?,\n" //57 imago_phase_id
|
+" ?,\n" //57 imago_wing_id
|
||||||
+" ?,\n" //58 imago_action_id
|
+" ?,\n" //58 imago_maturity
|
||||||
+" ?,\n" //59 imago_density
|
+" ?,\n" //59 imago_phase_id
|
||||||
+" ?,\n" //60 imago_density_ga
|
+" ?,\n" //60 imago_action_id
|
||||||
+" ?,\n" //61 imago_feeding
|
+" ?,\n" //61 imago_density
|
||||||
+" ?,\n" //62 imago_copulation
|
+" ?,\n" //62 imago_density_ga
|
||||||
+" ?,\n" //63 imago_laying
|
+" ?,\n" //63 imago_feeding
|
||||||
+" ?,\n" //64 imago_flying
|
+" ?,\n" //64 imago_copulation
|
||||||
+" ?,\n" //65 swarm_maturity
|
+" ?,\n" //65 imago_laying
|
||||||
+" ?,\n" //66 swarm_density_id
|
+" ?,\n" //66 imago_flying
|
||||||
+" ?,\n" //67 swarm_size
|
+" ?,\n" //67 swarm_maturity
|
||||||
+" ?,\n" //68 swarm_count
|
+" ?,\n" //68 swarm_density_id
|
||||||
+" ?,\n" //69 swarm_copulation
|
+" ?,\n" //69 swarm_size
|
||||||
+" ?,\n" //70 swarm_laying
|
+" ?,\n" //70 swarm_count
|
||||||
+" ?,\n" //71 swarm_flying_direction_id
|
+" ?,\n" //71 swarm_copulation
|
||||||
+" ?,\n" //72 swarm_height_id
|
+" ?,\n" //72 swarm_laying
|
||||||
+" ?,\n" //73 description
|
+" ?,\n" //73 swarm_flying_direction_id
|
||||||
+" ST_SetSRID(ST_GeomFromGeoJSON(?),4326),\n" //74 geom
|
+" ?,\n" //74 swarm_height_id
|
||||||
+" ?\n" //75 test
|
+" ?,\n" //75 description
|
||||||
|
+" ST_SetSRID(ST_GeomFromGeoJSON(?),4326),\n" //76 geom
|
||||||
|
+" ?\n" //77 test
|
||||||
+")";
|
+")";
|
||||||
try {
|
try {
|
||||||
stmt = conn.prepareStatement(sql);
|
stmt = conn.prepareStatement(sql);
|
||||||
@ -733,10 +739,19 @@ public class AcceptASDC implements ServletContextAware {
|
|||||||
String date=getCdataValue(reqNode, "date");
|
String date=getCdataValue(reqNode, "date");
|
||||||
String timezone=getCdataValue(reqNode, "timezone");
|
String timezone=getCdataValue(reqNode, "timezone");
|
||||||
timezone=Tools.numConvert(timezone);
|
timezone=Tools.numConvert(timezone);
|
||||||
|
|
||||||
String lat1=getCdataValue(reqNode, "lat1");
|
String lat1=getCdataValue(reqNode, "lat1");
|
||||||
if(lat1==null) { lat1=getCdataValue(reqNode, "lat"); }
|
if(lat1==null) { lat1=getCdataValue(reqNode, "lat"); }
|
||||||
String lon1=getCdataValue(reqNode, "lon1");
|
String lon1=getCdataValue(reqNode, "lon1");
|
||||||
if(lon1==null) { lon1=getCdataValue(reqNode, "lon"); }
|
if(lon1==null) { lon1=getCdataValue(reqNode, "lon"); }
|
||||||
|
|
||||||
|
String lat_center=getCdataValue(reqNode, "lat_center");
|
||||||
|
if(lat_center==null) { lat_center=lat1; }
|
||||||
|
String lon_center=getCdataValue(reqNode, "lon_center");
|
||||||
|
if(lon_center==null) { lon_center=lon1; }
|
||||||
|
if(lat1==null) { lat1=lat_center; }
|
||||||
|
if(lon1==null) { lon1=lon_center; }
|
||||||
|
|
||||||
String lat2=getCdataValue(reqNode, "lat2");
|
String lat2=getCdataValue(reqNode, "lat2");
|
||||||
String lon2=getCdataValue(reqNode, "lon2");
|
String lon2=getCdataValue(reqNode, "lon2");
|
||||||
String lat3=getCdataValue(reqNode, "lat3");
|
String lat3=getCdataValue(reqNode, "lat3");
|
||||||
@ -845,108 +860,112 @@ public class AcceptASDC implements ServletContextAware {
|
|||||||
|
|
||||||
stmt.setString(15,timezone);
|
stmt.setString(15,timezone);
|
||||||
|
|
||||||
if(lat1==null) stmt.setNull(16, Types.DOUBLE, null); else stmt.setDouble(16,Double.parseDouble(lat1));
|
if(lat_center==null) stmt.setNull(16, Types.DOUBLE, null); else stmt.setDouble(16,Double.parseDouble(lat_center));
|
||||||
if(lon1==null) stmt.setNull(17, Types.DOUBLE, null); else stmt.setDouble(17,Double.parseDouble(lon1));
|
if(lon_center==null) stmt.setNull(17, Types.DOUBLE, null); else stmt.setDouble(17,Double.parseDouble(lon_center));
|
||||||
if(lat2==null) stmt.setNull(18, Types.DOUBLE, null); else stmt.setDouble(18,Double.parseDouble(lat2));
|
|
||||||
if(lon2==null) stmt.setNull(19, Types.DOUBLE, null); else stmt.setDouble(19,Double.parseDouble(lon2));
|
|
||||||
if(lat3==null) stmt.setNull(20, Types.DOUBLE, null); else stmt.setDouble(20,Double.parseDouble(lat3));
|
|
||||||
if(lon3==null) stmt.setNull(21, Types.DOUBLE, null); else stmt.setDouble(21,Double.parseDouble(lon3));
|
|
||||||
if(lat4==null) stmt.setNull(22, Types.DOUBLE, null); else stmt.setDouble(22,Double.parseDouble(lat4));
|
|
||||||
if(lon4==null) stmt.setNull(23, Types.DOUBLE, null); else stmt.setDouble(23,Double.parseDouble(lon4));
|
|
||||||
if(lat5==null) stmt.setNull(24, Types.DOUBLE, null); else stmt.setDouble(24,Double.parseDouble(lat5));
|
|
||||||
if(lon5==null) stmt.setNull(25, Types.DOUBLE, null); else stmt.setDouble(25,Double.parseDouble(lon5));
|
|
||||||
if(lat6==null) stmt.setNull(26, Types.DOUBLE, null); else stmt.setDouble(26,Double.parseDouble(lat6));
|
|
||||||
if(lon6==null) stmt.setNull(27, Types.DOUBLE, null); else stmt.setDouble(27,Double.parseDouble(lon6));
|
|
||||||
|
|
||||||
if(bio_hectare==null) stmt.setNull(28, Types.DOUBLE, null); else stmt.setDouble(28,Double.parseDouble(bio_hectare)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>)
|
|
||||||
if(bio_biotope_id==null) stmt.setNull(29, Types.INTEGER, null); else stmt.setInt(29,Integer.parseInt(bio_biotope_id));
|
|
||||||
if(bio_greenery_id==null) stmt.setNull(30, Types.INTEGER, null); else stmt.setInt(30,Integer.parseInt(bio_greenery_id));
|
|
||||||
if(bio_greenery_cover_id==null) stmt.setNull(31, Types.INTEGER, null); else stmt.setInt(31,Integer.parseInt(bio_greenery_cover_id));
|
|
||||||
if(bio_temperature==null) stmt.setNull(32, Types.DOUBLE, null); else stmt.setDouble(32,Double.parseDouble(bio_temperature));
|
|
||||||
if(bio_wind==null) stmt.setNull(33, Types.DOUBLE, null); else stmt.setDouble(33,Double.parseDouble(bio_wind));
|
|
||||||
if(locust_have==null) stmt.setNull(34, Types.INTEGER, null); else stmt.setInt(34,Integer.parseInt(locust_have));
|
|
||||||
if(locust_type_id==null) stmt.setNull(35, Types.INTEGER, null); else stmt.setInt(35,Integer.parseInt(locust_type_id)); //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
if(locust_populated==null) stmt.setNull(36, Types.DOUBLE, null); else stmt.setDouble(36,Double.parseDouble(locust_populated)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>)
|
|
||||||
|
|
||||||
if(eggs_capsules_area==null) stmt.setNull(37, Types.DOUBLE, null); else stmt.setDouble(37,Double.parseDouble(eggs_capsules_area));
|
|
||||||
if(eggs_capsules_density==null) stmt.setNull(38, Types.DOUBLE, null); else stmt.setDouble(38,Double.parseDouble(eggs_capsules_density));
|
|
||||||
if(eggs_capsules_density_to==null) stmt.setNull(39, Types.DOUBLE, null); else stmt.setDouble(39,Double.parseDouble(eggs_capsules_density_to));
|
|
||||||
if(eggs_capsules==null) stmt.setNull(40, Types.DOUBLE, null); else stmt.setDouble(40,Double.parseDouble(eggs_capsules));
|
|
||||||
if(eggs_live==null) stmt.setNull(41, Types.DOUBLE, null); else stmt.setDouble(41,Double.parseDouble(eggs_live));
|
|
||||||
if(eggs_enemies_id==null) stmt.setNull(42, Types.INTEGER, null); else stmt.setInt(42,Integer.parseInt(eggs_enemies_id)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>?)
|
|
||||||
|
|
||||||
if(larva_born_id==null) stmt.setNull(43, Types.INTEGER, null); else stmt.setInt(43,Integer.parseInt(larva_born_id));
|
|
||||||
if(larva_age_id==null) stmt.setNull(44, Types.INTEGER, null); else stmt.setInt(44,Integer.parseInt(larva_age_id));
|
|
||||||
if(larva_painting_id==null) stmt.setNull(45, Types.INTEGER, null); else stmt.setInt(45,Integer.parseInt(larva_painting_id));
|
|
||||||
if(larva_behavior_id==null) stmt.setNull(46, Types.INTEGER, null); else stmt.setInt(46,Integer.parseInt(larva_behavior_id));
|
|
||||||
|
|
||||||
if(larva_density==null) stmt.setNull(47, Types.DOUBLE, null); else stmt.setDouble(47,Double.parseDouble(larva_density));
|
|
||||||
if(larva_density_to==null) stmt.setNull(48, Types.DOUBLE, null); else stmt.setDouble(48,Double.parseDouble(larva_density_to));
|
|
||||||
if(kuliguli_age_id==null) stmt.setNull(49, Types.INTEGER, null); else stmt.setInt(49,Integer.parseInt(kuliguli_age_id)); //c<>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
||||||
|
|
||||||
if(kuliguli_density==null) stmt.setNull(50, Types.DOUBLE, null); else stmt.setDouble(50,Double.parseDouble(kuliguli_density));
|
|
||||||
if(kuliguli_density_to==null) stmt.setNull(51, Types.DOUBLE, null); else stmt.setDouble(51,Double.parseDouble(kuliguli_density_to));
|
|
||||||
if(kuliguli_size==null) stmt.setNull(52, Types.DOUBLE, null); else stmt.setDouble(52,Double.parseDouble(kuliguli_size));
|
|
||||||
if(kuliguli_count==null) stmt.setNull(53, Types.DOUBLE, null); else stmt.setDouble(53,Double.parseDouble(kuliguli_count));
|
|
||||||
if(kuliguli_action_id==null) stmt.setNull(54, Types.INTEGER, null); else stmt.setInt(54,Integer.parseInt(kuliguli_action_id));
|
|
||||||
if(imago_wing_id==null) stmt.setNull(55, Types.INTEGER, null); else stmt.setInt(55,Integer.parseInt(imago_wing_id));
|
|
||||||
if(imago_maturity==null) stmt.setNull(56, Types.BOOLEAN, null);
|
|
||||||
else {
|
|
||||||
if(imago_maturity.equals("1")) stmt.setBoolean(56,true);
|
|
||||||
else stmt.setBoolean(56,false);
|
|
||||||
}
|
|
||||||
if(imago_phase_id==null) stmt.setNull(57, Types.INTEGER, null); else stmt.setInt(57,Integer.parseInt(imago_phase_id)); //<2F><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>S, <20><><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD> <20>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G)
|
|
||||||
if(imago_action_id==null) stmt.setNull(58, Types.INTEGER, null); else stmt.setInt(58,Integer.parseInt(imago_action_id));
|
|
||||||
|
|
||||||
if(imago_density==null) stmt.setNull(59, Types.DOUBLE, null); else stmt.setDouble(59,Double.parseDouble(imago_density));
|
if(lat1==null) stmt.setNull(18, Types.DOUBLE, null); else stmt.setDouble(18,Double.parseDouble(lat1));
|
||||||
if(imago_density_ga==null) stmt.setNull(60, Types.DOUBLE, null); else stmt.setDouble(60,Double.parseDouble(imago_density_ga));
|
if(lon1==null) stmt.setNull(19, Types.DOUBLE, null); else stmt.setDouble(19,Double.parseDouble(lon1));
|
||||||
if(imago_feeding==null) stmt.setNull(61, Types.BOOLEAN, null);
|
if(lat2==null) stmt.setNull(20, Types.DOUBLE, null); else stmt.setDouble(20,Double.parseDouble(lat2));
|
||||||
|
if(lon2==null) stmt.setNull(21, Types.DOUBLE, null); else stmt.setDouble(21,Double.parseDouble(lon2));
|
||||||
|
if(lat3==null) stmt.setNull(22, Types.DOUBLE, null); else stmt.setDouble(22,Double.parseDouble(lat3));
|
||||||
|
if(lon3==null) stmt.setNull(23, Types.DOUBLE, null); else stmt.setDouble(23,Double.parseDouble(lon3));
|
||||||
|
if(lat4==null) stmt.setNull(24, Types.DOUBLE, null); else stmt.setDouble(24,Double.parseDouble(lat4));
|
||||||
|
if(lon4==null) stmt.setNull(25, Types.DOUBLE, null); else stmt.setDouble(25,Double.parseDouble(lon4));
|
||||||
|
if(lat5==null) stmt.setNull(26, Types.DOUBLE, null); else stmt.setDouble(26,Double.parseDouble(lat5));
|
||||||
|
if(lon5==null) stmt.setNull(27, Types.DOUBLE, null); else stmt.setDouble(27,Double.parseDouble(lon5));
|
||||||
|
if(lat6==null) stmt.setNull(28, Types.DOUBLE, null); else stmt.setDouble(28,Double.parseDouble(lat6));
|
||||||
|
if(lon6==null) stmt.setNull(29, Types.DOUBLE, null); else stmt.setDouble(29,Double.parseDouble(lon6));
|
||||||
|
|
||||||
|
if(bio_hectare==null) stmt.setNull(30, Types.DOUBLE, null); else stmt.setDouble(30,Double.parseDouble(bio_hectare)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>)
|
||||||
|
if(bio_biotope_id==null) stmt.setNull(31, Types.INTEGER, null); else stmt.setInt(31,Integer.parseInt(bio_biotope_id));
|
||||||
|
if(bio_greenery_id==null) stmt.setNull(32, Types.INTEGER, null); else stmt.setInt(32,Integer.parseInt(bio_greenery_id));
|
||||||
|
if(bio_greenery_cover_id==null) stmt.setNull(33, Types.INTEGER, null); else stmt.setInt(33,Integer.parseInt(bio_greenery_cover_id));
|
||||||
|
if(bio_temperature==null) stmt.setNull(34, Types.DOUBLE, null); else stmt.setDouble(34,Double.parseDouble(bio_temperature));
|
||||||
|
if(bio_wind==null) stmt.setNull(35, Types.DOUBLE, null); else stmt.setDouble(35,Double.parseDouble(bio_wind));
|
||||||
|
if(locust_have==null) stmt.setNull(36, Types.INTEGER, null); else stmt.setInt(36,Integer.parseInt(locust_have));
|
||||||
|
if(locust_type_id==null) stmt.setNull(37, Types.INTEGER, null); else stmt.setInt(37,Integer.parseInt(locust_type_id)); //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
if(locust_populated==null) stmt.setNull(38, Types.DOUBLE, null); else stmt.setDouble(38,Double.parseDouble(locust_populated)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><>)
|
||||||
|
|
||||||
|
if(eggs_capsules_area==null) stmt.setNull(39, Types.DOUBLE, null); else stmt.setDouble(39,Double.parseDouble(eggs_capsules_area));
|
||||||
|
if(eggs_capsules_density==null) stmt.setNull(40, Types.DOUBLE, null); else stmt.setDouble(40,Double.parseDouble(eggs_capsules_density));
|
||||||
|
if(eggs_capsules_density_to==null) stmt.setNull(41, Types.DOUBLE, null); else stmt.setDouble(41,Double.parseDouble(eggs_capsules_density_to));
|
||||||
|
if(eggs_capsules==null) stmt.setNull(42, Types.DOUBLE, null); else stmt.setDouble(42,Double.parseDouble(eggs_capsules));
|
||||||
|
if(eggs_live==null) stmt.setNull(43, Types.DOUBLE, null); else stmt.setDouble(43,Double.parseDouble(eggs_live));
|
||||||
|
if(eggs_enemies_id==null) stmt.setNull(44, Types.INTEGER, null); else stmt.setInt(44,Integer.parseInt(eggs_enemies_id)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>?)
|
||||||
|
|
||||||
|
if(larva_born_id==null) stmt.setNull(45, Types.INTEGER, null); else stmt.setInt(45,Integer.parseInt(larva_born_id));
|
||||||
|
if(larva_age_id==null) stmt.setNull(46, Types.INTEGER, null); else stmt.setInt(46,Integer.parseInt(larva_age_id));
|
||||||
|
if(larva_painting_id==null) stmt.setNull(47, Types.INTEGER, null); else stmt.setInt(47,Integer.parseInt(larva_painting_id));
|
||||||
|
if(larva_behavior_id==null) stmt.setNull(48, Types.INTEGER, null); else stmt.setInt(48,Integer.parseInt(larva_behavior_id));
|
||||||
|
|
||||||
|
if(larva_density==null) stmt.setNull(49, Types.DOUBLE, null); else stmt.setDouble(49,Double.parseDouble(larva_density));
|
||||||
|
if(larva_density_to==null) stmt.setNull(50, Types.DOUBLE, null); else stmt.setDouble(50,Double.parseDouble(larva_density_to));
|
||||||
|
if(kuliguli_age_id==null) stmt.setNull(51, Types.INTEGER, null); else stmt.setInt(51,Integer.parseInt(kuliguli_age_id)); //c<>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
|
|
||||||
|
if(kuliguli_density==null) stmt.setNull(52, Types.DOUBLE, null); else stmt.setDouble(52,Double.parseDouble(kuliguli_density));
|
||||||
|
if(kuliguli_density_to==null) stmt.setNull(53, Types.DOUBLE, null); else stmt.setDouble(53,Double.parseDouble(kuliguli_density_to));
|
||||||
|
if(kuliguli_size==null) stmt.setNull(54, Types.DOUBLE, null); else stmt.setDouble(54,Double.parseDouble(kuliguli_size));
|
||||||
|
if(kuliguli_count==null) stmt.setNull(55, Types.DOUBLE, null); else stmt.setDouble(55,Double.parseDouble(kuliguli_count));
|
||||||
|
if(kuliguli_action_id==null) stmt.setNull(56, Types.INTEGER, null); else stmt.setInt(56,Integer.parseInt(kuliguli_action_id));
|
||||||
|
if(imago_wing_id==null) stmt.setNull(57, Types.INTEGER, null); else stmt.setInt(57,Integer.parseInt(imago_wing_id));
|
||||||
|
if(imago_maturity==null) stmt.setNull(58, Types.BOOLEAN, null);
|
||||||
else {
|
else {
|
||||||
if(imago_feeding.equals("1")) stmt.setBoolean(61,true);
|
if(imago_maturity.equals("1")) stmt.setBoolean(58,true);
|
||||||
else stmt.setBoolean(61,false);
|
else stmt.setBoolean(58,false);
|
||||||
}
|
}
|
||||||
if(imago_copulation==null) stmt.setNull(62, Types.BOOLEAN, null);
|
if(imago_phase_id==null) stmt.setNull(59, Types.INTEGER, null); else stmt.setInt(59,Integer.parseInt(imago_phase_id)); //<2F><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>S, <20><><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD><6F><EFBFBD><EFBFBD> <20>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G)
|
||||||
else {
|
if(imago_action_id==null) stmt.setNull(60, Types.INTEGER, null); else stmt.setInt(60,Integer.parseInt(imago_action_id));
|
||||||
if(imago_copulation.equals("1")) stmt.setBoolean(62,true);
|
|
||||||
else stmt.setBoolean(62,false);
|
if(imago_density==null) stmt.setNull(61, Types.DOUBLE, null); else stmt.setDouble(61,Double.parseDouble(imago_density));
|
||||||
}
|
if(imago_density_ga==null) stmt.setNull(62, Types.DOUBLE, null); else stmt.setDouble(62,Double.parseDouble(imago_density_ga));
|
||||||
if(imago_laying==null) stmt.setNull(63, Types.BOOLEAN, null);
|
if(imago_feeding==null) stmt.setNull(63, Types.BOOLEAN, null);
|
||||||
else {
|
else {
|
||||||
if(imago_laying.equals("1")) stmt.setBoolean(63,true);
|
if(imago_feeding.equals("1")) stmt.setBoolean(63,true);
|
||||||
else stmt.setBoolean(63,false);
|
else stmt.setBoolean(63,false);
|
||||||
}
|
}
|
||||||
if(imago_flying==null) stmt.setNull(64, Types.BOOLEAN, null);
|
|
||||||
else {
|
if(imago_copulation==null) stmt.setNull(64, Types.BOOLEAN, null);
|
||||||
if(imago_flying.equals("1")) stmt.setBoolean(64,true);
|
else {
|
||||||
|
if(imago_copulation.equals("1")) stmt.setBoolean(64,true);
|
||||||
else stmt.setBoolean(64,false);
|
else stmt.setBoolean(64,false);
|
||||||
}
|
}
|
||||||
if(swarm_maturity==null) stmt.setNull(65, Types.BOOLEAN, null);
|
if(imago_laying==null) stmt.setNull(65, Types.BOOLEAN, null);
|
||||||
else {
|
else {
|
||||||
if(swarm_maturity.equals("1")) stmt.setBoolean(65,true);
|
if(imago_laying.equals("1")) stmt.setBoolean(65,true);
|
||||||
else stmt.setBoolean(65,false);
|
else stmt.setBoolean(65,false);
|
||||||
}
|
}
|
||||||
if(swarm_density_id==null) stmt.setNull(66, Types.INTEGER, null); else stmt.setInt(66,Integer.parseInt(swarm_density_id));
|
if(imago_flying==null) stmt.setNull(66, Types.BOOLEAN, null);
|
||||||
if(swarm_size==null) stmt.setNull(67, Types.DOUBLE, null); else stmt.setDouble(67,Double.parseDouble(swarm_size));
|
|
||||||
if(swarm_count==null) stmt.setNull(68, Types.DOUBLE, null); else stmt.setDouble(68,Double.parseDouble(swarm_count));
|
|
||||||
if(swarm_copulation==null) stmt.setNull(69, Types.BOOLEAN, null);
|
|
||||||
else {
|
else {
|
||||||
if(swarm_copulation.equals("1")) stmt.setBoolean(69,true);
|
if(imago_flying.equals("1")) stmt.setBoolean(66,true);
|
||||||
else stmt.setBoolean(69,false);
|
else stmt.setBoolean(66,false);
|
||||||
|
}
|
||||||
|
if(swarm_maturity==null) stmt.setNull(67, Types.BOOLEAN, null);
|
||||||
|
else {
|
||||||
|
if(swarm_maturity.equals("1")) stmt.setBoolean(67,true);
|
||||||
|
else stmt.setBoolean(67,false);
|
||||||
|
}
|
||||||
|
if(swarm_density_id==null) stmt.setNull(68, Types.INTEGER, null); else stmt.setInt(68,Integer.parseInt(swarm_density_id));
|
||||||
|
if(swarm_size==null) stmt.setNull(69, Types.DOUBLE, null); else stmt.setDouble(69,Double.parseDouble(swarm_size));
|
||||||
|
if(swarm_count==null) stmt.setNull(70, Types.DOUBLE, null); else stmt.setDouble(70,Double.parseDouble(swarm_count));
|
||||||
|
if(swarm_copulation==null) stmt.setNull(71, Types.BOOLEAN, null);
|
||||||
|
else {
|
||||||
|
if(swarm_copulation.equals("1")) stmt.setBoolean(71,true);
|
||||||
|
else stmt.setBoolean(71,false);
|
||||||
}
|
}
|
||||||
if(swarm_laying==null) stmt.setNull(70, Types.BOOLEAN, null);
|
if(swarm_laying==null) stmt.setNull(72, Types.BOOLEAN, null);
|
||||||
else {
|
else {
|
||||||
if(swarm_laying.equals("1")) stmt.setBoolean(70,true);
|
if(swarm_laying.equals("1")) stmt.setBoolean(72,true);
|
||||||
else stmt.setBoolean(70,false);
|
else stmt.setBoolean(72,false);
|
||||||
}
|
}
|
||||||
if(swarm_flying_direction_id==null) stmt.setNull(71, Types.INTEGER, null); else stmt.setInt(71,Integer.parseInt(swarm_flying_direction_id));
|
if(swarm_flying_direction_id==null) stmt.setNull(73, Types.INTEGER, null); else stmt.setInt(73,Integer.parseInt(swarm_flying_direction_id));
|
||||||
if(swarm_height_id==null) stmt.setNull(72, Types.INTEGER, null); else stmt.setInt(72,Integer.parseInt(swarm_height_id)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
if(swarm_height_id==null) stmt.setNull(74, Types.INTEGER, null); else stmt.setInt(74,Integer.parseInt(swarm_height_id)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||||
|
|
||||||
stmt.setString(73,description);
|
stmt.setString(75,description);
|
||||||
stmt.setString(74,geom);
|
stmt.setString(76,geom);
|
||||||
if(test==null) stmt.setNull(75, Types.BOOLEAN, null);
|
if(test==null) stmt.setNull(77, Types.BOOLEAN, null);
|
||||||
else {
|
else {
|
||||||
if(test.equals("1")) stmt.setBoolean(75,true);
|
if(test.equals("1")) stmt.setBoolean(77,true);
|
||||||
else stmt.setBoolean(75,false);
|
else stmt.setBoolean(77,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
|
|||||||
@ -73,6 +73,280 @@ public class AcceptJSON implements ServletContextAware {
|
|||||||
public void setServletContext(ServletContext servletContext) {
|
public void setServletContext(ServletContext servletContext) {
|
||||||
this.context=servletContext;
|
this.context=servletContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/AcceptJSON_KAZ", method = { RequestMethod.GET, RequestMethod.POST })
|
||||||
|
public String acceptJSON_KAZ(@ModelAttribute User user, Model model,@RequestParam(required=false,name="file") MultipartFile file,@RequestParam(required=false,name="skip",defaultValue = "0") Boolean skip) {
|
||||||
|
|
||||||
|
String db_url="";
|
||||||
|
String db_login="";
|
||||||
|
String db_password="";
|
||||||
|
//Load DB configuration
|
||||||
|
try {
|
||||||
|
//String fullPath = context.getRealPath("/WEB-INF/config.xml");
|
||||||
|
//File fXmlFile = new File(fullPath);
|
||||||
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||||
|
//Document doc = dBuilder.parse(fXmlFile);
|
||||||
|
Document doc = dBuilder.parse(new ClassPathResource("config.xml").getInputStream());
|
||||||
|
Element nMain=doc.getDocumentElement();
|
||||||
|
NodeList nl=nMain.getChildNodes();
|
||||||
|
for (int i = 0; i <nl.getLength(); i++)
|
||||||
|
{
|
||||||
|
if(nl.item(i).getNodeName().equals("db-url"))
|
||||||
|
db_url=nl.item(i).getTextContent();
|
||||||
|
if(nl.item(i).getNodeName().equals("db-login"))
|
||||||
|
db_login=nl.item(i).getTextContent();
|
||||||
|
if(nl.item(i).getNodeName().equals("db-password"))
|
||||||
|
db_password=nl.item(i).getTextContent();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
Class.forName("org.postgresql.Driver");
|
||||||
|
conn = DriverManager.getConnection(db_url, db_login, db_password);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String strURL="http://91.185.13.233:98/get_fito";
|
||||||
|
URL url = new URL(strURL);
|
||||||
|
HttpURLConnection hConn = (HttpURLConnection) url.openConnection();
|
||||||
|
hConn.setRequestMethod("GET");
|
||||||
|
hConn.setRequestProperty("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEyMyIsInVzZXJuYW1lIjoiQ0NBTE0iLCJyb2xlIjoidXNlciIsImlhdCI6MTcwNjc4NjQ0Nn0.bypDbAZYjbQu8hWrb6MnnAZ80AbO4ZifP3inEnpbabI");
|
||||||
|
hConn.connect();
|
||||||
|
int responseCode = hConn.getResponseCode();
|
||||||
|
if (responseCode / 100 == 2) //Code 206 is "Partial Content"
|
||||||
|
{
|
||||||
|
InputStreamReader inputStream = new InputStreamReader(hConn.getInputStream(), "UTF-8");
|
||||||
|
int bytesRead;
|
||||||
|
char[] buffer = new char[BUFFER_SIZE];
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
sb.append(new String(buffer,0,bytesRead));
|
||||||
|
}
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
}catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
String content=sb.toString();
|
||||||
|
if(content==null || content.equals("")) {
|
||||||
|
System.out.println("Content is null");
|
||||||
|
}else {
|
||||||
|
//String str="";
|
||||||
|
System.out.println("Start");
|
||||||
|
|
||||||
|
String sql="delete from main.frmlocust where country_id=5 and eid=0 and extract(year from date)=2023";
|
||||||
|
try{
|
||||||
|
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||||
|
int cnt = stmt.executeUpdate();
|
||||||
|
System.out.println("cnt: " + String.valueOf(cnt));
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//System.out.println(content);
|
||||||
|
//Iterate over the elements of the array.
|
||||||
|
int i=1;
|
||||||
|
JSONObject jsonObject= new JSONObject(content);
|
||||||
|
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
||||||
|
for (Object o : jsonArray) {
|
||||||
|
JSONObject jsonObj = (JSONObject) o;
|
||||||
|
|
||||||
|
//System.out.println( "insert into main.frmlocust");
|
||||||
|
sql="insert into main.frmlocust(\n"
|
||||||
|
+" eid,\n" //1
|
||||||
|
+" lat1,\n" //2
|
||||||
|
+" lon1,\n" //3
|
||||||
|
+" date,\n" //4
|
||||||
|
+" village,\n" //5
|
||||||
|
+" terrain,\n" //6
|
||||||
|
+" district,\n" //7
|
||||||
|
+" country_id,\n" //8
|
||||||
|
+" region_id,\n" //9
|
||||||
|
+" locust_type_id,\n" //10
|
||||||
|
+" bio_hectare,\n" //11
|
||||||
|
+" locust_populated,\n" //12
|
||||||
|
+" description\n" //13
|
||||||
|
+")values(\n"
|
||||||
|
+" ?,\n" //1 eid
|
||||||
|
+" ?,\n" //2 lat1
|
||||||
|
+" ?,\n" //3 lon1
|
||||||
|
+" TO_TIMESTAMP(?, 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"'),\n" //4 date
|
||||||
|
+" LEFT(?, 100),\n" //5 village
|
||||||
|
+" LEFT(?, 100),\n" //6 terrain
|
||||||
|
+" LEFT(?, 100),\n" //7 district
|
||||||
|
+" ?,\n" //8 country_id
|
||||||
|
+" ?,\n" //9 region_id
|
||||||
|
+" ?,\n" //10 locust_type_id
|
||||||
|
+" ?,\n" //11 bio_hectare
|
||||||
|
+" ?,\n" //12 locust_populated
|
||||||
|
+" ?\n" //13 description
|
||||||
|
+")";
|
||||||
|
PreparedStatement stmt=null;
|
||||||
|
try {
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
model.addAttribute("PreviewTable","Error prepare 2");
|
||||||
|
return "json";
|
||||||
|
}
|
||||||
|
if(jsonObj.getString("examination_date").indexOf("2023-")>=0) {
|
||||||
|
|
||||||
|
String description="";
|
||||||
|
description += "city: "+jsonObj.getString("city")+"\n";
|
||||||
|
description += "message_type: "+jsonObj.getString("message_type")+"\n";
|
||||||
|
if(jsonObj.has("development_stage") && !jsonObj.isNull("development_stage"))
|
||||||
|
description += "stage: "+jsonObj.getString("development_stage")+"\n";
|
||||||
|
|
||||||
|
try {
|
||||||
|
stmt.setLong(1, 0);
|
||||||
|
stmt.setDouble(2,jsonObj.getDouble("latitude"));
|
||||||
|
stmt.setDouble(3,jsonObj.getDouble("longitude"));
|
||||||
|
stmt.setString(4,jsonObj.getString("examination_date")); //2023-03-20T06:23:20.000Z
|
||||||
|
if(jsonObj.has("village") && !jsonObj.isNull("village"))
|
||||||
|
stmt.setString(5,jsonObj.getString("village"));
|
||||||
|
else
|
||||||
|
stmt.setNull(5, Types.VARCHAR);
|
||||||
|
if(jsonObj.has("farm") && !jsonObj.isNull("farm"))
|
||||||
|
stmt.setString(6,jsonObj.getString("farm"));
|
||||||
|
else
|
||||||
|
stmt.setNull(6, Types.VARCHAR);
|
||||||
|
stmt.setString(7,jsonObj.getString("district"));
|
||||||
|
stmt.setInt(8,5); //country_id
|
||||||
|
|
||||||
|
|
||||||
|
int region_id=-1;
|
||||||
|
switch (jsonObj.getString("region")) {
|
||||||
|
case "Туркестанская": //5 false -215739 1691403679 5 "Түркістан облысы (Туркестанская область)"
|
||||||
|
region_id=5;
|
||||||
|
break;
|
||||||
|
case "Жамбылская": //4 false -215722 1691403679 5 "Жамбыл облысы (Жамбылская область)"
|
||||||
|
region_id=4;
|
||||||
|
break;
|
||||||
|
case "Алматинская": //3 false -215718 1691403679 5 "Алматы облысы (Алматинская область)"
|
||||||
|
region_id=3;
|
||||||
|
break;
|
||||||
|
case "Карагандинская": //2 false -215776 1691403679 5 "Қарағанды облысы (Карагандинская область)"
|
||||||
|
region_id=2;
|
||||||
|
break;
|
||||||
|
case "Жетысу": //478 false -14312169 1691403679 5 "Жетісу облысы"
|
||||||
|
region_id=478;
|
||||||
|
break;
|
||||||
|
case "Кызылординская": //6 false -215727 1691403679 5 "Қызылорда облысы (Кызылординская область)"
|
||||||
|
region_id=6;
|
||||||
|
break;
|
||||||
|
case "Атырауская": //13 false -214834 1691403679 5 "Атырау облысы (Атырауская область)"
|
||||||
|
region_id=13;
|
||||||
|
break;
|
||||||
|
case "Западно-Казахстанская": //12 false -215441 1691403679 5 "Батыс Қазақстан облысы (Западно-Казахстанская область)"
|
||||||
|
region_id=12;
|
||||||
|
break;
|
||||||
|
case "Акмолинская": //10 false -215743 1691403679 5 "Ақмола облысы (Акмолинская область)"
|
||||||
|
region_id=10;
|
||||||
|
break;
|
||||||
|
case "Восточно-Казахстанская": //1 false -215699 1691403679 5 "Шығыс Қазақстан облысы (Восточно-Казахстанская область)"
|
||||||
|
region_id=1;
|
||||||
|
break;
|
||||||
|
case "Абай": //477 false -14243026 1691473439 5 "Абай облысы"
|
||||||
|
region_id=477;
|
||||||
|
break;
|
||||||
|
case "Костанайская": //8 false -1288730 1691403679 5 "Қостанай облысы (Костанайская область)"
|
||||||
|
region_id=8;
|
||||||
|
break;
|
||||||
|
case "Павлодарская": //11 false -215772 1691403679 5 "Павлодар облысы (Павлодарская область)"
|
||||||
|
region_id=11;
|
||||||
|
break;
|
||||||
|
case "Северо-Казахстанская": //9 false -215760 1691403679 5 "Солтүстік Қазақстан облысы (Северо-Казахстанская область)"
|
||||||
|
region_id=9;
|
||||||
|
break;
|
||||||
|
case "Актюбинская": //7 false -215683 1691403679 5 "Ақтөбе облысы (Актюбинская область)"
|
||||||
|
region_id=7;
|
||||||
|
break;
|
||||||
|
case "Мангистауская": //14 false -215686 1691403679 5 "Маңғыстау облысы (Мангистауская область)"
|
||||||
|
region_id=14;
|
||||||
|
break;
|
||||||
|
case "Улытау": //479 false -14312737 1691462768 5 "Ұлытау облысы"
|
||||||
|
region_id=14;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.out.println(jsonObj.getString("region"));
|
||||||
|
}
|
||||||
|
stmt.setInt(9,region_id); //region_id
|
||||||
|
|
||||||
|
//Вид саранчи
|
||||||
|
int locust_id=-1;
|
||||||
|
switch (jsonObj.getString("grasshopper_type")) {
|
||||||
|
case "Мароккская саранча":
|
||||||
|
locust_id=2;
|
||||||
|
break;
|
||||||
|
case "Итальянский прус":
|
||||||
|
locust_id=1;
|
||||||
|
break;
|
||||||
|
case "Азиатская саранча":
|
||||||
|
locust_id=3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.out.println(jsonObj.getString("grasshopper_type"));
|
||||||
|
}
|
||||||
|
stmt.setInt(10,locust_id); //locust_id
|
||||||
|
|
||||||
|
//Обследованно
|
||||||
|
if(jsonObj.has("examination_area") && !jsonObj.isNull("examination_area"))
|
||||||
|
stmt.setDouble(11,Double.parseDouble(jsonObj.get("examination_area").toString()));
|
||||||
|
else
|
||||||
|
stmt.setNull(11, Types.DOUBLE);
|
||||||
|
|
||||||
|
//Площадь заселения
|
||||||
|
if(jsonObj.has("settlement_area") && !jsonObj.isNull("settlement_area"))
|
||||||
|
stmt.setDouble(12,Double.parseDouble(jsonObj.get("settlement_area").toString()));
|
||||||
|
else
|
||||||
|
stmt.setNull(12, Types.DOUBLE);
|
||||||
|
|
||||||
|
//Прочее описание
|
||||||
|
stmt.setString(13,description); //description
|
||||||
|
|
||||||
|
|
||||||
|
if(region_id!=-1) {
|
||||||
|
stmt.execute();
|
||||||
|
}else {
|
||||||
|
System.out.println("region: "+jsonObj.getString("region"));
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
model.addAttribute("PreviewTable","Error set data");
|
||||||
|
return "json";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
System.out.println("Proc count = "+String.valueOf(i));
|
||||||
|
|
||||||
|
/*String filePath = "O:\\temp\\123.txt";
|
||||||
|
try {
|
||||||
|
FileWriter fileWriter = new FileWriter(filePath);
|
||||||
|
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
|
||||||
|
bufferedWriter.write(str);
|
||||||
|
bufferedWriter.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
return "json";
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/AcceptJSON", method = { RequestMethod.GET, RequestMethod.POST })
|
@RequestMapping(value = "/AcceptJSON", method = { RequestMethod.GET, RequestMethod.POST })
|
||||||
public String acceptCSV(@ModelAttribute User user, Model model,@RequestParam(required=false,name="file") MultipartFile file,@RequestParam(required=false,name="skip",defaultValue = "0") Boolean skip) {
|
public String acceptCSV(@ModelAttribute User user, Model model,@RequestParam(required=false,name="file") MultipartFile file,@RequestParam(required=false,name="skip",defaultValue = "0") Boolean skip) {
|
||||||
|
|||||||
@ -688,6 +688,161 @@ public class Products implements ServletContextAware {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/get_checkpoints",method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
|
||||||
|
@ResponseBody
|
||||||
|
public String getCheckpoints(@ModelAttribute User user,@RequestBody byte[] reqData,@RequestParam(required=false,name="lng") String language_id) {
|
||||||
|
|
||||||
|
int errorCode=0;
|
||||||
|
String errorMessage="";
|
||||||
|
|
||||||
|
//Load configuration from "config.xml"
|
||||||
|
String db_url = "";
|
||||||
|
String db_login = "";
|
||||||
|
String db_password = "";
|
||||||
|
try {
|
||||||
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||||
|
//Document doc = dBuilder.parse(fXmlFile);
|
||||||
|
Document doc = dBuilder.parse(new ClassPathResource("config.xml").getInputStream());
|
||||||
|
Element nMain = doc.getDocumentElement();
|
||||||
|
NodeList nl = nMain.getChildNodes();
|
||||||
|
for (int i = 0; i < nl.getLength(); i++) {
|
||||||
|
if (nl.item(i).getNodeName().equals("db-url"))
|
||||||
|
db_url = nl.item(i).getTextContent();
|
||||||
|
if (nl.item(i).getNodeName().equals("db-login"))
|
||||||
|
db_login = nl.item(i).getTextContent();
|
||||||
|
if (nl.item(i).getNodeName().equals("db-password"))
|
||||||
|
db_password = nl.item(i).getTextContent();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
errorCode=1;
|
||||||
|
errorMessage+="Internal server error, settings.";
|
||||||
|
logger.info(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection conn = null;
|
||||||
|
try {
|
||||||
|
Class.forName("org.postgresql.Driver");
|
||||||
|
conn = DriverManager.getConnection(db_url, db_login, db_password);
|
||||||
|
if (conn != null) {
|
||||||
|
logger.info("Connect is OK!");
|
||||||
|
} else {
|
||||||
|
errorCode=1;
|
||||||
|
errorMessage+="An error occurred while connecting to the database!";
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.info(ex.getMessage());
|
||||||
|
errorCode=1;
|
||||||
|
errorMessage+="An error occurred while connecting to the database!";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Statement stt0 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
|
//st.executeUpdate("SET TIME ZONE 'UTC';"); зачем коментил?
|
||||||
|
stt0.executeUpdate("SET TIME ZONE 'Asia/Almaty';");
|
||||||
|
stt0.close();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
logger.info(ex.getMessage());
|
||||||
|
errorCode=1;
|
||||||
|
errorMessage+="Failed to execute SQL query!";
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject doc=null;
|
||||||
|
InputStream body;
|
||||||
|
if(reqData!=null) {
|
||||||
|
|
||||||
|
|
||||||
|
body = new ByteArrayInputStream(reqData);
|
||||||
|
|
||||||
|
String text="";
|
||||||
|
try {
|
||||||
|
text = new String(body.readAllBytes(), StandardCharsets.UTF_8);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
logger.info(text);
|
||||||
|
|
||||||
|
//JSONParser jsonParser = new JSONParser();
|
||||||
|
//doc = (JSONObject)jsonParser.parse(text);
|
||||||
|
//doc = new JSONObject(body);
|
||||||
|
doc = new JSONObject(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONArray array=new JSONArray(); //Результирующий набор данных
|
||||||
|
|
||||||
|
String sql_query = "";
|
||||||
|
Statement stt=null;
|
||||||
|
ResultSet rs=null;
|
||||||
|
try {
|
||||||
|
stt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||||
|
sql_query = "select id,"
|
||||||
|
+ " country_id,"
|
||||||
|
+ " lat,"
|
||||||
|
+ " lon"
|
||||||
|
+ " from main.frmcheckpoints where"
|
||||||
|
+ " del=false"
|
||||||
|
+ " and (${country_id} is null or (${country_id}=-1 and country_id in (7,3,4,2)) or (${country_id}=-2 and country_id in (7,1,5,6,8,9,10)) or ${country_id}=country_id)"
|
||||||
|
+ " order by id desc;";
|
||||||
|
|
||||||
|
PreparedStatementNamed stmtn = new PreparedStatementNamed(conn, sql_query);
|
||||||
|
if(doc!=null) {
|
||||||
|
//stmtn.setInt("_user_id", Integer.parseInt(user.id));
|
||||||
|
|
||||||
|
if(doc.isNull("country_id")) stmtn.setNULLInt("country_id");
|
||||||
|
else stmtn.setInt("country_id",doc.getInt("country_id"));
|
||||||
|
}
|
||||||
|
PreparedStatement stmt=stmtn.getPreparedStatement();
|
||||||
|
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
if (rs != null) {
|
||||||
|
try {
|
||||||
|
while(rs.next()) {
|
||||||
|
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("id", rs.getLong("id"));
|
||||||
|
|
||||||
|
double lat=0;
|
||||||
|
double lon=0;
|
||||||
|
lat=rs.getDouble("lat");
|
||||||
|
lon=rs.getDouble("lon");
|
||||||
|
obj.put("lat", lat);
|
||||||
|
obj.put("lon", lon);
|
||||||
|
|
||||||
|
array.put(obj);
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
errorCode=4;
|
||||||
|
errorMessage+="Internal server error, sampling.";
|
||||||
|
ex.printStackTrace();
|
||||||
|
logger.info(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
errorCode=5;
|
||||||
|
errorMessage+="Internal server error, sampling. ";
|
||||||
|
ex.printStackTrace();
|
||||||
|
logger.info(ex.getMessage());
|
||||||
|
}finally {
|
||||||
|
if(rs!=null) try{rs.close();}catch(SQLException ex){}
|
||||||
|
if(stt!=null) try{stt.close();}catch(SQLException ex){}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(errorCode!=0) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("errorCode",errorCode);
|
||||||
|
obj.put("errorMessage", errorMessage);
|
||||||
|
return obj.toString();
|
||||||
|
}else {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("errorCode",0);
|
||||||
|
obj.put("errorMessage", "");
|
||||||
|
obj.put("data",array);
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setServletContext(ServletContext servletContext) {
|
public void setServletContext(ServletContext servletContext) {
|
||||||
this.context=servletContext;
|
this.context=servletContext;
|
||||||
|
|||||||
@ -145,6 +145,7 @@ var g_user=null;
|
|||||||
//var g_WinLegend1 = null;
|
//var g_WinLegend1 = null;
|
||||||
//var m_FrmLocust=null;
|
//var m_FrmLocust=null;
|
||||||
//var m_FrmLocustDel=null;
|
//var m_FrmLocustDel=null;
|
||||||
|
var g_FrmCheckpoints=null;
|
||||||
|
|
||||||
|
|
||||||
//Decode URL parameters.
|
//Decode URL parameters.
|
||||||
@ -715,6 +716,30 @@ if(field!=null)
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div style="position: relative; padding-left:1px; padding-right:1px; padding-bottom:5px;">
|
||||||
|
<table id="FrmCheckpointData" style="border: 1px solid rgb(99, 99, 99); table-layout: auto;" width="100%" cellspacing="2" cellpadding="0" bgcolor="whitesmoke">
|
||||||
|
<caption style="text-align:left; font-weight:bold;">Контрольные точки</caption>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 1px; white-space: nowrap;">${Country}</td>
|
||||||
|
<td style="padding: 1px; width: 100%;"><select style="width: 100%;" id="filter_checkpoint_country_id"><option value="1">Afghanistan (افغانستان)</option><option value="2">Armenia (Հայաստան)</option><option value="3">Azərbaycan (Azerbaijan)</option><option value="4">Georgia (საქართველო)</option><option value="5">Kazakhstan (Қазақстан)</option><option value="6">Kyrgyzstan (Кыргызстан)</option><option value="7">Russia (Российская Федерация)</option><option value="8">Tajikistan (Тоҷикистон)</option><option value="9">Turkmenistan (Türkmenistan)</option><option value="10">Uzbekistan (O'zbekiston)</option><option value="">${All_countries_of_CCA}</option><option value="-1">${The_Caucasus_countries_and_Russia}</option><option value="-2">${Countries_of_Central_Asia_and_Russia}</option></select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 1px;"><input value="${Open_in_a_table_format}" type="button" onclick="openFrmCheckpoints();"></td>
|
||||||
|
<td style="padding: 1px;" align="right"><input value="${Show_data}" type="button" onclick="callFrmCheckpoints();"><input value="${Hide}" type="button" onclick="hideFrmCheckpoints();"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var field=document.getElementById("filter_checkpoint_country_id");
|
||||||
|
if(field!=null)
|
||||||
|
{
|
||||||
|
field.value=country_id;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--div id="tab_Survey_Form">
|
<!--div id="tab_Survey_Form">
|
||||||
@ -1703,14 +1728,27 @@ map.addLayer(districtLayer);
|
|||||||
|
|
||||||
|
|
||||||
// display popup on click
|
// display popup on click
|
||||||
map.on('click', function(evt){
|
map.on('singleclick', function(evt){ //map.on('click', function(evt){
|
||||||
|
|
||||||
var coordinate = evt.coordinate;
|
let coordinate = evt.coordinate;
|
||||||
//var hdms = ol.coordinate.toStringHDMS(ol.proj.transform( coordinate, 'EPSG:3857', 'EPSG:4326'));
|
//var hdms = ol.coordinate.toStringHDMS(ol.proj.transform( coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||||
//$(element).popover('destroy');
|
//$(element).popover('destroy');
|
||||||
//popup.setPosition(coordinate);
|
//popup.setPosition(coordinate);
|
||||||
//$(popup.getElement()).show();
|
//$(popup.getElement()).show();
|
||||||
|
|
||||||
|
if(g_FrmCheckpoints!=null){
|
||||||
|
let center = ol.proj.transform(coordinate, 'EPSG:3857', 'EPSG:4326')
|
||||||
|
|
||||||
|
for(let i=0;i<g_FrmCheckpoints.win.childs.length;i++){
|
||||||
|
if(g_FrmCheckpoints.win.childs[i]!=null && g_FrmCheckpoints.win.childs[i].obj.constructor.name == "EdtRec"){
|
||||||
|
let erec = g_FrmCheckpoints.win.childs[i].obj;
|
||||||
|
erec.setValue("lat",center[1]);
|
||||||
|
erec.setValue("lon",center[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var feature = map.forEachFeatureAtPixel(evt.pixel,function(feature) {return feature;});
|
var feature = map.forEachFeatureAtPixel(evt.pixel,function(feature) {return feature;});
|
||||||
if(feature)
|
if(feature)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -364,8 +364,8 @@ function getFeatureStyle (feature) {
|
|||||||
|
|
||||||
// display popup on click
|
// display popup on click
|
||||||
g_map.on('click', function(evt){
|
g_map.on('click', function(evt){
|
||||||
|
|
||||||
let coordinate = evt.coordinate;
|
let coordinate = evt.coordinate;
|
||||||
|
|
||||||
|
|
||||||
//var hdms = ol.coordinate.toStringHDMS(ol.proj.transform( coordinate, 'EPSG:3857', 'EPSG:4326'));
|
//var hdms = ol.coordinate.toStringHDMS(ol.proj.transform( coordinate, 'EPSG:3857', 'EPSG:4326'));
|
||||||
//$(element).popover('destroy');
|
//$(element).popover('destroy');
|
||||||
|
|||||||
BIN
src/main/webapp/resources/engine/images/icons/marker_p.png
Normal file
BIN
src/main/webapp/resources/engine/images/icons/marker_p.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@ -1712,6 +1712,98 @@ function callFrmLocustDelData()
|
|||||||
setTimeout(function() { g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40); }, 1000);
|
setTimeout(function() { g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40); }, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Call data for create markers
|
||||||
|
function callFrmCheckpoints(){
|
||||||
|
let input; let value;
|
||||||
|
|
||||||
|
let rData = {
|
||||||
|
country_id: null
|
||||||
|
};
|
||||||
|
value = $('#filter_checkpoint_country_id').val();
|
||||||
|
if(value!='') rData.country_id = parseInt(value);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '../get_checkpoints',
|
||||||
|
data: JSON.stringify(rData),
|
||||||
|
contentType: 'application/json; charset=utf-8',
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data,status){
|
||||||
|
if(status=='success')
|
||||||
|
{
|
||||||
|
if(data.errorCode=='0')
|
||||||
|
{
|
||||||
|
//updatePOILocustDel(data.data);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
alert2(trt('Error'),data.errorMessage);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
alert2(trt('Alert'),status);
|
||||||
|
}
|
||||||
|
hideProgressBar('FrmCheckpointData');
|
||||||
|
},
|
||||||
|
error: function(jqXHR, exception) {
|
||||||
|
alert2(trt('Alert'),jqXHR.responseText);
|
||||||
|
hideProgressBar('FrmCheckpointData');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
showProgressBar("FrmCheckpointData");
|
||||||
|
|
||||||
|
//Show legend
|
||||||
|
/*if(typeof g_WinLegend0 == "undefined" || g_WinLegend0==null || g_WinLegend0.closed)
|
||||||
|
{
|
||||||
|
g_WinLegend0=new TWin();
|
||||||
|
g_WinLegend0.BuildGUI(window.innerWidth-150,40);
|
||||||
|
}
|
||||||
|
g_WinLegend0.setCaption(trt('Legend'));
|
||||||
|
g_WinLegend0.setSize("145px","65px");
|
||||||
|
g_WinLegend0.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/flag.png" alt=""></td><td style="padding-left:10px;">'+trt('Spraying')+'</td></tr></table>');
|
||||||
|
g_WinLegend0.hide(false);
|
||||||
|
g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40);
|
||||||
|
setTimeout(function() { g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40); }, 1000);*/
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFrmCheckpoints(){
|
||||||
|
var input;
|
||||||
|
|
||||||
|
var country_id="";
|
||||||
|
|
||||||
|
input = document.getElementById('filter_checkpoint_country_id');
|
||||||
|
if(input!=null) country_id=input.value;
|
||||||
|
|
||||||
|
g_FrmCheckpoints = new SRec();
|
||||||
|
g_FrmCheckpoints.create(null);
|
||||||
|
g_FrmCheckpoints.f_TypeName="FrmCheckpoints";
|
||||||
|
|
||||||
|
g_FrmCheckpoints.f_Settings='\
|
||||||
|
<metadata><type n="FrmCheckpoints">\n\
|
||||||
|
<properties>\n\
|
||||||
|
<prop n="country_id">\n\
|
||||||
|
<![CDATA['+country_id+']]>\n\
|
||||||
|
<type n="Countries">\n\
|
||||||
|
<objects-list>\n\
|
||||||
|
<filter><column n="id"><![CDATA['+country_id+']]></column></filter>\n\
|
||||||
|
</objects-list>\n\
|
||||||
|
</type>\n\
|
||||||
|
</prop>\n\
|
||||||
|
</properties>\n\
|
||||||
|
<objects-list>\n\
|
||||||
|
<filter height="1">\n\
|
||||||
|
<column n="id"><![CDATA[]]></column>\n\
|
||||||
|
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||||||
|
</filter>\n\
|
||||||
|
</objects-list>\n\
|
||||||
|
</type></metadata>\n\
|
||||||
|
';
|
||||||
|
|
||||||
|
//g_FrmCheckpoints.win.setSize("400px","100px");
|
||||||
|
g_FrmCheckpoints.win.setHeight(500);
|
||||||
|
//g_FrmCheckpoints.win.setLeftTop(300,40);
|
||||||
|
g_FrmCheckpoints.win.setCenter();
|
||||||
|
g_FrmCheckpoints.request.callServer(ScriptName,'<metadata fn="0"><type n="FrmCheckpoints"></type></metadata>');
|
||||||
|
}
|
||||||
|
|
||||||
function openFrmLocustInfo()
|
function openFrmLocustInfo()
|
||||||
{
|
{
|
||||||
var input;
|
var input;
|
||||||
|
|||||||
Reference in New Issue
Block a user