Commit 7673d3a5f6d5ab07407f952fc16f3da1e1e7f6b4
1 parent
bbf95631
闵行18路测试用部分代码调整
Showing
5 changed files
with
14 additions
and
9 deletions
src/main/java/com/bsth/XDApplication.java
| @@ -127,7 +127,7 @@ public class XDApplication implements CommandLineRunner { | @@ -127,7 +127,7 @@ public class XDApplication implements CommandLineRunner { | ||
| 127 | log.info("devInit..."); | 127 | log.info("devInit..."); |
| 128 | ScheduledExecutorService sexec = Application.mainServices; | 128 | ScheduledExecutorService sexec = Application.mainServices; |
| 129 | //抓取GPS数据 | 129 | //抓取GPS数据 |
| 130 | - gpsDataLoader.setFlag(-1); | 130 | + GpsDataLoaderThread.setFlag(-1); |
| 131 | //dayOfSchedule.dataRecovery(); | 131 | //dayOfSchedule.dataRecovery(); |
| 132 | //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS); | 132 | //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS); |
| 133 | //实际排班更新线程 | 133 | //实际排班更新线程 |
| @@ -160,8 +160,8 @@ public class XDApplication implements CommandLineRunner { | @@ -160,8 +160,8 @@ public class XDApplication implements CommandLineRunner { | ||
| 160 | 160 | ||
| 161 | /** 线调业务 */ | 161 | /** 线调业务 */ |
| 162 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | 162 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
| 163 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点 | ||
| 164 | - gpsDataLoader.setFlag(-1); | 163 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 |
| 164 | + GpsDataLoaderThread.setFlag(-1); | ||
| 165 | sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 | 165 | sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 |
| 166 | sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | 166 | sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 |
| 167 | 167 |
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
| @@ -41,7 +41,7 @@ public class DataHandleProcess { | @@ -41,7 +41,7 @@ public class DataHandleProcess { | ||
| 41 | 41 | ||
| 42 | static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); | 42 | static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); |
| 43 | 43 | ||
| 44 | - final static int POOL_SIZE = 8; | 44 | + final static int POOL_SIZE = 20; |
| 45 | 45 | ||
| 46 | static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); | 46 | static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); |
| 47 | public static CountDownLatch count; | 47 | public static CountDownLatch count; |
src/main/java/com/bsth/data/gpsdata_v2/thread/GpsDataLoaderThread.java
| @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata_v2.thread; | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata_v2.thread; | ||
| 3 | import com.bsth.data.gpsdata_v2.DataHandleProcess; | 3 | import com.bsth.data.gpsdata_v2.DataHandleProcess; |
| 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; | 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 5 | import com.bsth.data.gpsdata_v2.load.GatewayHttpLoader; | 5 | import com.bsth.data.gpsdata_v2.load.GatewayHttpLoader; |
| 6 | +import com.bsth.data.gpsdata_v2.load.SocketClientLoader; | ||
| 6 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -31,13 +32,13 @@ public class GpsDataLoaderThread extends Thread { | @@ -31,13 +32,13 @@ public class GpsDataLoaderThread extends Thread { | ||
| 31 | @Override | 32 | @Override |
| 32 | public void run() { | 33 | public void run() { |
| 33 | try { | 34 | try { |
| 34 | - List<GpsEntity> list = GatewayHttpLoader.load(); | ||
| 35 | - /*if (flag == 0) | 35 | + List<GpsEntity> list; |
| 36 | + if (flag == 0) | ||
| 36 | list = SocketClientLoader.load(); | 37 | list = SocketClientLoader.load(); |
| 37 | else | 38 | else |
| 38 | - list = GatewayHttpLoader.load();*/ | 39 | + list = GatewayHttpLoader.load(); |
| 39 | 40 | ||
| 40 | - if (null != list && list.size() > 0) | 41 | + if(null != list && list.size() > 0) |
| 41 | handleProcess.handle(list); | 42 | handleProcess.handle(list); |
| 42 | } catch (Exception e) { | 43 | } catch (Exception e) { |
| 43 | logger.error("", e); | 44 | logger.error("", e); |
src/main/java/com/bsth/data/gpsdata_v2/utils/GeoUtils.java
| @@ -397,5 +397,9 @@ public class GeoUtils { | @@ -397,5 +397,9 @@ public class GeoUtils { | ||
| 397 | return true; | 397 | return true; |
| 398 | } | 398 | } |
| 399 | } | 399 | } |
| 400 | + | ||
| 401 | + public static void main(String args[]) { | ||
| 402 | + System.out.println(getDistance(new Point(121.52079, 31.189495), new Point(121.519981, 31.189695))); | ||
| 403 | + } | ||
| 400 | 404 | ||
| 401 | } | 405 | } |
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
| @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 84 | Calendar calendar = Calendar.getInstance(); | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | ||
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=39"; //+ dayOfYear; | 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info"; //+ dayOfYear; |
| 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | ||
| 90 | List<GpsEntity> list = | 90 | List<GpsEntity> list = |