Commit edfbda52003148decce6bd421bda331d94daee65

Authored by 王通
1 parent 4144c46d

1.

src/main/java/com/bsth/CXFConfig.java
... ... @@ -19,6 +19,7 @@ import com.bsth.server_rs.electric.ElectricService;
19 19 import com.bsth.server_rs.exception.AesExceptionMapper;
20 20 import com.bsth.server_rs.gps.GpsRestService;
21 21 import com.bsth.server_rs.logs.RealLogRestService;
  22 +import com.bsth.server_rs.man_hours.ManHoursRestService;
22 23 import com.bsth.server_rs.rate.RateService;
23 24 import com.bsth.server_rs.schedule.plan.SchedulePlanService;
24 25 import com.bsth.server_rs.schedule.real.ScheduleRealService;
... ... @@ -135,6 +136,8 @@ public class CXFConfig {
135 136 private DksRestService dksRestService;
136 137 @Autowired
137 138 private WhiteIpRestService whiteIpRestService;
  139 + @Autowired
  140 + private ManHoursRestService manHoursRestService;
138 141  
139 142 @Bean
140 143 public Server rsServer() {
... ... @@ -163,7 +166,8 @@ public class CXFConfig {
163 166 carparkRestService,
164 167 departureRestService,
165 168 dksRestService,
166   - whiteIpRestService));
  169 + whiteIpRestService,
  170 + manHoursRestService));
167 171 endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper()));
168 172 //endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
169 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 +}
... ...