Commit 9dd13cb77655e99c7cc27bfe301d9c069515ec31
1 parent
cc5e7cda
1.
Showing
1 changed file
with
57 additions
and
57 deletions
src/main/java/com/bsth/StartCommand.java
| 1 | -package com.bsth; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.server_rs.gps.buffer.BasicDataRefreshThread; | |
| 5 | -import com.bsth.server_rs.gps.buffer.GpsRefreshThread; | |
| 6 | -import com.bsth.server_rs.schedule.real.thread.ExecSchDataRefreshThread; | |
| 7 | -import com.bsth.server_rs.schedule.real.thread.SchInOutDataRefreshThread; | |
| 8 | -import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread; | |
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | -import org.springframework.boot.CommandLineRunner; | |
| 11 | -import org.springframework.stereotype.Component; | |
| 12 | - | |
| 13 | -import java.util.concurrent.ScheduledExecutorService; | |
| 14 | -import java.util.concurrent.TimeUnit; | |
| 15 | - | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 随应用启动运行 | |
| 19 | - * @author PanZhao | |
| 20 | - * | |
| 21 | - */ | |
| 22 | -@Component | |
| 23 | -public class StartCommand implements CommandLineRunner{ | |
| 24 | - | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread; | |
| 28 | - @Autowired | |
| 29 | - SchInOutDataRefreshThread schInOutDataRefreshThread; | |
| 30 | - @Autowired | |
| 31 | - ExecSchDataRefreshThread execSchDataRefreshThread; | |
| 32 | - @Autowired | |
| 33 | - GpsRefreshThread gpsRefreshThread; | |
| 34 | - @Autowired | |
| 35 | - BasicDataRefreshThread basicDataRefreshThread; | |
| 36 | - | |
| 37 | - @Override | |
| 38 | - public void run(String... arg0){ | |
| 39 | - | |
| 40 | - try { | |
| 41 | - ScheduledExecutorService sexec = Application.mainServices; | |
| 42 | - //定时将人车卡数据入库 | |
| 43 | - sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 10, TimeUnit.SECONDS); | |
| 44 | - //定时从调度系统刷新进出场数据 | |
| 45 | - sexec.scheduleWithFixedDelay(schInOutDataRefreshThread, 40, 60, TimeUnit.SECONDS); | |
| 46 | - //定时从调度系统刷新车辆正在的执行班次 | |
| 47 | - sexec.scheduleWithFixedDelay(execSchDataRefreshThread, 20, 60, TimeUnit.SECONDS); | |
| 48 | - //定时刷新实时gps缓存 | |
| 49 | - Application.mainServices.scheduleWithFixedDelay(gpsRefreshThread, 10, 7, TimeUnit.SECONDS); | |
| 50 | - //定时刷新基础信息 | |
| 51 | - Application.mainServices.scheduleWithFixedDelay(basicDataRefreshThread, 30, 30, TimeUnit.MINUTES); | |
| 52 | - | |
| 53 | - } catch (Exception e) { | |
| 54 | - e.printStackTrace(); | |
| 55 | - } | |
| 56 | - } | |
| 57 | -} | |
| 1 | +package com.bsth; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.bsth.server_rs.gps.buffer.BasicDataRefreshThread; | |
| 5 | +import com.bsth.server_rs.gps.buffer.GpsRefreshThread; | |
| 6 | +import com.bsth.server_rs.schedule.real.thread.ExecSchDataRefreshThread; | |
| 7 | +import com.bsth.server_rs.schedule.real.thread.SchInOutDataRefreshThread; | |
| 8 | +import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.boot.CommandLineRunner; | |
| 11 | +import org.springframework.stereotype.Component; | |
| 12 | + | |
| 13 | +import java.util.concurrent.ScheduledExecutorService; | |
| 14 | +import java.util.concurrent.TimeUnit; | |
| 15 | + | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 随应用启动运行 | |
| 19 | + * @author PanZhao | |
| 20 | + * | |
| 21 | + */ | |
| 22 | +@Component | |
| 23 | +public class StartCommand implements CommandLineRunner{ | |
| 24 | + | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread; | |
| 28 | + @Autowired | |
| 29 | + SchInOutDataRefreshThread schInOutDataRefreshThread; | |
| 30 | + @Autowired | |
| 31 | + ExecSchDataRefreshThread execSchDataRefreshThread; | |
| 32 | + //@Autowired | |
| 33 | + //GpsRefreshThread gpsRefreshThread; | |
| 34 | + @Autowired | |
| 35 | + BasicDataRefreshThread basicDataRefreshThread; | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public void run(String... arg0){ | |
| 39 | + | |
| 40 | + try { | |
| 41 | + ScheduledExecutorService sexec = Application.mainServices; | |
| 42 | + //定时将人车卡数据入库 | |
| 43 | + sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 10, TimeUnit.SECONDS); | |
| 44 | + //定时从调度系统刷新进出场数据 | |
| 45 | + sexec.scheduleWithFixedDelay(schInOutDataRefreshThread, 40, 60, TimeUnit.SECONDS); | |
| 46 | + //定时从调度系统刷新车辆正在的执行班次 | |
| 47 | + sexec.scheduleWithFixedDelay(execSchDataRefreshThread, 20, 60, TimeUnit.SECONDS); | |
| 48 | + //定时刷新实时gps缓存 | |
| 49 | + //Application.mainServices.scheduleWithFixedDelay(gpsRefreshThread, 10, 7, TimeUnit.SECONDS); | |
| 50 | + //定时刷新基础信息 | |
| 51 | + Application.mainServices.scheduleWithFixedDelay(basicDataRefreshThread, 30, 30, TimeUnit.MINUTES); | |
| 52 | + | |
| 53 | + } catch (Exception e) { | |
| 54 | + e.printStackTrace(); | |
| 55 | + } | |
| 56 | + } | |
| 57 | +} | ... | ... |