Commit d3a02a96d55c722e04ebf4a8862690eeef511d3a
Merge branch 'minhang' into qingpu
# Conflicts: # src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java # src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java # src/main/resources/application-dev.properties # src/main/resources/static/index.html # src/main/resources/static/real_control_v2/css/line_schedule.css # src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json # src/main/resources/static/real_control_v2/js/main.js # src/main/resources/static/real_control_v2/main.html
Showing
70 changed files
with
2294 additions
and
771 deletions
Too many changes to show.
To preserve performance only 70 of 2345 files are displayed.
.gitignore
| @@ -8,9 +8,11 @@ test_junitReport/ | @@ -8,9 +8,11 @@ test_junitReport/ | ||
| 8 | test_coverage/ | 8 | test_coverage/ |
| 9 | .idea | 9 | .idea |
| 10 | .DS_Store | 10 | .DS_Store |
| 11 | +npm-debug.log | ||
| 11 | *.iml | 12 | *.iml |
| 12 | tmp | 13 | tmp |
| 14 | +E:/ | ||
| 13 | 15 | ||
| 14 | # git忽略空文件夹,按照惯例,空文件夹下放置.gitkeep文件避免文件夹被忽略不上传。 | 16 | # git忽略空文件夹,按照惯例,空文件夹下放置.gitkeep文件避免文件夹被忽略不上传。 |
| 15 | -!.gitkeep | ||
| 16 | -/target/ | 17 | +!.gitkeep |
| 18 | +/target/ |
pom.xml
| @@ -24,7 +24,12 @@ | @@ -24,7 +24,12 @@ | ||
| 24 | <artifactId>spring-boot-starter-tomcat</artifactId> | 24 | <artifactId>spring-boot-starter-tomcat</artifactId> |
| 25 | <scope>provided</scope> | 25 | <scope>provided</scope> |
| 26 | </dependency> | 26 | </dependency> |
| 27 | - | 27 | + <dependency> |
| 28 | + <groupId>javax.servlet</groupId> | ||
| 29 | + <artifactId>javax.servlet-api</artifactId> | ||
| 30 | + <version>3.1.0</version> | ||
| 31 | + <scope>provided</scope> | ||
| 32 | + </dependency> | ||
| 28 | <dependency> | 33 | <dependency> |
| 29 | <groupId>org.springframework.boot</groupId> | 34 | <groupId>org.springframework.boot</groupId> |
| 30 | <artifactId>spring-boot-starter-security</artifactId> | 35 | <artifactId>spring-boot-starter-security</artifactId> |
| @@ -101,11 +106,11 @@ | @@ -101,11 +106,11 @@ | ||
| 101 | <artifactId>janino</artifactId> | 106 | <artifactId>janino</artifactId> |
| 102 | </dependency> | 107 | </dependency> |
| 103 | 108 | ||
| 104 | - <dependency> | ||
| 105 | - <groupId>org.apache.poi</groupId> | ||
| 106 | - <artifactId>poi</artifactId> | ||
| 107 | - <version>3.13</version> | ||
| 108 | - </dependency> | 109 | + <dependency> |
| 110 | + <groupId>org.apache.poi</groupId> | ||
| 111 | + <artifactId>poi-ooxml</artifactId> | ||
| 112 | + <version>3.13</version> | ||
| 113 | + </dependency> | ||
| 109 | 114 | ||
| 110 | <dependency> | 115 | <dependency> |
| 111 | <groupId>com.google.guava</groupId> | 116 | <groupId>com.google.guava</groupId> |
| @@ -229,6 +234,23 @@ | @@ -229,6 +234,23 @@ | ||
| 229 | <version>1.1</version> | 234 | <version>1.1</version> |
| 230 | </dependency> | 235 | </dependency> |
| 231 | 236 | ||
| 237 | + <dependency> | ||
| 238 | + <groupId>org.apache.axis2</groupId> | ||
| 239 | + <artifactId>axis2-adb</artifactId> | ||
| 240 | + <version>1.7.4</version> | ||
| 241 | + </dependency> | ||
| 242 | + <dependency> | ||
| 243 | + <groupId>org.apache.axis2</groupId> | ||
| 244 | + <artifactId>axis2-transport-local</artifactId> | ||
| 245 | + <version>1.7.4</version> | ||
| 246 | + </dependency> | ||
| 247 | + <dependency> | ||
| 248 | + <groupId>org.apache.axis2</groupId> | ||
| 249 | + <artifactId>axis2-transport-http</artifactId> | ||
| 250 | + <version>1.7.4</version> | ||
| 251 | + </dependency> | ||
| 252 | + | ||
| 253 | + | ||
| 232 | <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> | 254 | <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> |
| 233 | <optional>true</optional> </dependency> --> | 255 | <optional>true</optional> </dependency> --> |
| 234 | <dependency> | 256 | <dependency> |
| @@ -264,6 +286,24 @@ | @@ -264,6 +286,24 @@ | ||
| 264 | <artifactId>ojdbc</artifactId> | 286 | <artifactId>ojdbc</artifactId> |
| 265 | <version>14</version> | 287 | <version>14</version> |
| 266 | </dependency> | 288 | </dependency> |
| 289 | + | ||
| 290 | + <dependency> | ||
| 291 | + <groupId>org.apache.mina</groupId> | ||
| 292 | + <artifactId>mina-core</artifactId> | ||
| 293 | + <version>2.0.13</version> | ||
| 294 | + </dependency> | ||
| 295 | + | ||
| 296 | + <dependency> | ||
| 297 | + <groupId>com.google.protobuf</groupId> | ||
| 298 | + <artifactId>protobuf-java</artifactId> | ||
| 299 | + <version>3.3.0</version> | ||
| 300 | + </dependency> | ||
| 301 | + | ||
| 302 | + <dependency> | ||
| 303 | + <groupId>com.github.stuxuhai</groupId> | ||
| 304 | + <artifactId>jpinyin</artifactId> | ||
| 305 | + <version>1.1.8</version> | ||
| 306 | + </dependency> | ||
| 267 | </dependencies> | 307 | </dependencies> |
| 268 | 308 | ||
| 269 | <dependencyManagement> | 309 | <dependencyManagement> |
src/main/java/com/bsth/Application.java
| @@ -8,14 +8,16 @@ import org.springframework.boot.builder.SpringApplicationBuilder; | @@ -8,14 +8,16 @@ import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 8 | import org.springframework.boot.context.web.SpringBootServletInitializer; | 8 | import org.springframework.boot.context.web.SpringBootServletInitializer; |
| 9 | import org.springframework.context.annotation.Bean; | 9 | import org.springframework.context.annotation.Bean; |
| 10 | import org.springframework.context.annotation.Primary; | 10 | import org.springframework.context.annotation.Primary; |
| 11 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
| 11 | 12 | ||
| 12 | import java.util.concurrent.Executors; | 13 | import java.util.concurrent.Executors; |
| 13 | import java.util.concurrent.ScheduledExecutorService; | 14 | import java.util.concurrent.ScheduledExecutorService; |
| 14 | 15 | ||
| 16 | +@EnableTransactionManagement | ||
| 15 | @SpringBootApplication | 17 | @SpringBootApplication |
| 16 | public class Application extends SpringBootServletInitializer { | 18 | public class Application extends SpringBootServletInitializer { |
| 17 | 19 | ||
| 18 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(13); | 20 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(15); |
| 19 | 21 | ||
| 20 | @Override | 22 | @Override |
| 21 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | 23 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { |
src/main/java/com/bsth/ServiceStateTest.java deleted
100644 → 0
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | -public class ServiceStateTest { | ||
| 4 | - | ||
| 5 | - public static void main(String[] args) { | ||
| 6 | - System.out.println("运营状态:" + getService(603979776)); | ||
| 7 | - System.out.println("上下行:" + getUpOrDown(603979776)); | ||
| 8 | - } | ||
| 9 | - | ||
| 10 | - /** | ||
| 11 | - * 获取运营状态 | ||
| 12 | - * | ||
| 13 | - * @return -1无效 0运营 1未运营 | ||
| 14 | - */ | ||
| 15 | - public static byte getService(long serviceState) { | ||
| 16 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | ||
| 17 | - return -1; | ||
| 18 | - return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * 王通 2016/6/29 9:23:24 获取车辆线路上下行 | ||
| 23 | - * | ||
| 24 | - * @return -1无效 0上行 1下行 | ||
| 25 | - */ | ||
| 26 | - public static byte getUpOrDown(long serviceState) { | ||
| 27 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000 | ||
| 28 | - || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000) | ||
| 29 | - return -1; | ||
| 30 | - return (byte) (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0); | ||
| 31 | - } | ||
| 32 | -} |
src/main/java/com/bsth/WebAppConfiguration.java
| 1 | package com.bsth; | 1 | package com.bsth; |
| 2 | 2 | ||
| 3 | -import javax.servlet.Filter; | ||
| 4 | - | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | 3 | +import com.bsth.filter.ResourceFilter; |
| 4 | +import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 5 | +import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 6 | import org.springframework.boot.context.embedded.FilterRegistrationBean; | 8 | import org.springframework.boot.context.embedded.FilterRegistrationBean; |
| 7 | import org.springframework.context.annotation.Bean; | 9 | import org.springframework.context.annotation.Bean; |
| 8 | import org.springframework.context.annotation.ComponentScan; | 10 | import org.springframework.context.annotation.ComponentScan; |
| 9 | import org.springframework.context.annotation.Configuration; | 11 | import org.springframework.context.annotation.Configuration; |
| 10 | import org.springframework.web.filter.CharacterEncodingFilter; | 12 | import org.springframework.web.filter.CharacterEncodingFilter; |
| 11 | import org.springframework.web.filter.HttpPutFormContentFilter; | 13 | import org.springframework.web.filter.HttpPutFormContentFilter; |
| 12 | -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
| 13 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | 14 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
| 14 | import org.springframework.web.socket.config.annotation.EnableWebSocket; | 15 | import org.springframework.web.socket.config.annotation.EnableWebSocket; |
| 15 | import org.springframework.web.socket.config.annotation.WebSocketConfigurer; | 16 | import org.springframework.web.socket.config.annotation.WebSocketConfigurer; |
| 16 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; | 17 | import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; |
| 18 | +import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean; | ||
| 17 | 19 | ||
| 18 | -import com.bsth.filter.ResourceFilter; | ||
| 19 | -import com.bsth.oplog.http.HttpOpLogInterceptor; | ||
| 20 | -import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 21 | -import com.bsth.websocket.handler.RealControlSocketHandler; | 20 | +import javax.servlet.Filter; |
| 22 | 21 | ||
| 23 | @Configuration | 22 | @Configuration |
| 24 | @EnableWebSocket | 23 | @EnableWebSocket |
| @@ -27,6 +26,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | @@ -27,6 +26,8 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | ||
| 27 | 26 | ||
| 28 | // @Autowired | 27 | // @Autowired |
| 29 | // HttpOpLogInterceptor httpOpLogInterceptor; | 28 | // HttpOpLogInterceptor httpOpLogInterceptor; |
| 29 | + | ||
| 30 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * @Title: httpPutFormContentFilter | 33 | * @Title: httpPutFormContentFilter |
| @@ -75,4 +76,17 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | @@ -75,4 +76,17 @@ public class WebAppConfiguration extends WebMvcConfigurerAdapter implements WebS | ||
| 75 | registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) | 76 | registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) |
| 76 | .withSockJS(); | 77 | .withSockJS(); |
| 77 | } | 78 | } |
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 增加websocket的输出缓冲区 | ||
| 82 | + * @return | ||
| 83 | + */ | ||
| 84 | + @Bean | ||
| 85 | + public ServletServerContainerFactoryBean createServletServerContainerFactoryBean() { | ||
| 86 | + ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean(); | ||
| 87 | + container.setMaxTextMessageBufferSize(52768); | ||
| 88 | + container.setMaxBinaryMessageBufferSize(52768); | ||
| 89 | + logger.info("Websocket factory returned"); | ||
| 90 | + return container; | ||
| 91 | + } | ||
| 78 | } | 92 | } |
src/main/java/com/bsth/XDApplication.java
0 → 100644
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.ThreadMonotor; | ||
| 5 | +import com.bsth.data.car_out_info.UpdateDBThread; | ||
| 6 | +import com.bsth.data.directive.DirectivesPstThread; | ||
| 7 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | ||
| 8 | +import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | ||
| 9 | +import com.bsth.data.schedule.edit_logs.SeiPstThread; | ||
| 10 | +import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | ||
| 11 | +import com.bsth.data.schedule.thread.CalcOilThread; | ||
| 12 | +import com.bsth.data.schedule.thread.SchedulePstThread; | ||
| 13 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | ||
| 14 | +import com.bsth.data.schedule.thread.SubmitToTrafficManage; | ||
| 15 | +import com.bsth.util.DateUtils; | ||
| 16 | +import com.bsth.util.Tools; | ||
| 17 | +import org.slf4j.Logger; | ||
| 18 | +import org.slf4j.LoggerFactory; | ||
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 20 | +import org.springframework.boot.CommandLineRunner; | ||
| 21 | +import org.springframework.stereotype.Component; | ||
| 22 | + | ||
| 23 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 24 | +import java.util.concurrent.TimeUnit; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 线调大部分服务都在这里启动 | ||
| 28 | + * Created by panzhao on 2017/5/14. | ||
| 29 | + */ | ||
| 30 | +@Component | ||
| 31 | +public class XDApplication implements CommandLineRunner { | ||
| 32 | + | ||
| 33 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + BasicData.BasicDataLoader basicDataLoader; | ||
| 37 | + @Autowired | ||
| 38 | + UpdateDBThread fcxxUpdateThread; | ||
| 39 | + @Autowired | ||
| 40 | + GpsDataLoaderThread gpsDataLoader; | ||
| 41 | + @Autowired | ||
| 42 | + OfflineMonitorThread offlineMonitorThread; | ||
| 43 | + @Autowired | ||
| 44 | + ScheduleRefreshThread scheduleRefreshThread; | ||
| 45 | + @Autowired | ||
| 46 | + SchedulePstThread schedulePstThread; | ||
| 47 | + @Autowired | ||
| 48 | + ScheduleLateThread scheduleLateThread; | ||
| 49 | + @Autowired | ||
| 50 | + SubmitToTrafficManage submitToTrafficManage; | ||
| 51 | + @Autowired | ||
| 52 | + CalcOilThread calcOilThread; | ||
| 53 | + @Autowired | ||
| 54 | + DirectivesPstThread directivesPstThread; | ||
| 55 | + @Autowired | ||
| 56 | + ThreadMonotor threadMonotor; | ||
| 57 | + @Autowired | ||
| 58 | + SeiPstThread seiPstThread; | ||
| 59 | + | ||
| 60 | + private static long timeDiff; | ||
| 61 | + private static long timeDiffTraffic; | ||
| 62 | + | ||
| 63 | + static { | ||
| 64 | + // 早上2:20 | ||
| 65 | + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | ||
| 66 | + if (timeDiff < 0) | ||
| 67 | + timeDiff += (1000 * 60 * 60 * 24); | ||
| 68 | + // 早上07:00 | ||
| 69 | + timeDiffTraffic = (DateUtils.getTimestamp() + 1000 * 60 * 60 * 7) - System.currentTimeMillis(); | ||
| 70 | + if (timeDiffTraffic < 0) | ||
| 71 | + timeDiffTraffic += (1000 * 60 * 60 * 24); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public void run(String... strings) throws Exception { | ||
| 76 | + try { | ||
| 77 | + Tools tools = new Tools("application.properties"); | ||
| 78 | + String environment = tools.getValue("spring.profiles.active"); | ||
| 79 | + //预先加载基础的对照数据 | ||
| 80 | + basicDataLoader.loadAllData(); | ||
| 81 | + switch (environment){ | ||
| 82 | + case "dev": | ||
| 83 | + devInit(); | ||
| 84 | + break; | ||
| 85 | + case "prod": | ||
| 86 | + prodInit(); | ||
| 87 | + break; | ||
| 88 | + } | ||
| 89 | + }catch (Exception e){ | ||
| 90 | + log.error("线调后台启动出现异常!!", e); | ||
| 91 | + System.exit(1); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + //@Autowired | ||
| 96 | + //DayOfSchedule dayOfSchedule; | ||
| 97 | + public void devInit(){ | ||
| 98 | + log.info("devInit..."); | ||
| 99 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 100 | + //抓取GPS数据 | ||
| 101 | + gpsDataLoader.setFlag(-1); | ||
| 102 | + //dayOfSchedule.dataRecovery(); | ||
| 103 | + //sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | ||
| 104 | + //实际排班更新线程 | ||
| 105 | + //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | ||
| 106 | + //实际排班延迟入库线程 | ||
| 107 | + //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS); | ||
| 108 | + //班次修正日志延迟入库 | ||
| 109 | + //sexec.scheduleWithFixedDelay(seiPstThread, 60, 30, TimeUnit.SECONDS); | ||
| 110 | + //调度指令延迟入库 | ||
| 111 | + //sexec.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); | ||
| 112 | + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 113 | + //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void prodInit(){ | ||
| 117 | + log.info("prodInit..."); | ||
| 118 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 119 | + //发车信息 | ||
| 120 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 60, 40, TimeUnit.SECONDS); | ||
| 121 | + //抓取GPS数据 | ||
| 122 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 30, 2, TimeUnit.SECONDS); | ||
| 123 | + //GPS设备掉离线 | ||
| 124 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | ||
| 125 | + //班次更新线程 | ||
| 126 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | ||
| 127 | + //班次延迟入库线程 | ||
| 128 | + sexec.scheduleWithFixedDelay(schedulePstThread, 60, 10, TimeUnit.SECONDS); | ||
| 129 | + //班次修正日志入库 | ||
| 130 | + sexec.scheduleWithFixedDelay(seiPstThread, 60, 60, TimeUnit.SECONDS); | ||
| 131 | + //检查班次误点 | ||
| 132 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | ||
| 133 | + //调度指令延迟入库 | ||
| 134 | + sexec.scheduleWithFixedDelay(directivesPstThread, 180, 100, TimeUnit.SECONDS); | ||
| 135 | + | ||
| 136 | + //运管处静态数据提交 | ||
| 137 | + log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 138 | + sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 139 | + //计算油、公里加注 | ||
| 140 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 141 | + | ||
| 142 | + //线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 143 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS); | ||
| 144 | + } | ||
| 145 | +} |
src/main/java/com/bsth/controller/CarParkController.java
| @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*; | @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*; | ||
| 15 | @RestController | 15 | @RestController |
| 16 | @RequestMapping("carpark") | 16 | @RequestMapping("carpark") |
| 17 | public class CarParkController extends BaseController<CarPark, Integer> { | 17 | public class CarParkController extends BaseController<CarPark, Integer> { |
| 18 | - | ||
| 19 | @Autowired | 18 | @Autowired |
| 20 | CarParkService service; | 19 | CarParkService service; |
| 21 | 20 | ||
| @@ -26,16 +25,10 @@ public class CarParkController extends BaseController<CarPark, Integer> { | @@ -26,16 +25,10 @@ public class CarParkController extends BaseController<CarPark, Integer> { | ||
| 26 | */ | 25 | */ |
| 27 | @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET) | 26 | @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET) |
| 28 | public Map<String, Object> getStationCode() { | 27 | public Map<String, Object> getStationCode() { |
| 29 | - | ||
| 30 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 28 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 31 | - | ||
| 32 | - resultMap.put("carParkCode", "FFFF" + GetUIDAndCode.getCarParkId()); | ||
| 33 | - | 29 | + resultMap.put("carParkCode", "FFFFFF" + GetUIDAndCode.getCarParkId()); |
| 34 | return resultMap; | 30 | return resultMap; |
| 35 | - | ||
| 36 | } | 31 | } |
| 37 | - | ||
| 38 | - | ||
| 39 | /** | 32 | /** |
| 40 | * 新增停车场信息 | 33 | * 新增停车场信息 |
| 41 | * | 34 | * |
| @@ -53,21 +46,14 @@ public class CarParkController extends BaseController<CarPark, Integer> { | @@ -53,21 +46,14 @@ public class CarParkController extends BaseController<CarPark, Integer> { | ||
| 53 | */ | 46 | */ |
| 54 | @RequestMapping(value="carParkSave" , method = RequestMethod.POST) | 47 | @RequestMapping(value="carParkSave" , method = RequestMethod.POST) |
| 55 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { | 48 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 56 | - | ||
| 57 | map.put("createBy", ""); | 49 | map.put("createBy", ""); |
| 58 | - | ||
| 59 | map.put("updateBy", ""); | 50 | map.put("updateBy", ""); |
| 60 | - | ||
| 61 | return service.carParkSave(map); | 51 | return service.carParkSave(map); |
| 62 | - | ||
| 63 | } | 52 | } |
| 64 | - | ||
| 65 | @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET) | 53 | @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET) |
| 66 | public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) { | 54 | public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) { |
| 67 | - | ||
| 68 | return service.findCarParkInfoFormId(map); | 55 | return service.findCarParkInfoFormId(map); |
| 69 | } | 56 | } |
| 70 | - | ||
| 71 | /** | 57 | /** |
| 72 | * 修改停车场信息 | 58 | * 修改停车场信息 |
| 73 | * | 59 | * |
| @@ -85,11 +71,12 @@ public class CarParkController extends BaseController<CarPark, Integer> { | @@ -85,11 +71,12 @@ public class CarParkController extends BaseController<CarPark, Integer> { | ||
| 85 | */ | 71 | */ |
| 86 | @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) | 72 | @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) |
| 87 | public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { | 73 | public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { |
| 88 | - | ||
| 89 | map.put("updateBy", ""); | 74 | map.put("updateBy", ""); |
| 90 | - | ||
| 91 | return service.carParkUpdate(map); | 75 | return service.carParkUpdate(map); |
| 92 | - | ||
| 93 | } | 76 | } |
| 94 | 77 | ||
| 78 | + @RequestMapping(value="isHaveParkCode",method=RequestMethod.GET) | ||
| 79 | + public boolean isHaveParkCode(@RequestParam Map<String,Object> map) { | ||
| 80 | + return service.selectTccInfoByCode(map); | ||
| 81 | + } | ||
| 95 | } | 82 | } |
src/main/java/com/bsth/controller/PersonnelController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.Constants; | ||
| 4 | +import com.bsth.data.pinyin.PersionPinYin; | ||
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 3 | import com.bsth.entity.Personnel; | 6 | import com.bsth.entity.Personnel; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 4 | import com.bsth.service.PersonnelService; | 8 | import com.bsth.service.PersonnelService; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.web.bind.annotation.RequestMapping; | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| @@ -8,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -8,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | import org.springframework.web.bind.annotation.RestController; | 13 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 14 | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 11 | import java.util.List; | 16 | import java.util.List; |
| 12 | import java.util.Map; | 17 | import java.util.Map; |
| 13 | 18 | ||
| @@ -21,8 +26,23 @@ public class PersonnelController extends BaseController<Personnel, Integer> { | @@ -21,8 +26,23 @@ public class PersonnelController extends BaseController<Personnel, Integer> { | ||
| 21 | @Autowired | 26 | @Autowired |
| 22 | private PersonnelService service; | 27 | private PersonnelService service; |
| 23 | 28 | ||
| 29 | + @Autowired | ||
| 30 | + PersionPinYinBuffer persionPinYinBuffer; | ||
| 31 | + | ||
| 24 | @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) | 32 | @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) |
| 25 | public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { | 33 | public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { |
| 26 | return service.sreachPersonnel(jobCode); | 34 | return service.sreachPersonnel(jobCode); |
| 27 | } | 35 | } |
| 36 | + | ||
| 37 | + @RequestMapping(value = "/all_py", method = RequestMethod.GET) | ||
| 38 | + public List<PersionPinYin> findAll_PY(){ | ||
| 39 | + persionPinYinBuffer.refresh(); | ||
| 40 | + return persionPinYinBuffer.getAll(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @RequestMapping(value = "/list_py", method = RequestMethod.GET) | ||
| 44 | + public List<PersionPinYin> findByCurrUser_PY(HttpServletRequest request){ | ||
| 45 | + List<CompanyAuthority> auths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 46 | + return persionPinYinBuffer.getAll(auths); | ||
| 47 | + } | ||
| 28 | } | 48 | } |
src/main/java/com/bsth/controller/SectionController.java
| @@ -60,6 +60,26 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -60,6 +60,26 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 60 | * | 60 | * |
| 61 | * @return Map<String, Object> <SUCCESS ; ERROR> | 61 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 62 | */ | 62 | */ |
| 63 | + @RequestMapping(value="sectionCut" , method = RequestMethod.POST) | ||
| 64 | + public Map<String, Object> sectionCut(@RequestParam Map<String, Object> map) { | ||
| 65 | + | ||
| 66 | + map.put("updateBy", ""); | ||
| 67 | + | ||
| 68 | + map.put("createBy", ""); | ||
| 69 | + | ||
| 70 | + map.put("createDate", ""); | ||
| 71 | + | ||
| 72 | + return service.sectionCut(map); | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Description :TODO(编辑线路走向) | ||
| 78 | + * | ||
| 79 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 80 | + * | ||
| 81 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 82 | + */ | ||
| 63 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | 83 | @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) |
| 64 | public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | 84 | public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { |
| 65 | 85 | ||
| @@ -74,6 +94,22 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -74,6 +94,22 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 74 | } | 94 | } |
| 75 | 95 | ||
| 76 | /** | 96 | /** |
| 97 | + * @Description :TODO(编辑缓存线路走向) | ||
| 98 | + */ | ||
| 99 | + @RequestMapping(value="sectionCacheUpdate" , method = RequestMethod.POST) | ||
| 100 | + public Map<String, Object> sectionCacheUpdate(@RequestParam Map<String, Object> map) { | ||
| 101 | + | ||
| 102 | + map.put("updateBy", ""); | ||
| 103 | + | ||
| 104 | + map.put("createBy", ""); | ||
| 105 | + | ||
| 106 | + map.put("createDate", ""); | ||
| 107 | + | ||
| 108 | + return service.sectionCacheUpdate(map); | ||
| 109 | + | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 77 | * @Description :TODO(查询路段编码) | 113 | * @Description :TODO(查询路段编码) |
| 78 | * | 114 | * |
| 79 | * @return int <sectionCode路段编码> | 115 | * @return int <sectionCode路段编码> |
src/main/java/com/bsth/controller/SectionRouteController.java
| @@ -35,6 +35,16 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -35,6 +35,16 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 35 | @Autowired | 35 | @Autowired |
| 36 | SectionRouteService routeService; | 36 | SectionRouteService routeService; |
| 37 | 37 | ||
| 38 | + /** | ||
| 39 | + * @param String | ||
| 40 | + * @throws | ||
| 41 | + * @Description: TODO(批量撤销路段) | ||
| 42 | + */ | ||
| 43 | + @RequestMapping(value = "/batchDestroy", method = RequestMethod.GET) | ||
| 44 | + public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) { | ||
| 45 | + return routeService.updateSectionRouteInfoFormId(map); | ||
| 46 | + } | ||
| 47 | + | ||
| 38 | /** | 48 | /** |
| 39 | * @param @param map | 49 | * @param @param map |
| 40 | * @throws | 50 | * @throws |
| @@ -60,6 +70,18 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -60,6 +70,18 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 60 | 70 | ||
| 61 | 71 | ||
| 62 | /** | 72 | /** |
| 73 | + * @Description :TODO(查询路段信息) | ||
| 74 | + * | ||
| 75 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 76 | + * | ||
| 77 | + * @return Map<String, Object> | ||
| 78 | + */ | ||
| 79 | + @RequestMapping(value = "/findSectionCache" , method = RequestMethod.GET) | ||
| 80 | + public List<Map<String, Object>> findPointsCache(@RequestParam Map<String, Object> map) { | ||
| 81 | + return routeService.getSectionRouteCache(map); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 63 | * @Description : TODO(根据路段路由Id查询详情) | 85 | * @Description : TODO(根据路段路由Id查询详情) |
| 64 | * | 86 | * |
| 65 | * @param map <id:路段路由ID> | 87 | * @param map <id:路段路由ID> |
| @@ -78,7 +100,7 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | @@ -78,7 +100,7 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer | ||
| 78 | * | 100 | * |
| 79 | * @return List<Map<String, Object>> | 101 | * @return List<Map<String, Object>> |
| 80 | */ | 102 | */ |
| 81 | - @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET) | 103 | + @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET) |
| 82 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | 104 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 83 | return routeService.findUpSectionRouteCode(map); | 105 | return routeService.findUpSectionRouteCode(map); |
| 84 | } | 106 | } |
src/main/java/com/bsth/controller/StationController.java
| @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | import org.springframework.web.bind.annotation.RequestParam; | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 10 | ||
| 11 | +import antlr.collections.List; | ||
| 12 | + | ||
| 11 | import com.bsth.entity.Station; | 13 | import com.bsth.entity.Station; |
| 12 | import com.bsth.service.StationService; | 14 | import com.bsth.service.StationService; |
| 13 | import com.bsth.util.GetUIDAndCode; | 15 | import com.bsth.util.GetUIDAndCode; |
| @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { | @@ -36,6 +38,17 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 36 | private StationService service; | 38 | private StationService service; |
| 37 | 39 | ||
| 38 | /** | 40 | /** |
| 41 | + * @Description :TODO(根据坐标点匹配数据库中的站点) | ||
| 42 | + * | ||
| 43 | + * @param map: <point:坐标点; name:站点名> | ||
| 44 | + * | ||
| 45 | + */ | ||
| 46 | + @RequestMapping(value="matchStation" , method = RequestMethod.GET) | ||
| 47 | + public Map<String, Object> matchStation(@RequestParam Map<String, Object> map) { | ||
| 48 | + return service.matchStation(map); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 39 | * @Description :TODO(系统规划保存数据) | 52 | * @Description :TODO(系统规划保存数据) |
| 40 | * | 53 | * |
| 41 | * @param map <stationJSON:站点信息; | 54 | * @param map <stationJSON:站点信息; |
| @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { | @@ -68,6 +81,11 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 68 | return service.manualSave(map); | 81 | return service.manualSave(map); |
| 69 | } | 82 | } |
| 70 | 83 | ||
| 84 | + @RequestMapping(value="cacheSave" , method = RequestMethod.POST) | ||
| 85 | + public Map<String, Object> cacheSave(@RequestParam Map<String, Object> map) { | ||
| 86 | + return service.cacheSave(map); | ||
| 87 | + } | ||
| 88 | + | ||
| 71 | /** | 89 | /** |
| 72 | * @Description :TODO(新增站点保存) | 90 | * @Description :TODO(新增站点保存) |
| 73 | * | 91 | * |
| @@ -107,13 +125,9 @@ public class StationController extends BaseController<Station, Integer> { | @@ -107,13 +125,9 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 107 | */ | 125 | */ |
| 108 | @RequestMapping(value="stationUpdate" , method = RequestMethod.POST) | 126 | @RequestMapping(value="stationUpdate" , method = RequestMethod.POST) |
| 109 | public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) { | 127 | public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) { |
| 110 | - | ||
| 111 | map.put("updateBy", ""); | 128 | map.put("updateBy", ""); |
| 112 | - | ||
| 113 | return service.stationUpdate(map); | 129 | return service.stationUpdate(map); |
| 114 | - | ||
| 115 | } | 130 | } |
| 116 | - | ||
| 117 | /** | 131 | /** |
| 118 | * @Description :TODO(查询站点编码) | 132 | * @Description :TODO(查询站点编码) |
| 119 | * | 133 | * |
src/main/java/com/bsth/controller/StationRouteController.java
| @@ -47,6 +47,16 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -47,6 +47,16 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 47 | return service.list(map); | 47 | return service.list(map); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | + /** | ||
| 51 | + * @param String | ||
| 52 | + * @throws | ||
| 53 | + * @Description: TODO(批量撤销站点) | ||
| 54 | + */ | ||
| 55 | + @RequestMapping(value = "/batchDestroy", method = RequestMethod.GET) | ||
| 56 | + public Map<String, Object> updateBatch(@RequestParam Map<String, Object> map) { | ||
| 57 | + return service.updateStationRouteInfoFormId(map); | ||
| 58 | + } | ||
| 59 | + | ||
| 50 | /** | 60 | /** |
| 51 | * @Description :TODO(查询树站点与路段数据) | 61 | * @Description :TODO(查询树站点与路段数据) |
| 52 | * | 62 | * |
| @@ -89,6 +99,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -89,6 +99,18 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 89 | } | 99 | } |
| 90 | 100 | ||
| 91 | /** | 101 | /** |
| 102 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 103 | + * | ||
| 104 | + * @param map <lineId:线路ID; direction:方向> | ||
| 105 | + * | ||
| 106 | + * @return List<Map<String, Object>> | ||
| 107 | + */ | ||
| 108 | + @RequestMapping(value = "/getStationRouteCacheCenterPoints" , method = RequestMethod.GET) | ||
| 109 | + public List<Map<String, Object>> getStationRouteCacheCenterPoints(@RequestParam Map<String, Object> map) { | ||
| 110 | + return service.getStationRouteCacheCenterPoints(map); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 92 | * @Description :TODO(撤销站点) | 114 | * @Description :TODO(撤销站点) |
| 93 | * | 115 | * |
| 94 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | 116 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> |
src/main/java/com/bsth/controller/directive/DirectiveController.java
| @@ -31,7 +31,7 @@ public class DirectiveController { | @@ -31,7 +31,7 @@ public class DirectiveController { | ||
| 31 | 31 | ||
| 32 | @Autowired | 32 | @Autowired |
| 33 | DirectiveService directiveService; | 33 | DirectiveService directiveService; |
| 34 | - | 34 | + |
| 35 | /** | 35 | /** |
| 36 | * | 36 | * |
| 37 | * @Title: send60 | 37 | * @Title: send60 |
| @@ -106,7 +106,7 @@ public class DirectiveController { | @@ -106,7 +106,7 @@ public class DirectiveController { | ||
| 106 | @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) | 106 | @RequestMapping(value = "/upDownChange", method = RequestMethod.POST) |
| 107 | public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ | 107 | public int upDownChange(@RequestParam String nbbm, @RequestParam Integer upDown){ |
| 108 | SysUser user = SecurityUtils.getCurrentUser(); | 108 | SysUser user = SecurityUtils.getCurrentUser(); |
| 109 | - return directiveService.upDownChange(nbbm, upDown, user.getUserName()); | 109 | + return directiveService.send60Operation(nbbm, 0, upDown, user.getUserName()); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| @@ -120,7 +120,7 @@ public class DirectiveController { | @@ -120,7 +120,7 @@ public class DirectiveController { | ||
| 120 | @RequestMapping(value = "/stateChange", method = RequestMethod.POST) | 120 | @RequestMapping(value = "/stateChange", method = RequestMethod.POST) |
| 121 | public int stateChange(@RequestParam String nbbm, @RequestParam Integer upDown, @RequestParam Integer state){ | 121 | public int stateChange(@RequestParam String nbbm, @RequestParam Integer upDown, @RequestParam Integer state){ |
| 122 | SysUser user = SecurityUtils.getCurrentUser(); | 122 | SysUser user = SecurityUtils.getCurrentUser(); |
| 123 | - return directiveService.stateChange(nbbm, upDown, state, user.getUserName()); | 123 | + return directiveService.send60Operation(nbbm, state, upDown, user.getUserName()); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /** | 126 | /** |
| @@ -173,15 +173,10 @@ public class DirectiveController { | @@ -173,15 +173,10 @@ public class DirectiveController { | ||
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | @RequestMapping(value = "/c0a4", method = RequestMethod.POST) | 175 | @RequestMapping(value = "/c0a4", method = RequestMethod.POST) |
| 176 | - public int c0a4(@RequestParam String nbbm){ | 176 | + public Map<String, Object> c0a4(@RequestParam String nbbm){ |
| 177 | return directiveService.sendC0A4(nbbm); | 177 | return directiveService.sendC0A4(nbbm); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | -// @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | ||
| 181 | -// public int c0a3(@RequestParam DC0_A4 c0a4){ | ||
| 182 | -// return directiveService.sendC0A3(c0a4); | ||
| 183 | -// } | ||
| 184 | - | ||
| 185 | @RequestMapping(value = "/c0a3", method = RequestMethod.POST) | 180 | @RequestMapping(value = "/c0a3", method = RequestMethod.POST) |
| 186 | public int c0a3(String json){ | 181 | public int c0a3(String json){ |
| 187 | json = StringEscapeUtils.unescapeHtml4(json); | 182 | json = StringEscapeUtils.unescapeHtml4(json); |
| @@ -192,7 +187,18 @@ public class DirectiveController { | @@ -192,7 +187,18 @@ public class DirectiveController { | ||
| 192 | @RequestMapping(value = "/c0a5", method = RequestMethod.POST) | 187 | @RequestMapping(value = "/c0a5", method = RequestMethod.POST) |
| 193 | public int c0a5(String json){ | 188 | public int c0a5(String json){ |
| 194 | json = StringEscapeUtils.unescapeHtml4(json); | 189 | json = StringEscapeUtils.unescapeHtml4(json); |
| 195 | - //DC0_A3 c0a3 = JSON.toJavaObject(JSONObject.parseObject(json), DC0_A3.class); | ||
| 196 | return directiveService.sendC0A5(json); | 190 | return directiveService.sendC0A5(json); |
| 197 | } | 191 | } |
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * 设备参数查询 | ||
| 195 | + * @return | ||
| 196 | + */ | ||
| 197 | + @RequestMapping(value = "/deviceCofigList", method = RequestMethod.GET) | ||
| 198 | + public Map<String, Object> deviceCofigList( | ||
| 199 | + @RequestParam Map<String, String> map, | ||
| 200 | + @RequestParam(defaultValue = "0") int page, | ||
| 201 | + @RequestParam(defaultValue = "10") int size){ | ||
| 202 | + return directiveService.deviceCofigList(map, page, size); | ||
| 203 | + } | ||
| 198 | } | 204 | } |
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
| 1 | package com.bsth.controller.directive; | 1 | package com.bsth.controller.directive; |
| 2 | 2 | ||
| 3 | +import org.apache.commons.lang3.StringUtils; | ||
| 3 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 4 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -59,7 +60,8 @@ public class UpstreamEntrance { | @@ -59,7 +60,8 @@ public class UpstreamEntrance { | ||
| 59 | case 0x26: | 60 | case 0x26: |
| 60 | // 驾驶员上报 | 61 | // 驾驶员上报 |
| 61 | D80 d80 = JSON.toJavaObject(jsonParam, D80.class); | 62 | D80 d80 = JSON.toJavaObject(jsonParam, D80.class); |
| 62 | - pilotReport.report(d80); | 63 | + if(d80!=null && StringUtils.isNotEmpty(d80.getDeviceId())) |
| 64 | + pilotReport.report(d80); | ||
| 63 | break; | 65 | break; |
| 64 | 66 | ||
| 65 | case 0xA4: | 67 | case 0xA4: |
| @@ -67,9 +69,9 @@ public class UpstreamEntrance { | @@ -67,9 +69,9 @@ public class UpstreamEntrance { | ||
| 67 | data.put("posPort", data.getString("posPort").trim()); | 69 | data.put("posPort", data.getString("posPort").trim()); |
| 68 | data.put("posIpAddress", data.getString("posIpAddress").trim()); | 70 | data.put("posIpAddress", data.getString("posIpAddress").trim()); |
| 69 | data.put("ipAddress", data.getString("ipAddress").trim()); | 71 | data.put("ipAddress", data.getString("ipAddress").trim()); |
| 70 | - | 72 | + |
| 71 | DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class); | 73 | DC0_A4 c0a4 = JSON.toJavaObject(jsonParam, DC0_A4.class); |
| 72 | - System.out.println(c0a4); | 74 | + pilotReport.report(c0a4); |
| 73 | break; | 75 | break; |
| 74 | } | 76 | } |
| 75 | 77 |
src/main/java/com/bsth/controller/excep/NowAbnormalController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.excep.Abnormal; | ||
| 14 | +import com.bsth.entity.sys.SysUser; | ||
| 15 | +import com.bsth.service.excep.NowAbnormalService; | ||
| 16 | +import com.bsth.util.PageObject; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("nowabnormal") | ||
| 20 | +public class NowAbnormalController extends BaseController<SysUser, Integer>{ | ||
| 21 | + @Autowired | ||
| 22 | + private NowAbnormalService nowAbnormalService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 25 | + public PageObject<Abnormal> pagequery(@RequestParam Map<String, Object> map){ | ||
| 26 | + PageObject<Abnormal> pageObject = null; | ||
| 27 | + map.put("curPage", map.get("page").toString()); | ||
| 28 | + map.put("pageData","10"); | ||
| 29 | + pageObject=nowAbnormalService.Pagequery(map); | ||
| 30 | + return pageObject; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + map.put("isShow", 1); | ||
| 40 | +// modelMap = offlineService.getReport(map); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + } | ||
| 44 | + return modelMap; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
src/main/java/com/bsth/controller/excep/NowOfflineController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.excep.Offline; | ||
| 14 | +import com.bsth.entity.sys.SysUser; | ||
| 15 | +import com.bsth.service.excep.NowOfflineService; | ||
| 16 | +import com.bsth.util.PageObject; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("nowoffline") | ||
| 20 | +public class NowOfflineController extends BaseController<SysUser, Integer>{ | ||
| 21 | + @Autowired | ||
| 22 | + private NowOfflineService nowOfflineService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 25 | + public PageObject<Offline> pagequery(@RequestParam Map<String, Object> map){ | ||
| 26 | + PageObject<Offline> pageObject = null; | ||
| 27 | + map.put("curPage", map.get("page").toString()); | ||
| 28 | + map.put("pageData","10"); | ||
| 29 | + pageObject=nowOfflineService.Pagequery(map); | ||
| 30 | + return pageObject; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + map.put("isShow", 1); | ||
| 40 | + modelMap = nowOfflineService.getReport(map); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + } | ||
| 44 | + return modelMap; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
src/main/java/com/bsth/controller/excep/NowOutboundController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.excep.Outbound; | ||
| 14 | +import com.bsth.entity.sys.SysUser; | ||
| 15 | +import com.bsth.service.excep.NowOutboundService; | ||
| 16 | +import com.bsth.util.PageObject; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("nowbound") | ||
| 20 | +public class NowOutboundController extends BaseController<SysUser, Integer>{ | ||
| 21 | + @Autowired | ||
| 22 | + private NowOutboundService nowOutboundService; | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 25 | + public PageObject<Outbound> pagequery(@RequestParam Map<String, Object> map){ | ||
| 26 | + PageObject<Outbound> pageObject = null; | ||
| 27 | + map.put("curPage", map.get("page").toString()); | ||
| 28 | + map.put("pageData","10"); | ||
| 29 | + pageObject=nowOutboundService.Pagequery(map); | ||
| 30 | + return pageObject; | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 36 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 37 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + map.put("isShow", 1); | ||
| 40 | + modelMap = nowOutboundService.getReport(map); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + } | ||
| 44 | + return modelMap; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +} |
src/main/java/com/bsth/controller/excep/NowSpeedingController.java
0 → 100644
| 1 | +package com.bsth.controller.excep; | ||
| 2 | + | ||
| 3 | +import java.text.ParseException; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import com.bsth.controller.BaseController; | ||
| 15 | +import com.bsth.data.BasicData; | ||
| 16 | +import com.bsth.entity.excep.Speeding; | ||
| 17 | +import com.bsth.entity.sys.SysUser; | ||
| 18 | +import com.bsth.service.excep.NowSpeedingService; | ||
| 19 | +import com.bsth.util.PageObject; | ||
| 20 | + | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("nowspeeding") | ||
| 23 | +public class NowSpeedingController extends BaseController<SysUser, Integer>{ | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + private NowSpeedingService nowSpeedingService; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 29 | + public PageObject<Speeding> pagequery(@RequestParam Map<String, Object> map){ | ||
| 30 | + PageObject<Speeding> pageObject = null; | ||
| 31 | + map.put("curPage", map.get("page").toString()); | ||
| 32 | + map.put("pageData","10"); | ||
| 33 | + pageObject=nowSpeedingService.Pagequery(map); | ||
| 34 | + return pageObject; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @RequestMapping(value = "/getReport", method = RequestMethod.POST) | ||
| 38 | + public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | ||
| 39 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | ||
| 40 | + try { | ||
| 41 | + map.put("isShow", 1); | ||
| 42 | + modelMap = nowSpeedingService.getReport(map); | ||
| 43 | + } catch (Exception e) { | ||
| 44 | + e.printStackTrace(); | ||
| 45 | + } | ||
| 46 | + return modelMap; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 50 | + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 51 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 52 | + List<Speeding> listSpeeding = nowSpeedingService.findPosition(deviceid,startdate,enddate); | ||
| 53 | + return listSpeeding; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | +} |
src/main/java/com/bsth/controller/excep/SpeedingController.java
| 1 | package com.bsth.controller.excep; | 1 | package com.bsth.controller.excep; |
| 2 | 2 | ||
| 3 | +import java.text.ParseException; | ||
| 3 | import java.util.HashMap; | 4 | import java.util.HashMap; |
| 5 | +import java.util.List; | ||
| 4 | import java.util.Map; | 6 | import java.util.Map; |
| 5 | 7 | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.web.bind.annotation.RequestMapping; | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | import org.springframework.web.bind.annotation.RequestMethod; | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 9 | import org.springframework.web.bind.annotation.RequestParam; | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 10 | -import org.springframework.web.bind.annotation.ResponseBody; | ||
| 11 | import org.springframework.web.bind.annotation.RestController; | 12 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 13 | ||
| 13 | import com.bsth.controller.BaseController; | 14 | import com.bsth.controller.BaseController; |
| 14 | -import com.bsth.entity.excep.Offline; | 15 | +import com.bsth.data.BasicData; |
| 15 | import com.bsth.entity.excep.Speeding; | 16 | import com.bsth.entity.excep.Speeding; |
| 16 | import com.bsth.entity.sys.SysUser; | 17 | import com.bsth.entity.sys.SysUser; |
| 17 | -import com.bsth.service.excep.OfflineService; | ||
| 18 | import com.bsth.service.excep.SpeedingService; | 18 | import com.bsth.service.excep.SpeedingService; |
| 19 | import com.bsth.util.PageObject; | 19 | import com.bsth.util.PageObject; |
| 20 | 20 | ||
| @@ -31,10 +31,8 @@ public class SpeedingController extends BaseController<SysUser, Integer>{ | @@ -31,10 +31,8 @@ public class SpeedingController extends BaseController<SysUser, Integer>{ | ||
| 31 | map.put("pageData","10"); | 31 | map.put("pageData","10"); |
| 32 | pageObject=speedingService.Pagequery(map); | 32 | pageObject=speedingService.Pagequery(map); |
| 33 | return pageObject; | 33 | return pageObject; |
| 34 | - | ||
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | - | ||
| 38 | @RequestMapping(value = "/getReport", method = RequestMethod.POST) | 36 | @RequestMapping(value = "/getReport", method = RequestMethod.POST) |
| 39 | public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { | 37 | public Map<String, Object> getReport(@RequestParam Map<String, Object> map) { |
| 40 | Map<String, Object> modelMap = new HashMap<String, Object>(); | 38 | Map<String, Object> modelMap = new HashMap<String, Object>(); |
| @@ -47,5 +45,11 @@ public class SpeedingController extends BaseController<SysUser, Integer>{ | @@ -47,5 +45,11 @@ public class SpeedingController extends BaseController<SysUser, Integer>{ | ||
| 47 | return modelMap; | 45 | return modelMap; |
| 48 | } | 46 | } |
| 49 | 47 | ||
| 48 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 49 | + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 50 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 51 | + List<Speeding> listSpeeding = speedingService.findPosition(deviceid,startdate,enddate); | ||
| 52 | + return listSpeeding; | ||
| 53 | + } | ||
| 50 | 54 | ||
| 51 | } | 55 | } |
src/main/java/com/bsth/controller/forms/ExportController.java
| @@ -87,6 +87,7 @@ public class ExportController { | @@ -87,6 +87,7 @@ public class ExportController { | ||
| 87 | public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) { | 87 | public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) { |
| 88 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 88 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 89 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | 89 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 90 | + Map<String, Object> map2 = new HashMap<String, Object>(); | ||
| 90 | ReportUtils ee = new ReportUtils(); | 91 | ReportUtils ee = new ReportUtils(); |
| 91 | List<Shifday> shifday = formsService.shifday(map); | 92 | List<Shifday> shifday = formsService.shifday(map); |
| 92 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 93 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| @@ -110,11 +111,15 @@ public class ExportController { | @@ -110,11 +111,15 @@ public class ExportController { | ||
| 110 | m.put("sjbc", l.getSjbc()); | 111 | m.put("sjbc", l.getSjbc()); |
| 111 | resList.add(m); | 112 | resList.add(m); |
| 112 | } | 113 | } |
| 114 | + if(resList.size() > 0){ | ||
| 115 | + map2 = resList.get(resList.size() - 1); | ||
| 116 | + resList.remove(map2); | ||
| 117 | + } | ||
| 113 | 118 | ||
| 114 | try { | 119 | try { |
| 115 | listI.add(resList.iterator()); | 120 | listI.add(resList.iterator()); |
| 116 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | 121 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
| 117 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/shifday.xls", | 122 | + ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls", |
| 118 | path + "export/班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); | 123 | path + "export/班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); |
| 119 | } catch (Exception e) { | 124 | } catch (Exception e) { |
| 120 | e.printStackTrace(); | 125 | e.printStackTrace(); |
| @@ -303,12 +308,10 @@ public class ExportController { | @@ -303,12 +308,10 @@ public class ExportController { | ||
| 303 | m.put("fssj", l.getFssj()); | 308 | m.put("fssj", l.getFssj()); |
| 304 | m.put("xgsj", l.getXgsj()); | 309 | m.put("xgsj", l.getXgsj()); |
| 305 | m.put("pcch", l.getPcch()); | 310 | m.put("pcch", l.getPcch()); |
| 306 | - m.put("pcry", l.getPcry()); | ||
| 307 | - m.put("jhch", l.getJhch()); | ||
| 308 | - m.put("jhgh", l.getJhgh()); | ||
| 309 | m.put("sjch", l.getSjch()); | 311 | m.put("sjch", l.getSjch()); |
| 312 | + m.put("fcgh", l.getPcry()); | ||
| 310 | m.put("sjgh", l.getSjgh()); | 313 | m.put("sjgh", l.getSjgh()); |
| 311 | - m.put("yy", l.getYy()); | 314 | + m.put("yy", l.getYy()==null?"":l.getYy()); |
| 312 | m.put("xgr", l.getXgr()); | 315 | m.put("xgr", l.getXgr()); |
| 313 | resList.add(m); | 316 | resList.add(m); |
| 314 | } | 317 | } |
| @@ -330,69 +333,22 @@ public class ExportController { | @@ -330,69 +333,22 @@ public class ExportController { | ||
| 330 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 333 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 331 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | 334 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 332 | ReportUtils ee = new ReportUtils(); | 335 | ReportUtils ee = new ReportUtils(); |
| 333 | - List<Turnoutrate> turnoutrate = formsService.turnoutrate(map); | ||
| 334 | Map<String, Object> map1 = new HashMap<String, Object>(); | 336 | Map<String, Object> map1 = new HashMap<String, Object>(); |
| 335 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 336 | - String xlts=""; | ||
| 337 | - String zsgs=""; | ||
| 338 | - String jh=""; | ||
| 339 | - Float j=0f; | ||
| 340 | - Float sj=0f; | ||
| 341 | - Float qz=0f; | ||
| 342 | - Float ccl=0f; | ||
| 343 | - Float bcjh=0f; | ||
| 344 | - String bcsj=""; | ||
| 345 | - Float bczxl=0f; | ||
| 346 | - String gs=""; | ||
| 347 | - String zhgs=""; | ||
| 348 | 337 | ||
| 349 | - for (Turnoutrate l : turnoutrate) { | ||
| 350 | - Map<String, Object> m = new HashMap<String, Object>(); | ||
| 351 | - | ||
| 352 | - xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs()); | ||
| 353 | - zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs()); | ||
| 354 | - jh +=l.getXl()==""?0:String.valueOf(l.getXl()); | ||
| 355 | - sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh()); | ||
| 356 | - ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj()); | ||
| 357 | - bcjh +=l.getCchqz()==""?0f:Float.valueOf(l.getCchqz()); | ||
| 358 | - bcsj +=l.getChl()==""?0:String.valueOf(l.getChl()); | ||
| 359 | - bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh()); | ||
| 360 | - gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj()); | ||
| 361 | - zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl()); | ||
| 362 | - | ||
| 363 | - | ||
| 364 | - m.put("rq", l.getRq()); | ||
| 365 | - m.put("gs", l.getGs()); | ||
| 366 | - m.put("zhgs", l.getZhgs()); | ||
| 367 | - m.put("xl", l.getXl()); | ||
| 368 | - m.put("cchjh", l.getCchjh()); | ||
| 369 | - m.put("cchsj", l.getCchsj()); | ||
| 370 | - m.put("cchqz", l.getCchqz()); | ||
| 371 | - m.put("chl", l.getChl()); | ||
| 372 | - m.put("bcjh", l.getBcjh()); | ||
| 373 | - m.put("bcsj", l.getBcsj()); | ||
| 374 | - m.put("bbzxl", l.getBbzxl()); | ||
| 375 | - m.put("sm", l.getSm()); | ||
| 376 | - resList.add(m); | ||
| 377 | - | ||
| 378 | - | ||
| 379 | - | ||
| 380 | - m=new HashMap<String,Object>(); | ||
| 381 | - m.put("total_xlts", xlts); | ||
| 382 | - m.put("total_zhgs", zsgs); | ||
| 383 | - m.put("total_jh", jh); | ||
| 384 | - m.put("total_sj", sj); | ||
| 385 | - m.put("total_qz", ccl); | ||
| 386 | - m.put("total_ccl", bcjh); | ||
| 387 | - m.put("total_bcjh",bcsj); | ||
| 388 | - m.put("total_bcsj", bczxl); | ||
| 389 | - m.put("total_bczxl", bczxl); | ||
| 390 | - m.put("total_gs", zhgs); | ||
| 391 | - | ||
| 392 | - | ||
| 393 | - map1 = m; | ||
| 394 | - } | ||
| 395 | - | 338 | + List<Map<String, Object>> resList = formsService.turnoutrate(map); |
| 339 | + Map<String, Object> m = resList.get(resList.size() - 1); | ||
| 340 | + map1.put("line", m.get("line")); | ||
| 341 | + map1.put("jhcc", m.get("jhcc")); | ||
| 342 | + map1.put("sjcc", m.get("sjcc")); | ||
| 343 | + map1.put("jhbc", m.get("jhbc")); | ||
| 344 | + map1.put("sjbc", m.get("sjbc")); | ||
| 345 | + map1.put("ccl", m.get("ccl")); | ||
| 346 | + map1.put("zxl", m.get("zxl")); | ||
| 347 | + map1.put("qz", m.get("qz")); | ||
| 348 | + map1.put("sm", m.get("sm")); | ||
| 349 | + | ||
| 350 | + resList.remove(m); | ||
| 351 | + | ||
| 396 | try { | 352 | try { |
| 397 | listI.add(resList.iterator()); | 353 | listI.add(resList.iterator()); |
| 398 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | 354 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
| @@ -66,7 +66,7 @@ public class MCY_FormsController { | @@ -66,7 +66,7 @@ public class MCY_FormsController { | ||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | // 换人换车情况统计表 | 68 | // 换人换车情况统计表 |
| 69 | - @RequestMapping(value = "/changetochange", method = RequestMethod.POST) | 69 | + @RequestMapping(value = "/changetochange", method = RequestMethod.GET) |
| 70 | public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) { | 70 | public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) { |
| 71 | 71 | ||
| 72 | return formsService.changetochange(map); | 72 | return formsService.changetochange(map); |
| @@ -94,7 +94,7 @@ public class MCY_FormsController { | @@ -94,7 +94,7 @@ public class MCY_FormsController { | ||
| 94 | 94 | ||
| 95 | // 营运线路出车率统计表 | 95 | // 营运线路出车率统计表 |
| 96 | @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST) | 96 | @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST) |
| 97 | - public List<Turnoutrate> turnoutrate(@RequestParam Map<String, Object> map) { | 97 | + public List<Map<String, Object>> turnoutrate(@RequestParam Map<String, Object> map) { |
| 98 | 98 | ||
| 99 | return formsService.turnoutrate(map); | 99 | return formsService.turnoutrate(map); |
| 100 | } | 100 | } |
src/main/java/com/bsth/controller/gps/GpsController.java
| @@ -3,11 +3,18 @@ package com.bsth.controller.gps; | @@ -3,11 +3,18 @@ package com.bsth.controller.gps; | ||
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | import com.bsth.data.gpsdata.GpsEntity; | 4 | import com.bsth.data.gpsdata.GpsEntity; |
| 5 | import com.bsth.data.gpsdata.GpsRealData; | 5 | import com.bsth.data.gpsdata.GpsRealData; |
| 6 | +import com.bsth.entity.excep.Speeding; | ||
| 6 | import com.bsth.service.gps.GpsService; | 7 | import com.bsth.service.gps.GpsService; |
| 8 | +import com.bsth.service.gps.entity.GpsSpeed; | ||
| 9 | +import com.bsth.util.PageObject; | ||
| 7 | import com.google.common.base.Splitter; | 10 | import com.google.common.base.Splitter; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
| 10 | 13 | ||
| 14 | +import javax.servlet.http.HttpServletResponse; | ||
| 15 | + | ||
| 16 | +import java.text.ParseException; | ||
| 17 | +import java.util.ArrayList; | ||
| 11 | import java.util.List; | 18 | import java.util.List; |
| 12 | import java.util.Map; | 19 | import java.util.Map; |
| 13 | 20 | ||
| @@ -90,11 +97,12 @@ public class GpsController { | @@ -90,11 +97,12 @@ public class GpsController { | ||
| 90 | 97 | ||
| 91 | /** | 98 | /** |
| 92 | * gps补全 | 99 | * gps补全 |
| 100 | + * type 0 : 实时GPS 1:走补传 | ||
| 93 | * @return | 101 | * @return |
| 94 | */ | 102 | */ |
| 95 | @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST) | 103 | @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST) |
| 96 | - public Map<String, Object> gpsCompletion(@RequestParam long schId) { | ||
| 97 | - return gpsService.gpsCompletion(schId); | 104 | + public Map<String, Object> gpsCompletion(@RequestParam long schId, @RequestParam int type) { |
| 105 | + return gpsService.gpsCompletion(schId, type); | ||
| 98 | } | 106 | } |
| 99 | 107 | ||
| 100 | /** | 108 | /** |
| @@ -110,6 +118,57 @@ public class GpsController { | @@ -110,6 +118,57 @@ public class GpsController { | ||
| 110 | } | 118 | } |
| 111 | 119 | ||
| 112 | /** | 120 | /** |
| 121 | + * 历史GPS查询 ,第三版轨迹回放用 | ||
| 122 | + * @param nbbm | ||
| 123 | + * @param st | ||
| 124 | + * @param et | ||
| 125 | + * @return | ||
| 126 | + */ | ||
| 127 | + @RequestMapping(value = "/history_v3/{nbbm}") | ||
| 128 | + public Map<String, Object> history_v3(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){ | ||
| 129 | + return gpsService.history_v3(nbbm, st, et); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * 轨迹导出 | ||
| 134 | + * @param nbbm | ||
| 135 | + * @param st | ||
| 136 | + * @param et | ||
| 137 | + * @return | ||
| 138 | + */ | ||
| 139 | + @RequestMapping(value = "/history_v3/excel/{nbbm}") | ||
| 140 | + public void trailExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){ | ||
| 141 | + gpsService.trailExcel(nbbm, st, et, resp); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * 轨迹异常数据导出 | ||
| 146 | + * @param nbbm | ||
| 147 | + * @param st | ||
| 148 | + * @param et | ||
| 149 | + * @return | ||
| 150 | + */ | ||
| 151 | + @RequestMapping(value = "/history_v3/excel_abnormal/{nbbm}") | ||
| 152 | + public void abnormalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){ | ||
| 153 | + gpsService.abnormalExcel(nbbm, st, et, resp); | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * 到离站数据导出 | ||
| 158 | + * @param nbbm | ||
| 159 | + * @param st | ||
| 160 | + * @param et | ||
| 161 | + * @return | ||
| 162 | + */ | ||
| 163 | + @RequestMapping(value = "/history_v3/excel_arrival/{nbbm}") | ||
| 164 | + public void arrivalExcel(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et, HttpServletResponse resp){ | ||
| 165 | + gpsService.arrivalExcel(nbbm, st, et, resp); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + /** | ||
| 113 | * 安全驾驶数据 分页查询 | 172 | * 安全驾驶数据 分页查询 |
| 114 | * @param map | 173 | * @param map |
| 115 | * @param page | 174 | * @param page |
| @@ -126,4 +185,20 @@ public class GpsController { | @@ -126,4 +185,20 @@ public class GpsController { | ||
| 126 | @RequestParam(defaultValue = "DESC") String direction){ | 185 | @RequestParam(defaultValue = "DESC") String direction){ |
| 127 | return gpsService.safeDrivList(map , page, size, order, direction); | 186 | return gpsService.safeDrivList(map , page, size, order, direction); |
| 128 | } | 187 | } |
| 188 | + | ||
| 189 | + @RequestMapping(value = "/findPosition", method = RequestMethod.GET) | ||
| 190 | + public List<GpsSpeed> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException { | ||
| 191 | + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle); | ||
| 192 | + List<GpsSpeed> listGpsSpeed = new ArrayList<GpsSpeed>(); | ||
| 193 | + listGpsSpeed = gpsService.findPosition(deviceid,startdate,enddate); | ||
| 194 | + return listGpsSpeed; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + @RequestMapping(value = "/pagequery",method = RequestMethod.GET) | ||
| 198 | + public Map<String, Object> pagequery(@RequestParam Map<String, Object> map){ | ||
| 199 | + map.put("curPage", map.get("page").toString()); | ||
| 200 | + map.put("pageData","10"); | ||
| 201 | + return gpsService.Pagequery(map); | ||
| 202 | + } | ||
| 203 | + | ||
| 129 | } | 204 | } |
src/main/java/com/bsth/controller/oil/CwjyController.java
| @@ -33,6 +33,11 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | @@ -33,6 +33,11 @@ public class CwjyController extends BaseController<Cwjy, Integer>{ | ||
| 33 | return service.save(t); | 33 | return service.save(t); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | + @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET) | ||
| 37 | + public int checkNbbm(Cwjy t){ | ||
| 38 | + return service.checkNbbm(t.getNbbm().trim()); | ||
| 39 | + } | ||
| 40 | + | ||
| 36 | @RequestMapping(value = "/queryList",method = RequestMethod.GET) | 41 | @RequestMapping(value = "/queryList",method = RequestMethod.GET) |
| 37 | public List<Ylxxb> queryList(@RequestParam Map<String, Object> map){ | 42 | public List<Ylxxb> queryList(@RequestParam Map<String, Object> map){ |
| 38 | List<Ylxxb> pagequery=null; | 43 | List<Ylxxb> pagequery=null; |
src/main/java/com/bsth/controller/oil/DlbController.java
| @@ -143,13 +143,17 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -143,13 +143,17 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 143 | Map<String, Object> m = new HashMap<String, Object>(); | 143 | Map<String, Object> m = new HashMap<String, Object>(); |
| 144 | m.put("rq", y.getRq()); | 144 | m.put("rq", y.getRq()); |
| 145 | m.put("gsname",y.getGsname() ); | 145 | m.put("gsname",y.getGsname() ); |
| 146 | + m.put("fgsname", y.getFgsname()); | ||
| 146 | m.put("xlname", y.getXlname()); | 147 | m.put("xlname", y.getXlname()); |
| 147 | m.put("nbbm", y.getNbbm()); | 148 | m.put("nbbm", y.getNbbm()); |
| 148 | m.put("jsy", y.getJsy()); | 149 | m.put("jsy", y.getJsy()); |
| 149 | - m.put("cdl", y.getCdl()); | ||
| 150 | - m.put("czcd", y.getCzcd()+"%"); | ||
| 151 | - m.put("jzcd", y.getJzcd()+"%"); | ||
| 152 | - m.put("hd", y.getHd()); | 150 | + m.put("name", y.getName()); |
| 151 | + m.put("cdl", y.getCdl()<=0?"0":y.getCdl()); | ||
| 152 | + m.put("czcd", y.getCzcd()<=0?"0":y.getCzcd()+"%"); | ||
| 153 | + m.put("jzcd", y.getJzcd()<=0?"0":y.getJzcd()+"%"); | ||
| 154 | + m.put("czlc", y.getCzlc()<=0?"0":y.getCzlc()); | ||
| 155 | + m.put("jzlc", y.getJzlc()<=0?"0":y.getJzlc()); | ||
| 156 | + m.put("hd", y.getHd()<=0?"0":y.getHd()); | ||
| 153 | String shyy ="无"; | 157 | String shyy ="无"; |
| 154 | if(y.getShyy()!=null){ | 158 | if(y.getShyy()!=null){ |
| 155 | if(shyy.equals("1")){shyy="票务用油";} | 159 | if(shyy.equals("1")){shyy="票务用油";} |
| @@ -162,20 +166,23 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -162,20 +166,23 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 162 | else if(shyy.equals("8")){shyy="车间(小修)";} | 166 | else if(shyy.equals("8")){shyy="车间(小修)";} |
| 163 | else{shyy ="无";} | 167 | else{shyy ="无";} |
| 164 | } | 168 | } |
| 169 | + m.put("ns", y.getNs()<=0?"0":y.getNs()); | ||
| 165 | m.put("shyy", shyy); | 170 | m.put("shyy", shyy); |
| 166 | - m.put("sh", y.getSh()); | ||
| 167 | - m.put("zlc", y.getZlc()); | 171 | + m.put("sh", y.getSh()<=0?"0":y.getSh()); |
| 172 | + m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | ||
| 173 | + m.put("rdlx", ""); | ||
| 168 | m.put("bglyh", y.getBglyh()); | 174 | m.put("bglyh", y.getBglyh()); |
| 169 | resList.add(m); | 175 | resList.add(m); |
| 170 | } | 176 | } |
| 171 | try { | 177 | try { |
| 178 | + map.put("sheetName", map.get("rq")); | ||
| 172 | listI.add(resList.iterator()); | 179 | listI.add(resList.iterator()); |
| 173 | String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | 180 | String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; |
| 174 | ee.excelReplace(listI, new Object[] { map }, path+"mould/listDl.xls", | 181 | ee.excelReplace(listI, new Object[] { map }, path+"mould/listDl.xls", |
| 175 | path+"export/"+map.get("rq").toString()+ "进出场存电量.xls"); | 182 | path+"export/"+map.get("rq").toString()+ "进出场存电量.xls"); |
| 176 | } catch (Exception e) { | 183 | } catch (Exception e) { |
| 177 | e.printStackTrace(); | 184 | e.printStackTrace(); |
| 178 | - } | 185 | + } |
| 179 | 186 | ||
| 180 | return resList; | 187 | return resList; |
| 181 | 188 |
src/main/java/com/bsth/controller/oil/YlbController.java
| @@ -209,8 +209,8 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -209,8 +209,8 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 209 | return maps; | 209 | return maps; |
| 210 | } | 210 | } |
| 211 | @RequestMapping(value="/oilListMonth") | 211 | @RequestMapping(value="/oilListMonth") |
| 212 | - public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date){ | ||
| 213 | - return yblService.oilListMonth(line, date); | 212 | + public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date,@RequestParam String type){ |
| 213 | + return yblService.oilListMonth(line, date, type); | ||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) | 216 | @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) |
| @@ -236,28 +236,29 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -236,28 +236,29 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 236 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 236 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 237 | for (Ylb y : ylb) { | 237 | for (Ylb y : ylb) { |
| 238 | Map<String, Object> m = new HashMap<String, Object>(); | 238 | Map<String, Object> m = new HashMap<String, Object>(); |
| 239 | - m.put("rq", y.getRq()); | 239 | + m.put("rq", sdfMonth.format(y.getRq())); |
| 240 | m.put("gsname",y.getGsname() ); | 240 | m.put("gsname",y.getGsname() ); |
| 241 | m.put("fgsname", y.getFgsname()); | 241 | m.put("fgsname", y.getFgsname()); |
| 242 | - m.put("xlname", y.getXlname()); | 242 | + m.put("xlname", y.getXlname()==null?"":y.getXlname()); |
| 243 | m.put("nbbm", y.getNbbm()); | 243 | m.put("nbbm", y.getNbbm()); |
| 244 | m.put("jsy", y.getJsy()); | 244 | m.put("jsy", y.getJsy()); |
| 245 | m.put("name", y.getName()); | 245 | m.put("name", y.getName()); |
| 246 | - m.put("jzl", y.getJzl()); | ||
| 247 | - m.put("czlc", y.getCzlc()); | ||
| 248 | - m.put("jzlc", y.getJzlc()); | ||
| 249 | - m.put("czyl", y.getCzyl()); | ||
| 250 | - m.put("jzyl", y.getJzyl()); | ||
| 251 | - m.put("yh", y.getYh()); | 246 | + m.put("jzl", y.getJzl()<=0?"0":y.getJzl()); |
| 247 | + m.put("czlc", "0"); | ||
| 248 | + m.put("jzlc", "0"); | ||
| 249 | + m.put("czyl", y.getCzyl()<=0?"0":y.getCzyl()); | ||
| 250 | + m.put("jzyl", y.getJzyl()<=0?"0":y.getJzyl()); | ||
| 251 | + m.put("yh", y.getYh()<=0?"0":y.getYh()); | ||
| 252 | String rylx=""; | 252 | String rylx=""; |
| 253 | if(y.getRylx()!=null){ | 253 | if(y.getRylx()!=null){ |
| 254 | if(y.getRylx().equals("0")){rylx="0号柴油";} | 254 | if(y.getRylx().equals("0")){rylx="0号柴油";} |
| 255 | if(y.getRylx().equals("1")){rylx="负10号柴油";} | 255 | if(y.getRylx().equals("1")){rylx="负10号柴油";} |
| 256 | } | 256 | } |
| 257 | m.put("rylx", rylx); | 257 | m.put("rylx", rylx); |
| 258 | - m.put("ns", y.getNs()); | 258 | + m.put("ns", y.getNs()==null?"0":y.getNs()); |
| 259 | String shyy ="无"; | 259 | String shyy ="无"; |
| 260 | if(y.getShyy()!=null){ | 260 | if(y.getShyy()!=null){ |
| 261 | + shyy=y.getShyy(); | ||
| 261 | if(shyy.equals("1")){shyy="票务用油";} | 262 | if(shyy.equals("1")){shyy="票务用油";} |
| 262 | else if(shyy.equals("2")){shyy="保养用油";} | 263 | else if(shyy.equals("2")){shyy="保养用油";} |
| 263 | else if(shyy.equals("3")){shyy="报废车用油";} | 264 | else if(shyy.equals("3")){shyy="报废车用油";} |
| @@ -269,12 +270,13 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -269,12 +270,13 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 269 | else{shyy ="无";} | 270 | else{shyy ="无";} |
| 270 | } | 271 | } |
| 271 | m.put("shyy", shyy); | 272 | m.put("shyy", shyy); |
| 272 | - m.put("sh", y.getSh()); | ||
| 273 | - m.put("zlc", y.getZlc()); | 273 | + m.put("sh", y.getSh()<=0?"0":y.getSh()); |
| 274 | + m.put("zlc", y.getZlc()<=0?"0":y.getZlc()); | ||
| 274 | m.put("bglyh", y.getBglyh()); | 275 | m.put("bglyh", y.getBglyh()); |
| 275 | resList.add(m); | 276 | resList.add(m); |
| 276 | } | 277 | } |
| 277 | try { | 278 | try { |
| 279 | + map.put("sheetName", map.get("rq")); | ||
| 278 | listI.add(resList.iterator()); | 280 | listI.add(resList.iterator()); |
| 279 | String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | 281 | String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; |
| 280 | ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls", | 282 | ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls", |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.serializer.PropertyFilter; | 3 | import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | import com.bsth.common.ResponseCode; | 4 | import com.bsth.common.ResponseCode; |
| 6 | import com.bsth.data.BasicData; | 5 | import com.bsth.data.BasicData; |
| 6 | +import com.bsth.data.Station2ParkBuffer; | ||
| 7 | import com.bsth.entity.Line; | 7 | import com.bsth.entity.Line; |
| 8 | +import com.bsth.entity.realcontrol.StationToPark; | ||
| 9 | +import com.google.common.base.Splitter; | ||
| 8 | import com.google.common.collect.ArrayListMultimap; | 10 | import com.google.common.collect.ArrayListMultimap; |
| 11 | +import com.google.common.collect.BiMap; | ||
| 9 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.web.bind.annotation.RequestMapping; | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
| 13 | import org.springframework.web.bind.annotation.RequestMethod; | 16 | import org.springframework.web.bind.annotation.RequestMethod; |
| 17 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
| 15 | 19 | ||
| 16 | import java.util.*; | 20 | import java.util.*; |
| @@ -26,6 +30,9 @@ public class BasicDataController { | @@ -26,6 +30,9 @@ public class BasicDataController { | ||
| 26 | BasicData basicData; | 30 | BasicData basicData; |
| 27 | 31 | ||
| 28 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 32 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + Station2ParkBuffer station2ParkBuffer; | ||
| 29 | 36 | ||
| 30 | @RequestMapping("/cars") | 37 | @RequestMapping("/cars") |
| 31 | public Iterable<String> findAllNbbm(Map<String, Object> map){ | 38 | public Iterable<String> findAllNbbm(Map<String, Object> map){ |
| @@ -52,16 +59,16 @@ public class BasicDataController { | @@ -52,16 +59,16 @@ public class BasicDataController { | ||
| 52 | return rs; | 59 | return rs; |
| 53 | } | 60 | } |
| 54 | 61 | ||
| 55 | - @RequestMapping("/personnel") | 62 | + /*@RequestMapping("/personnel") |
| 56 | public Map<String, Object> findPersonnelInfo(){ | 63 | public Map<String, Object> findPersonnelInfo(){ |
| 57 | Map<String, Object> rs = new HashMap<>(); | 64 | Map<String, Object> rs = new HashMap<>(); |
| 58 | PersonnelFieldFilter filter=new PersonnelFieldFilter(); | 65 | PersonnelFieldFilter filter=new PersonnelFieldFilter(); |
| 59 | //驾驶员 | 66 | //驾驶员 |
| 60 | rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | 67 | rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); |
| 61 | //售票员 | 68 | //售票员 |
| 62 | - rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter))); | 69 | + rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));*//* |
| 63 | return rs; | 70 | return rs; |
| 64 | - } | 71 | + }*/ |
| 65 | 72 | ||
| 66 | @RequestMapping("/all_personnel") | 73 | @RequestMapping("/all_personnel") |
| 67 | public Map<String, String> all_personnel(){ | 74 | public Map<String, String> all_personnel(){ |
| @@ -145,4 +152,54 @@ public class BasicDataController { | @@ -145,4 +152,54 @@ public class BasicDataController { | ||
| 145 | } | 152 | } |
| 146 | return listMultimap.asMap(); | 153 | return listMultimap.asMap(); |
| 147 | } | 154 | } |
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * 获取车辆信息 | ||
| 158 | + * @return | ||
| 159 | + */ | ||
| 160 | + @RequestMapping("/ccInfo/lineArray") | ||
| 161 | + public List<Map<String, String>> ccInfoByLine(@RequestParam String idx){ | ||
| 162 | + List<String> lines = Splitter.on(",").splitToList(idx); | ||
| 163 | + List<Map<String, String>> rs = new ArrayList<>(); | ||
| 164 | + Map<String, String> map; | ||
| 165 | + | ||
| 166 | + //ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | ||
| 167 | + Set<String> ks = BasicData.nbbm2LineMap.keySet(); | ||
| 168 | + BiMap<String,String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse(); | ||
| 169 | + | ||
| 170 | + Line line; | ||
| 171 | + for(String nbbm : ks){ | ||
| 172 | + line = BasicData.nbbm2LineMap.get(nbbm); | ||
| 173 | + if(lines.contains(line.getLineCode())){ | ||
| 174 | + map = new HashMap<>(); | ||
| 175 | + map.put("nbbm", nbbm); | ||
| 176 | + map.put("deviceId", nbbm2deviceMap.get(nbbm)); | ||
| 177 | + map.put("lineName", line.getName()); | ||
| 178 | + map.put("lineCode", line.getLineCode()); | ||
| 179 | + rs.add(map); | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + return rs; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * 获取站点和停车场历时公里对照表 | ||
| 187 | + * @param idx | ||
| 188 | + * @return | ||
| 189 | + */ | ||
| 190 | + @RequestMapping("/station2ParkData") | ||
| 191 | + public Map<String, Collection<StationToPark>> findStation2ParkData(@RequestParam String idx){ | ||
| 192 | + List<String> lines = Splitter.on(",").splitToList(idx); | ||
| 193 | + ArrayListMultimap<String, StationToPark> rs = ArrayListMultimap.create(); | ||
| 194 | + | ||
| 195 | + for(String lineCode : lines){ | ||
| 196 | + rs.putAll(lineCode, Station2ParkBuffer.get(lineCode)); | ||
| 197 | + } | ||
| 198 | + return rs.asMap(); | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + @RequestMapping(value = "/deleteStation2Park", method = RequestMethod.POST) | ||
| 202 | + public Map<String, Object> deleteStation2Park(@RequestParam String lineCode,@RequestParam Integer id){ | ||
| 203 | + return station2ParkBuffer.delete(lineCode, id); | ||
| 204 | + } | ||
| 148 | } | 205 | } |
src/main/java/com/bsth/controller/realcontrol/ChildTaskPlanController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 5 | +import com.bsth.service.realcontrol.ChildTaskPlanService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 3 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 4 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 11 | ||
| 6 | -import com.bsth.controller.BaseController; | ||
| 7 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | 12 | +import java.util.Map; |
| 8 | 13 | ||
| 9 | @RestController | 14 | @RestController |
| 10 | @RequestMapping("/childTask") | 15 | @RequestMapping("/childTask") |
| 11 | public class ChildTaskPlanController extends BaseController<ChildTaskPlan, Long>{ | 16 | public class ChildTaskPlanController extends BaseController<ChildTaskPlan, Long>{ |
| 12 | 17 | ||
| 18 | + @Autowired | ||
| 19 | + ChildTaskPlanService childTaskPlanService; | ||
| 20 | + | ||
| 21 | + @RequestMapping(value = "history", method = RequestMethod.POST) | ||
| 22 | + public Map<String, Object> saveHistory(ChildTaskPlan childTask){ | ||
| 23 | + return childTaskPlanService.saveHistory(childTask); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE) | ||
| 27 | + public Map<String, Object> delHistory(@PathVariable("id") Long id){ | ||
| 28 | + return childTaskPlanService.delHistory(id); | ||
| 29 | + } | ||
| 13 | } | 30 | } |
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| @@ -101,4 +101,14 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | @@ -101,4 +101,14 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | ||
| 101 | //System.out.println(map); | 101 | //System.out.println(map); |
| 102 | return lineConfigService.yjtkSet(map); | 102 | return lineConfigService.yjtkSet(map); |
| 103 | } | 103 | } |
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 修改场既是站的 停车场 和 站点 | ||
| 107 | + * @param map | ||
| 108 | + * @return | ||
| 109 | + */ | ||
| 110 | + @RequestMapping(value = "/parkAndStationSet", method = RequestMethod.POST) | ||
| 111 | + public Map<String, Object> parkAndStationSet(@RequestParam Map<String, String> map){ | ||
| 112 | + return lineConfigService.parkAndStationSet(map); | ||
| 113 | + } | ||
| 104 | } | 114 | } |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
| @@ -45,8 +45,8 @@ public class RealMapController { | @@ -45,8 +45,8 @@ public class RealMapController { | ||
| 45 | * @Description: TODO(获取线路的站点,路段路由) | 45 | * @Description: TODO(获取线路的站点,路段路由) |
| 46 | */ | 46 | */ |
| 47 | @RequestMapping(value = "/findRouteByLine") | 47 | @RequestMapping(value = "/findRouteByLine") |
| 48 | - public Map<String, Object> findRouteByLine(@RequestParam String lineCode) { | ||
| 49 | - return realMapService.findRouteByLine(lineCode); | 48 | + public Map<String, Object> findRouteByLine(@RequestParam String idx) { |
| 49 | + return realMapService.findRouteByLine(idx); | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | @RequestMapping(value = "/multiRouteByLine") | 52 | @RequestMapping(value = "/multiRouteByLine") |
src/main/java/com/bsth/controller/realcontrol/SchEditInfoController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo; | ||
| 5 | +import com.bsth.data.schedule.edit_logs.service.SchEditInfoService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 班次修正记录 | ||
| 16 | + * Created by panzhao on 2017/5/22. | ||
| 17 | + */ | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("schEditInfo") | ||
| 20 | +public class SchEditInfoController extends BaseController<SchEditInfo, Long>{ | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + SchEditInfoService editInfoService; | ||
| 24 | + | ||
| 25 | + @RequestMapping(value = "/_list", method = RequestMethod.GET) | ||
| 26 | + public Map<String, Object> _list(@RequestParam String rq, @RequestParam String lineCode,@RequestParam Map<String, String> map) { | ||
| 27 | + return editInfoService._list(rq, lineCode, map); | ||
| 28 | + } | ||
| 29 | +} |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -7,6 +7,7 @@ import com.bsth.controller.realcontrol.dto.ChangePersonCar; | @@ -7,6 +7,7 @@ import com.bsth.controller.realcontrol.dto.ChangePersonCar; | ||
| 7 | import com.bsth.controller.realcontrol.dto.DfsjChange; | 7 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 8 | import com.bsth.data.BasicData; | 8 | import com.bsth.data.BasicData; |
| 9 | import com.bsth.data.schedule.DayOfSchedule; | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 10 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | ||
| 10 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 11 | import com.bsth.entity.schedule.SchedulePlanInfo; | 12 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 12 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 13 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| @@ -24,10 +25,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -24,10 +25,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 24 | 25 | ||
| 25 | /*@Autowired | 26 | /*@Autowired |
| 26 | GetSchedulePlanThread getSchedulePlanThread;*/ | 27 | GetSchedulePlanThread getSchedulePlanThread;*/ |
| 27 | - | 28 | + |
| 28 | @Autowired | 29 | @Autowired |
| 29 | ScheduleRealInfoService scheduleRealInfoService; | 30 | ScheduleRealInfoService scheduleRealInfoService; |
| 30 | - | 31 | + |
| 31 | @Autowired | 32 | @Autowired |
| 32 | DayOfSchedule dayOfSchedule; | 33 | DayOfSchedule dayOfSchedule; |
| 33 | 34 | ||
| @@ -42,29 +43,30 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -42,29 +43,30 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | /** | 45 | /** |
| 45 | - * | 46 | + * |
| 46 | * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id | 47 | * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id |
| 47 | * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws | 48 | * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws |
| 48 | */ | 49 | */ |
| 49 | @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) | 50 | @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) |
| 50 | public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, | 51 | public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, |
| 51 | - @RequestParam String dfsj,String bcType) { | ||
| 52 | - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType); | 52 | + @RequestParam String dfsj,String bcType, |
| 53 | + @RequestParam(defaultValue = "") String opType) { | ||
| 54 | + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType); | ||
| 53 | } | 55 | } |
| 54 | 56 | ||
| 55 | /** | 57 | /** |
| 56 | - * | 58 | + * |
| 57 | * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔 | 59 | * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔 |
| 58 | */ | 60 | */ |
| 59 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) | 61 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) |
| 60 | public Map<String, Object> destroy(@RequestParam String idsStr | 62 | public Map<String, Object> destroy(@RequestParam String idsStr |
| 61 | /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, | 63 | /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, |
| 62 | - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { | 64 | + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { |
| 63 | return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/); | 65 | return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/); |
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | /** | 68 | /** |
| 67 | - * | 69 | + * |
| 68 | * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws | 70 | * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws |
| 69 | */ | 71 | */ |
| 70 | @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET) | 72 | @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET) |
| @@ -73,7 +75,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -73,7 +75,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | /** | 77 | /** |
| 76 | - * | 78 | + * |
| 77 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param | 79 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param |
| 78 | * lineId @throws | 80 | * lineId @throws |
| 79 | */ | 81 | */ |
| @@ -83,7 +85,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -83,7 +85,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 83 | } | 85 | } |
| 84 | 86 | ||
| 85 | /** | 87 | /** |
| 86 | - * | 88 | + * |
| 87 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param | 89 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param |
| 88 | * lineId @throws | 90 | * lineId @throws |
| 89 | */ | 91 | */ |
| @@ -93,7 +95,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -93,7 +95,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 93 | } | 95 | } |
| 94 | 96 | ||
| 95 | /** | 97 | /** |
| 96 | - * | 98 | + * |
| 97 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param | 99 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param |
| 98 | * lineId @throws | 100 | * lineId @throws |
| 99 | */ | 101 | */ |
| @@ -103,7 +105,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -103,7 +105,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | /** | 107 | /** |
| 106 | - * | 108 | + * |
| 107 | * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws | 109 | * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws |
| 108 | */ | 110 | */ |
| 109 | @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET) | 111 | @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET) |
| @@ -111,9 +113,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -111,9 +113,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 111 | return scheduleRealInfoService.sreachVehic(nbbm); | 113 | return scheduleRealInfoService.sreachVehic(nbbm); |
| 112 | } | 114 | } |
| 113 | /** | 115 | /** |
| 114 | - * | ||
| 115 | - * @Title: realOutAdjust | ||
| 116 | - * @Description: TODO(实发调整) | 116 | + * |
| 117 | + * @Title: realOutAdjust | ||
| 118 | + * @Description: TODO(实发调整) | ||
| 117 | * @param @param id 班次ID | 119 | * @param @param id 班次ID |
| 118 | * @param @param fcsjActual 实际发车时间 HH:mm | 120 | * @param @param fcsjActual 实际发车时间 HH:mm |
| 119 | * @param @param remarks 备注 | 121 | * @param @param remarks 备注 |
| @@ -121,14 +123,14 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -121,14 +123,14 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 121 | */ | 123 | */ |
| 122 | @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) | 124 | @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) |
| 123 | public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual, | 125 | public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual, |
| 124 | - @RequestParam String remarks) { | 126 | + @RequestParam String remarks) { |
| 125 | return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); | 127 | return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); |
| 126 | } | 128 | } |
| 127 | - | 129 | + |
| 128 | /** | 130 | /** |
| 129 | - * | ||
| 130 | - * @Title: revokeDestroy | ||
| 131 | - * @Description: TODO(撤销烂班) | 131 | + * |
| 132 | + * @Title: revokeDestroy | ||
| 133 | + * @Description: TODO(撤销烂班) | ||
| 132 | * @param @param id | 134 | * @param @param id |
| 133 | * @throws | 135 | * @throws |
| 134 | */ | 136 | */ |
| @@ -136,11 +138,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -136,11 +138,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 136 | public Map<String, Object> revokeDestroy(@RequestParam Long id){ | 138 | public Map<String, Object> revokeDestroy(@RequestParam Long id){ |
| 137 | return scheduleRealInfoService.revokeDestroy(id); | 139 | return scheduleRealInfoService.revokeDestroy(id); |
| 138 | } | 140 | } |
| 139 | - | 141 | + |
| 140 | /** | 142 | /** |
| 141 | - * | ||
| 142 | - * @Title: revokeRealOutgo | ||
| 143 | - * @Description: TODO(撤销实发) | 143 | + * |
| 144 | + * @Title: revokeRealOutgo | ||
| 145 | + * @Description: TODO(撤销实发) | ||
| 144 | * @param @param id | 146 | * @param @param id |
| 145 | * @throws | 147 | * @throws |
| 146 | */ | 148 | */ |
| @@ -160,9 +162,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -160,9 +162,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | /** | 164 | /** |
| 163 | - * | ||
| 164 | - * @Title: spaceAdjust | ||
| 165 | - * @Description: TODO(间隔调整) | 165 | + * |
| 166 | + * @Title: spaceAdjust | ||
| 167 | + * @Description: TODO(间隔调整) | ||
| 166 | * @param @param ids 要调整的班次数组ID | 168 | * @param @param ids 要调整的班次数组ID |
| 167 | * @param @param space 间隔 | 169 | * @param @param space 间隔 |
| 168 | * @throws | 170 | * @throws |
| @@ -171,11 +173,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -171,11 +173,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 171 | public Map<String, Object> spaceAdjust(Long[] ids, Integer space){ | 173 | public Map<String, Object> spaceAdjust(Long[] ids, Integer space){ |
| 172 | return scheduleRealInfoService.spaceAdjust(ids, space); | 174 | return scheduleRealInfoService.spaceAdjust(ids, space); |
| 173 | } | 175 | } |
| 174 | - | 176 | + |
| 175 | /** | 177 | /** |
| 176 | - * | ||
| 177 | - * @Title: schInfoFineTune | ||
| 178 | - * @Description: TODO(发车信息微调) | 178 | + * |
| 179 | + * @Title: schInfoFineTune | ||
| 180 | + * @Description: TODO(发车信息微调) | ||
| 179 | * @param @param map | 181 | * @param @param map |
| 180 | * @throws | 182 | * @throws |
| 181 | */ | 183 | */ |
| @@ -183,11 +185,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -183,11 +185,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 183 | public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){ | 185 | public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){ |
| 184 | return scheduleRealInfoService.schInfoFineTune(map); | 186 | return scheduleRealInfoService.schInfoFineTune(map); |
| 185 | } | 187 | } |
| 186 | - | 188 | + |
| 187 | /** | 189 | /** |
| 188 | - * | ||
| 189 | - * @Title: outgoAdjustAll | ||
| 190 | - * @Description: TODO(批量待发调整) | 190 | + * |
| 191 | + * @Title: outgoAdjustAll | ||
| 192 | + * @Description: TODO(批量待发调整) | ||
| 191 | * @param @param list | 193 | * @param @param list |
| 192 | * @throws | 194 | * @throws |
| 193 | */ | 195 | */ |
| @@ -197,11 +199,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -197,11 +199,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 197 | params = StringEscapeUtils.unescapeHtml4(params); | 199 | params = StringEscapeUtils.unescapeHtml4(params); |
| 198 | return scheduleRealInfoService.outgoAdjustAll(params); | 200 | return scheduleRealInfoService.outgoAdjustAll(params); |
| 199 | } | 201 | } |
| 200 | - | 202 | + |
| 201 | /** | 203 | /** |
| 202 | - * | ||
| 203 | - * @Title: findByLineAndUpDown | ||
| 204 | - * @Description: TODO(根据线路和走向获取班次) | 204 | + * |
| 205 | + * @Title: findByLineAndUpDown | ||
| 206 | + * @Description: TODO(根据线路和走向获取班次) | ||
| 205 | * @param @param line | 207 | * @param @param line |
| 206 | * @param @param upDown | 208 | * @param @param upDown |
| 207 | */ | 209 | */ |
| @@ -209,11 +211,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -209,11 +211,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 209 | public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){ | 211 | public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){ |
| 210 | return dayOfSchedule.findByLineAndUpDown(line, upDown); | 212 | return dayOfSchedule.findByLineAndUpDown(line, upDown); |
| 211 | } | 213 | } |
| 212 | - | 214 | + |
| 213 | /** | 215 | /** |
| 214 | - * | ||
| 215 | - * @Title: findRouteByLine | ||
| 216 | - * @Description: TODO(获取线路的站点,路段路由) | 216 | + * |
| 217 | + * @Title: findRouteByLine | ||
| 218 | + * @Description: TODO(获取线路的站点,路段路由) | ||
| 217 | * @param @param lineCode | 219 | * @param @param lineCode |
| 218 | * @throws | 220 | * @throws |
| 219 | */ | 221 | */ |
| @@ -221,11 +223,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -221,11 +223,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 221 | public Map<String, Object> findRouteByLine(@RequestParam String lineCode){ | 223 | public Map<String, Object> findRouteByLine(@RequestParam String lineCode){ |
| 222 | return scheduleRealInfoService.findRouteByLine(lineCode); | 224 | return scheduleRealInfoService.findRouteByLine(lineCode); |
| 223 | } | 225 | } |
| 224 | - | 226 | + |
| 225 | /** | 227 | /** |
| 226 | - * | ||
| 227 | - * @Title: removeChildTask | ||
| 228 | - * @Description: TODO(删除子任务) | 228 | + * |
| 229 | + * @Title: removeChildTask | ||
| 230 | + * @Description: TODO(删除子任务) | ||
| 229 | * @param @param taskId 子任务ID | 231 | * @param @param taskId 子任务ID |
| 230 | * @throws | 232 | * @throws |
| 231 | */ | 233 | */ |
| @@ -235,9 +237,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -235,9 +237,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 235 | } | 237 | } |
| 236 | 238 | ||
| 237 | /** | 239 | /** |
| 238 | - * | ||
| 239 | - * @Title: findByLineCode | ||
| 240 | - * @Description: TODO(根据线路获取班次信息) | 240 | + * |
| 241 | + * @Title: findByLineCode | ||
| 242 | + * @Description: TODO(根据线路获取班次信息) | ||
| 241 | * @param @param lineCode | 243 | * @param @param lineCode |
| 242 | */ | 244 | */ |
| 243 | @RequestMapping(value = "/lineCode/{lineCode}") | 245 | @RequestMapping(value = "/lineCode/{lineCode}") |
| @@ -247,29 +249,29 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -247,29 +249,29 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 247 | 249 | ||
| 248 | @RequestMapping(value = "/queryUserInfo") | 250 | @RequestMapping(value = "/queryUserInfo") |
| 249 | public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, | 251 | public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, |
| 250 | - @RequestParam String date,@RequestParam String state) { | 252 | + @RequestParam String date,@RequestParam String state) { |
| 251 | return scheduleRealInfoService.queryUserInfo(line, date,state); | 253 | return scheduleRealInfoService.queryUserInfo(line, date,state); |
| 252 | } | 254 | } |
| 253 | - | 255 | + |
| 254 | @RequestMapping(value = "/queryUserInfoPx") | 256 | @RequestMapping(value = "/queryUserInfoPx") |
| 255 | public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line, | 257 | public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line, |
| 256 | - @RequestParam String date,@RequestParam String state,@RequestParam String type) { | 258 | + @RequestParam String date,@RequestParam String state,@RequestParam String type) { |
| 257 | return scheduleRealInfoService.queryUserInfoPx(line, date,state,type); | 259 | return scheduleRealInfoService.queryUserInfoPx(line, date,state,type); |
| 258 | } | 260 | } |
| 259 | 261 | ||
| 260 | @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET) | 262 | @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET) |
| 261 | public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh, | 263 | public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh, |
| 262 | - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { | 264 | + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { |
| 263 | return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line); | 265 | return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line); |
| 264 | } | 266 | } |
| 265 | - | 267 | + |
| 266 | @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET) | 268 | @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET) |
| 267 | public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh | 269 | public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh |
| 268 | ,@RequestParam String date,@RequestParam String line) { | 270 | ,@RequestParam String date,@RequestParam String line) { |
| 269 | return scheduleRealInfoService.exportWaybillQp( clZbh, date,line); | 271 | return scheduleRealInfoService.exportWaybillQp( clZbh, date,line); |
| 270 | } | 272 | } |
| 271 | 273 | ||
| 272 | - | 274 | + |
| 273 | @RequestMapping(value = "/dailyInfo") | 275 | @RequestMapping(value = "/dailyInfo") |
| 274 | public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) { | 276 | public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) { |
| 275 | return scheduleRealInfoService.dailyInfo(line, date, type); | 277 | return scheduleRealInfoService.dailyInfo(line, date, type); |
| @@ -277,42 +279,65 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -277,42 +279,65 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 277 | 279 | ||
| 278 | @RequestMapping(value = "/historyMessage") | 280 | @RequestMapping(value = "/historyMessage") |
| 279 | public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date, | 281 | public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date, |
| 280 | - @RequestParam String code, @RequestParam String type) { | 282 | + @RequestParam String code, @RequestParam String type) { |
| 281 | return scheduleRealInfoService.historyMessage(line, date, code, type); | 283 | return scheduleRealInfoService.historyMessage(line, date, code, type); |
| 282 | } | 284 | } |
| 283 | - | 285 | + |
| 284 | @RequestMapping(value="/findLine") | 286 | @RequestMapping(value="/findLine") |
| 285 | public List<Map<String,String>> findLine(@RequestParam String line){ | 287 | public List<Map<String,String>> findLine(@RequestParam String line){ |
| 286 | return scheduleRealInfoService.findLine(line); | 288 | return scheduleRealInfoService.findLine(line); |
| 287 | } | 289 | } |
| 288 | - | 290 | + |
| 289 | @RequestMapping(value="/findKMBC",method = RequestMethod.GET) | 291 | @RequestMapping(value="/findKMBC",method = RequestMethod.GET) |
| 290 | public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | 292 | public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName |
| 291 | ,@RequestParam String date,@RequestParam String line){ | 293 | ,@RequestParam String date,@RequestParam String line){ |
| 292 | return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line); | 294 | return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line); |
| 293 | } | 295 | } |
| 294 | - | 296 | + |
| 297 | + /** | ||
| 298 | + * 路单公里统计 (闵行审计专用) | ||
| 299 | + * @param jGh | ||
| 300 | + * @param clZbh | ||
| 301 | + * @param lpName | ||
| 302 | + * @param date | ||
| 303 | + * @param line | ||
| 304 | + * @return | ||
| 305 | + */ | ||
| 306 | + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET) | ||
| 307 | + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | ||
| 308 | + ,@RequestParam String date,@RequestParam String line){ | ||
| 309 | + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line); | ||
| 310 | + } | ||
| 311 | + | ||
| 295 | @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET) | 312 | @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET) |
| 296 | public Map<String,Object> findKMBCQp(@RequestParam String clZbh | 313 | public Map<String,Object> findKMBCQp(@RequestParam String clZbh |
| 297 | ,@RequestParam String date,@RequestParam String line){ | 314 | ,@RequestParam String date,@RequestParam String line){ |
| 298 | return scheduleRealInfoService.findKMBCQp(clZbh,date,line); | 315 | return scheduleRealInfoService.findKMBCQp(clZbh,date,line); |
| 299 | } | 316 | } |
| 300 | - | 317 | + |
| 301 | @RequestMapping(value="/findLpName") | 318 | @RequestMapping(value="/findLpName") |
| 302 | public List<Map<String,String>> findLpName(@RequestParam String lpName){ | 319 | public List<Map<String,String>> findLpName(@RequestParam String lpName){ |
| 303 | return scheduleRealInfoService.findLpName(lpName); | 320 | return scheduleRealInfoService.findLpName(lpName); |
| 304 | } | 321 | } |
| 305 | - | 322 | + |
| 306 | @RequestMapping(value = "/account") | 323 | @RequestMapping(value = "/account") |
| 307 | public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date, | 324 | public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date, |
| 308 | - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { | 325 | + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { |
| 309 | return scheduleRealInfoService.account(line, date, code, xlName, type); | 326 | return scheduleRealInfoService.account(line, date, code, xlName, type); |
| 310 | } | 327 | } |
| 311 | 328 | ||
| 329 | + @RequestMapping(value = "/accountPx") | ||
| 330 | + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date, | ||
| 331 | + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) { | ||
| 332 | + return scheduleRealInfoService.accountPx(line, date, code, xlName, px); | ||
| 333 | + } | ||
| 334 | + | ||
| 312 | @RequestMapping(value = "/correctForm") | 335 | @RequestMapping(value = "/correctForm") |
| 313 | - public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate, | ||
| 314 | - @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) { | ||
| 315 | - return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type); | 336 | + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, |
| 337 | + @RequestParam String endDate, | ||
| 338 | + @RequestParam String lpName, @RequestParam String code, | ||
| 339 | + @RequestParam String type,@RequestParam String changType) { | ||
| 340 | + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType); | ||
| 316 | } | 341 | } |
| 317 | /** | 342 | /** |
| 318 | * @Title queryListWaybill | 343 | * @Title queryListWaybill |
| @@ -327,19 +352,39 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -327,19 +352,39 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 327 | ,@RequestParam String date,@RequestParam String line){ | 352 | ,@RequestParam String date,@RequestParam String line){ |
| 328 | return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line); | 353 | return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line); |
| 329 | } | 354 | } |
| 330 | - | 355 | + |
| 356 | + /** | ||
| 357 | + * @Title queryListWaybill | ||
| 358 | + * @Description 查询行车路单列表(闵行审计专用路单) | ||
| 359 | + * @param jName 驾驶员名字 | ||
| 360 | + * @param clZbh 车辆自编号(内部编号) | ||
| 361 | + * @param lpName 路牌 | ||
| 362 | + * @return | ||
| 363 | + */ | ||
| 364 | + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET) | ||
| 365 | + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName | ||
| 366 | + ,@RequestParam String date,@RequestParam String line){ | ||
| 367 | + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line); | ||
| 368 | + } | ||
| 369 | + | ||
| 331 | @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET) | 370 | @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET) |
| 332 | public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh, | 371 | public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh, |
| 333 | - @RequestParam String date,@RequestParam String line){ | 372 | + @RequestParam String date,@RequestParam String line){ |
| 334 | return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line); | 373 | return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line); |
| 335 | } | 374 | } |
| 336 | - | 375 | + |
| 337 | @RequestMapping(value="/statisticsDaily") | 376 | @RequestMapping(value="/statisticsDaily") |
| 338 | public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date, | 377 | public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date, |
| 339 | - @RequestParam String xlName, @RequestParam String type){ | 378 | + @RequestParam String xlName, @RequestParam String type){ |
| 340 | return scheduleRealInfoService.statisticsDaily(line, date, xlName, type); | 379 | return scheduleRealInfoService.statisticsDaily(line, date, xlName, type); |
| 341 | } | 380 | } |
| 342 | - | 381 | + |
| 382 | + @RequestMapping(value="/statisticsDaily_mh_2") | ||
| 383 | + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date, | ||
| 384 | + @RequestParam String xlName, @RequestParam String type){ | ||
| 385 | + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type); | ||
| 386 | + } | ||
| 387 | + | ||
| 343 | @RequestMapping(value="/statisticsDailyTj") | 388 | @RequestMapping(value="/statisticsDailyTj") |
| 344 | public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | 389 | public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ |
| 345 | String gsdm=""; | 390 | String gsdm=""; |
| @@ -372,41 +417,46 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -372,41 +417,46 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 372 | } | 417 | } |
| 373 | return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); | 418 | return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); |
| 374 | } | 419 | } |
| 375 | - | 420 | + |
| 376 | @RequestMapping(value="/MapById",method = RequestMethod.GET) | 421 | @RequestMapping(value="/MapById",method = RequestMethod.GET) |
| 377 | public Map<String, Object> MapById(@RequestParam("id") Long id){ | 422 | public Map<String, Object> MapById(@RequestParam("id") Long id){ |
| 378 | return scheduleRealInfoService.MapById(id); | 423 | return scheduleRealInfoService.MapById(id); |
| 379 | } | 424 | } |
| 380 | - | 425 | + |
| 381 | /** | 426 | /** |
| 382 | - * @Title: scheduleDaily | ||
| 383 | - * @Description: TODO(调度日报表) | 427 | + * @Title: scheduleDaily |
| 428 | + * @Description: TODO(调度日报表) | ||
| 384 | * @param line 线路 | 429 | * @param line 线路 |
| 385 | * @param date 时间 | 430 | * @param date 时间 |
| 386 | - * @return | 431 | + * @return |
| 387 | */ | 432 | */ |
| 388 | @RequestMapping(value="/scheduleDaily") | 433 | @RequestMapping(value="/scheduleDaily") |
| 389 | public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){ | 434 | public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){ |
| 390 | return scheduleRealInfoService.scheduleDaily(line,date); | 435 | return scheduleRealInfoService.scheduleDaily(line,date); |
| 391 | } | 436 | } |
| 392 | - | 437 | + |
| 393 | @RequestMapping(value="/realScheduleList") | 438 | @RequestMapping(value="/realScheduleList") |
| 394 | public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){ | 439 | public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){ |
| 395 | return scheduleRealInfoService.realScheduleList(line,date); | 440 | return scheduleRealInfoService.realScheduleList(line,date); |
| 396 | } | 441 | } |
| 397 | - | 442 | + |
| 443 | + @RequestMapping(value="/realScheduleList_mh_2") | ||
| 444 | + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){ | ||
| 445 | + return scheduleRealInfoService.realScheduleList_mh_2(line,date); | ||
| 446 | + } | ||
| 447 | + | ||
| 398 | @RequestMapping(value="/realScheduleListQp") | 448 | @RequestMapping(value="/realScheduleListQp") |
| 399 | public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){ | 449 | public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){ |
| 400 | return scheduleRealInfoService.realScheduleListQp(line,date); | 450 | return scheduleRealInfoService.realScheduleListQp(line,date); |
| 401 | } | 451 | } |
| 402 | - | 452 | + |
| 403 | @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST) | 453 | @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST) |
| 404 | public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ | 454 | public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ |
| 405 | cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); | 455 | cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); |
| 406 | List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); | 456 | List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); |
| 407 | return scheduleRealInfoService.multi_tzrc(cpcs); | 457 | return scheduleRealInfoService.multi_tzrc(cpcs); |
| 408 | } | 458 | } |
| 409 | - | 459 | + |
| 410 | @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) | 460 | @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) |
| 411 | public Map<String, Object> multi_dftz(@RequestParam String dcsJson){ | 461 | public Map<String, Object> multi_dftz(@RequestParam String dcsJson){ |
| 412 | dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson); | 462 | dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson); |
| @@ -419,10 +469,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -419,10 +469,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 419 | return scheduleRealInfoService.changeBcType(id, bcType, remarks); | 469 | return scheduleRealInfoService.changeBcType(id, bcType, remarks); |
| 420 | } | 470 | } |
| 421 | 471 | ||
| 422 | -/* @RequestMapping(value="/history", method=RequestMethod.POST) | 472 | + @RequestMapping(value="/history", method=RequestMethod.POST) |
| 423 | public Map<String,Object> historySave(ScheduleRealInfo sch){ | 473 | public Map<String,Object> historySave(ScheduleRealInfo sch){ |
| 424 | return scheduleRealInfoService.historySave(sch); | 474 | return scheduleRealInfoService.historySave(sch); |
| 425 | - }*/ | 475 | + } |
| 426 | 476 | ||
| 427 | 477 | ||
| 428 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | 478 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); |
| @@ -432,11 +482,13 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -432,11 +482,13 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 432 | * @return | 482 | * @return |
| 433 | */ | 483 | */ |
| 434 | @RequestMapping("dateArray") | 484 | @RequestMapping("dateArray") |
| 435 | - public List<String> dateArray(){ | 485 | + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){ |
| 436 | List<String> rs = new ArrayList<>(); | 486 | List<String> rs = new ArrayList<>(); |
| 437 | 487 | ||
| 438 | - long t = new Date().getTime() - ONE_DAY; | ||
| 439 | - for(int i = 0; i < 5; i ++){ | 488 | + long t = new Date().getTime(); |
| 489 | + if(c != 1) | ||
| 490 | + t -= ONE_DAY - (1000 * 60 * 60 * 2); | ||
| 491 | + for(int i = 0; i < 3; i ++){ | ||
| 440 | rs.add(fmtyyyyMMdd.print(t)); | 492 | rs.add(fmtyyyyMMdd.print(t)); |
| 441 | t -= ONE_DAY; | 493 | t -= ONE_DAY; |
| 442 | } | 494 | } |
| @@ -467,7 +519,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -467,7 +519,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 467 | public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){ | 519 | public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){ |
| 468 | return scheduleRealInfoService.scheduleDailyExport(map); | 520 | return scheduleRealInfoService.scheduleDailyExport(map); |
| 469 | } | 521 | } |
| 470 | - | 522 | + |
| 471 | @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | 523 | @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) |
| 472 | public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | 524 | public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ |
| 473 | return scheduleRealInfoService.exportWaybillMore(map); | 525 | return scheduleRealInfoService.exportWaybillMore(map); |
| @@ -536,4 +588,24 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -536,4 +588,24 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 536 | public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ | 588 | public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ |
| 537 | return scheduleRealInfoService.allLate2(idx); | 589 | return scheduleRealInfoService.allLate2(idx); |
| 538 | } | 590 | } |
| 591 | + | ||
| 592 | + /** | ||
| 593 | + * 添加一个临加到历史库 | ||
| 594 | + * @param sch | ||
| 595 | + * @return | ||
| 596 | + */ | ||
| 597 | + @RequestMapping(value = "history/add", method = RequestMethod.POST) | ||
| 598 | + public Map<String, Object> addToHistory(ScheduleRealInfo sch){ | ||
| 599 | + return scheduleRealInfoService.addToHistory(sch); | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + /** | ||
| 603 | + * 从历史库里删除临加班次 | ||
| 604 | + * @param sch | ||
| 605 | + * @return | ||
| 606 | + */ | ||
| 607 | + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE) | ||
| 608 | + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ | ||
| 609 | + return scheduleRealInfoService.deleteToHistory(id); | ||
| 610 | + } | ||
| 539 | } | 611 | } |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.gpsdata.arrival.GeoCacheData; | ||
| 4 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | ||
| 5 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | ||
| 6 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 7 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 3 | import com.bsth.data.schedule.DayOfSchedule; | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 4 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 5 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| @@ -10,12 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -10,12 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | import org.springframework.web.bind.annotation.RequestParam; | 15 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | import org.springframework.web.bind.annotation.RestController; | 16 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 17 | ||
| 13 | -import java.util.HashSet; | 18 | +import java.util.HashMap; |
| 14 | import java.util.List; | 19 | import java.util.List; |
| 15 | -import java.util.Set; | 20 | +import java.util.Map; |
| 16 | 21 | ||
| 17 | /** | 22 | /** |
| 18 | - * 相关数据异常检测 | ||
| 19 | * Created by panzhao on 2017/4/14. | 23 | * Created by panzhao on 2017/4/14. |
| 20 | */ | 24 | */ |
| 21 | @RestController | 25 | @RestController |
| @@ -27,6 +31,10 @@ public class anomalyCheckController { | @@ -27,6 +31,10 @@ public class anomalyCheckController { | ||
| 27 | 31 | ||
| 28 | @Autowired | 32 | @Autowired |
| 29 | DayOfSchedule dayOfSchedule; | 33 | DayOfSchedule dayOfSchedule; |
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + GeoCacheData geoCacheData; | ||
| 37 | + | ||
| 30 | /** | 38 | /** |
| 31 | * 出现重复班次的车辆 | 39 | * 出现重复班次的车辆 |
| 32 | * @param nbbm | 40 | * @param nbbm |
| @@ -35,16 +43,56 @@ public class anomalyCheckController { | @@ -35,16 +43,56 @@ public class anomalyCheckController { | ||
| 35 | public void schRepeat(@RequestParam String nbbm){ | 43 | public void schRepeat(@RequestParam String nbbm){ |
| 36 | logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); | 44 | logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); |
| 37 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); | 45 | List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); |
| 46 | + logger.info("检测前,车辆班次数量:" + list.size()); | ||
| 38 | 47 | ||
| 39 | - Set<ScheduleRealInfo> set = new HashSet<>(); | 48 | + Map<Long, ScheduleRealInfo> map = new HashMap<>(); |
| 40 | for(ScheduleRealInfo sch : list){ | 49 | for(ScheduleRealInfo sch : list){ |
| 41 | - if(!set.add(sch)){ | ||
| 42 | - logger.info("出现一次重复班次,班次ID:" + sch.getId()); | 50 | + if(map.containsKey(sch.getId())){ |
| 51 | + logger.info("检测到重复ID: " + sch.getId()); | ||
| 43 | } | 52 | } |
| 53 | + map.put(sch.getId(), sch); | ||
| 44 | } | 54 | } |
| 45 | 55 | ||
| 46 | - if(set.size() > 0){ | ||
| 47 | - dayOfSchedule.replaceByNbbm(nbbm, set); | 56 | + logger.info("检测后,车辆班次数量:" + list.size()); |
| 57 | + if(map.values().size() > 0){ | ||
| 58 | + dayOfSchedule.replaceByNbbm(nbbm, map.values()); | ||
| 48 | } | 59 | } |
| 49 | } | 60 | } |
| 61 | + | ||
| 62 | + @RequestMapping(value = "/shutdownThreadPool") | ||
| 63 | + public void shutdownThreadPool(){ | ||
| 64 | + GpsRealAnalyse.shutdown(); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @RequestMapping(value = "/directivePushQueue") | ||
| 68 | + public void directivePushQueue(){ | ||
| 69 | + DirectivePushQueue.start(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @RequestMapping(value = "/directiveQueueSize") | ||
| 73 | + public void directiveQueueSize(){ | ||
| 74 | + DirectivePushQueue.size(); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @RequestMapping(value = "/webSocketPushQueue") | ||
| 78 | + public void webSocketPushQueue(){ | ||
| 79 | + WebSocketPushQueue.start(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @RequestMapping(value = "/webSocketQueueSize") | ||
| 83 | + public void webSocketQueueSize(){ | ||
| 84 | + WebSocketPushQueue.size(); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @RequestMapping(value = "/setHttpFlag") | ||
| 88 | + public void setHttpFlag(@RequestParam int flag){ | ||
| 89 | + if(flag != 0 && flag != -1) | ||
| 90 | + return; | ||
| 91 | + GpsDataLoaderThread.setFlag(flag); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @RequestMapping(value = "/updateCacheBuff") | ||
| 95 | + public void updateCacheBuff(){ | ||
| 96 | + geoCacheData.loadData(); | ||
| 97 | + } | ||
| 50 | } | 98 | } |
src/main/java/com/bsth/controller/realcontrol/summary/HoursController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol.summary; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.data.summary.entity.Hours_jsy; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 汇总数据 -工时 | ||
| 10 | + * Created by panzhao on 2017/7/27. | ||
| 11 | + */ | ||
| 12 | +@RestController | ||
| 13 | +@RequestMapping("/summary/hours") | ||
| 14 | +public class HoursController extends BaseController<Hours_jsy, Long>{ | ||
| 15 | +} |
src/main/java/com/bsth/controller/report/ReportController.java
| @@ -6,12 +6,16 @@ import java.util.Iterator; | @@ -6,12 +6,16 @@ import java.util.Iterator; | ||
| 6 | import java.util.List; | 6 | import java.util.List; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | 8 | ||
| 9 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.web.bind.annotation.RequestMapping; | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | import org.springframework.web.bind.annotation.RequestMethod; | 12 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 15 | ||
| 16 | +import com.alibaba.fastjson.JSONArray; | ||
| 17 | +import com.alibaba.fastjson.JSONObject; | ||
| 18 | +import com.bsth.entity.StationRoute; | ||
| 15 | import com.bsth.entity.excep.ArrivalInfo; | 19 | import com.bsth.entity.excep.ArrivalInfo; |
| 16 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 20 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 17 | import com.bsth.service.report.ReportService; | 21 | import com.bsth.service.report.ReportService; |
| @@ -75,6 +79,17 @@ public class ReportController { | @@ -75,6 +79,17 @@ public class ReportController { | ||
| 75 | } | 79 | } |
| 76 | 80 | ||
| 77 | 81 | ||
| 82 | + @RequestMapping(value="/queryStrinon" ,method = RequestMethod.GET) | ||
| 83 | + public List<StationRoute> queryStrinon(@RequestParam String line, | ||
| 84 | + @RequestParam int zd){ | ||
| 85 | + return service.queryStrinon(line,zd); | ||
| 86 | + } | ||
| 87 | + @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET) | ||
| 88 | + public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line, | ||
| 89 | + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){ | ||
| 90 | + return service.queryInOutStrtion(line,date,zd,lzsj); | ||
| 91 | + } | ||
| 92 | + | ||
| 78 | @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) | 93 | @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) |
| 79 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, | 94 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, |
| 80 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ | 95 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ |
| @@ -84,6 +99,8 @@ public class ReportController { | @@ -84,6 +99,8 @@ public class ReportController { | ||
| 84 | 99 | ||
| 85 | 100 | ||
| 86 | 101 | ||
| 102 | + | ||
| 103 | + | ||
| 87 | @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET) | 104 | @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET) |
| 88 | public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line, | 105 | public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line, |
| 89 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ | 106 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ |
| @@ -96,6 +113,7 @@ public class ReportController { | @@ -96,6 +113,7 @@ public class ReportController { | ||
| 96 | Map<String, Object> m = new HashMap<String, Object>(); | 113 | Map<String, Object> m = new HashMap<String, Object>(); |
| 97 | m.put("i", i); | 114 | m.put("i", i); |
| 98 | m.put("nbbm", a.getNbbm()); | 115 | m.put("nbbm", a.getNbbm()); |
| 116 | + m.put("pzh", a.getPzh()); | ||
| 99 | m.put("stopName", a.getStopName()); | 117 | m.put("stopName", a.getStopName()); |
| 100 | m.put("jzsj", a.getJzsj()); | 118 | m.put("jzsj", a.getJzsj()); |
| 101 | m.put("czsj", a.getCzsj()); | 119 | m.put("czsj", a.getCzsj()); |
| @@ -171,8 +189,8 @@ public class ReportController { | @@ -171,8 +189,8 @@ public class ReportController { | ||
| 171 | return new ArrayList<Map<String, Object>>(); | 189 | return new ArrayList<Map<String, Object>>(); |
| 172 | } | 190 | } |
| 173 | @RequestMapping(value = "/sreachZd", method = RequestMethod.GET) | 191 | @RequestMapping(value = "/sreachZd", method = RequestMethod.GET) |
| 174 | - public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) { | ||
| 175 | - return service.sreachZd(line,zdlx, zd); | 192 | + public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx) { |
| 193 | + return service.sreachZd(line,zdlx); | ||
| 176 | } | 194 | } |
| 177 | 195 | ||
| 178 | 196 | ||
| @@ -246,4 +264,57 @@ public class ReportController { | @@ -246,4 +264,57 @@ public class ReportController { | ||
| 246 | return service.userList(map); | 264 | return service.userList(map); |
| 247 | } | 265 | } |
| 248 | 266 | ||
| 267 | + @RequestMapping(value="/countLineMileage") | ||
| 268 | + public List<Map<String,Object>> countLineMileage(@RequestParam Map<String, Object> map){ | ||
| 269 | + | ||
| 270 | + return service.countByList(map); | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + @RequestMapping(value="/countBusMileage") | ||
| 274 | + public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){ | ||
| 275 | + return service.countByBusList(map); | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + @RequestMapping(value="/countDjg") | ||
| 279 | + public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){ | ||
| 280 | + return service.countDjg(map); | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + | ||
| 284 | + @RequestMapping(value="/countDjgXx") | ||
| 285 | + public List<Map<String, Object>> countDjgXx(@RequestParam Map<String, Object> map){ | ||
| 286 | + List<Map<String, Object>> lMap=new ArrayList<Map<String, Object>>(); | ||
| 287 | + String json =StringEscapeUtils.unescapeHtml4(map.get("listXx").toString()); | ||
| 288 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 289 | + JSONObject jsonObject; | ||
| 290 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 291 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 292 | + Map<String, Object> m_=new HashMap<String,Object>(); | ||
| 293 | + m_.put("fgsname", jsonObject.getString("fgsname")); | ||
| 294 | + m_.put("xlName", jsonObject.getString("xlName")); | ||
| 295 | + m_.put("djgde", jsonObject.getString("djgde")); | ||
| 296 | + m_.put("qJh", jsonObject.getString("qJh")); | ||
| 297 | + m_.put("qSj", jsonObject.getString("qSj")); | ||
| 298 | + m_.put("hJh", jsonObject.getString("hJh")); | ||
| 299 | + m_.put("hSj", jsonObject.getString("hSj")); | ||
| 300 | + m_.put("djgsj", jsonObject.getString("djgsj")); | ||
| 301 | + m_.put("bcjgsj", jsonObject.getString("bcjgsj")); | ||
| 302 | + lMap.add(m_); | ||
| 303 | + } | ||
| 304 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 305 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 306 | + m.put("date", map.get("date").toString()); | ||
| 307 | + ReportUtils ee = new ReportUtils(); | ||
| 308 | + try { | ||
| 309 | + listI.add(lMap.iterator()); | ||
| 310 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 311 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/countIntervalXx.xls", | ||
| 312 | + path + "export/大间隔统计表详细.xls"); | ||
| 313 | + } catch (Exception e) { | ||
| 314 | + // TODO: handle exception | ||
| 315 | + e.printStackTrace(); | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + return lMap; | ||
| 319 | + } | ||
| 249 | } | 320 | } |
src/main/java/com/bsth/controller/report/SheetController.java
0 → 100644
| 1 | +package com.bsth.controller.report; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import com.bsth.controller.BaseController; | ||
| 13 | +import com.bsth.entity.sheet.Sheet; | ||
| 14 | +import com.bsth.service.report.SheetService; | ||
| 15 | + | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("sheet") | ||
| 18 | +public class SheetController extends BaseController<Sheet, Integer>{ | ||
| 19 | + @Autowired | ||
| 20 | + SheetService sheetService; | ||
| 21 | + @RequestMapping(value = "/saveListSheet",method = RequestMethod.POST) | ||
| 22 | + public String saveListSheet(@RequestParam String date){ | ||
| 23 | + String result=""; | ||
| 24 | + try { | ||
| 25 | + result = sheetService.saveSheetList(date); | ||
| 26 | + } catch (Exception e) { | ||
| 27 | + // TODO Auto-generated catch block | ||
| 28 | + e.printStackTrace(); | ||
| 29 | + } | ||
| 30 | + return result; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + @RequestMapping(value = "/sheetList",method = RequestMethod.GET) | ||
| 35 | + public List<Sheet> sheetList(@RequestParam Integer id){ | ||
| 36 | + List<Sheet> list=sheetService.sheetList(id); | ||
| 37 | + return list; | ||
| 38 | + } | ||
| 39 | + @RequestMapping(value = "/exportList",method = RequestMethod.GET) | ||
| 40 | + public List<Sheet> exportList(@RequestParam Integer id){ | ||
| 41 | + List<Sheet> list=sheetService.exportList(id); | ||
| 42 | + return list; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @RequestMapping(value = "/countList",method = RequestMethod.GET) | ||
| 46 | + public List<Map<String, Object>> countList(@RequestParam Map<String, Object> map){ | ||
| 47 | + List<Map<String, Object>> list=sheetService.countList(map); | ||
| 48 | + return list; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/listSheet",method = RequestMethod.GET) | ||
| 52 | + public List<Map<String, Object>> listSheet(@RequestParam Map<String, Object> map){ | ||
| 53 | + List<Map<String, Object>> list=sheetService.listSheet(map); | ||
| 54 | + return list; | ||
| 55 | + } | ||
| 56 | +} |
src/main/java/com/bsth/controller/schedule/BController.java
| @@ -6,11 +6,11 @@ import com.bsth.entity.schedule.BEntity; | @@ -6,11 +6,11 @@ import com.bsth.entity.schedule.BEntity; | ||
| 6 | import com.bsth.entity.sys.SysUser; | 6 | import com.bsth.entity.sys.SysUser; |
| 7 | import com.bsth.service.schedule.BService; | 7 | import com.bsth.service.schedule.BService; |
| 8 | import com.bsth.service.schedule.exception.ScheduleException; | 8 | import com.bsth.service.schedule.exception.ScheduleException; |
| 9 | +import com.bsth.service.schedule.utils.DataToolsFile; | ||
| 9 | import com.bsth.service.sys.SysUserService; | 10 | import com.bsth.service.sys.SysUserService; |
| 10 | import com.google.common.base.Splitter; | 11 | import com.google.common.base.Splitter; |
| 11 | -import jxl.Sheet; | ||
| 12 | -import jxl.Workbook; | ||
| 13 | import org.apache.commons.lang3.StringUtils; | 12 | import org.apache.commons.lang3.StringUtils; |
| 13 | +import org.apache.poi.ss.usermodel.Workbook; | ||
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.data.domain.PageRequest; | 15 | import org.springframework.data.domain.PageRequest; |
| 16 | import org.springframework.data.domain.Sort; | 16 | import org.springframework.data.domain.Sort; |
| @@ -154,20 +154,24 @@ public class BController<T, ID extends Serializable> { | @@ -154,20 +154,24 @@ public class BController<T, ID extends Serializable> { | ||
| 154 | public Map<String, Object> uploadFile(MultipartFile file) { | 154 | public Map<String, Object> uploadFile(MultipartFile file) { |
| 155 | Map<String, Object> rtn = new HashMap<>(); | 155 | Map<String, Object> rtn = new HashMap<>(); |
| 156 | try { | 156 | try { |
| 157 | - File file1 = bService.uploadFile(file.getOriginalFilename(), file.getBytes()); | 157 | + DataToolsFile dataToolsFile = bService.uploadFile(file.getOriginalFilename(), file.getBytes()); |
| 158 | // excel文件名 | 158 | // excel文件名 |
| 159 | - String fileName = file1.getAbsolutePath(); | 159 | + String fileName = dataToolsFile.getFile().getAbsolutePath(); |
| 160 | + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile()); | ||
| 161 | + | ||
| 160 | // excel文件sheet | 162 | // excel文件sheet |
| 161 | List<String> sheetnames = new ArrayList<>(); | 163 | List<String> sheetnames = new ArrayList<>(); |
| 162 | - Workbook book = Workbook.getWorkbook(file1); | ||
| 163 | - for (Sheet sheet : book.getSheets()) { | ||
| 164 | - sheetnames.add(sheet.getName()); | 164 | + for (int i = 0; i < wb.getNumberOfSheets(); i ++) { |
| 165 | + sheetnames.add(wb.getSheetAt(i).getSheetName()); | ||
| 165 | } | 166 | } |
| 166 | 167 | ||
| 168 | + wb.close(); | ||
| 169 | + | ||
| 167 | rtn.put("status", ResponseCode.SUCCESS); | 170 | rtn.put("status", ResponseCode.SUCCESS); |
| 168 | rtn.put("filename", fileName); | 171 | rtn.put("filename", fileName); |
| 169 | rtn.put("sheetnames", StringUtils.join(sheetnames, ",")); | 172 | rtn.put("sheetnames", StringUtils.join(sheetnames, ",")); |
| 170 | } catch (Exception exp) { | 173 | } catch (Exception exp) { |
| 174 | + exp.printStackTrace(); | ||
| 171 | rtn.put("status", ResponseCode.ERROR); | 175 | rtn.put("status", ResponseCode.ERROR); |
| 172 | rtn.put("msg", exp.getMessage()); | 176 | rtn.put("msg", exp.getMessage()); |
| 173 | } | 177 | } |
| @@ -202,13 +206,14 @@ public class BController<T, ID extends Serializable> { | @@ -202,13 +206,14 @@ public class BController<T, ID extends Serializable> { | ||
| 202 | Map<String, Object> rtn = new HashMap<>(); | 206 | Map<String, Object> rtn = new HashMap<>(); |
| 203 | 207 | ||
| 204 | try { | 208 | try { |
| 205 | - File file1 = bService.uploadFile(file.getOriginalFilename(), file.getBytes()); | 209 | + DataToolsFile dataToolsFile = bService.uploadFile(file.getOriginalFilename(), file.getBytes()); |
| 206 | Map<String, Object> params = new HashMap<>(); | 210 | Map<String, Object> params = new HashMap<>(); |
| 207 | - bService.importData(file1, params); | 211 | + bService.importData(dataToolsFile.getFile(), params); |
| 208 | 212 | ||
| 209 | rtn.put("status", ResponseCode.SUCCESS); | 213 | rtn.put("status", ResponseCode.SUCCESS); |
| 210 | rtn.put("msg", "上传&导入文件成功"); | 214 | rtn.put("msg", "上传&导入文件成功"); |
| 211 | } catch (Exception exp) { | 215 | } catch (Exception exp) { |
| 216 | + exp.printStackTrace(); | ||
| 212 | rtn.put("status", ResponseCode.ERROR); | 217 | rtn.put("status", ResponseCode.ERROR); |
| 213 | rtn.put("msg", exp.getMessage()); | 218 | rtn.put("msg", exp.getMessage()); |
| 214 | } | 219 | } |
| @@ -220,16 +225,16 @@ public class BController<T, ID extends Serializable> { | @@ -220,16 +225,16 @@ public class BController<T, ID extends Serializable> { | ||
| 220 | @RequestMapping(value = "/exportFile", method = RequestMethod.GET) | 225 | @RequestMapping(value = "/exportFile", method = RequestMethod.GET) |
| 221 | public void exportFile(HttpServletResponse response, | 226 | public void exportFile(HttpServletResponse response, |
| 222 | @RequestParam Map<String, Object> params) throws Exception { | 227 | @RequestParam Map<String, Object> params) throws Exception { |
| 223 | - File file = bService.exportData(params); | 228 | + DataToolsFile dataToolsFile = bService.exportData(params); |
| 224 | // 流输出导出文件 | 229 | // 流输出导出文件 |
| 225 | response.setHeader("content-type", "application/octet-stream"); | 230 | response.setHeader("content-type", "application/octet-stream"); |
| 226 | - response.setHeader("Content-Disposition", "attachment; filename=" + file.getName()); | 231 | + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); |
| 227 | response.setContentType("application/octet-stream"); | 232 | response.setContentType("application/octet-stream"); |
| 228 | 233 | ||
| 229 | OutputStream os = response.getOutputStream(); | 234 | OutputStream os = response.getOutputStream(); |
| 230 | BufferedOutputStream bos = new BufferedOutputStream(os); | 235 | BufferedOutputStream bos = new BufferedOutputStream(os); |
| 231 | 236 | ||
| 232 | - InputStream is = new FileInputStream(file); | 237 | + InputStream is = new FileInputStream(dataToolsFile.getFile()); |
| 233 | BufferedInputStream bis = new BufferedInputStream(is); | 238 | BufferedInputStream bis = new BufferedInputStream(is); |
| 234 | 239 | ||
| 235 | int length = 0; | 240 | int length = 0; |
src/main/java/com/bsth/controller/schedule/PeopleCarPlanController.java
| @@ -33,6 +33,11 @@ public class PeopleCarPlanController { | @@ -33,6 +33,11 @@ public class PeopleCarPlanController { | ||
| 33 | public Map<String, Object> scheduleAnaly(@RequestParam Map<String, Object> map){ | 33 | public Map<String, Object> scheduleAnaly(@RequestParam Map<String, Object> map){ |
| 34 | return peopleCarPlanService.scheduleAnaly(map); | 34 | return peopleCarPlanService.scheduleAnaly(map); |
| 35 | } | 35 | } |
| 36 | + | ||
| 37 | + @RequestMapping(value="/scheduleAnaly_sum", method = RequestMethod.GET) | ||
| 38 | + public Map<String, Object> scheduleAnaly_sum(@RequestParam Map<String, Object> map){ | ||
| 39 | + return peopleCarPlanService.scheduleAnaly_sum(map); | ||
| 40 | + } | ||
| 36 | 41 | ||
| 37 | @RequestMapping(value="/getModel", method = RequestMethod.GET) | 42 | @RequestMapping(value="/getModel", method = RequestMethod.GET) |
| 38 | public List<Map<String,Object>> getModel(@RequestParam Map<String, Object> map){ | 43 | public List<Map<String,Object>> getModel(@RequestParam Map<String, Object> map){ |
| @@ -44,9 +49,25 @@ public class PeopleCarPlanController { | @@ -44,9 +49,25 @@ public class PeopleCarPlanController { | ||
| 44 | return peopleCarPlanService.firstAndLastBus(map); | 49 | return peopleCarPlanService.firstAndLastBus(map); |
| 45 | } | 50 | } |
| 46 | 51 | ||
| 52 | + @RequestMapping(value="/firstAndLastBus_sum", method = RequestMethod.GET) | ||
| 53 | + public List<Map<String,Object>> firstAndLastBus_sum(@RequestParam Map<String, Object> map){ | ||
| 54 | + return peopleCarPlanService.firstAndLastBus_sum(map); | ||
| 55 | + } | ||
| 56 | + | ||
| 47 | @RequestMapping(value="/commandState", method = RequestMethod.GET) | 57 | @RequestMapping(value="/commandState", method = RequestMethod.GET) |
| 48 | public List<Map<String,Object>> commandState(@RequestParam Map<String, Object> map){ | 58 | public List<Map<String,Object>> commandState(@RequestParam Map<String, Object> map){ |
| 49 | return peopleCarPlanService.commandState(map); | 59 | return peopleCarPlanService.commandState(map); |
| 50 | } | 60 | } |
| 51 | 61 | ||
| 62 | + @RequestMapping(value="/commandByLineList", method = RequestMethod.GET) | ||
| 63 | + public List<Map<String,Object>> commandByLineList(@RequestParam Map<String, Object> map){ | ||
| 64 | + return peopleCarPlanService.commandByLineList(map); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @RequestMapping(value="/commandByJghList", method = RequestMethod.GET) | ||
| 68 | + public List<Map<String,Object>> commandByJghList(@RequestParam Map<String, Object> map){ | ||
| 69 | + return peopleCarPlanService.commandByJghList(map); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + | ||
| 52 | } | 73 | } |
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
| @@ -22,9 +22,9 @@ public class TrafficManageController { | @@ -22,9 +22,9 @@ public class TrafficManageController { | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | @RequestMapping(value = "/setXL", method = RequestMethod.GET) | 24 | @RequestMapping(value = "/setXL", method = RequestMethod.GET) |
| 25 | - public String setXL() throws Exception { | 25 | + public String setXL(@RequestParam("ids") String ids) throws Exception { |
| 26 | try { | 26 | try { |
| 27 | - return trManageService.setXL(); | 27 | + return trManageService.setXL(ids); |
| 28 | } catch (Exception exp) { | 28 | } catch (Exception exp) { |
| 29 | throw new Exception(exp.getCause()); | 29 | throw new Exception(exp.getCause()); |
| 30 | } | 30 | } |
| @@ -57,6 +57,15 @@ public class TrafficManageController { | @@ -57,6 +57,15 @@ public class TrafficManageController { | ||
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | + @RequestMapping(value = "/setLDFile", method = RequestMethod.GET) | ||
| 61 | + public String setLDFile() throws Exception { | ||
| 62 | + try { | ||
| 63 | + return trManageService.setLDFile(); | ||
| 64 | + } catch (Exception exp) { | ||
| 65 | + throw new Exception(exp.getCause()); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 60 | @RequestMapping(value = "/setLCYH", method = RequestMethod.GET) | 69 | @RequestMapping(value = "/setLCYH", method = RequestMethod.GET) |
| 61 | public String setLCYH() throws Exception { | 70 | public String setLCYH() throws Exception { |
| 62 | try { | 71 | try { |
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
| @@ -7,10 +7,7 @@ import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | @@ -7,10 +7,7 @@ import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | ||
| 7 | import com.bsth.service.schedule.EmployeeConfigInfoService; | 7 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | import com.bsth.service.schedule.exception.ScheduleException; | 8 | import com.bsth.service.schedule.exception.ScheduleException; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | -import org.springframework.web.bind.annotation.RestController; | 10 | +import org.springframework.web.bind.annotation.*; |
| 14 | 11 | ||
| 15 | import java.util.HashMap; | 12 | import java.util.HashMap; |
| 16 | import java.util.List; | 13 | import java.util.List; |
| @@ -38,6 +35,19 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo | @@ -38,6 +35,19 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo | ||
| 38 | } | 35 | } |
| 39 | 36 | ||
| 40 | 37 | ||
| 38 | + @RequestMapping(value = "/dbbm/{xlid}", method = RequestMethod.GET) | ||
| 39 | + public Map<String, Object> getDbbm(@PathVariable("xlid") Integer xl) { | ||
| 40 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 41 | + try { | ||
| 42 | + rtn.put("data", employeeConfigInfoService.getMaxDbbm(xl)); | ||
| 43 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 44 | + } catch (Exception exp) { | ||
| 45 | + exp.printStackTrace(); | ||
| 46 | + rtn.put("status", ResponseCode.ERROR); | ||
| 47 | + rtn.put("msg", exp.getMessage()); | ||
| 48 | + } | ||
| 49 | + return rtn; | ||
| 50 | + } | ||
| 41 | 51 | ||
| 42 | @RequestMapping(value = "/validate_jsy", method = RequestMethod.GET) | 52 | @RequestMapping(value = "/validate_jsy", method = RequestMethod.GET) |
| 43 | public Map<String, Object> validate_jsy(@RequestParam Map<String, Object> param) { | 53 | public Map<String, Object> validate_jsy(@RequestParam Map<String, Object> param) { |
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
| @@ -6,13 +6,8 @@ import com.bsth.entity.schedule.GuideboardInfo; | @@ -6,13 +6,8 @@ import com.bsth.entity.schedule.GuideboardInfo; | ||
| 6 | import com.bsth.repository.schedule.GuideboardInfoRepository; | 6 | import com.bsth.repository.schedule.GuideboardInfoRepository; |
| 7 | import com.bsth.service.schedule.GuideboardInfoService; | 7 | import com.bsth.service.schedule.GuideboardInfoService; |
| 8 | import com.bsth.service.schedule.exception.ScheduleException; | 8 | import com.bsth.service.schedule.exception.ScheduleException; |
| 9 | -import com.bsth.service.schedule.utils.DataToolsProperties; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 15 | -import org.springframework.web.bind.annotation.RestController; | 10 | +import org.springframework.web.bind.annotation.*; |
| 16 | 11 | ||
| 17 | import java.util.HashMap; | 12 | import java.util.HashMap; |
| 18 | import java.util.List; | 13 | import java.util.List; |
| @@ -23,7 +18,6 @@ import java.util.Map; | @@ -23,7 +18,6 @@ import java.util.Map; | ||
| 23 | */ | 18 | */ |
| 24 | @RestController | 19 | @RestController |
| 25 | @RequestMapping("gic") | 20 | @RequestMapping("gic") |
| 26 | -@EnableConfigurationProperties(DataToolsProperties.class) | ||
| 27 | public class GuideboardInfoController extends BController<GuideboardInfo, Long> { | 21 | public class GuideboardInfoController extends BController<GuideboardInfo, Long> { |
| 28 | @Autowired | 22 | @Autowired |
| 29 | private GuideboardInfoService guideboardInfoService; | 23 | private GuideboardInfoService guideboardInfoService; |
| @@ -36,6 +30,21 @@ public class GuideboardInfoController extends BController<GuideboardInfo, Long> | @@ -36,6 +30,21 @@ public class GuideboardInfoController extends BController<GuideboardInfo, Long> | ||
| 36 | return guideboardInfoRepository.findLpName(ttid); | 30 | return guideboardInfoRepository.findLpName(ttid); |
| 37 | } | 31 | } |
| 38 | 32 | ||
| 33 | + @RequestMapping(value = "lpno/{xlid}", method = RequestMethod.GET) | ||
| 34 | + public Map<String, Object> getLpNo(@PathVariable("xlid") Integer xl) { | ||
| 35 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 36 | + try { | ||
| 37 | + rtn.put("data", guideboardInfoService.getMaxLpno(xl)); | ||
| 38 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 39 | + } catch (Exception exp) { | ||
| 40 | + exp.printStackTrace(); | ||
| 41 | + rtn.put("status", ResponseCode.ERROR); | ||
| 42 | + rtn.put("msg", exp.getMessage()); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + return rtn; | ||
| 46 | + } | ||
| 47 | + | ||
| 39 | @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET) | 48 | @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET) |
| 40 | public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) { | 49 | public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) { |
| 41 | Map<String, Object> rtn = new HashMap<>(); | 50 | Map<String, Object> rtn = new HashMap<>(); |
src/main/java/com/bsth/controller/schedule/SchedulePlanInfoController.java renamed to src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController.java
| 1 | -package com.bsth.controller.schedule; | 1 | +package com.bsth.controller.schedule.core; |
| 2 | 2 | ||
| 3 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 4 | -import com.bsth.controller.BaseController; | 4 | +import com.bsth.controller.schedule.BController; |
| 5 | import com.bsth.entity.schedule.SchedulePlanInfo; | 5 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 6 | import com.bsth.service.schedule.SchedulePlanInfoService; | 6 | import com.bsth.service.schedule.SchedulePlanInfoService; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -13,14 +13,51 @@ import java.util.List; | @@ -13,14 +13,51 @@ import java.util.List; | ||
| 13 | import java.util.Map; | 13 | import java.util.Map; |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | - * Created by xu on 16/6/16. | 16 | + * Created by xu on 17/5/1. |
| 17 | */ | 17 | */ |
| 18 | @RestController | 18 | @RestController |
| 19 | @RequestMapping("spic") | 19 | @RequestMapping("spic") |
| 20 | -public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> { | 20 | +public class SchedulePlanInfoController extends BController<SchedulePlanInfo, Long> { |
| 21 | @Autowired | 21 | @Autowired |
| 22 | private SchedulePlanInfoService schedulePlanInfoService; | 22 | private SchedulePlanInfoService schedulePlanInfoService; |
| 23 | 23 | ||
| 24 | + @RequestMapping(value = "/groupextinfos/{xlid}/{date}", method = RequestMethod.GET) | ||
| 25 | + public Map<String, Object> findGroupInfoExt( | ||
| 26 | + @PathVariable(value = "xlid") Integer xlid, | ||
| 27 | + @PathVariable(value = "date") Date scheduleDate) { | ||
| 28 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 29 | + try { | ||
| 30 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 31 | + resultMap.put("data", schedulePlanInfoService.findSchedulePlanGroupInfo(xlid, scheduleDate)); | ||
| 32 | + | ||
| 33 | + } catch (Exception exp) { | ||
| 34 | + exp.printStackTrace(); | ||
| 35 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 36 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + return resultMap; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/lastestsd/{xlid}", method = RequestMethod.GET) | ||
| 43 | + public Map<String, Object> findLastestPlanDate( | ||
| 44 | + @PathVariable(value = "xlid") Integer xlid) { | ||
| 45 | + Map<String, Object> resultMap = new HashMap<>(); | ||
| 46 | + try { | ||
| 47 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 48 | + resultMap.put("data", schedulePlanInfoService.findLastestPlanDate(xlid)); | ||
| 49 | + | ||
| 50 | + } catch (Exception exp) { | ||
| 51 | + exp.printStackTrace(); | ||
| 52 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 53 | + resultMap.put("msg", exp.getLocalizedMessage()); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + return resultMap; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | +// ------------------------ 老版本 ----------------------// | ||
| 24 | @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | 61 | @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) |
| 25 | public List<SchedulePlanInfoService.GroupInfo> findGroupInfo( | 62 | public List<SchedulePlanInfoService.GroupInfo> findGroupInfo( |
| 26 | @PathVariable(value = "xlid") Integer xlid, | 63 | @PathVariable(value = "xlid") Integer xlid, |
src/main/java/com/bsth/controller/schedule/core/TTInfoController.java
| @@ -3,13 +3,10 @@ package com.bsth.controller.schedule.core; | @@ -3,13 +3,10 @@ package com.bsth.controller.schedule.core; | ||
| 3 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 4 | import com.bsth.controller.schedule.BController; | 4 | import com.bsth.controller.schedule.BController; |
| 5 | import com.bsth.entity.schedule.TTInfo; | 5 | import com.bsth.entity.schedule.TTInfo; |
| 6 | -import com.bsth.service.schedule.exception.ScheduleException; | ||
| 7 | import com.bsth.service.schedule.TTInfoService; | 6 | import com.bsth.service.schedule.TTInfoService; |
| 7 | +import com.bsth.service.schedule.exception.ScheduleException; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | -import org.springframework.web.bind.annotation.RestController; | 9 | +import org.springframework.web.bind.annotation.*; |
| 13 | 10 | ||
| 14 | import java.util.HashMap; | 11 | import java.util.HashMap; |
| 15 | import java.util.Map; | 12 | import java.util.Map; |
| @@ -87,4 +84,18 @@ public class TTInfoController extends BController<TTInfo, Long> { | @@ -87,4 +84,18 @@ public class TTInfoController extends BController<TTInfo, Long> { | ||
| 87 | return rtn; | 84 | return rtn; |
| 88 | } | 85 | } |
| 89 | 86 | ||
| 87 | + @RequestMapping(value = "/backup/{ttinfo}", method = RequestMethod.GET) | ||
| 88 | + public Map<String, Object> backup(@PathVariable(value = "ttinfo") Long ttInfoId) { | ||
| 89 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 90 | + try { | ||
| 91 | + // 备份时刻表 | ||
| 92 | + this.ttInfoService.backUp(ttInfoId); | ||
| 93 | + } catch (ScheduleException exp) { | ||
| 94 | + rtn.put("status", ResponseCode.ERROR); | ||
| 95 | + rtn.put("msg", exp.getMessage()); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + return rtn; | ||
| 99 | + } | ||
| 100 | + | ||
| 90 | } | 101 | } |
| 91 | \ No newline at end of file | 102 | \ No newline at end of file |
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
| @@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode; | @@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode; | ||
| 4 | import com.bsth.controller.schedule.BController; | 4 | import com.bsth.controller.schedule.BController; |
| 5 | import com.bsth.entity.schedule.TTInfoDetail; | 5 | import com.bsth.entity.schedule.TTInfoDetail; |
| 6 | import com.bsth.service.schedule.TTInfoDetailService; | 6 | import com.bsth.service.schedule.TTInfoDetailService; |
| 7 | +import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
| 9 | 10 | ||
| @@ -73,9 +74,13 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { | @@ -73,9 +74,13 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { | ||
| 73 | @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) | 74 | @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) |
| 74 | public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, | 75 | public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, |
| 75 | @PathVariable("ttid") Long ttid) { | 76 | @PathVariable("ttid") Long ttid) { |
| 77 | + | ||
| 78 | + // 获取最大的发车数,用于输出数据的数量 | ||
| 79 | + Long maxfcno = ttInfoDetailService.findMaxFcno(xlid, ttid); | ||
| 80 | + | ||
| 76 | Map<String, Object> rtn = new HashMap<>(); | 81 | Map<String, Object> rtn = new HashMap<>(); |
| 77 | try { | 82 | try { |
| 78 | - TTInfoDetailService.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid); | 83 | + TTInfoDetailForEdit.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid, maxfcno); |
| 79 | rtn.put("status", ResponseCode.SUCCESS); | 84 | rtn.put("status", ResponseCode.SUCCESS); |
| 80 | rtn.put("data", editInfo); | 85 | rtn.put("data", editInfo); |
| 81 | } catch (Exception exp) { | 86 | } catch (Exception exp) { |
src/main/java/com/bsth/controller/sys/IntervalController.java
0 → 100644
| 1 | +package com.bsth.controller.sys; | ||
| 2 | + | ||
| 3 | +import java.util.Map; | ||
| 4 | + | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 9 | +import org.springframework.web.bind.annotation.RestController; | ||
| 10 | + | ||
| 11 | +import com.alibaba.fastjson.JSON; | ||
| 12 | +import com.bsth.entity.sys.Interval; | ||
| 13 | +import com.bsth.service.sys.IntervalService; | ||
| 14 | + | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("interval") | ||
| 17 | +public class IntervalController { | ||
| 18 | + | ||
| 19 | + @Autowired | ||
| 20 | + IntervalService intervalService; | ||
| 21 | + | ||
| 22 | + @RequestMapping(value = "/save", method = RequestMethod.POST) | ||
| 23 | + public Map<String, Object> save(@RequestParam String array){ | ||
| 24 | + return intervalService.saveList(JSON.parseArray(array, Interval.class)); | ||
| 25 | + } | ||
| 26 | +} |
src/main/java/com/bsth/controller/sys/ModuleController.java
| 1 | package com.bsth.controller.sys; | 1 | package com.bsth.controller.sys; |
| 2 | 2 | ||
| 3 | -import java.util.List; | ||
| 4 | - | 3 | +import com.bsth.controller.BaseController; |
| 4 | +import com.bsth.entity.sys.Module; | ||
| 5 | +import com.bsth.service.sys.ModuleService; | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | import org.springframework.web.bind.annotation.RequestParam; | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| 8 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 9 | 10 | ||
| 10 | -import com.bsth.controller.BaseController; | ||
| 11 | -import com.bsth.entity.sys.Module; | ||
| 12 | -import com.bsth.service.sys.ModuleService; | 11 | +import java.util.List; |
| 13 | 12 | ||
| 14 | @RestController | 13 | @RestController |
| 15 | @RequestMapping("module") | 14 | @RequestMapping("module") |
| @@ -34,4 +33,9 @@ public class ModuleController extends BaseController<Module, Integer>{ | @@ -34,4 +33,9 @@ public class ModuleController extends BaseController<Module, Integer>{ | ||
| 34 | public List<Module> findByCurrentUser(){ | 33 | public List<Module> findByCurrentUser(){ |
| 35 | return moduleService.findByCurrentUser(); | 34 | return moduleService.findByCurrentUser(); |
| 36 | } | 35 | } |
| 36 | + | ||
| 37 | + @RequestMapping(value = "/all_distinct") | ||
| 38 | + public List<Module> findAll_distinct(){ | ||
| 39 | + return moduleService.findAll_distinct(); | ||
| 40 | + } | ||
| 37 | } | 41 | } |
src/main/java/com/bsth/controller/sys/UserController.java
| @@ -242,4 +242,9 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -242,4 +242,9 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 242 | public Map<String, Object> register(SysUser u){ | 242 | public Map<String, Object> register(SysUser u){ |
| 243 | return sysUserService.register(u); | 243 | return sysUserService.register(u); |
| 244 | } | 244 | } |
| 245 | + | ||
| 246 | + @RequestMapping(value = "/all_distinct") | ||
| 247 | + public List<SysUser> findAll_distinct(){ | ||
| 248 | + return sysUserService.findAll_distinct(); | ||
| 249 | + } | ||
| 245 | } | 250 | } |
src/main/java/com/bsth/controller/traffic/SKBUploadLoggerController.java
0 → 100644
| 1 | +package com.bsth.controller.traffic; | ||
| 2 | + | ||
| 3 | +import com.bsth.controller.BaseController; | ||
| 4 | +import com.bsth.entity.traffic.SKBUploadLogger; | ||
| 5 | +import com.bsth.service.traffic.SKBUploadLoggerService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RestController; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * | ||
| 12 | + * @author BSTH | ||
| 13 | + * | ||
| 14 | + */ | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("skb_log") | ||
| 17 | +public class SKBUploadLoggerController extends BaseController<SKBUploadLogger,Integer> { | ||
| 18 | + | ||
| 19 | + @Autowired | ||
| 20 | + private SKBUploadLoggerService skbUploadLoggerService; | ||
| 21 | + | ||
| 22 | +} |
src/main/java/com/bsth/data/BasicData.java
| @@ -2,6 +2,7 @@ package com.bsth.data; | @@ -2,6 +2,7 @@ package com.bsth.data; | ||
| 2 | 2 | ||
| 3 | import com.bsth.Application; | 3 | import com.bsth.Application; |
| 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; | 4 | import com.bsth.data.gpsdata.arrival.GeoCacheData; |
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 5 | import com.bsth.entity.*; | 6 | import com.bsth.entity.*; |
| 6 | import com.bsth.entity.schedule.CarConfigInfo; | 7 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | import com.bsth.repository.*; | 8 | import com.bsth.repository.*; |
| @@ -39,13 +40,13 @@ public class BasicData implements CommandLineRunner { | @@ -39,13 +40,13 @@ public class BasicData implements CommandLineRunner { | ||
| 39 | 40 | ||
| 40 | //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) | 41 | //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) |
| 41 | public static Map<String, String> nbbm2CompanyCodeMap; | 42 | public static Map<String, String> nbbm2CompanyCodeMap; |
| 43 | + | ||
| 44 | + //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号) | ||
| 45 | + public static Map<String, String> nbbmCompanyPlateMap; | ||
| 42 | 46 | ||
| 43 | //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称) | 47 | //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称) |
| 44 | public static Map<String, String> stationCode2NameMap; | 48 | public static Map<String, String> stationCode2NameMap; |
| 45 | 49 | ||
| 46 | - //线路起终点对照(线路编码_上下行_起终点) 1024_0_B (1024上行起点) | ||
| 47 | - //public static Map<String, String> lineSEPointMap; | ||
| 48 | - | ||
| 49 | //车辆和线路对照 | 50 | //车辆和线路对照 |
| 50 | public static Map<String, Line> nbbm2LineMap; | 51 | public static Map<String, Line> nbbm2LineMap; |
| 51 | 52 | ||
| @@ -64,10 +65,10 @@ public class BasicData implements CommandLineRunner { | @@ -64,10 +65,10 @@ public class BasicData implements CommandLineRunner { | ||
| 64 | //线路Code和shangHaiLinecode 对照 | 65 | //线路Code和shangHaiLinecode 对照 |
| 65 | public static Map<String, String> lineCode2ShangHaiCodeMap; | 66 | public static Map<String, String> lineCode2ShangHaiCodeMap; |
| 66 | 67 | ||
| 67 | - //驾驶员工号 和 personnel 对象映射 | 68 | + /*//驾驶员工号 和 personnel 对象映射 |
| 68 | public static Map<String, Personnel> jsyMap; | 69 | public static Map<String, Personnel> jsyMap; |
| 69 | //售票员工号 和 personnel 对象映射 | 70 | //售票员工号 和 personnel 对象映射 |
| 70 | - public static Map<String, Personnel> spyMap; | 71 | + public static Map<String, Personnel> spyMap;*/ |
| 71 | //所以员工和personnerl 对象映射 | 72 | //所以员工和personnerl 对象映射 |
| 72 | public static Map<String, Personnel> perMap; | 73 | public static Map<String, Personnel> perMap; |
| 73 | //全量员工 工号和姓名对照 | 74 | //全量员工 工号和姓名对照 |
| @@ -134,6 +135,12 @@ public class BasicData implements CommandLineRunner { | @@ -134,6 +135,12 @@ public class BasicData implements CommandLineRunner { | ||
| 134 | @Autowired | 135 | @Autowired |
| 135 | GeoCacheData geoCacheData; | 136 | GeoCacheData geoCacheData; |
| 136 | 137 | ||
| 138 | + @Autowired | ||
| 139 | + Station2ParkBuffer station2ParkBuffer; | ||
| 140 | + | ||
| 141 | + @Autowired | ||
| 142 | + PersionPinYinBuffer persionPinYinBuffer; | ||
| 143 | + | ||
| 137 | 144 | ||
| 138 | @Override | 145 | @Override |
| 139 | public void run() { | 146 | public void run() { |
| @@ -154,14 +161,13 @@ public class BasicData implements CommandLineRunner { | @@ -154,14 +161,13 @@ public class BasicData implements CommandLineRunner { | ||
| 154 | loadLineInfo(); | 161 | loadLineInfo(); |
| 155 | //车辆和线路映射信息 | 162 | //车辆和线路映射信息 |
| 156 | loadNbbm2LineInfo(); | 163 | loadNbbm2LineInfo(); |
| 157 | - //站点路由信息 | ||
| 158 | - //loadStationRouteInfo(); | ||
| 159 | //人员信息 | 164 | //人员信息 |
| 160 | loadPersonnelInfo(); | 165 | loadPersonnelInfo(); |
| 161 | //公司信息 | 166 | //公司信息 |
| 162 | loadBusinessInfo(); | 167 | loadBusinessInfo(); |
| 163 | 168 | ||
| 164 | geoCacheData.loadData(); | 169 | geoCacheData.loadData(); |
| 170 | + station2ParkBuffer.saveAll(); | ||
| 165 | logger.info("加载基础数据成功!,"); | 171 | logger.info("加载基础数据成功!,"); |
| 166 | } catch (Exception e) { | 172 | } catch (Exception e) { |
| 167 | logger.error("加载基础数据时出现异常,", e); | 173 | logger.error("加载基础数据时出现异常,", e); |
| @@ -195,16 +201,22 @@ public class BasicData implements CommandLineRunner { | @@ -195,16 +201,22 @@ public class BasicData implements CommandLineRunner { | ||
| 195 | BiMap<String, String> deviceId2Nbbm = HashBiMap.create(); | 201 | BiMap<String, String> deviceId2Nbbm = HashBiMap.create(); |
| 196 | //车辆和公司代码对照 | 202 | //车辆和公司代码对照 |
| 197 | Map<String, String> nbbm2CompanyCode = new HashMap<>(); | 203 | Map<String, String> nbbm2CompanyCode = new HashMap<>(); |
| 204 | + | ||
| 205 | + //车辆自编号和拍照号对照 | ||
| 206 | + Map<String, String> nbbmCompanyPlate = new HashMap<>(); | ||
| 207 | + | ||
| 198 | Iterator<Cars> carIterator = carsRepository.findAll().iterator(); | 208 | Iterator<Cars> carIterator = carsRepository.findAll().iterator(); |
| 199 | Cars car; | 209 | Cars car; |
| 200 | while (carIterator.hasNext()) { | 210 | while (carIterator.hasNext()) { |
| 201 | car = carIterator.next(); | 211 | car = carIterator.next(); |
| 202 | deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); | 212 | deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); |
| 203 | nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); | 213 | nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); |
| 214 | + nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate()); | ||
| 204 | } | 215 | } |
| 205 | 216 | ||
| 206 | deviceId2NbbmMap = deviceId2Nbbm; | 217 | deviceId2NbbmMap = deviceId2Nbbm; |
| 207 | nbbm2CompanyCodeMap = nbbm2CompanyCode; | 218 | nbbm2CompanyCodeMap = nbbm2CompanyCode; |
| 219 | + nbbmCompanyPlateMap =nbbmCompanyPlate; | ||
| 208 | } | 220 | } |
| 209 | 221 | ||
| 210 | /** | 222 | /** |
| @@ -266,36 +278,37 @@ public class BasicData implements CommandLineRunner { | @@ -266,36 +278,37 @@ public class BasicData implements CommandLineRunner { | ||
| 266 | Map<String, String> code2SHcode = new HashMap<String, String>(); | 278 | Map<String, String> code2SHcode = new HashMap<String, String>(); |
| 267 | Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); | 279 | Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); |
| 268 | 280 | ||
| 281 | + /** | ||
| 282 | + * 加载运管处的站点及序号 | ||
| 283 | + * 上行从1开始,下行顺序续编 | ||
| 284 | + */ | ||
| 285 | + List<Map<String, String>> ygcLines = stationRouteRepository.findAllLineWithYgc(); | ||
| 286 | + if(ygcLines != null && ygcLines.size() > 0){ | ||
| 287 | + int size = ygcLines.size(); | ||
| 288 | + Map<String, String> tempMap ; | ||
| 289 | + int num = 1; | ||
| 290 | + String key; | ||
| 291 | + String lineCode = ""; | ||
| 292 | + for (int i = 0; i < size; i ++){ | ||
| 293 | + tempMap = ygcLines.get(i); | ||
| 294 | + if(lineCode.equals("")){ | ||
| 295 | + lineCode = tempMap.get("lineCode"); | ||
| 296 | + }else if(!lineCode.equals(tempMap.get("lineCode"))){ | ||
| 297 | + num = 1; | ||
| 298 | + lineCode = tempMap.get("lineCode"); | ||
| 299 | + } | ||
| 300 | + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | ||
| 301 | + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | ||
| 302 | + tempStationName2YgcNumber.put(key,num++); | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + | ||
| 269 | while (iterator.hasNext()) { | 306 | while (iterator.hasNext()) { |
| 270 | line = iterator.next(); | 307 | line = iterator.next(); |
| 271 | biMap.put(line.getId(), line.getLineCode()); | 308 | biMap.put(line.getId(), line.getLineCode()); |
| 272 | code2name.put(line.getLineCode(), line.getName()); | 309 | code2name.put(line.getLineCode(), line.getName()); |
| 273 | id2SHcode.put(line.getId(), line.getShanghaiLinecode()); | 310 | id2SHcode.put(line.getId(), line.getShanghaiLinecode()); |
| 274 | code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | 311 | code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); |
| 275 | - | ||
| 276 | - /** | ||
| 277 | - * 加载运管处的站点及序号 | ||
| 278 | - * 上行从1开始,下行顺序续编 | ||
| 279 | - */ | ||
| 280 | - List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc(); | ||
| 281 | - if(ygcLines != null && ygcLines.size() > 0){ | ||
| 282 | - int size = ygcLines.size(); | ||
| 283 | - Object[] tempArray ; | ||
| 284 | - int num = 1; | ||
| 285 | - String key; | ||
| 286 | - String lineCode = ""; | ||
| 287 | - for (int i = 0; i < size; i ++){ | ||
| 288 | - tempArray = ygcLines.get(i); | ||
| 289 | - if(lineCode.equals("")){ | ||
| 290 | - lineCode = tempArray[0]+""; | ||
| 291 | - }else if(!lineCode.equals(tempArray[0]+"")){ | ||
| 292 | - num = 1; | ||
| 293 | - lineCode = tempArray[0]+""; | ||
| 294 | - } | ||
| 295 | - key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2]; | ||
| 296 | - tempStationName2YgcNumber.put(key,num++); | ||
| 297 | - } | ||
| 298 | - } | ||
| 299 | } | 312 | } |
| 300 | 313 | ||
| 301 | lineId2CodeMap = biMap; | 314 | lineId2CodeMap = biMap; |
| @@ -312,7 +325,7 @@ public class BasicData implements CommandLineRunner { | @@ -312,7 +325,7 @@ public class BasicData implements CommandLineRunner { | ||
| 312 | public void loadPersonnelInfo() { | 325 | public void loadPersonnelInfo() { |
| 313 | Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | 326 | Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); |
| 314 | 327 | ||
| 315 | - Map<String, Personnel> jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),perTempMap=new HashMap<>(); | 328 | + Map<String, Personnel> /*jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),*/perTempMap=new HashMap<>(); |
| 316 | Map<String, String> allPersonMap = new HashMap<>(); | 329 | Map<String, String> allPersonMap = new HashMap<>(); |
| 317 | 330 | ||
| 318 | Personnel p; | 331 | Personnel p; |
| @@ -324,22 +337,25 @@ public class BasicData implements CommandLineRunner { | @@ -324,22 +337,25 @@ public class BasicData implements CommandLineRunner { | ||
| 324 | if (StringUtils.isEmpty(jobCode)) | 337 | if (StringUtils.isEmpty(jobCode)) |
| 325 | continue; | 338 | continue; |
| 326 | 339 | ||
| 327 | - if (p.getPosts() != null) { | 340 | + /*if (p.getPosts() != null) { |
| 328 | if (p.getPosts().equals("1")) | 341 | if (p.getPosts().equals("1")) |
| 329 | jsyTempMap.put(jobCode, p); | 342 | jsyTempMap.put(jobCode, p); |
| 330 | else if (p.getPosts().equals("2")) | 343 | else if (p.getPosts().equals("2")) |
| 331 | spyTempMap.put(jobCode, p); | 344 | spyTempMap.put(jobCode, p); |
| 332 | - } | 345 | + }*/ |
| 333 | 346 | ||
| 334 | perTempMap.put(jobCode, p); | 347 | perTempMap.put(jobCode, p); |
| 335 | 348 | ||
| 336 | allPersonMap.put(jobCode, p.getPersonnelName()); | 349 | allPersonMap.put(jobCode, p.getPersonnelName()); |
| 337 | } | 350 | } |
| 338 | 351 | ||
| 339 | - jsyMap = jsyTempMap; | ||
| 340 | - spyMap = spyTempMap; | 352 | + //jsyMap = jsyTempMap; |
| 353 | + //spyMap = spyTempMap; | ||
| 341 | allPerson = allPersonMap; | 354 | allPerson = allPersonMap; |
| 342 | perMap = perTempMap; | 355 | perMap = perTempMap; |
| 356 | + | ||
| 357 | + //人员拼音转换 | ||
| 358 | + persionPinYinBuffer.refresh(); | ||
| 343 | } | 359 | } |
| 344 | } | 360 | } |
| 345 | } | 361 | } |
src/main/java/com/bsth/data/LineConfigData.java
| @@ -64,7 +64,7 @@ public class LineConfigData implements CommandLineRunner { | @@ -64,7 +64,7 @@ public class LineConfigData implements CommandLineRunner { | ||
| 64 | */ | 64 | */ |
| 65 | public long applyOut(ScheduleRealInfo sch, Long timestamp) { | 65 | public long applyOut(ScheduleRealInfo sch, Long timestamp) { |
| 66 | LineConfig config = lineConfMap.get(sch.getXlBm()); | 66 | LineConfig config = lineConfMap.get(sch.getXlBm()); |
| 67 | - int diff = sch.getXlDir()=="0"?config.getUpOutDiff():config.getDownOutDiff(); | 67 | + int diff = sch.getXlDir().equals("0")?config.getUpOutDiff():config.getDownOutDiff(); |
| 68 | return timestamp - (diff * 1000); | 68 | return timestamp - (diff * 1000); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -76,7 +76,7 @@ public class LineConfigData implements CommandLineRunner { | @@ -76,7 +76,7 @@ public class LineConfigData implements CommandLineRunner { | ||
| 76 | */ | 76 | */ |
| 77 | public long applyIn(ScheduleRealInfo sch, Long timestamp){ | 77 | public long applyIn(ScheduleRealInfo sch, Long timestamp){ |
| 78 | LineConfig config = lineConfMap.get(sch.getXlBm()); | 78 | LineConfig config = lineConfMap.get(sch.getXlBm()); |
| 79 | - int diff = sch.getXlDir()=="0"?config.getUpInDiff():config.getDownInDiff(); | 79 | + int diff = sch.getXlDir().equals("0")?config.getUpInDiff():config.getDownInDiff(); |
| 80 | return timestamp - (diff * 1000); | 80 | return timestamp - (diff * 1000); |
| 81 | } | 81 | } |
| 82 | 82 |
src/main/java/com/bsth/data/Station2ParkBuffer.java
0 → 100644
| 1 | +package com.bsth.data; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 6 | +import com.bsth.entity.realcontrol.StationToPark; | ||
| 7 | +import com.bsth.repository.realcontrol.StationToParkRepository; | ||
| 8 | +import com.bsth.util.Arith; | ||
| 9 | +import com.google.common.collect.ArrayListMultimap; | ||
| 10 | +import org.joda.time.format.DateTimeFormat; | ||
| 11 | +import org.joda.time.format.DateTimeFormatter; | ||
| 12 | +import org.slf4j.Logger; | ||
| 13 | +import org.slf4j.LoggerFactory; | ||
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | +import org.springframework.boot.CommandLineRunner; | ||
| 16 | +import org.springframework.stereotype.Component; | ||
| 17 | + | ||
| 18 | +import java.util.*; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 站到场 历时、公里 数据缓存 | ||
| 22 | + * Created by panzhao on 2017/7/10. | ||
| 23 | + */ | ||
| 24 | +@Component | ||
| 25 | +public class Station2ParkBuffer implements CommandLineRunner { | ||
| 26 | + | ||
| 27 | + @Autowired | ||
| 28 | + StationToParkRepository stationToParkRepository; | ||
| 29 | + | ||
| 30 | + private static ArrayListMultimap listMultimap; | ||
| 31 | + | ||
| 32 | + private static Set<StationToPark> pstBuff = new HashSet<>(); | ||
| 33 | + | ||
| 34 | + static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class); | ||
| 35 | + | ||
| 36 | + @Override | ||
| 37 | + public void run(String... strings) throws Exception { | ||
| 38 | + listMultimap = ArrayListMultimap.create(); | ||
| 39 | + Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator(); | ||
| 40 | + StationToPark stp; | ||
| 41 | + while (iterator.hasNext()) { | ||
| 42 | + stp = iterator.next(); | ||
| 43 | + listMultimap.put(stp.getLineCode(), stp); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public static List<StationToPark> get(String lineCode) { | ||
| 48 | + return listMultimap.get(lineCode); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public static StationToPark get(String lineCode, String sName, String eName) { | ||
| 52 | + List<StationToPark> list = get(lineCode); | ||
| 53 | + StationToPark stp = null; | ||
| 54 | + for (StationToPark s : list) { | ||
| 55 | + if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) { | ||
| 56 | + stp = s; | ||
| 57 | + break; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + return stp; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 64 | + | ||
| 65 | + public static void put(ChildTaskPlan ctask) { | ||
| 66 | + try{ | ||
| 67 | + String type2 = ctask.getType2(); | ||
| 68 | + String lineCode = ctask.getSchedule().getXlBm(), sName, eName; | ||
| 69 | + | ||
| 70 | + if (type2.equals("2")) { | ||
| 71 | + sName = ctask.getStartStationName(); | ||
| 72 | + eName = ctask.getEndStationName(); | ||
| 73 | + } else if (type2.equals("3")) { | ||
| 74 | + eName = ctask.getStartStationName(); | ||
| 75 | + sName = ctask.getEndStationName(); | ||
| 76 | + } else | ||
| 77 | + return; | ||
| 78 | + | ||
| 79 | + Float time = calcMinute(ctask); | ||
| 80 | + Float mileage = ctask.getMileage(); | ||
| 81 | + | ||
| 82 | + StationToPark stp = get(lineCode, sName, eName); | ||
| 83 | + if (stp == null) { | ||
| 84 | + stp = new StationToPark(); | ||
| 85 | + stp.setLineCode(lineCode); | ||
| 86 | + stp.setStationName(sName); | ||
| 87 | + stp.setParkName(eName); | ||
| 88 | + listMultimap.put(lineCode, stp); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + if (type2.equals("2")) { | ||
| 92 | + stp.setTime1(time); | ||
| 93 | + stp.setMileage1(mileage); | ||
| 94 | + } else { | ||
| 95 | + stp.setTime2(time); | ||
| 96 | + stp.setMileage2(mileage); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + pstBuff.add(stp); | ||
| 100 | + }catch (Exception e){ | ||
| 101 | + log.error("", e); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public static void put(ScheduleRealInfo sch){ | ||
| 106 | + try{ | ||
| 107 | + String type = sch.getBcType(); | ||
| 108 | + String lineCode = sch.getXlBm(), sName, eName; | ||
| 109 | + | ||
| 110 | + if (type.equals("in")) { | ||
| 111 | + sName = sch.getQdzName(); | ||
| 112 | + eName = sch.getZdzName(); | ||
| 113 | + } else if (type.equals("out")) { | ||
| 114 | + eName = sch.getQdzName(); | ||
| 115 | + sName = sch.getZdzName(); | ||
| 116 | + } else | ||
| 117 | + return; | ||
| 118 | + | ||
| 119 | + long dt = sch.getZdsjT() - sch.getDfsjT(); | ||
| 120 | + Float time = Float.parseFloat(String.valueOf(Arith.div(Arith.div(dt, 1000), 60))); | ||
| 121 | + Float mileage = Float.parseFloat(sch.getJhlc().toString()); | ||
| 122 | + | ||
| 123 | + StationToPark stp = get(lineCode, sName, eName); | ||
| 124 | + if (stp == null) { | ||
| 125 | + stp = new StationToPark(); | ||
| 126 | + stp.setLineCode(lineCode); | ||
| 127 | + stp.setStationName(sName); | ||
| 128 | + stp.setParkName(eName); | ||
| 129 | + listMultimap.put(lineCode, stp); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + if (type.equals("in")) { | ||
| 133 | + stp.setTime1(time); | ||
| 134 | + stp.setMileage1(mileage); | ||
| 135 | + } else { | ||
| 136 | + stp.setTime2(time); | ||
| 137 | + stp.setMileage2(mileage); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + pstBuff.add(stp); | ||
| 141 | + }catch (Exception e){ | ||
| 142 | + log.error("", e); | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public static Float calcMinute(ChildTaskPlan ctask) { | ||
| 147 | + long t = 0; | ||
| 148 | + | ||
| 149 | + try { | ||
| 150 | + long st = fmtHHmm.parseMillis(ctask.getStartDate()); | ||
| 151 | + long et = fmtHHmm.parseMillis(ctask.getEndDate()); | ||
| 152 | + | ||
| 153 | + t = et - st; | ||
| 154 | + } catch (Exception e) { | ||
| 155 | + e.printStackTrace(); | ||
| 156 | + } | ||
| 157 | + return Float.parseFloat(String.valueOf(Arith.div(Arith.div(t, 1000), 60))); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public void saveAll(){ | ||
| 161 | + if(pstBuff.size()==0) | ||
| 162 | + return; | ||
| 163 | + Set<StationToPark> pstBuffCopy = pstBuff; | ||
| 164 | + pstBuff = new HashSet<>(); | ||
| 165 | + //持久化到数据库 | ||
| 166 | + stationToParkRepository.save(pstBuffCopy); | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public Map<String, Object> delete(String lineCode, Integer id) { | ||
| 170 | + Map<String, Object> rs = new HashMap<>(); | ||
| 171 | + try { | ||
| 172 | + List<StationToPark> list = listMultimap.get(lineCode); | ||
| 173 | + | ||
| 174 | + StationToPark stp = null; | ||
| 175 | + for(StationToPark temp : list){ | ||
| 176 | + if(temp.getId().equals(id)){ | ||
| 177 | + stp=temp; | ||
| 178 | + break; | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + if(stp != null){ | ||
| 183 | + listMultimap.remove(lineCode, stp); | ||
| 184 | + stationToParkRepository.delete(id); | ||
| 185 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 186 | + } | ||
| 187 | + else{ | ||
| 188 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 189 | + rs.put("msg", "操作失败,可能数据已经被删除!"); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + }catch (Exception e){ | ||
| 193 | + rs.put("status", ResponseCode.ERROR); | ||
| 194 | + rs.put("msg", e.getMessage()); | ||
| 195 | + log.error("", e); | ||
| 196 | + } | ||
| 197 | + return rs; | ||
| 198 | + } | ||
| 199 | +} |
src/main/java/com/bsth/data/ThreadMonotor.java
0 → 100644
| 1 | +package com.bsth.data; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | ||
| 4 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | ||
| 5 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 6 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Created by panzhao on 2017/5/11. | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +public class ThreadMonotor extends Thread{ | ||
| 16 | + | ||
| 17 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + public void run() { | ||
| 21 | + | ||
| 22 | + //线调GPS分析主线程 | ||
| 23 | + if(GpsRealAnalyse.isBlock()){ | ||
| 24 | + log.warn("GpsRealAnalyse isBlock true !!!!"); | ||
| 25 | + GpsRealAnalyse.shutdown(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + if(GpsRealAnalyse.isIdle()){ | ||
| 29 | + //切换到备用的网关实时GPS对照数据 | ||
| 30 | + GpsDataLoaderThread.setFlag(-1); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + //webSocket 消息推送队列 | ||
| 34 | + if(WebSocketPushQueue.isIdle()){ | ||
| 35 | + log.warn("WebSocketPushQueue isIdle true !!!!"); | ||
| 36 | + WebSocketPushQueue.start(); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + //网关指令推送队列(系统自动发送的) | ||
| 40 | + if(DirectivePushQueue.isIdle()){ | ||
| 41 | + log.warn("DirectivePushQueue isIdle true !!!!"); | ||
| 42 | + DirectivePushQueue.start(); | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | +} | ||
| 0 | \ No newline at end of file | 46 | \ No newline at end of file |
src/main/java/com/bsth/data/arrival/AnalyseData.java deleted
100644 → 0
| 1 | -package com.bsth.data.arrival; | ||
| 2 | - | ||
| 3 | -import org.slf4j.Logger; | ||
| 4 | -import org.slf4j.LoggerFactory; | ||
| 5 | -import org.springframework.stereotype.Component; | ||
| 6 | - | ||
| 7 | -import java.util.ArrayList; | ||
| 8 | -import java.util.Collections; | ||
| 9 | -import java.util.List; | ||
| 10 | -import java.util.Set; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * | ||
| 14 | - * @ClassName: AnalyseArrivalData | ||
| 15 | - * @Description: TODO(分析一下进出站场数据) | ||
| 16 | - * @author PanZhao | ||
| 17 | - * @date 2016年8月24日 上午11:09:37 | ||
| 18 | - * | ||
| 19 | - */ | ||
| 20 | -@Component | ||
| 21 | -public class AnalyseData { | ||
| 22 | - | ||
| 23 | - Logger logger = LoggerFactory.getLogger(AnalyseData.class); | ||
| 24 | - | ||
| 25 | - public void analyse(Set<String> cars){ | ||
| 26 | - try{ | ||
| 27 | - List<ArrivalEntity> list, clearList; | ||
| 28 | - for(String car : cars){ | ||
| 29 | - list = ArrivalData_GPS.findByNbbm(car); | ||
| 30 | - analyse(list); | ||
| 31 | - | ||
| 32 | - //清理掉无效的点 | ||
| 33 | - clearList = new ArrayList<>(); | ||
| 34 | - for(ArrivalEntity arr : list){ | ||
| 35 | - if(!arr.isEnable()) | ||
| 36 | - clearList.add(arr); | ||
| 37 | - } | ||
| 38 | - list.removeAll(clearList); | ||
| 39 | - } | ||
| 40 | - }catch(Exception e){ | ||
| 41 | - logger.error("", e); | ||
| 42 | - } | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - private final static int SHIFT_TIME = 1000 * 60 * 5, | ||
| 46 | - SCH_TIME = 1000 * 60 * 10; | ||
| 47 | - | ||
| 48 | - static ArrivalComparator comp = new ArrivalComparator(); | ||
| 49 | - | ||
| 50 | - public void analyse(List<ArrivalEntity> list){ | ||
| 51 | - if(list.size() <= 1) | ||
| 52 | - return; | ||
| 53 | - | ||
| 54 | - //排序 | ||
| 55 | - Collections.sort(list, comp); | ||
| 56 | - ArrivalEntity prve = list.get(0) | ||
| 57 | - ,curr; | ||
| 58 | - for(int i = 1; i < list.size(); i ++){ | ||
| 59 | - curr = list.get(i); | ||
| 60 | - //如果第一个点无效 | ||
| 61 | - if(!effective(prve)){ | ||
| 62 | - prve.setEnable(false); | ||
| 63 | - prve = curr; | ||
| 64 | - continue; | ||
| 65 | - } | ||
| 66 | - //如果第二个点无效 | ||
| 67 | - else if(!effective(curr)){ | ||
| 68 | - curr.setEnable(false); | ||
| 69 | - continue; | ||
| 70 | - } | ||
| 71 | - else if(curr.getTs() - prve.getTs() < SCH_TIME){ | ||
| 72 | - if(prve.getUpDown() == curr.getUpDown()){ | ||
| 73 | - //信号漂移,出站无效 | ||
| 74 | - if(curr.getStopNo().equals(prve.getStopNo()) | ||
| 75 | - && prve.getInOut() == 1 && curr.getInOut() == 0 | ||
| 76 | - && curr.getTs() - prve.getTs() < SHIFT_TIME){ | ||
| 77 | - prve.setEnable(false); | ||
| 78 | - } | ||
| 79 | -// else if(curr.getInOut()){ | ||
| 80 | -// //curr.getTs() - prve.getTs() < 30000 | ||
| 81 | -// } | ||
| 82 | - } | ||
| 83 | - else{ | ||
| 84 | - //上下行的同名站,新走向的第一个出站信号开始有效 | ||
| 85 | - if(prve.getStopName().equals(curr.getStopName())){ | ||
| 86 | - if(curr.getInOut() == 0) | ||
| 87 | - curr.setEnable(false); | ||
| 88 | - else | ||
| 89 | - prve = curr; | ||
| 90 | - } | ||
| 91 | - } | ||
| 92 | - } | ||
| 93 | - else | ||
| 94 | - prve = curr; | ||
| 95 | - } | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - private boolean effective(ArrivalEntity arr){ | ||
| 99 | - /*//停车场 | ||
| 100 | - if(BasicData.parkCodeList.contains(arr.getStopNo())){ | ||
| 101 | - arr.setTcc(true); | ||
| 102 | - return true; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - Integer upDown = BasicData.lineStationUpDownMap.get(arr.getLineCode() + "_" + arr.getStopNo()); | ||
| 106 | - | ||
| 107 | - return arr.getUpDown() == upDown || BasicData.parkCodeList.contains(arr.getStopNo());*/ | ||
| 108 | - return false; | ||
| 109 | - } | ||
| 110 | -} |
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java deleted
100644 → 0
| 1 | -package com.bsth.data.arrival; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.schedule.DayOfSchedule; | ||
| 4 | -import com.google.common.collect.ArrayListMultimap; | ||
| 5 | -import com.google.common.collect.ListMultimap; | ||
| 6 | -import org.slf4j.Logger; | ||
| 7 | -import org.slf4j.LoggerFactory; | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.boot.CommandLineRunner; | ||
| 10 | -import org.springframework.stereotype.Component; | ||
| 11 | - | ||
| 12 | -import java.util.*; | ||
| 13 | - | ||
| 14 | -/** | ||
| 15 | - * | ||
| 16 | - * @ClassName: ArrivalData_GPS | ||
| 17 | - * @Description: TODO(GPS到离站数据) | ||
| 18 | - * @author PanZhao | ||
| 19 | - * @date 2016年8月18日 下午10:05:27 | ||
| 20 | - * | ||
| 21 | - */ | ||
| 22 | -@Component | ||
| 23 | -public class ArrivalData_GPS implements CommandLineRunner{ | ||
| 24 | - | ||
| 25 | - // 起终点站进出数据 K:车辆编码 | ||
| 26 | - private static ListMultimap<String, ArrivalEntity> startAndEndMaps; | ||
| 27 | - | ||
| 28 | - private static Map<String, Integer> carIndexMap; | ||
| 29 | - | ||
| 30 | - static{ | ||
| 31 | - startAndEndMaps = ArrayListMultimap.create(); | ||
| 32 | - | ||
| 33 | - carIndexMap = new HashMap<>(); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @Autowired | ||
| 37 | - DataLoaderThread dataLoaderThread; | ||
| 38 | - | ||
| 39 | - static Logger logger = LoggerFactory.getLogger(ArrivalData_GPS.class); | ||
| 40 | - | ||
| 41 | - @Override | ||
| 42 | - public void run(String... arg0) throws Exception { | ||
| 43 | - logger.info("ArrivalData_GPS,30,06"); | ||
| 44 | - //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 6, TimeUnit.SECONDS); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - @Component | ||
| 48 | - public static class DataLoaderThread extends Thread { | ||
| 49 | - | ||
| 50 | - @Autowired | ||
| 51 | - DataLoader dataLoader; | ||
| 52 | - | ||
| 53 | - @Autowired | ||
| 54 | - DayOfSchedule dayOfSchedule; | ||
| 55 | - | ||
| 56 | - @Autowired | ||
| 57 | - AnalyseData analyseData; | ||
| 58 | - | ||
| 59 | - @Override | ||
| 60 | - public void run() { | ||
| 61 | - /*try{ | ||
| 62 | - logger.info("开始加载到离站数据, " + System.currentTimeMillis()); | ||
| 63 | - List<ArrivalEntity> arrSets = dataLoader.load(); | ||
| 64 | - if(null == arrSets || arrSets.size() == 0) | ||
| 65 | - return; | ||
| 66 | - | ||
| 67 | - //有起终点进出的车辆 | ||
| 68 | - Set<String> carSet = new TreeSet<>(); | ||
| 69 | - //按车辆起终点站过滤数据 | ||
| 70 | - String nbbm; | ||
| 71 | - Set<String> seList; | ||
| 72 | - for(ArrivalEntity arr : arrSets){ | ||
| 73 | - nbbm = arr.getNbbm(); | ||
| 74 | - | ||
| 75 | - seList = dayOfSchedule.getSEStationList(nbbm); | ||
| 76 | - if(seList.contains(arr.getStopNo())){ | ||
| 77 | - startAndEndMaps.put(nbbm, arr); | ||
| 78 | - carSet.add(nbbm); | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - //从专业的角度分析一下数据 | ||
| 82 | - analyseData.analyse(carSet); | ||
| 83 | - | ||
| 84 | - //开始匹配 | ||
| 85 | - Arrival2Schedule.start(carSet); | ||
| 86 | - }catch(Exception e){ | ||
| 87 | - logger.error("", e); | ||
| 88 | - }*/ | ||
| 89 | - } | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - /** | ||
| 93 | - * | ||
| 94 | - * @Title: clearRAMData | ||
| 95 | - * @Description: TODO(清理内存数据) | ||
| 96 | - */ | ||
| 97 | - public void clearRAMData(String lineCode){ | ||
| 98 | - | ||
| 99 | - List<ArrivalEntity> remList = new ArrayList<>(); | ||
| 100 | - | ||
| 101 | - //车辆映射的进出站数据,遍历删除对应线路数据。 | ||
| 102 | - Collection<ArrivalEntity> seList = startAndEndMaps.values(); | ||
| 103 | - for(ArrivalEntity arr : seList){ | ||
| 104 | - if(arr.getLineCode().equals(lineCode)) | ||
| 105 | - remList.add(arr); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - //删除数据 | ||
| 109 | - int count = 0; | ||
| 110 | - for(ArrivalEntity arr : remList){ | ||
| 111 | - startAndEndMaps.remove(arr.getNbbm(), arr); | ||
| 112 | - count ++; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - logger.info(lineCode + " 清除到离站数据 ," + count); | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - public synchronized static List<ArrivalEntity> findByNbbm(String nbbm){ | ||
| 119 | - return startAndEndMaps.get(nbbm); | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - public static List<ArrivalEntity> getIncrement(String nbbm){ | ||
| 123 | - Integer mark = null; | ||
| 124 | - if (!carIndexMap.containsKey(nbbm)) | ||
| 125 | - mark = 0; | ||
| 126 | - else | ||
| 127 | - mark = carIndexMap.get(nbbm); | ||
| 128 | - | ||
| 129 | - List<ArrivalEntity> all = startAndEndMaps.get(nbbm); | ||
| 130 | - int size = all.size(); | ||
| 131 | - if(size == 0) | ||
| 132 | - return new ArrayList<>(0); | ||
| 133 | - | ||
| 134 | - List<ArrivalEntity> rs = all.subList(mark, size); | ||
| 135 | - carIndexMap.put(nbbm, size); | ||
| 136 | - return rs; | ||
| 137 | - } | ||
| 138 | -} | ||
| 139 | \ No newline at end of file | 0 | \ No newline at end of file |
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
0 → 100644
| 1 | +package com.bsth.data.car_out_info; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 5 | +import com.bsth.data.schedule.ScheduleComparator; | ||
| 6 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 7 | +import com.google.common.collect.ArrayListMultimap; | ||
| 8 | +import org.apache.commons.lang3.StringUtils; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | ||
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 14 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 15 | +import org.springframework.stereotype.Component; | ||
| 16 | +import org.springframework.transaction.TransactionDefinition; | ||
| 17 | +import org.springframework.transaction.TransactionStatus; | ||
| 18 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 19 | + | ||
| 20 | +import java.sql.PreparedStatement; | ||
| 21 | +import java.sql.SQLException; | ||
| 22 | +import java.util.*; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * 发车信息表处理程序 | ||
| 26 | + * Created by panzhao on 2017/5/5. | ||
| 27 | + */ | ||
| 28 | +@Component | ||
| 29 | +public class CarOutInfoHandler { | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + DayOfSchedule dayOfSchedule; | ||
| 33 | + | ||
| 34 | + //班次类型对照表 | ||
| 35 | + static Map<String, String> bcTypeMap; | ||
| 36 | + | ||
| 37 | + static{ | ||
| 38 | + bcTypeMap = new HashMap<>(); | ||
| 39 | + bcTypeMap.put("normal", "正常班次"); | ||
| 40 | + bcTypeMap.put("region", "区间"); | ||
| 41 | + bcTypeMap.put("venting", "直放"); | ||
| 42 | + bcTypeMap.put("major", "放站"); | ||
| 43 | + bcTypeMap.put("ldks", "两点间空驶"); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + private static ScheduleComparator.DFSJ schDFSJComparator = new ScheduleComparator.DFSJ(); | ||
| 47 | + | ||
| 48 | + @Autowired | ||
| 49 | + JdbcTemplate jdbcTemplate; | ||
| 50 | + | ||
| 51 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 全量更新发车信息表 | ||
| 55 | + */ | ||
| 56 | + public void updateAll() { | ||
| 57 | + Set<String> ks = BasicData.lineCode2NameMap.keySet(); | ||
| 58 | + for (String lineCode : ks) { | ||
| 59 | + update(lineCode); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void update(String lineCode) { | ||
| 64 | + try { | ||
| 65 | + ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap(); | ||
| 66 | + List<ScheduleRealInfo> list = new ArrayList<>(); | ||
| 67 | + | ||
| 68 | + Set<String> ks = lpScheduleMap.keySet(); | ||
| 69 | + String prefix = lineCode + "_"; | ||
| 70 | + for (String k : ks) { | ||
| 71 | + if (k.startsWith(prefix)) { | ||
| 72 | + list.addAll(lpScheduleMap.get(k)); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + update(list); | ||
| 77 | + } catch (Exception e) { | ||
| 78 | + logger.error("", e); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public void update(List<ScheduleRealInfo> list) { | ||
| 83 | + if (list.size() == 0) | ||
| 84 | + return; | ||
| 85 | + String lineCode = list.get(0).getXlBm(); | ||
| 86 | + //按上下行分组 | ||
| 87 | + List<ScheduleRealInfo> ups = new ArrayList<>(), downs = new ArrayList<>(); | ||
| 88 | + for (ScheduleRealInfo sch : list) { | ||
| 89 | + if (sch.getXlDir().equals("0")) | ||
| 90 | + ups.add(sch); | ||
| 91 | + else | ||
| 92 | + downs.add(sch); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + ScheduleRealInfo[] upArray = nexts(ups), | ||
| 96 | + downArray = nexts(downs); | ||
| 97 | + | ||
| 98 | + final List<ScheduleRealInfo> pstArray = mergeArray(upArray, downArray); | ||
| 99 | + //编程式事务 | ||
| 100 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource()); | ||
| 101 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 102 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 103 | + TransactionStatus status = tran.getTransaction(def); | ||
| 104 | + | ||
| 105 | + try{ | ||
| 106 | + //删除 | ||
| 107 | + jdbcTemplate.update("delete from bsth_t_clfcxxb where line_code=?", lineCode); | ||
| 108 | + //重新写入 | ||
| 109 | + jdbcTemplate.batchUpdate("insert into bsth_t_clfcxxb(rq, line_code, line_name, lp_name, lp_sn, dfsj, nbbm, cph, bc_type, end_station_name, updown, jGh, jName, remarks, sn)" + | ||
| 110 | + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() { | ||
| 111 | + @Override | ||
| 112 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | ||
| 113 | + ScheduleRealInfo sch = pstArray.get(i); | ||
| 114 | + ps.setString(1, sch.getScheduleDateStr()); | ||
| 115 | + ps.setString(2, sch.getXlBm()); | ||
| 116 | + ps.setString(3, sch.getXlName()); | ||
| 117 | + ps.setString(4, /*sch.getLpName()*/"0"); | ||
| 118 | + ps.setInt(5, sch.getFcno()==null?-1:sch.getFcno()); | ||
| 119 | + ps.setString(6, sch.getDfsj().replace(":", "")); | ||
| 120 | + ps.setString(7, sch.getClZbh().replace("-", "")); | ||
| 121 | + ps.setString(8, BasicData.nbbmCompanyPlateMap.get(sch.getClZbh())); | ||
| 122 | + ps.setString(9, bcTypeMap.containsKey(sch.getBcType()) ? bcTypeMap.get(sch.getBcType()) : sch.getBcType()); | ||
| 123 | + ps.setString(10, sch.getZdzName()); | ||
| 124 | + ps.setInt(11, Integer.parseInt(sch.getXlDir())); | ||
| 125 | + ps.setString(12, sch.getjGh()); | ||
| 126 | + ps.setString(13, sch.getjName()); | ||
| 127 | + ps.setString(14, sch.getRemarks()); | ||
| 128 | + ps.setInt(15, sch.getFcpSn()); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + @Override | ||
| 132 | + public int getBatchSize() { | ||
| 133 | + return pstArray.size(); | ||
| 134 | + } | ||
| 135 | + }); | ||
| 136 | + | ||
| 137 | + tran.commit(status); | ||
| 138 | + }catch (Exception e){ | ||
| 139 | + tran.rollback(status); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + private List<ScheduleRealInfo> mergeArray(ScheduleRealInfo[] upArray, ScheduleRealInfo[] downArray) { | ||
| 144 | + List<ScheduleRealInfo> list = new ArrayList<>(); | ||
| 145 | + for (int i = 0; i < upArray.length; i++) { | ||
| 146 | + if (upArray[i] != null) { | ||
| 147 | + upArray[i].setFcpSn(i + 1); | ||
| 148 | + list.add(upArray[i]); | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + for (int i = 0; i < downArray.length; i++) { | ||
| 152 | + if (downArray[i] != null) { | ||
| 153 | + downArray[i].setFcpSn(i + 1); | ||
| 154 | + list.add(downArray[i]); | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + return list; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * 接下来要执行的3个班次 | ||
| 162 | + * | ||
| 163 | + * @param list | ||
| 164 | + * @return | ||
| 165 | + */ | ||
| 166 | + private ScheduleRealInfo[] nexts(List<ScheduleRealInfo> list) { | ||
| 167 | + ScheduleRealInfo[] array = new ScheduleRealInfo[3]; | ||
| 168 | + Collections.sort(list, schDFSJComparator); | ||
| 169 | + | ||
| 170 | + int count = 0, threshold = 1000 * 60 * 60; | ||
| 171 | + long t = System.currentTimeMillis(); | ||
| 172 | + for (ScheduleRealInfo sch : list) { | ||
| 173 | + if (count == 3) | ||
| 174 | + break; | ||
| 175 | + | ||
| 176 | + //烂班 | ||
| 177 | + if (sch.isDestroy()) | ||
| 178 | + continue; | ||
| 179 | + | ||
| 180 | + //进场、出场、2点间空驶 | ||
| 181 | + if (sch.getBcType().equals("in") | ||
| 182 | + || sch.getBcType().equals("out") | ||
| 183 | + || sch.getBcType().equals("ldks")) | ||
| 184 | + continue; | ||
| 185 | + | ||
| 186 | + //有实发实达时间的 | ||
| 187 | + if (StringUtils.isNotEmpty(sch.getFcsjActual()) | ||
| 188 | + || StringUtils.isNotEmpty(sch.getZdsjActual())) | ||
| 189 | + continue; | ||
| 190 | + | ||
| 191 | + if (t - sch.getDfsjT() > threshold) | ||
| 192 | + continue; | ||
| 193 | + | ||
| 194 | + array[count] = sch; | ||
| 195 | + count++; | ||
| 196 | + } | ||
| 197 | + return array; | ||
| 198 | + } | ||
| 199 | +} |
src/main/java/com/bsth/data/car_out_info/UpdateDBThread.java
0 → 100644
| 1 | +package com.bsth.data.car_out_info; | ||
| 2 | + | ||
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | +import org.springframework.stereotype.Component; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 数据库发车信息表更新线程 | ||
| 8 | + * Created by panzhao on 2017/5/14. | ||
| 9 | + */ | ||
| 10 | +@Component | ||
| 11 | +public class UpdateDBThread extends Thread{ | ||
| 12 | + | ||
| 13 | + @Autowired | ||
| 14 | + CarOutInfoHandler carOutInfoHandler; | ||
| 15 | + | ||
| 16 | + @Override | ||
| 17 | + public void run() { | ||
| 18 | + carOutInfoHandler.updateAll(); | ||
| 19 | + } | ||
| 20 | +} |
src/main/java/com/bsth/data/directive/DayOfDirectives.java
| @@ -57,10 +57,11 @@ public class DayOfDirectives { | @@ -57,10 +57,11 @@ public class DayOfDirectives { | ||
| 57 | pstDirectives = new LinkedList<>(); | 57 | pstDirectives = new LinkedList<>(); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | - public void put60(D60 d60) { | 60 | + public void put60(D60 d60, boolean pst) { |
| 61 | d60Map.put(d60.getMsgId(), d60); | 61 | d60Map.put(d60.getMsgId(), d60); |
| 62 | //等待持久化 | 62 | //等待持久化 |
| 63 | - pstDirectives.add(d60); | 63 | + if(pst) |
| 64 | + pstDirectives.add(d60); | ||
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | public void put64(D64 d64) { | 67 | public void put64(D64 d64) { |
| @@ -165,7 +166,8 @@ public class DayOfDirectives { | @@ -165,7 +166,8 @@ public class DayOfDirectives { | ||
| 165 | if(null != d60Map.remove(d60.getMsgId())) | 166 | if(null != d60Map.remove(d60.getMsgId())) |
| 166 | c60 ++; | 167 | c60 ++; |
| 167 | } | 168 | } |
| 168 | - logger.info("清除60数据 ," + c60); | 169 | + if(c60 > 0) |
| 170 | + logger.info("清除60数据 ," + c60); | ||
| 169 | 171 | ||
| 170 | //找到该设备的64数据 | 172 | //找到该设备的64数据 |
| 171 | Collection<D64> d64s = d64Map.values(); | 173 | Collection<D64> d64s = d64Map.values(); |
| @@ -183,8 +185,9 @@ public class DayOfDirectives { | @@ -183,8 +185,9 @@ public class DayOfDirectives { | ||
| 183 | if(null != d64Map.remove(d64.getKey())) | 185 | if(null != d64Map.remove(d64.getKey())) |
| 184 | c64 ++; | 186 | c64 ++; |
| 185 | } | 187 | } |
| 186 | - | ||
| 187 | - logger.info("清除64数据 ," + c64); | 188 | + |
| 189 | + if(c64 > 0) | ||
| 190 | + logger.info("清除64数据 ," + c64); | ||
| 188 | } | 191 | } |
| 189 | 192 | ||
| 190 | public Collection<D60> all60(){ | 193 | public Collection<D60> all60(){ |
src/main/java/com/bsth/data/directive/DirectiveCreator.java
| 1 | package com.bsth.data.directive; | 1 | package com.bsth.data.directive; |
| 2 | 2 | ||
| 3 | -import java.text.SimpleDateFormat; | ||
| 4 | -import java.util.Date; | ||
| 5 | -import java.util.HashMap; | ||
| 6 | -import java.util.Map; | ||
| 7 | - | ||
| 8 | -import org.slf4j.Logger; | ||
| 9 | -import org.slf4j.LoggerFactory; | ||
| 10 | - | ||
| 11 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 12 | import com.bsth.data.BasicData; | 4 | import com.bsth.data.BasicData; |
| 13 | import com.bsth.entity.directive.D60; | 5 | import com.bsth.entity.directive.D60; |
| 14 | import com.bsth.entity.directive.D60.D60Data; | 6 | import com.bsth.entity.directive.D60.D60Data; |
| 15 | import com.bsth.entity.directive.D64; | 7 | import com.bsth.entity.directive.D64; |
| 16 | import com.bsth.entity.directive.D64.D64Data; | 8 | import com.bsth.entity.directive.D64.D64Data; |
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | + | ||
| 12 | +import java.text.SimpleDateFormat; | ||
| 13 | +import java.util.Date; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Map; | ||
| 17 | 16 | ||
| 18 | /** | 17 | /** |
| 19 | * | 18 | * |
| @@ -43,7 +42,7 @@ public class DirectiveCreator { | @@ -43,7 +42,7 @@ public class DirectiveCreator { | ||
| 43 | * @return Directive60 返回类型 | 42 | * @return Directive60 返回类型 |
| 44 | * @throws | 43 | * @throws |
| 45 | */ | 44 | */ |
| 46 | - public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state) { | 45 | + public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state,String lineCode) { |
| 47 | Long timestamp = System.currentTimeMillis(); | 46 | Long timestamp = System.currentTimeMillis(); |
| 48 | 47 | ||
| 49 | Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); | 48 | Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm)); |
| @@ -67,6 +66,7 @@ public class DirectiveCreator { | @@ -67,6 +66,7 @@ public class DirectiveCreator { | ||
| 67 | data.setCompanyCode(company); | 66 | data.setCompanyCode(company); |
| 68 | data.setMsgId(msgId); | 67 | data.setMsgId(msgId); |
| 69 | directive.setData(data); | 68 | directive.setData(data); |
| 69 | + directive.setLineCode(lineCode); | ||
| 70 | long serviceState; | 70 | long serviceState; |
| 71 | try { | 71 | try { |
| 72 | serviceState = Consts.SERVICE_STATE[upDown][state]; | 72 | serviceState = Consts.SERVICE_STATE[upDown][state]; |
| @@ -81,7 +81,7 @@ public class DirectiveCreator { | @@ -81,7 +81,7 @@ public class DirectiveCreator { | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | - public D60 createD60_02(String nbbm, String text, int upDown, int state, Date alarmTime){ | 84 | + public D60 createD60_01(String nbbm, String text, int upDown, int state, Date alarmTime){ |
| 85 | SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); | 85 | SimpleDateFormat sdfMMddHHmm = new SimpleDateFormat("MMddHHmm"); |
| 86 | 86 | ||
| 87 | Long timestamp = System.currentTimeMillis(); | 87 | Long timestamp = System.currentTimeMillis(); |
| @@ -102,7 +102,7 @@ public class DirectiveCreator { | @@ -102,7 +102,7 @@ public class DirectiveCreator { | ||
| 102 | directive.setMsgId(msgId); | 102 | directive.setMsgId(msgId); |
| 103 | // 构造数据 | 103 | // 构造数据 |
| 104 | data.setDeviceId(deviceId); | 104 | data.setDeviceId(deviceId); |
| 105 | - data.setDispatchInstruct((short) 0x02); | 105 | + data.setDispatchInstruct((short) 0x01); |
| 106 | data.setTimestamp(timestamp); | 106 | data.setTimestamp(timestamp); |
| 107 | data.setCompanyCode(company); | 107 | data.setCompanyCode(company); |
| 108 | data.setMsgId(msgId); | 108 | data.setMsgId(msgId); |
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
| 1 | package com.bsth.data.directive; | 1 | package com.bsth.data.directive; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 3 | import com.bsth.entity.directive.D60; | 4 | import com.bsth.entity.directive.D60; |
| 4 | import com.bsth.entity.directive.D64; | 5 | import com.bsth.entity.directive.D64; |
| 5 | import com.bsth.entity.directive.Directive; | 6 | import com.bsth.entity.directive.Directive; |
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 6 | import com.bsth.repository.directive.D60Repository; | 8 | import com.bsth.repository.directive.D60Repository; |
| 7 | import com.bsth.repository.directive.D64Repository; | 9 | import com.bsth.repository.directive.D64Repository; |
| 8 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| @@ -27,8 +29,12 @@ public class DirectivesPstThread extends Thread { | @@ -27,8 +29,12 @@ public class DirectivesPstThread extends Thread { | ||
| 27 | @Autowired | 29 | @Autowired |
| 28 | D64Repository d64Repository; | 30 | D64Repository d64Repository; |
| 29 | 31 | ||
| 32 | + @Autowired | ||
| 33 | + DayOfSchedule dayOfSchedule; | ||
| 34 | + | ||
| 30 | @Override | 35 | @Override |
| 31 | public void run() { | 36 | public void run() { |
| 37 | + | ||
| 32 | LinkedList<Directive> list = DayOfDirectives.pstDirectives; | 38 | LinkedList<Directive> list = DayOfDirectives.pstDirectives; |
| 33 | 39 | ||
| 34 | Directive directive; | 40 | Directive directive; |
| @@ -37,7 +43,20 @@ public class DirectivesPstThread extends Thread { | @@ -37,7 +43,20 @@ public class DirectivesPstThread extends Thread { | ||
| 37 | directive = list.poll(); | 43 | directive = list.poll(); |
| 38 | 44 | ||
| 39 | if (directive instanceof D60) { | 45 | if (directive instanceof D60) { |
| 40 | - d60Repository.save((D60) directive); | 46 | + D60 d60 = (D60) directive; |
| 47 | + if(d60.isDispatch()){ | ||
| 48 | + ScheduleRealInfo sch = d60.getSch(); | ||
| 49 | + //如果关联的班次已经不存在了,放弃入库 | ||
| 50 | + if(sch.isDeleted()){ | ||
| 51 | + logger.warn("save 指令,发现 deleted=true 的班次,id=" + sch.getId()); | ||
| 52 | + continue; | ||
| 53 | + } | ||
| 54 | + if(dayOfSchedule.get(sch.getId()) == null){ | ||
| 55 | + logger.warn("班次:" + sch.getId() + "不存在了,调度指令放弃入库。"); | ||
| 56 | + continue; | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + d60Repository.save(d60); | ||
| 41 | } | 60 | } |
| 42 | 61 | ||
| 43 | if (directive instanceof D64) { | 62 | if (directive instanceof D64) { |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| 1 | package com.bsth.data.directive; | 1 | package com.bsth.data.directive; |
| 2 | 2 | ||
| 3 | -import java.io.IOException; | ||
| 4 | - | 3 | +import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.bsth.util.ConfigUtil; | ||
| 5 | import org.apache.http.client.config.RequestConfig; | 5 | import org.apache.http.client.config.RequestConfig; |
| 6 | import org.apache.http.client.methods.CloseableHttpResponse; | 6 | import org.apache.http.client.methods.CloseableHttpResponse; |
| 7 | import org.apache.http.client.methods.HttpPost; | 7 | import org.apache.http.client.methods.HttpPost; |
| @@ -12,8 +12,7 @@ import org.apache.http.util.EntityUtils; | @@ -12,8 +12,7 @@ import org.apache.http.util.EntityUtils; | ||
| 12 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 14 | 14 | ||
| 15 | -import com.alibaba.fastjson.JSONObject; | ||
| 16 | -import com.bsth.util.ConfigUtil; | 15 | +import java.io.IOException; |
| 17 | 16 | ||
| 18 | /** | 17 | /** |
| 19 | * | 18 | * |
| @@ -42,8 +41,8 @@ public class GatewayHttpUtils { | @@ -42,8 +41,8 @@ public class GatewayHttpUtils { | ||
| 42 | 41 | ||
| 43 | //超时时间 | 42 | //超时时间 |
| 44 | RequestConfig requestConfig = RequestConfig.custom() | 43 | RequestConfig requestConfig = RequestConfig.custom() |
| 45 | - .setConnectTimeout(3000).setConnectionRequestTimeout(1000) | ||
| 46 | - .setSocketTimeout(3000).build(); | 44 | + .setConnectTimeout(1500).setConnectionRequestTimeout(1000) |
| 45 | + .setSocketTimeout(1500).build(); | ||
| 47 | 46 | ||
| 48 | HttpPost post = new HttpPost(url); | 47 | HttpPost post = new HttpPost(url); |
| 49 | 48 |
src/main/java/com/bsth/data/arrival/ArrivalComparator.java renamed to src/main/java/com/bsth/data/forecast/ArrivalComparator.java
src/main/java/com/bsth/data/arrival/DataLoader.java renamed to src/main/java/com/bsth/data/forecast/ArrivalDataLoader.java
| 1 | -package com.bsth.data.arrival; | 1 | +package com.bsth.data.forecast; |
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.LineConfigData; | ||
| 5 | +import com.bsth.data.forecast.entity.ArrivalEntity; | ||
| 6 | +import com.bsth.entity.realcontrol.LineConfig; | ||
| 7 | +import com.bsth.util.db.DBUtils_MS; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 2 | 12 | ||
| 3 | import java.sql.Connection; | 13 | import java.sql.Connection; |
| 4 | import java.sql.PreparedStatement; | 14 | import java.sql.PreparedStatement; |
| @@ -9,16 +19,6 @@ import java.util.Calendar; | @@ -9,16 +19,6 @@ import java.util.Calendar; | ||
| 9 | import java.util.Collection; | 19 | import java.util.Collection; |
| 10 | import java.util.List; | 20 | import java.util.List; |
| 11 | 21 | ||
| 12 | -import org.slf4j.Logger; | ||
| 13 | -import org.slf4j.LoggerFactory; | ||
| 14 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 15 | -import org.springframework.stereotype.Component; | ||
| 16 | - | ||
| 17 | -import com.bsth.data.BasicData; | ||
| 18 | -import com.bsth.data.LineConfigData; | ||
| 19 | -import com.bsth.entity.realcontrol.LineConfig; | ||
| 20 | -import com.bsth.util.db.DBUtils_MS; | ||
| 21 | - | ||
| 22 | /** | 22 | /** |
| 23 | * | 23 | * |
| 24 | * @ClassName: DataLoader | 24 | * @ClassName: DataLoader |
| @@ -28,7 +28,7 @@ import com.bsth.util.db.DBUtils_MS; | @@ -28,7 +28,7 @@ import com.bsth.util.db.DBUtils_MS; | ||
| 28 | * | 28 | * |
| 29 | */ | 29 | */ |
| 30 | @Component | 30 | @Component |
| 31 | -public class DataLoader { | 31 | +public class ArrivalDataLoader { |
| 32 | 32 | ||
| 33 | private static Long prveLoadTime; | 33 | private static Long prveLoadTime; |
| 34 | 34 |
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
| @@ -47,7 +47,7 @@ public class ForecastRealServer implements CommandLineRunner { | @@ -47,7 +47,7 @@ public class ForecastRealServer implements CommandLineRunner { | ||
| 47 | 47 | ||
| 48 | //车辆 ——> 预测终点时间 | 48 | //车辆 ——> 预测终点时间 |
| 49 | //static Map<String, Float> forecastMap = new HashMap<>(); | 49 | //static Map<String, Float> forecastMap = new HashMap<>(); |
| 50 | - //线路_上下行 ——> 封装耗时数据的路由链 | 50 | + //线路_上下行 ——> 耗时数据的路由链 |
| 51 | public static ArrayListMultimap<String, SimpleRoute> lineSampleMap; | 51 | public static ArrayListMultimap<String, SimpleRoute> lineSampleMap; |
| 52 | //车辆 ——> 预测结果 | 52 | //车辆 ——> 预测结果 |
| 53 | public static Map<String, ForecastResult> forecastMap; | 53 | public static Map<String, ForecastResult> forecastMap; |
src/main/java/com/bsth/data/arrival/ArrivalEntity.java renamed to src/main/java/com/bsth/data/forecast/entity/ArrivalEntity.java
| 1 | -package com.bsth.data.arrival; | 1 | +package com.bsth.data.forecast.entity; |
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 2 | 4 | ||
| 3 | import java.text.SimpleDateFormat; | 5 | import java.text.SimpleDateFormat; |
| 4 | import java.util.Date; | 6 | import java.util.Date; |
| 5 | 7 | ||
| 6 | -import com.bsth.data.BasicData; | ||
| 7 | - | ||
| 8 | /** | 8 | /** |
| 9 | * | 9 | * |
| 10 | * @ClassName: ArrivalEntity | 10 | * @ClassName: ArrivalEntity |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| @@ -11,10 +11,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore; | @@ -11,10 +11,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 11 | * @date 2016年5月11日 下午4:32:07 | 11 | * @date 2016年5月11日 下午4:32:07 |
| 12 | * | 12 | * |
| 13 | */ | 13 | */ |
| 14 | -public class GpsEntity { | 14 | +public class GpsEntity implements Cloneable{ |
| 15 | 15 | ||
| 16 | /** 公司代码 */ | 16 | /** 公司代码 */ |
| 17 | - private Integer companyCode; | 17 | + private Short companyCode; |
| 18 | 18 | ||
| 19 | /** 线路编码 */ | 19 | /** 线路编码 */ |
| 20 | private String lineId; | 20 | private String lineId; |
| @@ -40,30 +40,30 @@ public class GpsEntity { | @@ -40,30 +40,30 @@ public class GpsEntity { | ||
| 40 | /** 纬度 */ | 40 | /** 纬度 */ |
| 41 | private Float lat; | 41 | private Float lat; |
| 42 | 42 | ||
| 43 | - /** 发送时间戳 */ | 43 | + /** GPS发送时间戳 */ |
| 44 | private Long timestamp; | 44 | private Long timestamp; |
| 45 | 45 | ||
| 46 | + /** 网关收到时间 */ | ||
| 47 | + private Long serverTimestamp; | ||
| 48 | + | ||
| 46 | /** 速度 */ | 49 | /** 速度 */ |
| 47 | private Float speed; | 50 | private Float speed; |
| 48 | 51 | ||
| 49 | /** 方向(角度) */ | 52 | /** 方向(角度) */ |
| 50 | - private Float direction; | 53 | + private float direction; |
| 51 | 54 | ||
| 52 | /** 营运状态( 0 营运 ,1 非营运, -1 无效) */ | 55 | /** 营运状态( 0 营运 ,1 非营运, -1 无效) */ |
| 53 | private Integer state; | 56 | private Integer state; |
| 54 | 57 | ||
| 55 | /** 上下行(0 上行 , 1 下行 , -1 无效) */ | 58 | /** 上下行(0 上行 , 1 下行 , -1 无效) */ |
| 56 | - private Integer upDown; | 59 | + private Byte upDown; |
| 57 | 60 | ||
| 58 | /** 车辆内部编码 */ | 61 | /** 车辆内部编码 */ |
| 59 | private String nbbm; | 62 | private String nbbm; |
| 60 | 63 | ||
| 61 | /** 预计到达终点时间 */ | 64 | /** 预计到达终点时间 */ |
| 62 | private Float expectStopTime; | 65 | private Float expectStopTime; |
| 63 | - | ||
| 64 | - /** 设备是否在线 | ||
| 65 | - private boolean online; | ||
| 66 | - */ | 66 | + |
| 67 | /** 当前执行班次ID */ | 67 | /** 当前执行班次ID */ |
| 68 | private Long schId; | 68 | private Long schId; |
| 69 | 69 | ||
| @@ -91,12 +91,19 @@ public class GpsEntity { | @@ -91,12 +91,19 @@ public class GpsEntity { | ||
| 91 | /** gps是否有效 设备端发送的状态 */ | 91 | /** gps是否有效 设备端发送的状态 */ |
| 92 | private int valid; | 92 | private int valid; |
| 93 | 93 | ||
| 94 | - public Integer getCompanyCode() { | ||
| 95 | - return companyCode; | ||
| 96 | - } | 94 | + /** |
| 95 | + * 数据来源 | ||
| 96 | + * 1:网关 | ||
| 97 | + * 0:转发 | ||
| 98 | + */ | ||
| 99 | + private int source = -1; | ||
| 97 | 100 | ||
| 98 | - public void setCompanyCode(Integer companyCode) { | ||
| 99 | - this.companyCode = companyCode; | 101 | + public Object clone() { |
| 102 | + try { | ||
| 103 | + return super.clone(); | ||
| 104 | + } catch (CloneNotSupportedException e) { | ||
| 105 | + return null; | ||
| 106 | + } | ||
| 100 | } | 107 | } |
| 101 | 108 | ||
| 102 | public String getDeviceId() { | 109 | public String getDeviceId() { |
| @@ -147,21 +154,6 @@ public class GpsEntity { | @@ -147,21 +154,6 @@ public class GpsEntity { | ||
| 147 | this.timestamp = timestamp; | 154 | this.timestamp = timestamp; |
| 148 | } | 155 | } |
| 149 | 156 | ||
| 150 | - public Float getSpeed() { | ||
| 151 | - return speed; | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | - public void setSpeed(Float speed) { | ||
| 155 | - this.speed = speed; | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - public Float getDirection() { | ||
| 159 | - return direction; | ||
| 160 | - } | ||
| 161 | - | ||
| 162 | - public void setDirection(Float direction) { | ||
| 163 | - this.direction = direction; | ||
| 164 | - } | ||
| 165 | 157 | ||
| 166 | public Integer getState() { | 158 | public Integer getState() { |
| 167 | return state; | 159 | return state; |
| @@ -171,14 +163,6 @@ public class GpsEntity { | @@ -171,14 +163,6 @@ public class GpsEntity { | ||
| 171 | this.state = state; | 163 | this.state = state; |
| 172 | } | 164 | } |
| 173 | 165 | ||
| 174 | - public Integer getUpDown() { | ||
| 175 | - return upDown; | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - public void setUpDown(Integer upDown) { | ||
| 179 | - this.upDown = upDown; | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | public String getNbbm() { | 166 | public String getNbbm() { |
| 183 | return nbbm; | 167 | return nbbm; |
| 184 | } | 168 | } |
| @@ -291,4 +275,87 @@ public class GpsEntity { | @@ -291,4 +275,87 @@ public class GpsEntity { | ||
| 291 | public void setValid(int valid) { | 275 | public void setValid(int valid) { |
| 292 | this.valid = valid; | 276 | this.valid = valid; |
| 293 | } | 277 | } |
| 278 | + | ||
| 279 | + | ||
| 280 | + | ||
| 281 | + public short getCompanyCode() { | ||
| 282 | + return companyCode; | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + public void setCompanyCode(short companyCode) { | ||
| 286 | + this.companyCode = companyCode; | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + public Byte getUpDown() { | ||
| 290 | + return upDown; | ||
| 291 | + } | ||
| 292 | + | ||
| 293 | + public void setUpDown(Byte upDown) { | ||
| 294 | + this.upDown = upDown; | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + | ||
| 298 | + public float getDirection() { | ||
| 299 | + return direction; | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + public void setDirection(float direction) { | ||
| 303 | + this.direction = direction; | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + public Float getSpeed() { | ||
| 307 | + return speed; | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + public void setSpeed(Float speed) { | ||
| 311 | + this.speed = speed; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + public int getSource() { | ||
| 315 | + return source; | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + public void setSource(int source) { | ||
| 319 | + this.source = source; | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + public void offline(){ | ||
| 323 | + this.setAbnormalStatus("offline"); | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | +/* public boolean isOnline(){ | ||
| 327 | + if(isOffline()) | ||
| 328 | + return false; | ||
| 329 | + | ||
| 330 | + long t = System.currentTimeMillis(); | ||
| 331 | + | ||
| 332 | + if((t - this.getServerTimestamp()) > 1000 * 60 * 2){ | ||
| 333 | + return false; | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + if((this.getServerTimestamp() - t) > 1000 * 60 * 3){ | ||
| 337 | + return false; | ||
| 338 | + } | ||
| 339 | + return true; | ||
| 340 | + }*/ | ||
| 341 | + | ||
| 342 | + /** | ||
| 343 | + * 是否营运 | ||
| 344 | + * @return | ||
| 345 | + */ | ||
| 346 | + public boolean isService(){ | ||
| 347 | + return state!=null && state==0; | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + public boolean isOffline(){ | ||
| 351 | + return this.getAbnormalStatus() != null && this.getAbnormalStatus().equals("offline"); | ||
| 352 | + } | ||
| 353 | + | ||
| 354 | + public Long getServerTimestamp() { | ||
| 355 | + return serverTimestamp; | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + public void setServerTimestamp(Long serverTimestamp) { | ||
| 359 | + this.serverTimestamp = serverTimestamp; | ||
| 360 | + } | ||
| 294 | } | 361 | } |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| @@ -2,8 +2,6 @@ package com.bsth.data.gpsdata; | @@ -2,8 +2,6 @@ package com.bsth.data.gpsdata; | ||
| 2 | 2 | ||
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | import com.bsth.data.forecast.ForecastRealServer; | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 5 | -import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | ||
| 6 | -import com.bsth.data.gpsdata.thread.OfflineMonitorThread; | ||
| 7 | import com.bsth.data.schedule.DayOfSchedule; | 5 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | import com.google.common.collect.TreeMultimap; | 7 | import com.google.common.collect.TreeMultimap; |
| @@ -11,10 +9,11 @@ import org.apache.commons.lang3.StringUtils; | @@ -11,10 +9,11 @@ import org.apache.commons.lang3.StringUtils; | ||
| 11 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 12 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | -import org.springframework.boot.CommandLineRunner; | ||
| 15 | import org.springframework.stereotype.Component; | 12 | import org.springframework.stereotype.Component; |
| 16 | 13 | ||
| 17 | import java.util.*; | 14 | import java.util.*; |
| 15 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 16 | +import java.util.concurrent.ConcurrentMap; | ||
| 18 | 17 | ||
| 19 | /** | 18 | /** |
| 20 | * @author PanZhao | 19 | * @author PanZhao |
| @@ -23,22 +22,16 @@ import java.util.*; | @@ -23,22 +22,16 @@ import java.util.*; | ||
| 23 | * @date 2016年8月12日 下午2:04:41 | 22 | * @date 2016年8月12日 下午2:04:41 |
| 24 | */ | 23 | */ |
| 25 | @Component | 24 | @Component |
| 26 | -public class GpsRealData implements CommandLineRunner { | 25 | +public class GpsRealData { |
| 27 | 26 | ||
| 28 | static Logger logger = LoggerFactory.getLogger(GpsRealData.class); | 27 | static Logger logger = LoggerFactory.getLogger(GpsRealData.class); |
| 29 | 28 | ||
| 30 | - private static Map<String, GpsEntity> gpsMap; | 29 | + private static ConcurrentMap<String, GpsEntity> gpsMap; |
| 31 | 30 | ||
| 32 | //按线路分组设备号 | 31 | //按线路分组设备号 |
| 33 | private static TreeMultimap<String, String> lineCode2Devices; | 32 | private static TreeMultimap<String, String> lineCode2Devices; |
| 34 | 33 | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | - GpsDataLoaderThread gpsDataLoader; | ||
| 37 | - | ||
| 38 | - @Autowired | ||
| 39 | - OfflineMonitorThread offlineMonitorThread; | ||
| 40 | - | ||
| 41 | - @Autowired | ||
| 42 | DayOfSchedule dayOfSchedule; | 35 | DayOfSchedule dayOfSchedule; |
| 43 | 36 | ||
| 44 | @Autowired | 37 | @Autowired |
| @@ -48,19 +41,10 @@ public class GpsRealData implements CommandLineRunner { | @@ -48,19 +41,10 @@ public class GpsRealData implements CommandLineRunner { | ||
| 48 | * 构造函数 | 41 | * 构造函数 |
| 49 | */ | 42 | */ |
| 50 | public GpsRealData() { | 43 | public GpsRealData() { |
| 51 | - gpsMap = new HashMap<>(); | 44 | + gpsMap = new ConcurrentHashMap<>(); |
| 52 | lineCode2Devices = TreeMultimap.create(); | 45 | lineCode2Devices = TreeMultimap.create(); |
| 53 | } | 46 | } |
| 54 | 47 | ||
| 55 | - @Override | ||
| 56 | - public void run(String... arg0) throws Exception { | ||
| 57 | - logger.info("gpsDataLoader,20,3"); | ||
| 58 | - //定时从网关获取GPS数据 | ||
| 59 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS); | ||
| 60 | - //定时扫描掉离线 | ||
| 61 | - //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | 48 | ||
| 65 | public void put(GpsEntity gps) { | 49 | public void put(GpsEntity gps) { |
| 66 | String device = gps.getDeviceId(); | 50 | String device = gps.getDeviceId(); |
| @@ -79,19 +63,29 @@ public class GpsRealData implements CommandLineRunner { | @@ -79,19 +63,29 @@ public class GpsRealData implements CommandLineRunner { | ||
| 79 | gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); | 63 | gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); |
| 80 | } | 64 | } |
| 81 | } | 65 | } |
| 82 | - } catch (Exception e) { | ||
| 83 | - logger.error("", e); | ||
| 84 | - } | ||
| 85 | 66 | ||
| 86 | - //刷新对照 | ||
| 87 | - gpsMap.put(device, gps); | ||
| 88 | - if (StringUtils.isNotBlank(gps.getLineId())) { | ||
| 89 | - //站点名称 | ||
| 90 | - gps.setStationName(getStationName(gps)); | ||
| 91 | - lineCode2Devices.put(gps.getLineId(), device); | 67 | + //刷新对照 |
| 68 | + gpsMap.put(device, gps); | ||
| 69 | + if (StringUtils.isNotBlank(gps.getLineId())) { | ||
| 70 | + //站点名称 | ||
| 71 | + gps.setStationName(getStationName(gps)); | ||
| 72 | + lineCode2Devices.put(gps.getLineId(), device); | ||
| 73 | + | ||
| 74 | + if(old != null && !gps.getLineId().equals(old.getLineId())) | ||
| 75 | + lineCode2Devices.remove(old.getLineId(), device); | ||
| 76 | + } | ||
| 92 | 77 | ||
| 93 | - if(old != null && !gps.getLineId().equals(old.getLineId())) | ||
| 94 | - lineCode2Devices.remove(old.getLineId(), device); | 78 | + //车辆换设备了 |
| 79 | + String nbbm = gps.getNbbm(); | ||
| 80 | + if(old != null && StringUtils.isNotEmpty(nbbm) && !nbbm.equals(old.getNbbm())){ | ||
| 81 | + List<GpsEntity> list = findByNbbm(nbbm); | ||
| 82 | + for(GpsEntity g : list){ | ||
| 83 | + if(!g.getDeviceId().equals(device)) | ||
| 84 | + gpsMap.remove(g.getDeviceId()); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + } catch (Exception e) { | ||
| 88 | + logger.error("", e); | ||
| 95 | } | 89 | } |
| 96 | } | 90 | } |
| 97 | 91 | ||
| @@ -106,6 +100,24 @@ public class GpsRealData implements CommandLineRunner { | @@ -106,6 +100,24 @@ public class GpsRealData implements CommandLineRunner { | ||
| 106 | return gpsMap.get(deviceId); | 100 | return gpsMap.get(deviceId); |
| 107 | } | 101 | } |
| 108 | 102 | ||
| 103 | + public List<GpsEntity> findByNbbm(String nbbm){ | ||
| 104 | + Collection<GpsEntity> arr = gpsMap.values(); | ||
| 105 | + List<GpsEntity> rs = new ArrayList<>(); | ||
| 106 | + for(GpsEntity g : arr){ | ||
| 107 | + if(nbbm.equals(g.getNbbm())) | ||
| 108 | + rs.add(g); | ||
| 109 | + } | ||
| 110 | + return rs; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public GpsEntity getByNbbm(String nbbm){ | ||
| 114 | + String device = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | ||
| 115 | + if(StringUtils.isNotBlank(device)) | ||
| 116 | + return get(device); | ||
| 117 | + else | ||
| 118 | + return null; | ||
| 119 | + } | ||
| 120 | + | ||
| 109 | /** | 121 | /** |
| 110 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws | 122 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws |
| 111 | */ | 123 | */ |
src/main/java/com/bsth/data/gpsdata/SignalStateData.java
| @@ -23,9 +23,9 @@ public class SignalStateData { | @@ -23,9 +23,9 @@ public class SignalStateData { | ||
| 23 | private static ArrayListMultimap<String, SignalState> listMultimap = ArrayListMultimap.create(); | 23 | private static ArrayListMultimap<String, SignalState> listMultimap = ArrayListMultimap.create(); |
| 24 | 24 | ||
| 25 | public void put(SignalState state){ | 25 | public void put(SignalState state){ |
| 26 | - listMultimap.put(state.getLineCode(), state); | 26 | + //listMultimap.put(state.getLineCode(), state); |
| 27 | //推送到客户端 | 27 | //推送到客户端 |
| 28 | - sendUtils.sendSignalState(state); | 28 | + //sendUtils.sendSignalState(state); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | public List<SignalState> get(String idx){ | 31 | public List<SignalState> get(String idx){ |
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
| @@ -36,6 +36,9 @@ public class GeoCacheData { | @@ -36,6 +36,9 @@ public class GeoCacheData { | ||
| 36 | //线路路段走向 | 36 | //线路路段走向 |
| 37 | private static ArrayListMultimap<String, LineString> sectionCacheMap; | 37 | private static ArrayListMultimap<String, LineString> sectionCacheMap; |
| 38 | 38 | ||
| 39 | + //路段编码和名称对照 | ||
| 40 | + private static Map<String, String> sectionCode2Name; | ||
| 41 | + | ||
| 39 | //线路站点路由 | 42 | //线路站点路由 |
| 40 | private static ArrayListMultimap<String, StationRoute> stationCacheMap; | 43 | private static ArrayListMultimap<String, StationRoute> stationCacheMap; |
| 41 | 44 | ||
| @@ -44,6 +47,8 @@ public class GeoCacheData { | @@ -44,6 +47,8 @@ public class GeoCacheData { | ||
| 44 | 47 | ||
| 45 | //停车场 | 48 | //停车场 |
| 46 | public static Map<String, Polygon> tccMap; | 49 | public static Map<String, Polygon> tccMap; |
| 50 | + //停车场 | ||
| 51 | + public static Map<String, com.bsth.util.Geo.Polygon> tccMap2; | ||
| 47 | 52 | ||
| 48 | //线路限速信息 | 53 | //线路限速信息 |
| 49 | private static Map<String, Double> speedLimitMap; | 54 | private static Map<String, Double> speedLimitMap; |
| @@ -78,6 +83,10 @@ public class GeoCacheData { | @@ -78,6 +83,10 @@ public class GeoCacheData { | ||
| 78 | } | 83 | } |
| 79 | } | 84 | } |
| 80 | 85 | ||
| 86 | + public static Map<String, String> sectionCode2NameMap(){ | ||
| 87 | + return sectionCode2Name; | ||
| 88 | + } | ||
| 89 | + | ||
| 81 | public static StationRoute getRouteCode(GpsEntity gps) { | 90 | public static StationRoute getRouteCode(GpsEntity gps) { |
| 82 | return routeCodeMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()); | 91 | return routeCodeMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo()); |
| 83 | } | 92 | } |
| @@ -135,17 +144,18 @@ public class GeoCacheData { | @@ -135,17 +144,18 @@ public class GeoCacheData { | ||
| 135 | } | 144 | } |
| 136 | 145 | ||
| 137 | private void loadRoadsData() { | 146 | private void loadRoadsData() { |
| 138 | - String sql = "select r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) as GSECTION_VECTOR, r.DIRECTIONS from bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section=s.id where r.destroy=0 and GSECTION_VECTOR is not null order by line_code,directions,sectionroute_code"; | 147 | + //加载线路下路段空间数据 |
| 148 | + String sql = "select r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) as GSECTION_VECTOR, r.DIRECTIONS, s.CROSES_ROAD from bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section=s.id where r.destroy=0 and GSECTION_VECTOR is not null order by line_code,directions,sectionroute_code"; | ||
| 139 | List<Map<String, Object>> secList = jdbcTemplate.queryForList(sql); | 149 | List<Map<String, Object>> secList = jdbcTemplate.queryForList(sql); |
| 140 | 150 | ||
| 141 | String polygonStr, key; | 151 | String polygonStr, key; |
| 142 | String[] coords; | 152 | String[] coords; |
| 143 | int i, len; | 153 | int i, len; |
| 144 | - | ||
| 145 | ArrayListMultimap<String, LineString> sectionCacheTempMap = ArrayListMultimap.create(); | 154 | ArrayListMultimap<String, LineString> sectionCacheTempMap = ArrayListMultimap.create(); |
| 146 | Coordinate[] cds; | 155 | Coordinate[] cds; |
| 147 | String[] temps1, temps2; | 156 | String[] temps1, temps2; |
| 148 | for (Map<String, Object> tMap : secList) { | 157 | for (Map<String, Object> tMap : secList) { |
| 158 | + //空间数据映射 | ||
| 149 | polygonStr = tMap.get("GSECTION_VECTOR").toString(); | 159 | polygonStr = tMap.get("GSECTION_VECTOR").toString(); |
| 150 | key = tMap.get("LINE_CODE") + "_" + tMap.get("DIRECTIONS"); | 160 | key = tMap.get("LINE_CODE") + "_" + tMap.get("DIRECTIONS"); |
| 151 | 161 | ||
| @@ -166,6 +176,24 @@ public class GeoCacheData { | @@ -166,6 +176,24 @@ public class GeoCacheData { | ||
| 166 | 176 | ||
| 167 | if(sectionCacheTempMap.size() > 0) | 177 | if(sectionCacheTempMap.size() > 0) |
| 168 | sectionCacheMap = sectionCacheTempMap; | 178 | sectionCacheMap = sectionCacheTempMap; |
| 179 | + | ||
| 180 | + Map<String, String> sectionCode2NameTemp = new HashMap<>(); | ||
| 181 | + | ||
| 182 | + //加载全量路段编码和名称对照 | ||
| 183 | + sql = "select SECTION_CODE,SECTION_NAME,CROSES_ROAD from bsth_c_section"; | ||
| 184 | + secList = jdbcTemplate.queryForList(sql); | ||
| 185 | + String name = null, code; | ||
| 186 | + for (Map<String, Object> tMap : secList) { | ||
| 187 | + if(tMap.get("CROSES_ROAD") != null && StringUtils.isNotEmpty(tMap.get("CROSES_ROAD").toString())) | ||
| 188 | + name = tMap.get("CROSES_ROAD").toString(); | ||
| 189 | + else if(tMap.get("SECTION_NAME") != null && StringUtils.isNotEmpty(tMap.get("SECTION_NAME").toString())) | ||
| 190 | + name = tMap.get("SECTION_NAME").toString(); | ||
| 191 | + | ||
| 192 | + code = tMap.get("SECTION_CODE").toString(); | ||
| 193 | + sectionCode2NameTemp.put(code, name); | ||
| 194 | + } | ||
| 195 | + if(sectionCode2NameTemp.size() > 0) | ||
| 196 | + sectionCode2Name = sectionCode2NameTemp; | ||
| 169 | } | 197 | } |
| 170 | 198 | ||
| 171 | private void loadTccMapData(){ | 199 | private void loadTccMapData(){ |
| @@ -185,8 +213,31 @@ public class GeoCacheData { | @@ -185,8 +213,31 @@ public class GeoCacheData { | ||
| 185 | logger.error("停车场:" + tMap.get("PARK_CODE"), e); | 213 | logger.error("停车场:" + tMap.get("PARK_CODE"), e); |
| 186 | } | 214 | } |
| 187 | } | 215 | } |
| 188 | - if (tccTempMap.size() > 0) | 216 | + if (tccTempMap.size() > 0){ |
| 189 | tccMap = tccTempMap; | 217 | tccMap = tccTempMap; |
| 218 | + tccMap2 = convertPolygonMap(tccMap); | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + private Map<String, com.bsth.util.Geo.Polygon> convertPolygonMap(Map<String, Polygon> tccMap) { | ||
| 223 | + Map<String, com.bsth.util.Geo.Polygon> rsMap = new HashMap<>(); | ||
| 224 | + Set<String> ks = tccMap.keySet(); | ||
| 225 | + for(String k : ks){ | ||
| 226 | + rsMap.put(k, convertPolygon(tccMap.get(k))); | ||
| 227 | + } | ||
| 228 | + return rsMap; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public static com.bsth.util.Geo.Polygon convertPolygon(Polygon polygon) { | ||
| 232 | + List<com.bsth.util.Geo.Point> ps = new ArrayList<>(); | ||
| 233 | + com.bsth.util.Geo.Point p; | ||
| 234 | + | ||
| 235 | + Coordinate[] cs = polygon.getCoordinates(); | ||
| 236 | + for(int i = 0; i < cs.length;i ++){ | ||
| 237 | + p = new com.bsth.util.Geo.Point(cs[i].y, cs[i].x); | ||
| 238 | + ps.add(p); | ||
| 239 | + } | ||
| 240 | + return new com.bsth.util.Geo.Polygon(ps); | ||
| 190 | } | 241 | } |
| 191 | 242 | ||
| 192 | private void loadStationRoutesData(){ | 243 | private void loadStationRoutesData(){ |
| @@ -285,7 +336,7 @@ public class GeoCacheData { | @@ -285,7 +336,7 @@ public class GeoCacheData { | ||
| 285 | * @param stationCode | 336 | * @param stationCode |
| 286 | * @return | 337 | * @return |
| 287 | */ | 338 | */ |
| 288 | - public static boolean isEndStation(String lineId, Integer upDown, String stationCode) { | 339 | + public static boolean isEndStation(String lineId, Byte upDown, String stationCode) { |
| 289 | StationRoute station = routeCodeMap.get(lineId + "_" + upDown + "_" + stationCode); | 340 | StationRoute station = routeCodeMap.get(lineId + "_" + upDown + "_" + stationCode); |
| 290 | return station != null && station.getMark().equals("E"); | 341 | return station != null && station.getMark().equals("E"); |
| 291 | } | 342 | } |
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
| @@ -4,12 +4,14 @@ import com.bsth.data.gpsdata.GpsEntity; | @@ -4,12 +4,14 @@ import com.bsth.data.gpsdata.GpsEntity; | ||
| 4 | import com.bsth.data.gpsdata.GpsRealData; | 4 | import com.bsth.data.gpsdata.GpsRealData; |
| 5 | import com.bsth.data.gpsdata.arrival.handlers.*; | 5 | import com.bsth.data.gpsdata.arrival.handlers.*; |
| 6 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | 6 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 7 | +import com.bsth.data.gpsdata.recovery.GpsDataRecovery; | ||
| 8 | +import com.google.common.collect.ArrayListMultimap; | ||
| 7 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.stereotype.Component; | 12 | import org.springframework.stereotype.Component; |
| 11 | 13 | ||
| 12 | -import java.util.List; | 14 | +import java.util.*; |
| 13 | import java.util.concurrent.CountDownLatch; | 15 | import java.util.concurrent.CountDownLatch; |
| 14 | import java.util.concurrent.ExecutorService; | 16 | import java.util.concurrent.ExecutorService; |
| 15 | import java.util.concurrent.Executors; | 17 | import java.util.concurrent.Executors; |
| @@ -21,7 +23,7 @@ import java.util.concurrent.Executors; | @@ -21,7 +23,7 @@ import java.util.concurrent.Executors; | ||
| 21 | @Component | 23 | @Component |
| 22 | public class GpsRealAnalyse { | 24 | public class GpsRealAnalyse { |
| 23 | 25 | ||
| 24 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | 26 | + static Logger logger = LoggerFactory.getLogger(GpsRealAnalyse.class); |
| 25 | 27 | ||
| 26 | @Autowired | 28 | @Autowired |
| 27 | OfflineSignalHandle offlineSignalHandle; | 29 | OfflineSignalHandle offlineSignalHandle; |
| @@ -39,34 +41,73 @@ public class GpsRealAnalyse { | @@ -39,34 +41,73 @@ public class GpsRealAnalyse { | ||
| 39 | @Autowired | 41 | @Autowired |
| 40 | GpsRealData gpsRealData; | 42 | GpsRealData gpsRealData; |
| 41 | 43 | ||
| 42 | - //50个线程 | ||
| 43 | - static ExecutorService threadPool = Executors.newFixedThreadPool(50); | 44 | + static ExecutorService threadPool = Executors.newFixedThreadPool(25); |
| 44 | 45 | ||
| 45 | - public void analyse(List<GpsEntity> list) { | ||
| 46 | - CountDownLatch count = new CountDownLatch(list.size()); | 46 | + public static long st; |
| 47 | + public static CountDownLatch count; | ||
| 48 | + | ||
| 49 | + public static boolean isBlock() { | ||
| 50 | + return System.currentTimeMillis() - st > 1000 * 20; | ||
| 51 | + } | ||
| 47 | 52 | ||
| 48 | - for(GpsEntity gps : list) | ||
| 49 | - threadPool.execute(new SignalHandleThread(gps, count)); | 53 | + public static boolean isIdle(){ |
| 54 | + return System.currentTimeMillis() - st > 1000 * 60; | ||
| 55 | + } | ||
| 50 | 56 | ||
| 57 | + public void analyse(List<GpsEntity> list) { | ||
| 51 | try { | 58 | try { |
| 59 | + if(list.size() == 0 || GpsDataRecovery.run) | ||
| 60 | + return; | ||
| 61 | + st = System.currentTimeMillis(); | ||
| 62 | + | ||
| 63 | + //按线路分组gps | ||
| 64 | + ArrayListMultimap multimap = ArrayListMultimap.create(); | ||
| 65 | + for (GpsEntity gps : list) { | ||
| 66 | + multimap.put(gps.getLineId(), gps); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + Set<String> ks = multimap.keySet(); | ||
| 70 | + | ||
| 71 | + logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); | ||
| 72 | + count = new CountDownLatch(ks.size()); | ||
| 73 | + | ||
| 74 | + for (String lineCode : ks) { | ||
| 75 | + threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count)); | ||
| 76 | + } | ||
| 77 | + | ||
| 52 | //等待子线程结束 | 78 | //等待子线程结束 |
| 53 | count.await(); | 79 | count.await(); |
| 54 | 80 | ||
| 55 | //加入实时gps对照 | 81 | //加入实时gps对照 |
| 56 | - for(GpsEntity gps: list) | 82 | + for (GpsEntity gps : list) |
| 57 | gpsRealData.put(gps); | 83 | gpsRealData.put(gps); |
| 58 | - } catch (InterruptedException e) { | 84 | + |
| 85 | + logger.info("time , " + (System.currentTimeMillis() - st)); | ||
| 86 | + } catch (Exception e) { | ||
| 59 | logger.error("", e); | 87 | logger.error("", e); |
| 60 | } | 88 | } |
| 61 | } | 89 | } |
| 62 | 90 | ||
| 91 | + public static void shutdown() { | ||
| 92 | + logger.warn("GpsRealAnalyse shutdown!!"); | ||
| 93 | + threadPool.shutdownNow(); | ||
| 94 | + long len = count.getCount(); | ||
| 95 | + for (int i = 0; i < len; i++) { | ||
| 96 | + count.countDown(); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + threadPool = Executors.newFixedThreadPool(100); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + static GpsComp comp = new GpsComp(); | ||
| 103 | + | ||
| 63 | public class SignalHandleThread implements Runnable { | 104 | public class SignalHandleThread implements Runnable { |
| 64 | 105 | ||
| 65 | - GpsEntity gps; | 106 | + List<GpsEntity> list; |
| 66 | CountDownLatch count; | 107 | CountDownLatch count; |
| 67 | 108 | ||
| 68 | - SignalHandleThread(GpsEntity gps, CountDownLatch count) { | ||
| 69 | - this.gps = gps; | 109 | + SignalHandleThread(List<GpsEntity> gpsList, CountDownLatch count) { |
| 110 | + this.list = gpsList; | ||
| 70 | this.count = count; | 111 | this.count = count; |
| 71 | } | 112 | } |
| 72 | 113 | ||
| @@ -74,32 +115,45 @@ public class GpsRealAnalyse { | @@ -74,32 +115,45 @@ public class GpsRealAnalyse { | ||
| 74 | public void run() { | 115 | public void run() { |
| 75 | 116 | ||
| 76 | try { | 117 | try { |
| 77 | - //是否有任务 | ||
| 78 | - boolean task; | ||
| 79 | - CircleQueue<GpsEntity> prevs = GeoCacheData.getGps(gps.getNbbm()); | ||
| 80 | - //掉线处理 | ||
| 81 | - offlineSignalHandle.handle(gps, prevs); | ||
| 82 | - //状态处理 | ||
| 83 | - task = correctSignalHandle.handle(gps, prevs); | ||
| 84 | - //场,站内外判断 | ||
| 85 | - stationInsideHandle.handle(gps, prevs); | ||
| 86 | - //异常判定(越界/超速) | ||
| 87 | - abnormalStateHandle.handle(gps, prevs); | ||
| 88 | - | ||
| 89 | - if(!task) | ||
| 90 | - return; //无任务的,到这里就结束 | ||
| 91 | - | ||
| 92 | - //反向处理 | ||
| 93 | - reverseSignalHandle.handle(gps, prevs); | ||
| 94 | - //进出站动作处理 | ||
| 95 | - inOutStationSignalHandle.handle(gps, prevs); | ||
| 96 | - GeoCacheData.putGps(gps); | ||
| 97 | - | ||
| 98 | - } catch (Exception e) { | ||
| 99 | - logger.error("", e); | 118 | + Collections.sort(list, comp); |
| 119 | + for (GpsEntity gps : list) { | ||
| 120 | + try { | ||
| 121 | + //是否有任务 | ||
| 122 | + boolean task; | ||
| 123 | + CircleQueue<GpsEntity> prevs = GeoCacheData.getGps(gps.getNbbm()); | ||
| 124 | + //掉线处理 | ||
| 125 | + offlineSignalHandle.handle(gps, prevs); | ||
| 126 | + //状态处理 | ||
| 127 | + task = correctSignalHandle.handle(gps, prevs); | ||
| 128 | + //场,站内外判断 | ||
| 129 | + stationInsideHandle.handle(gps, prevs); | ||
| 130 | + //异常判定(越界/超速) | ||
| 131 | + abnormalStateHandle.handle(gps, prevs); | ||
| 132 | + | ||
| 133 | + if (!task) | ||
| 134 | + continue; //无任务的,到这里就结束 | ||
| 135 | + | ||
| 136 | + //反向处理 | ||
| 137 | + reverseSignalHandle.handle(gps, prevs); | ||
| 138 | + //进出站动作处理 | ||
| 139 | + inOutStationSignalHandle.handle(gps, prevs); | ||
| 140 | + GeoCacheData.putGps(gps); | ||
| 141 | + }catch (Exception e){ | ||
| 142 | + logger.error("", e); | ||
| 143 | + } | ||
| 144 | + } | ||
| 100 | } finally { | 145 | } finally { |
| 101 | - count.countDown(); | 146 | + if (count != null) |
| 147 | + count.countDown(); | ||
| 102 | } | 148 | } |
| 103 | } | 149 | } |
| 104 | } | 150 | } |
| 151 | + | ||
| 152 | + public static class GpsComp implements Comparator<GpsEntity> { | ||
| 153 | + | ||
| 154 | + @Override | ||
| 155 | + public int compare(GpsEntity g1, GpsEntity g2) { | ||
| 156 | + return g1.getTimestamp().compareTo(g2.getTimestamp()); | ||
| 157 | + } | ||
| 158 | + } | ||
| 105 | } | 159 | } |
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
| @@ -75,7 +75,7 @@ public abstract class SignalHandle { | @@ -75,7 +75,7 @@ public abstract class SignalHandle { | ||
| 75 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 75 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 76 | private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | 76 | private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); |
| 77 | protected void transformUpdown(GpsEntity gps, ScheduleRealInfo sch) { | 77 | protected void transformUpdown(GpsEntity gps, ScheduleRealInfo sch) { |
| 78 | - int updown = Integer.parseInt(sch.getXlDir()); | 78 | + byte updown = Byte.parseByte(sch.getXlDir()); |
| 79 | //gps 切换走向 | 79 | //gps 切换走向 |
| 80 | gps.setUpDown(updown); | 80 | gps.setUpDown(updown); |
| 81 | 81 |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/CorrectSignalHandle.java
| @@ -3,8 +3,8 @@ package com.bsth.data.gpsdata.arrival.handlers; | @@ -3,8 +3,8 @@ package com.bsth.data.gpsdata.arrival.handlers; | ||
| 3 | import com.bsth.data.gpsdata.GpsEntity; | 3 | import com.bsth.data.gpsdata.GpsEntity; |
| 4 | import com.bsth.data.gpsdata.arrival.SignalHandle; | 4 | import com.bsth.data.gpsdata.arrival.SignalHandle; |
| 5 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; | 5 | import com.bsth.data.gpsdata.arrival.utils.CircleQueue; |
| 6 | +import com.bsth.data.gpsdata.status_manager.GpsStatusManager; | ||
| 6 | import com.bsth.data.schedule.DayOfSchedule; | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| 7 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | import com.bsth.service.directive.DirectiveService; | 9 | import com.bsth.service.directive.DirectiveService; |
| 10 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| @@ -24,30 +24,47 @@ public class CorrectSignalHandle extends SignalHandle { | @@ -24,30 +24,47 @@ public class CorrectSignalHandle extends SignalHandle { | ||
| 24 | @Autowired | 24 | @Autowired |
| 25 | DirectiveService directiveService; | 25 | DirectiveService directiveService; |
| 26 | 26 | ||
| 27 | + @Autowired | ||
| 28 | + GpsStatusManager gpsStatusManager; | ||
| 29 | + | ||
| 27 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 30 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 28 | 31 | ||
| 29 | @Override | 32 | @Override |
| 30 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { | 33 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 31 | - Object task = dayOfSchedule.executeCurr(gps.getNbbm()); | 34 | + ScheduleRealInfo task = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 32 | if(task == null) | 35 | if(task == null) |
| 33 | return false; | 36 | return false; |
| 34 | - ScheduleRealInfo sch; | 37 | + //ScheduleRealInfo sch; |
| 35 | 38 | ||
| 36 | //子任务 | 39 | //子任务 |
| 37 | - if(task.getClass().isAssignableFrom(ChildTaskPlan.class)){ | 40 | + /*if(task.getClass().isAssignableFrom(ChildTaskPlan.class)){ |
| 38 | ChildTaskPlan childTask = (ChildTaskPlan) task; | 41 | ChildTaskPlan childTask = (ChildTaskPlan) task; |
| 39 | sch = childTask.getSchedule(); | 42 | sch = childTask.getSchedule(); |
| 40 | } | 43 | } |
| 41 | else | 44 | else |
| 42 | - sch = (ScheduleRealInfo) task; | 45 | + sch = (ScheduleRealInfo) task;*/ |
| 43 | 46 | ||
| 44 | - int updown = Integer.parseInt(sch.getXlDir()); | 47 | + byte updown = Byte.parseByte(task.getXlDir()); |
| 45 | //走向 | 48 | //走向 |
| 46 | if(gps.getUpDown() != updown){ | 49 | if(gps.getUpDown() != updown){ |
| 47 | gps.setUpDown(updown); | 50 | gps.setUpDown(updown); |
| 48 | - gps.setState(0); | 51 | + //gps.setState(0); |
| 52 | + } | ||
| 53 | + | ||
| 54 | + //(转发的数据不管) | ||
| 55 | + if(gps.getSource() != 0){ | ||
| 56 | + //gps=非营运 或走向不对 && 班次=非空驶 ;切换到营运状态 | ||
| 57 | + if((!gps.isService() || gps.getUpDown() != updown) && | ||
| 58 | + !dayOfSchedule.emptyService(task)){ | ||
| 59 | + gpsStatusManager.changeServiceState(gps.getNbbm(), updown, 0, "同步@系统"); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + //需要切换线路 | ||
| 63 | + if(!task.getXlBm().equals(gps.getLineId())){ | ||
| 64 | + gpsStatusManager.changeLine(gps.getNbbm(), task.getXlBm(), "同步@系统"); | ||
| 65 | + } | ||
| 49 | } | 66 | } |
| 50 | 67 | ||
| 51 | return true; | 68 | return true; |
| 52 | } | 69 | } |
| 53 | -} | 70 | +} |
| 54 | \ No newline at end of file | 71 | \ No newline at end of file |