Commit f97bb69baee45543836ae8b8dfe763c43ae044a8

Authored by 王通
1 parent 885583f2

1.

src/main/java/com/bsth/CXFConfig.java
@@ -20,6 +20,7 @@ import com.bsth.server_rs.exception.AesExceptionMapper; @@ -20,6 +20,7 @@ import com.bsth.server_rs.exception.AesExceptionMapper;
20 import com.bsth.server_rs.gps.GpsRestService; 20 import com.bsth.server_rs.gps.GpsRestService;
21 import com.bsth.server_rs.info_publish.XxfbRestService; 21 import com.bsth.server_rs.info_publish.XxfbRestService;
22 import com.bsth.server_rs.logs.RealLogRestService; 22 import com.bsth.server_rs.logs.RealLogRestService;
  23 +import com.bsth.server_rs.man_hours.ManHoursRestService;
23 import com.bsth.server_rs.rate.RateService; 24 import com.bsth.server_rs.rate.RateService;
24 import com.bsth.server_rs.schedule.plan.SchedulePlanService; 25 import com.bsth.server_rs.schedule.plan.SchedulePlanService;
25 import com.bsth.server_rs.schedule.real.ScheduleRealService; 26 import com.bsth.server_rs.schedule.real.ScheduleRealService;
@@ -135,6 +136,8 @@ public class CXFConfig { @@ -135,6 +136,8 @@ public class CXFConfig {
135 private DksRestService dksRestService; 136 private DksRestService dksRestService;
136 @Autowired 137 @Autowired
137 private XxfbRestService xxfbRestService; 138 private XxfbRestService xxfbRestService;
  139 + @Autowired
  140 + private ManHoursRestService manHoursRestService;
138 141
139 @Bean 142 @Bean
140 public Server rsServer() { 143 public Server rsServer() {
@@ -163,7 +166,8 @@ public class CXFConfig { @@ -163,7 +166,8 @@ public class CXFConfig {
163 carparkRestService, 166 carparkRestService,
164 departureRestService, 167 departureRestService,
165 dksRestService, 168 dksRestService,
166 - xxfbRestService)); 169 + xxfbRestService,
  170 + manHoursRestService));
167 endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); 171 endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper()));
168 //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); 172 //endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
169 endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); 173 endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN());
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.man_hours.ManHoursRefreshScheduler;
  7 +import com.bsth.server_rs.schedule.real.thread.ExecSchDataRefreshThread;
  8 +import com.bsth.server_rs.schedule.real.thread.SchInOutDataRefreshThread;
  9 +import com.bsth.server_rs.thread.RfidCardInfoPersistenceThread;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.boot.CommandLineRunner;
  12 +import org.springframework.stereotype.Component;
  13 +
  14 +import java.util.concurrent.ScheduledExecutorService;
  15 +import java.util.concurrent.TimeUnit;
  16 +
  17 +
  18 +/**
  19 + * 随应用启动运行
  20 + * @author PanZhao
  21 + *
  22 + */
  23 +@Component
  24 +public class StartCommand implements CommandLineRunner{
  25 +
  26 +
  27 + @Autowired
  28 + RfidCardInfoPersistenceThread rfidCardInfoPersistenceThread;
  29 + @Autowired
  30 + SchInOutDataRefreshThread schInOutDataRefreshThread;
  31 + @Autowired
  32 + ExecSchDataRefreshThread execSchDataRefreshThread;
  33 + @Autowired
  34 + GpsRefreshThread gpsRefreshThread;
  35 + @Autowired
  36 + BasicDataRefreshThread basicDataRefreshThread;
  37 + @Autowired
  38 + ManHoursRefreshScheduler manHoursRefreshScheduler;
  39 +
  40 + @Override
  41 + public void run(String... arg0){
  42 +
  43 + try {
  44 + ScheduledExecutorService sexec = Application.mainServices;
  45 + //定时将人车卡数据入库
  46 + sexec.scheduleWithFixedDelay(rfidCardInfoPersistenceThread, 120, 60 * 10, TimeUnit.SECONDS);
  47 + //定时从调度系统刷新进出场数据
  48 + sexec.scheduleWithFixedDelay(schInOutDataRefreshThread, 40, 60, TimeUnit.SECONDS);
  49 + //定时从调度系统刷新车辆正在的执行班次
  50 + sexec.scheduleWithFixedDelay(execSchDataRefreshThread, 20, 60, TimeUnit.SECONDS);
  51 + //定时刷新实时gps缓存
  52 + Application.mainServices.scheduleWithFixedDelay(gpsRefreshThread, 10, 7, TimeUnit.SECONDS);
  53 + //定时刷新基础信息
  54 + Application.mainServices.scheduleWithFixedDelay(basicDataRefreshThread, 30, 30, TimeUnit.MINUTES);
  55 + manHoursRefreshScheduler.refresh();
  56 + } catch (Exception e) {
  57 + e.printStackTrace();
  58 + }
  59 + }
  60 +}