Commit 3e684046ad174819383a45cb90aa81c07cdaf6e7
Merge branch 'pudong_jdk8' of
http://61.169.120.202:8888/panzhaov5/bsth_control into pudong_jdk8 # Conflicts: # src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
Showing
20 changed files
with
2419 additions
and
2419 deletions
Too many changes to show.
To preserve performance only 20 of 508 files are displayed.
doc/pom错误解决.txt
| 1 | -1、jsonpath手动导入 | ||
| 2 | -pom定义如下: | ||
| 3 | -<!-- https://mvnrepository.com/artifact/pentaho/simple-jndi --> | ||
| 4 | -<dependency> | ||
| 5 | - <groupId>pentaho</groupId> | ||
| 6 | - <artifactId>simple-jndi</artifactId> | ||
| 7 | - <version>1.0.0</version> | ||
| 8 | -</dependency> | ||
| 9 | -pom中repositoy添加如下: | ||
| 10 | -<repository> | ||
| 11 | - <id>pentaho-public</id> | ||
| 12 | - <url>https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn/</url> | ||
| 13 | -</repository> | ||
| 14 | -如果无法获取,可能由于被墙了,则手动导入,控制台输入命令如下: | ||
| 15 | -mvn install:install-file -DgroupId=pentaho -DartifactId=simple-jndi -Dversion=1.0.0 -Dpackaging=jar -Dfile=./jar/simple-jndi-1.0.0.jar | 1 | +1、jsonpath手动导入 |
| 2 | +pom定义如下: | ||
| 3 | +<!-- https://mvnrepository.com/artifact/pentaho/simple-jndi --> | ||
| 4 | +<dependency> | ||
| 5 | + <groupId>pentaho</groupId> | ||
| 6 | + <artifactId>simple-jndi</artifactId> | ||
| 7 | + <version>1.0.0</version> | ||
| 8 | +</dependency> | ||
| 9 | +pom中repositoy添加如下: | ||
| 10 | +<repository> | ||
| 11 | + <id>pentaho-public</id> | ||
| 12 | + <url>https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn/</url> | ||
| 13 | +</repository> | ||
| 14 | +如果无法获取,可能由于被墙了,则手动导入,控制台输入命令如下: | ||
| 15 | +mvn install:install-file -DgroupId=pentaho -DartifactId=simple-jndi -Dversion=1.0.0 -Dpackaging=jar -Dfile=./jar/simple-jndi-1.0.0.jar |
pom.xml
| 1 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 2 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 3 | - | ||
| 4 | - <modelVersion>4.0.0</modelVersion> | ||
| 5 | - <groupId>com.bsth</groupId> | ||
| 6 | - <artifactId>bsth_control</artifactId> | ||
| 7 | - <version>0.0.1-SNAPSHOT</version> | ||
| 8 | - <packaging>war</packaging> | ||
| 9 | - | ||
| 10 | - <parent> | ||
| 11 | - <groupId>org.springframework.boot</groupId> | ||
| 12 | - <artifactId>spring-boot-starter-parent</artifactId> | ||
| 13 | - <version>2.1.6.RELEASE</version> | ||
| 14 | - </parent> | ||
| 15 | - | ||
| 16 | - <dependencies> | ||
| 17 | - <dependency> | ||
| 18 | - <groupId>org.springframework.boot</groupId> | ||
| 19 | - <artifactId>spring-boot-starter-web</artifactId> | ||
| 20 | - </dependency> | ||
| 21 | - | ||
| 22 | - <dependency> | ||
| 23 | - <groupId>org.springframework.boot</groupId> | ||
| 24 | - <artifactId>spring-boot-starter-tomcat</artifactId> | ||
| 25 | - <scope>provided</scope> | ||
| 26 | - </dependency> | ||
| 27 | - <dependency> | ||
| 28 | - <groupId>javax.servlet</groupId> | ||
| 29 | - <artifactId>javax.servlet-api</artifactId> | ||
| 30 | - <version>3.1.0</version> | ||
| 31 | - <scope>provided</scope> | ||
| 32 | - </dependency> | ||
| 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 | - </dependencies> | ||
| 416 | - | ||
| 417 | - <dependencyManagement> | ||
| 418 | - <dependencies> | ||
| 419 | - <!-- drools 6依赖 --> | ||
| 420 | - <dependency> | ||
| 421 | - <groupId>org.drools</groupId> | ||
| 422 | - <artifactId>drools-bom</artifactId> | ||
| 423 | - <type>pom</type> | ||
| 424 | - <version>6.3.0.Final</version> | ||
| 425 | - <scope>import</scope> | ||
| 426 | - </dependency> | ||
| 427 | - </dependencies> | ||
| 428 | - </dependencyManagement> | ||
| 429 | - | ||
| 430 | - <build> | ||
| 431 | - <plugins> | ||
| 432 | - <plugin> | ||
| 433 | - <artifactId>maven-compiler-plugin</artifactId> | ||
| 434 | - <configuration> | ||
| 435 | - <source>1.8</source> | ||
| 436 | - <target>1.8</target> | ||
| 437 | - </configuration> | ||
| 438 | - </plugin> | ||
| 439 | - <plugin> | ||
| 440 | - <artifactId>maven-war-plugin</artifactId> | ||
| 441 | - <configuration> | ||
| 442 | - <failOnMissingWebXml>false</failOnMissingWebXml> | ||
| 443 | - </configuration> | ||
| 444 | - </plugin> | ||
| 445 | - <plugin> | ||
| 446 | - <groupId>org.springframework.boot</groupId> | ||
| 447 | - <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 448 | - </plugin> | ||
| 449 | - </plugins> | ||
| 450 | - <resources> | ||
| 451 | - <resource> | ||
| 452 | - <directory>src/main/resources</directory> | ||
| 453 | - <filtering>false</filtering> | ||
| 454 | - </resource> | ||
| 455 | - </resources> | ||
| 456 | - </build> | ||
| 457 | - <repositories> | ||
| 458 | - <repository> | ||
| 459 | - <id>spring-snapshots</id> | ||
| 460 | - <url>http://repo.spring.io/snapshot</url> | ||
| 461 | - <snapshots> | ||
| 462 | - <enabled>true</enabled> | ||
| 463 | - </snapshots> | ||
| 464 | - </repository> | ||
| 465 | - <repository> | ||
| 466 | - <id>spring-milestones</id> | ||
| 467 | - <url>http://repo.spring.io/milestone</url> | ||
| 468 | - </repository> | ||
| 469 | - <repository> | ||
| 470 | - <id>pentaho-public</id> | ||
| 471 | - <url>https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn/</url> | ||
| 472 | - </repository> | ||
| 473 | - </repositories> | ||
| 474 | - <pluginRepositories> | ||
| 475 | - <pluginRepository> | ||
| 476 | - <id>spring-snapshots</id> | ||
| 477 | - <url>http://repo.spring.io/snapshot</url> | ||
| 478 | - </pluginRepository> | ||
| 479 | - <pluginRepository> | ||
| 480 | - <id>spring-milestones</id> | ||
| 481 | - <url>http://repo.spring.io/milestone</url> | ||
| 482 | - </pluginRepository> | ||
| 483 | - </pluginRepositories> | ||
| 484 | - | ||
| 485 | - <properties> | ||
| 486 | - <start-class>com.bsth.Application</start-class> | ||
| 487 | - </properties> | ||
| 488 | -</project> | 1 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 3 | + | ||
| 4 | + <modelVersion>4.0.0</modelVersion> | ||
| 5 | + <groupId>com.bsth</groupId> | ||
| 6 | + <artifactId>bsth_control</artifactId> | ||
| 7 | + <version>0.0.1-SNAPSHOT</version> | ||
| 8 | + <packaging>war</packaging> | ||
| 9 | + | ||
| 10 | + <parent> | ||
| 11 | + <groupId>org.springframework.boot</groupId> | ||
| 12 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 13 | + <version>2.1.6.RELEASE</version> | ||
| 14 | + </parent> | ||
| 15 | + | ||
| 16 | + <dependencies> | ||
| 17 | + <dependency> | ||
| 18 | + <groupId>org.springframework.boot</groupId> | ||
| 19 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 20 | + </dependency> | ||
| 21 | + | ||
| 22 | + <dependency> | ||
| 23 | + <groupId>org.springframework.boot</groupId> | ||
| 24 | + <artifactId>spring-boot-starter-tomcat</artifactId> | ||
| 25 | + <scope>provided</scope> | ||
| 26 | + </dependency> | ||
| 27 | + <dependency> | ||
| 28 | + <groupId>javax.servlet</groupId> | ||
| 29 | + <artifactId>javax.servlet-api</artifactId> | ||
| 30 | + <version>3.1.0</version> | ||
| 31 | + <scope>provided</scope> | ||
| 32 | + </dependency> | ||
| 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 | + </dependencies> | ||
| 416 | + | ||
| 417 | + <dependencyManagement> | ||
| 418 | + <dependencies> | ||
| 419 | + <!-- drools 6依赖 --> | ||
| 420 | + <dependency> | ||
| 421 | + <groupId>org.drools</groupId> | ||
| 422 | + <artifactId>drools-bom</artifactId> | ||
| 423 | + <type>pom</type> | ||
| 424 | + <version>6.3.0.Final</version> | ||
| 425 | + <scope>import</scope> | ||
| 426 | + </dependency> | ||
| 427 | + </dependencies> | ||
| 428 | + </dependencyManagement> | ||
| 429 | + | ||
| 430 | + <build> | ||
| 431 | + <plugins> | ||
| 432 | + <plugin> | ||
| 433 | + <artifactId>maven-compiler-plugin</artifactId> | ||
| 434 | + <configuration> | ||
| 435 | + <source>1.8</source> | ||
| 436 | + <target>1.8</target> | ||
| 437 | + </configuration> | ||
| 438 | + </plugin> | ||
| 439 | + <plugin> | ||
| 440 | + <artifactId>maven-war-plugin</artifactId> | ||
| 441 | + <configuration> | ||
| 442 | + <failOnMissingWebXml>false</failOnMissingWebXml> | ||
| 443 | + </configuration> | ||
| 444 | + </plugin> | ||
| 445 | + <plugin> | ||
| 446 | + <groupId>org.springframework.boot</groupId> | ||
| 447 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 448 | + </plugin> | ||
| 449 | + </plugins> | ||
| 450 | + <resources> | ||
| 451 | + <resource> | ||
| 452 | + <directory>src/main/resources</directory> | ||
| 453 | + <filtering>false</filtering> | ||
| 454 | + </resource> | ||
| 455 | + </resources> | ||
| 456 | + </build> | ||
| 457 | + <repositories> | ||
| 458 | + <repository> | ||
| 459 | + <id>spring-snapshots</id> | ||
| 460 | + <url>http://repo.spring.io/snapshot</url> | ||
| 461 | + <snapshots> | ||
| 462 | + <enabled>true</enabled> | ||
| 463 | + </snapshots> | ||
| 464 | + </repository> | ||
| 465 | + <repository> | ||
| 466 | + <id>spring-milestones</id> | ||
| 467 | + <url>http://repo.spring.io/milestone</url> | ||
| 468 | + </repository> | ||
| 469 | + <repository> | ||
| 470 | + <id>pentaho-public</id> | ||
| 471 | + <url>https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn/</url> | ||
| 472 | + </repository> | ||
| 473 | + </repositories> | ||
| 474 | + <pluginRepositories> | ||
| 475 | + <pluginRepository> | ||
| 476 | + <id>spring-snapshots</id> | ||
| 477 | + <url>http://repo.spring.io/snapshot</url> | ||
| 478 | + </pluginRepository> | ||
| 479 | + <pluginRepository> | ||
| 480 | + <id>spring-milestones</id> | ||
| 481 | + <url>http://repo.spring.io/milestone</url> | ||
| 482 | + </pluginRepository> | ||
| 483 | + </pluginRepositories> | ||
| 484 | + | ||
| 485 | + <properties> | ||
| 486 | + <start-class>com.bsth.Application</start-class> | ||
| 487 | + </properties> | ||
| 488 | +</project> |
src/main/java/com/bsth/Application.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.SystemParamCache; | ||
| 4 | -import com.fasterxml.jackson.annotation.JsonInclude; | ||
| 5 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 6 | -import com.fasterxml.jackson.databind.SerializationFeature; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.boot.SpringApplication; | ||
| 9 | -import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 10 | -import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 11 | -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||
| 12 | -import org.springframework.context.annotation.Bean; | ||
| 13 | -import org.springframework.context.annotation.EnableAspectJAutoProxy; | ||
| 14 | -import org.springframework.context.annotation.Primary; | ||
| 15 | -import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
| 16 | - | ||
| 17 | -import java.util.concurrent.Executors; | ||
| 18 | -import java.util.concurrent.ScheduledExecutorService; | ||
| 19 | - | ||
| 20 | -@EnableAspectJAutoProxy | ||
| 21 | -@EnableTransactionManagement | ||
| 22 | -@SpringBootApplication | ||
| 23 | -public class Application extends SpringBootServletInitializer { | ||
| 24 | - | ||
| 25 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(21); | ||
| 26 | - | ||
| 27 | - @Autowired | ||
| 28 | - private SystemParamCache systemParamCache; | ||
| 29 | - | ||
| 30 | - @Override | ||
| 31 | - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||
| 32 | - return application.sources(Application.class); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - @Bean | ||
| 36 | - @Primary | ||
| 37 | - public ObjectMapper objectMapper() { | ||
| 38 | - ObjectMapper mapper = new ObjectMapper(); | ||
| 39 | - mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); | ||
| 40 | - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
| 41 | - | ||
| 42 | - return mapper; | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - public static void main(String[] args) throws Exception { | ||
| 46 | - SpringApplication.run(Application.class, args); | ||
| 47 | - } | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | +import com.bsth.data.SystemParamCache; | ||
| 4 | +import com.fasterxml.jackson.annotation.JsonInclude; | ||
| 5 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 6 | +import com.fasterxml.jackson.databind.SerializationFeature; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.boot.SpringApplication; | ||
| 9 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 10 | +import org.springframework.boot.builder.SpringApplicationBuilder; | ||
| 11 | +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; | ||
| 12 | +import org.springframework.context.annotation.Bean; | ||
| 13 | +import org.springframework.context.annotation.EnableAspectJAutoProxy; | ||
| 14 | +import org.springframework.context.annotation.Primary; | ||
| 15 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
| 16 | + | ||
| 17 | +import java.util.concurrent.Executors; | ||
| 18 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 19 | + | ||
| 20 | +@EnableAspectJAutoProxy | ||
| 21 | +@EnableTransactionManagement | ||
| 22 | +@SpringBootApplication | ||
| 23 | +public class Application extends SpringBootServletInitializer { | ||
| 24 | + | ||
| 25 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(21); | ||
| 26 | + | ||
| 27 | + @Autowired | ||
| 28 | + private SystemParamCache systemParamCache; | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ||
| 32 | + return application.sources(Application.class); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Bean | ||
| 36 | + @Primary | ||
| 37 | + public ObjectMapper objectMapper() { | ||
| 38 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 39 | + mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); | ||
| 40 | + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); | ||
| 41 | + | ||
| 42 | + return mapper; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public static void main(String[] args) throws Exception { | ||
| 46 | + SpringApplication.run(Application.class, args); | ||
| 47 | + } | ||
| 48 | } | 48 | } |
| 49 | \ No newline at end of file | 49 | \ No newline at end of file |
src/main/java/com/bsth/StartCommand.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import com.bsth.security.SecurityMetadataSourceService; | ||
| 5 | - | ||
| 6 | -import org.slf4j.Logger; | ||
| 7 | -import org.slf4j.LoggerFactory; | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.boot.CommandLineRunner; | ||
| 10 | -import org.springframework.stereotype.Component; | ||
| 11 | - | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * 随应用启动运行 | ||
| 15 | - * @author PanZhao | ||
| 16 | - * | ||
| 17 | - */ | ||
| 18 | -@Component | ||
| 19 | -public class StartCommand implements CommandLineRunner{ | ||
| 20 | - | ||
| 21 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 22 | - | ||
| 23 | - @Autowired | ||
| 24 | - SecurityMetadataSourceService invocationSecurityMetadataSourceService; | ||
| 25 | - | ||
| 26 | - @Override | ||
| 27 | - public void run(String... arg0){ | ||
| 28 | - | ||
| 29 | - try { | ||
| 30 | - //启动时加载所有资源 | ||
| 31 | - invocationSecurityMetadataSourceService.loadResourceDefine(); | ||
| 32 | - } catch (Exception e) { | ||
| 33 | - e.printStackTrace(); | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | -} | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.security.SecurityMetadataSourceService; | ||
| 5 | + | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.boot.CommandLineRunner; | ||
| 10 | +import org.springframework.stereotype.Component; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 随应用启动运行 | ||
| 15 | + * @author PanZhao | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +@Component | ||
| 19 | +public class StartCommand implements CommandLineRunner{ | ||
| 20 | + | ||
| 21 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + SecurityMetadataSourceService invocationSecurityMetadataSourceService; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public void run(String... arg0){ | ||
| 28 | + | ||
| 29 | + try { | ||
| 30 | + //启动时加载所有资源 | ||
| 31 | + invocationSecurityMetadataSourceService.loadResourceDefine(); | ||
| 32 | + } catch (Exception e) { | ||
| 33 | + e.printStackTrace(); | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | +} |
src/main/java/com/bsth/WebAppConfiguration.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | -import com.bsth.filter.ResourceFilter; | ||
| 4 | -import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 5 | -import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 6 | -import org.slf4j.Logger; | ||
| 7 | -import org.slf4j.LoggerFactory; | ||
| 8 | -import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
| 9 | -import org.springframework.context.annotation.Bean; | ||
| 10 | -import org.springframework.context.annotation.ComponentScan; | ||
| 11 | -import org.springframework.context.annotation.Configuration; | ||
| 12 | -import org.springframework.web.filter.CharacterEncodingFilter; | ||
| 13 | -import org.springframework.web.filter.FormContentFilter; | ||
| 14 | -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
| 15 | -import org.springframework.web.socket.config.annotation.EnableWebSocket; | ||
| 16 | -import org.springframework.web.socket.config.annotation.WebSocketConfigurer; | ||
| 17 | -import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; | ||
| 18 | - | ||
| 19 | -import javax.servlet.Filter; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * @author Hill | ||
| 23 | - */ | ||
| 24 | -@Configuration | ||
| 25 | -@EnableWebSocket | ||
| 26 | -@ComponentScan | ||
| 27 | -public class WebAppConfiguration implements WebSocketConfigurer, WebMvcConfigurer { | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * @Title: httpPutFormContentFilter | ||
| 31 | - * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换) | ||
| 32 | - */ | ||
| 33 | - @Bean | ||
| 34 | - public Filter httpPutFormContentFilter() { | ||
| 35 | - return new FormContentFilter(); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * @Title: characterEncodingFilter | ||
| 40 | - * @Description: TODO(编码过滤器) | ||
| 41 | - */ | ||
| 42 | - /*@Bean | ||
| 43 | - public Filter characterEncodingFilter(){ | ||
| 44 | - return new CharacterEncodingFilter("UTF-8"); | ||
| 45 | - }*/ | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * | ||
| 49 | - * @Title: resourceFilterRegistration | ||
| 50 | - * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 ) | ||
| 51 | - */ | ||
| 52 | - @Bean | ||
| 53 | - public FilterRegistrationBean resourceFilterRegistration(){ | ||
| 54 | - FilterRegistrationBean registration = new FilterRegistrationBean(); | ||
| 55 | - registration.setFilter(new ResourceFilter()); | ||
| 56 | - registration.addUrlPatterns("/pages/*"); | ||
| 57 | - return registration; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - @Override | ||
| 61 | - public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { | ||
| 62 | - //线调webSocket | ||
| 63 | - registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) | ||
| 64 | - .withSockJS(); | ||
| 65 | - } | ||
| 66 | -} | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | +import com.bsth.filter.ResourceFilter; | ||
| 4 | +import com.bsth.websocket.WebSocketHandshakeInterceptor; | ||
| 5 | +import com.bsth.websocket.handler.RealControlSocketHandler; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | +import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
| 9 | +import org.springframework.context.annotation.Bean; | ||
| 10 | +import org.springframework.context.annotation.ComponentScan; | ||
| 11 | +import org.springframework.context.annotation.Configuration; | ||
| 12 | +import org.springframework.web.filter.CharacterEncodingFilter; | ||
| 13 | +import org.springframework.web.filter.FormContentFilter; | ||
| 14 | +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
| 15 | +import org.springframework.web.socket.config.annotation.EnableWebSocket; | ||
| 16 | +import org.springframework.web.socket.config.annotation.WebSocketConfigurer; | ||
| 17 | +import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; | ||
| 18 | + | ||
| 19 | +import javax.servlet.Filter; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @author Hill | ||
| 23 | + */ | ||
| 24 | +@Configuration | ||
| 25 | +@EnableWebSocket | ||
| 26 | +@ComponentScan | ||
| 27 | +public class WebAppConfiguration implements WebSocketConfigurer, WebMvcConfigurer { | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @Title: httpPutFormContentFilter | ||
| 31 | + * @Description: TODO(弥补浏览器不支持PUT/DELETE,对携带 _method 参数的请求进行转换) | ||
| 32 | + */ | ||
| 33 | + @Bean | ||
| 34 | + public Filter httpPutFormContentFilter() { | ||
| 35 | + return new FormContentFilter(); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @Title: characterEncodingFilter | ||
| 40 | + * @Description: TODO(编码过滤器) | ||
| 41 | + */ | ||
| 42 | + /*@Bean | ||
| 43 | + public Filter characterEncodingFilter(){ | ||
| 44 | + return new CharacterEncodingFilter("UTF-8"); | ||
| 45 | + }*/ | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * | ||
| 49 | + * @Title: resourceFilterRegistration | ||
| 50 | + * @Description: TODO(静态资源过滤器, 只处理 /pages 目录下的片段请求 ) | ||
| 51 | + */ | ||
| 52 | + @Bean | ||
| 53 | + public FilterRegistrationBean resourceFilterRegistration(){ | ||
| 54 | + FilterRegistrationBean registration = new FilterRegistrationBean(); | ||
| 55 | + registration.setFilter(new ResourceFilter()); | ||
| 56 | + registration.addUrlPatterns("/pages/*"); | ||
| 57 | + return registration; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { | ||
| 62 | + //线调webSocket | ||
| 63 | + registry.addHandler(new RealControlSocketHandler(), "/sockjs/realcontrol").addInterceptors(new WebSocketHandshakeInterceptor()) | ||
| 64 | + .withSockJS(); | ||
| 65 | + } | ||
| 66 | +} |
src/main/java/com/bsth/XDApplication.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.BasicData; | ||
| 4 | -import com.bsth.data.LineVersionsData; | ||
| 5 | -import com.bsth.data.ThreadMonotor; | ||
| 6 | -import com.bsth.data.car_out_info.UpdateDBThread; | ||
| 7 | -import com.bsth.data.directive.DirectivesPstThread; | ||
| 8 | -import com.bsth.data.forecast.SampleTimeDataLoader; | ||
| 9 | -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 10 | -import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread; | ||
| 11 | -import com.bsth.data.gpsdata_v2.thread.RfidDataLoaderThread; | ||
| 12 | -import com.bsth.data.maintenance_plan.MtPlanDataLoadThread; | ||
| 13 | -import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 14 | -import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 15 | -import com.bsth.data.safe_driv.SafeDrivDataLoadThread; | ||
| 16 | -import com.bsth.data.schedule.DayOfSchedule; | ||
| 17 | -import com.bsth.data.schedule.auto_exec.AutoExecScanThread; | ||
| 18 | -import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread; | ||
| 19 | -import com.bsth.data.schedule.edit_logs.SeiPstThread; | ||
| 20 | -import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | ||
| 21 | -import com.bsth.data.schedule.signal.SchSiginUpdateDBThread; | ||
| 22 | -import com.bsth.data.schedule.thread.CalcOilThread; | ||
| 23 | -import com.bsth.data.schedule.thread.SchedulePstThread; | ||
| 24 | -import com.bsth.data.schedule.thread.ScheduleRefreshThread; | ||
| 25 | -import com.bsth.data.schedule.thread.SubmitToTrafficManage; | ||
| 26 | -import com.bsth.util.DateUtils; | ||
| 27 | -import com.bsth.util.Tools; | ||
| 28 | -import org.slf4j.Logger; | ||
| 29 | -import org.slf4j.LoggerFactory; | ||
| 30 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 31 | -import org.springframework.boot.CommandLineRunner; | ||
| 32 | -import org.springframework.stereotype.Component; | ||
| 33 | - | ||
| 34 | -import java.util.concurrent.ScheduledExecutorService; | ||
| 35 | -import java.util.concurrent.TimeUnit; | ||
| 36 | - | ||
| 37 | -/** | ||
| 38 | - * 线调大部分服务都在这里启动 | ||
| 39 | - * Created by panzhao on 2017/5/14. | ||
| 40 | - */ | ||
| 41 | -@Component | ||
| 42 | -public class XDApplication implements CommandLineRunner { | ||
| 43 | - | ||
| 44 | - Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 45 | - | ||
| 46 | - @Autowired | ||
| 47 | - BasicData.BasicDataLoader basicDataLoader; | ||
| 48 | - @Autowired | ||
| 49 | - UpdateDBThread fcxxUpdateThread; | ||
| 50 | - @Autowired | ||
| 51 | - ScheduleRefreshThread scheduleRefreshThread; | ||
| 52 | - @Autowired | ||
| 53 | - SchedulePstThread schedulePstThread; | ||
| 54 | - @Autowired | ||
| 55 | - ScheduleLateThread scheduleLateThread; | ||
| 56 | - @Autowired | ||
| 57 | - SubmitToTrafficManage submitToTrafficManage; | ||
| 58 | - @Autowired | ||
| 59 | - CalcOilThread calcOilThread; | ||
| 60 | - @Autowired | ||
| 61 | - DirectivesPstThread directivesPstThread; | ||
| 62 | - @Autowired | ||
| 63 | - ThreadMonotor threadMonotor; | ||
| 64 | - @Autowired | ||
| 65 | - SeiPstThread seiPstThread; | ||
| 66 | - @Autowired | ||
| 67 | - SampleTimeDataLoader sampleTimeDataLoader; | ||
| 68 | - @Autowired | ||
| 69 | - SchSiginUpdateDBThread schSiginUpdateDBThread; | ||
| 70 | - @Autowired | ||
| 71 | - AutoExecScanThread autoExecScanThread; | ||
| 72 | - | ||
| 73 | - @Autowired | ||
| 74 | - GpsDataLoaderThread gpsDataLoader; | ||
| 75 | - @Autowired | ||
| 76 | - RfidDataLoaderThread rfidDataLoader; | ||
| 77 | - | ||
| 78 | - @Autowired | ||
| 79 | - OfflineMonitorThread offlineMonitorThread; | ||
| 80 | - | ||
| 81 | - @Autowired | ||
| 82 | - LineVersionsData lineVersionsData; | ||
| 83 | - | ||
| 84 | - /*@Autowired | ||
| 85 | - FixedEnableVerionsThread fixedEnableVerionsThread;*/ | ||
| 86 | - | ||
| 87 | - @Autowired | ||
| 88 | - SafeDrivDataLoadThread safeDrivDataLoadThread; | ||
| 89 | - | ||
| 90 | - @Autowired | ||
| 91 | - MtPlanDataLoadThread mtPlanDataLoadThread; | ||
| 92 | - | ||
| 93 | - @Autowired | ||
| 94 | - FixedCheckStationCodeThread fixedCheckStationCodeThread; | ||
| 95 | - | ||
| 96 | - private static long timeDiff; | ||
| 97 | - private static long timeDiffTraffic; | ||
| 98 | - | ||
| 99 | - static { | ||
| 100 | - // 早上2:20 | ||
| 101 | - timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | ||
| 102 | - if (timeDiff < 0) | ||
| 103 | - timeDiff += (1000 * 60 * 60 * 24); | ||
| 104 | - // 早上09:00 | ||
| 105 | - timeDiffTraffic = (DateUtils.getTimestamp() + 3600000 * 9) - System.currentTimeMillis(); | ||
| 106 | - if (timeDiffTraffic < 0) | ||
| 107 | - timeDiffTraffic += (1000 * 60 * 60 * 24); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - @Override | ||
| 111 | - public void run(String... strings) throws Exception { | ||
| 112 | - try { | ||
| 113 | - Tools tools = new Tools("application.properties"); | ||
| 114 | - String environment = tools.getValue("spring.profiles.active"); | ||
| 115 | - //预先加载基础的对照数据 | ||
| 116 | - basicDataLoader.loadAllData(); | ||
| 117 | - switch (environment){ | ||
| 118 | - case "dev": | ||
| 119 | - devInit(); | ||
| 120 | - break; | ||
| 121 | - case "prod": | ||
| 122 | - prodInit(); | ||
| 123 | - break; | ||
| 124 | - case "test": | ||
| 125 | - testInit(); | ||
| 126 | - break; | ||
| 127 | - case "cloud": | ||
| 128 | - cloudInit(); | ||
| 129 | - break; | ||
| 130 | - default: | ||
| 131 | - break; | ||
| 132 | - } | ||
| 133 | - }catch (Exception e){ | ||
| 134 | - log.error("线调后台启动出现异常!!", e); | ||
| 135 | - System.exit(1); | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - @Autowired | ||
| 140 | - DayOfSchedule dayOfSchedule; | ||
| 141 | - public void devInit(){ | ||
| 142 | - log.info("devInit..."); | ||
| 143 | - ScheduledExecutorService sexec = Application.mainServices; | ||
| 144 | - //抓取GPS数据 | ||
| 145 | - gpsDataLoader.setFlag(-1); | ||
| 146 | - //dayOfSchedule.dataRecovery(); | ||
| 147 | - | ||
| 148 | - //安全驾驶 | ||
| 149 | - sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 150 | - | ||
| 151 | - /** 线调业务 */ | ||
| 152 | - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 153 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 154 | - sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 155 | - sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 156 | - sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 157 | - | ||
| 158 | - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 159 | - sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 160 | - sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 161 | - sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 162 | - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 163 | - sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 164 | - sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 165 | - sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 166 | - //DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 167 | - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 168 | - | ||
| 169 | - /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 170 | - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 171 | - //线路首末班数据(网关用,班次更新时写入) | ||
| 172 | - //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 173 | - sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 174 | - | ||
| 175 | - //运管处静态数据提交 | ||
| 176 | - //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 177 | - //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 178 | - //计算油、公里加注 | ||
| 179 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 180 | - | ||
| 181 | - //线路版本更新 | ||
| 182 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 183 | - | ||
| 184 | - //线路版本更新 | ||
| 185 | - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - public void prodInit(){ | ||
| 189 | - log.info("prodInit..."); | ||
| 190 | - ScheduledExecutorService sexec = Application.mainServices; | ||
| 191 | - //安全驾驶 | ||
| 192 | - sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 193 | - sexec.scheduleWithFixedDelay(mtPlanDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 194 | - | ||
| 195 | - GpsDataLoaderThread.setFlag(-1); | ||
| 196 | - /** 线调业务 */ | ||
| 197 | - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 198 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 199 | - sexec.scheduleWithFixedDelay(gpsDataLoader, 0, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 200 | - sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 201 | - sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 202 | - | ||
| 203 | - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 204 | - sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 205 | - sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 206 | - sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 207 | - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 208 | - sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 209 | - sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 210 | - sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 211 | - DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 212 | - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 213 | - | ||
| 214 | - /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 215 | - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 216 | - //线路首末班数据(网关用,班次更新时写入) | ||
| 217 | - //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 218 | - sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 219 | - | ||
| 220 | - //运管处静态数据提交 | ||
| 221 | - log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 222 | - sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 223 | - //计算油、公里加注 | ||
| 224 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 225 | - | ||
| 226 | - //线路版本更新 | ||
| 227 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 228 | - | ||
| 229 | - //线路版本更新 | ||
| 230 | - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | - public void testInit(){ | ||
| 234 | - log.info("testInit..."); | ||
| 235 | - ScheduledExecutorService sexec = Application.mainServices; | ||
| 236 | - //安全驾驶 | ||
| 237 | - sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 238 | - sexec.scheduleWithFixedDelay(mtPlanDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 239 | - | ||
| 240 | - GpsDataLoaderThread.setFlag(-1); | ||
| 241 | - //dayOfSchedule.dataRecovery(); | ||
| 242 | - /** 线调业务 */ | ||
| 243 | - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 244 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 245 | - sexec.scheduleWithFixedDelay(gpsDataLoader, 0, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 246 | - sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 247 | - sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 248 | - | ||
| 249 | - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 250 | - sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 251 | - sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 252 | - sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 253 | - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 254 | - sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 255 | - sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 256 | - sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 257 | - //DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 258 | - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 259 | - | ||
| 260 | - /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 261 | - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 262 | - //线路首末班数据(网关用,班次更新时写入) | ||
| 263 | - //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 264 | - sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 265 | - | ||
| 266 | - //运管处静态数据提交 | ||
| 267 | - //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 268 | - //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 269 | - //计算油、公里加注 | ||
| 270 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 271 | - | ||
| 272 | - //线路版本更新 | ||
| 273 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 274 | - | ||
| 275 | - //线路版本更新 | ||
| 276 | - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 277 | - } | ||
| 278 | - | ||
| 279 | - public void cloudInit(){ | ||
| 280 | - log.info("cloudInit..."); | ||
| 281 | - ScheduledExecutorService sexec = Application.mainServices; | ||
| 282 | - //安全驾驶 | ||
| 283 | - sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 284 | - sexec.scheduleWithFixedDelay(mtPlanDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 285 | - | ||
| 286 | - GpsDataLoaderThread.setFlag(-1); | ||
| 287 | - /** 线调业务 */ | ||
| 288 | - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 289 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 290 | - sexec.scheduleWithFixedDelay(gpsDataLoader, 0, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 291 | - sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 292 | - sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 293 | - | ||
| 294 | - sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 295 | - sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 296 | - sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 297 | - sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 298 | - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 299 | - sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 300 | - sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 301 | - sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 302 | - DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 303 | - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 304 | - | ||
| 305 | - /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 306 | - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 307 | - //线路首末班数据(网关用,班次更新时写入) | ||
| 308 | - //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 309 | - sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 310 | - | ||
| 311 | - //运管处静态数据提交 | ||
| 312 | - log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 313 | - sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 314 | - //计算油、公里加注 | ||
| 315 | - sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 316 | - | ||
| 317 | - //线路版本更新 | ||
| 318 | - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 319 | - | ||
| 320 | - //线路版本更新 | ||
| 321 | - //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 322 | - } | ||
| 323 | -} | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.LineVersionsData; | ||
| 5 | +import com.bsth.data.ThreadMonotor; | ||
| 6 | +import com.bsth.data.car_out_info.UpdateDBThread; | ||
| 7 | +import com.bsth.data.directive.DirectivesPstThread; | ||
| 8 | +import com.bsth.data.forecast.SampleTimeDataLoader; | ||
| 9 | +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | ||
| 10 | +import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread; | ||
| 11 | +import com.bsth.data.gpsdata_v2.thread.RfidDataLoaderThread; | ||
| 12 | +import com.bsth.data.maintenance_plan.MtPlanDataLoadThread; | ||
| 13 | +import com.bsth.data.msg_queue.DirectivePushQueue; | ||
| 14 | +import com.bsth.data.msg_queue.WebSocketPushQueue; | ||
| 15 | +import com.bsth.data.safe_driv.SafeDrivDataLoadThread; | ||
| 16 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 17 | +import com.bsth.data.schedule.auto_exec.AutoExecScanThread; | ||
| 18 | +import com.bsth.data.schedule.e_state_check.thread.FixedCheckStationCodeThread; | ||
| 19 | +import com.bsth.data.schedule.edit_logs.SeiPstThread; | ||
| 20 | +import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | ||
| 21 | +import com.bsth.data.schedule.signal.SchSiginUpdateDBThread; | ||
| 22 | +import com.bsth.data.schedule.thread.CalcOilThread; | ||
| 23 | +import com.bsth.data.schedule.thread.SchedulePstThread; | ||
| 24 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | ||
| 25 | +import com.bsth.data.schedule.thread.SubmitToTrafficManage; | ||
| 26 | +import com.bsth.util.DateUtils; | ||
| 27 | +import com.bsth.util.Tools; | ||
| 28 | +import org.slf4j.Logger; | ||
| 29 | +import org.slf4j.LoggerFactory; | ||
| 30 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 31 | +import org.springframework.boot.CommandLineRunner; | ||
| 32 | +import org.springframework.stereotype.Component; | ||
| 33 | + | ||
| 34 | +import java.util.concurrent.ScheduledExecutorService; | ||
| 35 | +import java.util.concurrent.TimeUnit; | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | + * 线调大部分服务都在这里启动 | ||
| 39 | + * Created by panzhao on 2017/5/14. | ||
| 40 | + */ | ||
| 41 | +@Component | ||
| 42 | +public class XDApplication implements CommandLineRunner { | ||
| 43 | + | ||
| 44 | + Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 45 | + | ||
| 46 | + @Autowired | ||
| 47 | + BasicData.BasicDataLoader basicDataLoader; | ||
| 48 | + @Autowired | ||
| 49 | + UpdateDBThread fcxxUpdateThread; | ||
| 50 | + @Autowired | ||
| 51 | + ScheduleRefreshThread scheduleRefreshThread; | ||
| 52 | + @Autowired | ||
| 53 | + SchedulePstThread schedulePstThread; | ||
| 54 | + @Autowired | ||
| 55 | + ScheduleLateThread scheduleLateThread; | ||
| 56 | + @Autowired | ||
| 57 | + SubmitToTrafficManage submitToTrafficManage; | ||
| 58 | + @Autowired | ||
| 59 | + CalcOilThread calcOilThread; | ||
| 60 | + @Autowired | ||
| 61 | + DirectivesPstThread directivesPstThread; | ||
| 62 | + @Autowired | ||
| 63 | + ThreadMonotor threadMonotor; | ||
| 64 | + @Autowired | ||
| 65 | + SeiPstThread seiPstThread; | ||
| 66 | + @Autowired | ||
| 67 | + SampleTimeDataLoader sampleTimeDataLoader; | ||
| 68 | + @Autowired | ||
| 69 | + SchSiginUpdateDBThread schSiginUpdateDBThread; | ||
| 70 | + @Autowired | ||
| 71 | + AutoExecScanThread autoExecScanThread; | ||
| 72 | + | ||
| 73 | + @Autowired | ||
| 74 | + GpsDataLoaderThread gpsDataLoader; | ||
| 75 | + @Autowired | ||
| 76 | + RfidDataLoaderThread rfidDataLoader; | ||
| 77 | + | ||
| 78 | + @Autowired | ||
| 79 | + OfflineMonitorThread offlineMonitorThread; | ||
| 80 | + | ||
| 81 | + @Autowired | ||
| 82 | + LineVersionsData lineVersionsData; | ||
| 83 | + | ||
| 84 | + /*@Autowired | ||
| 85 | + FixedEnableVerionsThread fixedEnableVerionsThread;*/ | ||
| 86 | + | ||
| 87 | + @Autowired | ||
| 88 | + SafeDrivDataLoadThread safeDrivDataLoadThread; | ||
| 89 | + | ||
| 90 | + @Autowired | ||
| 91 | + MtPlanDataLoadThread mtPlanDataLoadThread; | ||
| 92 | + | ||
| 93 | + @Autowired | ||
| 94 | + FixedCheckStationCodeThread fixedCheckStationCodeThread; | ||
| 95 | + | ||
| 96 | + private static long timeDiff; | ||
| 97 | + private static long timeDiffTraffic; | ||
| 98 | + | ||
| 99 | + static { | ||
| 100 | + // 早上2:20 | ||
| 101 | + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); | ||
| 102 | + if (timeDiff < 0) | ||
| 103 | + timeDiff += (1000 * 60 * 60 * 24); | ||
| 104 | + // 早上09:00 | ||
| 105 | + timeDiffTraffic = (DateUtils.getTimestamp() + 3600000 * 9) - System.currentTimeMillis(); | ||
| 106 | + if (timeDiffTraffic < 0) | ||
| 107 | + timeDiffTraffic += (1000 * 60 * 60 * 24); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + public void run(String... strings) throws Exception { | ||
| 112 | + try { | ||
| 113 | + Tools tools = new Tools("application.properties"); | ||
| 114 | + String environment = tools.getValue("spring.profiles.active"); | ||
| 115 | + //预先加载基础的对照数据 | ||
| 116 | + basicDataLoader.loadAllData(); | ||
| 117 | + switch (environment){ | ||
| 118 | + case "dev": | ||
| 119 | + devInit(); | ||
| 120 | + break; | ||
| 121 | + case "prod": | ||
| 122 | + prodInit(); | ||
| 123 | + break; | ||
| 124 | + case "test": | ||
| 125 | + testInit(); | ||
| 126 | + break; | ||
| 127 | + case "cloud": | ||
| 128 | + cloudInit(); | ||
| 129 | + break; | ||
| 130 | + default: | ||
| 131 | + break; | ||
| 132 | + } | ||
| 133 | + }catch (Exception e){ | ||
| 134 | + log.error("线调后台启动出现异常!!", e); | ||
| 135 | + System.exit(1); | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + @Autowired | ||
| 140 | + DayOfSchedule dayOfSchedule; | ||
| 141 | + public void devInit(){ | ||
| 142 | + log.info("devInit..."); | ||
| 143 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 144 | + //抓取GPS数据 | ||
| 145 | + gpsDataLoader.setFlag(-1); | ||
| 146 | + //dayOfSchedule.dataRecovery(); | ||
| 147 | + | ||
| 148 | + //安全驾驶 | ||
| 149 | + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 150 | + | ||
| 151 | + /** 线调业务 */ | ||
| 152 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 153 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 154 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 155 | + sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 156 | + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 157 | + | ||
| 158 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 159 | + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 160 | + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 161 | + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 162 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 163 | + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 164 | + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 165 | + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 166 | + //DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 167 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 168 | + | ||
| 169 | + /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 170 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 171 | + //线路首末班数据(网关用,班次更新时写入) | ||
| 172 | + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 173 | + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 174 | + | ||
| 175 | + //运管处静态数据提交 | ||
| 176 | + //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 177 | + //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 178 | + //计算油、公里加注 | ||
| 179 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 180 | + | ||
| 181 | + //线路版本更新 | ||
| 182 | + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 183 | + | ||
| 184 | + //线路版本更新 | ||
| 185 | + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void prodInit(){ | ||
| 189 | + log.info("prodInit..."); | ||
| 190 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 191 | + //安全驾驶 | ||
| 192 | + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 193 | + sexec.scheduleWithFixedDelay(mtPlanDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 194 | + | ||
| 195 | + GpsDataLoaderThread.setFlag(-1); | ||
| 196 | + /** 线调业务 */ | ||
| 197 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 198 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 199 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 0, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 200 | + sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 201 | + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 202 | + | ||
| 203 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 204 | + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 205 | + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 206 | + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 207 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 208 | + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 209 | + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 210 | + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 211 | + DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 212 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 213 | + | ||
| 214 | + /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 215 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 216 | + //线路首末班数据(网关用,班次更新时写入) | ||
| 217 | + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 218 | + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 219 | + | ||
| 220 | + //运管处静态数据提交 | ||
| 221 | + log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 222 | + sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 223 | + //计算油、公里加注 | ||
| 224 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 225 | + | ||
| 226 | + //线路版本更新 | ||
| 227 | + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 228 | + | ||
| 229 | + //线路版本更新 | ||
| 230 | + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + public void testInit(){ | ||
| 234 | + log.info("testInit..."); | ||
| 235 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 236 | + //安全驾驶 | ||
| 237 | + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 238 | + sexec.scheduleWithFixedDelay(mtPlanDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 239 | + | ||
| 240 | + GpsDataLoaderThread.setFlag(-1); | ||
| 241 | + //dayOfSchedule.dataRecovery(); | ||
| 242 | + /** 线调业务 */ | ||
| 243 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 244 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 245 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 0, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 246 | + sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 247 | + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 248 | + | ||
| 249 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 250 | + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 251 | + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 252 | + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 253 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 254 | + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 255 | + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 256 | + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 257 | + //DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 258 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 259 | + | ||
| 260 | + /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 261 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 262 | + //线路首末班数据(网关用,班次更新时写入) | ||
| 263 | + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 264 | + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 265 | + | ||
| 266 | + //运管处静态数据提交 | ||
| 267 | + //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 268 | + //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 269 | + //计算油、公里加注 | ||
| 270 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 271 | + | ||
| 272 | + //线路版本更新 | ||
| 273 | + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 274 | + | ||
| 275 | + //线路版本更新 | ||
| 276 | + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + public void cloudInit(){ | ||
| 280 | + log.info("cloudInit..."); | ||
| 281 | + ScheduledExecutorService sexec = Application.mainServices; | ||
| 282 | + //安全驾驶 | ||
| 283 | + sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 284 | + sexec.scheduleWithFixedDelay(mtPlanDataLoadThread, 180, 10, TimeUnit.SECONDS); | ||
| 285 | + | ||
| 286 | + GpsDataLoaderThread.setFlag(-1); | ||
| 287 | + /** 线调业务 */ | ||
| 288 | + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | ||
| 289 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | ||
| 290 | + sexec.scheduleWithFixedDelay(gpsDataLoader, 0, 2, TimeUnit.SECONDS);//抓取GPS数据 | ||
| 291 | + sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据 | ||
| 292 | + sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 | ||
| 293 | + | ||
| 294 | + sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线 | ||
| 295 | + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 | ||
| 296 | + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 | ||
| 297 | + sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 | ||
| 298 | + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | ||
| 299 | + sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 | ||
| 300 | + sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 | ||
| 301 | + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ||
| 302 | + DirectivePushQueue.start();//消息队列 -指令,系统下发的 | ||
| 303 | + WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的 | ||
| 304 | + | ||
| 305 | + /** 线调为其他程序提供的数据 --写入数据库 */ | ||
| 306 | + sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布) | ||
| 307 | + //线路首末班数据(网关用,班次更新时写入) | ||
| 308 | + //com.bsth.data.schedule.f_a_l.FirstAndLastHandler | ||
| 309 | + sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号) | ||
| 310 | + | ||
| 311 | + //运管处静态数据提交 | ||
| 312 | + log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处"); | ||
| 313 | + sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 314 | + //计算油、公里加注 | ||
| 315 | + sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | ||
| 316 | + | ||
| 317 | + //线路版本更新 | ||
| 318 | + sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS); | ||
| 319 | + | ||
| 320 | + //线路版本更新 | ||
| 321 | + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS); | ||
| 322 | + } | ||
| 323 | +} |
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
| 1 | -package com.bsth.common; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * | ||
| 5 | - * @ClassName: Constants | ||
| 6 | - * @Description: TODO(常量类) | ||
| 7 | - * @author PanZhao | ||
| 8 | - * @date 2016年3月18日 下午11:06:53 | ||
| 9 | - * | ||
| 10 | - */ | ||
| 11 | -public class Constants { | ||
| 12 | - | ||
| 13 | - /** | ||
| 14 | - * 不需要拦截的资源 | ||
| 15 | - */ | ||
| 16 | - public static final String LOGIN = "/user/login/**"; | ||
| 17 | - public static final String ORIGINAL_LOGIN_PAGE = "/login.html"; | ||
| 18 | - public static String LOGIN_PAGE = "/login.html"; | ||
| 19 | - public static final String ASSETS_URL = "/login_assets/**"; | ||
| 20 | - public static final String FAVICON_URL = "/favicon.ico"; | ||
| 21 | - public static final String LOGIN_FAILURE = "/user/loginFailure"; | ||
| 22 | - public static final String CAPTCHA = "/captcha.jpg"; | ||
| 23 | - | ||
| 24 | - // springboot manage health的检测url | ||
| 25 | - public static final String ACTUATOR_MANAGEMENT_HEALTH = "/manage/health"; | ||
| 26 | - // 车辆数据同步url | ||
| 27 | - public static final String VEHICLE_DATA_SYNC_URL = "/dataSync/vehicle/api/**"; | ||
| 28 | - | ||
| 29 | - //对外的营运数据接口 | ||
| 30 | - public static final String SERVICE_INTERFACE = "/companyService/**"; | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * 线调部分子页面不做拦截,便于浏览器缓存 | ||
| 34 | - */ | ||
| 35 | - public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | ||
| 36 | - public static final String XD_REAL_GPS = "/gps/real/line"; | ||
| 37 | - //public static final String XD_TEMPS = "/pages/control/line/temps/**"; | ||
| 38 | - | ||
| 39 | - //车载网关上行接口 | ||
| 40 | - public static final String UPSTREAM_URL = "/control/upstream"; | ||
| 41 | - //rfid 上传入口 | ||
| 42 | - public static final String UP_RFID_URL = "/rfid/**"; | ||
| 43 | - | ||
| 44 | - public static final String SESSION_USERNAME = "sessionUserName"; | ||
| 45 | - public static final String COMPANY_AUTHORITYS = "cmyAuths"; | ||
| 46 | - public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * 解除调度指令和班次的外键约束 | ||
| 50 | - */ | ||
| 51 | - public static final String REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch=?"; | ||
| 52 | - | ||
| 53 | - /** | ||
| 54 | - * 批量解除调度指令和班次的外键约束 | ||
| 55 | - */ | ||
| 56 | - public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | ||
| 57 | - | ||
| 58 | - /** | ||
| 59 | - * 批量解除子任务和班次的外键约束 | ||
| 60 | - */ | ||
| 61 | - public static final String MULTI_REMOVE_CHILDTASK_SCH_FK = "update bsth_c_s_child_task set schedule=NULL where schedule in "; | ||
| 62 | - | ||
| 63 | - public static final String WEAK_CIPHER = "weakCipher"; | ||
| 64 | - | ||
| 65 | - public static final String FILE_AUTH = "/.well-known/pki-validation/fileauth.txt"; | ||
| 66 | - | ||
| 67 | - public static final String SSO_TOKEN = "ssoToken"; | ||
| 68 | - | ||
| 69 | - public static final String RESOURCE_AUTHORITYS = "resourceAuthoritys"; | ||
| 70 | -} | 1 | +package com.bsth.common; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * | ||
| 5 | + * @ClassName: Constants | ||
| 6 | + * @Description: TODO(常量类) | ||
| 7 | + * @author PanZhao | ||
| 8 | + * @date 2016年3月18日 下午11:06:53 | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | +public class Constants { | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 不需要拦截的资源 | ||
| 15 | + */ | ||
| 16 | + public static final String LOGIN = "/user/login/**"; | ||
| 17 | + public static final String ORIGINAL_LOGIN_PAGE = "/login.html"; | ||
| 18 | + public static String LOGIN_PAGE = "/login.html"; | ||
| 19 | + public static final String ASSETS_URL = "/login_assets/**"; | ||
| 20 | + public static final String FAVICON_URL = "/favicon.ico"; | ||
| 21 | + public static final String LOGIN_FAILURE = "/user/loginFailure"; | ||
| 22 | + public static final String CAPTCHA = "/captcha.jpg"; | ||
| 23 | + | ||
| 24 | + // springboot manage health的检测url | ||
| 25 | + public static final String ACTUATOR_MANAGEMENT_HEALTH = "/manage/health"; | ||
| 26 | + // 车辆数据同步url | ||
| 27 | + public static final String VEHICLE_DATA_SYNC_URL = "/dataSync/vehicle/api/**"; | ||
| 28 | + | ||
| 29 | + //对外的营运数据接口 | ||
| 30 | + public static final String SERVICE_INTERFACE = "/companyService/**"; | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 线调部分子页面不做拦截,便于浏览器缓存 | ||
| 34 | + */ | ||
| 35 | + public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | ||
| 36 | + public static final String XD_REAL_GPS = "/gps/real/line"; | ||
| 37 | + //public static final String XD_TEMPS = "/pages/control/line/temps/**"; | ||
| 38 | + | ||
| 39 | + //车载网关上行接口 | ||
| 40 | + public static final String UPSTREAM_URL = "/control/upstream"; | ||
| 41 | + //rfid 上传入口 | ||
| 42 | + public static final String UP_RFID_URL = "/rfid/**"; | ||
| 43 | + | ||
| 44 | + public static final String SESSION_USERNAME = "sessionUserName"; | ||
| 45 | + public static final String COMPANY_AUTHORITYS = "cmyAuths"; | ||
| 46 | + public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 解除调度指令和班次的外键约束 | ||
| 50 | + */ | ||
| 51 | + public static final String REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch=?"; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 批量解除调度指令和班次的外键约束 | ||
| 55 | + */ | ||
| 56 | + public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 批量解除子任务和班次的外键约束 | ||
| 60 | + */ | ||
| 61 | + public static final String MULTI_REMOVE_CHILDTASK_SCH_FK = "update bsth_c_s_child_task set schedule=NULL where schedule in "; | ||
| 62 | + | ||
| 63 | + public static final String WEAK_CIPHER = "weakCipher"; | ||
| 64 | + | ||
| 65 | + public static final String FILE_AUTH = "/.well-known/pki-validation/fileauth.txt"; | ||
| 66 | + | ||
| 67 | + public static final String SSO_TOKEN = "ssoToken"; | ||
| 68 | + | ||
| 69 | + public static final String RESOURCE_AUTHORITYS = "resourceAuthoritys"; | ||
| 70 | +} |
src/main/java/com/bsth/common/SystemParamKeys.java
| 1 | -package com.bsth.common; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * @author Hill | ||
| 5 | - */ | ||
| 6 | -public class SystemParamKeys { | ||
| 7 | - | ||
| 8 | - public static final String SPECIAL_ROLES = "special.roles"; | ||
| 9 | - | ||
| 10 | - public static final String SPECIAL_DAYS = "special.days"; | ||
| 11 | - | ||
| 12 | - public static final String URL_HTTP_GPS_REAL_CACHE = "url.http.gps.real.cache"; | ||
| 13 | - | ||
| 14 | - public static final String URL_HTTP_GPS_REAL = "url.http.gps.real"; | ||
| 15 | - | ||
| 16 | - public static final String URL_HTTP_DIRECTIVE = "url.http.directive"; | ||
| 17 | - | ||
| 18 | - public static final String URL_HTTP_RFID = "url.http.rfid"; | ||
| 19 | - | ||
| 20 | - public static final String URL_HTTP_REPORT = "url.http.report.%s"; | ||
| 21 | - | ||
| 22 | - public static final String URL_HTTP_TICKETING = "url.http.ticketing"; | ||
| 23 | - | ||
| 24 | - public static final String URL_HTTP_DSM_ACK = "url.http.dsm.ack"; | ||
| 25 | - | ||
| 26 | - public static final String URL_HTTP_CP_ACK = "url.http.cp.ack"; | ||
| 27 | - | ||
| 28 | - public static final String MAIL_ADMIN = "mail.admin"; | ||
| 29 | - | ||
| 30 | - public static final String MAIL_WAYBILL = "mail.waybill"; | ||
| 31 | - | ||
| 32 | - public static final String ENABLED_FIRST_LAST_GENERATION = "enabled.first.last.generation"; | ||
| 33 | - | ||
| 34 | - public static final String ENABLED_FILTER_SQL_INJECTION = "enabled.filter.sql.injection"; | ||
| 35 | - | ||
| 36 | - public static final String ENABLED_SSO = "enabled.sso"; | ||
| 37 | - | ||
| 38 | - public static final String SSO_SYSTEM_CODE = "sso.system.code"; | ||
| 39 | - | ||
| 40 | - public static final String URL_HTTP_SSO_LOGIN = "url.http.sso.login"; | ||
| 41 | - | ||
| 42 | - public static final String URL_HTTP_SSO_LOGOUT = "url.http.sso.logout"; | ||
| 43 | - | ||
| 44 | - public static final String URL_HTTP_SSO_AUTH = "url.http.sso.auth"; | ||
| 45 | - | ||
| 46 | - public static final String URL_HTTP_MAINTENANCE = "url.http.maintenance"; | ||
| 47 | - | ||
| 48 | - public static final String ENABLED_WHITE_IP = "enabled.white.ip"; | ||
| 49 | - | ||
| 50 | - public static final String ENABLED_FILTER_AUTHORITY = "enabled.filter.authority"; | ||
| 51 | -} | 1 | +package com.bsth.common; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * @author Hill | ||
| 5 | + */ | ||
| 6 | +public class SystemParamKeys { | ||
| 7 | + | ||
| 8 | + public static final String SPECIAL_ROLES = "special.roles"; | ||
| 9 | + | ||
| 10 | + public static final String SPECIAL_DAYS = "special.days"; | ||
| 11 | + | ||
| 12 | + public static final String URL_HTTP_GPS_REAL_CACHE = "url.http.gps.real.cache"; | ||
| 13 | + | ||
| 14 | + public static final String URL_HTTP_GPS_REAL = "url.http.gps.real"; | ||
| 15 | + | ||
| 16 | + public static final String URL_HTTP_DIRECTIVE = "url.http.directive"; | ||
| 17 | + | ||
| 18 | + public static final String URL_HTTP_RFID = "url.http.rfid"; | ||
| 19 | + | ||
| 20 | + public static final String URL_HTTP_REPORT = "url.http.report.%s"; | ||
| 21 | + | ||
| 22 | + public static final String URL_HTTP_TICKETING = "url.http.ticketing"; | ||
| 23 | + | ||
| 24 | + public static final String URL_HTTP_DSM_ACK = "url.http.dsm.ack"; | ||
| 25 | + | ||
| 26 | + public static final String URL_HTTP_CP_ACK = "url.http.cp.ack"; | ||
| 27 | + | ||
| 28 | + public static final String MAIL_ADMIN = "mail.admin"; | ||
| 29 | + | ||
| 30 | + public static final String MAIL_WAYBILL = "mail.waybill"; | ||
| 31 | + | ||
| 32 | + public static final String ENABLED_FIRST_LAST_GENERATION = "enabled.first.last.generation"; | ||
| 33 | + | ||
| 34 | + public static final String ENABLED_FILTER_SQL_INJECTION = "enabled.filter.sql.injection"; | ||
| 35 | + | ||
| 36 | + public static final String ENABLED_SSO = "enabled.sso"; | ||
| 37 | + | ||
| 38 | + public static final String SSO_SYSTEM_CODE = "sso.system.code"; | ||
| 39 | + | ||
| 40 | + public static final String URL_HTTP_SSO_LOGIN = "url.http.sso.login"; | ||
| 41 | + | ||
| 42 | + public static final String URL_HTTP_SSO_LOGOUT = "url.http.sso.logout"; | ||
| 43 | + | ||
| 44 | + public static final String URL_HTTP_SSO_AUTH = "url.http.sso.auth"; | ||
| 45 | + | ||
| 46 | + public static final String URL_HTTP_MAINTENANCE = "url.http.maintenance"; | ||
| 47 | + | ||
| 48 | + public static final String ENABLED_WHITE_IP = "enabled.white.ip"; | ||
| 49 | + | ||
| 50 | + public static final String ENABLED_FILTER_AUTHORITY = "enabled.filter.authority"; | ||
| 51 | +} |
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/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/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
| 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
| 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
| 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/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/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
| 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/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
| 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 | +} |