Commit e96117ff031de15476ad07075cdde445a91779e8
1 parent
2ab5ad10
update...
Showing
3 changed files
with
12 additions
and
1 deletions
src/main/java/com/bsth/Application.java
| @@ -11,7 +11,7 @@ import java.util.concurrent.ScheduledExecutorService; | @@ -11,7 +11,7 @@ import java.util.concurrent.ScheduledExecutorService; | ||
| 11 | @SpringBootApplication | 11 | @SpringBootApplication |
| 12 | public class Application extends SpringBootServletInitializer { | 12 | public class Application extends SpringBootServletInitializer { |
| 13 | 13 | ||
| 14 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(7); | 14 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(8); |
| 15 | 15 | ||
| 16 | @Override | 16 | @Override |
| 17 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 17 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
src/main/java/com/bsth/StartCommand.java
| 1 | package com.bsth; | 1 | package com.bsth; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread; | ||
| 4 | import com.bsth.service.Line2SystemService; | 5 | import com.bsth.service.Line2SystemService; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.boot.CommandLineRunner; | 7 | import org.springframework.boot.CommandLineRunner; |
| 7 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| 8 | 9 | ||
| 10 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 11 | +import java.util.concurrent.TimeUnit; | ||
| 12 | + | ||
| 9 | 13 | ||
| 10 | /** | 14 | /** |
| 11 | * 随应用启动运行 | 15 | * 随应用启动运行 |
| @@ -18,6 +22,9 @@ public class StartCommand implements CommandLineRunner{ | @@ -18,6 +22,9 @@ public class StartCommand implements CommandLineRunner{ | ||
| 18 | @Autowired | 22 | @Autowired |
| 19 | Line2SystemService line2SystemService; | 23 | Line2SystemService line2SystemService; |
| 20 | 24 | ||
| 25 | + @Autowired | ||
| 26 | + RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread; | ||
| 27 | + | ||
| 21 | @Override | 28 | @Override |
| 22 | public void run(String... arg0){ | 29 | public void run(String... arg0){ |
| 23 | 30 | ||
| @@ -25,6 +32,9 @@ public class StartCommand implements CommandLineRunner{ | @@ -25,6 +32,9 @@ public class StartCommand implements CommandLineRunner{ | ||
| 25 | //将增量的线路load到对照清单 | 32 | //将增量的线路load到对照清单 |
| 26 | line2SystemService.loadByLineInfo(); | 33 | line2SystemService.loadByLineInfo(); |
| 27 | 34 | ||
| 35 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 36 | + //定时将人车卡数据入库 | ||
| 37 | + sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 5, TimeUnit.SECONDS); | ||
| 28 | //OldWSClient.returnCCInfo(); | 38 | //OldWSClient.returnCCInfo(); |
| 29 | //OldWSClient.getCurrentDayPlan(); | 39 | //OldWSClient.getCurrentDayPlan(); |
| 30 | } catch (Exception e) { | 40 | } catch (Exception e) { |
src/main/java/com/bsth/server_rs/thread/RfidCardInfoPersistenceThread.java
| @@ -37,6 +37,7 @@ public class RfidCardInfoPersistenceThread extends Thread{ | @@ -37,6 +37,7 @@ public class RfidCardInfoPersistenceThread extends Thread{ | ||
| 37 | try{ | 37 | try{ |
| 38 | personCardSave(); | 38 | personCardSave(); |
| 39 | carCardSave(); | 39 | carCardSave(); |
| 40 | + logger.info("RfidCardInfoPersistenceThread.."); | ||
| 40 | }catch (Exception e){ | 41 | }catch (Exception e){ |
| 41 | logger.error("", e); | 42 | logger.error("", e); |
| 42 | } | 43 | } |