Commit 28a78cc31943ae80b2093b1d215debf338625160
1 parent
52eb029a
1.
Showing
28 changed files
with
2183 additions
and
2563 deletions
Too many changes to show.
To preserve performance only 28 of 1536 files are displayed.
pom.xml
| @@ -31,398 +31,9 @@ | @@ -31,398 +31,9 @@ | ||
| 31 | <scope>provided</scope> | 31 | <scope>provided</scope> |
| 32 | </dependency> | 32 | </dependency> |
| 33 | <dependency> | 33 | <dependency> |
| 34 | - <groupId>org.springframework.boot</groupId> | ||
| 35 | - <artifactId>spring-boot-starter-security</artifactId> | ||
| 36 | - </dependency> | ||
| 37 | - <dependency> | ||
| 38 | - <groupId>org.springframework.boot</groupId> | ||
| 39 | - <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| 40 | - </dependency> | ||
| 41 | - <dependency> | ||
| 42 | - <groupId>org.springframework.boot</groupId> | ||
| 43 | - <artifactId>spring-boot-starter-aop</artifactId> | ||
| 44 | - </dependency> | ||
| 45 | - | ||
| 46 | - <dependency> | ||
| 47 | - <groupId>org.springframework</groupId> | ||
| 48 | - <artifactId>spring-context-support</artifactId> | ||
| 49 | - </dependency> | ||
| 50 | - <dependency> | ||
| 51 | - <groupId>org.springframework.boot</groupId> | ||
| 52 | - <artifactId>spring-boot-starter-websocket</artifactId> | ||
| 53 | - </dependency> | ||
| 54 | - <dependency> | ||
| 55 | - <groupId>org.springframework.boot</groupId> | ||
| 56 | - <artifactId>spring-boot-configuration-processor</artifactId> | ||
| 57 | - <optional>true</optional> | ||
| 58 | - </dependency> | ||
| 59 | - <dependency> | ||
| 60 | - <groupId>org.springframework.kafka</groupId> | ||
| 61 | - <artifactId>spring-kafka</artifactId> | ||
| 62 | - </dependency> | ||
| 63 | - <dependency> | ||
| 64 | - <groupId>mysql</groupId> | ||
| 65 | - <artifactId>mysql-connector-java</artifactId> | ||
| 66 | - <version>5.1.38</version> | ||
| 67 | - </dependency> | ||
| 68 | - | ||
| 69 | - <dependency> | ||
| 70 | - <groupId>joda-time</groupId> | ||
| 71 | - <artifactId>joda-time</artifactId> | ||
| 72 | - </dependency> | ||
| 73 | - <dependency> | ||
| 74 | - <groupId>com.alibaba</groupId> | ||
| 75 | - <artifactId>fastjson</artifactId> | ||
| 76 | - <version>1.2.4</version> | ||
| 77 | - </dependency> | ||
| 78 | - | ||
| 79 | - <dependency> | ||
| 80 | - <groupId>org.apache.httpcomponents</groupId> | ||
| 81 | - <artifactId>httpclient</artifactId> | ||
| 82 | - </dependency> | ||
| 83 | - | ||
| 84 | - <!-- dbcp2数据库连接池 --> | ||
| 85 | - <dependency> | ||
| 86 | - <groupId>org.apache.commons</groupId> | ||
| 87 | - <artifactId>commons-dbcp2</artifactId> | ||
| 88 | - </dependency> | ||
| 89 | - | ||
| 90 | - <dependency> | ||
| 91 | - <groupId>org.hibernate</groupId> | ||
| 92 | - <artifactId>hibernate-search-orm</artifactId> | ||
| 93 | - <version>5.11.2.Final</version> | ||
| 94 | - </dependency> | ||
| 95 | - | ||
| 96 | - <dependency> | ||
| 97 | - <groupId>commons-lang</groupId> | ||
| 98 | - <artifactId>commons-lang</artifactId> | ||
| 99 | - <version>2.6</version> | ||
| 100 | - </dependency> | ||
| 101 | - <dependency> | ||
| 102 | - <groupId>org.apache.commons</groupId> | ||
| 103 | - <artifactId>commons-lang3</artifactId> | ||
| 104 | - <version>3.4</version> | ||
| 105 | - </dependency> | ||
| 106 | - <dependency> | ||
| 107 | - <groupId>commons-fileupload</groupId> | ||
| 108 | - <artifactId>commons-fileupload</artifactId> | ||
| 109 | - <version>1.2.2</version> | ||
| 110 | - </dependency> | ||
| 111 | - <dependency> | ||
| 112 | - <groupId>commons-io</groupId> | ||
| 113 | - <artifactId>commons-io</artifactId> | ||
| 114 | - <version>2.4</version> | ||
| 115 | - </dependency> | ||
| 116 | - <dependency> | ||
| 117 | - <groupId>org.codehaus.janino</groupId> | ||
| 118 | - <artifactId>janino</artifactId> | ||
| 119 | - </dependency> | ||
| 120 | - | ||
| 121 | - <dependency> | ||
| 122 | - <groupId>org.apache.poi</groupId> | ||
| 123 | - <artifactId>poi-ooxml</artifactId> | ||
| 124 | - <version>3.13</version> | ||
| 125 | - </dependency> | ||
| 126 | - | ||
| 127 | - <dependency> | ||
| 128 | - <groupId>com.google.guava</groupId> | ||
| 129 | - <artifactId>guava</artifactId> | ||
| 130 | - <version>19.0</version> | ||
| 131 | - </dependency> | ||
| 132 | - <!-- ftp文件上传包 --> | ||
| 133 | - <dependency> | ||
| 134 | - <groupId>commons-net</groupId> | ||
| 135 | - <artifactId>commons-net</artifactId> | ||
| 136 | - <version>3.5</version> | ||
| 137 | - </dependency> | ||
| 138 | - <dependency> | ||
| 139 | - <groupId>org.apache.commons</groupId> | ||
| 140 | - <artifactId>commons-compress</artifactId> | ||
| 141 | - <version>1.3</version> | ||
| 142 | - </dependency> | ||
| 143 | - <!-- drools 6依赖 --> | ||
| 144 | - <dependency> | ||
| 145 | - <groupId>org.kie</groupId> | ||
| 146 | - <artifactId>kie-api</artifactId> | ||
| 147 | - </dependency> | ||
| 148 | - <dependency> | ||
| 149 | - <groupId>org.drools</groupId> | ||
| 150 | - <artifactId>drools-compiler</artifactId> | ||
| 151 | - </dependency> | ||
| 152 | - | ||
| 153 | - <!-- springboot测试 --> | ||
| 154 | - <dependency> | ||
| 155 | - <groupId>org.springframework.boot</groupId> | ||
| 156 | - <artifactId>spring-boot-starter-test</artifactId> | ||
| 157 | - <scope>test</scope> | ||
| 158 | - </dependency> | ||
| 159 | - | ||
| 160 | - <dependency> | ||
| 161 | - <groupId>c3p0</groupId> | ||
| 162 | - <artifactId>c3p0</artifactId> | ||
| 163 | - <version>0.9.1.2</version> | ||
| 164 | - </dependency> | ||
| 165 | - | ||
| 166 | - <!-- 图表 --> | ||
| 167 | - <dependency> | ||
| 168 | - <groupId>com.google.code.gson</groupId> | ||
| 169 | - <artifactId>gson</artifactId> | ||
| 170 | - <version>2.8.5</version> | ||
| 171 | - </dependency> | ||
| 172 | - <dependency> | ||
| 173 | - <groupId>com.github.abel533</groupId> | ||
| 174 | - <artifactId>ECharts</artifactId> | ||
| 175 | - <version>2.1.8</version> | ||
| 176 | - </dependency> | ||
| 177 | - | ||
| 178 | - <dependency> | ||
| 179 | - <groupId>org.apache.tika</groupId> | ||
| 180 | - <artifactId>tika-core</artifactId> | ||
| 181 | - <version>1.7</version> | ||
| 182 | - </dependency> | ||
| 183 | - | ||
| 184 | - <!-- pentaho kettle 依赖 --> | ||
| 185 | - <dependency> | ||
| 186 | - <groupId>pentaho-kettle</groupId> | ||
| 187 | - <artifactId>kettle-core</artifactId> | ||
| 188 | - <version>6.0.1.0-386</version> | ||
| 189 | - <exclusions> | ||
| 190 | - <exclusion> | ||
| 191 | - <groupId>org.apache.xmlgraphics</groupId> | ||
| 192 | - <artifactId>batik-js</artifactId> | ||
| 193 | - </exclusion> | ||
| 194 | - </exclusions> | ||
| 195 | - </dependency> | ||
| 196 | - <dependency> | ||
| 197 | - <groupId>pentaho-kettle</groupId> | ||
| 198 | - <artifactId>kettle-engine</artifactId> | ||
| 199 | - <version>6.0.1.0-386</version> | ||
| 200 | - </dependency> | ||
| 201 | - <dependency> | ||
| 202 | - <groupId>pentaho</groupId> | ||
| 203 | - <artifactId>metastore</artifactId> | ||
| 204 | - <version>6.0.1.0-386</version> | ||
| 205 | - </dependency> | ||
| 206 | - <dependency> | ||
| 207 | - <groupId>org.apache.commons</groupId> | ||
| 208 | - <artifactId>commons-vfs2</artifactId> | ||
| 209 | - <version>2.1-20150824</version> | ||
| 210 | - </dependency> | ||
| 211 | - | ||
| 212 | - <dependency> | ||
| 213 | - <groupId>net.sourceforge.jexcelapi</groupId> | ||
| 214 | - <artifactId>jxl</artifactId> | ||
| 215 | - <version>2.6.12</version> | ||
| 216 | - <exclusions> | ||
| 217 | - <exclusion> | ||
| 218 | - <groupId>log4j</groupId> | ||
| 219 | - <artifactId>log4j</artifactId> | ||
| 220 | - </exclusion> | ||
| 221 | - </exclusions> | ||
| 222 | - </dependency> | ||
| 223 | - <dependency> | ||
| 224 | - <groupId>rhino</groupId> | ||
| 225 | - <artifactId>js</artifactId> | ||
| 226 | - <version>1.7R2</version> | ||
| 227 | - </dependency> | ||
| 228 | - <dependency> | ||
| 229 | - <groupId>javax.mail</groupId> | ||
| 230 | - <artifactId>mail</artifactId> | ||
| 231 | - <version>1.4.7</version> | ||
| 232 | - </dependency> | ||
| 233 | - | ||
| 234 | - <dependency> | ||
| 235 | - <groupId>com.github.axet</groupId> | ||
| 236 | - <artifactId>kaptcha</artifactId> | ||
| 237 | - <version>0.0.9</version> | ||
| 238 | - </dependency> | ||
| 239 | - | ||
| 240 | - <dependency> | ||
| 241 | - <groupId>commons-codec</groupId> | ||
| 242 | - <artifactId>commons-codec</artifactId> | ||
| 243 | - <version>1.4</version> | ||
| 244 | - <scope>compile</scope> | ||
| 245 | - </dependency> | ||
| 246 | - <dependency> | ||
| 247 | - <groupId>org.bouncycastle</groupId> | ||
| 248 | - <artifactId>bcprov-jdk15on</artifactId> | ||
| 249 | - <version>1.52</version> | ||
| 250 | - </dependency> | ||
| 251 | - <dependency> | ||
| 252 | - <groupId>axis</groupId> | ||
| 253 | - <artifactId>axis</artifactId> | ||
| 254 | - <version>1.4</version> | ||
| 255 | - </dependency> | ||
| 256 | - <dependency> | ||
| 257 | - <groupId>javax.xml</groupId> | ||
| 258 | - <artifactId>jaxrpc-api</artifactId> | ||
| 259 | - <version>1.1</version> | ||
| 260 | - </dependency> | ||
| 261 | - | ||
| 262 | - <dependency> | ||
| 263 | - <groupId>org.apache.axis2</groupId> | ||
| 264 | - <artifactId>axis2-adb</artifactId> | ||
| 265 | - <version>1.7.4</version> | ||
| 266 | - </dependency> | ||
| 267 | - <dependency> | ||
| 268 | - <groupId>org.apache.axis2</groupId> | ||
| 269 | - <artifactId>axis2-transport-local</artifactId> | ||
| 270 | - <version>1.7.4</version> | ||
| 271 | - </dependency> | ||
| 272 | - <dependency> | ||
| 273 | - <groupId>org.apache.axis2</groupId> | ||
| 274 | - <artifactId>axis2-transport-http</artifactId> | ||
| 275 | - <version>1.7.4</version> | ||
| 276 | - </dependency> | ||
| 277 | - | ||
| 278 | - <dependency> | ||
| 279 | - <groupId>org.dbunit</groupId> | ||
| 280 | - <artifactId>dbunit</artifactId> | ||
| 281 | - <version>2.4.9</version> | ||
| 282 | - <scope>test</scope> | ||
| 283 | - | ||
| 284 | - <exclusions> | ||
| 285 | - <exclusion> | ||
| 286 | - <groupId>org.slf4j</groupId> | ||
| 287 | - <artifactId>slf4j-api</artifactId> | ||
| 288 | - </exclusion> | ||
| 289 | - </exclusions> | ||
| 290 | - </dependency> | ||
| 291 | - | ||
| 292 | - <dependency> | ||
| 293 | - <groupId>com.h2database</groupId> | ||
| 294 | - <artifactId>h2</artifactId> | ||
| 295 | - <version>1.2.132</version> | ||
| 296 | - <scope>test</scope> | ||
| 297 | - </dependency> | ||
| 298 | - | ||
| 299 | - | ||
| 300 | - <dependency> | ||
| 301 | - <groupId>org.apache.mina</groupId> | ||
| 302 | - <artifactId>mina-core</artifactId> | ||
| 303 | - <version>2.0.13</version> | ||
| 304 | - </dependency> | ||
| 305 | - | ||
| 306 | - <dependency> | ||
| 307 | - <groupId>com.google.protobuf</groupId> | ||
| 308 | - <artifactId>protobuf-java</artifactId> | ||
| 309 | - <version>3.3.0</version> | ||
| 310 | - </dependency> | ||
| 311 | - | ||
| 312 | - <dependency> | ||
| 313 | - <groupId>com.github.stuxuhai</groupId> | ||
| 314 | - <artifactId>jpinyin</artifactId> | ||
| 315 | - <version>1.1.8</version> | ||
| 316 | - </dependency> | ||
| 317 | - | ||
| 318 | - <!-- dubbo 需要的jar start --> | ||
| 319 | - <dependency> | ||
| 320 | - <groupId>com.alibaba</groupId> | ||
| 321 | - <artifactId>dubbo</artifactId> | ||
| 322 | - <!--<version>2.6.3</version>--> | ||
| 323 | - <version>2.5.3</version> | ||
| 324 | - <exclusions> | ||
| 325 | - <exclusion> | ||
| 326 | - <groupId>org.springframework</groupId> | ||
| 327 | - <artifactId>spring</artifactId> | ||
| 328 | - </exclusion> | ||
| 329 | - <exclusion> | ||
| 330 | - <groupId>log4j</groupId> | ||
| 331 | - <artifactId>log4j</artifactId> | ||
| 332 | - </exclusion> | ||
| 333 | - </exclusions> | ||
| 334 | - </dependency> | ||
| 335 | - | ||
| 336 | - <dependency> | ||
| 337 | - <groupId>org.apache.zookeeper</groupId> | ||
| 338 | - <artifactId>zookeeper</artifactId> | ||
| 339 | - <version>3.4.5</version> | ||
| 340 | - <exclusions> | ||
| 341 | - <exclusion> | ||
| 342 | - <groupId>log4j</groupId> | ||
| 343 | - <artifactId>log4j</artifactId> | ||
| 344 | - </exclusion> | ||
| 345 | - <exclusion> | ||
| 346 | - <groupId>org.slf4j</groupId> | ||
| 347 | - <artifactId>slf4j-log4j12</artifactId> | ||
| 348 | - </exclusion> | ||
| 349 | - </exclusions> | ||
| 350 | - </dependency> | ||
| 351 | - | ||
| 352 | - <dependency> | ||
| 353 | - <groupId>com.101tec</groupId> | ||
| 354 | - <artifactId>zkclient</artifactId> | ||
| 355 | - <version>0.3</version> | ||
| 356 | - <exclusions> | ||
| 357 | - <exclusion> | ||
| 358 | - <groupId>log4j</groupId> | ||
| 359 | - <artifactId>log4j</artifactId> | ||
| 360 | - </exclusion> | ||
| 361 | - </exclusions> | ||
| 362 | - </dependency> | ||
| 363 | - | ||
| 364 | - <!-- plan common工程依赖 --> | ||
| 365 | - <dependency> | ||
| 366 | - <groupId>com.bsth.control_v2</groupId> | ||
| 367 | - <artifactId>plan_module-common</artifactId> | ||
| 368 | - <version>1.0-SNAPSHOT</version> | ||
| 369 | - </dependency> | ||
| 370 | - <!-- plan common config 工程依赖 --> | ||
| 371 | - <dependency> | ||
| 372 | - <groupId>com.bsth.control_v2</groupId> | ||
| 373 | - <artifactId>plan_module-common-config</artifactId> | ||
| 374 | - <version>1.0-SNAPSHOT</version> | ||
| 375 | - </dependency> | ||
| 376 | - <dependency> | ||
| 377 | - <groupId>org.slf4j</groupId> | ||
| 378 | - <artifactId>slf4j-api</artifactId> | ||
| 379 | - <version>1.7.7</version> | ||
| 380 | - </dependency> | ||
| 381 | - <dependency> | ||
| 382 | - <groupId>ch.qos.logback</groupId> | ||
| 383 | - <artifactId>logback-classic</artifactId> | ||
| 384 | - <version>1.1.11</version> | ||
| 385 | - </dependency> | ||
| 386 | - <dependency> | ||
| 387 | - <groupId>org.slf4j</groupId> | ||
| 388 | - <artifactId>log4j-over-slf4j</artifactId> | ||
| 389 | - <version>1.7.7</version> | ||
| 390 | - </dependency> | ||
| 391 | - | ||
| 392 | - <dependency> | ||
| 393 | - <groupId>org.projectlombok</groupId> | ||
| 394 | - <artifactId>lombok</artifactId> | ||
| 395 | - </dependency> | ||
| 396 | - | ||
| 397 | - <!-- https://mvnrepository.com/artifact/pentaho/simple-jndi --> | ||
| 398 | - <dependency> | ||
| 399 | - <groupId>pentaho</groupId> | ||
| 400 | - <artifactId>simple-jndi</artifactId> | ||
| 401 | - <version>1.0.0</version> | ||
| 402 | - </dependency> | ||
| 403 | - | ||
| 404 | - <!-- geotool --> | ||
| 405 | - <dependency> | ||
| 406 | - <groupId>org.locationtech.jts</groupId> | ||
| 407 | - <artifactId>jts-core</artifactId> | ||
| 408 | - <version>1.16.1</version> | ||
| 409 | - </dependency> | ||
| 410 | - | ||
| 411 | - <dependency> | ||
| 412 | - <groupId>org.hibernate</groupId> | ||
| 413 | - <artifactId>hibernate-spatial</artifactId> | ||
| 414 | - </dependency> | ||
| 415 | - | ||
| 416 | - <dependency> | ||
| 417 | - <groupId>org.java-websocket</groupId> | ||
| 418 | - <artifactId>Java-WebSocket</artifactId> | ||
| 419 | - <version>1.5.3</version> | ||
| 420 | - </dependency> | ||
| 421 | - | ||
| 422 | - <dependency> | ||
| 423 | - <groupId>org.bytedeco</groupId> | ||
| 424 | - <artifactId>javacv-platform</artifactId> | ||
| 425 | - <version>1.5.11</version> | 34 | + <groupId>com.bsth</groupId> |
| 35 | + <artifactId>schedule-core</artifactId> | ||
| 36 | + <version>0.0.1-SNAPSHOT</version> | ||
| 426 | </dependency> | 37 | </dependency> |
| 427 | </dependencies> | 38 | </dependencies> |
| 428 | 39 |
schedule-core/src/main/java/com/bsth/ScheduleService.java
0 → 100644
| 1 | +package com.bsth; | ||
| 2 | + | ||
| 3 | +import java.util.concurrent.Executors; | ||
| 4 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 5 | + | ||
| 6 | +public class ScheduleService { | ||
| 7 | + | ||
| 8 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(21); | ||
| 9 | +} | ||
| 0 | \ No newline at end of file | 10 | \ No newline at end of file |
src/main/java/com/bsth/annotation/BusinessDescription.java renamed to schedule-core/src/main/java/com/bsth/annotation/BusinessDescription.java
| 1 | -package com.bsth.annotation; | ||
| 2 | - | ||
| 3 | -import java.lang.annotation.ElementType; | ||
| 4 | -import java.lang.annotation.Retention; | ||
| 5 | -import java.lang.annotation.RetentionPolicy; | ||
| 6 | -import java.lang.annotation.Target; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * @author Hill | ||
| 10 | - */ | ||
| 11 | -@Retention(RetentionPolicy.RUNTIME) | ||
| 12 | -@Target(ElementType.METHOD) | ||
| 13 | -public @interface BusinessDescription { | ||
| 14 | - | ||
| 15 | - /** | ||
| 16 | - * 业务描述内容 | ||
| 17 | - * @return | ||
| 18 | - */ | ||
| 19 | - String value(); | ||
| 20 | -} | 1 | +package com.bsth.annotation; |
| 2 | + | ||
| 3 | +import java.lang.annotation.ElementType; | ||
| 4 | +import java.lang.annotation.Retention; | ||
| 5 | +import java.lang.annotation.RetentionPolicy; | ||
| 6 | +import java.lang.annotation.Target; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author Hill | ||
| 10 | + */ | ||
| 11 | +@Retention(RetentionPolicy.RUNTIME) | ||
| 12 | +@Target(ElementType.METHOD) | ||
| 13 | +public @interface BusinessDescription { | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 业务描述内容 | ||
| 17 | + * @return | ||
| 18 | + */ | ||
| 19 | + String value(); | ||
| 20 | +} |
src/main/java/com/bsth/common/Constants.java renamed to schedule-core/src/main/java/com/bsth/common/Constants.java
src/main/java/com/bsth/common/ResponseCode.java renamed to schedule-core/src/main/java/com/bsth/common/ResponseCode.java
| 1 | -package com.bsth.common; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * | ||
| 5 | - * @ClassName: ResponseCode | ||
| 6 | - * @Description: TODO(响应状态码) | ||
| 7 | - * @author PanZhao | ||
| 8 | - * @date 2016年3月18日 下午11:12:08 | ||
| 9 | - * | ||
| 10 | - */ | ||
| 11 | -public enum ResponseCode { | ||
| 12 | - | ||
| 13 | - SUCCESS("操作成功", 200), | ||
| 14 | - NO_PERMISSION("无资源访问权限", 403), | ||
| 15 | - NO_AUTHENTICATION("客户端未授权", 407), | ||
| 16 | - ERROR("服务器异常", 500); | ||
| 17 | - | ||
| 18 | - private String text; | ||
| 19 | - private int code; | ||
| 20 | - | ||
| 21 | - ResponseCode(String text, int code) { | ||
| 22 | - this.text = text; | ||
| 23 | - this.code = code; | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - @Override | ||
| 27 | - public String toString() { | ||
| 28 | - return this.code + ""; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - public String getText() { | ||
| 32 | - return this.text; | ||
| 33 | - } | ||
| 34 | -} | 1 | +package com.bsth.common; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * | ||
| 5 | + * @ClassName: ResponseCode | ||
| 6 | + * @Description: TODO(响应状态码) | ||
| 7 | + * @author PanZhao | ||
| 8 | + * @date 2016年3月18日 下午11:12:08 | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | +public enum ResponseCode { | ||
| 12 | + | ||
| 13 | + SUCCESS("操作成功", 200), | ||
| 14 | + NO_PERMISSION("无资源访问权限", 403), | ||
| 15 | + NO_AUTHENTICATION("客户端未授权", 407), | ||
| 16 | + ERROR("服务器异常", 500); | ||
| 17 | + | ||
| 18 | + private String text; | ||
| 19 | + private int code; | ||
| 20 | + | ||
| 21 | + ResponseCode(String text, int code) { | ||
| 22 | + this.text = text; | ||
| 23 | + this.code = code; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public String toString() { | ||
| 28 | + return this.code + ""; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public String getText() { | ||
| 32 | + return this.text; | ||
| 33 | + } | ||
| 34 | +} |
src/main/java/com/bsth/common/SystemParamKeys.java renamed to schedule-core/src/main/java/com/bsth/common/SystemParamKeys.java
src/main/java/com/bsth/controller/BaseController.java renamed to schedule-core/src/main/java/com/bsth/controller/BaseController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.service.BaseService; | ||
| 4 | -import com.google.common.base.Splitter; | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | -import org.springframework.data.domain.Page; | ||
| 7 | -import org.springframework.data.domain.PageRequest; | ||
| 8 | -import org.springframework.data.domain.Sort; | ||
| 9 | -import org.springframework.data.domain.Sort.Direction; | ||
| 10 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | - | ||
| 15 | -import java.io.Serializable; | ||
| 16 | -import java.util.ArrayList; | ||
| 17 | -import java.util.Arrays; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * @param <T> | ||
| 23 | - * @param <ID> 主键类型 | ||
| 24 | - * @author PanZhao | ||
| 25 | - * @ClassName: BaseController | ||
| 26 | - * @Description: TODO(基础的Controller实现) | ||
| 27 | - * @date 2016年3月17日 下午12:44:06 | ||
| 28 | - */ | ||
| 29 | -public class BaseController<T, ID extends Serializable> { | ||
| 30 | - | ||
| 31 | - @Autowired | ||
| 32 | - protected BaseService<T, ID> baseService; | ||
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * @param @param map 查询条件 | ||
| 36 | - * @param @param page 页码 | ||
| 37 | - * @param @param size 每页显示数量 | ||
| 38 | - * @throws | ||
| 39 | - * @Title: list | ||
| 40 | - * @Description: TODO(多条件分页查询) | ||
| 41 | - */ | ||
| 42 | - @RequestMapping(method = RequestMethod.GET) | ||
| 43 | - public Page<T> list(@RequestParam Map<String, Object> map, | ||
| 44 | - @RequestParam(defaultValue = "0") int page, | ||
| 45 | - @RequestParam(defaultValue = "10") int size, | ||
| 46 | - @RequestParam(defaultValue = "id") String order, | ||
| 47 | - @RequestParam(defaultValue = "DESC") String direction) { | ||
| 48 | - | ||
| 49 | - // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | ||
| 50 | - // 多个字段格式:{col1},{col2},{col3},....,{coln} | ||
| 51 | - List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | ||
| 52 | - // 多字段排序:DESC,ASC... | ||
| 53 | - List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | ||
| 54 | - | ||
| 55 | - if (order_dirs.size() == 1) { // 所有字段采用一种排序 | ||
| 56 | - if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) { | ||
| 57 | - return baseService.list(map, new PageRequest(page, size, new Sort(Direction.ASC, order_columns))); | ||
| 58 | - } else { | ||
| 59 | - return baseService.list(map, new PageRequest(page, size, new Sort(Direction.DESC, order_columns))); | ||
| 60 | - } | ||
| 61 | - } else if (order_columns.size() == order_dirs.size()) { | ||
| 62 | - List<Sort.Order> orderList = new ArrayList<>(); | ||
| 63 | - for (int i = 0; i < order_columns.size(); i++) { | ||
| 64 | - if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | ||
| 65 | - orderList.add(new Sort.Order(Direction.ASC, order_columns.get(i))); | ||
| 66 | - } else { | ||
| 67 | - orderList.add(new Sort.Order(Direction.DESC, order_columns.get(i))); | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - return baseService.list(map, new PageRequest(page, size, new Sort(orderList))); | ||
| 71 | - } else { | ||
| 72 | - throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | ||
| 73 | - } | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | - * @param @param map | ||
| 78 | - * @throws | ||
| 79 | - * @Title: list | ||
| 80 | - * @Description: TODO(多条件查询) | ||
| 81 | - */ | ||
| 82 | - @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 83 | - public Iterable<T> list(@RequestParam Map<String, Object> map) { | ||
| 84 | - return baseService.list(map); | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * @param @param map | ||
| 89 | - * @throws | ||
| 90 | - * @Title: list | ||
| 91 | - * @Description: TODO(多条件查询) | ||
| 92 | - */ | ||
| 93 | - @RequestMapping(value = "/findAll", method = RequestMethod.GET) | ||
| 94 | - public List<T> findAll(@RequestParam Map<String, Object> map, | ||
| 95 | - @RequestParam(defaultValue = "id") String order, | ||
| 96 | - @RequestParam(defaultValue = "DESC") String direction) { | ||
| 97 | - String[] columns = order.split(","), directions = direction.split(","); | ||
| 98 | - if (columns.length != directions.length) { | ||
| 99 | - throw new IllegalArgumentException("不合法的排序参数"); | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | - List<Sort.Order> orders = new ArrayList<>(); | ||
| 103 | - for (int i = 0;i < columns.length;i++) { | ||
| 104 | - String column = columns[i], direction1 = directions[i]; | ||
| 105 | - if ("DESC".equals(direction1)) { | ||
| 106 | - orders.add(Sort.Order.desc(column)); | ||
| 107 | - } else if ("ASC".equals(direction1)) { | ||
| 108 | - orders.add(Sort.Order.asc(column)); | ||
| 109 | - } else { | ||
| 110 | - throw new IllegalArgumentException("不合法的排序参数"); | ||
| 111 | - } | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - return baseService.findAll(map, Sort.by(orders)); | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - /** | ||
| 118 | - * @param @param t | ||
| 119 | - * @param @return 设定文件 | ||
| 120 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 121 | - * @throws | ||
| 122 | - * @Title: save | ||
| 123 | - * @Description: TODO(持久化对象) | ||
| 124 | - */ | ||
| 125 | - @RequestMapping(method = RequestMethod.POST) | ||
| 126 | - public Map<String, Object> save(T t) { | ||
| 127 | - return baseService.save(t); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - /** | ||
| 131 | - * @param @param id | ||
| 132 | - * @throws | ||
| 133 | - * @Title: findById | ||
| 134 | - * @Description: TODO(根据主键获取单个对象) | ||
| 135 | - */ | ||
| 136 | - @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
| 137 | - public T findById(@PathVariable("id") ID id) { | ||
| 138 | - return baseService.findById(id); | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - /** | ||
| 142 | - * @param @param id | ||
| 143 | - * @throws | ||
| 144 | - * @Title: delete | ||
| 145 | - * @Description: TODO(根据主键删除对象) | ||
| 146 | - */ | ||
| 147 | - @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) | ||
| 148 | - public Map<String, Object> delete(@PathVariable("id") ID id) { | ||
| 149 | - return baseService.delete(id); | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.service.BaseService; | ||
| 4 | +import com.google.common.base.Splitter; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.data.domain.Page; | ||
| 7 | +import org.springframework.data.domain.PageRequest; | ||
| 8 | +import org.springframework.data.domain.Sort; | ||
| 9 | +import org.springframework.data.domain.Sort.Direction; | ||
| 10 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | + | ||
| 15 | +import java.io.Serializable; | ||
| 16 | +import java.util.ArrayList; | ||
| 17 | +import java.util.Arrays; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @param <T> | ||
| 23 | + * @param <ID> 主键类型 | ||
| 24 | + * @author PanZhao | ||
| 25 | + * @ClassName: BaseController | ||
| 26 | + * @Description: TODO(基础的Controller实现) | ||
| 27 | + * @date 2016年3月17日 下午12:44:06 | ||
| 28 | + */ | ||
| 29 | +public class BaseController<T, ID extends Serializable> { | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + protected BaseService<T, ID> baseService; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @param @param map 查询条件 | ||
| 36 | + * @param @param page 页码 | ||
| 37 | + * @param @param size 每页显示数量 | ||
| 38 | + * @throws | ||
| 39 | + * @Title: list | ||
| 40 | + * @Description: TODO(多条件分页查询) | ||
| 41 | + */ | ||
| 42 | + @RequestMapping(method = RequestMethod.GET) | ||
| 43 | + public Page<T> list(@RequestParam Map<String, Object> map, | ||
| 44 | + @RequestParam(defaultValue = "0") int page, | ||
| 45 | + @RequestParam(defaultValue = "10") int size, | ||
| 46 | + @RequestParam(defaultValue = "id") String order, | ||
| 47 | + @RequestParam(defaultValue = "DESC") String direction) { | ||
| 48 | + | ||
| 49 | + // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | ||
| 50 | + // 多个字段格式:{col1},{col2},{col3},....,{coln} | ||
| 51 | + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | ||
| 52 | + // 多字段排序:DESC,ASC... | ||
| 53 | + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | ||
| 54 | + | ||
| 55 | + if (order_dirs.size() == 1) { // 所有字段采用一种排序 | ||
| 56 | + if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) { | ||
| 57 | + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.ASC, order_columns))); | ||
| 58 | + } else { | ||
| 59 | + return baseService.list(map, new PageRequest(page, size, new Sort(Direction.DESC, order_columns))); | ||
| 60 | + } | ||
| 61 | + } else if (order_columns.size() == order_dirs.size()) { | ||
| 62 | + List<Sort.Order> orderList = new ArrayList<>(); | ||
| 63 | + for (int i = 0; i < order_columns.size(); i++) { | ||
| 64 | + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | ||
| 65 | + orderList.add(new Sort.Order(Direction.ASC, order_columns.get(i))); | ||
| 66 | + } else { | ||
| 67 | + orderList.add(new Sort.Order(Direction.DESC, order_columns.get(i))); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + return baseService.list(map, new PageRequest(page, size, new Sort(orderList))); | ||
| 71 | + } else { | ||
| 72 | + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @param @param map | ||
| 78 | + * @throws | ||
| 79 | + * @Title: list | ||
| 80 | + * @Description: TODO(多条件查询) | ||
| 81 | + */ | ||
| 82 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 83 | + public Iterable<T> list(@RequestParam Map<String, Object> map) { | ||
| 84 | + return baseService.list(map); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * @param @param map | ||
| 89 | + * @throws | ||
| 90 | + * @Title: list | ||
| 91 | + * @Description: TODO(多条件查询) | ||
| 92 | + */ | ||
| 93 | + @RequestMapping(value = "/findAll", method = RequestMethod.GET) | ||
| 94 | + public List<T> findAll(@RequestParam Map<String, Object> map, | ||
| 95 | + @RequestParam(defaultValue = "id") String order, | ||
| 96 | + @RequestParam(defaultValue = "DESC") String direction) { | ||
| 97 | + String[] columns = order.split(","), directions = direction.split(","); | ||
| 98 | + if (columns.length != directions.length) { | ||
| 99 | + throw new IllegalArgumentException("不合法的排序参数"); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + List<Sort.Order> orders = new ArrayList<>(); | ||
| 103 | + for (int i = 0;i < columns.length;i++) { | ||
| 104 | + String column = columns[i], direction1 = directions[i]; | ||
| 105 | + if ("DESC".equals(direction1)) { | ||
| 106 | + orders.add(Sort.Order.desc(column)); | ||
| 107 | + } else if ("ASC".equals(direction1)) { | ||
| 108 | + orders.add(Sort.Order.asc(column)); | ||
| 109 | + } else { | ||
| 110 | + throw new IllegalArgumentException("不合法的排序参数"); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + return baseService.findAll(map, Sort.by(orders)); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * @param @param t | ||
| 119 | + * @param @return 设定文件 | ||
| 120 | + * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 121 | + * @throws | ||
| 122 | + * @Title: save | ||
| 123 | + * @Description: TODO(持久化对象) | ||
| 124 | + */ | ||
| 125 | + @RequestMapping(method = RequestMethod.POST) | ||
| 126 | + public Map<String, Object> save(T t) { | ||
| 127 | + return baseService.save(t); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * @param @param id | ||
| 132 | + * @throws | ||
| 133 | + * @Title: findById | ||
| 134 | + * @Description: TODO(根据主键获取单个对象) | ||
| 135 | + */ | ||
| 136 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
| 137 | + public T findById(@PathVariable("id") ID id) { | ||
| 138 | + return baseService.findById(id); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + /** | ||
| 142 | + * @param @param id | ||
| 143 | + * @throws | ||
| 144 | + * @Title: delete | ||
| 145 | + * @Description: TODO(根据主键删除对象) | ||
| 146 | + */ | ||
| 147 | + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) | ||
| 148 | + public Map<String, Object> delete(@PathVariable("id") ID id) { | ||
| 149 | + return baseService.delete(id); | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | +} |
src/main/java/com/bsth/controller/BusIntervalController.java renamed to schedule-core/src/main/java/com/bsth/controller/BusIntervalController.java
| 1 | -package com.bsth.controller; | ||
| 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.service.BusIntervalService; | ||
| 13 | - | ||
| 14 | -@RestController | ||
| 15 | -@RequestMapping("busInterval") | ||
| 16 | -public class BusIntervalController { | ||
| 17 | - | ||
| 18 | - @Autowired | ||
| 19 | - private BusIntervalService busIntervalService; | ||
| 20 | - | ||
| 21 | - @RequestMapping(value = "/getDir", method = RequestMethod.GET) | ||
| 22 | - public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){ | ||
| 23 | - return busIntervalService.getDir(map); | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - @RequestMapping(value = "/getLp", method = RequestMethod.GET) | ||
| 27 | - public List<Map<String,Object>> getLp(@RequestParam Map<String, Object> map){ | ||
| 28 | - return busIntervalService.getLp(map); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - @RequestMapping(value = "/interval", method = RequestMethod.GET) | ||
| 32 | - public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){ | ||
| 33 | - return busIntervalService.interval(map); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @RequestMapping(value = "/timeAndSpeed", method = RequestMethod.GET) | ||
| 37 | - public Map<String,Object> timeAndSpeed(@RequestParam Map<String, Object> map){ | ||
| 38 | - return busIntervalService.timeAndSpeed(map); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - @RequestMapping(value = "/lineTimeAnaliy", method = RequestMethod.GET) | ||
| 42 | - public List<Map<String,Object>> lineTimeAnaliy(@RequestParam Map<String, Object> map){ | ||
| 43 | - return busIntervalService.lineTimeAnaliy(map); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - @RequestMapping(value = "/lbStatuAnaly", method = RequestMethod.GET) | ||
| 47 | - public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){ | ||
| 48 | - return busIntervalService.lbStatuAnaly(map); | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - @RequestMapping(value = "/correctStatis", method = RequestMethod.GET) | ||
| 52 | - public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ | ||
| 53 | - return busIntervalService.correctStatis(map); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | ||
| 57 | - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | ||
| 58 | - return busIntervalService.exportWaybillMore(map); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - @RequestMapping(value = "/onTime", method = RequestMethod.GET) | ||
| 62 | - public List<Map<String,Object>> onTime(@RequestParam Map<String, Object> map){ | ||
| 63 | - return busIntervalService.onTime(map); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | -} | 1 | +package com.bsth.controller; |
| 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.service.BusIntervalService; | ||
| 13 | + | ||
| 14 | +@RestController | ||
| 15 | +@RequestMapping("busInterval") | ||
| 16 | +public class BusIntervalController { | ||
| 17 | + | ||
| 18 | + @Autowired | ||
| 19 | + private BusIntervalService busIntervalService; | ||
| 20 | + | ||
| 21 | + @RequestMapping(value = "/getDir", method = RequestMethod.GET) | ||
| 22 | + public List<Map<String,Object>> getDir(@RequestParam Map<String, Object> map){ | ||
| 23 | + return busIntervalService.getDir(map); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "/getLp", method = RequestMethod.GET) | ||
| 27 | + public List<Map<String,Object>> getLp(@RequestParam Map<String, Object> map){ | ||
| 28 | + return busIntervalService.getLp(map); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @RequestMapping(value = "/interval", method = RequestMethod.GET) | ||
| 32 | + public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){ | ||
| 33 | + return busIntervalService.interval(map); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/timeAndSpeed", method = RequestMethod.GET) | ||
| 37 | + public Map<String,Object> timeAndSpeed(@RequestParam Map<String, Object> map){ | ||
| 38 | + return busIntervalService.timeAndSpeed(map); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @RequestMapping(value = "/lineTimeAnaliy", method = RequestMethod.GET) | ||
| 42 | + public List<Map<String,Object>> lineTimeAnaliy(@RequestParam Map<String, Object> map){ | ||
| 43 | + return busIntervalService.lineTimeAnaliy(map); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @RequestMapping(value = "/lbStatuAnaly", method = RequestMethod.GET) | ||
| 47 | + public List<Map<String,Object>> lbStatuAnaly(@RequestParam Map<String, Object> map){ | ||
| 48 | + return busIntervalService.lbStatuAnaly(map); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/correctStatis", method = RequestMethod.GET) | ||
| 52 | + public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ | ||
| 53 | + return busIntervalService.correctStatis(map); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | ||
| 57 | + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | ||
| 58 | + return busIntervalService.exportWaybillMore(map); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @RequestMapping(value = "/onTime", method = RequestMethod.GET) | ||
| 62 | + public List<Map<String,Object>> onTime(@RequestParam Map<String, Object> map){ | ||
| 63 | + return busIntervalService.onTime(map); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | +} |
src/main/java/com/bsth/controller/BusinessController.java renamed to schedule-core/src/main/java/com/bsth/controller/BusinessController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 6 | -import org.springframework.web.bind.annotation.RestController; | ||
| 7 | - | ||
| 8 | -import com.bsth.entity.Business; | ||
| 9 | -import com.bsth.service.BusinessService; | ||
| 10 | -import com.bsth.util.GetUIDAndCode; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * | ||
| 14 | - * @ClassName: LineController(公司控制器) | ||
| 15 | - * | ||
| 16 | - * @Extends : BaseController | ||
| 17 | - * | ||
| 18 | - * @Description: TODO(公司控制层) | ||
| 19 | - * | ||
| 20 | - * @Author bsth@lq | ||
| 21 | - * | ||
| 22 | - * @Date 2016-4-28 9:21:17 | ||
| 23 | - * | ||
| 24 | - * @Version 公交调度系统BS版 0.1 | ||
| 25 | - * | ||
| 26 | - */ | ||
| 27 | -@RestController | ||
| 28 | -@RequestMapping("business") | ||
| 29 | -public class BusinessController extends BaseController<Business, Integer> { | ||
| 30 | - @Autowired | ||
| 31 | - private BusinessService businessService; | ||
| 32 | - | ||
| 33 | - @RequestMapping(value = "getCompCode", method = RequestMethod.GET) | ||
| 34 | - public long getLineCode() { | ||
| 35 | - return businessService.getCompCode(); | ||
| 36 | - } | ||
| 37 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 4 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | + | ||
| 8 | +import com.bsth.entity.Business; | ||
| 9 | +import com.bsth.service.BusinessService; | ||
| 10 | +import com.bsth.util.GetUIDAndCode; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * | ||
| 14 | + * @ClassName: LineController(公司控制器) | ||
| 15 | + * | ||
| 16 | + * @Extends : BaseController | ||
| 17 | + * | ||
| 18 | + * @Description: TODO(公司控制层) | ||
| 19 | + * | ||
| 20 | + * @Author bsth@lq | ||
| 21 | + * | ||
| 22 | + * @Date 2016-4-28 9:21:17 | ||
| 23 | + * | ||
| 24 | + * @Version 公交调度系统BS版 0.1 | ||
| 25 | + * | ||
| 26 | + */ | ||
| 27 | +@RestController | ||
| 28 | +@RequestMapping("business") | ||
| 29 | +public class BusinessController extends BaseController<Business, Integer> { | ||
| 30 | + @Autowired | ||
| 31 | + private BusinessService businessService; | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "getCompCode", method = RequestMethod.GET) | ||
| 34 | + public long getLineCode() { | ||
| 35 | + return businessService.getCompCode(); | ||
| 36 | + } | ||
| 37 | +} |
src/main/java/com/bsth/controller/CarDeviceController.java renamed to schedule-core/src/main/java/com/bsth/controller/CarDeviceController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.CarDevice; | ||
| 5 | -import com.bsth.service.CarDeviceService; | ||
| 6 | -import org.joda.time.DateTime; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 9 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | -import org.springframework.web.bind.annotation.RestController; | ||
| 12 | - | ||
| 13 | -import java.util.HashMap; | ||
| 14 | -import java.util.Iterator; | ||
| 15 | -import java.util.Map; | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * Created by xu on 16/6/15. | ||
| 19 | - */ | ||
| 20 | -@RestController | ||
| 21 | -@RequestMapping("cde") | ||
| 22 | -public class CarDeviceController extends BaseController<CarDevice, Long> { | ||
| 23 | - @Autowired | ||
| 24 | - private CarDeviceService carDeviceService; | ||
| 25 | - /** | ||
| 26 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | ||
| 27 | - * @Title: save | ||
| 28 | - * @Description: TODO(持久化对象) | ||
| 29 | - * @param @param t | ||
| 30 | - * @param @return 设定文件 | ||
| 31 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 32 | - * @throws | ||
| 33 | - */ | ||
| 34 | - @RequestMapping(method = RequestMethod.POST) | ||
| 35 | - public Map<String, Object> save(@RequestBody CarDevice t){ | ||
| 36 | - return baseService.save(t); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - @RequestMapping(value = "/validate/qyrq", method = RequestMethod.GET) | ||
| 40 | - public Map<String, Object> validateQyrq(String qyrq, Integer xl, Integer cl) { | ||
| 41 | - // 验证启用日期,必须是最大的日期,就是最晚的日期 | ||
| 42 | - Map<String, Object> obj = new HashMap<>(); | ||
| 43 | - obj.put("xl_eq", xl); | ||
| 44 | - obj.put("cl_eq", cl); | ||
| 45 | - obj.put("qyrq_ge", new DateTime(qyrq).toDate()); | ||
| 46 | - Iterator<CarDevice> iterator = carDeviceService.list(obj).iterator(); | ||
| 47 | - if (iterator.hasNext()) { | ||
| 48 | - obj.clear(); | ||
| 49 | - obj.put("status", ResponseCode.ERROR); | ||
| 50 | - } else { | ||
| 51 | - obj.clear(); | ||
| 52 | - obj.put("status", ResponseCode.SUCCESS); | ||
| 53 | - } | ||
| 54 | - return obj; | ||
| 55 | - } | ||
| 56 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.CarDevice; | ||
| 5 | +import com.bsth.service.CarDeviceService; | ||
| 6 | +import org.joda.time.DateTime; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.Iterator; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Created by xu on 16/6/15. | ||
| 19 | + */ | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("cde") | ||
| 22 | +public class CarDeviceController extends BaseController<CarDevice, Long> { | ||
| 23 | + @Autowired | ||
| 24 | + private CarDeviceService carDeviceService; | ||
| 25 | + /** | ||
| 26 | + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | ||
| 27 | + * @Title: save | ||
| 28 | + * @Description: TODO(持久化对象) | ||
| 29 | + * @param @param t | ||
| 30 | + * @param @return 设定文件 | ||
| 31 | + * @return Map<String,Object> {status: 1(成功),-1(失败)} | ||
| 32 | + * @throws | ||
| 33 | + */ | ||
| 34 | + @RequestMapping(method = RequestMethod.POST) | ||
| 35 | + public Map<String, Object> save(@RequestBody CarDevice t){ | ||
| 36 | + return baseService.save(t); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @RequestMapping(value = "/validate/qyrq", method = RequestMethod.GET) | ||
| 40 | + public Map<String, Object> validateQyrq(String qyrq, Integer xl, Integer cl) { | ||
| 41 | + // 验证启用日期,必须是最大的日期,就是最晚的日期 | ||
| 42 | + Map<String, Object> obj = new HashMap<>(); | ||
| 43 | + obj.put("xl_eq", xl); | ||
| 44 | + obj.put("cl_eq", cl); | ||
| 45 | + obj.put("qyrq_ge", new DateTime(qyrq).toDate()); | ||
| 46 | + Iterator<CarDevice> iterator = carDeviceService.list(obj).iterator(); | ||
| 47 | + if (iterator.hasNext()) { | ||
| 48 | + obj.clear(); | ||
| 49 | + obj.put("status", ResponseCode.ERROR); | ||
| 50 | + } else { | ||
| 51 | + obj.clear(); | ||
| 52 | + obj.put("status", ResponseCode.SUCCESS); | ||
| 53 | + } | ||
| 54 | + return obj; | ||
| 55 | + } | ||
| 56 | +} |
src/main/java/com/bsth/controller/CarParkController.java renamed to schedule-core/src/main/java/com/bsth/controller/CarParkController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import java.util.HashMap; | ||
| 4 | -import java.util.List; | ||
| 5 | -import java.util.Map; | ||
| 6 | - | ||
| 7 | -import com.bsth.entity.CarPark; | ||
| 8 | -import com.bsth.service.CarParkService; | ||
| 9 | -import com.bsth.util.GetUIDAndCode; | ||
| 10 | - | ||
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | -import org.springframework.web.bind.annotation.*; | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -@RestController | ||
| 16 | -@RequestMapping("carpark") | ||
| 17 | -public class CarParkController extends BaseController<CarPark, Integer> { | ||
| 18 | - @Autowired | ||
| 19 | - CarParkService service; | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * @Description :TODO(查询停车场编码) | ||
| 23 | - * | ||
| 24 | - * @return int <carParkCode 停车场编码> | ||
| 25 | - */ | ||
| 26 | - @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET) | ||
| 27 | - public Map<String, Object> getStationCode() { | ||
| 28 | - Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 29 | - resultMap.put("carParkCode", "FFFFFF" + service.carParkMaxId() + 1); | ||
| 30 | - return resultMap; | ||
| 31 | - } | ||
| 32 | - /** | ||
| 33 | - * 新增停车场信息 | ||
| 34 | - * | ||
| 35 | - * | ||
| 36 | - * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | ||
| 37 | - * | ||
| 38 | - * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | ||
| 39 | - * | ||
| 40 | - * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | ||
| 41 | - * | ||
| 42 | - * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | ||
| 43 | - * | ||
| 44 | - * @return map <SUCCESS:成功;ERROR:失败> | ||
| 45 | - * | ||
| 46 | - */ | ||
| 47 | - @RequestMapping(value="carParkSave" , method = RequestMethod.POST) | ||
| 48 | - public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { | ||
| 49 | - map.put("createBy", ""); | ||
| 50 | - map.put("updateBy", ""); | ||
| 51 | - return service.carParkSave(map); | ||
| 52 | - } | ||
| 53 | - @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET) | ||
| 54 | - public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) { | ||
| 55 | - return service.findCarParkInfoFormId(map); | ||
| 56 | - } | ||
| 57 | - /** | ||
| 58 | - * 修改停车场信息 | ||
| 59 | - * | ||
| 60 | - * | ||
| 61 | - * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | ||
| 62 | - * | ||
| 63 | - * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | ||
| 64 | - * | ||
| 65 | - * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | ||
| 66 | - * | ||
| 67 | - * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | ||
| 68 | - * | ||
| 69 | - * @return map <SUCCESS:成功;ERROR:失败> | ||
| 70 | - * | ||
| 71 | - */ | ||
| 72 | - @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) | ||
| 73 | - public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { | ||
| 74 | - map.put("updateBy", ""); | ||
| 75 | - return service.carParkUpdate(map); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - @RequestMapping(value="isHaveParkCode",method=RequestMethod.GET) | ||
| 79 | - public boolean isHaveParkCode(@RequestParam Map<String,Object> map) { | ||
| 80 | - return service.selectTccInfoByCode(map); | ||
| 81 | - } | ||
| 82 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Map; | ||
| 6 | + | ||
| 7 | +import com.bsth.entity.CarPark; | ||
| 8 | +import com.bsth.service.CarParkService; | ||
| 9 | +import com.bsth.util.GetUIDAndCode; | ||
| 10 | + | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("carpark") | ||
| 17 | +public class CarParkController extends BaseController<CarPark, Integer> { | ||
| 18 | + @Autowired | ||
| 19 | + CarParkService service; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * @Description :TODO(查询停车场编码) | ||
| 23 | + * | ||
| 24 | + * @return int <carParkCode 停车场编码> | ||
| 25 | + */ | ||
| 26 | + @RequestMapping(value="getCarParkCode" , method = RequestMethod.GET) | ||
| 27 | + public Map<String, Object> getStationCode() { | ||
| 28 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 29 | + resultMap.put("carParkCode", "FFFFFF" + service.carParkMaxId() + 1); | ||
| 30 | + return resultMap; | ||
| 31 | + } | ||
| 32 | + /** | ||
| 33 | + * 新增停车场信息 | ||
| 34 | + * | ||
| 35 | + * | ||
| 36 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | ||
| 37 | + * | ||
| 38 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | ||
| 39 | + * | ||
| 40 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | ||
| 41 | + * | ||
| 42 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | ||
| 43 | + * | ||
| 44 | + * @return map <SUCCESS:成功;ERROR:失败> | ||
| 45 | + * | ||
| 46 | + */ | ||
| 47 | + @RequestMapping(value="carParkSave" , method = RequestMethod.POST) | ||
| 48 | + public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { | ||
| 49 | + map.put("createBy", ""); | ||
| 50 | + map.put("updateBy", ""); | ||
| 51 | + return service.carParkSave(map); | ||
| 52 | + } | ||
| 53 | + @RequestMapping(value = "findCarParkInfoFormId",method = RequestMethod.GET) | ||
| 54 | + public List<Map<String, Object>> findCarParkInfoFormId(@RequestParam Map<String, Object> map) { | ||
| 55 | + return service.findCarParkInfoFormId(map); | ||
| 56 | + } | ||
| 57 | + /** | ||
| 58 | + * 修改停车场信息 | ||
| 59 | + * | ||
| 60 | + * | ||
| 61 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | ||
| 62 | + * | ||
| 63 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | ||
| 64 | + * | ||
| 65 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | ||
| 66 | + * | ||
| 67 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | ||
| 68 | + * | ||
| 69 | + * @return map <SUCCESS:成功;ERROR:失败> | ||
| 70 | + * | ||
| 71 | + */ | ||
| 72 | + @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) | ||
| 73 | + public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { | ||
| 74 | + map.put("updateBy", ""); | ||
| 75 | + return service.carParkUpdate(map); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + @RequestMapping(value="isHaveParkCode",method=RequestMethod.GET) | ||
| 79 | + public boolean isHaveParkCode(@RequestParam Map<String,Object> map) { | ||
| 80 | + return service.selectTccInfoByCode(map); | ||
| 81 | + } | ||
| 82 | +} |
src/main/java/com/bsth/controller/CarsController.java renamed to schedule-core/src/main/java/com/bsth/controller/CarsController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Cars; | ||
| 4 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | -import org.springframework.web.bind.annotation.RestController; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * Created by xu on 16/5/31. | ||
| 9 | - */ | ||
| 10 | -@RestController | ||
| 11 | -@RequestMapping("cars") | ||
| 12 | -public class CarsController extends BaseController<Cars, Integer> { | ||
| 13 | - | ||
| 14 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | +import org.springframework.web.bind.annotation.RestController; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Created by xu on 16/5/31. | ||
| 9 | + */ | ||
| 10 | +@RestController | ||
| 11 | +@RequestMapping("cars") | ||
| 12 | +public class CarsController extends BaseController<Cars, Integer> { | ||
| 13 | + | ||
| 14 | +} |
src/main/java/com/bsth/controller/DeviceGpsController.java renamed to schedule-core/src/main/java/com/bsth/controller/DeviceGpsController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 4 | -import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 5 | -import com.fasterxml.jackson.core.JsonParseException; | ||
| 6 | -import com.fasterxml.jackson.databind.JsonMappingException; | ||
| 7 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 8 | -import org.apache.commons.lang.StringEscapeUtils; | ||
| 9 | -import org.apache.poi.hssf.usermodel.*; | ||
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | -import org.springframework.util.StringUtils; | ||
| 12 | -import org.springframework.web.bind.annotation.*; | ||
| 13 | -import org.springframework.web.multipart.MultipartFile; | ||
| 14 | - | ||
| 15 | -import javax.servlet.http.HttpServletRequest; | ||
| 16 | -import javax.servlet.http.HttpServletResponse; | ||
| 17 | -import java.io.*; | ||
| 18 | -import java.text.SimpleDateFormat; | ||
| 19 | -import java.util.*; | ||
| 20 | - | ||
| 21 | -@RestController | ||
| 22 | -@RequestMapping("devicegps") | ||
| 23 | -public class DeviceGpsController { | ||
| 24 | - | ||
| 25 | - @Autowired | ||
| 26 | - GpsRealData gpsRealData; | ||
| 27 | - | ||
| 28 | - @RequestMapping(value = "/real/line/{lineCode}") | ||
| 29 | - public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | ||
| 30 | - return gpsRealData.getByLine(lineCode); | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - @RequestMapping(value = "/real/all") | ||
| 34 | - public List<GpsEntity> findByLineCodes() { | ||
| 35 | - return new ArrayList<>(gpsRealData.all()); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - @RequestMapping(value = "/open", method = RequestMethod.POST) | ||
| 39 | - public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) { | ||
| 40 | - Map<String, Object> res = new HashMap<>(); | ||
| 41 | - File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + ""); | ||
| 42 | - File rd = rf.getParentFile(); | ||
| 43 | - if (!rd.exists()) { | ||
| 44 | - rd.mkdirs(); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - BufferedReader reader = null; | ||
| 48 | - try { | ||
| 49 | - file.transferTo(rf); | ||
| 50 | - reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK")); | ||
| 51 | - String line = null; | ||
| 52 | - List<Map<String, Object>> data = new ArrayList<>(); | ||
| 53 | - while ((line = reader.readLine()) != null) { | ||
| 54 | - if (!StringUtils.isEmpty(line)) { | ||
| 55 | - String temp[] = line.split(","); | ||
| 56 | - if (temp.length != 4) { | ||
| 57 | - res.put("errCode", 1); | ||
| 58 | - res.put("msg", "txt文档格式错误,请检查"); | ||
| 59 | - return res; | ||
| 60 | - } | ||
| 61 | - Map<String, Object> info = new HashMap<>(); | ||
| 62 | - info.put("lineName", temp[0]); | ||
| 63 | - info.put("lineCode", temp[1]); | ||
| 64 | - info.put("inCode", temp[2]); | ||
| 65 | - info.put("deviceId", temp[3]); | ||
| 66 | - info.put("detail", gpsRealData.get(temp[3])); | ||
| 67 | - | ||
| 68 | - data.add(info); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - // 删除临时文件 | ||
| 72 | - rf.delete(); | ||
| 73 | - res.put("errCode", 0); | ||
| 74 | - res.put("data", data); | ||
| 75 | - } catch (IllegalStateException e) { | ||
| 76 | - // TODO Auto-generated catch block | ||
| 77 | - e.printStackTrace(); | ||
| 78 | - } catch (IOException e) { | ||
| 79 | - // TODO Auto-generated catch block | ||
| 80 | - e.printStackTrace(); | ||
| 81 | - } finally { | ||
| 82 | - try { | ||
| 83 | - if (reader != null) reader.close(); | ||
| 84 | - } catch (IOException e) { | ||
| 85 | - // TODO Auto-generated catch block | ||
| 86 | - e.printStackTrace(); | ||
| 87 | - } | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - return res; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - @SuppressWarnings("unchecked") | ||
| 94 | - @RequestMapping(value = "/opened", method = RequestMethod.POST) | ||
| 95 | - public Map<String, Object> opened(@RequestParam(value = "json")String json) { | ||
| 96 | - json = StringEscapeUtils.unescapeHtml(json); | ||
| 97 | - Map<String, Object> res = new HashMap<>(); | ||
| 98 | - List<Map<String, Object>> data = null; | ||
| 99 | - try { | ||
| 100 | - data = new ObjectMapper().readValue(json, List.class); | ||
| 101 | - for (Map<String, Object> info : data) { | ||
| 102 | - info.put("detail", gpsRealData.get((String)info.get("deviceId"))); | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - res.put("errCode", 0); | ||
| 106 | - res.put("data", data); | ||
| 107 | - } catch (JsonParseException e) { | ||
| 108 | - // TODO Auto-generated catch block | ||
| 109 | - e.printStackTrace(); | ||
| 110 | - } catch (JsonMappingException e) { | ||
| 111 | - // TODO Auto-generated catch block | ||
| 112 | - e.printStackTrace(); | ||
| 113 | - } catch (IOException e) { | ||
| 114 | - // TODO Auto-generated catch block | ||
| 115 | - e.printStackTrace(); | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - return res; | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - @SuppressWarnings("unchecked") | ||
| 122 | - @RequestMapping(value = "/export", method = RequestMethod.POST) | ||
| 123 | - public void export(@RequestParam(value = "json")String json, HttpServletResponse response) { | ||
| 124 | - json = StringEscapeUtils.unescapeHtml(json); | ||
| 125 | - List<Map<String, Object>> data = null; | ||
| 126 | - OutputStream out = null; | ||
| 127 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 128 | - try { | ||
| 129 | - data = new ObjectMapper().readValue(json, List.class); | ||
| 130 | - for (Map<String, Object> info : data) { | ||
| 131 | - Map<String, Object> detail = (Map<String, Object>)info.get("detail"); | ||
| 132 | - if (detail != null) { | ||
| 133 | - info.put("lineId", detail.get("lineId")); | ||
| 134 | - info.put("valid", (int)detail.get("valid") == 0 ? "有效" : "无效"); | ||
| 135 | - info.put("timestamp", sdf.format(new Date((Long)detail.get("timestamp")))); | ||
| 136 | - info.put("version", detail.get("version")); | ||
| 137 | - } else { | ||
| 138 | - info.put("lineId", ""); | ||
| 139 | - info.put("valid", ""); | ||
| 140 | - info.put("timestamp", ""); | ||
| 141 | - info.put("version", ""); | ||
| 142 | - } | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - List<Header> head = new ArrayList<>(); | ||
| 146 | - head.add(new Header("线路编码", "lineCode")); | ||
| 147 | - head.add(new Header("线路名称", "lineName")); | ||
| 148 | - head.add(new Header("内部编码", "inCode")); | ||
| 149 | - head.add(new Header("识别码", "deviceId")); | ||
| 150 | - head.add(new Header("线路ID", "lineId")); | ||
| 151 | - head.add(new Header("GPS", "valid")); | ||
| 152 | - head.add(new Header("report", "timestamp")); | ||
| 153 | - head.add(new Header("版本", "version")); | ||
| 154 | - | ||
| 155 | - // 清空response | ||
| 156 | - response.reset(); | ||
| 157 | - // 设置response的Header | ||
| 158 | - response.addHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls"); | ||
| 159 | - response.setContentType("application/vnd.ms-excel;charset=UTF-8"); | ||
| 160 | - out = new BufferedOutputStream(response.getOutputStream()); | ||
| 161 | - excel(head, data, out); | ||
| 162 | - out.flush(); | ||
| 163 | - } catch (JsonParseException e) { | ||
| 164 | - // TODO Auto-generated catch block | ||
| 165 | - e.printStackTrace(); | ||
| 166 | - } catch (JsonMappingException e) { | ||
| 167 | - // TODO Auto-generated catch block | ||
| 168 | - e.printStackTrace(); | ||
| 169 | - } catch (IOException e) { | ||
| 170 | - // TODO Auto-generated catch block | ||
| 171 | - e.printStackTrace(); | ||
| 172 | - } finally { | ||
| 173 | - try { | ||
| 174 | - if (out != null) out.close(); | ||
| 175 | - } catch (IOException e) { | ||
| 176 | - e.printStackTrace(); | ||
| 177 | - } | ||
| 178 | - } | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - private void excel(List<Header> head, List<Map<String, Object>> data, OutputStream out) throws IOException { | ||
| 182 | - // 声明一个工作薄 | ||
| 183 | - HSSFWorkbook wb = new HSSFWorkbook(); | ||
| 184 | - // 生成一个表格 | ||
| 185 | - HSSFSheet sheet = wb.createSheet("1"); | ||
| 186 | - // 产生表格标题行 | ||
| 187 | - HSSFRow row = sheet.createRow(0); | ||
| 188 | - for (int i = 0;i < head.size();i++) { | ||
| 189 | - HSSFCell cell = row.createCell(i); | ||
| 190 | - HSSFRichTextString text = new HSSFRichTextString(head.get(i).getDescribe()); | ||
| 191 | - cell.setCellValue(text); | ||
| 192 | - } | ||
| 193 | - | ||
| 194 | - int rownum = 1; | ||
| 195 | - for (Map<String, Object> map : data) { | ||
| 196 | - HSSFRow r = sheet.createRow(rownum); | ||
| 197 | - for (int i = 0;i < head.size();i++) { | ||
| 198 | - HSSFCell cell = r.createCell(i); | ||
| 199 | - HSSFRichTextString text = new HSSFRichTextString(String.valueOf(map.get(head.get(i).getField()))); | ||
| 200 | - cell.setCellValue(text); | ||
| 201 | - } | ||
| 202 | - rownum++; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - wb.write(out); | ||
| 206 | - wb.close(); | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - final class Header { | ||
| 210 | - private String describe; | ||
| 211 | - private String field; | ||
| 212 | - | ||
| 213 | - Header(){ | ||
| 214 | - | ||
| 215 | - } | ||
| 216 | - | ||
| 217 | - Header(String describe, String field) { | ||
| 218 | - this.describe = describe; | ||
| 219 | - this.field = field; | ||
| 220 | - } | ||
| 221 | - | ||
| 222 | - public String getDescribe() { | ||
| 223 | - return describe; | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - public void setDescribe(String describe) { | ||
| 227 | - this.describe = describe; | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - public String getField() { | ||
| 231 | - return field; | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - public void setField(String field) { | ||
| 235 | - this.field = field; | ||
| 236 | - } | ||
| 237 | - } | ||
| 238 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 4 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 5 | +import com.fasterxml.jackson.core.JsonParseException; | ||
| 6 | +import com.fasterxml.jackson.databind.JsonMappingException; | ||
| 7 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 8 | +import org.apache.commons.lang.StringEscapeUtils; | ||
| 9 | +import org.apache.poi.hssf.usermodel.*; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.util.StringUtils; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | +import org.springframework.web.multipart.MultipartFile; | ||
| 14 | + | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 16 | +import javax.servlet.http.HttpServletResponse; | ||
| 17 | +import java.io.*; | ||
| 18 | +import java.text.SimpleDateFormat; | ||
| 19 | +import java.util.*; | ||
| 20 | + | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("devicegps") | ||
| 23 | +public class DeviceGpsController { | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + GpsRealData gpsRealData; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/real/line/{lineCode}") | ||
| 29 | + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | ||
| 30 | + return gpsRealData.getByLine(lineCode); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "/real/all") | ||
| 34 | + public List<GpsEntity> findByLineCodes() { | ||
| 35 | + return new ArrayList<>(gpsRealData.all()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @RequestMapping(value = "/open", method = RequestMethod.POST) | ||
| 39 | + public Map<String, Object> open(@RequestParam(value = "_txt_", required = false) MultipartFile file, HttpServletRequest request) { | ||
| 40 | + Map<String, Object> res = new HashMap<>(); | ||
| 41 | + File rf = new File(request.getServletContext().getRealPath("/temp"), System.currentTimeMillis() + ""); | ||
| 42 | + File rd = rf.getParentFile(); | ||
| 43 | + if (!rd.exists()) { | ||
| 44 | + rd.mkdirs(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + BufferedReader reader = null; | ||
| 48 | + try { | ||
| 49 | + file.transferTo(rf); | ||
| 50 | + reader = new BufferedReader(new InputStreamReader(new FileInputStream(rf), "GBK")); | ||
| 51 | + String line = null; | ||
| 52 | + List<Map<String, Object>> data = new ArrayList<>(); | ||
| 53 | + while ((line = reader.readLine()) != null) { | ||
| 54 | + if (!StringUtils.isEmpty(line)) { | ||
| 55 | + String temp[] = line.split(","); | ||
| 56 | + if (temp.length != 4) { | ||
| 57 | + res.put("errCode", 1); | ||
| 58 | + res.put("msg", "txt文档格式错误,请检查"); | ||
| 59 | + return res; | ||
| 60 | + } | ||
| 61 | + Map<String, Object> info = new HashMap<>(); | ||
| 62 | + info.put("lineName", temp[0]); | ||
| 63 | + info.put("lineCode", temp[1]); | ||
| 64 | + info.put("inCode", temp[2]); | ||
| 65 | + info.put("deviceId", temp[3]); | ||
| 66 | + info.put("detail", gpsRealData.get(temp[3])); | ||
| 67 | + | ||
| 68 | + data.add(info); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + // 删除临时文件 | ||
| 72 | + rf.delete(); | ||
| 73 | + res.put("errCode", 0); | ||
| 74 | + res.put("data", data); | ||
| 75 | + } catch (IllegalStateException e) { | ||
| 76 | + // TODO Auto-generated catch block | ||
| 77 | + e.printStackTrace(); | ||
| 78 | + } catch (IOException e) { | ||
| 79 | + // TODO Auto-generated catch block | ||
| 80 | + e.printStackTrace(); | ||
| 81 | + } finally { | ||
| 82 | + try { | ||
| 83 | + if (reader != null) reader.close(); | ||
| 84 | + } catch (IOException e) { | ||
| 85 | + // TODO Auto-generated catch block | ||
| 86 | + e.printStackTrace(); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + return res; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @SuppressWarnings("unchecked") | ||
| 94 | + @RequestMapping(value = "/opened", method = RequestMethod.POST) | ||
| 95 | + public Map<String, Object> opened(@RequestParam(value = "json")String json) { | ||
| 96 | + json = StringEscapeUtils.unescapeHtml(json); | ||
| 97 | + Map<String, Object> res = new HashMap<>(); | ||
| 98 | + List<Map<String, Object>> data = null; | ||
| 99 | + try { | ||
| 100 | + data = new ObjectMapper().readValue(json, List.class); | ||
| 101 | + for (Map<String, Object> info : data) { | ||
| 102 | + info.put("detail", gpsRealData.get((String)info.get("deviceId"))); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + res.put("errCode", 0); | ||
| 106 | + res.put("data", data); | ||
| 107 | + } catch (JsonParseException e) { | ||
| 108 | + // TODO Auto-generated catch block | ||
| 109 | + e.printStackTrace(); | ||
| 110 | + } catch (JsonMappingException e) { | ||
| 111 | + // TODO Auto-generated catch block | ||
| 112 | + e.printStackTrace(); | ||
| 113 | + } catch (IOException e) { | ||
| 114 | + // TODO Auto-generated catch block | ||
| 115 | + e.printStackTrace(); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + return res; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + @SuppressWarnings("unchecked") | ||
| 122 | + @RequestMapping(value = "/export", method = RequestMethod.POST) | ||
| 123 | + public void export(@RequestParam(value = "json")String json, HttpServletResponse response) { | ||
| 124 | + json = StringEscapeUtils.unescapeHtml(json); | ||
| 125 | + List<Map<String, Object>> data = null; | ||
| 126 | + OutputStream out = null; | ||
| 127 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 128 | + try { | ||
| 129 | + data = new ObjectMapper().readValue(json, List.class); | ||
| 130 | + for (Map<String, Object> info : data) { | ||
| 131 | + Map<String, Object> detail = (Map<String, Object>)info.get("detail"); | ||
| 132 | + if (detail != null) { | ||
| 133 | + info.put("lineId", detail.get("lineId")); | ||
| 134 | + info.put("valid", (int)detail.get("valid") == 0 ? "有效" : "无效"); | ||
| 135 | + info.put("timestamp", sdf.format(new Date((Long)detail.get("timestamp")))); | ||
| 136 | + info.put("version", detail.get("version")); | ||
| 137 | + } else { | ||
| 138 | + info.put("lineId", ""); | ||
| 139 | + info.put("valid", ""); | ||
| 140 | + info.put("timestamp", ""); | ||
| 141 | + info.put("version", ""); | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + List<Header> head = new ArrayList<>(); | ||
| 146 | + head.add(new Header("线路编码", "lineCode")); | ||
| 147 | + head.add(new Header("线路名称", "lineName")); | ||
| 148 | + head.add(new Header("内部编码", "inCode")); | ||
| 149 | + head.add(new Header("识别码", "deviceId")); | ||
| 150 | + head.add(new Header("线路ID", "lineId")); | ||
| 151 | + head.add(new Header("GPS", "valid")); | ||
| 152 | + head.add(new Header("report", "timestamp")); | ||
| 153 | + head.add(new Header("版本", "version")); | ||
| 154 | + | ||
| 155 | + // 清空response | ||
| 156 | + response.reset(); | ||
| 157 | + // 设置response的Header | ||
| 158 | + response.addHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls"); | ||
| 159 | + response.setContentType("application/vnd.ms-excel;charset=UTF-8"); | ||
| 160 | + out = new BufferedOutputStream(response.getOutputStream()); | ||
| 161 | + excel(head, data, out); | ||
| 162 | + out.flush(); | ||
| 163 | + } catch (JsonParseException e) { | ||
| 164 | + // TODO Auto-generated catch block | ||
| 165 | + e.printStackTrace(); | ||
| 166 | + } catch (JsonMappingException e) { | ||
| 167 | + // TODO Auto-generated catch block | ||
| 168 | + e.printStackTrace(); | ||
| 169 | + } catch (IOException e) { | ||
| 170 | + // TODO Auto-generated catch block | ||
| 171 | + e.printStackTrace(); | ||
| 172 | + } finally { | ||
| 173 | + try { | ||
| 174 | + if (out != null) out.close(); | ||
| 175 | + } catch (IOException e) { | ||
| 176 | + e.printStackTrace(); | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + private void excel(List<Header> head, List<Map<String, Object>> data, OutputStream out) throws IOException { | ||
| 182 | + // 声明一个工作薄 | ||
| 183 | + HSSFWorkbook wb = new HSSFWorkbook(); | ||
| 184 | + // 生成一个表格 | ||
| 185 | + HSSFSheet sheet = wb.createSheet("1"); | ||
| 186 | + // 产生表格标题行 | ||
| 187 | + HSSFRow row = sheet.createRow(0); | ||
| 188 | + for (int i = 0;i < head.size();i++) { | ||
| 189 | + HSSFCell cell = row.createCell(i); | ||
| 190 | + HSSFRichTextString text = new HSSFRichTextString(head.get(i).getDescribe()); | ||
| 191 | + cell.setCellValue(text); | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + int rownum = 1; | ||
| 195 | + for (Map<String, Object> map : data) { | ||
| 196 | + HSSFRow r = sheet.createRow(rownum); | ||
| 197 | + for (int i = 0;i < head.size();i++) { | ||
| 198 | + HSSFCell cell = r.createCell(i); | ||
| 199 | + HSSFRichTextString text = new HSSFRichTextString(String.valueOf(map.get(head.get(i).getField()))); | ||
| 200 | + cell.setCellValue(text); | ||
| 201 | + } | ||
| 202 | + rownum++; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + wb.write(out); | ||
| 206 | + wb.close(); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + final class Header { | ||
| 210 | + private String describe; | ||
| 211 | + private String field; | ||
| 212 | + | ||
| 213 | + Header(){ | ||
| 214 | + | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + Header(String describe, String field) { | ||
| 218 | + this.describe = describe; | ||
| 219 | + this.field = field; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + public String getDescribe() { | ||
| 223 | + return describe; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + public void setDescribe(String describe) { | ||
| 227 | + this.describe = describe; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + public String getField() { | ||
| 231 | + return field; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + public void setField(String field) { | ||
| 235 | + this.field = field; | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | +} |
src/main/java/com/bsth/controller/DownloadController.java renamed to schedule-core/src/main/java/com/bsth/controller/DownloadController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import java.io.BufferedInputStream; | ||
| 4 | -import java.io.BufferedOutputStream; | ||
| 5 | -import java.io.File; | ||
| 6 | -import java.io.FileInputStream; | ||
| 7 | -import java.io.IOException; | ||
| 8 | -import java.io.InputStream; | ||
| 9 | -import java.io.OutputStream; | ||
| 10 | -import java.net.URLDecoder; | ||
| 11 | - | ||
| 12 | -import javax.servlet.http.HttpServletResponse; | ||
| 13 | - | ||
| 14 | -import org.apache.commons.io.FileUtils; | ||
| 15 | -import org.springframework.context.annotation.Scope; | ||
| 16 | -import org.springframework.http.HttpHeaders; | ||
| 17 | -import org.springframework.http.HttpStatus; | ||
| 18 | -import org.springframework.http.MediaType; | ||
| 19 | -import org.springframework.http.ResponseEntity; | ||
| 20 | -import org.springframework.stereotype.Component; | ||
| 21 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - * <一句话功能简述> | ||
| 25 | - * <功能详细描述> | ||
| 26 | - * | ||
| 27 | - * @author Administrator | ||
| 28 | - * @version [版本号, 2014年3月7日] | ||
| 29 | - * @see [相关类/方法] | ||
| 30 | - * @since [产品/模块版本] | ||
| 31 | - */ | ||
| 32 | -@Component | ||
| 33 | -@Scope("prototype") | ||
| 34 | -@RequestMapping("/downloadFile") | ||
| 35 | -public class DownloadController | ||
| 36 | -{ | ||
| 37 | - | ||
| 38 | - @RequestMapping("download2") | ||
| 39 | - public ResponseEntity<byte[]> download2(String fileName) throws IOException { | ||
| 40 | - String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 41 | - fileNames = fileNames + ".xls"; | ||
| 42 | - String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileNames; | ||
| 43 | - System.out.println(moudelPath); | ||
| 44 | -// String path="D:\\export\\target\\"+jName+".xls"; | ||
| 45 | - File file=new File(moudelPath); | ||
| 46 | - HttpHeaders headers = new HttpHeaders(); | ||
| 47 | - String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 | ||
| 48 | - headers.setContentDispositionFormData("attachment", fileNames); | ||
| 49 | - System.out.println( URLDecoder.decode(realFileName,"utf-8")); | ||
| 50 | - headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); | ||
| 51 | - return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), | ||
| 52 | - headers, HttpStatus.CREATED); | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - @RequestMapping("download") | ||
| 56 | - public void download(HttpServletResponse response,String fileName) | ||
| 57 | - throws IOException { | ||
| 58 | -// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 59 | - if(!fileName.contains(".xls")) | ||
| 60 | - fileName =fileName + ".xls"; | ||
| 61 | - String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 62 | - File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 63 | -// String filename = file.getName();// 获取日志文件名称 | ||
| 64 | - InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 65 | - byte[] buffer = new byte[fis.available()]; | ||
| 66 | - fis.read(buffer); | ||
| 67 | - fis.close(); | ||
| 68 | - response.reset(); | ||
| 69 | - response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 70 | - response.addHeader("Content-Length", "" + file.length()); | ||
| 71 | - OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 72 | - response.setContentType("application/octet-stream"); | ||
| 73 | - os.write(buffer);// 输出文件 | ||
| 74 | - os.flush(); | ||
| 75 | - os.close(); | ||
| 76 | - file.delete(); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - @RequestMapping("downloadList") | ||
| 80 | - public void downloadList(HttpServletResponse response,String fileName) | ||
| 81 | - throws IOException { | ||
| 82 | -// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 83 | - File files = new File(this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName);// | ||
| 84 | - fileName = fileName + ".zip"; | ||
| 85 | - String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 86 | - File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 87 | -// String filename = file.getName();// 获取日志文件名称 | ||
| 88 | - InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 89 | - byte[] buffer = new byte[fis.available()]; | ||
| 90 | - fis.read(buffer); | ||
| 91 | - fis.close(); | ||
| 92 | - response.reset(); | ||
| 93 | - response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 94 | - response.addHeader("Content-Length", "" + file.length()); | ||
| 95 | - OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 96 | - response.setContentType("application/octet-stream"); | ||
| 97 | - os.write(buffer);// 输出文件 | ||
| 98 | - os.flush(); | ||
| 99 | - os.close(); | ||
| 100 | - file.delete(); | ||
| 101 | - deleteFiles(files); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - @RequestMapping("downloadModel") | ||
| 106 | - public void downloadModel(HttpServletResponse response,String fileName) | ||
| 107 | - throws IOException { | ||
| 108 | -// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 109 | - fileName =fileName + ".xls"; | ||
| 110 | - String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 111 | - File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 112 | -// String filename = file.getName();// 获取日志文件名称 | ||
| 113 | - InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 114 | - byte[] buffer = new byte[fis.available()]; | ||
| 115 | - fis.read(buffer); | ||
| 116 | - fis.close(); | ||
| 117 | - response.reset(); | ||
| 118 | - response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 119 | - response.addHeader("Content-Length", "" + file.length()); | ||
| 120 | - OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 121 | - response.setContentType("application/octet-stream"); | ||
| 122 | - os.write(buffer);// 输出文件 | ||
| 123 | - os.flush(); | ||
| 124 | - os.close(); | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - | ||
| 128 | - /** | ||
| 129 | - * 删除文件夹 | ||
| 130 | - * @param files | ||
| 131 | - * @return | ||
| 132 | - */ | ||
| 133 | - public Boolean deleteFiles(File files){ | ||
| 134 | - if (files.isDirectory()) { | ||
| 135 | - String[] children = files.list(); | ||
| 136 | - //递归删除目录中的子目录下 | ||
| 137 | - for (int i=0; i<children.length; i++) { | ||
| 138 | - boolean success = deleteFiles(new File(files, children[i])); | ||
| 139 | - if (!success) { | ||
| 140 | - return false; | ||
| 141 | - } | ||
| 142 | - } | ||
| 143 | - } | ||
| 144 | - //目录此时为空,可以删除 | ||
| 145 | - return files.delete(); | ||
| 146 | - } | ||
| 147 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import java.io.BufferedInputStream; | ||
| 4 | +import java.io.BufferedOutputStream; | ||
| 5 | +import java.io.File; | ||
| 6 | +import java.io.FileInputStream; | ||
| 7 | +import java.io.IOException; | ||
| 8 | +import java.io.InputStream; | ||
| 9 | +import java.io.OutputStream; | ||
| 10 | +import java.net.URLDecoder; | ||
| 11 | + | ||
| 12 | +import javax.servlet.http.HttpServletResponse; | ||
| 13 | + | ||
| 14 | +import org.apache.commons.io.FileUtils; | ||
| 15 | +import org.springframework.context.annotation.Scope; | ||
| 16 | +import org.springframework.http.HttpHeaders; | ||
| 17 | +import org.springframework.http.HttpStatus; | ||
| 18 | +import org.springframework.http.MediaType; | ||
| 19 | +import org.springframework.http.ResponseEntity; | ||
| 20 | +import org.springframework.stereotype.Component; | ||
| 21 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * <一句话功能简述> | ||
| 25 | + * <功能详细描述> | ||
| 26 | + * | ||
| 27 | + * @author Administrator | ||
| 28 | + * @version [版本号, 2014年3月7日] | ||
| 29 | + * @see [相关类/方法] | ||
| 30 | + * @since [产品/模块版本] | ||
| 31 | + */ | ||
| 32 | +@Component | ||
| 33 | +@Scope("prototype") | ||
| 34 | +@RequestMapping("/downloadFile") | ||
| 35 | +public class DownloadController | ||
| 36 | +{ | ||
| 37 | + | ||
| 38 | + @RequestMapping("download2") | ||
| 39 | + public ResponseEntity<byte[]> download2(String fileName) throws IOException { | ||
| 40 | + String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 41 | + fileNames = fileNames + ".xls"; | ||
| 42 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileNames; | ||
| 43 | + System.out.println(moudelPath); | ||
| 44 | +// String path="D:\\export\\target\\"+jName+".xls"; | ||
| 45 | + File file=new File(moudelPath); | ||
| 46 | + HttpHeaders headers = new HttpHeaders(); | ||
| 47 | + String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 | ||
| 48 | + headers.setContentDispositionFormData("attachment", fileNames); | ||
| 49 | + System.out.println( URLDecoder.decode(realFileName,"utf-8")); | ||
| 50 | + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); | ||
| 51 | + return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), | ||
| 52 | + headers, HttpStatus.CREATED); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @RequestMapping("download") | ||
| 56 | + public void download(HttpServletResponse response,String fileName) | ||
| 57 | + throws IOException { | ||
| 58 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 59 | + if(!fileName.contains(".xls")) | ||
| 60 | + fileName =fileName + ".xls"; | ||
| 61 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 62 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 63 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 64 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 65 | + byte[] buffer = new byte[fis.available()]; | ||
| 66 | + fis.read(buffer); | ||
| 67 | + fis.close(); | ||
| 68 | + response.reset(); | ||
| 69 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 70 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 71 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 72 | + response.setContentType("application/octet-stream"); | ||
| 73 | + os.write(buffer);// 输出文件 | ||
| 74 | + os.flush(); | ||
| 75 | + os.close(); | ||
| 76 | + file.delete(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @RequestMapping("downloadList") | ||
| 80 | + public void downloadList(HttpServletResponse response,String fileName) | ||
| 81 | + throws IOException { | ||
| 82 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 83 | + File files = new File(this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName);// | ||
| 84 | + fileName = fileName + ".zip"; | ||
| 85 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 86 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 87 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 88 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 89 | + byte[] buffer = new byte[fis.available()]; | ||
| 90 | + fis.read(buffer); | ||
| 91 | + fis.close(); | ||
| 92 | + response.reset(); | ||
| 93 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 94 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 95 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 96 | + response.setContentType("application/octet-stream"); | ||
| 97 | + os.write(buffer);// 输出文件 | ||
| 98 | + os.flush(); | ||
| 99 | + os.close(); | ||
| 100 | + file.delete(); | ||
| 101 | + deleteFiles(files); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + @RequestMapping("downloadModel") | ||
| 106 | + public void downloadModel(HttpServletResponse response,String fileName) | ||
| 107 | + throws IOException { | ||
| 108 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | ||
| 109 | + fileName =fileName + ".xls"; | ||
| 110 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | ||
| 111 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | ||
| 112 | +// String filename = file.getName();// 获取日志文件名称 | ||
| 113 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | ||
| 114 | + byte[] buffer = new byte[fis.available()]; | ||
| 115 | + fis.read(buffer); | ||
| 116 | + fis.close(); | ||
| 117 | + response.reset(); | ||
| 118 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | ||
| 119 | + response.addHeader("Content-Length", "" + file.length()); | ||
| 120 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | ||
| 121 | + response.setContentType("application/octet-stream"); | ||
| 122 | + os.write(buffer);// 输出文件 | ||
| 123 | + os.flush(); | ||
| 124 | + os.close(); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * 删除文件夹 | ||
| 130 | + * @param files | ||
| 131 | + * @return | ||
| 132 | + */ | ||
| 133 | + public Boolean deleteFiles(File files){ | ||
| 134 | + if (files.isDirectory()) { | ||
| 135 | + String[] children = files.list(); | ||
| 136 | + //递归删除目录中的子目录下 | ||
| 137 | + for (int i=0; i<children.length; i++) { | ||
| 138 | + boolean success = deleteFiles(new File(files, children[i])); | ||
| 139 | + if (!success) { | ||
| 140 | + return false; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + //目录此时为空,可以删除 | ||
| 145 | + return files.delete(); | ||
| 146 | + } | ||
| 147 | +} |
src/main/java/com/bsth/controller/DvrController.java renamed to schedule-core/src/main/java/com/bsth/controller/DvrController.java
src/main/java/com/bsth/controller/GeoPremiseController.java renamed to schedule-core/src/main/java/com/bsth/controller/GeoPremiseController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.GeoPremise; | ||
| 5 | -import com.bsth.service.GeoPremiseService; | ||
| 6 | -import com.bsth.util.GeoConverter; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 9 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | -import org.springframework.web.bind.annotation.RestController; | ||
| 11 | - | ||
| 12 | -import java.util.HashMap; | ||
| 13 | -import java.util.Map; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * @author Hill | ||
| 17 | - */ | ||
| 18 | -@RestController | ||
| 19 | -@RequestMapping("/api/geopremise") | ||
| 20 | -public class GeoPremiseController extends BaseController<GeoPremise, Integer> { | ||
| 21 | - | ||
| 22 | - @Autowired | ||
| 23 | - private GeoPremiseService geoPremiseService; | ||
| 24 | - | ||
| 25 | - @Override | ||
| 26 | - @RequestMapping(method = RequestMethod.POST) | ||
| 27 | - public Map<String, Object> save(GeoPremise geoPremise) { | ||
| 28 | - Map<String, Object> result = new HashMap<>(); | ||
| 29 | - try { | ||
| 30 | - String coords = geoPremise.getCoords(); | ||
| 31 | - geoPremise.setCoordsWgs(GeoConverter.polygonBd2wgs(String.format("POLYGON((%s))", coords)).toString().replace("POLYGON((", "").replace("))", "")); | ||
| 32 | - result.putAll(geoPremiseService.save(geoPremise)); | ||
| 33 | - result.put("status", ResponseCode.SUCCESS); | ||
| 34 | - } catch (Exception e) { | ||
| 35 | - result.put("status", ResponseCode.ERROR); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - return result; | ||
| 39 | - } | ||
| 40 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.GeoPremise; | ||
| 5 | +import com.bsth.service.GeoPremiseService; | ||
| 6 | +import com.bsth.util.GeoConverter; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import java.util.HashMap; | ||
| 13 | +import java.util.Map; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * @author Hill | ||
| 17 | + */ | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("/api/geopremise") | ||
| 20 | +public class GeoPremiseController extends BaseController<GeoPremise, Integer> { | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + private GeoPremiseService geoPremiseService; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + @RequestMapping(method = RequestMethod.POST) | ||
| 27 | + public Map<String, Object> save(GeoPremise geoPremise) { | ||
| 28 | + Map<String, Object> result = new HashMap<>(); | ||
| 29 | + try { | ||
| 30 | + String coords = geoPremise.getCoords(); | ||
| 31 | + geoPremise.setCoordsWgs(GeoConverter.polygonBd2wgs(String.format("POLYGON((%s))", coords)).toString().replace("POLYGON((", "").replace("))", "")); | ||
| 32 | + result.putAll(geoPremiseService.save(geoPremise)); | ||
| 33 | + result.put("status", ResponseCode.SUCCESS); | ||
| 34 | + } catch (Exception e) { | ||
| 35 | + result.put("status", ResponseCode.ERROR); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + return result; | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/bsth/controller/IndexController.java renamed to schedule-core/src/main/java/com/bsth/controller/IndexController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import java.io.BufferedInputStream; | ||
| 4 | -import java.io.IOException; | ||
| 5 | -import java.io.InputStream; | ||
| 6 | - | ||
| 7 | -import javax.servlet.http.HttpServletResponse; | ||
| 8 | - | ||
| 9 | -import org.apache.commons.lang3.StringUtils; | ||
| 10 | -import org.slf4j.Logger; | ||
| 11 | -import org.slf4j.LoggerFactory; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | -import org.springframework.web.bind.annotation.RestController; | ||
| 15 | - | ||
| 16 | -@RestController | ||
| 17 | -@RequestMapping("/") | ||
| 18 | -public class IndexController { | ||
| 19 | - | ||
| 20 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 21 | - | ||
| 22 | - String indexSource; | ||
| 23 | - | ||
| 24 | - /** | ||
| 25 | - * 构造函数 | ||
| 26 | - */ | ||
| 27 | - public IndexController() { | ||
| 28 | - load(); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * | ||
| 33 | - * @Title: index | ||
| 34 | - * @Description: TODO(输出首页 index.html) | ||
| 35 | - */ | ||
| 36 | - @RequestMapping | ||
| 37 | - public void index(String initFragment, HttpServletResponse resp) { | ||
| 38 | - | ||
| 39 | - // 初始打开的片段地址 | ||
| 40 | - String outStr = StringUtils.replace(indexSource, "^_^initFragment^_^", | ||
| 41 | - initFragment == null ? "" : initFragment); | ||
| 42 | - | ||
| 43 | - resp.setContentType("text/html;charset=UTF-8"); | ||
| 44 | - try { | ||
| 45 | - resp.getOutputStream().write(outStr.getBytes()); | ||
| 46 | - } catch (IOException e) { | ||
| 47 | - logger.error("", e); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - @RequestMapping(value = "/index/load", method = RequestMethod.GET) | ||
| 53 | - public void load() { | ||
| 54 | - BufferedInputStream bis = null; | ||
| 55 | - | ||
| 56 | - try { | ||
| 57 | - InputStream is = IndexController.class.getClassLoader().getResourceAsStream("static/index.html"); | ||
| 58 | - bis = new BufferedInputStream(is); | ||
| 59 | - StringBuilder source = new StringBuilder(); | ||
| 60 | - byte[] buffer = new byte[bis.available()]; | ||
| 61 | - | ||
| 62 | - while (bis.read(buffer) != -1) { | ||
| 63 | - source.append(new String(buffer)); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - indexSource = source.toString(); | ||
| 67 | - } catch (Exception e) { | ||
| 68 | - logger.error("", e); | ||
| 69 | - } finally { | ||
| 70 | - try { | ||
| 71 | - bis.close(); | ||
| 72 | - } catch (IOException e) { | ||
| 73 | - logger.error("", e); | ||
| 74 | - } | ||
| 75 | - } | ||
| 76 | - } | ||
| 77 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import java.io.BufferedInputStream; | ||
| 4 | +import java.io.IOException; | ||
| 5 | +import java.io.InputStream; | ||
| 6 | + | ||
| 7 | +import javax.servlet.http.HttpServletResponse; | ||
| 8 | + | ||
| 9 | +import org.apache.commons.lang3.StringUtils; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | +import org.springframework.web.bind.annotation.RestController; | ||
| 15 | + | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("/") | ||
| 18 | +public class IndexController { | ||
| 19 | + | ||
| 20 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 21 | + | ||
| 22 | + String indexSource; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 构造函数 | ||
| 26 | + */ | ||
| 27 | + public IndexController() { | ||
| 28 | + load(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * | ||
| 33 | + * @Title: index | ||
| 34 | + * @Description: TODO(输出首页 index.html) | ||
| 35 | + */ | ||
| 36 | + @RequestMapping | ||
| 37 | + public void index(String initFragment, HttpServletResponse resp) { | ||
| 38 | + | ||
| 39 | + // 初始打开的片段地址 | ||
| 40 | + String outStr = StringUtils.replace(indexSource, "^_^initFragment^_^", | ||
| 41 | + initFragment == null ? "" : initFragment); | ||
| 42 | + | ||
| 43 | + resp.setContentType("text/html;charset=UTF-8"); | ||
| 44 | + try { | ||
| 45 | + resp.getOutputStream().write(outStr.getBytes()); | ||
| 46 | + } catch (IOException e) { | ||
| 47 | + logger.error("", e); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @RequestMapping(value = "/index/load", method = RequestMethod.GET) | ||
| 53 | + public void load() { | ||
| 54 | + BufferedInputStream bis = null; | ||
| 55 | + | ||
| 56 | + try { | ||
| 57 | + InputStream is = IndexController.class.getClassLoader().getResourceAsStream("static/index.html"); | ||
| 58 | + bis = new BufferedInputStream(is); | ||
| 59 | + StringBuilder source = new StringBuilder(); | ||
| 60 | + byte[] buffer = new byte[bis.available()]; | ||
| 61 | + | ||
| 62 | + while (bis.read(buffer) != -1) { | ||
| 63 | + source.append(new String(buffer)); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + indexSource = source.toString(); | ||
| 67 | + } catch (Exception e) { | ||
| 68 | + logger.error("", e); | ||
| 69 | + } finally { | ||
| 70 | + try { | ||
| 71 | + bis.close(); | ||
| 72 | + } catch (IOException e) { | ||
| 73 | + logger.error("", e); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | +} |
src/main/java/com/bsth/controller/InoutCarparkController.java renamed to schedule-core/src/main/java/com/bsth/controller/InoutCarparkController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.LsInoutSectionRoute; | ||
| 5 | -import com.bsth.service.InoutCarparkService; | ||
| 6 | -import org.slf4j.Logger; | ||
| 7 | -import org.slf4j.LoggerFactory; | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.util.StringUtils; | ||
| 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; | ||
| 14 | - | ||
| 15 | -import java.util.HashMap; | ||
| 16 | -import java.util.Map; | ||
| 17 | - | ||
| 18 | -@RestController | ||
| 19 | -@RequestMapping("inout") | ||
| 20 | -public class InoutCarparkController extends BaseController<LsInoutSectionRoute, Long>{ | ||
| 21 | - | ||
| 22 | - private final static Logger logger = LoggerFactory.getLogger(InoutCarparkController.class); | ||
| 23 | - | ||
| 24 | - @Autowired | ||
| 25 | - InoutCarparkService inoutCarparkService; | ||
| 26 | - | ||
| 27 | - @RequestMapping(value = "/getStartEndByLine", method = RequestMethod.GET) | ||
| 28 | - public Map<String, Object> getStartEndByLine(@RequestParam("lineId")int lineId, @RequestParam("version")int version) { | ||
| 29 | - return inoutCarparkService.getStartEndByLine(lineId, version); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - @RequestMapping(value = "/getRouteByStartEnd", method = RequestMethod.GET) | ||
| 33 | - public Map<String, Object> getRouteByStartEnd(@RequestParam("lineId")int lineId, @RequestParam("version")int version, @RequestParam("start")String start, @RequestParam("end")String end) { | ||
| 34 | - return inoutCarparkService.getRouteByStartEnd(lineId, version, start, end); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 新增路段信息 | ||
| 39 | - * | ||
| 40 | - * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | ||
| 41 | - * | ||
| 42 | - * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | ||
| 43 | - * | ||
| 44 | - * sectionrouteCode:路段序号;speedLimit:路段限速> | ||
| 45 | - * | ||
| 46 | - * @return map<SUCCESS:成功;ERROR:异常> | ||
| 47 | - */ | ||
| 48 | - @RequestMapping(value="sectionSave" , method = RequestMethod.POST) | ||
| 49 | - public Map<String, Object> sectionSave(LsInoutSectionRoute sectionRoute) { | ||
| 50 | - Map<String, Object> result = new HashMap<>(); | ||
| 51 | - try { | ||
| 52 | - inoutCarparkService.add(sectionRoute); | ||
| 53 | - result.put("status", ResponseCode.SUCCESS); | ||
| 54 | - } catch (Exception e) { | ||
| 55 | - result.put("status", ResponseCode.ERROR); | ||
| 56 | - result.put("msg", e.getMessage()); | ||
| 57 | - logger.error("", e); | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - return result; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - /** | ||
| 64 | - * @Description :TODO(编辑线路走向) | ||
| 65 | - * | ||
| 66 | - * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 67 | - * | ||
| 68 | - * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 69 | - */ | ||
| 70 | - @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | ||
| 71 | - public Map<String, Object> sectionUpdate(LsInoutSectionRoute sectionRoute) { | ||
| 72 | - Map<String, Object> result = new HashMap<>(); | ||
| 73 | - try { | ||
| 74 | - inoutCarparkService.modify(sectionRoute); | ||
| 75 | - result.put("status", ResponseCode.SUCCESS); | ||
| 76 | - } catch (Exception e) { | ||
| 77 | - result.put("status", ResponseCode.ERROR); | ||
| 78 | - result.put("msg", e.getMessage()); | ||
| 79 | - logger.error("", e); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - return result; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * @param id //路段路由id | ||
| 87 | - * @Description: TODO(撤销路段) | ||
| 88 | - */ | ||
| 89 | - @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 90 | - public Map<String, Object> destroy(@RequestParam Map<String, Object> map) { | ||
| 91 | - return inoutCarparkService.destroy(map); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - /** | ||
| 95 | - * 从历史轨迹做进场路径规划 | ||
| 96 | - * @Description: TODO(撤销路段) | ||
| 97 | - */ | ||
| 98 | - @RequestMapping(value = "/pathPlaningByHistory", method = RequestMethod.POST) | ||
| 99 | - public Map<String, Object> pathPlaningByHistory(@RequestParam Map<String, Object> map){ | ||
| 100 | - Map<String, Object> result = new HashMap<>(); | ||
| 101 | - result.put("status", ResponseCode.SUCCESS); | ||
| 102 | - try { | ||
| 103 | - String schId = (String)map.get("schId"), version = (String)map.get("version"); | ||
| 104 | - if (StringUtils.isEmpty(schId) || StringUtils.isEmpty(version)) { | ||
| 105 | - throw new RuntimeException("无效的参数"); | ||
| 106 | - } | ||
| 107 | - inoutCarparkService.pathPlaningByHistory(Long.parseLong(schId), Integer.parseInt(version)); | ||
| 108 | - } catch (Exception e) { | ||
| 109 | - result.put("status", ResponseCode.ERROR); | ||
| 110 | - logger.error("路径规划异常", e); | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - return result; | ||
| 114 | - } | ||
| 115 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.LsInoutSectionRoute; | ||
| 5 | +import com.bsth.service.InoutCarparkService; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.util.StringUtils; | ||
| 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; | ||
| 14 | + | ||
| 15 | +import java.util.HashMap; | ||
| 16 | +import java.util.Map; | ||
| 17 | + | ||
| 18 | +@RestController | ||
| 19 | +@RequestMapping("inout") | ||
| 20 | +public class InoutCarparkController extends BaseController<LsInoutSectionRoute, Long>{ | ||
| 21 | + | ||
| 22 | + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkController.class); | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + InoutCarparkService inoutCarparkService; | ||
| 26 | + | ||
| 27 | + @RequestMapping(value = "/getStartEndByLine", method = RequestMethod.GET) | ||
| 28 | + public Map<String, Object> getStartEndByLine(@RequestParam("lineId")int lineId, @RequestParam("version")int version) { | ||
| 29 | + return inoutCarparkService.getStartEndByLine(lineId, version); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + @RequestMapping(value = "/getRouteByStartEnd", method = RequestMethod.GET) | ||
| 33 | + public Map<String, Object> getRouteByStartEnd(@RequestParam("lineId")int lineId, @RequestParam("version")int version, @RequestParam("start")String start, @RequestParam("end")String end) { | ||
| 34 | + return inoutCarparkService.getRouteByStartEnd(lineId, version, start, end); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 新增路段信息 | ||
| 39 | + * | ||
| 40 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | ||
| 41 | + * | ||
| 42 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | ||
| 43 | + * | ||
| 44 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | ||
| 45 | + * | ||
| 46 | + * @return map<SUCCESS:成功;ERROR:异常> | ||
| 47 | + */ | ||
| 48 | + @RequestMapping(value="sectionSave" , method = RequestMethod.POST) | ||
| 49 | + public Map<String, Object> sectionSave(LsInoutSectionRoute sectionRoute) { | ||
| 50 | + Map<String, Object> result = new HashMap<>(); | ||
| 51 | + try { | ||
| 52 | + inoutCarparkService.add(sectionRoute); | ||
| 53 | + result.put("status", ResponseCode.SUCCESS); | ||
| 54 | + } catch (Exception e) { | ||
| 55 | + result.put("status", ResponseCode.ERROR); | ||
| 56 | + result.put("msg", e.getMessage()); | ||
| 57 | + logger.error("", e); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + return result; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * @Description :TODO(编辑线路走向) | ||
| 65 | + * | ||
| 66 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 67 | + * | ||
| 68 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 69 | + */ | ||
| 70 | + @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | ||
| 71 | + public Map<String, Object> sectionUpdate(LsInoutSectionRoute sectionRoute) { | ||
| 72 | + Map<String, Object> result = new HashMap<>(); | ||
| 73 | + try { | ||
| 74 | + inoutCarparkService.modify(sectionRoute); | ||
| 75 | + result.put("status", ResponseCode.SUCCESS); | ||
| 76 | + } catch (Exception e) { | ||
| 77 | + result.put("status", ResponseCode.ERROR); | ||
| 78 | + result.put("msg", e.getMessage()); | ||
| 79 | + logger.error("", e); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + return result; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * @param id //路段路由id | ||
| 87 | + * @Description: TODO(撤销路段) | ||
| 88 | + */ | ||
| 89 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 90 | + public Map<String, Object> destroy(@RequestParam Map<String, Object> map) { | ||
| 91 | + return inoutCarparkService.destroy(map); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * 从历史轨迹做进场路径规划 | ||
| 96 | + * @Description: TODO(撤销路段) | ||
| 97 | + */ | ||
| 98 | + @RequestMapping(value = "/pathPlaningByHistory", method = RequestMethod.POST) | ||
| 99 | + public Map<String, Object> pathPlaningByHistory(@RequestParam Map<String, Object> map){ | ||
| 100 | + Map<String, Object> result = new HashMap<>(); | ||
| 101 | + result.put("status", ResponseCode.SUCCESS); | ||
| 102 | + try { | ||
| 103 | + String schId = (String)map.get("schId"), version = (String)map.get("version"); | ||
| 104 | + if (StringUtils.isEmpty(schId) || StringUtils.isEmpty(version)) { | ||
| 105 | + throw new RuntimeException("无效的参数"); | ||
| 106 | + } | ||
| 107 | + inoutCarparkService.pathPlaningByHistory(Long.parseLong(schId), Integer.parseInt(version)); | ||
| 108 | + } catch (Exception e) { | ||
| 109 | + result.put("status", ResponseCode.ERROR); | ||
| 110 | + logger.error("路径规划异常", e); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + return result; | ||
| 114 | + } | ||
| 115 | +} |
src/main/java/com/bsth/controller/LineController.java renamed to schedule-core/src/main/java/com/bsth/controller/LineController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.Line; | ||
| 5 | -import com.bsth.entity.LineVersions; | ||
| 6 | -import com.bsth.service.LineService; | ||
| 7 | -import com.bsth.service.LineVersionsService; | ||
| 8 | -import com.bsth.util.GetUIDAndCode; | ||
| 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; | ||
| 14 | - | ||
| 15 | -import java.text.ParseException; | ||
| 16 | -import java.text.SimpleDateFormat; | ||
| 17 | -import java.util.Date; | ||
| 18 | -import java.util.HashMap; | ||
| 19 | -import java.util.Map; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * | ||
| 23 | - * @ClassName: LineController(线路控制器) | ||
| 24 | - * | ||
| 25 | - * @Extends : BaseController | ||
| 26 | - * | ||
| 27 | - * @Description: TODO(线路控制层) | ||
| 28 | - * | ||
| 29 | - * @Author bsth@lq | ||
| 30 | - * | ||
| 31 | - * @Date 2016年4月28日 上午9:21:17 | ||
| 32 | - * | ||
| 33 | - * @Version 公交调度系统BS版 0.1 | ||
| 34 | - * | ||
| 35 | - */ | ||
| 36 | -@RestController | ||
| 37 | -@RequestMapping("line") | ||
| 38 | -public class LineController extends BaseController<Line, Integer> { | ||
| 39 | - | ||
| 40 | - @Autowired | ||
| 41 | - private LineService service; | ||
| 42 | - | ||
| 43 | - @Autowired | ||
| 44 | - private LineVersionsService lineVersionsService; | ||
| 45 | - | ||
| 46 | - /** | ||
| 47 | - * 获取线路编码与ID | ||
| 48 | - * | ||
| 49 | - * @return int <lineCode:线路编码> | ||
| 50 | - */ | ||
| 51 | - @RequestMapping(value = "getLineCode", method = RequestMethod.GET) | ||
| 52 | - public long getLineCode() { | ||
| 53 | - return service.selectMaxIdToLineCode() + 1; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * 验证线路编码是否存在 | ||
| 58 | - * | ||
| 59 | - * @return Map < {valid: true }:是否通过验证> | ||
| 60 | - */ | ||
| 61 | - @RequestMapping(value = "lineCodeVerification", method = RequestMethod.GET) | ||
| 62 | - public String lineCodeVerification(@RequestParam(defaultValue = "lineCode") String lineCode) { | ||
| 63 | - return service.lineCodeVerification(lineCode); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * | ||
| 68 | - * 保存 | ||
| 69 | - * | ||
| 70 | - */ | ||
| 71 | - @RequestMapping(method = RequestMethod.POST) | ||
| 72 | - public Map<String, Object> save(Line t){ | ||
| 73 | - Map<String, Object> map = new HashMap<>(); | ||
| 74 | - if(t.getId()==null) { | ||
| 75 | - | ||
| 76 | - t.setId(Integer.valueOf(t.getLineCode())); | ||
| 77 | - | ||
| 78 | - } | ||
| 79 | - if( (t.getId().toString().length()) > 6 || service.lineCodeVerification(t.getLineCode()).equals("false") ) { | ||
| 80 | - | ||
| 81 | - map.put("status", ResponseCode.ERROR); | ||
| 82 | - return map; | ||
| 83 | - } | ||
| 84 | - if(t.getDestroy() == 0){ | ||
| 85 | - t.setInUse(1); | ||
| 86 | - } else | ||
| 87 | - t.setInUse(0); | ||
| 88 | - // 添加线路版本 | ||
| 89 | - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 90 | - try { | ||
| 91 | - Date endDate = simpleDateFormat.parse("2088-08-08 00:00:00"); | ||
| 92 | - LineVersions lineVersions = new LineVersions(); | ||
| 93 | - lineVersions.setName("原始版本"); | ||
| 94 | - lineVersions.setLine(t); | ||
| 95 | - lineVersions.setLineCode(t.getLineCode()); | ||
| 96 | - lineVersions.setStartDate(new java.sql.Date(new Date().getTime())); | ||
| 97 | - lineVersions.setEndDate(new java.sql.Date(endDate.getTime()));// 2088-8-8 00:00:00 | ||
| 98 | - lineVersions.setVersions(1); | ||
| 99 | - lineVersions.setStatus(1); | ||
| 100 | - // 先添加线路再添加版本 | ||
| 101 | - service.save(t); | ||
| 102 | - return lineVersionsService.save(lineVersions); | ||
| 103 | - } catch (ParseException e) { | ||
| 104 | - // TODO Auto-generated catch block | ||
| 105 | - e.printStackTrace(); | ||
| 106 | - map.put("status", ResponseCode.ERROR); | ||
| 107 | - return map; | ||
| 108 | - } | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * 更改 | ||
| 113 | - */ | ||
| 114 | - @RequestMapping(value="/update", method = RequestMethod.POST) | ||
| 115 | - public Map<String, Object> update(Line l){ | ||
| 116 | - Map<String, Object> map = new HashMap<>(); | ||
| 117 | - if((l.getId().toString().length()) > 6 || service.lineCodeVerification(l.getLineCode()).equals("true") ) { | ||
| 118 | - | ||
| 119 | - map.put("status", ResponseCode.ERROR); | ||
| 120 | - return map; | ||
| 121 | - } | ||
| 122 | - return service.update(l); | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - @RequestMapping(value ="/findById" , method = RequestMethod.GET) | ||
| 126 | - Line findByID(@RequestParam(defaultValue = "id") Integer id){ | ||
| 127 | - return service.findById(id); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - /** | ||
| 131 | - * 删除线路 | ||
| 132 | - * @param id | ||
| 133 | - * @return | ||
| 134 | - */ | ||
| 135 | - @RequestMapping(value ="/remove" , method = RequestMethod.POST) | ||
| 136 | - public Map<String, Object> remove(Integer id){ | ||
| 137 | - return service.remove(id); | ||
| 138 | - } | ||
| 139 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.Line; | ||
| 5 | +import com.bsth.entity.LineVersions; | ||
| 6 | +import com.bsth.service.LineService; | ||
| 7 | +import com.bsth.service.LineVersionsService; | ||
| 8 | +import com.bsth.util.GetUIDAndCode; | ||
| 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; | ||
| 14 | + | ||
| 15 | +import java.text.ParseException; | ||
| 16 | +import java.text.SimpleDateFormat; | ||
| 17 | +import java.util.Date; | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * | ||
| 23 | + * @ClassName: LineController(线路控制器) | ||
| 24 | + * | ||
| 25 | + * @Extends : BaseController | ||
| 26 | + * | ||
| 27 | + * @Description: TODO(线路控制层) | ||
| 28 | + * | ||
| 29 | + * @Author bsth@lq | ||
| 30 | + * | ||
| 31 | + * @Date 2016年4月28日 上午9:21:17 | ||
| 32 | + * | ||
| 33 | + * @Version 公交调度系统BS版 0.1 | ||
| 34 | + * | ||
| 35 | + */ | ||
| 36 | +@RestController | ||
| 37 | +@RequestMapping("line") | ||
| 38 | +public class LineController extends BaseController<Line, Integer> { | ||
| 39 | + | ||
| 40 | + @Autowired | ||
| 41 | + private LineService service; | ||
| 42 | + | ||
| 43 | + @Autowired | ||
| 44 | + private LineVersionsService lineVersionsService; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获取线路编码与ID | ||
| 48 | + * | ||
| 49 | + * @return int <lineCode:线路编码> | ||
| 50 | + */ | ||
| 51 | + @RequestMapping(value = "getLineCode", method = RequestMethod.GET) | ||
| 52 | + public long getLineCode() { | ||
| 53 | + return service.selectMaxIdToLineCode() + 1; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 验证线路编码是否存在 | ||
| 58 | + * | ||
| 59 | + * @return Map < {valid: true }:是否通过验证> | ||
| 60 | + */ | ||
| 61 | + @RequestMapping(value = "lineCodeVerification", method = RequestMethod.GET) | ||
| 62 | + public String lineCodeVerification(@RequestParam(defaultValue = "lineCode") String lineCode) { | ||
| 63 | + return service.lineCodeVerification(lineCode); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * | ||
| 68 | + * 保存 | ||
| 69 | + * | ||
| 70 | + */ | ||
| 71 | + @RequestMapping(method = RequestMethod.POST) | ||
| 72 | + public Map<String, Object> save(Line t){ | ||
| 73 | + Map<String, Object> map = new HashMap<>(); | ||
| 74 | + if(t.getId()==null) { | ||
| 75 | + | ||
| 76 | + t.setId(Integer.valueOf(t.getLineCode())); | ||
| 77 | + | ||
| 78 | + } | ||
| 79 | + if( (t.getId().toString().length()) > 6 || service.lineCodeVerification(t.getLineCode()).equals("false") ) { | ||
| 80 | + | ||
| 81 | + map.put("status", ResponseCode.ERROR); | ||
| 82 | + return map; | ||
| 83 | + } | ||
| 84 | + if(t.getDestroy() == 0){ | ||
| 85 | + t.setInUse(1); | ||
| 86 | + } else | ||
| 87 | + t.setInUse(0); | ||
| 88 | + // 添加线路版本 | ||
| 89 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 90 | + try { | ||
| 91 | + Date endDate = simpleDateFormat.parse("2088-08-08 00:00:00"); | ||
| 92 | + LineVersions lineVersions = new LineVersions(); | ||
| 93 | + lineVersions.setName("原始版本"); | ||
| 94 | + lineVersions.setLine(t); | ||
| 95 | + lineVersions.setLineCode(t.getLineCode()); | ||
| 96 | + lineVersions.setStartDate(new java.sql.Date(new Date().getTime())); | ||
| 97 | + lineVersions.setEndDate(new java.sql.Date(endDate.getTime()));// 2088-8-8 00:00:00 | ||
| 98 | + lineVersions.setVersions(1); | ||
| 99 | + lineVersions.setStatus(1); | ||
| 100 | + // 先添加线路再添加版本 | ||
| 101 | + service.save(t); | ||
| 102 | + return lineVersionsService.save(lineVersions); | ||
| 103 | + } catch (ParseException e) { | ||
| 104 | + // TODO Auto-generated catch block | ||
| 105 | + e.printStackTrace(); | ||
| 106 | + map.put("status", ResponseCode.ERROR); | ||
| 107 | + return map; | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 更改 | ||
| 113 | + */ | ||
| 114 | + @RequestMapping(value="/update", method = RequestMethod.POST) | ||
| 115 | + public Map<String, Object> update(Line l){ | ||
| 116 | + Map<String, Object> map = new HashMap<>(); | ||
| 117 | + if((l.getId().toString().length()) > 6 || service.lineCodeVerification(l.getLineCode()).equals("true") ) { | ||
| 118 | + | ||
| 119 | + map.put("status", ResponseCode.ERROR); | ||
| 120 | + return map; | ||
| 121 | + } | ||
| 122 | + return service.update(l); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + @RequestMapping(value ="/findById" , method = RequestMethod.GET) | ||
| 126 | + Line findByID(@RequestParam(defaultValue = "id") Integer id){ | ||
| 127 | + return service.findById(id); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * 删除线路 | ||
| 132 | + * @param id | ||
| 133 | + * @return | ||
| 134 | + */ | ||
| 135 | + @RequestMapping(value ="/remove" , method = RequestMethod.POST) | ||
| 136 | + public Map<String, Object> remove(Integer id){ | ||
| 137 | + return service.remove(id); | ||
| 138 | + } | ||
| 139 | +} |
src/main/java/com/bsth/controller/LineInformationController.java renamed to schedule-core/src/main/java/com/bsth/controller/LineInformationController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | - | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 8 | -import org.springframework.web.bind.annotation.RestController; | ||
| 9 | - | ||
| 10 | -import com.bsth.entity.LineInformation; | ||
| 11 | -import com.bsth.service.LineInformationService; | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * | ||
| 15 | - * @ClassName: LineInformationController(线路标准信息控制器) | ||
| 16 | - * | ||
| 17 | - * @Extends : BaseController | ||
| 18 | - * | ||
| 19 | - * @Description: TODO(路段控制层) | ||
| 20 | - * | ||
| 21 | - * @Author bsth@lq | ||
| 22 | - * | ||
| 23 | - * @Date 2016年05月03日 上午9:21:17 | ||
| 24 | - * | ||
| 25 | - * @Version 公交调度系统BS版 0.1 | ||
| 26 | - * | ||
| 27 | - */ | ||
| 28 | - | ||
| 29 | -@RestController | ||
| 30 | -@RequestMapping("lineInformation") | ||
| 31 | -public class LineInformationController extends BaseController<LineInformation, Integer> { | ||
| 32 | - | ||
| 33 | - @Autowired | ||
| 34 | - LineInformationService lineInformationService; | ||
| 35 | - | ||
| 36 | - @RequestMapping("/line/multi") | ||
| 37 | - public List<LineInformation> findByLine(@RequestParam String lineCodes){ | ||
| 38 | - return lineInformationService.findByLine(lineCodes); | ||
| 39 | - } | ||
| 40 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 8 | +import org.springframework.web.bind.annotation.RestController; | ||
| 9 | + | ||
| 10 | +import com.bsth.entity.LineInformation; | ||
| 11 | +import com.bsth.service.LineInformationService; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * | ||
| 15 | + * @ClassName: LineInformationController(线路标准信息控制器) | ||
| 16 | + * | ||
| 17 | + * @Extends : BaseController | ||
| 18 | + * | ||
| 19 | + * @Description: TODO(路段控制层) | ||
| 20 | + * | ||
| 21 | + * @Author bsth@lq | ||
| 22 | + * | ||
| 23 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 24 | + * | ||
| 25 | + * @Version 公交调度系统BS版 0.1 | ||
| 26 | + * | ||
| 27 | + */ | ||
| 28 | + | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("lineInformation") | ||
| 31 | +public class LineInformationController extends BaseController<LineInformation, Integer> { | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + LineInformationService lineInformationService; | ||
| 35 | + | ||
| 36 | + @RequestMapping("/line/multi") | ||
| 37 | + public List<LineInformation> findByLine(@RequestParam String lineCodes){ | ||
| 38 | + return lineInformationService.findByLine(lineCodes); | ||
| 39 | + } | ||
| 40 | +} |
src/main/java/com/bsth/controller/LineRegionController.java renamed to schedule-core/src/main/java/com/bsth/controller/LineRegionController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.LineRegion; | ||
| 5 | -import com.bsth.entity.LsStationRoute; | ||
| 6 | -import com.bsth.service.LineRegionService; | ||
| 7 | -import org.slf4j.Logger; | ||
| 8 | -import org.slf4j.LoggerFactory; | ||
| 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; | ||
| 14 | - | ||
| 15 | -import java.util.HashMap; | ||
| 16 | -import java.util.List; | ||
| 17 | -import java.util.Map; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * @Author Hill | ||
| 21 | - */ | ||
| 22 | -@RestController | ||
| 23 | -@RequestMapping("/api/lineregion") | ||
| 24 | -public class LineRegionController extends BaseController<LineRegion, Integer> { | ||
| 25 | - | ||
| 26 | - private Logger log = LoggerFactory.getLogger(LineRegionController.class); | ||
| 27 | - | ||
| 28 | - @Autowired | ||
| 29 | - private LineRegionService lineRegionService; | ||
| 30 | - | ||
| 31 | - @RequestMapping(path = "findStationRoutes") | ||
| 32 | - public List<LsStationRoute> findStationRoutes(@RequestParam(defaultValue = "id") Integer regionId) { | ||
| 33 | - return lineRegionService.findStationRoutes(regionId); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @RequestMapping(path = "add", method = RequestMethod.POST) | ||
| 37 | - public Map<String, Object> add(LineRegion lineRegion) { | ||
| 38 | - Map<String, Object> result = new HashMap<>(); | ||
| 39 | - try { | ||
| 40 | - lineRegionService.add(lineRegion); | ||
| 41 | - result.put("status", ResponseCode.SUCCESS); | ||
| 42 | - } catch (Exception e) { | ||
| 43 | - log.error("添加线路区间异常", e); | ||
| 44 | - result.put("status", ResponseCode.ERROR); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - return result; | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - @RequestMapping(path = "modify", method = RequestMethod.POST) | ||
| 51 | - public Map<String, Object> modify(LineRegion lineRegion) { | ||
| 52 | - Map<String, Object> result = new HashMap<>(); | ||
| 53 | - try { | ||
| 54 | - lineRegionService.save(lineRegion); | ||
| 55 | - result.put("status", ResponseCode.SUCCESS); | ||
| 56 | - } catch (Exception e) { | ||
| 57 | - log.error("变更线路区间异常", e); | ||
| 58 | - result.put("status", ResponseCode.ERROR); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - return result; | ||
| 62 | - } | ||
| 63 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.LineRegion; | ||
| 5 | +import com.bsth.entity.LsStationRoute; | ||
| 6 | +import com.bsth.service.LineRegionService; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 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; | ||
| 14 | + | ||
| 15 | +import java.util.HashMap; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @Author Hill | ||
| 21 | + */ | ||
| 22 | +@RestController | ||
| 23 | +@RequestMapping("/api/lineregion") | ||
| 24 | +public class LineRegionController extends BaseController<LineRegion, Integer> { | ||
| 25 | + | ||
| 26 | + private Logger log = LoggerFactory.getLogger(LineRegionController.class); | ||
| 27 | + | ||
| 28 | + @Autowired | ||
| 29 | + private LineRegionService lineRegionService; | ||
| 30 | + | ||
| 31 | + @RequestMapping(path = "findStationRoutes") | ||
| 32 | + public List<LsStationRoute> findStationRoutes(@RequestParam(defaultValue = "id") Integer regionId) { | ||
| 33 | + return lineRegionService.findStationRoutes(regionId); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @RequestMapping(path = "add", method = RequestMethod.POST) | ||
| 37 | + public Map<String, Object> add(LineRegion lineRegion) { | ||
| 38 | + Map<String, Object> result = new HashMap<>(); | ||
| 39 | + try { | ||
| 40 | + lineRegionService.add(lineRegion); | ||
| 41 | + result.put("status", ResponseCode.SUCCESS); | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + log.error("添加线路区间异常", e); | ||
| 44 | + result.put("status", ResponseCode.ERROR); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + return result; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @RequestMapping(path = "modify", method = RequestMethod.POST) | ||
| 51 | + public Map<String, Object> modify(LineRegion lineRegion) { | ||
| 52 | + Map<String, Object> result = new HashMap<>(); | ||
| 53 | + try { | ||
| 54 | + lineRegionService.save(lineRegion); | ||
| 55 | + result.put("status", ResponseCode.SUCCESS); | ||
| 56 | + } catch (Exception e) { | ||
| 57 | + log.error("变更线路区间异常", e); | ||
| 58 | + result.put("status", ResponseCode.ERROR); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + return result; | ||
| 62 | + } | ||
| 63 | +} |
src/main/java/com/bsth/controller/LineVersionsController.java renamed to schedule-core/src/main/java/com/bsth/controller/LineVersionsController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.LineVersions; | ||
| 4 | -import com.bsth.entity.LsSectionRoute; | ||
| 5 | -import com.bsth.entity.LsStationRoute; | ||
| 6 | -import com.bsth.repository.LineRepository; | ||
| 7 | -import com.bsth.repository.LsSectionRouteRepository; | ||
| 8 | -import com.bsth.repository.LsStationRouteRepository; | ||
| 9 | -import com.bsth.service.LineVersionsService; | ||
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | -import org.springframework.web.bind.annotation.RestController; | ||
| 15 | - | ||
| 16 | -import java.util.List; | ||
| 17 | -import java.util.Map; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * | ||
| 21 | - * @ClassName: LineController(线路版本控制器) | ||
| 22 | - * | ||
| 23 | - * @Extends : BaseController | ||
| 24 | - * | ||
| 25 | - * @Description: TODO(线路版本版控制层) | ||
| 26 | - * | ||
| 27 | - * @Author bsth@lq | ||
| 28 | - * | ||
| 29 | - * @Version 公交调度系统BS版 0.1 | ||
| 30 | - * | ||
| 31 | - */ | ||
| 32 | -@RestController | ||
| 33 | -@RequestMapping("lineVersions") | ||
| 34 | -public class LineVersionsController extends BaseController<LineVersions, Integer> { | ||
| 35 | - | ||
| 36 | - @Autowired | ||
| 37 | - private LineVersionsService service; | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - @Autowired | ||
| 41 | - private LsStationRouteRepository lsStationRouteRepository; | ||
| 42 | - | ||
| 43 | - @Autowired | ||
| 44 | - private LsSectionRouteRepository lsSectionRouteRepository; | ||
| 45 | - | ||
| 46 | - @Autowired | ||
| 47 | - LineRepository lineRepository; | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * 获取线路所有版本 | ||
| 51 | - */ | ||
| 52 | - @RequestMapping(value = "findLineVersionsMax", method = RequestMethod.GET) | ||
| 53 | - public LineVersions findLineVersionsMax(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 54 | - return service.findLineVersionsMax(lineId); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - @RequestMapping(value = "findAllHistroyLineVersionsById", method = RequestMethod.GET) | ||
| 58 | - public List<LineVersions> findAllHistroyLineVersionsById(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 59 | - return service.findAllHistroyLineVersionsById(lineId); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - /** | ||
| 63 | - * 获取线路所有版本 | ||
| 64 | - * | ||
| 65 | - */ | ||
| 66 | - @RequestMapping(value = "findByLineId", method = RequestMethod.GET) | ||
| 67 | - public List<LineVersions> getLineCode(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 68 | - return service.findByLineCode(lineId); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - /** | ||
| 72 | - * 根据id查询线路版本信息 | ||
| 73 | - * | ||
| 74 | - */ | ||
| 75 | - @RequestMapping(value = "findById", method = RequestMethod.GET) | ||
| 76 | - public LineVersions findOne(@RequestParam(defaultValue = "id") int id) { | ||
| 77 | - return service.findById(id); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - /** | ||
| 81 | - * 根据id修改线路版本信息 | ||
| 82 | - * | ||
| 83 | - */ | ||
| 84 | - @RequestMapping(value = "update", method = RequestMethod.POST) | ||
| 85 | - public Map<String, Object> update(@RequestParam Map<String, Object> map) { | ||
| 86 | - return service.update(map); | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - @RequestMapping(value = "add", method = RequestMethod.POST) | ||
| 90 | - public Map<String, Object> add(@RequestParam Map<String, Object> map) { | ||
| 91 | - return service.add(map); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - @RequestMapping(value = "delete", method = RequestMethod.POST) | ||
| 95 | - public Map<String, Object> delete(@RequestParam (defaultValue = "id") int id) { | ||
| 96 | - | ||
| 97 | - return service.deleteAllData(id); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - /** | ||
| 101 | - * 根据线路id获取当前版本号 | ||
| 102 | - * | ||
| 103 | - */ | ||
| 104 | - @RequestMapping(value = "findCurrentVersion", method = RequestMethod.GET) | ||
| 105 | - public Integer findCurrentVersion(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 106 | - return service.findCurrentVersion(lineId); | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - /** | ||
| 110 | - * 根据id发布版本号(修改isupdate字段) | ||
| 111 | - */ | ||
| 112 | - @RequestMapping(value = "issueVersion", method = RequestMethod.POST) | ||
| 113 | - public Map<String, Object> issueVersion(@RequestParam(defaultValue = "id") int id) { | ||
| 114 | - return service.issueVersion(id); | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.entity.LineVersions; | ||
| 4 | +import com.bsth.entity.LsSectionRoute; | ||
| 5 | +import com.bsth.entity.LsStationRoute; | ||
| 6 | +import com.bsth.repository.LineRepository; | ||
| 7 | +import com.bsth.repository.LsSectionRouteRepository; | ||
| 8 | +import com.bsth.repository.LsStationRouteRepository; | ||
| 9 | +import com.bsth.service.LineVersionsService; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | +import org.springframework.web.bind.annotation.RestController; | ||
| 15 | + | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * | ||
| 21 | + * @ClassName: LineController(线路版本控制器) | ||
| 22 | + * | ||
| 23 | + * @Extends : BaseController | ||
| 24 | + * | ||
| 25 | + * @Description: TODO(线路版本版控制层) | ||
| 26 | + * | ||
| 27 | + * @Author bsth@lq | ||
| 28 | + * | ||
| 29 | + * @Version 公交调度系统BS版 0.1 | ||
| 30 | + * | ||
| 31 | + */ | ||
| 32 | +@RestController | ||
| 33 | +@RequestMapping("lineVersions") | ||
| 34 | +public class LineVersionsController extends BaseController<LineVersions, Integer> { | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private LineVersionsService service; | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + @Autowired | ||
| 41 | + private LsStationRouteRepository lsStationRouteRepository; | ||
| 42 | + | ||
| 43 | + @Autowired | ||
| 44 | + private LsSectionRouteRepository lsSectionRouteRepository; | ||
| 45 | + | ||
| 46 | + @Autowired | ||
| 47 | + LineRepository lineRepository; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 获取线路所有版本 | ||
| 51 | + */ | ||
| 52 | + @RequestMapping(value = "findLineVersionsMax", method = RequestMethod.GET) | ||
| 53 | + public LineVersions findLineVersionsMax(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 54 | + return service.findLineVersionsMax(lineId); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @RequestMapping(value = "findAllHistroyLineVersionsById", method = RequestMethod.GET) | ||
| 58 | + public List<LineVersions> findAllHistroyLineVersionsById(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 59 | + return service.findAllHistroyLineVersionsById(lineId); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 获取线路所有版本 | ||
| 64 | + * | ||
| 65 | + */ | ||
| 66 | + @RequestMapping(value = "findByLineId", method = RequestMethod.GET) | ||
| 67 | + public List<LineVersions> getLineCode(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 68 | + return service.findByLineCode(lineId); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * 根据id查询线路版本信息 | ||
| 73 | + * | ||
| 74 | + */ | ||
| 75 | + @RequestMapping(value = "findById", method = RequestMethod.GET) | ||
| 76 | + public LineVersions findOne(@RequestParam(defaultValue = "id") int id) { | ||
| 77 | + return service.findById(id); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 根据id修改线路版本信息 | ||
| 82 | + * | ||
| 83 | + */ | ||
| 84 | + @RequestMapping(value = "update", method = RequestMethod.POST) | ||
| 85 | + public Map<String, Object> update(@RequestParam Map<String, Object> map) { | ||
| 86 | + return service.update(map); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @RequestMapping(value = "add", method = RequestMethod.POST) | ||
| 90 | + public Map<String, Object> add(@RequestParam Map<String, Object> map) { | ||
| 91 | + return service.add(map); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @RequestMapping(value = "delete", method = RequestMethod.POST) | ||
| 95 | + public Map<String, Object> delete(@RequestParam (defaultValue = "id") int id) { | ||
| 96 | + | ||
| 97 | + return service.deleteAllData(id); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * 根据线路id获取当前版本号 | ||
| 102 | + * | ||
| 103 | + */ | ||
| 104 | + @RequestMapping(value = "findCurrentVersion", method = RequestMethod.GET) | ||
| 105 | + public Integer findCurrentVersion(@RequestParam(defaultValue = "lineId") int lineId) { | ||
| 106 | + return service.findCurrentVersion(lineId); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * 根据id发布版本号(修改isupdate字段) | ||
| 111 | + */ | ||
| 112 | + @RequestMapping(value = "issueVersion", method = RequestMethod.POST) | ||
| 113 | + public Map<String, Object> issueVersion(@RequestParam(defaultValue = "id") int id) { | ||
| 114 | + return service.issueVersion(id); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | +} |
src/main/java/com/bsth/controller/LsSectionRouteController.java renamed to schedule-core/src/main/java/com/bsth/controller/LsSectionRouteController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.LsSectionRoute; | ||
| 5 | -import com.bsth.entity.LsStationRoute; | ||
| 6 | -import com.bsth.entity.SectionRoute; | ||
| 7 | -import com.bsth.service.LsSectionRouteService; | ||
| 8 | -import org.slf4j.Logger; | ||
| 9 | -import org.slf4j.LoggerFactory; | ||
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | -import org.springframework.data.domain.Page; | ||
| 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; | ||
| 16 | - | ||
| 17 | -import java.util.Arrays; | ||
| 18 | -import java.util.HashMap; | ||
| 19 | -import java.util.List; | ||
| 20 | -import java.util.Map; | ||
| 21 | - | ||
| 22 | -/** | ||
| 23 | - * | ||
| 24 | - * @ClassName: SectionRouteController(路段路由控制器) | ||
| 25 | - * | ||
| 26 | - * @Extends : BaseController | ||
| 27 | - * | ||
| 28 | - * @Description: TODO(路段路由控制层) | ||
| 29 | - * | ||
| 30 | - * @Author bsth@lq | ||
| 31 | - * | ||
| 32 | - * @Date 2016年05月03日 上午9:21:17 | ||
| 33 | - * | ||
| 34 | - * @Version 公交调度系统BS版 0.1 | ||
| 35 | - * | ||
| 36 | - */ | ||
| 37 | - | ||
| 38 | -@RestController | ||
| 39 | -@RequestMapping("/api/lssectionroute") | ||
| 40 | -public class LsSectionRouteController extends BaseController<LsSectionRoute, Integer> { | ||
| 41 | - | ||
| 42 | - private final static Logger log = LoggerFactory.getLogger(LsSectionRouteController.class); | ||
| 43 | - | ||
| 44 | - @Autowired | ||
| 45 | - private LsSectionRouteService lsSectionRouteService; | ||
| 46 | - | ||
| 47 | - @RequestMapping(value = "/findSectionRoutes" , method = RequestMethod.GET) | ||
| 48 | - public List<LsSectionRoute> findSectionRoutes(@RequestParam Map<String, Object> map) { | ||
| 49 | - map.put("destroy_eq", 0); | ||
| 50 | - if (map.get("line.id_eq") == null || map.get("versions_eq") == null) { | ||
| 51 | - throw new IllegalArgumentException("需正确传入线路、版本参数"); | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - return lsSectionRouteService.findSectionRoutes(map); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - @RequestMapping(value = "/findPageByParams", method = RequestMethod.GET) | ||
| 58 | - public Page<LsSectionRoute> findPageByParams(@RequestParam Map<String, Object> params) { | ||
| 59 | - int page = params.get("page") == null ? 0 : Integer.parseInt(params.get("page").toString()); | ||
| 60 | - int size = params.get("size") == null ? 10 : Integer.parseInt(params.get("size").toString()); | ||
| 61 | - String order = params.get("order").toString(), direction = params.get("direction").toString(); | ||
| 62 | - | ||
| 63 | - return super.list(params, page, size, order, direction); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * @param id | ||
| 68 | - * @throws | ||
| 69 | - * @Description: TODO(批量撤销路段) | ||
| 70 | - */ | ||
| 71 | - @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 72 | - public Map<String, Object> destroy(Integer id) { | ||
| 73 | - Map<String, Object> result = new HashMap<>(); | ||
| 74 | - try { | ||
| 75 | - lsSectionRouteService.batchDestroy(Arrays.asList(id)); | ||
| 76 | - result.put("status", ResponseCode.SUCCESS); | ||
| 77 | - } catch (Exception e) { | ||
| 78 | - result.put("status", ResponseCode.ERROR); | ||
| 79 | - log.error("", e); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - return result; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * @param ids | ||
| 87 | - * @throws | ||
| 88 | - * @Description: TODO(批量撤销路段) | ||
| 89 | - */ | ||
| 90 | - @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST) | ||
| 91 | - public Map<String, Object> batchDestroy(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 92 | - Map<String, Object> result = new HashMap<>(); | ||
| 93 | - try { | ||
| 94 | - lsSectionRouteService.batchDestroy(ids); | ||
| 95 | - result.put("status", ResponseCode.SUCCESS); | ||
| 96 | - } catch (Exception e) { | ||
| 97 | - result.put("status", ResponseCode.ERROR); | ||
| 98 | - log.error("", e); | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - return result; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - /** | ||
| 105 | - * @param ids | ||
| 106 | - * @throws | ||
| 107 | - * @Description: TODO(批量恢复撤销站点) | ||
| 108 | - */ | ||
| 109 | - @RequestMapping(value = "/batchRecover", method = RequestMethod.POST) | ||
| 110 | - public Map<String, Object> batchRecover(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 111 | - Map<String, Object> result = new HashMap<>(); | ||
| 112 | - try { | ||
| 113 | - lsSectionRouteService.batchRecover(ids); | ||
| 114 | - result.put("status", ResponseCode.SUCCESS); | ||
| 115 | - } catch (Exception e) { | ||
| 116 | - result.put("status", ResponseCode.ERROR); | ||
| 117 | - result.put("msg", e.getMessage()); | ||
| 118 | - log.error("", e); | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - return result; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - /** | ||
| 125 | - * @param lineId | ||
| 126 | - * @param version | ||
| 127 | - * @param direction | ||
| 128 | - * @param otherDirection | ||
| 129 | - * @throws | ||
| 130 | - * @Description: 引用另一上下行路段 | ||
| 131 | - */ | ||
| 132 | - @RequestMapping(value = "/quoteOtherSide", method = RequestMethod.POST) | ||
| 133 | - public Map<String, Object> quoteOtherSide(int lineId, int version, int direction, int otherDirection) { | ||
| 134 | - Map<String, Object> result = new HashMap<>(); | ||
| 135 | - try { | ||
| 136 | - lsSectionRouteService.quoteOtherSide(lineId, version, direction, otherDirection); | ||
| 137 | - result.put("status", ResponseCode.SUCCESS); | ||
| 138 | - } catch (Exception e) { | ||
| 139 | - result.put("status", ResponseCode.ERROR); | ||
| 140 | - log.error("", e); | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - return result; | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - @RequestMapping(value = "/add", method = RequestMethod.POST) | ||
| 147 | - public Map<String, Object> add(LsSectionRoute sectionRoute) { | ||
| 148 | - Map<String, Object> result = new HashMap<>(); | ||
| 149 | - try { | ||
| 150 | - lsSectionRouteService.add(sectionRoute); | ||
| 151 | - result.put("status", ResponseCode.SUCCESS); | ||
| 152 | - } catch (Exception e) { | ||
| 153 | - result.put("status", ResponseCode.ERROR); | ||
| 154 | - result.put("msg", e.getMessage()); | ||
| 155 | - log.error("", e); | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - return result; | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - @RequestMapping(value = "/modify", method = RequestMethod.POST) | ||
| 162 | - public Map<String, Object> modify(LsSectionRoute sectionRoute) { | ||
| 163 | - Map<String, Object> result = new HashMap<>(); | ||
| 164 | - try { | ||
| 165 | - lsSectionRouteService.modify(sectionRoute); | ||
| 166 | - result.put("status", ResponseCode.SUCCESS); | ||
| 167 | - } catch (Exception e) { | ||
| 168 | - result.put("status", ResponseCode.ERROR); | ||
| 169 | - result.put("msg", e.getMessage()); | ||
| 170 | - log.error("", e); | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - return result; | ||
| 174 | - } | ||
| 175 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.LsSectionRoute; | ||
| 5 | +import com.bsth.entity.LsStationRoute; | ||
| 6 | +import com.bsth.entity.SectionRoute; | ||
| 7 | +import com.bsth.service.LsSectionRouteService; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.data.domain.Page; | ||
| 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; | ||
| 16 | + | ||
| 17 | +import java.util.Arrays; | ||
| 18 | +import java.util.HashMap; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.Map; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * | ||
| 24 | + * @ClassName: SectionRouteController(路段路由控制器) | ||
| 25 | + * | ||
| 26 | + * @Extends : BaseController | ||
| 27 | + * | ||
| 28 | + * @Description: TODO(路段路由控制层) | ||
| 29 | + * | ||
| 30 | + * @Author bsth@lq | ||
| 31 | + * | ||
| 32 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 33 | + * | ||
| 34 | + * @Version 公交调度系统BS版 0.1 | ||
| 35 | + * | ||
| 36 | + */ | ||
| 37 | + | ||
| 38 | +@RestController | ||
| 39 | +@RequestMapping("/api/lssectionroute") | ||
| 40 | +public class LsSectionRouteController extends BaseController<LsSectionRoute, Integer> { | ||
| 41 | + | ||
| 42 | + private final static Logger log = LoggerFactory.getLogger(LsSectionRouteController.class); | ||
| 43 | + | ||
| 44 | + @Autowired | ||
| 45 | + private LsSectionRouteService lsSectionRouteService; | ||
| 46 | + | ||
| 47 | + @RequestMapping(value = "/findSectionRoutes" , method = RequestMethod.GET) | ||
| 48 | + public List<LsSectionRoute> findSectionRoutes(@RequestParam Map<String, Object> map) { | ||
| 49 | + map.put("destroy_eq", 0); | ||
| 50 | + if (map.get("line.id_eq") == null || map.get("versions_eq") == null) { | ||
| 51 | + throw new IllegalArgumentException("需正确传入线路、版本参数"); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + return lsSectionRouteService.findSectionRoutes(map); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @RequestMapping(value = "/findPageByParams", method = RequestMethod.GET) | ||
| 58 | + public Page<LsSectionRoute> findPageByParams(@RequestParam Map<String, Object> params) { | ||
| 59 | + int page = params.get("page") == null ? 0 : Integer.parseInt(params.get("page").toString()); | ||
| 60 | + int size = params.get("size") == null ? 10 : Integer.parseInt(params.get("size").toString()); | ||
| 61 | + String order = params.get("order").toString(), direction = params.get("direction").toString(); | ||
| 62 | + | ||
| 63 | + return super.list(params, page, size, order, direction); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * @param id | ||
| 68 | + * @throws | ||
| 69 | + * @Description: TODO(批量撤销路段) | ||
| 70 | + */ | ||
| 71 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 72 | + public Map<String, Object> destroy(Integer id) { | ||
| 73 | + Map<String, Object> result = new HashMap<>(); | ||
| 74 | + try { | ||
| 75 | + lsSectionRouteService.batchDestroy(Arrays.asList(id)); | ||
| 76 | + result.put("status", ResponseCode.SUCCESS); | ||
| 77 | + } catch (Exception e) { | ||
| 78 | + result.put("status", ResponseCode.ERROR); | ||
| 79 | + log.error("", e); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + return result; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * @param ids | ||
| 87 | + * @throws | ||
| 88 | + * @Description: TODO(批量撤销路段) | ||
| 89 | + */ | ||
| 90 | + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST) | ||
| 91 | + public Map<String, Object> batchDestroy(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 92 | + Map<String, Object> result = new HashMap<>(); | ||
| 93 | + try { | ||
| 94 | + lsSectionRouteService.batchDestroy(ids); | ||
| 95 | + result.put("status", ResponseCode.SUCCESS); | ||
| 96 | + } catch (Exception e) { | ||
| 97 | + result.put("status", ResponseCode.ERROR); | ||
| 98 | + log.error("", e); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + return result; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * @param ids | ||
| 106 | + * @throws | ||
| 107 | + * @Description: TODO(批量恢复撤销站点) | ||
| 108 | + */ | ||
| 109 | + @RequestMapping(value = "/batchRecover", method = RequestMethod.POST) | ||
| 110 | + public Map<String, Object> batchRecover(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 111 | + Map<String, Object> result = new HashMap<>(); | ||
| 112 | + try { | ||
| 113 | + lsSectionRouteService.batchRecover(ids); | ||
| 114 | + result.put("status", ResponseCode.SUCCESS); | ||
| 115 | + } catch (Exception e) { | ||
| 116 | + result.put("status", ResponseCode.ERROR); | ||
| 117 | + result.put("msg", e.getMessage()); | ||
| 118 | + log.error("", e); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + return result; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * @param lineId | ||
| 126 | + * @param version | ||
| 127 | + * @param direction | ||
| 128 | + * @param otherDirection | ||
| 129 | + * @throws | ||
| 130 | + * @Description: 引用另一上下行路段 | ||
| 131 | + */ | ||
| 132 | + @RequestMapping(value = "/quoteOtherSide", method = RequestMethod.POST) | ||
| 133 | + public Map<String, Object> quoteOtherSide(int lineId, int version, int direction, int otherDirection) { | ||
| 134 | + Map<String, Object> result = new HashMap<>(); | ||
| 135 | + try { | ||
| 136 | + lsSectionRouteService.quoteOtherSide(lineId, version, direction, otherDirection); | ||
| 137 | + result.put("status", ResponseCode.SUCCESS); | ||
| 138 | + } catch (Exception e) { | ||
| 139 | + result.put("status", ResponseCode.ERROR); | ||
| 140 | + log.error("", e); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + return result; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + @RequestMapping(value = "/add", method = RequestMethod.POST) | ||
| 147 | + public Map<String, Object> add(LsSectionRoute sectionRoute) { | ||
| 148 | + Map<String, Object> result = new HashMap<>(); | ||
| 149 | + try { | ||
| 150 | + lsSectionRouteService.add(sectionRoute); | ||
| 151 | + result.put("status", ResponseCode.SUCCESS); | ||
| 152 | + } catch (Exception e) { | ||
| 153 | + result.put("status", ResponseCode.ERROR); | ||
| 154 | + result.put("msg", e.getMessage()); | ||
| 155 | + log.error("", e); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + return result; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + @RequestMapping(value = "/modify", method = RequestMethod.POST) | ||
| 162 | + public Map<String, Object> modify(LsSectionRoute sectionRoute) { | ||
| 163 | + Map<String, Object> result = new HashMap<>(); | ||
| 164 | + try { | ||
| 165 | + lsSectionRouteService.modify(sectionRoute); | ||
| 166 | + result.put("status", ResponseCode.SUCCESS); | ||
| 167 | + } catch (Exception e) { | ||
| 168 | + result.put("status", ResponseCode.ERROR); | ||
| 169 | + result.put("msg", e.getMessage()); | ||
| 170 | + log.error("", e); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + return result; | ||
| 174 | + } | ||
| 175 | +} |
src/main/java/com/bsth/controller/LsStationRouteController.java renamed to schedule-core/src/main/java/com/bsth/controller/LsStationRouteController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.LsSectionRoute; | ||
| 5 | -import com.bsth.entity.LsStationRoute; | ||
| 6 | -import com.bsth.service.LsStationRouteService; | ||
| 7 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 8 | -import org.slf4j.Logger; | ||
| 9 | -import org.slf4j.LoggerFactory; | ||
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | -import org.springframework.data.domain.Page; | ||
| 12 | -import org.springframework.web.bind.annotation.*; | ||
| 13 | - | ||
| 14 | -import java.util.*; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * @author Hill | ||
| 18 | - */ | ||
| 19 | -@RestController | ||
| 20 | -@RequestMapping("/api/lsstationroute") | ||
| 21 | -public class LsStationRouteController extends BaseController<LsStationRoute, Integer> { | ||
| 22 | - | ||
| 23 | - private static final Logger log = LoggerFactory.getLogger(LsStationRouteController.class); | ||
| 24 | - | ||
| 25 | - @Autowired | ||
| 26 | - private LsStationRouteService lsStationRouteService; | ||
| 27 | - | ||
| 28 | - @Autowired | ||
| 29 | - private ObjectMapper mapper; | ||
| 30 | - | ||
| 31 | - @RequestMapping(value = "/findAllByParams", method = RequestMethod.GET) | ||
| 32 | - public Iterable<LsStationRoute> findAllByParams(@RequestParam Map<String, Object> params) { | ||
| 33 | - return lsStationRouteService.findAllByParams(params); | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - @RequestMapping(value = "/findPageByParams", method = RequestMethod.GET) | ||
| 37 | - public Page<LsStationRoute> findPageByParams(@RequestParam Map<String, Object> params) { | ||
| 38 | - int page = params.get("page") == null ? 0 : Integer.parseInt(params.get("page").toString()); | ||
| 39 | - int size = params.get("size") == null ? 10 : Integer.parseInt(params.get("size").toString()); | ||
| 40 | - String order = params.get("order").toString(), direction = params.get("direction").toString(); | ||
| 41 | - | ||
| 42 | - return super.list(params, page, size, order, direction); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - @RequestMapping(value = "/findRoutes" , method = RequestMethod.GET) | ||
| 46 | - public Map<String, Object> findRoutes(@RequestParam Map<String, Object> map) { | ||
| 47 | - map.put("destroy_eq", 0); | ||
| 48 | - if (map.get("line.id_eq") == null || map.get("versions_eq") == null) { | ||
| 49 | - throw new IllegalArgumentException("需正确传入线路、版本参数"); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - return lsStationRouteService.findRoutes(map); | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - @RequestMapping(value = "/findStationRoutes" , method = RequestMethod.GET) | ||
| 56 | - public List<LsStationRoute> findStationRoutes(@RequestParam Map<String, Object> map) { | ||
| 57 | - map.put("destroy_eq", 0); | ||
| 58 | - if (map.get("line.id_eq") == null || map.get("versions_eq") == null) { | ||
| 59 | - throw new IllegalArgumentException("需正确传入线路、版本参数"); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - return lsStationRouteService.findStationRoutes(map); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * @Description :TODO(查询站点的下一个缓存站点) | ||
| 67 | - */ | ||
| 68 | - @RequestMapping(value = "/findCurrentAndNext" , method = RequestMethod.GET) | ||
| 69 | - public List<LsStationRoute> findCurrentAndNext(Integer id) { | ||
| 70 | - return lsStationRouteService.findCurrentAndNext(id); | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - /** | ||
| 74 | - * @param id | ||
| 75 | - * @throws | ||
| 76 | - * @Description: TODO(批量撤销站点) | ||
| 77 | - */ | ||
| 78 | - @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 79 | - public Map<String, Object> destroy(Integer id) { | ||
| 80 | - Map<String, Object> result = new HashMap<>(); | ||
| 81 | - try { | ||
| 82 | - lsStationRouteService.batchDestroy(Arrays.asList(id)); | ||
| 83 | - result.put("status", ResponseCode.SUCCESS); | ||
| 84 | - } catch (Exception e) { | ||
| 85 | - result.put("status", ResponseCode.ERROR); | ||
| 86 | - result.put("msg", e.getMessage()); | ||
| 87 | - log.error("", e); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - return result; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * @param ids | ||
| 95 | - * @throws | ||
| 96 | - * @Description: TODO(批量撤销站点) | ||
| 97 | - */ | ||
| 98 | - @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST) | ||
| 99 | - public Map<String, Object> batchDestroy(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 100 | - Map<String, Object> result = new HashMap<>(); | ||
| 101 | - try { | ||
| 102 | - lsStationRouteService.batchDestroy(ids); | ||
| 103 | - result.put("status", ResponseCode.SUCCESS); | ||
| 104 | - } catch (Exception e) { | ||
| 105 | - result.put("status", ResponseCode.ERROR); | ||
| 106 | - result.put("msg", e.getMessage()); | ||
| 107 | - log.error("", e); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - return result; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - /** | ||
| 114 | - * @param ids | ||
| 115 | - * @throws | ||
| 116 | - * @Description: TODO(批量恢复撤销站点) | ||
| 117 | - */ | ||
| 118 | - @RequestMapping(value = "/batchRecover", method = RequestMethod.POST) | ||
| 119 | - public Map<String, Object> batchRecover(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 120 | - Map<String, Object> result = new HashMap<>(); | ||
| 121 | - try { | ||
| 122 | - lsStationRouteService.batchRecover(ids); | ||
| 123 | - result.put("status", ResponseCode.SUCCESS); | ||
| 124 | - } catch (Exception e) { | ||
| 125 | - result.put("status", ResponseCode.ERROR); | ||
| 126 | - result.put("msg", e.getMessage()); | ||
| 127 | - log.error("", e); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - return result; | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - /** | ||
| 134 | - * 保存线路某个版本下单行的站点和路段路由 | ||
| 135 | - * 常规使用在根据百度地图生成数据或者模板导入的批量保存 | ||
| 136 | - * @param map | ||
| 137 | - * @return | ||
| 138 | - */ | ||
| 139 | - @RequestMapping(value="addRoutes" , method = RequestMethod.POST) | ||
| 140 | - public Map<String, Object> addRoutes(@RequestBody Map<String, Object> map) { | ||
| 141 | - Map<String, Object> result = new HashMap<>(); | ||
| 142 | - try { | ||
| 143 | - if (map.get("lineId") == null || map.get("versions") == null || map.get("directions") == null) { | ||
| 144 | - throw new IllegalArgumentException("需正确传入线路、方向、版本参数"); | ||
| 145 | - } | ||
| 146 | - Integer versions = Integer.parseInt(map.get("versions").toString()), directions = Integer.parseInt(map.get("directions").toString()), lineId = Integer.parseInt(map.get("lineId").toString()); | ||
| 147 | - List<LsStationRoute> stationRoutes = mapper.convertValue(map.get("stationRoutes"), mapper.constructType(mapper.getTypeFactory().constructParametricType(List.class, LsStationRoute.class))); | ||
| 148 | - List<LsSectionRoute> sectionRoutes = mapper.convertValue(map.get("sectionRoutes"), mapper.constructType(mapper.getTypeFactory().constructParametricType(List.class, LsSectionRoute.class))); | ||
| 149 | - | ||
| 150 | - result.putAll(lsStationRouteService.addRoutes(lineId, versions, directions, stationRoutes, sectionRoutes)); | ||
| 151 | - result.put("status", ResponseCode.SUCCESS); | ||
| 152 | - } catch (Exception e) { | ||
| 153 | - result.put("status", ResponseCode.ERROR); | ||
| 154 | - log.error("", e); | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - return result; | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - @RequestMapping(value = "/add", method = RequestMethod.POST) | ||
| 161 | - public Map<String, Object> add(LsStationRoute stationRoute) { | ||
| 162 | - Map<String, Object> result = new HashMap<>(); | ||
| 163 | - try { | ||
| 164 | - lsStationRouteService.add(stationRoute); | ||
| 165 | - result.put("status", ResponseCode.SUCCESS); | ||
| 166 | - } catch (Exception e) { | ||
| 167 | - result.put("status", ResponseCode.ERROR); | ||
| 168 | - result.put("msg", e.getMessage()); | ||
| 169 | - log.error("", e); | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - return result; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - @RequestMapping(value = "/modify", method = RequestMethod.POST) | ||
| 176 | - public Map<String, Object> modify(LsStationRoute stationRoute) { | ||
| 177 | - Map<String, Object> result = new HashMap<>(); | ||
| 178 | - try { | ||
| 179 | - lsStationRouteService.modify(stationRoute); | ||
| 180 | - result.put("status", ResponseCode.SUCCESS); | ||
| 181 | - } catch (Exception e) { | ||
| 182 | - result.put("status", ResponseCode.ERROR); | ||
| 183 | - result.put("msg", e.getMessage()); | ||
| 184 | - log.error("", e); | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - return result; | ||
| 188 | - } | ||
| 189 | - | ||
| 190 | - @RequestMapping(value = "/exchangeDirection", method = RequestMethod.POST) | ||
| 191 | - public Map<String, Object> exchangeDirection(int lineId, int version) { | ||
| 192 | - Map<String, Object> result = new HashMap<>(); | ||
| 193 | - try { | ||
| 194 | - lsStationRouteService.exchangeDirection(lineId, version); | ||
| 195 | - result.put("status", ResponseCode.SUCCESS); | ||
| 196 | - } catch (Exception e) { | ||
| 197 | - result.put("status", ResponseCode.ERROR); | ||
| 198 | - result.put("msg", e.getMessage()); | ||
| 199 | - log.error("", e); | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - return result; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - @RequestMapping(value = "/modifyDistance", method = RequestMethod.POST) | ||
| 206 | - public Map<String, Object> modifyDistance(@RequestParam Map<String, Object> params) { | ||
| 207 | - Map<String, Object> result = new HashMap<>(); | ||
| 208 | - try { | ||
| 209 | - List<Integer> ids = new ArrayList<>(); | ||
| 210 | - List<Double> distances = new ArrayList<>(); | ||
| 211 | - for (Map.Entry<String, Object> entry : params.entrySet()) { | ||
| 212 | - String key = entry.getKey(), value = String.valueOf(entry.getValue()); | ||
| 213 | - ids.add(Integer.parseInt(key.split("_")[1])); | ||
| 214 | - distances.add(Double.parseDouble(value) / 1000); | ||
| 215 | - } | ||
| 216 | - if (ids.size() == 0) { | ||
| 217 | - throw new IllegalArgumentException("不合法的参数"); | ||
| 218 | - } | ||
| 219 | - lsStationRouteService.modifyDistance(ids, distances); | ||
| 220 | - result.put("status", ResponseCode.SUCCESS); | ||
| 221 | - } catch (Exception e) { | ||
| 222 | - result.put("status", ResponseCode.ERROR); | ||
| 223 | - result.put("msg", e.getMessage()); | ||
| 224 | - log.error("", e); | ||
| 225 | - } | ||
| 226 | - | ||
| 227 | - return result; | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - @RequestMapping(value = "/circularRouteHandle", method = RequestMethod.POST) | ||
| 231 | - public Map<String, Object> circularRouteHandle(Integer lineId, Integer version) { | ||
| 232 | - Map<String, Object> result = new HashMap<>(); | ||
| 233 | - try { | ||
| 234 | - lsStationRouteService.circularRouteHandle(lineId, version); | ||
| 235 | - result.put("status", ResponseCode.SUCCESS); | ||
| 236 | - } catch (Exception e) { | ||
| 237 | - result.put("status", ResponseCode.ERROR); | ||
| 238 | - result.put("msg", e.getMessage()); | ||
| 239 | - log.error("", e); | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - return result; | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - @RequestMapping(value = "/analyzeRoutes") | ||
| 246 | - public Map<String, Object> analyzeRoutes(Integer lineId, Integer version, Integer direction) { | ||
| 247 | - Map<String, Object> result = new HashMap<>(); | ||
| 248 | - try { | ||
| 249 | - result.putAll(lsStationRouteService.analyzeRoutes(lineId, version, direction)); | ||
| 250 | - result.put("status", ResponseCode.SUCCESS); | ||
| 251 | - } catch (Exception e) { | ||
| 252 | - result.put("status", ResponseCode.ERROR); | ||
| 253 | - result.put("msg", e.getMessage()); | ||
| 254 | - log.error("", e); | ||
| 255 | - } | ||
| 256 | - | ||
| 257 | - return result; | ||
| 258 | - } | ||
| 259 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.LsSectionRoute; | ||
| 5 | +import com.bsth.entity.LsStationRoute; | ||
| 6 | +import com.bsth.service.LsStationRouteService; | ||
| 7 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.data.domain.Page; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | + | ||
| 14 | +import java.util.*; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @author Hill | ||
| 18 | + */ | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("/api/lsstationroute") | ||
| 21 | +public class LsStationRouteController extends BaseController<LsStationRoute, Integer> { | ||
| 22 | + | ||
| 23 | + private static final Logger log = LoggerFactory.getLogger(LsStationRouteController.class); | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + private LsStationRouteService lsStationRouteService; | ||
| 27 | + | ||
| 28 | + @Autowired | ||
| 29 | + private ObjectMapper mapper; | ||
| 30 | + | ||
| 31 | + @RequestMapping(value = "/findAllByParams", method = RequestMethod.GET) | ||
| 32 | + public Iterable<LsStationRoute> findAllByParams(@RequestParam Map<String, Object> params) { | ||
| 33 | + return lsStationRouteService.findAllByParams(params); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @RequestMapping(value = "/findPageByParams", method = RequestMethod.GET) | ||
| 37 | + public Page<LsStationRoute> findPageByParams(@RequestParam Map<String, Object> params) { | ||
| 38 | + int page = params.get("page") == null ? 0 : Integer.parseInt(params.get("page").toString()); | ||
| 39 | + int size = params.get("size") == null ? 10 : Integer.parseInt(params.get("size").toString()); | ||
| 40 | + String order = params.get("order").toString(), direction = params.get("direction").toString(); | ||
| 41 | + | ||
| 42 | + return super.list(params, page, size, order, direction); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @RequestMapping(value = "/findRoutes" , method = RequestMethod.GET) | ||
| 46 | + public Map<String, Object> findRoutes(@RequestParam Map<String, Object> map) { | ||
| 47 | + map.put("destroy_eq", 0); | ||
| 48 | + if (map.get("line.id_eq") == null || map.get("versions_eq") == null) { | ||
| 49 | + throw new IllegalArgumentException("需正确传入线路、版本参数"); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + return lsStationRouteService.findRoutes(map); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @RequestMapping(value = "/findStationRoutes" , method = RequestMethod.GET) | ||
| 56 | + public List<LsStationRoute> findStationRoutes(@RequestParam Map<String, Object> map) { | ||
| 57 | + map.put("destroy_eq", 0); | ||
| 58 | + if (map.get("line.id_eq") == null || map.get("versions_eq") == null) { | ||
| 59 | + throw new IllegalArgumentException("需正确传入线路、版本参数"); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + return lsStationRouteService.findStationRoutes(map); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * @Description :TODO(查询站点的下一个缓存站点) | ||
| 67 | + */ | ||
| 68 | + @RequestMapping(value = "/findCurrentAndNext" , method = RequestMethod.GET) | ||
| 69 | + public List<LsStationRoute> findCurrentAndNext(Integer id) { | ||
| 70 | + return lsStationRouteService.findCurrentAndNext(id); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * @param id | ||
| 75 | + * @throws | ||
| 76 | + * @Description: TODO(批量撤销站点) | ||
| 77 | + */ | ||
| 78 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 79 | + public Map<String, Object> destroy(Integer id) { | ||
| 80 | + Map<String, Object> result = new HashMap<>(); | ||
| 81 | + try { | ||
| 82 | + lsStationRouteService.batchDestroy(Arrays.asList(id)); | ||
| 83 | + result.put("status", ResponseCode.SUCCESS); | ||
| 84 | + } catch (Exception e) { | ||
| 85 | + result.put("status", ResponseCode.ERROR); | ||
| 86 | + result.put("msg", e.getMessage()); | ||
| 87 | + log.error("", e); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + return result; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * @param ids | ||
| 95 | + * @throws | ||
| 96 | + * @Description: TODO(批量撤销站点) | ||
| 97 | + */ | ||
| 98 | + @RequestMapping(value = "/batchDestroy", method = RequestMethod.POST) | ||
| 99 | + public Map<String, Object> batchDestroy(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 100 | + Map<String, Object> result = new HashMap<>(); | ||
| 101 | + try { | ||
| 102 | + lsStationRouteService.batchDestroy(ids); | ||
| 103 | + result.put("status", ResponseCode.SUCCESS); | ||
| 104 | + } catch (Exception e) { | ||
| 105 | + result.put("status", ResponseCode.ERROR); | ||
| 106 | + result.put("msg", e.getMessage()); | ||
| 107 | + log.error("", e); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + return result; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @param ids | ||
| 115 | + * @throws | ||
| 116 | + * @Description: TODO(批量恢复撤销站点) | ||
| 117 | + */ | ||
| 118 | + @RequestMapping(value = "/batchRecover", method = RequestMethod.POST) | ||
| 119 | + public Map<String, Object> batchRecover(@RequestParam(value = "ids[]") List<Integer> ids) { | ||
| 120 | + Map<String, Object> result = new HashMap<>(); | ||
| 121 | + try { | ||
| 122 | + lsStationRouteService.batchRecover(ids); | ||
| 123 | + result.put("status", ResponseCode.SUCCESS); | ||
| 124 | + } catch (Exception e) { | ||
| 125 | + result.put("status", ResponseCode.ERROR); | ||
| 126 | + result.put("msg", e.getMessage()); | ||
| 127 | + log.error("", e); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + return result; | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + /** | ||
| 134 | + * 保存线路某个版本下单行的站点和路段路由 | ||
| 135 | + * 常规使用在根据百度地图生成数据或者模板导入的批量保存 | ||
| 136 | + * @param map | ||
| 137 | + * @return | ||
| 138 | + */ | ||
| 139 | + @RequestMapping(value="addRoutes" , method = RequestMethod.POST) | ||
| 140 | + public Map<String, Object> addRoutes(@RequestBody Map<String, Object> map) { | ||
| 141 | + Map<String, Object> result = new HashMap<>(); | ||
| 142 | + try { | ||
| 143 | + if (map.get("lineId") == null || map.get("versions") == null || map.get("directions") == null) { | ||
| 144 | + throw new IllegalArgumentException("需正确传入线路、方向、版本参数"); | ||
| 145 | + } | ||
| 146 | + Integer versions = Integer.parseInt(map.get("versions").toString()), directions = Integer.parseInt(map.get("directions").toString()), lineId = Integer.parseInt(map.get("lineId").toString()); | ||
| 147 | + List<LsStationRoute> stationRoutes = mapper.convertValue(map.get("stationRoutes"), mapper.constructType(mapper.getTypeFactory().constructParametricType(List.class, LsStationRoute.class))); | ||
| 148 | + List<LsSectionRoute> sectionRoutes = mapper.convertValue(map.get("sectionRoutes"), mapper.constructType(mapper.getTypeFactory().constructParametricType(List.class, LsSectionRoute.class))); | ||
| 149 | + | ||
| 150 | + result.putAll(lsStationRouteService.addRoutes(lineId, versions, directions, stationRoutes, sectionRoutes)); | ||
| 151 | + result.put("status", ResponseCode.SUCCESS); | ||
| 152 | + } catch (Exception e) { | ||
| 153 | + result.put("status", ResponseCode.ERROR); | ||
| 154 | + log.error("", e); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + return result; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + @RequestMapping(value = "/add", method = RequestMethod.POST) | ||
| 161 | + public Map<String, Object> add(LsStationRoute stationRoute) { | ||
| 162 | + Map<String, Object> result = new HashMap<>(); | ||
| 163 | + try { | ||
| 164 | + lsStationRouteService.add(stationRoute); | ||
| 165 | + result.put("status", ResponseCode.SUCCESS); | ||
| 166 | + } catch (Exception e) { | ||
| 167 | + result.put("status", ResponseCode.ERROR); | ||
| 168 | + result.put("msg", e.getMessage()); | ||
| 169 | + log.error("", e); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + return result; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + @RequestMapping(value = "/modify", method = RequestMethod.POST) | ||
| 176 | + public Map<String, Object> modify(LsStationRoute stationRoute) { | ||
| 177 | + Map<String, Object> result = new HashMap<>(); | ||
| 178 | + try { | ||
| 179 | + lsStationRouteService.modify(stationRoute); | ||
| 180 | + result.put("status", ResponseCode.SUCCESS); | ||
| 181 | + } catch (Exception e) { | ||
| 182 | + result.put("status", ResponseCode.ERROR); | ||
| 183 | + result.put("msg", e.getMessage()); | ||
| 184 | + log.error("", e); | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + return result; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + @RequestMapping(value = "/exchangeDirection", method = RequestMethod.POST) | ||
| 191 | + public Map<String, Object> exchangeDirection(int lineId, int version) { | ||
| 192 | + Map<String, Object> result = new HashMap<>(); | ||
| 193 | + try { | ||
| 194 | + lsStationRouteService.exchangeDirection(lineId, version); | ||
| 195 | + result.put("status", ResponseCode.SUCCESS); | ||
| 196 | + } catch (Exception e) { | ||
| 197 | + result.put("status", ResponseCode.ERROR); | ||
| 198 | + result.put("msg", e.getMessage()); | ||
| 199 | + log.error("", e); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + return result; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + @RequestMapping(value = "/modifyDistance", method = RequestMethod.POST) | ||
| 206 | + public Map<String, Object> modifyDistance(@RequestParam Map<String, Object> params) { | ||
| 207 | + Map<String, Object> result = new HashMap<>(); | ||
| 208 | + try { | ||
| 209 | + List<Integer> ids = new ArrayList<>(); | ||
| 210 | + List<Double> distances = new ArrayList<>(); | ||
| 211 | + for (Map.Entry<String, Object> entry : params.entrySet()) { | ||
| 212 | + String key = entry.getKey(), value = String.valueOf(entry.getValue()); | ||
| 213 | + ids.add(Integer.parseInt(key.split("_")[1])); | ||
| 214 | + distances.add(Double.parseDouble(value) / 1000); | ||
| 215 | + } | ||
| 216 | + if (ids.size() == 0) { | ||
| 217 | + throw new IllegalArgumentException("不合法的参数"); | ||
| 218 | + } | ||
| 219 | + lsStationRouteService.modifyDistance(ids, distances); | ||
| 220 | + result.put("status", ResponseCode.SUCCESS); | ||
| 221 | + } catch (Exception e) { | ||
| 222 | + result.put("status", ResponseCode.ERROR); | ||
| 223 | + result.put("msg", e.getMessage()); | ||
| 224 | + log.error("", e); | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + return result; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + @RequestMapping(value = "/circularRouteHandle", method = RequestMethod.POST) | ||
| 231 | + public Map<String, Object> circularRouteHandle(Integer lineId, Integer version) { | ||
| 232 | + Map<String, Object> result = new HashMap<>(); | ||
| 233 | + try { | ||
| 234 | + lsStationRouteService.circularRouteHandle(lineId, version); | ||
| 235 | + result.put("status", ResponseCode.SUCCESS); | ||
| 236 | + } catch (Exception e) { | ||
| 237 | + result.put("status", ResponseCode.ERROR); | ||
| 238 | + result.put("msg", e.getMessage()); | ||
| 239 | + log.error("", e); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + return result; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + @RequestMapping(value = "/analyzeRoutes") | ||
| 246 | + public Map<String, Object> analyzeRoutes(Integer lineId, Integer version, Integer direction) { | ||
| 247 | + Map<String, Object> result = new HashMap<>(); | ||
| 248 | + try { | ||
| 249 | + result.putAll(lsStationRouteService.analyzeRoutes(lineId, version, direction)); | ||
| 250 | + result.put("status", ResponseCode.SUCCESS); | ||
| 251 | + } catch (Exception e) { | ||
| 252 | + result.put("status", ResponseCode.ERROR); | ||
| 253 | + result.put("msg", e.getMessage()); | ||
| 254 | + log.error("", e); | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + return result; | ||
| 258 | + } | ||
| 259 | +} |
src/main/java/com/bsth/controller/PersonnelController.java renamed to schedule-core/src/main/java/com/bsth/controller/PersonnelController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.Constants; | ||
| 4 | -import com.bsth.data.pinyin.PersionPinYin; | ||
| 5 | -import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 6 | -import com.bsth.entity.Personnel; | ||
| 7 | -import com.bsth.entity.sys.CompanyAuthority; | ||
| 8 | -import com.bsth.service.PersonnelService; | ||
| 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; | ||
| 14 | - | ||
| 15 | -import javax.servlet.http.HttpServletRequest; | ||
| 16 | -import java.util.List; | ||
| 17 | -import java.util.Map; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * Created by xu on 16/6/15. | ||
| 21 | - */ | ||
| 22 | -@RestController | ||
| 23 | -@RequestMapping("personnel") | ||
| 24 | -public class PersonnelController extends BaseController<Personnel, Integer> { | ||
| 25 | - | ||
| 26 | - @Autowired | ||
| 27 | - private PersonnelService service; | ||
| 28 | - | ||
| 29 | - @Autowired | ||
| 30 | - PersionPinYinBuffer persionPinYinBuffer; | ||
| 31 | - | ||
| 32 | - @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) | ||
| 33 | - public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { | ||
| 34 | - return service.sreachPersonnel(jobCode); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - @RequestMapping(value = "/all_py", method = RequestMethod.GET) | ||
| 38 | - public List<PersionPinYin> findAll_PY(){ | ||
| 39 | - return persionPinYinBuffer.getAll(); | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - @RequestMapping(value = "/list_py", method = RequestMethod.GET) | ||
| 43 | - public List<PersionPinYin> findByCurrUser_PY(HttpServletRequest request){ | ||
| 44 | - List<CompanyAuthority> auths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 45 | - return persionPinYinBuffer.getAll(auths); | ||
| 46 | - } | ||
| 47 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.Constants; | ||
| 4 | +import com.bsth.data.pinyin.PersionPinYin; | ||
| 5 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | ||
| 6 | +import com.bsth.entity.Personnel; | ||
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 8 | +import com.bsth.service.PersonnelService; | ||
| 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; | ||
| 14 | + | ||
| 15 | +import javax.servlet.http.HttpServletRequest; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Created by xu on 16/6/15. | ||
| 21 | + */ | ||
| 22 | +@RestController | ||
| 23 | +@RequestMapping("personnel") | ||
| 24 | +public class PersonnelController extends BaseController<Personnel, Integer> { | ||
| 25 | + | ||
| 26 | + @Autowired | ||
| 27 | + private PersonnelService service; | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + PersionPinYinBuffer persionPinYinBuffer; | ||
| 31 | + | ||
| 32 | + @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) | ||
| 33 | + public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { | ||
| 34 | + return service.sreachPersonnel(jobCode); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @RequestMapping(value = "/all_py", method = RequestMethod.GET) | ||
| 38 | + public List<PersionPinYin> findAll_PY(){ | ||
| 39 | + return persionPinYinBuffer.getAll(); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/list_py", method = RequestMethod.GET) | ||
| 43 | + public List<PersionPinYin> findByCurrUser_PY(HttpServletRequest request){ | ||
| 44 | + List<CompanyAuthority> auths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 45 | + return persionPinYinBuffer.getAll(auths); | ||
| 46 | + } | ||
| 47 | +} |
src/main/java/com/bsth/controller/RefuelController.java renamed to schedule-core/src/main/java/com/bsth/controller/RefuelController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Refuel; | ||
| 4 | -import com.bsth.service.RefuelService; | ||
| 5 | -import com.google.common.io.Files; | ||
| 6 | - | ||
| 7 | -import java.io.File; | ||
| 8 | -import java.util.List; | ||
| 9 | -import java.util.Map; | ||
| 10 | - | ||
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 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; | ||
| 16 | -import org.springframework.web.multipart.MultipartFile; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * Created in 19/9/3. | ||
| 20 | - */ | ||
| 21 | -@RestController | ||
| 22 | -@RequestMapping("refuel") | ||
| 23 | -public class RefuelController extends BaseController<Refuel, Long> { | ||
| 24 | - | ||
| 25 | - @Autowired | ||
| 26 | - private RefuelService refuelService; | ||
| 27 | - | ||
| 28 | - @RequestMapping(value = "/query", method = RequestMethod.GET) | ||
| 29 | - public List<Refuel> query(@RequestParam Map<String, Object> map){ | ||
| 30 | - return refuelService.query(map); | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - @RequestMapping(value = "/queryDaily", method = RequestMethod.GET) | ||
| 34 | - public List<Map<String, Object>> queryDaily(@RequestParam Map<String, Object> map){ | ||
| 35 | - return refuelService.queryDaily(map); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) | ||
| 39 | - public String uploadFile(MultipartFile file) throws Exception{ | ||
| 40 | - File newFile = new File( | ||
| 41 | - getDataImportClasspath() + File.separator + | ||
| 42 | - file.getOriginalFilename()); | ||
| 43 | - Files.write(file.getBytes(), newFile); | ||
| 44 | - String result = refuelService.importExcel(newFile); | ||
| 45 | - return "{\"result\":" + "\""+result+"\"}"; | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - private String getDataImportClasspath(){ | ||
| 49 | - return this.getClass().getResource("/").getPath() + "/static/pages/forms"; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.entity.Refuel; | ||
| 4 | +import com.bsth.service.RefuelService; | ||
| 5 | +import com.google.common.io.Files; | ||
| 6 | + | ||
| 7 | +import java.io.File; | ||
| 8 | +import java.util.List; | ||
| 9 | +import java.util.Map; | ||
| 10 | + | ||
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 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; | ||
| 16 | +import org.springframework.web.multipart.MultipartFile; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Created in 19/9/3. | ||
| 20 | + */ | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("refuel") | ||
| 23 | +public class RefuelController extends BaseController<Refuel, Long> { | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + private RefuelService refuelService; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/query", method = RequestMethod.GET) | ||
| 29 | + public List<Refuel> query(@RequestParam Map<String, Object> map){ | ||
| 30 | + return refuelService.query(map); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "/queryDaily", method = RequestMethod.GET) | ||
| 34 | + public List<Map<String, Object>> queryDaily(@RequestParam Map<String, Object> map){ | ||
| 35 | + return refuelService.queryDaily(map); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) | ||
| 39 | + public String uploadFile(MultipartFile file) throws Exception{ | ||
| 40 | + File newFile = new File( | ||
| 41 | + getDataImportClasspath() + File.separator + | ||
| 42 | + file.getOriginalFilename()); | ||
| 43 | + Files.write(file.getBytes(), newFile); | ||
| 44 | + String result = refuelService.importExcel(newFile); | ||
| 45 | + return "{\"result\":" + "\""+result+"\"}"; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + private String getDataImportClasspath(){ | ||
| 49 | + return this.getClass().getResource("/").getPath() + "/static/pages/forms"; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | +} |
src/main/java/com/bsth/controller/SectionController.java renamed to schedule-core/src/main/java/com/bsth/controller/SectionController.java
| 1 | -package com.bsth.controller; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.Section; | ||
| 5 | -import com.bsth.entity.Station; | ||
| 6 | -import com.bsth.repository.SectionRepository; | ||
| 7 | -import com.bsth.service.SectionService; | ||
| 8 | -import org.slf4j.Logger; | ||
| 9 | -import org.slf4j.LoggerFactory; | ||
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | -import org.springframework.web.bind.annotation.RestController; | ||
| 15 | - | ||
| 16 | -import javax.servlet.http.HttpServletRequest; | ||
| 17 | -import java.util.HashMap; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * | ||
| 23 | - * @ClassName: SectionController(路段控制器) | ||
| 24 | - * | ||
| 25 | - * @Extends : BaseController | ||
| 26 | - * | ||
| 27 | - * @Description: TODO(路段控制层) | ||
| 28 | - * | ||
| 29 | - * @Author bsth@lq | ||
| 30 | - * | ||
| 31 | - * @Date 2016年05月03日 上午9:21:17 | ||
| 32 | - * | ||
| 33 | - * @Version 公交调度系统BS版 0.1 | ||
| 34 | - * | ||
| 35 | - */ | ||
| 36 | - | ||
| 37 | -@RestController | ||
| 38 | -@RequestMapping("section") | ||
| 39 | -public class SectionController extends BaseController<Section, Integer> { | ||
| 40 | - | ||
| 41 | - private final static Logger log = LoggerFactory.getLogger(SectionController.class); | ||
| 42 | - | ||
| 43 | - @Autowired | ||
| 44 | - SectionService sectionService; | ||
| 45 | - | ||
| 46 | - @Autowired | ||
| 47 | - SectionRepository sectionRepository; | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * @Description :TODO(查询路段编码) | ||
| 51 | - * | ||
| 52 | - * @return int <sectionCode路段编码> | ||
| 53 | - */ | ||
| 54 | - @RequestMapping(value="getSectionCode", method = RequestMethod.GET) | ||
| 55 | - public long getSectionCode() { | ||
| 56 | - return sectionRepository.findLatestSectionId() + 1; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - /** | ||
| 60 | - * @Description :TODO(把路段截取位双路名路段) | ||
| 61 | - * | ||
| 62 | - * @return int <sectionCode路段编码> | ||
| 63 | - */ | ||
| 64 | - @RequestMapping(value="doubleName", method = RequestMethod.POST) | ||
| 65 | - public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { | ||
| 66 | - return sectionService.doubleName(map); | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - @RequestMapping(value="add", method = RequestMethod.POST) | ||
| 70 | - public Map<String, Object> add(Section section) { | ||
| 71 | - Map<String, Object> result = new HashMap<>(); | ||
| 72 | - try { | ||
| 73 | - sectionService.add(section); | ||
| 74 | - result.put("status", ResponseCode.SUCCESS); | ||
| 75 | - } catch (Exception e) { | ||
| 76 | - result.put("status", ResponseCode.ERROR); | ||
| 77 | - log.error("", e); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - return result; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - @RequestMapping(value="modify", method = RequestMethod.POST) | ||
| 84 | - public Map<String, Object> modify(Section section) { | ||
| 85 | - Map<String, Object> result = new HashMap<>(); | ||
| 86 | - try { | ||
| 87 | - sectionService.modify(section); | ||
| 88 | - result.put("status", ResponseCode.SUCCESS); | ||
| 89 | - } catch (Exception e) { | ||
| 90 | - result.put("status", ResponseCode.ERROR); | ||
| 91 | - log.error("", e); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - return result; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - @RequestMapping(value="findDistinctSectionName", method = RequestMethod.GET) | ||
| 98 | - public Map<String, Object> findDistinctSectionName() { | ||
| 99 | - Map<String, Object> result = new HashMap<>(); | ||
| 100 | - try { | ||
| 101 | - result.put("data", sectionService.findDistinctSectionName()); | ||
| 102 | - result.put("status", ResponseCode.SUCCESS); | ||
| 103 | - } catch (Exception e) { | ||
| 104 | - result.put("status", ResponseCode.ERROR); | ||
| 105 | - log.error("", e); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - return result; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * 根据路段名搜索路段信息 | ||
| 113 | - * @param sectionName | ||
| 114 | - * @return 站点列表 | ||
| 115 | - */ | ||
| 116 | - @RequestMapping(value="findSectionByName" , method = RequestMethod.GET) | ||
| 117 | - public Map<String, Object> findSectionByName(String sectionName) { | ||
| 118 | - Map<String, Object> result = new HashMap<>(); | ||
| 119 | - try { | ||
| 120 | - result.put("data", sectionService.findSectionByName(sectionName)); | ||
| 121 | - result.put("status", ResponseCode.SUCCESS); | ||
| 122 | - } catch (Exception e) { | ||
| 123 | - result.put("status", ResponseCode.ERROR); | ||
| 124 | - log.error("", e); | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - return result; | ||
| 128 | - } | ||
| 129 | -} | 1 | +package com.bsth.controller; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.Section; | ||
| 5 | +import com.bsth.entity.Station; | ||
| 6 | +import com.bsth.repository.SectionRepository; | ||
| 7 | +import com.bsth.service.SectionService; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 14 | +import org.springframework.web.bind.annotation.RestController; | ||
| 15 | + | ||
| 16 | +import javax.servlet.http.HttpServletRequest; | ||
| 17 | +import java.util.HashMap; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * | ||
| 23 | + * @ClassName: SectionController(路段控制器) | ||
| 24 | + * | ||
| 25 | + * @Extends : BaseController | ||
| 26 | + * | ||
| 27 | + * @Description: TODO(路段控制层) | ||
| 28 | + * | ||
| 29 | + * @Author bsth@lq | ||
| 30 | + * | ||
| 31 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 32 | + * | ||
| 33 | + * @Version 公交调度系统BS版 0.1 | ||
| 34 | + * | ||
| 35 | + */ | ||
| 36 | + | ||
| 37 | +@RestController | ||
| 38 | +@RequestMapping("section") | ||
| 39 | +public class SectionController extends BaseController<Section, Integer> { | ||
| 40 | + | ||
| 41 | + private final static Logger log = LoggerFactory.getLogger(SectionController.class); | ||
| 42 | + | ||
| 43 | + @Autowired | ||
| 44 | + SectionService sectionService; | ||
| 45 | + | ||
| 46 | + @Autowired | ||
| 47 | + SectionRepository sectionRepository; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * @Description :TODO(查询路段编码) | ||
| 51 | + * | ||
| 52 | + * @return int <sectionCode路段编码> | ||
| 53 | + */ | ||
| 54 | + @RequestMapping(value="getSectionCode", method = RequestMethod.GET) | ||
| 55 | + public long getSectionCode() { | ||
| 56 | + return sectionRepository.findLatestSectionId() + 1; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @Description :TODO(把路段截取位双路名路段) | ||
| 61 | + * | ||
| 62 | + * @return int <sectionCode路段编码> | ||
| 63 | + */ | ||
| 64 | + @RequestMapping(value="doubleName", method = RequestMethod.POST) | ||
| 65 | + public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { | ||
| 66 | + return sectionService.doubleName(map); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @RequestMapping(value="add", method = RequestMethod.POST) | ||
| 70 | + public Map<String, Object> add(Section section) { | ||
| 71 | + Map<String, Object> result = new HashMap<>(); | ||
| 72 | + try { | ||
| 73 | + sectionService.add(section); | ||
| 74 | + result.put("status", ResponseCode.SUCCESS); | ||
| 75 | + } catch (Exception e) { | ||
| 76 | + result.put("status", ResponseCode.ERROR); | ||
| 77 | + log.error("", e); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + return result; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @RequestMapping(value="modify", method = RequestMethod.POST) | ||
| 84 | + public Map<String, Object> modify(Section section) { | ||
| 85 | + Map<String, Object> result = new HashMap<>(); | ||
| 86 | + try { | ||
| 87 | + sectionService.modify(section); | ||
| 88 | + result.put("status", ResponseCode.SUCCESS); | ||
| 89 | + } catch (Exception e) { | ||
| 90 | + result.put("status", ResponseCode.ERROR); | ||
| 91 | + log.error("", e); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + return result; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @RequestMapping(value="findDistinctSectionName", method = RequestMethod.GET) | ||
| 98 | + public Map<String, Object> findDistinctSectionName() { | ||
| 99 | + Map<String, Object> result = new HashMap<>(); | ||
| 100 | + try { | ||
| 101 | + result.put("data", sectionService.findDistinctSectionName()); | ||
| 102 | + result.put("status", ResponseCode.SUCCESS); | ||
| 103 | + } catch (Exception e) { | ||
| 104 | + result.put("status", ResponseCode.ERROR); | ||
| 105 | + log.error("", e); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + return result; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 根据路段名搜索路段信息 | ||
| 113 | + * @param sectionName | ||
| 114 | + * @return 站点列表 | ||
| 115 | + */ | ||
| 116 | + @RequestMapping(value="findSectionByName" , method = RequestMethod.GET) | ||
| 117 | + public Map<String, Object> findSectionByName(String sectionName) { | ||
| 118 | + Map<String, Object> result = new HashMap<>(); | ||
| 119 | + try { | ||
| 120 | + result.put("data", sectionService.findSectionByName(sectionName)); | ||
| 121 | + result.put("status", ResponseCode.SUCCESS); | ||
| 122 | + } catch (Exception e) { | ||
| 123 | + result.put("status", ResponseCode.ERROR); | ||
| 124 | + log.error("", e); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + return result; | ||
| 128 | + } | ||
| 129 | +} |
src/main/java/com/bsth/controller/SectionRouteController.java renamed to schedule-core/src/main/java/com/bsth/controller/SectionRouteController.java
| 1 | -package com.bsth.controller; | ||
| 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.entity.SectionRoute; | ||
| 13 | -import com.bsth.service.SectionRouteService; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * | ||
| 17 | - * @ClassName: SectionRouteController(路段路由控制器) | ||
| 18 | - * | ||
| 19 | - * @Extends : BaseController | ||
| 20 | - * | ||
| 21 | - * @Description: TODO(路段路由控制层) | ||
| 22 | - * | ||
| 23 | - * @Author bsth@lq | ||
| 24 | - * | ||
| 25 | - * @Date 2016年05月03日 上午9:21:17 | ||
| 26 | - * | ||
| 27 | - * @Version 公交调度系统BS版 0.1 | ||
| 28 | - * | ||
| 29 | - */ | ||
| 30 | - | ||
| 31 | -@RestController | ||
| 32 | -@RequestMapping("sectionroute") | ||
| 33 | -public class SectionRouteController extends BaseController<SectionRoute, Integer> { | ||
| 34 | - | ||
| 35 | - @Autowired | ||
| 36 | - SectionRouteService routeService; | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * @param @param map | ||
| 40 | - * @throws | ||
| 41 | - * @Title: list | ||
| 42 | - * @Description: TODO(多条件查询) | ||
| 43 | - */ | ||
| 44 | - @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 45 | - public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) { | ||
| 46 | - return routeService.list(map); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * @Description :TODO(查询路段信息) | ||
| 51 | - * | ||
| 52 | - * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 53 | - * | ||
| 54 | - * @return Map<String, Object> | ||
| 55 | - */ | ||
| 56 | - @RequestMapping(value = "/findSection" , method = RequestMethod.GET) | ||
| 57 | - public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { | ||
| 58 | - return routeService.getSectionRoute(map); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * @Description :TODO(查询线路某方向下的上一个路段序号) | ||
| 63 | - * | ||
| 64 | - * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码> | ||
| 65 | - * | ||
| 66 | - * @return List<Map<String, Object>> | ||
| 67 | - */ | ||
| 68 | - @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET) | ||
| 69 | - public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | ||
| 70 | - return routeService.findUpSectionRouteCode(map); | ||
| 71 | - } | ||
| 72 | -} | 1 | +package com.bsth.controller; |
| 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.entity.SectionRoute; | ||
| 13 | +import com.bsth.service.SectionRouteService; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + * @ClassName: SectionRouteController(路段路由控制器) | ||
| 18 | + * | ||
| 19 | + * @Extends : BaseController | ||
| 20 | + * | ||
| 21 | + * @Description: TODO(路段路由控制层) | ||
| 22 | + * | ||
| 23 | + * @Author bsth@lq | ||
| 24 | + * | ||
| 25 | + * @Date 2016年05月03日 上午9:21:17 | ||
| 26 | + * | ||
| 27 | + * @Version 公交调度系统BS版 0.1 | ||
| 28 | + * | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("sectionroute") | ||
| 33 | +public class SectionRouteController extends BaseController<SectionRoute, Integer> { | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + SectionRouteService routeService; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @param @param map | ||
| 40 | + * @throws | ||
| 41 | + * @Title: list | ||
| 42 | + * @Description: TODO(多条件查询) | ||
| 43 | + */ | ||
| 44 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 45 | + public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) { | ||
| 46 | + return routeService.list(map); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * @Description :TODO(查询路段信息) | ||
| 51 | + * | ||
| 52 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 53 | + * | ||
| 54 | + * @return Map<String, Object> | ||
| 55 | + */ | ||
| 56 | + @RequestMapping(value = "/findSection" , method = RequestMethod.GET) | ||
| 57 | + public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) { | ||
| 58 | + return routeService.getSectionRoute(map); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * @Description :TODO(查询线路某方向下的上一个路段序号) | ||
| 63 | + * | ||
| 64 | + * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码> | ||
| 65 | + * | ||
| 66 | + * @return List<Map<String, Object>> | ||
| 67 | + */ | ||
| 68 | + @RequestMapping(value = "/findUpSectionRouteCode" , method = RequestMethod.GET) | ||
| 69 | + public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { | ||
| 70 | + return routeService.findUpSectionRouteCode(map); | ||
| 71 | + } | ||
| 72 | +} |