| | |
| | | status = liveLocationService.save(liveLocation); |
| | | //数据推送 |
| | | String s1 = |
| | | "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time,location) " + |
| | | "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time) " + |
| | | "values(" + "'" + liveLocation.getId() + "'" + "," + |
| | | "'" + liveLocation.getType() + "'" + "," + |
| | | "'" + liveLocation.getWorkerId() + "'" + "," + |
| | |
| | | */ |
| | | @Scheduled(cron = "0 0 * * * ?") |
| | | public void Peog() throws Exception { |
| | | System.out.println("押运人员"); |
| | | String url = "http://47.104.104.46/api/client/getgistrack.php"; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 1); |
| | |
| | | JSONArray jsonArray = JSONArray.fromObject(a); |
| | | String s1 = ""; |
| | | String track = jsonArray.getJSONObject(0).get("track").toString(); |
| | | JSONArray jsonArray1 = JSONArray.fromObject(track); |
| | | for (int j = 0; j < jsonArray1.size(); j++) { |
| | | String gis_jd = jsonArray1.getJSONObject(j).get("gis_jd").toString(); |
| | | String gis_wd = jsonArray1.getJSONObject(j).get("gis_wd").toString(); |
| | | String date = jsonArray1.getJSONObject(j).get("date").toString(); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | //使用SimpleDateFormat的parse()方法生成Date |
| | | Date dates = sf.parse(date); |
| | | locus.setRecordTime(dates); |
| | | //打印Date |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | locus.setLongitude(gis_jd); |
| | | locus.setLatitude(gis_wd); |
| | | locusService.save(locus); |
| | | //数据推送 |
| | | s1 += "insert into sys_locus(id,type,worker_id,longitude,latitude,record_time) values" + |
| | | " (" + "'" + locus.getId() + "'" + "," + |
| | | "'" + locus.getType() + "'" + "," + |
| | | "'" + locus.getWorkerId() + "'" + "," + |
| | | "'" + locus.getLongitude() + "'" + "," + |
| | | "'" + locus.getLatitude() + "'" + "," + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(locus.getRecordTime()) + "'" + ")"; |
| | | if (j != jsonArray1.size() - 1) { |
| | | s1 += ";"; |
| | | } |
| | | if (track.equals("[]")){ |
| | | System.out.println("数据为空"); |
| | | } |
| | | FtpUtil.sqlFileUpload(s1); |
| | | else { |
| | | JSONArray jsonArray1 = JSONArray.fromObject(track); |
| | | for (int j = 0; j < jsonArray1.size(); j++) { |
| | | String gis_jd = jsonArray1.getJSONObject(j).get("gis_jd").toString(); |
| | | String gis_wd = jsonArray1.getJSONObject(j).get("gis_wd").toString(); |
| | | String date = jsonArray1.getJSONObject(j).get("date").toString(); |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | //使用SimpleDateFormat的parse()方法生成Date |
| | | Date dates = sf.parse(date); |
| | | locus.setRecordTime(dates); |
| | | //打印Date |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | locus.setLongitude(gis_jd); |
| | | locus.setLatitude(gis_wd); |
| | | locusService.save(locus); |
| | | //数据推送 |
| | | s1 += "insert into sys_locus(id,type,worker_id,longitude,latitude,record_time) values" + |
| | | " (" + "'" + locus.getId() + "'" + "," + |
| | | "'" + locus.getType() + "'" + "," + |
| | | "'" + locus.getWorkerId() + "'" + "," + |
| | | "'" + locus.getLongitude() + "'" + "," + |
| | | "'" + locus.getLatitude() + "'" + "," + |
| | | "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(locus.getRecordTime()) + "'" + ")"; |
| | | if (j != jsonArray1.size() - 1) { |
| | | s1 += ";"; |
| | | } |
| | | } |
| | | FtpUtil.sqlFileUpload(s1); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | status = liveLocationService.save(liveLocation); |
| | | //数据推送 |
| | | String s1 = |
| | | "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time,location) " + |
| | | "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time) " + |
| | | "values(" + "'" + liveLocation.getId() + "'" + "," + |
| | | "'" + liveLocation.getType() + "'" + "," + |
| | | "'" + liveLocation.getWorkerId() + "'" + "," + |
| | |
| | | */ |
| | | @Scheduled(cron = "0 0 * * * ?") |
| | | public void locationhistoryTrack() { |
| | | System.out.println("车辆轨迹"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | /* HOUR_OF_DAY 指示一天中的小时 */ |
| | | calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 1); |