Commit 89f372206bf4149415d13756fd9bfeb0b2d95598
Merge branch 'pudong_jdk8' of http://61.169.120.202:8888/panzhaov5/bsth_control into pudong_jdk8
Showing
18 changed files
with
3426 additions
and
2608 deletions
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 | + | ||
| 416 | + <dependency> | ||
| 417 | + <groupId>org.java-websocket</groupId> | ||
| 418 | + <artifactId>Java-WebSocket</artifactId> | ||
| 419 | + <version>1.5.3</version> | ||
| 420 | + </dependency> | ||
| 421 | + | ||
| 422 | + <dependency> | ||
| 423 | + <groupId>org.bytedeco</groupId> | ||
| 424 | + <artifactId>javacv-platform</artifactId> | ||
| 425 | + <version>1.5.11</version> | ||
| 426 | + </dependency> | ||
| 427 | + </dependencies> | ||
| 428 | + | ||
| 429 | + <dependencyManagement> | ||
| 430 | + <dependencies> | ||
| 431 | + <!-- drools 6依赖 --> | ||
| 432 | + <dependency> | ||
| 433 | + <groupId>org.drools</groupId> | ||
| 434 | + <artifactId>drools-bom</artifactId> | ||
| 435 | + <type>pom</type> | ||
| 436 | + <version>6.3.0.Final</version> | ||
| 437 | + <scope>import</scope> | ||
| 438 | + </dependency> | ||
| 439 | + </dependencies> | ||
| 440 | + </dependencyManagement> | ||
| 441 | + | ||
| 442 | + <build> | ||
| 443 | + <plugins> | ||
| 444 | + <plugin> | ||
| 445 | + <artifactId>maven-compiler-plugin</artifactId> | ||
| 446 | + <configuration> | ||
| 447 | + <source>1.8</source> | ||
| 448 | + <target>1.8</target> | ||
| 449 | + </configuration> | ||
| 450 | + </plugin> | ||
| 451 | + <plugin> | ||
| 452 | + <artifactId>maven-war-plugin</artifactId> | ||
| 453 | + <configuration> | ||
| 454 | + <failOnMissingWebXml>false</failOnMissingWebXml> | ||
| 455 | + </configuration> | ||
| 456 | + </plugin> | ||
| 457 | + <plugin> | ||
| 458 | + <groupId>org.springframework.boot</groupId> | ||
| 459 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 460 | + </plugin> | ||
| 461 | + </plugins> | ||
| 462 | + <resources> | ||
| 463 | + <resource> | ||
| 464 | + <directory>src/main/resources</directory> | ||
| 465 | + <filtering>false</filtering> | ||
| 466 | + </resource> | ||
| 467 | + </resources> | ||
| 468 | + </build> | ||
| 469 | + <repositories> | ||
| 470 | + <repository> | ||
| 471 | + <id>spring-snapshots</id> | ||
| 472 | + <url>http://repo.spring.io/snapshot</url> | ||
| 473 | + <snapshots> | ||
| 474 | + <enabled>true</enabled> | ||
| 475 | + </snapshots> | ||
| 476 | + </repository> | ||
| 477 | + <repository> | ||
| 478 | + <id>spring-milestones</id> | ||
| 479 | + <url>http://repo.spring.io/milestone</url> | ||
| 480 | + </repository> | ||
| 481 | + <repository> | ||
| 482 | + <id>pentaho-public</id> | ||
| 483 | + <url>https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn/</url> | ||
| 484 | + </repository> | ||
| 485 | + </repositories> | ||
| 486 | + <pluginRepositories> | ||
| 487 | + <pluginRepository> | ||
| 488 | + <id>spring-snapshots</id> | ||
| 489 | + <url>http://repo.spring.io/snapshot</url> | ||
| 490 | + </pluginRepository> | ||
| 491 | + <pluginRepository> | ||
| 492 | + <id>spring-milestones</id> | ||
| 493 | + <url>http://repo.spring.io/milestone</url> | ||
| 494 | + </pluginRepository> | ||
| 495 | + </pluginRepositories> | ||
| 496 | + | ||
| 497 | + <properties> | ||
| 498 | + <start-class>com.bsth.Application</start-class> | ||
| 499 | + <javacpp.platform>linux-x86_64</javacpp.platform> | ||
| 500 | + </properties> | ||
| 501 | +</project> |
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 = "/assets/**"; | ||
| 20 | + public static final String LOGIN_ASSETS_URL = "/login_assets/**"; | ||
| 21 | + public static final String FAVICON_URL = "/favicon.ico"; | ||
| 22 | + public static final String METRONIC_URL = "/metronic_v4.5.4/**"; | ||
| 23 | + public static final String LOGIN_FAILURE = "/user/loginFailure"; | ||
| 24 | + public static final String CAPTCHA = "/captcha.jpg"; | ||
| 25 | + | ||
| 26 | + // springboot manage health的检测url | ||
| 27 | + public static final String ACTUATOR_MANAGEMENT_HEALTH = "/manage/health"; | ||
| 28 | + // 车辆数据同步url | ||
| 29 | + public static final String VEHICLE_DATA_SYNC_URL = "/dataSync/vehicle/api/**"; | ||
| 30 | + | ||
| 31 | + //对外的营运数据接口 | ||
| 32 | + public static final String SERVICE_INTERFACE = "/companyService/**"; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 线调部分子页面不做拦截,便于浏览器缓存 | ||
| 36 | + */ | ||
| 37 | + public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | ||
| 38 | + public static final String XD_REAL_GPS = "/gps/real/line"; | ||
| 39 | + //public static final String XD_TEMPS = "/pages/control/line/temps/**"; | ||
| 40 | + | ||
| 41 | + //车载网关上行接口 | ||
| 42 | + public static final String UPSTREAM_URL = "/control/upstream"; | ||
| 43 | + //rfid 上传入口 | ||
| 44 | + public static final String UP_RFID_URL = "/rfid/**"; | ||
| 45 | + | ||
| 46 | + public static final String SESSION_USERNAME = "sessionUserName"; | ||
| 47 | + public static final String COMPANY_AUTHORITYS = "cmyAuths"; | ||
| 48 | + public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 解除调度指令和班次的外键约束 | ||
| 52 | + */ | ||
| 53 | + public static final String REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch=?"; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * 批量解除调度指令和班次的外键约束 | ||
| 57 | + */ | ||
| 58 | + public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 批量解除子任务和班次的外键约束 | ||
| 62 | + */ | ||
| 63 | + public static final String MULTI_REMOVE_CHILDTASK_SCH_FK = "update bsth_c_s_child_task set schedule=NULL where schedule in "; | ||
| 64 | + | ||
| 65 | + public static final String WEAK_CIPHER = "weakCipher"; | ||
| 66 | + | ||
| 67 | + public static final String FILE_AUTH = "/.well-known/pki-validation/fileauth.txt"; | ||
| 68 | + | ||
| 69 | + public static final String SSO_TOKEN = "ssoToken"; | ||
| 70 | + | ||
| 71 | + public static final String RESOURCE_AUTHORITYS = "resourceAuthoritys"; | ||
| 72 | +} |
src/main/java/com/bsth/entity/speech/SpeechRequest.java
0 → 100644
| 1 | +package com.bsth.entity.speech; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +public class SpeechRequest { | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 包含appid | ||
| 12 | + */ | ||
| 13 | + private Map<String, Object> common = new HashMap<>(); | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 音频合成参数 | ||
| 17 | + */ | ||
| 18 | + private Map<String, Object> business = new HashMap<>(); | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 数据、状态参数 | ||
| 22 | + */ | ||
| 23 | + private Map<String, Object> data = new HashMap<>(); | ||
| 24 | + | ||
| 25 | + @JsonIgnore | ||
| 26 | + private boolean completed = false; | ||
| 27 | + | ||
| 28 | + public Map<String, Object> getCommon() { | ||
| 29 | + return common; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setCommon(Map<String, Object> common) { | ||
| 33 | + this.common = common; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public Map<String, Object> getBusiness() { | ||
| 37 | + return business; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public void setBusiness(Map<String, Object> business) { | ||
| 41 | + this.business = business; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public Map<String, Object> getData() { | ||
| 45 | + return data; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public void setData(Map<String, Object> data) { | ||
| 49 | + this.data = data; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public boolean isCompleted() { | ||
| 53 | + return completed; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public void setCompleted(boolean completed) { | ||
| 57 | + this.completed = completed; | ||
| 58 | + } | ||
| 59 | +} | ||
| 0 | \ No newline at end of file | 60 | \ No newline at end of file |
src/main/java/com/bsth/entity/speech/SpeechResponse.java
0 → 100644
| 1 | +package com.bsth.entity.speech; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 讯飞在线语音合成返回json | ||
| 5 | + */ | ||
| 6 | +public class SpeechResponse { | ||
| 7 | + | ||
| 8 | + private int code; | ||
| 9 | + | ||
| 10 | + private String message; | ||
| 11 | + | ||
| 12 | + private String sid; | ||
| 13 | + | ||
| 14 | + private AudioData data; | ||
| 15 | + | ||
| 16 | + public int getCode() { | ||
| 17 | + return code; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + public void setCode(int code) { | ||
| 21 | + this.code = code; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public String getMessage() { | ||
| 25 | + return message; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setMessage(String message) { | ||
| 29 | + this.message = message; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public String getSid() { | ||
| 33 | + return sid; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setSid(String sid) { | ||
| 37 | + this.sid = sid; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public AudioData getData() { | ||
| 41 | + return data; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setData(AudioData data) { | ||
| 45 | + this.data = data; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public final static class AudioData { | ||
| 49 | + | ||
| 50 | + private String audio; | ||
| 51 | + | ||
| 52 | + private String ced; | ||
| 53 | + | ||
| 54 | + private int status; | ||
| 55 | + | ||
| 56 | + public String getAudio() { | ||
| 57 | + return audio; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setAudio(String audio) { | ||
| 61 | + this.audio = audio; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public String getCed() { | ||
| 65 | + return ced; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setCed(String ced) { | ||
| 69 | + this.ced = ced; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public int getStatus() { | ||
| 73 | + return status; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setStatus(int status) { | ||
| 77 | + this.status = status; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public String toString() { | ||
| 82 | + return "AudioData{" + | ||
| 83 | + "audio='" + audio + '\'' + | ||
| 84 | + ", ced='" + ced + '\'' + | ||
| 85 | + ", status=" + status + | ||
| 86 | + '}'; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public String toString() { | ||
| 92 | + return "SpeechResponse{" + | ||
| 93 | + "code=" + code + | ||
| 94 | + ", message='" + message + '\'' + | ||
| 95 | + ", sid='" + sid + '\'' + | ||
| 96 | + ", audioData=" + data + | ||
| 97 | + '}'; | ||
| 98 | + } | ||
| 99 | +} | ||
| 0 | \ No newline at end of file | 100 | \ No newline at end of file |
src/main/java/com/bsth/entity/sys/SysUser.java
| 1 | -package com.bsth.entity.sys; | ||
| 2 | - | ||
| 3 | -import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| 5 | -import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | -import org.springframework.util.StringUtils; | ||
| 7 | -import org.joda.time.DateTime; | ||
| 8 | -import javax.persistence.*; | ||
| 9 | -import java.io.Serializable; | ||
| 10 | -import java.util.Date; | ||
| 11 | -import java.util.HashSet; | ||
| 12 | -import java.util.LinkedHashSet; | ||
| 13 | -import java.util.Set; | ||
| 14 | - | ||
| 15 | -@Entity | ||
| 16 | -@Table(name = "bsth_c_sys_user") | ||
| 17 | -@JsonIgnoreProperties(ignoreUnknown = true) | ||
| 18 | -@NamedEntityGraphs({ | ||
| 19 | - @NamedEntityGraph(name = "sysUser_role", attributeNodes = { | ||
| 20 | - @NamedAttributeNode("roles") | ||
| 21 | - }) | ||
| 22 | -}) | ||
| 23 | -public class SysUser implements Serializable { | ||
| 24 | - | ||
| 25 | - @Id | ||
| 26 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 27 | - private Integer id; | ||
| 28 | - | ||
| 29 | - private String userName; | ||
| 30 | - | ||
| 31 | - private String name; | ||
| 32 | - | ||
| 33 | - @JsonIgnore | ||
| 34 | - private String password; | ||
| 35 | - | ||
| 36 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 37 | - private Date createDate; | ||
| 38 | - | ||
| 39 | - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 40 | - private Date updateDate; | ||
| 41 | - | ||
| 42 | - @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
| 43 | - private Date lastLoginDate; | ||
| 44 | - | ||
| 45 | - /** 最近密码更新时间 */ | ||
| 46 | - @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
| 47 | - private Date lastPwdDate; | ||
| 48 | - /** 密码有效期 */ | ||
| 49 | - private Integer pwdValidPeriod; | ||
| 50 | - | ||
| 51 | - private String agencies; | ||
| 52 | - | ||
| 53 | - private boolean enabled; | ||
| 54 | - | ||
| 55 | - @ManyToMany(fetch = FetchType.EAGER) | ||
| 56 | - private Set<Role> roles = new LinkedHashSet<>(); | ||
| 57 | - | ||
| 58 | - private String jobCode; | ||
| 59 | - | ||
| 60 | - private String realName; | ||
| 61 | - | ||
| 62 | - /** | ||
| 63 | - * 密码过期时间 | ||
| 64 | - */ | ||
| 65 | - @Transient | ||
| 66 | - private Date pwdExpiredDate; | ||
| 67 | - | ||
| 68 | - public Integer getId() { | ||
| 69 | - return id; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public void setId(Integer id) { | ||
| 73 | - this.id = id; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public String getUserName() { | ||
| 77 | - return userName; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - public void setUserName(String userName) { | ||
| 81 | - this.userName = userName; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public String getName() { | ||
| 85 | - return name; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public void setName(String name) { | ||
| 89 | - this.name = name; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public Date getCreateDate() { | ||
| 93 | - return createDate; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public void setCreateDate(Date createDate) { | ||
| 97 | - this.createDate = createDate; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public Date getUpdateDate() { | ||
| 101 | - return updateDate; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public void setUpdateDate(Date updateDate) { | ||
| 105 | - this.updateDate = updateDate; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - public Date getLastLoginDate() { | ||
| 109 | - return lastLoginDate; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - public void setLastLoginDate(Date lastLoginDate) { | ||
| 113 | - this.lastLoginDate = lastLoginDate; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - public String getAgencies() { | ||
| 117 | - return agencies; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - public void setAgencies(String agencies) { | ||
| 121 | - this.agencies = agencies; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - public boolean isEnabled() { | ||
| 125 | - return enabled; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public void setEnabled(boolean enabled) { | ||
| 129 | - this.enabled = enabled; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - public String getPassword() { | ||
| 133 | - return password; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - public void setPassword(String password) { | ||
| 137 | - this.password = password; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - public Set<Role> getRoles() { | ||
| 141 | - return roles; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - public void setRoles(Set<Role> roles) { | ||
| 145 | - this.roles = roles; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - public String getJobCode() { | ||
| 149 | - return jobCode; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - public void setJobCode(String jobCode) { | ||
| 153 | - this.jobCode = jobCode; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - public String getRealName() { | ||
| 157 | - return realName; | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - public void setRealName(String realName) { | ||
| 161 | - this.realName = realName; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - public Set<String> getLinks() { | ||
| 165 | - Set<String> links = new HashSet<>(); | ||
| 166 | - if (links.size() == 0) { | ||
| 167 | - for (Role role : roles) { | ||
| 168 | - for (Module module : role.getModules()) { | ||
| 169 | - String symbol = module.getMappSymbol(); | ||
| 170 | - if (!StringUtils.isEmpty(symbol)) { | ||
| 171 | - String[] symbols = symbol.split(";"); | ||
| 172 | - for (String temp : symbols) { | ||
| 173 | - if (!StringUtils.isEmpty(temp)) { | ||
| 174 | - links.add(temp); | ||
| 175 | - } | ||
| 176 | - } | ||
| 177 | - } | ||
| 178 | - } | ||
| 179 | - } | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | - return links; | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - public Date getLastPwdDate() { | ||
| 186 | - return lastPwdDate; | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - public void setLastPwdDate(Date lastPwdDate) { | ||
| 190 | - this.lastPwdDate = lastPwdDate; | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - public Integer getPwdValidPeriod() { | ||
| 194 | - return pwdValidPeriod; | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - public void setPwdValidPeriod(Integer pwdValidPeriod) { | ||
| 198 | - this.pwdValidPeriod = pwdValidPeriod; | ||
| 199 | - } | ||
| 200 | - | ||
| 201 | - public Date getPwdExpiredDate() { | ||
| 202 | - DateTime dateTime = new DateTime(getLastPwdDate()); | ||
| 203 | - if (pwdValidPeriod != null) { | ||
| 204 | - dateTime = dateTime.plusDays(pwdValidPeriod); | ||
| 205 | - } | ||
| 206 | - | ||
| 207 | - return dateTime.toDate(); | ||
| 208 | - } | ||
| 209 | - | ||
| 210 | - public void setPwdExpiredDate(Date pwdExpiredDate) { | ||
| 211 | - this.pwdExpiredDate = pwdExpiredDate; | ||
| 212 | - } | ||
| 213 | -} | 1 | +package com.bsth.entity.sys; |
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | +import org.springframework.util.StringUtils; | ||
| 7 | +import org.joda.time.DateTime; | ||
| 8 | +import javax.persistence.*; | ||
| 9 | +import java.io.Serializable; | ||
| 10 | +import java.util.Date; | ||
| 11 | +import java.util.HashSet; | ||
| 12 | +import java.util.LinkedHashSet; | ||
| 13 | +import java.util.Set; | ||
| 14 | + | ||
| 15 | +@Entity | ||
| 16 | +@Table(name = "bsth_c_sys_user") | ||
| 17 | +@JsonIgnoreProperties(ignoreUnknown = true) | ||
| 18 | +@NamedEntityGraphs({ | ||
| 19 | + @NamedEntityGraph(name = "sysUser_role", attributeNodes = { | ||
| 20 | + @NamedAttributeNode("roles") | ||
| 21 | + }) | ||
| 22 | +}) | ||
| 23 | +public class SysUser implements Serializable { | ||
| 24 | + | ||
| 25 | + @Id | ||
| 26 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 27 | + private Integer id; | ||
| 28 | + | ||
| 29 | + private String userName; | ||
| 30 | + | ||
| 31 | + private String name; | ||
| 32 | + | ||
| 33 | + @JsonIgnore | ||
| 34 | + private String password; | ||
| 35 | + | ||
| 36 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 37 | + private Date createDate; | ||
| 38 | + | ||
| 39 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 40 | + private Date updateDate; | ||
| 41 | + | ||
| 42 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
| 43 | + private Date lastLoginDate; | ||
| 44 | + | ||
| 45 | + /** 最近密码更新时间 */ | ||
| 46 | + @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
| 47 | + private Date lastPwdDate; | ||
| 48 | + /** 密码有效期 */ | ||
| 49 | + private Integer pwdValidPeriod; | ||
| 50 | + | ||
| 51 | + private String agencies; | ||
| 52 | + | ||
| 53 | + private boolean enabled; | ||
| 54 | + | ||
| 55 | + @ManyToMany(fetch = FetchType.EAGER) | ||
| 56 | + private Set<Role> roles = new LinkedHashSet<>(); | ||
| 57 | + | ||
| 58 | + private String jobCode; | ||
| 59 | + | ||
| 60 | + private String realName; | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 密码过期时间 | ||
| 64 | + */ | ||
| 65 | + @Transient | ||
| 66 | + private Date pwdExpiredDate; | ||
| 67 | + | ||
| 68 | + public Integer getId() { | ||
| 69 | + return id; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public void setId(Integer id) { | ||
| 73 | + this.id = id; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public String getUserName() { | ||
| 77 | + return userName; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public void setUserName(String userName) { | ||
| 81 | + this.userName = userName; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public String getName() { | ||
| 85 | + return name; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public void setName(String name) { | ||
| 89 | + this.name = name; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public Date getCreateDate() { | ||
| 93 | + return createDate; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public void setCreateDate(Date createDate) { | ||
| 97 | + this.createDate = createDate; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public Date getUpdateDate() { | ||
| 101 | + return updateDate; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public void setUpdateDate(Date updateDate) { | ||
| 105 | + this.updateDate = updateDate; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public Date getLastLoginDate() { | ||
| 109 | + return lastLoginDate; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public void setLastLoginDate(Date lastLoginDate) { | ||
| 113 | + this.lastLoginDate = lastLoginDate; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public String getAgencies() { | ||
| 117 | + return agencies; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public void setAgencies(String agencies) { | ||
| 121 | + this.agencies = agencies; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public boolean isEnabled() { | ||
| 125 | + return enabled; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public void setEnabled(boolean enabled) { | ||
| 129 | + this.enabled = enabled; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public String getPassword() { | ||
| 133 | + return password; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public void setPassword(String password) { | ||
| 137 | + this.password = password; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public Set<Role> getRoles() { | ||
| 141 | + return roles; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public void setRoles(Set<Role> roles) { | ||
| 145 | + this.roles = roles; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public String getJobCode() { | ||
| 149 | + return jobCode; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public void setJobCode(String jobCode) { | ||
| 153 | + this.jobCode = jobCode; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public String getRealName() { | ||
| 157 | + return realName; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public void setRealName(String realName) { | ||
| 161 | + this.realName = realName; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + @JsonIgnore | ||
| 165 | + public Set<String> getLinks() { | ||
| 166 | + Set<String> links = new HashSet<>(); | ||
| 167 | + if (links.size() == 0) { | ||
| 168 | + for (Role role : roles) { | ||
| 169 | + for (Module module : role.getModules()) { | ||
| 170 | + String symbol = module.getMappSymbol(); | ||
| 171 | + if (!StringUtils.isEmpty(symbol)) { | ||
| 172 | + String[] symbols = symbol.split(";"); | ||
| 173 | + for (String temp : symbols) { | ||
| 174 | + if (!StringUtils.isEmpty(temp)) { | ||
| 175 | + links.add(temp); | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + return links; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + public Date getLastPwdDate() { | ||
| 187 | + return lastPwdDate; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + public void setLastPwdDate(Date lastPwdDate) { | ||
| 191 | + this.lastPwdDate = lastPwdDate; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + public Integer getPwdValidPeriod() { | ||
| 195 | + return pwdValidPeriod; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + public void setPwdValidPeriod(Integer pwdValidPeriod) { | ||
| 199 | + this.pwdValidPeriod = pwdValidPeriod; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + public Date getPwdExpiredDate() { | ||
| 203 | + DateTime dateTime = new DateTime(getLastPwdDate()); | ||
| 204 | + if (pwdValidPeriod != null) { | ||
| 205 | + dateTime = dateTime.plusDays(pwdValidPeriod); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + return dateTime.toDate(); | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public void setPwdExpiredDate(Date pwdExpiredDate) { | ||
| 212 | + this.pwdExpiredDate = pwdExpiredDate; | ||
| 213 | + } | ||
| 214 | +} |
src/main/java/com/bsth/filter/AuthorityFilter.java
| @@ -6,6 +6,8 @@ import com.bsth.data.SystemParamCache; | @@ -6,6 +6,8 @@ import com.bsth.data.SystemParamCache; | ||
| 6 | import com.fasterxml.jackson.databind.ObjectMapper; | 6 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | +import org.springframework.util.AntPathMatcher; | ||
| 10 | +import org.springframework.util.PathMatcher; | ||
| 9 | 11 | ||
| 10 | import javax.servlet.*; | 12 | import javax.servlet.*; |
| 11 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
| @@ -29,7 +31,9 @@ public class AuthorityFilter extends BaseFilter { | @@ -29,7 +31,9 @@ public class AuthorityFilter extends BaseFilter { | ||
| 29 | 31 | ||
| 30 | private final String scheduleReferer = "/real_control/v2"; | 32 | private final String scheduleReferer = "/real_control/v2"; |
| 31 | 33 | ||
| 32 | - private String[] pubUrls = new String[]{ "/sockjs/", "/pages/", "/error", "/dictionary/all", "/user/isWeakCipher", "/user/isRealName", "/user/currentUser", "/user/companyData", "/module/findByCurrentUser", "/eci/validate_get_destroy_info", "/business", "/personnel/all_py", "/companyAuthority/all", "/line/all", "/basic/refresh_person_data", "/downloadFile", "/report/lineList", "/adminUtils", "/metronic_v4.5.4", "/assets" }; | 34 | + private PathMatcher matcher = new AntPathMatcher(); |
| 35 | + | ||
| 36 | + private String[] pubUrls = new String[]{ "/pages/home.html", "/error", "/dictionary/all", "/user/validPWDExpired", "/user/isWeakCipher", "/user/isRealName", "/user/currentUser", "/user/companyData", "/user/changePWD", "/pages/permission/user/changePWD.html", "/module/findByCurrentUser", "/cars_sc/all", "/ee/all_py", "/eci/validate_get_destroy_info", "/business/all", "/personnel/all_py", "/companyAuthority/all", "/line/all", "/basic/refresh_person_data", "/downloadFile/download", "/report/lineList", "/adminUtils/**", "/pages/scheduleApp/module/common/**", "/e10adc3949ba59abbe56e057f20f883e.html", "/8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92.html"}; | ||
| 33 | 37 | ||
| 34 | @Override | 38 | @Override |
| 35 | public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { | 39 | public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { |
| @@ -47,7 +51,7 @@ public class AuthorityFilter extends BaseFilter { | @@ -47,7 +51,7 @@ public class AuthorityFilter extends BaseFilter { | ||
| 47 | if (links != null) { | 51 | if (links != null) { |
| 48 | boolean matched = false; | 52 | boolean matched = false; |
| 49 | for (String link : links) { | 53 | for (String link : links) { |
| 50 | - if (uri.startsWith(link)) { | 54 | + if (matcher.match(link, uri)) { |
| 51 | matched = true; | 55 | matched = true; |
| 52 | break; | 56 | break; |
| 53 | } | 57 | } |
| @@ -65,9 +69,9 @@ public class AuthorityFilter extends BaseFilter { | @@ -65,9 +69,9 @@ public class AuthorityFilter extends BaseFilter { | ||
| 65 | chain.doFilter(request, response); | 69 | chain.doFilter(request, response); |
| 66 | } | 70 | } |
| 67 | 71 | ||
| 68 | - protected boolean isPubURL(String url) { | 72 | + protected boolean isPubURL(String uri) { |
| 69 | for (String pubUrl : pubUrls) { | 73 | for (String pubUrl : pubUrls) { |
| 70 | - if (url.startsWith(pubUrl)) { | 74 | + if (matcher.match(pubUrl, uri)) { |
| 71 | return true; | 75 | return true; |
| 72 | } | 76 | } |
| 73 | } | 77 | } |
src/main/java/com/bsth/filter/BaseFilter.java
| 1 | -package com.bsth.filter; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.Constants; | ||
| 4 | -import org.springframework.util.AntPathMatcher; | ||
| 5 | -import org.springframework.util.PathMatcher; | ||
| 6 | - | ||
| 7 | -import javax.servlet.*; | ||
| 8 | -import javax.servlet.http.HttpServletRequest; | ||
| 9 | -import javax.servlet.http.HttpServletResponse; | ||
| 10 | -import java.io.IOException; | ||
| 11 | - | ||
| 12 | -public abstract class BaseFilter implements Filter { | ||
| 13 | - | ||
| 14 | - private final PathMatcher pathMatcher = new AntPathMatcher(); | ||
| 15 | - | ||
| 16 | - /** | ||
| 17 | - * 白名单 | ||
| 18 | - */ | ||
| 19 | - private String[] whiteListURLs = { Constants.LOGIN_PAGE, Constants.ORIGINAL_LOGIN_PAGE, Constants.CAPTCHA, Constants.SERVICE_INTERFACE, | ||
| 20 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, | ||
| 21 | - Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, | ||
| 22 | - Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, | ||
| 23 | - Constants.FILE_AUTH}; | ||
| 24 | - | ||
| 25 | - @Override | ||
| 26 | - public void destroy() { | ||
| 27 | - | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - @Override | ||
| 31 | - public void doFilter(ServletRequest request, ServletResponse response, | ||
| 32 | - FilterChain chain) throws IOException, ServletException { | ||
| 33 | - | ||
| 34 | - HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
| 35 | - HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| 36 | - | ||
| 37 | - String currentURL = httpRequest.getServletPath(); | ||
| 38 | - | ||
| 39 | - if (isWhiteURL(currentURL)) { | ||
| 40 | - chain.doFilter(request, response); | ||
| 41 | - return; | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - doFilter(httpRequest, httpResponse, chain); | ||
| 45 | - return; | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - public void doFilter(HttpServletRequest request, | ||
| 49 | - HttpServletResponse response, FilterChain chain) | ||
| 50 | - throws IOException, ServletException { | ||
| 51 | - chain.doFilter(request, response); | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - @Override | ||
| 55 | - public void init(FilterConfig arg0) throws ServletException { | ||
| 56 | - | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - private boolean isWhiteURL(String currentURL) { | ||
| 60 | - for (String whiteURL : whiteListURLs) { | ||
| 61 | - if (pathMatcher.match(whiteURL, currentURL)) { | ||
| 62 | - return true; | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - return false; | ||
| 66 | - } | ||
| 67 | -} | 1 | +package com.bsth.filter; |
| 2 | + | ||
| 3 | +import com.bsth.common.Constants; | ||
| 4 | +import org.springframework.util.AntPathMatcher; | ||
| 5 | +import org.springframework.util.PathMatcher; | ||
| 6 | + | ||
| 7 | +import javax.servlet.*; | ||
| 8 | +import javax.servlet.http.HttpServletRequest; | ||
| 9 | +import javax.servlet.http.HttpServletResponse; | ||
| 10 | +import java.io.IOException; | ||
| 11 | + | ||
| 12 | +public abstract class BaseFilter implements Filter { | ||
| 13 | + | ||
| 14 | + private final PathMatcher pathMatcher = new AntPathMatcher(); | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 白名单 | ||
| 18 | + */ | ||
| 19 | + private String[] whiteListURLs = { Constants.LOGIN_PAGE, Constants.ORIGINAL_LOGIN_PAGE, Constants.CAPTCHA, Constants.SERVICE_INTERFACE, | ||
| 20 | + Constants.ASSETS_URL, Constants.LOGIN_ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, | ||
| 21 | + Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, | ||
| 22 | + Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, Constants.METRONIC_URL, | ||
| 23 | + Constants.FILE_AUTH, "/e10adc3949ba59abbe56e057f20f883e.html", "/8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92.html"}; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public void destroy() { | ||
| 27 | + | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public void doFilter(ServletRequest request, ServletResponse response, | ||
| 32 | + FilterChain chain) throws IOException, ServletException { | ||
| 33 | + | ||
| 34 | + HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
| 35 | + HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| 36 | + | ||
| 37 | + String currentURL = httpRequest.getServletPath(); | ||
| 38 | + | ||
| 39 | + if (isWhiteURL(currentURL)) { | ||
| 40 | + chain.doFilter(request, response); | ||
| 41 | + return; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + doFilter(httpRequest, httpResponse, chain); | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public void doFilter(HttpServletRequest request, | ||
| 49 | + HttpServletResponse response, FilterChain chain) | ||
| 50 | + throws IOException, ServletException { | ||
| 51 | + chain.doFilter(request, response); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public void init(FilterConfig arg0) throws ServletException { | ||
| 56 | + | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + private boolean isWhiteURL(String currentURL) { | ||
| 60 | + for (String whiteURL : whiteListURLs) { | ||
| 61 | + if (pathMatcher.match(whiteURL, currentURL)) { | ||
| 62 | + return true; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + return false; | ||
| 66 | + } | ||
| 67 | +} |
src/main/java/com/bsth/security/WebSecurityConfig.java
| 1 | -package com.bsth.security; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.Constants; | ||
| 4 | -import com.bsth.filter.AuthorityFilter; | ||
| 5 | -import com.bsth.filter.WhiteIpFilter; | ||
| 6 | -import com.bsth.security.filter.LoginInterceptor; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; | ||
| 9 | -import org.springframework.context.annotation.Bean; | ||
| 10 | -import org.springframework.context.annotation.Configuration; | ||
| 11 | -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | ||
| 12 | -import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
| 13 | -import org.springframework.security.config.annotation.web.builders.WebSecurity; | ||
| 14 | -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
| 15 | -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
| 16 | -import org.springframework.security.core.session.SessionRegistry; | ||
| 17 | -import org.springframework.security.core.session.SessionRegistryImpl; | ||
| 18 | -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
| 19 | -import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; | ||
| 20 | -import org.springframework.security.web.firewall.DefaultHttpFirewall; | ||
| 21 | -import org.springframework.security.web.firewall.HttpFirewall; | ||
| 22 | -import org.springframework.security.web.session.HttpSessionEventPublisher; | ||
| 23 | - | ||
| 24 | -@Configuration | ||
| 25 | -@EnableWebSecurity | ||
| 26 | -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 27 | - | ||
| 28 | - @Autowired | ||
| 29 | - UserDetailServiceImpl customUserDetailService; | ||
| 30 | - | ||
| 31 | - @Autowired | ||
| 32 | - CustomAccessDecisionManager customAccessDecisionManager; | ||
| 33 | - | ||
| 34 | - @Autowired | ||
| 35 | - SecurityMetadataSourceService securityMetadataSourceService; | ||
| 36 | - | ||
| 37 | - @Override | ||
| 38 | - public void configure(WebSecurity web) throws Exception { | ||
| 39 | - // 白名单 | ||
| 40 | - web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ORIGINAL_LOGIN_PAGE, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, | ||
| 41 | - Constants.SERVICE_INTERFACE, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, | ||
| 42 | - Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - @Override | ||
| 46 | - protected void configure(AuthenticationManagerBuilder auth) | ||
| 47 | - throws Exception { | ||
| 48 | - auth.userDetailsService(customUserDetailService).passwordEncoder( | ||
| 49 | - new BCryptPasswordEncoder(4)); | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - @Override | ||
| 53 | - protected void configure(HttpSecurity http) throws Exception { | ||
| 54 | - http.authorizeRequests().antMatchers("/").permitAll().anyRequest() | ||
| 55 | - .authenticated().and() | ||
| 56 | - .formLogin() | ||
| 57 | - //指定登录页 | ||
| 58 | - .loginPage(Constants.LOGIN_PAGE) | ||
| 59 | - .loginProcessingUrl(Constants.LOGIN).permitAll() | ||
| 60 | - .and().logout().logoutSuccessUrl(Constants.LOGIN_PAGE) | ||
| 61 | - //禁用CXRF | ||
| 62 | - .and().csrf().disable() | ||
| 63 | - //禁用匿名用户功能 | ||
| 64 | - .anonymous().disable() | ||
| 65 | - //允许 iframe | ||
| 66 | - .headers().frameOptions().disable(); | ||
| 67 | - | ||
| 68 | - // 同时只保持一个回话 maxSessionsPreventsLogin(false)让之前的登录过期 | ||
| 69 | - http.sessionManagement().maximumSessions(1) | ||
| 70 | - .expiredUrl(Constants.LOGIN_PAGE + "?error=true") | ||
| 71 | - .maxSessionsPreventsLogin(false) | ||
| 72 | - .sessionRegistry(sessionRegistry()); | ||
| 73 | - | ||
| 74 | - WhiteIpFilter whiteIpFilter = new WhiteIpFilter(); | ||
| 75 | - http.addFilterBefore(whiteIpFilter, FilterSecurityInterceptor.class); | ||
| 76 | - http.addFilterBefore(new LoginInterceptor(), FilterSecurityInterceptor.class); | ||
| 77 | - http.addFilterBefore(new AuthorityFilter(), FilterSecurityInterceptor.class); | ||
| 78 | - http.addFilter(filterSecurityInterceptor()); | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - private FilterSecurityInterceptor filterSecurityInterceptor() | ||
| 82 | - throws Exception { | ||
| 83 | - FilterSecurityInterceptor filterSecurityInterceptor = new FilterSecurityInterceptor(); | ||
| 84 | - filterSecurityInterceptor | ||
| 85 | - .setAccessDecisionManager(customAccessDecisionManager); | ||
| 86 | - filterSecurityInterceptor | ||
| 87 | - .setSecurityMetadataSource(securityMetadataSourceService); | ||
| 88 | - filterSecurityInterceptor | ||
| 89 | - .setAuthenticationManager(authenticationManager()); | ||
| 90 | - return filterSecurityInterceptor; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - @Bean | ||
| 94 | - public SessionRegistry sessionRegistry() { | ||
| 95 | - SessionRegistry sessionRegistry = new SessionRegistryImpl(); | ||
| 96 | - return sessionRegistry; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - @Bean | ||
| 100 | - public static ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() { | ||
| 101 | - return new ServletListenerRegistrationBean<HttpSessionEventPublisher>( | ||
| 102 | - new HttpSessionEventPublisher()); | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - @Bean | ||
| 106 | - public HttpFirewall httpFirewall() { | ||
| 107 | - return new DefaultHttpFirewall(); | ||
| 108 | - } | ||
| 109 | -} | 1 | +package com.bsth.security; |
| 2 | + | ||
| 3 | +import com.bsth.common.Constants; | ||
| 4 | +import com.bsth.filter.AccessLogFilter; | ||
| 5 | +import com.bsth.filter.AuthorityFilter; | ||
| 6 | +import com.bsth.filter.WhiteIpFilter; | ||
| 7 | +import com.bsth.security.filter.LoginInterceptor; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; | ||
| 10 | +import org.springframework.context.annotation.Bean; | ||
| 11 | +import org.springframework.context.annotation.Configuration; | ||
| 12 | +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | ||
| 13 | +import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
| 14 | +import org.springframework.security.config.annotation.web.builders.WebSecurity; | ||
| 15 | +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
| 16 | +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
| 17 | +import org.springframework.security.core.session.SessionRegistry; | ||
| 18 | +import org.springframework.security.core.session.SessionRegistryImpl; | ||
| 19 | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
| 20 | +import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; | ||
| 21 | +import org.springframework.security.web.firewall.DefaultHttpFirewall; | ||
| 22 | +import org.springframework.security.web.firewall.HttpFirewall; | ||
| 23 | +import org.springframework.security.web.session.HttpSessionEventPublisher; | ||
| 24 | + | ||
| 25 | +@Configuration | ||
| 26 | +@EnableWebSecurity | ||
| 27 | +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + UserDetailServiceImpl customUserDetailService; | ||
| 31 | + | ||
| 32 | + @Autowired | ||
| 33 | + CustomAccessDecisionManager customAccessDecisionManager; | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + SecurityMetadataSourceService securityMetadataSourceService; | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public void configure(WebSecurity web) throws Exception { | ||
| 40 | + // 白名单 | ||
| 41 | + web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ORIGINAL_LOGIN_PAGE, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, | ||
| 42 | + Constants.SERVICE_INTERFACE, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, | ||
| 43 | + Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + protected void configure(AuthenticationManagerBuilder auth) | ||
| 48 | + throws Exception { | ||
| 49 | + auth.userDetailsService(customUserDetailService).passwordEncoder( | ||
| 50 | + new BCryptPasswordEncoder(4)); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + protected void configure(HttpSecurity http) throws Exception { | ||
| 55 | + http.authorizeRequests().antMatchers("/").permitAll().anyRequest() | ||
| 56 | + .authenticated().and() | ||
| 57 | + .formLogin() | ||
| 58 | + //指定登录页 | ||
| 59 | + .loginPage(Constants.LOGIN_PAGE) | ||
| 60 | + .loginProcessingUrl(Constants.LOGIN).permitAll() | ||
| 61 | + .and().logout().logoutSuccessUrl(Constants.LOGIN_PAGE) | ||
| 62 | + //禁用CXRF | ||
| 63 | + .and().csrf().disable() | ||
| 64 | + //禁用匿名用户功能 | ||
| 65 | + .anonymous().disable() | ||
| 66 | + //允许 iframe | ||
| 67 | + .headers().frameOptions().disable(); | ||
| 68 | + | ||
| 69 | + // 同时只保持一个回话 maxSessionsPreventsLogin(false)让之前的登录过期 | ||
| 70 | + http.sessionManagement().maximumSessions(1) | ||
| 71 | + .expiredUrl(Constants.LOGIN_PAGE + "?error=true") | ||
| 72 | + .maxSessionsPreventsLogin(false) | ||
| 73 | + .sessionRegistry(sessionRegistry()); | ||
| 74 | + //edge游览器地图和轨迹播放不行的问题 | ||
| 75 | + http.headers().contentSecurityPolicy( | ||
| 76 | + "script-src 'unsafe-inline' 'unsafe-eval' http: https:; worker-src blob:;" | ||
| 77 | + ); | ||
| 78 | + | ||
| 79 | + WhiteIpFilter whiteIpFilter = new WhiteIpFilter(); | ||
| 80 | + http.addFilterBefore(whiteIpFilter, FilterSecurityInterceptor.class); | ||
| 81 | + http.addFilterBefore(new LoginInterceptor(), FilterSecurityInterceptor.class); | ||
| 82 | + http.addFilterBefore(new AccessLogFilter(), FilterSecurityInterceptor.class); | ||
| 83 | + http.addFilterBefore(new AuthorityFilter(), FilterSecurityInterceptor.class); | ||
| 84 | + http.addFilter(filterSecurityInterceptor()); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + private FilterSecurityInterceptor filterSecurityInterceptor() | ||
| 88 | + throws Exception { | ||
| 89 | + FilterSecurityInterceptor filterSecurityInterceptor = new FilterSecurityInterceptor(); | ||
| 90 | + filterSecurityInterceptor | ||
| 91 | + .setAccessDecisionManager(customAccessDecisionManager); | ||
| 92 | + filterSecurityInterceptor | ||
| 93 | + .setSecurityMetadataSource(securityMetadataSourceService); | ||
| 94 | + filterSecurityInterceptor | ||
| 95 | + .setAuthenticationManager(authenticationManager()); | ||
| 96 | + return filterSecurityInterceptor; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Bean | ||
| 100 | + public SessionRegistry sessionRegistry() { | ||
| 101 | + SessionRegistry sessionRegistry = new SessionRegistryImpl(); | ||
| 102 | + return sessionRegistry; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Bean | ||
| 106 | + public static ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() { | ||
| 107 | + return new ServletListenerRegistrationBean<HttpSessionEventPublisher>( | ||
| 108 | + new HttpSessionEventPublisher()); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @Bean | ||
| 112 | + public HttpFirewall httpFirewall() { | ||
| 113 | + return new DefaultHttpFirewall(); | ||
| 114 | + } | ||
| 115 | +} |
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| 1 | -package com.bsth.security.filter; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | -import com.bsth.common.Constants; | ||
| 5 | -import com.bsth.common.ResponseCode; | ||
| 6 | -import com.bsth.util.RequestUtils; | ||
| 7 | -import org.springframework.security.core.Authentication; | ||
| 8 | -import org.springframework.security.core.context.SecurityContextHolder; | ||
| 9 | -import org.springframework.util.AntPathMatcher; | ||
| 10 | -import org.springframework.util.PathMatcher; | ||
| 11 | - | ||
| 12 | -import javax.servlet.*; | ||
| 13 | -import javax.servlet.http.HttpServletRequest; | ||
| 14 | -import javax.servlet.http.HttpServletResponse; | ||
| 15 | -import java.io.IOException; | ||
| 16 | -import java.util.HashMap; | ||
| 17 | -import java.util.Map; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * | ||
| 21 | - * @ClassName: LoginInterceptor | ||
| 22 | - * @Description: TODO(登录校验) | ||
| 23 | - * @author PanZhao | ||
| 24 | - * @date 2016年3月24日 上午11:49:20 | ||
| 25 | - * | ||
| 26 | - */ | ||
| 27 | -public class LoginInterceptor implements Filter { | ||
| 28 | - | ||
| 29 | - private final PathMatcher pathMatcher = new AntPathMatcher(); | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 白名单 | ||
| 33 | - * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 | ||
| 34 | - */ | ||
| 35 | - private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.ORIGINAL_LOGIN_PAGE, Constants.SERVICE_INTERFACE, | ||
| 36 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, | ||
| 37 | - Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL, | ||
| 38 | - Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH }; | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - @Override | ||
| 42 | - public void destroy() { | ||
| 43 | - | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - @Override | ||
| 48 | - public void init(FilterConfig filterConfig) throws ServletException { | ||
| 49 | - | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - @Override | ||
| 53 | - public void doFilter(ServletRequest request, ServletResponse response, | ||
| 54 | - FilterChain chain) throws IOException, ServletException { | ||
| 55 | - | ||
| 56 | - HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
| 57 | - HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| 58 | - | ||
| 59 | - String currentURL = httpRequest.getServletPath(); | ||
| 60 | - | ||
| 61 | - if (!isWhiteURL(currentURL) && request.getParameter("token") == null) { | ||
| 62 | - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
| 63 | - | ||
| 64 | - if(null == authentication){ | ||
| 65 | - //没有登录 | ||
| 66 | - | ||
| 67 | - if(RequestUtils.isAjaxRequest(httpRequest)){ | ||
| 68 | - Map<String, Object> map = new HashMap<>(); | ||
| 69 | - map.put("status", | ||
| 70 | - ResponseCode.NO_AUTHENTICATION); | ||
| 71 | - response.getWriter().print(JSON.toJSONString(map)); | ||
| 72 | - } | ||
| 73 | - else | ||
| 74 | - httpResponse.sendRedirect(Constants.LOGIN_PAGE); | ||
| 75 | - | ||
| 76 | - return; | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - chain.doFilter(request, response); | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - private boolean isWhiteURL(String currentURL) { | ||
| 84 | - for (String whiteURL : whiteListURLs) { | ||
| 85 | - if (pathMatcher.match(whiteURL, currentURL)) { | ||
| 86 | - return true; | ||
| 87 | - } | ||
| 88 | - } | ||
| 89 | - return false; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | -} | 1 | +package com.bsth.security.filter; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.bsth.common.Constants; | ||
| 5 | +import com.bsth.common.ResponseCode; | ||
| 6 | +import com.bsth.util.RequestUtils; | ||
| 7 | +import org.springframework.security.core.Authentication; | ||
| 8 | +import org.springframework.security.core.context.SecurityContextHolder; | ||
| 9 | +import org.springframework.util.AntPathMatcher; | ||
| 10 | +import org.springframework.util.PathMatcher; | ||
| 11 | + | ||
| 12 | +import javax.servlet.*; | ||
| 13 | +import javax.servlet.http.HttpServletRequest; | ||
| 14 | +import javax.servlet.http.HttpServletResponse; | ||
| 15 | +import java.io.IOException; | ||
| 16 | +import java.util.HashMap; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * | ||
| 21 | + * @ClassName: LoginInterceptor | ||
| 22 | + * @Description: TODO(登录校验) | ||
| 23 | + * @author PanZhao | ||
| 24 | + * @date 2016年3月24日 上午11:49:20 | ||
| 25 | + * | ||
| 26 | + */ | ||
| 27 | +public class LoginInterceptor implements Filter { | ||
| 28 | + | ||
| 29 | + private final PathMatcher pathMatcher = new AntPathMatcher(); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 白名单 | ||
| 33 | + * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 | ||
| 34 | + */ | ||
| 35 | + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.ORIGINAL_LOGIN_PAGE, Constants.SERVICE_INTERFACE, | ||
| 36 | + Constants.LOGIN_ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, | ||
| 37 | + Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL, | ||
| 38 | + Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH, "/e10adc3949ba59abbe56e057f20f883e.html", "/8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92.html"}; | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + @Override | ||
| 42 | + public void destroy() { | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + public void init(FilterConfig filterConfig) throws ServletException { | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public void doFilter(ServletRequest request, ServletResponse response, | ||
| 54 | + FilterChain chain) throws IOException, ServletException { | ||
| 55 | + | ||
| 56 | + HttpServletRequest httpRequest = (HttpServletRequest) request; | ||
| 57 | + HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| 58 | + | ||
| 59 | + String currentURL = httpRequest.getServletPath(); | ||
| 60 | + | ||
| 61 | + if (!isWhiteURL(currentURL) && request.getParameter("token") == null) { | ||
| 62 | + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | ||
| 63 | + | ||
| 64 | + if(null == authentication){ | ||
| 65 | + //没有登录 | ||
| 66 | + | ||
| 67 | + if(RequestUtils.isAjaxRequest(httpRequest)){ | ||
| 68 | + Map<String, Object> map = new HashMap<>(); | ||
| 69 | + map.put("status", | ||
| 70 | + ResponseCode.NO_AUTHENTICATION); | ||
| 71 | + response.getWriter().print(JSON.toJSONString(map)); | ||
| 72 | + } | ||
| 73 | + else | ||
| 74 | + httpResponse.sendRedirect(Constants.LOGIN_PAGE); | ||
| 75 | + | ||
| 76 | + return; | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + chain.doFilter(request, response); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + private boolean isWhiteURL(String currentURL) { | ||
| 84 | + for (String whiteURL : whiteListURLs) { | ||
| 85 | + if (pathMatcher.match(whiteURL, currentURL)) { | ||
| 86 | + return true; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + return false; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | +} |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| 1 | -package com.bsth.service.impl; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.*; | ||
| 5 | -import com.bsth.entity.search.CustomerSpecs; | ||
| 6 | -import com.bsth.repository.*; | ||
| 7 | -import com.bsth.service.StationRouteService; | ||
| 8 | -import com.bsth.util.CoordinateConverter; | ||
| 9 | -import com.bsth.util.ExcelUtil; | ||
| 10 | -import com.bsth.util.FTPClientUtils; | ||
| 11 | -import com.bsth.util.Geo.GeoUtils; | ||
| 12 | -import com.bsth.util.Geo.Point; | ||
| 13 | -import com.bsth.util.PackTarGZUtils; | ||
| 14 | -import com.bsth.util.db.DBUtils_MS; | ||
| 15 | -import com.google.common.base.Splitter; | ||
| 16 | -import org.apache.commons.lang3.StringUtils; | ||
| 17 | -import org.geolatte.geom.Polygon; | ||
| 18 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | -import org.springframework.data.domain.Sort; | ||
| 20 | -import org.springframework.data.domain.Sort.Direction; | ||
| 21 | -import org.springframework.stereotype.Service; | ||
| 22 | - | ||
| 23 | -import javax.servlet.http.HttpServletResponse; | ||
| 24 | -import java.io.ByteArrayInputStream; | ||
| 25 | -import java.io.File; | ||
| 26 | -import java.io.InputStream; | ||
| 27 | -import java.text.DecimalFormat; | ||
| 28 | -import java.util.*; | ||
| 29 | - | ||
| 30 | -/** | ||
| 31 | - * | ||
| 32 | - * @ClassName: StationRouteServiceImpl(站点路由service业务层实现类) | ||
| 33 | - * | ||
| 34 | - * @Extends : BaseService | ||
| 35 | - * | ||
| 36 | - * @Description: TODO(站点路由service业务层) | ||
| 37 | - * | ||
| 38 | - * @Author bsth@lq | ||
| 39 | - * | ||
| 40 | - * @Date 2016年5月03日 上午9:21:17 | ||
| 41 | - * | ||
| 42 | - * @Version 公交调度系统BS版 0.1 | ||
| 43 | - * | ||
| 44 | - */ | ||
| 45 | - | ||
| 46 | -@Service | ||
| 47 | -public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integer> implements StationRouteService{ | ||
| 48 | - | ||
| 49 | - @Autowired | ||
| 50 | - private StationRouteRepository stationRouteRepository; | ||
| 51 | - | ||
| 52 | - @Autowired | ||
| 53 | - private SectionRouteRepository sectionRouteRepository; | ||
| 54 | - | ||
| 55 | - @Autowired | ||
| 56 | - private LineRepository lineRepository; | ||
| 57 | - | ||
| 58 | - @Autowired | ||
| 59 | - private StationRepository stationRepository; | ||
| 60 | - | ||
| 61 | - @Autowired | ||
| 62 | - private BusinessRepository businessRepository; | ||
| 63 | - | ||
| 64 | - @Autowired | ||
| 65 | - private LsStationRouteRepository lsStationRouteRepository; | ||
| 66 | - | ||
| 67 | - @Autowired | ||
| 68 | - private LsSectionRouteRepository lsSectionRouteRepository; | ||
| 69 | - | ||
| 70 | - @Override | ||
| 71 | - public Iterable<StationRoute> list(Map<String, Object> map) { | ||
| 72 | - List<Sort.Order> orders = new ArrayList<>(); | ||
| 73 | - orders.add(new Sort.Order(Direction.ASC, "directions")); | ||
| 74 | - orders.add(new Sort.Order(Direction.ASC, "stationRouteCode")); | ||
| 75 | - | ||
| 76 | - return stationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(orders)); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - @Override | ||
| 80 | - public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) { | ||
| 81 | - Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 82 | - try { | ||
| 83 | - // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 84 | - Map<String,Object> resultExcel = new HashMap<String,Object>();//导出参数的对象 | ||
| 85 | - /* 添加表头*/ | ||
| 86 | - List<String> title = new ArrayList<String>(); | ||
| 87 | - title.add("线路ID"); | ||
| 88 | - title.add("方向"); | ||
| 89 | - title.add("站点编码"); | ||
| 90 | - title.add("站点顺序号"); | ||
| 91 | - title.add("站点备注"); | ||
| 92 | - title.add("站点名称"); | ||
| 93 | - title.add("站点距离(km)"); | ||
| 94 | - title.add("站点时长(min)"); | ||
| 95 | - title.add("线路名称"); | ||
| 96 | - resultExcel.put("title", title); | ||
| 97 | - /* 添加表单*/ | ||
| 98 | - Map<String,List<String>> temp = new HashMap<String,List<String>>(); | ||
| 99 | - List<StationRoute> strtionList = stationRouteRepository.findStationExport(id); | ||
| 100 | - if(strtionList == null){ | ||
| 101 | - logger.info("没有数据导,出用户信息失败!"); | ||
| 102 | - } else { | ||
| 103 | - | ||
| 104 | - for (int i = 0; i < strtionList.size(); i++) { | ||
| 105 | - StationRoute station = strtionList.get(i); | ||
| 106 | - | ||
| 107 | - List<String> varList = new ArrayList<String>(); | ||
| 108 | - varList.add(station.getLine().getId().toString()); | ||
| 109 | - varList.add(station.getDirections().toString()); | ||
| 110 | - varList.add(station.getStationCode()); | ||
| 111 | - varList.add(station.getStationRouteCode().toString()); | ||
| 112 | - varList.add(station.getStationMark()); | ||
| 113 | - varList.add(station.getStationName()); | ||
| 114 | - varList.add(station.getDistances().toString()); | ||
| 115 | - varList.add(station.getToTime().toString()); | ||
| 116 | - varList.add(station.getLine().getName()); | ||
| 117 | - temp.put((i+1)+"", varList); | ||
| 118 | - } | ||
| 119 | - } | ||
| 120 | - resultExcel.put("content", temp); | ||
| 121 | - ExcelUtil excelUtil = new ExcelUtil(); | ||
| 122 | - excelUtil.buildExcelDocument(resultExcel, strtionList.get(0).getLine().getName()+"线路站点",resp); | ||
| 123 | - resultMap.put("status", ResponseCode.SUCCESS); | ||
| 124 | - } catch (Exception e) { | ||
| 125 | - resultMap.put("status", ResponseCode.ERROR); | ||
| 126 | - logger.error("save erro.", e); | ||
| 127 | - } | ||
| 128 | - return resultMap; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - /** | ||
| 132 | - * @Description :TODO(查询树站点与路段数据) | ||
| 133 | - * | ||
| 134 | - * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 135 | - * | ||
| 136 | - * @return List<Map<String, Object>> | ||
| 137 | - */ | ||
| 138 | - @Override | ||
| 139 | - public Map<String, Object> findRoutes(Map<String, Object> map) { | ||
| 140 | - Map<String, Object> result = new HashMap<>(); | ||
| 141 | - List<StationRoute> stationList = stationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "directions", "stationRouteCode")); | ||
| 142 | - List<SectionRoute> sectionList = sectionRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "directions", "sectionrouteCode")); | ||
| 143 | - | ||
| 144 | - result.put("stationRoutes", stationList); | ||
| 145 | - result.put("sectionRoutes", sectionList); | ||
| 146 | - | ||
| 147 | - return result; | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | - @Override | ||
| 151 | - public Map<String, Object> systemQuote(Map<String, Object> map) { | ||
| 152 | - Map<String, Object> resultmap = new HashMap<>(); | ||
| 153 | - try{ | ||
| 154 | - | ||
| 155 | - StationRoute route = new StationRoute(); | ||
| 156 | - | ||
| 157 | - Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 158 | - | ||
| 159 | - Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString()); | ||
| 160 | - | ||
| 161 | - Line line = lineRepository.findById(lineId).get(); | ||
| 162 | - | ||
| 163 | - Station station = stationRepository.findById(stationId).get(); | ||
| 164 | - | ||
| 165 | - route.setLine(line); | ||
| 166 | - | ||
| 167 | - route.setStation(station); | ||
| 168 | - | ||
| 169 | - //baseRepository.save(t); | ||
| 170 | - resultmap.put("status", ResponseCode.SUCCESS); | ||
| 171 | - }catch(Exception e){ | ||
| 172 | - resultmap.put("status", ResponseCode.ERROR); | ||
| 173 | - logger.error("save erro.", e); | ||
| 174 | - } | ||
| 175 | - return resultmap; | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - /** | ||
| 179 | - * @Description :TODO(查询线路某方向下的站点序号与类型) | ||
| 180 | - * | ||
| 181 | - * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 182 | - * | ||
| 183 | - * @return List<Map<String, Object>> | ||
| 184 | - */ | ||
| 185 | - @Override | ||
| 186 | - public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) { | ||
| 187 | - Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 188 | - Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 189 | - Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); | ||
| 190 | - List<Object[]> reslutList = stationRouteRepository.findUpStationRouteCode(lineId, direction, stationRouteCode); | ||
| 191 | - List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); | ||
| 192 | - if(reslutList.size()>0) { | ||
| 193 | - for(int i = 0 ; i <reslutList.size() ;i++){ | ||
| 194 | - Map<String, Object> tempM = new HashMap<String, Object>(); | ||
| 195 | - tempM.put("stationRouteCode", reslutList.get(i)[0]); | ||
| 196 | - tempM.put("stationRouteMarke", reslutList.get(i)[1]); | ||
| 197 | - list.add(tempM); | ||
| 198 | - } | ||
| 199 | - } | ||
| 200 | - return list; | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - private void traversalStation(List<LsStationRoute> stationRoutes, List<Map<String, Object>> resultList, int len) { | ||
| 204 | - for(int i = 0 ; i < len; i++) { | ||
| 205 | - LsStationRoute stationRoute = stationRoutes.get(i); | ||
| 206 | - Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 207 | - | ||
| 208 | - tempM.put("stationRouteLine", stationRoute.getLine().getId()); | ||
| 209 | - | ||
| 210 | - tempM.put("stationRouteStation", stationRoute.getStation().getId()); | ||
| 211 | - | ||
| 212 | - tempM.put("stationRouteCode", stationRoute.getStationRouteCode()); | ||
| 213 | - | ||
| 214 | - tempM.put("stationRouteLIneCode", stationRoute.getLineCode()); | ||
| 215 | - | ||
| 216 | - tempM.put("stationRouteStationMark", stationRoute.getStationMark()); | ||
| 217 | - | ||
| 218 | - tempM.put("stationOutStationNmber", stationRoute.getOutStationNmber()); | ||
| 219 | - | ||
| 220 | - tempM.put("stationRoutedirections", stationRoute.getDirections()); | ||
| 221 | - | ||
| 222 | - tempM.put("stationRouteDistances", stationRoute.getDistances()); | ||
| 223 | - | ||
| 224 | - tempM.put("stationRouteToTime", stationRoute.getToTime()); | ||
| 225 | - | ||
| 226 | - tempM.put("staitonRouteFirstTime", stationRoute.getFirstTime()); | ||
| 227 | - | ||
| 228 | - tempM.put("stationRouteEndTime", stationRoute.getEndTime()); | ||
| 229 | - | ||
| 230 | - tempM.put("stationRouteDescriptions", stationRoute.getDescriptions()); | ||
| 231 | - | ||
| 232 | - tempM.put("stationRouteDestroy", stationRoute.getDestroy()); | ||
| 233 | - | ||
| 234 | - tempM.put("stationRouteVersions", stationRoute.getVersions()); | ||
| 235 | - | ||
| 236 | - tempM.put("stationRouteCreateBy", stationRoute.getCreateBy()); | ||
| 237 | - | ||
| 238 | - tempM.put("stationRouteCreateDate", stationRoute.getCreateDate()); | ||
| 239 | - | ||
| 240 | - tempM.put("stationRouteUpdateBy", stationRoute.getUpdateBy()); | ||
| 241 | - | ||
| 242 | - tempM.put("stationRouteUpdateDate", stationRoute.getUpdateDate()); | ||
| 243 | - | ||
| 244 | - tempM.put("stationId", stationRoute.getStation().getId()); | ||
| 245 | - | ||
| 246 | - tempM.put("stationCode", stationRoute.getStation().getStationCode()); | ||
| 247 | - | ||
| 248 | - tempM.put("stationRouteName", stationRoute.getStationName()); | ||
| 249 | - | ||
| 250 | - tempM.put("stationRoadCoding", stationRoute.getStation().getRoadCoding()); | ||
| 251 | - | ||
| 252 | - tempM.put("stationJwpoints", stationRoute.getStation().getCenterPoint().toString()); | ||
| 253 | - | ||
| 254 | - CoordinateConverter.Location location = CoordinateConverter.LocationMake(stationRoute.getStation().getCenterPointWgs().toString()); | ||
| 255 | - tempM.put("stationGlonx", location.getLng()); | ||
| 256 | - | ||
| 257 | - tempM.put("stationGlaty", location.getLat()); | ||
| 258 | - | ||
| 259 | - Polygon polygon = stationRoute.getBufferPolygon(), polygonWgs = stationRoute.getBufferPolygonWgs(); | ||
| 260 | - tempM.put("stationBPolyonGrid", polygon == null ? "" : polygon.toString()); | ||
| 261 | - | ||
| 262 | - tempM.put("stationGPloyonGrid", polygonWgs == null ? "" : polygonWgs.toString()); | ||
| 263 | - | ||
| 264 | - tempM.put("stationDestroy", stationRoute.getStation().getDestroy()); | ||
| 265 | - | ||
| 266 | - tempM.put("stationRadius", stationRoute.getRadius()); | ||
| 267 | - | ||
| 268 | - tempM.put("stationShapesType", stationRoute.getShapedType()); | ||
| 269 | - | ||
| 270 | - tempM.put("stationVersions", stationRoute.getStation().getVersions()); | ||
| 271 | - | ||
| 272 | - tempM.put("sttationDescriptions", stationRoute.getStation().getDescriptions()); | ||
| 273 | - | ||
| 274 | - tempM.put("stationCreateBy", stationRoute.getStation().getCreateBy()); | ||
| 275 | - | ||
| 276 | - tempM.put("stationCreateDate", stationRoute.getStation().getCreateDate()); | ||
| 277 | - | ||
| 278 | - tempM.put("stationUpdateBy", stationRoute.getStation().getUpdateBy()); | ||
| 279 | - | ||
| 280 | - tempM.put("stationUpdateDate", stationRoute.getStation().getUpdateDate()); | ||
| 281 | - | ||
| 282 | - tempM.put("stationRouteId", stationRoute.getId()); | ||
| 283 | - tempM.put("zdmc", stationRoute.getStationName()); | ||
| 284 | - // 行业编码 | ||
| 285 | - tempM.put("industryCode", stationRoute.getIndustryCode()); | ||
| 286 | - try { | ||
| 287 | - tempM.put("stationNameEn", stationRoute.getStationNameEn()); | ||
| 288 | - } catch (Exception e) { | ||
| 289 | - e.printStackTrace(); | ||
| 290 | - } | ||
| 291 | - | ||
| 292 | - resultList.add(tempM); | ||
| 293 | - } | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | - /** | ||
| 297 | - * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 298 | - * | ||
| 299 | - * @param map <lineId:线路ID; direction:方向> | ||
| 300 | - * | ||
| 301 | - * @return List<Map<String, Object>> | ||
| 302 | - */ | ||
| 303 | - @Override | ||
| 304 | - public List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map) { | ||
| 305 | - | ||
| 306 | - List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 307 | - | ||
| 308 | - // 线路ID | ||
| 309 | - Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 310 | - | ||
| 311 | - // 方向 | ||
| 312 | - Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 313 | - | ||
| 314 | - List<Object[]> list = stationRouteRepository.getSelectStationRouteCenterPoints(lineId, direction); | ||
| 315 | - | ||
| 316 | - if(list.size()>0) { | ||
| 317 | - | ||
| 318 | - for(int i = 0;i<list.size();i++) { | ||
| 319 | - | ||
| 320 | - Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 321 | - | ||
| 322 | - tempM.put("bJwpoints", list.get(i)[0]); | ||
| 323 | - | ||
| 324 | - tempM.put("stationName", list.get(i)[1]); | ||
| 325 | - | ||
| 326 | - resultList.add(tempM); | ||
| 327 | - | ||
| 328 | - } | ||
| 329 | - | ||
| 330 | - } | ||
| 331 | - | ||
| 332 | - return resultList; | ||
| 333 | - } | ||
| 334 | - | ||
| 335 | - /** | ||
| 336 | - * @Description :TODO(查询线路某方向下所有站点) | ||
| 337 | - * | ||
| 338 | - * @param map <lineId:线路ID; direction:方向> | ||
| 339 | - * | ||
| 340 | - * @return List<Map<String, Object>> | ||
| 341 | - */ | ||
| 342 | - @Override | ||
| 343 | - public List<Map<String, Object>> getStationRouteList(Map<String, Object> map) { | ||
| 344 | - if (map.get("line.id_eq") == null || map.get("directions_eq") == null || map.get("versions_eq") == null) { | ||
| 345 | - throw new IllegalArgumentException("需正确传入线路、方向、版本参数"); | ||
| 346 | - } | ||
| 347 | - map.put("destroy_eq", 0); | ||
| 348 | - List<LsStationRoute> stationRoutes = lsStationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "stationRouteCode")); | ||
| 349 | - | ||
| 350 | - List<Map<String, Object>> resultList = new ArrayList<>(); | ||
| 351 | - | ||
| 352 | - int len = stationRoutes.size(); | ||
| 353 | - | ||
| 354 | - if(len > 0) { | ||
| 355 | - // 遍历站点 | ||
| 356 | - traversalStation(stationRoutes, resultList, len); | ||
| 357 | - } | ||
| 358 | - return resultList; | ||
| 359 | - } | ||
| 360 | - | ||
| 361 | - /** | ||
| 362 | - * @Description :TODO(撤销站点) | ||
| 363 | - * | ||
| 364 | - * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | ||
| 365 | - * | ||
| 366 | - * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 367 | - */ | ||
| 368 | - @Override | ||
| 369 | - public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) { | ||
| 370 | - Map<String, Object> resultMap = new HashMap<String,Object>(); | ||
| 371 | - | ||
| 372 | - try { | ||
| 373 | - | ||
| 374 | - Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString()); | ||
| 375 | - | ||
| 376 | - Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); | ||
| 377 | - | ||
| 378 | - lsStationRouteRepository.deleteById(stationRouteId); | ||
| 379 | - | ||
| 380 | - resultMap.put("status", ResponseCode.SUCCESS); | ||
| 381 | - | ||
| 382 | - } catch (Exception e) { | ||
| 383 | - | ||
| 384 | - resultMap.put("status", ResponseCode.ERROR); | ||
| 385 | - | ||
| 386 | - logger.error("save erro.", e); | ||
| 387 | - | ||
| 388 | - } | ||
| 389 | - | ||
| 390 | - return resultMap; | ||
| 391 | - } | ||
| 392 | - | ||
| 393 | - /** | ||
| 394 | - * @Description : TODO(根据线路ID生成行单) | ||
| 395 | - * | ||
| 396 | - * @param map <lineId:线路ID> | ||
| 397 | - * | ||
| 398 | - * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> | ||
| 399 | - */ | ||
| 400 | - @Override | ||
| 401 | - public Map<String, Object> usingSingle(Map<String, Object> map) { | ||
| 402 | - // 返回值map | ||
| 403 | - Map<String, Object> resultMap = new HashMap<String,Object>(); | ||
| 404 | - try { | ||
| 405 | - // 获取线路ID | ||
| 406 | - Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | ||
| 407 | - /** 查询线路信息 @param:<lineId:线路ID> */ | ||
| 408 | - Line line = lineRepository.findById(lineId).get(); | ||
| 409 | - | ||
| 410 | - | ||
| 411 | - Business company = businessRepository.findByBusinessCode(line.getCompany()).get(0); | ||
| 412 | - | ||
| 413 | - Integer fileVersions = lineRepository.findfileVersions(lineId); | ||
| 414 | - if(fileVersions == null) { | ||
| 415 | - lineRepository.addFileVersions(line.getId(), line.getLineCode()); | ||
| 416 | - fileVersions = 1; | ||
| 417 | - } else { | ||
| 418 | - fileVersions = fileVersions + 1; | ||
| 419 | - lineRepository.editFileVersions(line.getId(),fileVersions); | ||
| 420 | - } | ||
| 421 | -// Integer fileVersions = map.get("fileVersions").equals("") ? 1 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认1 | ||
| 422 | - /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ | ||
| 423 | - List<Object[]> objects = stationRouteRepository.usingSingle(lineId); | ||
| 424 | - if (objects.size()>0) { | ||
| 425 | - /** 获取配置文件里的ftp登录参数 */ | ||
| 426 | - Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); | ||
| 427 | - // 压缩文件名 | ||
| 428 | - String odlGzFileName = line.getLineCode() + ".txt.gz"; | ||
| 429 | - // txt文件名 | ||
| 430 | - String textFileName = line.getLineCode() + ".txt"; | ||
| 431 | - // 创建一个ftp上传实例 | ||
| 432 | - FTPClientUtils clientUtils = new FTPClientUtils(); | ||
| 433 | - // IP | ||
| 434 | - String url = FTPParamMap.get("url").toString(); | ||
| 435 | - // 端口 | ||
| 436 | - int port = Integer.valueOf(FTPParamMap.get("port").toString()); | ||
| 437 | - // 用户名 | ||
| 438 | - String username = FTPParamMap.get("username").toString(); | ||
| 439 | - // 密码 | ||
| 440 | - String password = FTPParamMap.get("password").toString(); | ||
| 441 | - // 相对路径 | ||
| 442 | - String remotePath = FTPParamMap.get("remotePath").toString(); | ||
| 443 | - /** 如果已存在相同行单文件名则先删除 */ | ||
| 444 | - clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); | ||
| 445 | - clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); | ||
| 446 | - clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", textFileName); | ||
| 447 | - String textStr = ""; | ||
| 448 | -// boolean tempTag = ishxType(objects); | ||
| 449 | - Integer linePlayType = line.getLinePlayType() == null ? -1:line.getLinePlayType(); | ||
| 450 | - if(linePlayType == 1) | ||
| 451 | - textStr = hxTextFileToFtp(objects,lineId);// 环线行单文件内容 | ||
| 452 | - else if (linePlayType == 0) | ||
| 453 | - textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | ||
| 454 | - else | ||
| 455 | - resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 | ||
| 456 | - | ||
| 457 | - textStr = line.getName() + " " + fileVersions + "\r\n" + textStr; | ||
| 458 | - InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | ||
| 459 | - /** 生成txt文件,上传ftp */ | ||
| 460 | - clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | ||
| 461 | - // 创建打包实例 | ||
| 462 | - PackTarGZUtils packTarGZUtils= new PackTarGZUtils(); | ||
| 463 | - /** 获取txt文件 */ | ||
| 464 | - File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName); | ||
| 465 | - File target = new File(odlGzFileName); | ||
| 466 | - // 将txt文件打包 | ||
| 467 | - File targetFile = PackTarGZUtils.compress(textFile, target); | ||
| 468 | - clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); | ||
| 469 | - // 删除文件 | ||
| 470 | - textFile.delete(); | ||
| 471 | - targetFile.delete(); | ||
| 472 | - | ||
| 473 | - | ||
| 474 | - textStr = newTextVoiceFileToFTP(objects,lineId); | ||
| 475 | - | ||
| 476 | - String lineName = line.getName(); | ||
| 477 | - | ||
| 478 | - /*try { | ||
| 479 | - lineName = Integer.parseInt(line.getName().replace("路", "")) + ""; | ||
| 480 | - } catch (Exception e) { | ||
| 481 | - }*/ | ||
| 482 | - | ||
| 483 | - String head = lineName + " " + fileVersions + " " + line.getStartStationFirstTime() + "-" + line.getStartStationEndTime() + " " + line.getEndStationFirstTime() + "-" + line.getEndStationEndTime() + " " + line.getTicketPrice() + " " + company.getBusinessName().replace("公司", "公交") + " " + (company.getPhoneNum()== null ? "-" : company.getPhoneNum()); | ||
| 484 | - | ||
| 485 | - textStr = head +"\r\n" + textStr; | ||
| 486 | - | ||
| 487 | - input = new ByteArrayInputStream(textStr.getBytes("gbk")); | ||
| 488 | - | ||
| 489 | - clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", textFileName, input); | ||
| 490 | - | ||
| 491 | -// textFile.delete(); | ||
| 492 | - | ||
| 493 | - | ||
| 494 | - resultMap.put("status", ResponseCode.SUCCESS); | ||
| 495 | - }else { | ||
| 496 | - resultMap.put("status","NOTDATA"); | ||
| 497 | - } | ||
| 498 | - } catch (Exception e) { | ||
| 499 | - resultMap.put("status", ResponseCode.ERROR); | ||
| 500 | - logger.error("save erro.", e); | ||
| 501 | - } finally { | ||
| 502 | - return resultMap; | ||
| 503 | - } | ||
| 504 | - } | ||
| 505 | - | ||
| 506 | - /** | ||
| 507 | - * @Description : TODO(形成行单文件内容) | ||
| 508 | - * | ||
| 509 | - * @param objects :站点路由信息 | ||
| 510 | - * | ||
| 511 | - * {[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标) | ||
| 512 | - * | ||
| 513 | - * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码); | ||
| 514 | - * | ||
| 515 | - * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} | ||
| 516 | - * | ||
| 517 | - * @param lineId :线路ID | ||
| 518 | - * | ||
| 519 | - * @return String | ||
| 520 | - */ | ||
| 521 | - public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | ||
| 522 | - | ||
| 523 | - // 返回值String | ||
| 524 | - String stationRStr = ""; | ||
| 525 | - // windows下的文本文件换行符 | ||
| 526 | - //String enterStr = "\r\n"; | ||
| 527 | - // linux/unix下的文本文件换行符 | ||
| 528 | - String enterStr = "\r"; | ||
| 529 | - int defaultZdxh = 0; | ||
| 530 | - if(objects.size()>0) { | ||
| 531 | - for(int i = 0; i<objects.size();i++) { | ||
| 532 | - defaultZdxh ++ ; | ||
| 533 | - // 经度 | ||
| 534 | - String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | ||
| 535 | - | ||
| 536 | - // 纬度 | ||
| 537 | - String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | ||
| 538 | - | ||
| 539 | - Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 540 | - | ||
| 541 | - lat = "\t" + lat; | ||
| 542 | - | ||
| 543 | - // 站点类型 | ||
| 544 | - String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | ||
| 545 | - | ||
| 546 | - String stationMake = ""; | ||
| 547 | - | ||
| 548 | - if(stationMakeStr.equals("E")) { | ||
| 549 | - stationMake = "\t2"; | ||
| 550 | - }else { | ||
| 551 | - stationMake ="\t1"; | ||
| 552 | - } | ||
| 553 | - | ||
| 554 | - // 站点序号 | ||
| 555 | - // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | ||
| 556 | - String stationNo = String.valueOf(defaultZdxh); | ||
| 557 | - | ||
| 558 | - stationNo = "\t" + stationNo; | ||
| 559 | - | ||
| 560 | - // 站点编码 | ||
| 561 | - String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | ||
| 562 | - | ||
| 563 | - int len = stationCode.length(); | ||
| 564 | - if(len<8) { | ||
| 565 | - int dx = 8 - len; | ||
| 566 | - String addStr = ""; | ||
| 567 | - for(int p =0;p<dx;p++) { | ||
| 568 | - addStr = addStr + "0"; | ||
| 569 | - } | ||
| 570 | - stationCode = addStr + stationCode; | ||
| 571 | - }else if(len>8){ | ||
| 572 | - stationCode = stationCode.substring(8); | ||
| 573 | - } | ||
| 574 | - | ||
| 575 | - stationCode = "\t" +stationCode; | ||
| 576 | - | ||
| 577 | - double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | ||
| 578 | - | ||
| 579 | - String tempDistc = String.valueOf((int) dis); | ||
| 580 | - | ||
| 581 | - // 站点距离 | ||
| 582 | - String staitondistance = "\t" + tempDistc; | ||
| 583 | - | ||
| 584 | - // 站点名称 | ||
| 585 | - String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | ||
| 586 | - | ||
| 587 | - stationName = "\t" +stationName; | ||
| 588 | - | ||
| 589 | - // 限速 | ||
| 590 | - // String sleepStr = " " + "60"; | ||
| 591 | - | ||
| 592 | - // 限速 | ||
| 593 | - String sleepStr = ""; | ||
| 594 | - // 方向 | ||
| 595 | - int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | ||
| 596 | - /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 597 | - List<Object[]> sobje = sectionRouteRepository.sectionRouteVector(lineId,directions); | ||
| 598 | - if(sobje.size()==1) { | ||
| 599 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 600 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 601 | -// int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | ||
| 602 | -// sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 603 | - }else if(sobje.size()>1){ | ||
| 604 | - for(int j =0;j<sobje.size();j++) { | ||
| 605 | - double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 606 | - String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 607 | - pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 608 | - List<Point> ps = new ArrayList<>(); | ||
| 609 | - String[] pArray = pointsStr.split(","); | ||
| 610 | - for(int a = 0; a <pArray.length; a++) { | ||
| 611 | - String[] tmepA = pArray[a].split(" "); | ||
| 612 | - Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 613 | - ps.add(temp); | ||
| 614 | - } | ||
| 615 | - if(GeoUtils.isInSection(ps, point)) { | ||
| 616 | - sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 617 | - break; | ||
| 618 | - } | ||
| 619 | - } | ||
| 620 | - } | ||
| 621 | - if(sleepStr.equals("")) | ||
| 622 | - sleepStr = "\t" + "60"; | ||
| 623 | - stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | ||
| 624 | - } | ||
| 625 | - | ||
| 626 | - } | ||
| 627 | - return stationRStr; | ||
| 628 | - | ||
| 629 | - } | ||
| 630 | - | ||
| 631 | - public String newTextVoiceFileToFTP(List<Object[]> objects,Integer lineId) { | ||
| 632 | - | ||
| 633 | - // 返回值String | ||
| 634 | - String stationRStr = ""; | ||
| 635 | - // windows下的文本文件换行符 | ||
| 636 | - String enterStr = "\r\n"; | ||
| 637 | - // linux/unix下的文本文件换行符 | ||
| 638 | -// String enterStr = "\r"; | ||
| 639 | - int defaultZdxh = 0; | ||
| 640 | - if(objects.size()>0) { | ||
| 641 | - for(int i = 0; i<objects.size();i++) { | ||
| 642 | - defaultZdxh ++ ; | ||
| 643 | - // 经度 | ||
| 644 | - String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | ||
| 645 | - | ||
| 646 | - // 纬度 | ||
| 647 | - String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | ||
| 648 | - | ||
| 649 | - Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 650 | - | ||
| 651 | - lat = "\t" + lat; | ||
| 652 | - | ||
| 653 | - // 站点类型 | ||
| 654 | - String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | ||
| 655 | - | ||
| 656 | - String stationMake = ""; | ||
| 657 | - | ||
| 658 | - if(stationMakeStr.equals("E")) { | ||
| 659 | - stationMake = "\t2"; | ||
| 660 | - }else { | ||
| 661 | - stationMake ="\t1"; | ||
| 662 | - } | ||
| 663 | - | ||
| 664 | - // 站点序号 | ||
| 665 | - // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | ||
| 666 | - String stationNo = String.valueOf(defaultZdxh); | ||
| 667 | - | ||
| 668 | - stationNo = "\t" + stationNo; | ||
| 669 | - | ||
| 670 | - // 站点编码 | ||
| 671 | - String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | ||
| 672 | - | ||
| 673 | - int len = stationCode.length(); | ||
| 674 | - if(len<8) { | ||
| 675 | - int dx = 8 - len; | ||
| 676 | - String addStr = ""; | ||
| 677 | - for(int p =0;p<dx;p++) { | ||
| 678 | - addStr = addStr + "0"; | ||
| 679 | - } | ||
| 680 | - stationCode = addStr + stationCode; | ||
| 681 | - }else if(len>8){ | ||
| 682 | - stationCode = stationCode.substring(8); | ||
| 683 | - } | ||
| 684 | - | ||
| 685 | - stationCode = "\t" +stationCode; | ||
| 686 | - | ||
| 687 | - double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | ||
| 688 | - | ||
| 689 | - String tempDistc = String.valueOf((int) dis); | ||
| 690 | - | ||
| 691 | - // 站点距离 | ||
| 692 | - String staitondistance = "\t" + tempDistc; | ||
| 693 | - | ||
| 694 | - // 站点名称 | ||
| 695 | - String stationName = objects.get(i)[7].equals("") ? " " : objects.get(i)[7].toString(); | ||
| 696 | - | ||
| 697 | - String stationNameEn = " "; | ||
| 698 | - if(objects.get(i)[9] != null){ | ||
| 699 | - stationNameEn = objects.get(i)[9].equals("") ? " " : objects.get(i)[9].toString(); | ||
| 700 | - } | ||
| 701 | - | ||
| 702 | - | ||
| 703 | - stationName = "\t" +stationName; | ||
| 704 | - stationNameEn = "\t" +stationNameEn; | ||
| 705 | - | ||
| 706 | - // 限速 | ||
| 707 | - // String sleepStr = " " + "60"; | ||
| 708 | - | ||
| 709 | - // 限速 | ||
| 710 | - String sleepStr = ""; | ||
| 711 | - // 方向 | ||
| 712 | - int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | ||
| 713 | - if (directions == 1) { | ||
| 714 | - stationName = stationName.replaceAll("\\(起点站\\)", "").replaceAll("\\(终点站\\)", "").replaceAll("(起点站)", "").replaceAll("(终点站)", ""); | ||
| 715 | - } | ||
| 716 | - /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 717 | - List<Object[]> sobje = sectionRouteRepository.sectionRouteVector(lineId,directions); | ||
| 718 | - if(sobje.size()==1) { | ||
| 719 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 720 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 721 | -// int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | ||
| 722 | -// sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 723 | - }else if(sobje.size()>1){ | ||
| 724 | - for(int j =0;j<sobje.size();j++) { | ||
| 725 | - double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 726 | - String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 727 | - pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 728 | - List<Point> ps = new ArrayList<>(); | ||
| 729 | - String[] pArray = pointsStr.split(","); | ||
| 730 | - for(int a = 0; a <pArray.length; a++) { | ||
| 731 | - String[] tmepA = pArray[a].split(" "); | ||
| 732 | - Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 733 | - ps.add(temp); | ||
| 734 | - } | ||
| 735 | - if(GeoUtils.isInSection(ps, point)) { | ||
| 736 | - sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 737 | - break; | ||
| 738 | - } | ||
| 739 | - } | ||
| 740 | - } | ||
| 741 | - if(sleepStr.equals("")) | ||
| 742 | - sleepStr = "\t" + "60"; | ||
| 743 | - stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + stationNameEn + enterStr; | ||
| 744 | - } | ||
| 745 | - | ||
| 746 | - } | ||
| 747 | - return stationRStr; | ||
| 748 | - | ||
| 749 | - } | ||
| 750 | - | ||
| 751 | - public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { | ||
| 752 | - String restStr = ""; | ||
| 753 | - // windows下的文本文件换行符 | ||
| 754 | - //String enterStr = "\r\n"; | ||
| 755 | - // linux/unix下的文本文件换行符 | ||
| 756 | - String enterStr = "\r"; | ||
| 757 | - int xh = 1 ; | ||
| 758 | - for(int x =0;x<2;x++) { | ||
| 759 | - for(int i = 0; i<objects.size();i++) { | ||
| 760 | - if(Integer.valueOf(objects.get(i)[8].toString())==0) { | ||
| 761 | - // 经度 | ||
| 762 | - String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | ||
| 763 | - | ||
| 764 | - // 纬度 | ||
| 765 | - String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | ||
| 766 | - | ||
| 767 | - Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 768 | - lat = "\t" + lat; | ||
| 769 | - // 站点类型 | ||
| 770 | - String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | ||
| 771 | - String stationMake = ""; | ||
| 772 | - if(stationMakeStr.equals("E")) { | ||
| 773 | - stationMake = "\t2"; | ||
| 774 | - }else { | ||
| 775 | - stationMake ="\t1"; | ||
| 776 | - } | ||
| 777 | - // 站点序号 | ||
| 778 | - // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | ||
| 779 | - String stationNo = "\t" + xh; | ||
| 780 | - // 站点编码 | ||
| 781 | - String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | ||
| 782 | - int len = stationCode.length(); | ||
| 783 | - if(len<8) { | ||
| 784 | - int dx = 8 - len; | ||
| 785 | - String addStr = ""; | ||
| 786 | - for(int p =0;p<dx;p++) { | ||
| 787 | - addStr = addStr + "0"; | ||
| 788 | - } | ||
| 789 | - stationCode = addStr + stationCode; | ||
| 790 | - }else if(len>8){ | ||
| 791 | - stationCode = stationCode.substring(8); | ||
| 792 | - } | ||
| 793 | - stationCode = "\t" +stationCode; | ||
| 794 | - double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | ||
| 795 | - String tempDistc = String.valueOf((int) dis); | ||
| 796 | - // 站点距离 | ||
| 797 | - String staitondistance = "\t" + tempDistc; | ||
| 798 | - // 站点名称 | ||
| 799 | - String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | ||
| 800 | - stationName = "\t" +stationName; | ||
| 801 | - // 限速 | ||
| 802 | - String sleepStr = ""; | ||
| 803 | - // 方向 | ||
| 804 | - int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | ||
| 805 | - if (directions == 1) { | ||
| 806 | - stationName = stationName.replaceAll("\\(起点站\\)", "").replaceAll("\\(终点站\\)", "").replaceAll("(起点站)", "").replaceAll("(终点站)", ""); | ||
| 807 | - } | ||
| 808 | - /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 809 | - List<Object[]> sobje = sectionRouteRepository.sectionRouteVector(lineId,directions); | ||
| 810 | - if(sobje.size()==1) { | ||
| 811 | -// int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | ||
| 812 | -// sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 813 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 814 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 815 | - }else if(sobje.size()>1){ | ||
| 816 | - for(int j =0;j<sobje.size();j++) { | ||
| 817 | - double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 818 | - String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 819 | - pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 820 | - List<Point> ps = new ArrayList<>(); | ||
| 821 | - String[] pArray = pointsStr.split(","); | ||
| 822 | - for(int a = 0; a <pArray.length; a++) { | ||
| 823 | - String[] tmepA = pArray[a].split(" "); | ||
| 824 | - Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 825 | - ps.add(temp); | ||
| 826 | - } | ||
| 827 | - if(GeoUtils.isInSection(ps, point)) { | ||
| 828 | - sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 829 | - break; | ||
| 830 | - } | ||
| 831 | - } | ||
| 832 | - } | ||
| 833 | - if(sleepStr.equals("")) | ||
| 834 | - sleepStr = "\t" + "60"; | ||
| 835 | - xh++; | ||
| 836 | - restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | ||
| 837 | - } | ||
| 838 | - } | ||
| 839 | - } | ||
| 840 | - System.out.println(restStr); | ||
| 841 | - return restStr; | ||
| 842 | - } | ||
| 843 | - | ||
| 844 | - public boolean isPointOnPolyline (Map<String, Object> point, List<Map<String, Object>> listMap ){ | ||
| 845 | - | ||
| 846 | - boolean success = false; | ||
| 847 | - | ||
| 848 | - for(int l = 0; l < listMap.size() - 1; l ++){ | ||
| 849 | - | ||
| 850 | - Map<String, Object> tempM = listMap.get(l); | ||
| 851 | - | ||
| 852 | - Map<String, Object> nextTempM = listMap.get(l+1); | ||
| 853 | - | ||
| 854 | - if (Double.valueOf(point.get("lng").toString())>= Math.min(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && Double.valueOf(point.get("lng").toString()) <= Math.max(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && | ||
| 855 | - Double.valueOf(point.get("lat").toString()) >= Math.min(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString())) && Double.valueOf(point.get("lat").toString()) <= Math.max(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString()))){ | ||
| 856 | - | ||
| 857 | - | ||
| 858 | - double precision = (Double.valueOf(tempM.get("lng").toString()) - Double.valueOf(point.get("lng").toString())) * (Double.valueOf(nextTempM.get("lat").toString()) - Double.valueOf(point.get("lat").toString())) - | ||
| 859 | - (Double.valueOf(nextTempM.get("lng").toString()) - Double.valueOf(tempM.get("lng").toString())) * (Double.valueOf(tempM.get("lat").toString()) - Double.valueOf(nextTempM.get("lat").toString())); | ||
| 860 | - | ||
| 861 | - if(precision < 2e-10 && precision > -2e-10){ | ||
| 862 | - | ||
| 863 | - //实质判断是否接近0 | ||
| 864 | - success = true; | ||
| 865 | - | ||
| 866 | - } | ||
| 867 | - | ||
| 868 | - } | ||
| 869 | - | ||
| 870 | - } | ||
| 871 | - | ||
| 872 | - return success; | ||
| 873 | - } | ||
| 874 | - | ||
| 875 | - /** | ||
| 876 | - * @Description:TOOD(获取FTP登录参数) 这里暂时只做一个map值返回,以后可以作为ftp登录类提出来 | ||
| 877 | - * | ||
| 878 | - * @return : Map<String, Object> <url:IP;port:端口;username:用户名;password:密码;remotePath:相对路径> | ||
| 879 | - */ | ||
| 880 | - public Map<String, Object> readPropertiesGetFTPParam(){ | ||
| 881 | - | ||
| 882 | - // 返回值map | ||
| 883 | - Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 884 | - | ||
| 885 | - Properties env = new Properties(); | ||
| 886 | - | ||
| 887 | - try { | ||
| 888 | - | ||
| 889 | - env.load(DBUtils_MS.class.getClassLoader().getResourceAsStream("ftp.properties")); | ||
| 890 | - | ||
| 891 | - resultMap.put("url", env.getProperty("ftp.url")); | ||
| 892 | - | ||
| 893 | - resultMap.put("port", env.getProperty("ftp.port")); | ||
| 894 | - | ||
| 895 | - resultMap.put("username", env.getProperty("ftp.username")); | ||
| 896 | - | ||
| 897 | - resultMap.put("password", env.getProperty("ftp.password")); | ||
| 898 | - | ||
| 899 | - resultMap.put("remotePath", env.getProperty("ftp.path")); | ||
| 900 | - | ||
| 901 | - } catch (Exception e) { | ||
| 902 | - | ||
| 903 | - e.printStackTrace(); | ||
| 904 | - | ||
| 905 | - } | ||
| 906 | - | ||
| 907 | - return resultMap ; | ||
| 908 | - } | ||
| 909 | - | ||
| 910 | - @Override | ||
| 911 | - public Map<String, Object> findByMultiLine(String lineIds) { | ||
| 912 | - Map<String, Object> rs = new HashMap<>(); | ||
| 913 | - try{ | ||
| 914 | - List<String> idx = Splitter.on(',').splitToList(lineIds); | ||
| 915 | - //路由 | ||
| 916 | - List<StationRoute> list = new ArrayList<>(); | ||
| 917 | - | ||
| 918 | - | ||
| 919 | - /** | ||
| 920 | - * in 查询符 无法和 @EntityGraph 同时配合使用,这可能是一个bug | ||
| 921 | - * 暂时只能循环单线路查询 | ||
| 922 | - */ | ||
| 923 | - //stationRouteRepository.multiLine(idx) | ||
| 924 | - for(String id : idx){ | ||
| 925 | - list.addAll(stationRouteRepository.findByLineCode(id)); | ||
| 926 | - } | ||
| 927 | - | ||
| 928 | - for(StationRoute sr : list){ | ||
| 929 | - sr.setLine(null); | ||
| 930 | - } | ||
| 931 | - //过滤部分字段 | ||
| 932 | - /*String jsonStr = JSON.toJSONString(list, new PropertyFilter() { | ||
| 933 | - | ||
| 934 | - @Override | ||
| 935 | - public boolean apply(Object object, String name, Object value) { | ||
| 936 | - if(name.equals("line")) | ||
| 937 | - return false; | ||
| 938 | - return true; | ||
| 939 | - } | ||
| 940 | - });*/ | ||
| 941 | - | ||
| 942 | - rs.put("status", ResponseCode.SUCCESS); | ||
| 943 | - rs.put("list", list); | ||
| 944 | - }catch(Exception e){ | ||
| 945 | - logger.error("", e); | ||
| 946 | - rs.put("status", ResponseCode.ERROR); | ||
| 947 | - } | ||
| 948 | - | ||
| 949 | - return rs; | ||
| 950 | - } | ||
| 951 | - | ||
| 952 | - public void matchCode(List<StationRoute> stationRoutes,List<StationMatchData> stationMatchData, List<StationRoute> listMactah){ | ||
| 953 | - int listsSize = stationRoutes.size(); | ||
| 954 | - if(listsSize > 0 && stationMatchData.size() > 0){ | ||
| 955 | - if(stationMatchData.size() == listsSize){ | ||
| 956 | - for (int i=0; i<listsSize; i++) { | ||
| 957 | - if(!StringUtils.isEmpty(stationMatchData.get(i).getStationStandardCode())){ | ||
| 958 | - stationRoutes.get(i).setIndustryCode(stationMatchData.get(i).getStationStandardCode()); | ||
| 959 | - listMactah.add(stationRoutes.get(i)); | ||
| 960 | - } | ||
| 961 | - } | ||
| 962 | - } else { | ||
| 963 | - Map<String,String> smdMap = new HashMap<>(); | ||
| 964 | - for (int i=0; i<listsSize; i++) { | ||
| 965 | - | ||
| 966 | - String name = stationRoutes.get(i).getStationName(); | ||
| 967 | - String names[] = null; | ||
| 968 | - if(name.indexOf("(") != -1){ | ||
| 969 | - names = name.split("("); | ||
| 970 | - } else if(name.indexOf("(") != -1){ | ||
| 971 | - names = name.split("\\("); | ||
| 972 | - } | ||
| 973 | - | ||
| 974 | - for (StationMatchData smd:stationMatchData) { | ||
| 975 | - smdMap.put(smd.getStationName(),smd.getStationStandardCode()); | ||
| 976 | - String stationName =smd.getStationName(); | ||
| 977 | - String stationName2 =smd.getStationName2(); | ||
| 978 | - String industryCode =smd.getStationStandardCode(); | ||
| 979 | - if(StringUtils.isEmpty(industryCode)){ | ||
| 980 | - continue; | ||
| 981 | - } | ||
| 982 | - if(names != null && names.length > 1){ | ||
| 983 | -// if(stationRoutes.get(i).getStationMark().equals(smd.getStationType()) && (stationName.indexOf(names[0]) != -1 || stationName.indexOf(names[1].substring(0,names[1].length()-1)) != -1 || stationName2.indexOf(names[0]) != -1 || stationName2.indexOf(names[1].substring(0,names[1].length()-1)) != -1)){ | ||
| 984 | - if((stationName.indexOf(names[0]) != -1 || stationName.indexOf(names[1].substring(0,names[1].length()-1)) != -1 || stationName2.indexOf(names[0]) != -1 || stationName2.indexOf(names[1].substring(0,names[1].length()-1)) != -1)){ | ||
| 985 | - stationRoutes.get(i).setIndustryCode(industryCode); | ||
| 986 | - listMactah.add(stationRoutes.get(i)); | ||
| 987 | - break; | ||
| 988 | - } | ||
| 989 | - }else { | ||
| 990 | -// if(stationRoutes.get(i).getStationMark().equals(smd.getStationType()) && (stationName.indexOf(name) != -1 || stationName2.indexOf(name) != -1)){ | ||
| 991 | - if(stationName.indexOf(name) != -1 || stationName2.indexOf(name) != -1){ | ||
| 992 | -// if(stationRoutes.get(i).getStationMark().equals(smd.getStationType()) && (name.equals(stationName) || name.equals(stationName2))){ | ||
| 993 | - | ||
| 994 | - stationRoutes.get(i).setIndustryCode(industryCode); | ||
| 995 | - listMactah.add(stationRoutes.get(i)); | ||
| 996 | - break; | ||
| 997 | - } | ||
| 998 | - } | ||
| 999 | - } | ||
| 1000 | - } | ||
| 1001 | - } | ||
| 1002 | - } | ||
| 1003 | - } | ||
| 1004 | -} | 1 | +package com.bsth.service.impl; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.*; | ||
| 5 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 6 | +import com.bsth.repository.*; | ||
| 7 | +import com.bsth.service.StationRouteService; | ||
| 8 | +import com.bsth.util.*; | ||
| 9 | +import com.bsth.util.Geo.GeoUtils; | ||
| 10 | +import com.bsth.util.Geo.Point; | ||
| 11 | +import com.bsth.util.PackTarGZUtils; | ||
| 12 | +import com.bsth.util.db.DBUtils_MS; | ||
| 13 | +import com.google.common.base.Splitter; | ||
| 14 | +import org.apache.commons.lang3.StringUtils; | ||
| 15 | +import org.geolatte.geom.Polygon; | ||
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | +import org.springframework.beans.factory.annotation.Value; | ||
| 18 | +import org.springframework.data.domain.Sort; | ||
| 19 | +import org.springframework.data.domain.Sort.Direction; | ||
| 20 | +import org.springframework.stereotype.Service; | ||
| 21 | + | ||
| 22 | +import javax.servlet.http.HttpServletResponse; | ||
| 23 | +import java.io.*; | ||
| 24 | +import java.text.DecimalFormat; | ||
| 25 | +import java.util.*; | ||
| 26 | +import java.util.zip.ZipEntry; | ||
| 27 | +import java.util.zip.ZipOutputStream; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * | ||
| 31 | + * @ClassName: StationRouteServiceImpl(站点路由service业务层实现类) | ||
| 32 | + * | ||
| 33 | + * @Extends : BaseService | ||
| 34 | + * | ||
| 35 | + * @Description: TODO(站点路由service业务层) | ||
| 36 | + * | ||
| 37 | + * @Author bsth@lq | ||
| 38 | + * | ||
| 39 | + * @Date 2016年5月03日 上午9:21:17 | ||
| 40 | + * | ||
| 41 | + * @Version 公交调度系统BS版 0.1 | ||
| 42 | + * | ||
| 43 | + */ | ||
| 44 | + | ||
| 45 | +@Service | ||
| 46 | +public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integer> implements StationRouteService { | ||
| 47 | + | ||
| 48 | + @Value("${path.speech.common}") | ||
| 49 | + private String commonPath; | ||
| 50 | + | ||
| 51 | + @Value("${path.speech.line}") | ||
| 52 | + private String linePathPattern; | ||
| 53 | + | ||
| 54 | + @Autowired | ||
| 55 | + private StationRouteRepository stationRouteRepository; | ||
| 56 | + | ||
| 57 | + @Autowired | ||
| 58 | + private SectionRouteRepository sectionRouteRepository; | ||
| 59 | + | ||
| 60 | + @Autowired | ||
| 61 | + private LineRepository lineRepository; | ||
| 62 | + | ||
| 63 | + @Autowired | ||
| 64 | + private StationRepository stationRepository; | ||
| 65 | + | ||
| 66 | + @Autowired | ||
| 67 | + private BusinessRepository businessRepository; | ||
| 68 | + | ||
| 69 | + @Autowired | ||
| 70 | + private LsStationRouteRepository lsStationRouteRepository; | ||
| 71 | + | ||
| 72 | + @Autowired | ||
| 73 | + private LsSectionRouteRepository lsSectionRouteRepository; | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + public Iterable<StationRoute> list(Map<String, Object> map) { | ||
| 77 | + List<Sort.Order> orders = new ArrayList<>(); | ||
| 78 | + orders.add(new Sort.Order(Direction.ASC, "directions")); | ||
| 79 | + orders.add(new Sort.Order(Direction.ASC, "stationRouteCode")); | ||
| 80 | + | ||
| 81 | + return stationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(orders)); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @Override | ||
| 85 | + public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) { | ||
| 86 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 87 | + try { | ||
| 88 | + // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 89 | + Map<String,Object> resultExcel = new HashMap<String,Object>();//导出参数的对象 | ||
| 90 | + /* 添加表头*/ | ||
| 91 | + List<String> title = new ArrayList<String>(); | ||
| 92 | + title.add("线路ID"); | ||
| 93 | + title.add("方向"); | ||
| 94 | + title.add("站点编码"); | ||
| 95 | + title.add("站点顺序号"); | ||
| 96 | + title.add("站点备注"); | ||
| 97 | + title.add("站点名称"); | ||
| 98 | + title.add("站点距离(km)"); | ||
| 99 | + title.add("站点时长(min)"); | ||
| 100 | + title.add("线路名称"); | ||
| 101 | + resultExcel.put("title", title); | ||
| 102 | + /* 添加表单*/ | ||
| 103 | + Map<String,List<String>> temp = new HashMap<String,List<String>>(); | ||
| 104 | + List<StationRoute> strtionList = stationRouteRepository.findStationExport(id); | ||
| 105 | + if(strtionList == null){ | ||
| 106 | + logger.info("没有数据导,出用户信息失败!"); | ||
| 107 | + } else { | ||
| 108 | + | ||
| 109 | + for (int i = 0; i < strtionList.size(); i++) { | ||
| 110 | + StationRoute station = strtionList.get(i); | ||
| 111 | + | ||
| 112 | + List<String> varList = new ArrayList<String>(); | ||
| 113 | + varList.add(station.getLine().getId().toString()); | ||
| 114 | + varList.add(station.getDirections().toString()); | ||
| 115 | + varList.add(station.getStationCode()); | ||
| 116 | + varList.add(station.getStationRouteCode().toString()); | ||
| 117 | + varList.add(station.getStationMark()); | ||
| 118 | + varList.add(station.getStationName()); | ||
| 119 | + varList.add(station.getDistances().toString()); | ||
| 120 | + varList.add(station.getToTime().toString()); | ||
| 121 | + varList.add(station.getLine().getName()); | ||
| 122 | + temp.put((i+1)+"", varList); | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + resultExcel.put("content", temp); | ||
| 126 | + ExcelUtil excelUtil = new ExcelUtil(); | ||
| 127 | + excelUtil.buildExcelDocument(resultExcel, strtionList.get(0).getLine().getName()+"线路站点",resp); | ||
| 128 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 129 | + } catch (Exception e) { | ||
| 130 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 131 | + logger.error("save erro.", e); | ||
| 132 | + } | ||
| 133 | + return resultMap; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * @Description :TODO(查询树站点与路段数据) | ||
| 138 | + * | ||
| 139 | + * @param map <line.id_eq:线路ID; directions_eq:方向> | ||
| 140 | + * | ||
| 141 | + * @return List<Map<String, Object>> | ||
| 142 | + */ | ||
| 143 | + @Override | ||
| 144 | + public Map<String, Object> findRoutes(Map<String, Object> map) { | ||
| 145 | + Map<String, Object> result = new HashMap<>(); | ||
| 146 | + List<StationRoute> stationList = stationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "directions", "stationRouteCode")); | ||
| 147 | + List<SectionRoute> sectionList = sectionRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "directions", "sectionrouteCode")); | ||
| 148 | + | ||
| 149 | + result.put("stationRoutes", stationList); | ||
| 150 | + result.put("sectionRoutes", sectionList); | ||
| 151 | + | ||
| 152 | + return result; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + @Override | ||
| 156 | + public Map<String, Object> systemQuote(Map<String, Object> map) { | ||
| 157 | + Map<String, Object> resultmap = new HashMap<>(); | ||
| 158 | + try{ | ||
| 159 | + | ||
| 160 | + StationRoute route = new StationRoute(); | ||
| 161 | + | ||
| 162 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 163 | + | ||
| 164 | + Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString()); | ||
| 165 | + | ||
| 166 | + Line line = lineRepository.findById(lineId).get(); | ||
| 167 | + | ||
| 168 | + Station station = stationRepository.findById(stationId).get(); | ||
| 169 | + | ||
| 170 | + route.setLine(line); | ||
| 171 | + | ||
| 172 | + route.setStation(station); | ||
| 173 | + | ||
| 174 | + //baseRepository.save(t); | ||
| 175 | + resultmap.put("status", ResponseCode.SUCCESS); | ||
| 176 | + }catch(Exception e){ | ||
| 177 | + resultmap.put("status", ResponseCode.ERROR); | ||
| 178 | + logger.error("save erro.", e); | ||
| 179 | + } | ||
| 180 | + return resultmap; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + /** | ||
| 184 | + * @Description :TODO(查询线路某方向下的站点序号与类型) | ||
| 185 | + * | ||
| 186 | + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 187 | + * | ||
| 188 | + * @return List<Map<String, Object>> | ||
| 189 | + */ | ||
| 190 | + @Override | ||
| 191 | + public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) { | ||
| 192 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 193 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 194 | + Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); | ||
| 195 | + List<Object[]> reslutList = stationRouteRepository.findUpStationRouteCode(lineId, direction, stationRouteCode); | ||
| 196 | + List<Map<String, Object>> list = new ArrayList<Map<String,Object>>(); | ||
| 197 | + if(reslutList.size()>0) { | ||
| 198 | + for(int i = 0 ; i <reslutList.size() ;i++){ | ||
| 199 | + Map<String, Object> tempM = new HashMap<String, Object>(); | ||
| 200 | + tempM.put("stationRouteCode", reslutList.get(i)[0]); | ||
| 201 | + tempM.put("stationRouteMarke", reslutList.get(i)[1]); | ||
| 202 | + list.add(tempM); | ||
| 203 | + } | ||
| 204 | + } | ||
| 205 | + return list; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + private void traversalStation(List<LsStationRoute> stationRoutes, List<Map<String, Object>> resultList, int len) { | ||
| 209 | + for(int i = 0 ; i < len; i++) { | ||
| 210 | + LsStationRoute stationRoute = stationRoutes.get(i); | ||
| 211 | + Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 212 | + | ||
| 213 | + tempM.put("stationRouteLine", stationRoute.getLine().getId()); | ||
| 214 | + | ||
| 215 | + tempM.put("stationRouteStation", stationRoute.getStation().getId()); | ||
| 216 | + | ||
| 217 | + tempM.put("stationRouteCode", stationRoute.getStationRouteCode()); | ||
| 218 | + | ||
| 219 | + tempM.put("stationRouteLIneCode", stationRoute.getLineCode()); | ||
| 220 | + | ||
| 221 | + tempM.put("stationRouteStationMark", stationRoute.getStationMark()); | ||
| 222 | + | ||
| 223 | + tempM.put("stationOutStationNmber", stationRoute.getOutStationNmber()); | ||
| 224 | + | ||
| 225 | + tempM.put("stationRoutedirections", stationRoute.getDirections()); | ||
| 226 | + | ||
| 227 | + tempM.put("stationRouteDistances", stationRoute.getDistances()); | ||
| 228 | + | ||
| 229 | + tempM.put("stationRouteToTime", stationRoute.getToTime()); | ||
| 230 | + | ||
| 231 | + tempM.put("staitonRouteFirstTime", stationRoute.getFirstTime()); | ||
| 232 | + | ||
| 233 | + tempM.put("stationRouteEndTime", stationRoute.getEndTime()); | ||
| 234 | + | ||
| 235 | + tempM.put("stationRouteDescriptions", stationRoute.getDescriptions()); | ||
| 236 | + | ||
| 237 | + tempM.put("stationRouteDestroy", stationRoute.getDestroy()); | ||
| 238 | + | ||
| 239 | + tempM.put("stationRouteVersions", stationRoute.getVersions()); | ||
| 240 | + | ||
| 241 | + tempM.put("stationRouteCreateBy", stationRoute.getCreateBy()); | ||
| 242 | + | ||
| 243 | + tempM.put("stationRouteCreateDate", stationRoute.getCreateDate()); | ||
| 244 | + | ||
| 245 | + tempM.put("stationRouteUpdateBy", stationRoute.getUpdateBy()); | ||
| 246 | + | ||
| 247 | + tempM.put("stationRouteUpdateDate", stationRoute.getUpdateDate()); | ||
| 248 | + | ||
| 249 | + tempM.put("stationId", stationRoute.getStation().getId()); | ||
| 250 | + | ||
| 251 | + tempM.put("stationCode", stationRoute.getStation().getStationCode()); | ||
| 252 | + | ||
| 253 | + tempM.put("stationRouteName", stationRoute.getStationName()); | ||
| 254 | + | ||
| 255 | + tempM.put("stationRoadCoding", stationRoute.getStation().getRoadCoding()); | ||
| 256 | + | ||
| 257 | + tempM.put("stationJwpoints", stationRoute.getStation().getCenterPoint().toString()); | ||
| 258 | + | ||
| 259 | + CoordinateConverter.Location location = CoordinateConverter.LocationMake(stationRoute.getStation().getCenterPointWgs().toString()); | ||
| 260 | + tempM.put("stationGlonx", location.getLng()); | ||
| 261 | + | ||
| 262 | + tempM.put("stationGlaty", location.getLat()); | ||
| 263 | + | ||
| 264 | + Polygon polygon = stationRoute.getBufferPolygon(), polygonWgs = stationRoute.getBufferPolygonWgs(); | ||
| 265 | + tempM.put("stationBPolyonGrid", polygon == null ? "" : polygon.toString()); | ||
| 266 | + | ||
| 267 | + tempM.put("stationGPloyonGrid", polygonWgs == null ? "" : polygonWgs.toString()); | ||
| 268 | + | ||
| 269 | + tempM.put("stationDestroy", stationRoute.getStation().getDestroy()); | ||
| 270 | + | ||
| 271 | + tempM.put("stationRadius", stationRoute.getRadius()); | ||
| 272 | + | ||
| 273 | + tempM.put("stationShapesType", stationRoute.getShapedType()); | ||
| 274 | + | ||
| 275 | + tempM.put("stationVersions", stationRoute.getStation().getVersions()); | ||
| 276 | + | ||
| 277 | + tempM.put("sttationDescriptions", stationRoute.getStation().getDescriptions()); | ||
| 278 | + | ||
| 279 | + tempM.put("stationCreateBy", stationRoute.getStation().getCreateBy()); | ||
| 280 | + | ||
| 281 | + tempM.put("stationCreateDate", stationRoute.getStation().getCreateDate()); | ||
| 282 | + | ||
| 283 | + tempM.put("stationUpdateBy", stationRoute.getStation().getUpdateBy()); | ||
| 284 | + | ||
| 285 | + tempM.put("stationUpdateDate", stationRoute.getStation().getUpdateDate()); | ||
| 286 | + | ||
| 287 | + tempM.put("stationRouteId", stationRoute.getId()); | ||
| 288 | + tempM.put("zdmc", stationRoute.getStationName()); | ||
| 289 | + // 行业编码 | ||
| 290 | + tempM.put("industryCode", stationRoute.getIndustryCode()); | ||
| 291 | + try { | ||
| 292 | + tempM.put("stationNameEn", stationRoute.getStationNameEn()); | ||
| 293 | + } catch (Exception e) { | ||
| 294 | + e.printStackTrace(); | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + resultList.add(tempM); | ||
| 298 | + } | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + /** | ||
| 302 | + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | ||
| 303 | + * | ||
| 304 | + * @param map <lineId:线路ID; direction:方向> | ||
| 305 | + * | ||
| 306 | + * @return List<Map<String, Object>> | ||
| 307 | + */ | ||
| 308 | + @Override | ||
| 309 | + public List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map) { | ||
| 310 | + | ||
| 311 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 312 | + | ||
| 313 | + // 线路ID | ||
| 314 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 315 | + | ||
| 316 | + // 方向 | ||
| 317 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 318 | + | ||
| 319 | + List<Object[]> list = stationRouteRepository.getSelectStationRouteCenterPoints(lineId, direction); | ||
| 320 | + | ||
| 321 | + if(list.size()>0) { | ||
| 322 | + | ||
| 323 | + for(int i = 0;i<list.size();i++) { | ||
| 324 | + | ||
| 325 | + Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 326 | + | ||
| 327 | + tempM.put("bJwpoints", list.get(i)[0]); | ||
| 328 | + | ||
| 329 | + tempM.put("stationName", list.get(i)[1]); | ||
| 330 | + | ||
| 331 | + resultList.add(tempM); | ||
| 332 | + | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + } | ||
| 336 | + | ||
| 337 | + return resultList; | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + /** | ||
| 341 | + * @Description :TODO(查询线路某方向下所有站点) | ||
| 342 | + * | ||
| 343 | + * @param map <lineId:线路ID; direction:方向> | ||
| 344 | + * | ||
| 345 | + * @return List<Map<String, Object>> | ||
| 346 | + */ | ||
| 347 | + @Override | ||
| 348 | + public List<Map<String, Object>> getStationRouteList(Map<String, Object> map) { | ||
| 349 | + if (map.get("line.id_eq") == null || map.get("directions_eq") == null || map.get("versions_eq") == null) { | ||
| 350 | + throw new IllegalArgumentException("需正确传入线路、方向、版本参数"); | ||
| 351 | + } | ||
| 352 | + map.put("destroy_eq", 0); | ||
| 353 | + List<LsStationRoute> stationRoutes = lsStationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "stationRouteCode")); | ||
| 354 | + | ||
| 355 | + List<Map<String, Object>> resultList = new ArrayList<>(); | ||
| 356 | + | ||
| 357 | + int len = stationRoutes.size(); | ||
| 358 | + | ||
| 359 | + if(len > 0) { | ||
| 360 | + // 遍历站点 | ||
| 361 | + traversalStation(stationRoutes, resultList, len); | ||
| 362 | + } | ||
| 363 | + return resultList; | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + /** | ||
| 367 | + * @Description :TODO(撤销站点) | ||
| 368 | + * | ||
| 369 | + * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> | ||
| 370 | + * | ||
| 371 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 372 | + */ | ||
| 373 | + @Override | ||
| 374 | + public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) { | ||
| 375 | + Map<String, Object> resultMap = new HashMap<String,Object>(); | ||
| 376 | + | ||
| 377 | + try { | ||
| 378 | + | ||
| 379 | + Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString()); | ||
| 380 | + | ||
| 381 | + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); | ||
| 382 | + | ||
| 383 | + lsStationRouteRepository.deleteById(stationRouteId); | ||
| 384 | + | ||
| 385 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 386 | + | ||
| 387 | + } catch (Exception e) { | ||
| 388 | + | ||
| 389 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 390 | + | ||
| 391 | + logger.error("save erro.", e); | ||
| 392 | + | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + return resultMap; | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + /** | ||
| 399 | + * @Description : TODO(根据线路ID生成行单) | ||
| 400 | + * | ||
| 401 | + * @param map <lineId:线路ID> | ||
| 402 | + * | ||
| 403 | + * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> | ||
| 404 | + */ | ||
| 405 | + @Override | ||
| 406 | + public Map<String, Object> usingSingle(Map<String, Object> map) { | ||
| 407 | + // 返回值map | ||
| 408 | + Map<String, Object> resultMap = new HashMap<String,Object>(); | ||
| 409 | + try { | ||
| 410 | + // 获取线路ID | ||
| 411 | + Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | ||
| 412 | + /** 查询线路信息 @param:<lineId:线路ID> */ | ||
| 413 | + Line line = lineRepository.findById(lineId).get(); | ||
| 414 | + | ||
| 415 | + | ||
| 416 | + Business company = businessRepository.findByBusinessCode(line.getCompany()).get(0); | ||
| 417 | + | ||
| 418 | + Integer fileVersions = lineRepository.findfileVersions(lineId); | ||
| 419 | + if(fileVersions == null) { | ||
| 420 | + lineRepository.addFileVersions(line.getId(), line.getLineCode()); | ||
| 421 | + fileVersions = 1; | ||
| 422 | + } else { | ||
| 423 | + fileVersions = fileVersions + 1; | ||
| 424 | + lineRepository.editFileVersions(line.getId(),fileVersions); | ||
| 425 | + } | ||
| 426 | +// Integer fileVersions = map.get("fileVersions").equals("") ? 1 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认1 | ||
| 427 | + /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ | ||
| 428 | + List<Object[]> objects = stationRouteRepository.usingSingle(lineId); | ||
| 429 | + if (objects.size()>0) { | ||
| 430 | +// // 报站音频 | ||
| 431 | +// Set<String> languages = new HashSet<>(); | ||
| 432 | +// languages.add("cn"); | ||
| 433 | +// languages.add("sh"); | ||
| 434 | +// languages.add("en"); | ||
| 435 | +// InputStream tts = ttsAndZip(objects, line, languages); | ||
| 436 | + /** 获取配置文件里的ftp登录参数 */ | ||
| 437 | + Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); | ||
| 438 | + // 压缩文件名 | ||
| 439 | + String odlGzFileName = line.getLineCode() + ".txt.gz"; | ||
| 440 | + // txt文件名 | ||
| 441 | + String textFileName = line.getLineCode() + ".txt"; | ||
| 442 | + // 创建一个ftp上传实例 | ||
| 443 | + FTPClientUtils clientUtils = new FTPClientUtils(); | ||
| 444 | + // IP | ||
| 445 | + String url = FTPParamMap.get("url").toString(); | ||
| 446 | + // 端口 | ||
| 447 | + int port = Integer.valueOf(FTPParamMap.get("port").toString()); | ||
| 448 | + // 用户名 | ||
| 449 | + String username = FTPParamMap.get("username").toString(); | ||
| 450 | + // 密码 | ||
| 451 | + String password = FTPParamMap.get("password").toString(); | ||
| 452 | + // 相对路径 | ||
| 453 | + String remotePath = FTPParamMap.get("remotePath").toString(); | ||
| 454 | + /** 如果已存在相同行单文件名则先删除 */ | ||
| 455 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName); | ||
| 456 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName); | ||
| 457 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", textFileName); | ||
| 458 | + String textStr = ""; | ||
| 459 | +// boolean tempTag = ishxType(objects); | ||
| 460 | + Integer linePlayType = line.getLinePlayType() == null ? -1:line.getLinePlayType(); | ||
| 461 | + if(linePlayType == 1) | ||
| 462 | + textStr = hxTextFileToFtp(objects,lineId);// 环线行单文件内容 | ||
| 463 | + else if (linePlayType == 0) | ||
| 464 | + textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | ||
| 465 | + else | ||
| 466 | + resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 | ||
| 467 | + | ||
| 468 | + textStr = line.getName() + " " + fileVersions + "\r\n" + textStr; | ||
| 469 | + InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | ||
| 470 | + /** 生成txt文件,上传ftp */ | ||
| 471 | + clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | ||
| 472 | + // 创建打包实例 | ||
| 473 | + PackTarGZUtils packTarGZUtils= new PackTarGZUtils(); | ||
| 474 | + /** 获取txt文件 */ | ||
| 475 | + File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName); | ||
| 476 | + File target = new File(odlGzFileName); | ||
| 477 | + // 将txt文件打包 | ||
| 478 | + File targetFile = PackTarGZUtils.compress(textFile, target); | ||
| 479 | + clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); | ||
| 480 | + // 删除文件 | ||
| 481 | + textFile.delete(); | ||
| 482 | + targetFile.delete(); | ||
| 483 | + | ||
| 484 | + | ||
| 485 | + textStr = newTextVoiceFileToFTP(objects,lineId); | ||
| 486 | + | ||
| 487 | + String lineName = line.getName(); | ||
| 488 | + | ||
| 489 | + /*try { | ||
| 490 | + lineName = Integer.parseInt(line.getName().replace("路", "")) + ""; | ||
| 491 | + } catch (Exception e) { | ||
| 492 | + }*/ | ||
| 493 | + | ||
| 494 | + String head = lineName + " " + fileVersions + " " + line.getStartStationFirstTime() + "-" + line.getStartStationEndTime() + " " + line.getEndStationFirstTime() + "-" + line.getEndStationEndTime() + " " + line.getTicketPrice() + " " + company.getBusinessName().replace("公司", "公交") + " " + (company.getPhoneNum()== null ? "-" : company.getPhoneNum()); | ||
| 495 | + | ||
| 496 | + textStr = head +"\r\n" + textStr; | ||
| 497 | + | ||
| 498 | + input = new ByteArrayInputStream(textStr.getBytes("gbk")); | ||
| 499 | + | ||
| 500 | + clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", textFileName, input); | ||
| 501 | + | ||
| 502 | +// textFile.delete(); | ||
| 503 | + | ||
| 504 | +// clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode())); | ||
| 505 | +// clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode()), tts); | ||
| 506 | + | ||
| 507 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 508 | + }else { | ||
| 509 | + resultMap.put("status","NOTDATA"); | ||
| 510 | + } | ||
| 511 | + } catch (Exception e) { | ||
| 512 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 513 | + logger.error("save erro.", e); | ||
| 514 | + } finally { | ||
| 515 | + return resultMap; | ||
| 516 | + } | ||
| 517 | + } | ||
| 518 | + | ||
| 519 | + /** | ||
| 520 | + * @Description : TODO(形成行单文件内容) | ||
| 521 | + * | ||
| 522 | + * @param objects :站点路由信息 | ||
| 523 | + * | ||
| 524 | + * {[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标) | ||
| 525 | + * | ||
| 526 | + * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码); | ||
| 527 | + * | ||
| 528 | + * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} | ||
| 529 | + * | ||
| 530 | + * @param lineId :线路ID | ||
| 531 | + * | ||
| 532 | + * @return String | ||
| 533 | + */ | ||
| 534 | + public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | ||
| 535 | + | ||
| 536 | + // 返回值String | ||
| 537 | + String stationRStr = ""; | ||
| 538 | + // windows下的文本文件换行符 | ||
| 539 | + //String enterStr = "\r\n"; | ||
| 540 | + // linux/unix下的文本文件换行符 | ||
| 541 | + String enterStr = "\r"; | ||
| 542 | + int defaultZdxh = 0; | ||
| 543 | + if(objects.size()>0) { | ||
| 544 | + for(int i = 0; i<objects.size();i++) { | ||
| 545 | + defaultZdxh ++ ; | ||
| 546 | + // 经度 | ||
| 547 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | ||
| 548 | + | ||
| 549 | + // 纬度 | ||
| 550 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | ||
| 551 | + | ||
| 552 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 553 | + | ||
| 554 | + lat = "\t" + lat; | ||
| 555 | + | ||
| 556 | + // 站点类型 | ||
| 557 | + String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | ||
| 558 | + | ||
| 559 | + String stationMake = ""; | ||
| 560 | + | ||
| 561 | + if(stationMakeStr.equals("E")) { | ||
| 562 | + stationMake = "\t2"; | ||
| 563 | + }else { | ||
| 564 | + stationMake ="\t1"; | ||
| 565 | + } | ||
| 566 | + | ||
| 567 | + // 站点序号 | ||
| 568 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | ||
| 569 | + String stationNo = String.valueOf(defaultZdxh); | ||
| 570 | + | ||
| 571 | + stationNo = "\t" + stationNo; | ||
| 572 | + | ||
| 573 | + // 站点编码 | ||
| 574 | + String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | ||
| 575 | + | ||
| 576 | + int len = stationCode.length(); | ||
| 577 | + if(len<8) { | ||
| 578 | + int dx = 8 - len; | ||
| 579 | + String addStr = ""; | ||
| 580 | + for(int p =0;p<dx;p++) { | ||
| 581 | + addStr = addStr + "0"; | ||
| 582 | + } | ||
| 583 | + stationCode = addStr + stationCode; | ||
| 584 | + }else if(len>8){ | ||
| 585 | + stationCode = stationCode.substring(8); | ||
| 586 | + } | ||
| 587 | + | ||
| 588 | + stationCode = "\t" +stationCode; | ||
| 589 | + | ||
| 590 | + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | ||
| 591 | + | ||
| 592 | + String tempDistc = String.valueOf((int) dis); | ||
| 593 | + | ||
| 594 | + // 站点距离 | ||
| 595 | + String staitondistance = "\t" + tempDistc; | ||
| 596 | + | ||
| 597 | + // 站点名称 | ||
| 598 | + String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | ||
| 599 | + | ||
| 600 | + stationName = "\t" +stationName; | ||
| 601 | + | ||
| 602 | + // 限速 | ||
| 603 | + // String sleepStr = " " + "60"; | ||
| 604 | + | ||
| 605 | + // 限速 | ||
| 606 | + String sleepStr = ""; | ||
| 607 | + // 方向 | ||
| 608 | + int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | ||
| 609 | + /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 610 | + List<Object[]> sobje = sectionRouteRepository.sectionRouteVector(lineId,directions); | ||
| 611 | + if(sobje.size()==1) { | ||
| 612 | + double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 613 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 614 | +// int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | ||
| 615 | +// sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 616 | + }else if(sobje.size()>1){ | ||
| 617 | + for(int j =0;j<sobje.size();j++) { | ||
| 618 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 619 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 620 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 621 | + List<Point> ps = new ArrayList<>(); | ||
| 622 | + String[] pArray = pointsStr.split(","); | ||
| 623 | + for(int a = 0; a <pArray.length; a++) { | ||
| 624 | + String[] tmepA = pArray[a].split(" "); | ||
| 625 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 626 | + ps.add(temp); | ||
| 627 | + } | ||
| 628 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 629 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 630 | + break; | ||
| 631 | + } | ||
| 632 | + } | ||
| 633 | + } | ||
| 634 | + if(sleepStr.equals("")) | ||
| 635 | + sleepStr = "\t" + "60"; | ||
| 636 | + stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | ||
| 637 | + } | ||
| 638 | + | ||
| 639 | + } | ||
| 640 | + return stationRStr; | ||
| 641 | + | ||
| 642 | + } | ||
| 643 | + | ||
| 644 | + public String newTextVoiceFileToFTP(List<Object[]> objects,Integer lineId) { | ||
| 645 | + | ||
| 646 | + // 返回值String | ||
| 647 | + String stationRStr = ""; | ||
| 648 | + // windows下的文本文件换行符 | ||
| 649 | + String enterStr = "\r\n"; | ||
| 650 | + // linux/unix下的文本文件换行符 | ||
| 651 | +// String enterStr = "\r"; | ||
| 652 | + int defaultZdxh = 0; | ||
| 653 | + if(objects.size()>0) { | ||
| 654 | + for(int i = 0; i<objects.size();i++) { | ||
| 655 | + defaultZdxh ++ ; | ||
| 656 | + // 经度 | ||
| 657 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | ||
| 658 | + | ||
| 659 | + // 纬度 | ||
| 660 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | ||
| 661 | + | ||
| 662 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 663 | + | ||
| 664 | + lat = "\t" + lat; | ||
| 665 | + | ||
| 666 | + // 站点类型 | ||
| 667 | + String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | ||
| 668 | + | ||
| 669 | + String stationMake = ""; | ||
| 670 | + | ||
| 671 | + if(stationMakeStr.equals("E")) { | ||
| 672 | + stationMake = "\t2"; | ||
| 673 | + }else { | ||
| 674 | + stationMake ="\t1"; | ||
| 675 | + } | ||
| 676 | + | ||
| 677 | + // 站点序号 | ||
| 678 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | ||
| 679 | + String stationNo = String.valueOf(defaultZdxh); | ||
| 680 | + | ||
| 681 | + stationNo = "\t" + stationNo; | ||
| 682 | + | ||
| 683 | + // 站点编码 | ||
| 684 | + String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | ||
| 685 | + | ||
| 686 | + int len = stationCode.length(); | ||
| 687 | + if(len<8) { | ||
| 688 | + int dx = 8 - len; | ||
| 689 | + String addStr = ""; | ||
| 690 | + for(int p =0;p<dx;p++) { | ||
| 691 | + addStr = addStr + "0"; | ||
| 692 | + } | ||
| 693 | + stationCode = addStr + stationCode; | ||
| 694 | + }else if(len>8){ | ||
| 695 | + stationCode = stationCode.substring(8); | ||
| 696 | + } | ||
| 697 | + | ||
| 698 | + stationCode = "\t" +stationCode; | ||
| 699 | + | ||
| 700 | + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | ||
| 701 | + | ||
| 702 | + String tempDistc = String.valueOf((int) dis); | ||
| 703 | + | ||
| 704 | + // 站点距离 | ||
| 705 | + String staitondistance = "\t" + tempDistc; | ||
| 706 | + | ||
| 707 | + // 站点名称 | ||
| 708 | + String stationName = objects.get(i)[7].equals("") ? " " : objects.get(i)[7].toString(); | ||
| 709 | + | ||
| 710 | + String stationNameEn = " "; | ||
| 711 | + if(objects.get(i)[9] != null){ | ||
| 712 | + stationNameEn = objects.get(i)[9].equals("") ? " " : objects.get(i)[9].toString(); | ||
| 713 | + } | ||
| 714 | + | ||
| 715 | + | ||
| 716 | + stationName = "\t" +stationName; | ||
| 717 | + stationNameEn = "\t" +stationNameEn; | ||
| 718 | + | ||
| 719 | + // 限速 | ||
| 720 | + // String sleepStr = " " + "60"; | ||
| 721 | + | ||
| 722 | + // 限速 | ||
| 723 | + String sleepStr = ""; | ||
| 724 | + // 方向 | ||
| 725 | + int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | ||
| 726 | + if (directions == 1) { | ||
| 727 | + stationName = stationName.replaceAll("\\(起点站\\)", "").replaceAll("\\(终点站\\)", "").replaceAll("(起点站)", "").replaceAll("(终点站)", ""); | ||
| 728 | + } | ||
| 729 | + /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 730 | + List<Object[]> sobje = sectionRouteRepository.sectionRouteVector(lineId,directions); | ||
| 731 | + if(sobje.size()==1) { | ||
| 732 | + double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 733 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 734 | +// int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | ||
| 735 | +// sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 736 | + }else if(sobje.size()>1){ | ||
| 737 | + for(int j =0;j<sobje.size();j++) { | ||
| 738 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 739 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 740 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 741 | + List<Point> ps = new ArrayList<>(); | ||
| 742 | + String[] pArray = pointsStr.split(","); | ||
| 743 | + for(int a = 0; a <pArray.length; a++) { | ||
| 744 | + String[] tmepA = pArray[a].split(" "); | ||
| 745 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 746 | + ps.add(temp); | ||
| 747 | + } | ||
| 748 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 749 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 750 | + break; | ||
| 751 | + } | ||
| 752 | + } | ||
| 753 | + } | ||
| 754 | + if(sleepStr.equals("")) | ||
| 755 | + sleepStr = "\t" + "60"; | ||
| 756 | + stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + stationNameEn + enterStr; | ||
| 757 | + } | ||
| 758 | + | ||
| 759 | + } | ||
| 760 | + return stationRStr; | ||
| 761 | + | ||
| 762 | + } | ||
| 763 | + | ||
| 764 | + public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { | ||
| 765 | + String restStr = ""; | ||
| 766 | + // windows下的文本文件换行符 | ||
| 767 | + //String enterStr = "\r\n"; | ||
| 768 | + // linux/unix下的文本文件换行符 | ||
| 769 | + String enterStr = "\r"; | ||
| 770 | + int xh = 1 ; | ||
| 771 | + for(int x =0;x<2;x++) { | ||
| 772 | + for(int i = 0; i<objects.size();i++) { | ||
| 773 | + if(Integer.valueOf(objects.get(i)[8].toString())==0) { | ||
| 774 | + // 经度 | ||
| 775 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); | ||
| 776 | + | ||
| 777 | + // 纬度 | ||
| 778 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); | ||
| 779 | + | ||
| 780 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 781 | + lat = "\t" + lat; | ||
| 782 | + // 站点类型 | ||
| 783 | + String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | ||
| 784 | + String stationMake = ""; | ||
| 785 | + if(stationMakeStr.equals("E")) { | ||
| 786 | + stationMake = "\t2"; | ||
| 787 | + }else { | ||
| 788 | + stationMake ="\t1"; | ||
| 789 | + } | ||
| 790 | + // 站点序号 | ||
| 791 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | ||
| 792 | + String stationNo = "\t" + xh; | ||
| 793 | + // 站点编码 | ||
| 794 | + String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | ||
| 795 | + int len = stationCode.length(); | ||
| 796 | + if(len<8) { | ||
| 797 | + int dx = 8 - len; | ||
| 798 | + String addStr = ""; | ||
| 799 | + for(int p =0;p<dx;p++) { | ||
| 800 | + addStr = addStr + "0"; | ||
| 801 | + } | ||
| 802 | + stationCode = addStr + stationCode; | ||
| 803 | + }else if(len>8){ | ||
| 804 | + stationCode = stationCode.substring(8); | ||
| 805 | + } | ||
| 806 | + stationCode = "\t" +stationCode; | ||
| 807 | + double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | ||
| 808 | + String tempDistc = String.valueOf((int) dis); | ||
| 809 | + // 站点距离 | ||
| 810 | + String staitondistance = "\t" + tempDistc; | ||
| 811 | + // 站点名称 | ||
| 812 | + String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); | ||
| 813 | + stationName = "\t" +stationName; | ||
| 814 | + // 限速 | ||
| 815 | + String sleepStr = ""; | ||
| 816 | + // 方向 | ||
| 817 | + int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | ||
| 818 | + if (directions == 1) { | ||
| 819 | + stationName = stationName.replaceAll("\\(起点站\\)", "").replaceAll("\\(终点站\\)", "").replaceAll("(起点站)", "").replaceAll("(终点站)", ""); | ||
| 820 | + } | ||
| 821 | + /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | ||
| 822 | + List<Object[]> sobje = sectionRouteRepository.sectionRouteVector(lineId,directions); | ||
| 823 | + if(sobje.size()==1) { | ||
| 824 | +// int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); | ||
| 825 | +// sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 826 | + double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 827 | + sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 828 | + }else if(sobje.size()>1){ | ||
| 829 | + for(int j =0;j<sobje.size();j++) { | ||
| 830 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 831 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 832 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 833 | + List<Point> ps = new ArrayList<>(); | ||
| 834 | + String[] pArray = pointsStr.split(","); | ||
| 835 | + for(int a = 0; a <pArray.length; a++) { | ||
| 836 | + String[] tmepA = pArray[a].split(" "); | ||
| 837 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 838 | + ps.add(temp); | ||
| 839 | + } | ||
| 840 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 841 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 842 | + break; | ||
| 843 | + } | ||
| 844 | + } | ||
| 845 | + } | ||
| 846 | + if(sleepStr.equals("")) | ||
| 847 | + sleepStr = "\t" + "60"; | ||
| 848 | + xh++; | ||
| 849 | + restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | ||
| 850 | + } | ||
| 851 | + } | ||
| 852 | + } | ||
| 853 | + System.out.println(restStr); | ||
| 854 | + return restStr; | ||
| 855 | + } | ||
| 856 | + | ||
| 857 | + public boolean isPointOnPolyline (Map<String, Object> point, List<Map<String, Object>> listMap ){ | ||
| 858 | + | ||
| 859 | + boolean success = false; | ||
| 860 | + | ||
| 861 | + for(int l = 0; l < listMap.size() - 1; l ++){ | ||
| 862 | + | ||
| 863 | + Map<String, Object> tempM = listMap.get(l); | ||
| 864 | + | ||
| 865 | + Map<String, Object> nextTempM = listMap.get(l+1); | ||
| 866 | + | ||
| 867 | + if (Double.valueOf(point.get("lng").toString())>= Math.min(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && Double.valueOf(point.get("lng").toString()) <= Math.max(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && | ||
| 868 | + Double.valueOf(point.get("lat").toString()) >= Math.min(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString())) && Double.valueOf(point.get("lat").toString()) <= Math.max(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString()))){ | ||
| 869 | + | ||
| 870 | + | ||
| 871 | + double precision = (Double.valueOf(tempM.get("lng").toString()) - Double.valueOf(point.get("lng").toString())) * (Double.valueOf(nextTempM.get("lat").toString()) - Double.valueOf(point.get("lat").toString())) - | ||
| 872 | + (Double.valueOf(nextTempM.get("lng").toString()) - Double.valueOf(tempM.get("lng").toString())) * (Double.valueOf(tempM.get("lat").toString()) - Double.valueOf(nextTempM.get("lat").toString())); | ||
| 873 | + | ||
| 874 | + if(precision < 2e-10 && precision > -2e-10){ | ||
| 875 | + | ||
| 876 | + //实质判断是否接近0 | ||
| 877 | + success = true; | ||
| 878 | + | ||
| 879 | + } | ||
| 880 | + | ||
| 881 | + } | ||
| 882 | + | ||
| 883 | + } | ||
| 884 | + | ||
| 885 | + return success; | ||
| 886 | + } | ||
| 887 | + | ||
| 888 | + /** | ||
| 889 | + * @Description:TOOD(获取FTP登录参数) 这里暂时只做一个map值返回,以后可以作为ftp登录类提出来 | ||
| 890 | + * | ||
| 891 | + * @return : Map<String, Object> <url:IP;port:端口;username:用户名;password:密码;remotePath:相对路径> | ||
| 892 | + */ | ||
| 893 | + public Map<String, Object> readPropertiesGetFTPParam(){ | ||
| 894 | + | ||
| 895 | + // 返回值map | ||
| 896 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 897 | + | ||
| 898 | + Properties env = new Properties(); | ||
| 899 | + | ||
| 900 | + try { | ||
| 901 | + | ||
| 902 | + env.load(DBUtils_MS.class.getClassLoader().getResourceAsStream("ftp.properties")); | ||
| 903 | + | ||
| 904 | + resultMap.put("url", env.getProperty("ftp.url")); | ||
| 905 | + | ||
| 906 | + resultMap.put("port", env.getProperty("ftp.port")); | ||
| 907 | + | ||
| 908 | + resultMap.put("username", env.getProperty("ftp.username")); | ||
| 909 | + | ||
| 910 | + resultMap.put("password", env.getProperty("ftp.password")); | ||
| 911 | + | ||
| 912 | + resultMap.put("remotePath", env.getProperty("ftp.path")); | ||
| 913 | + | ||
| 914 | + } catch (Exception e) { | ||
| 915 | + | ||
| 916 | + e.printStackTrace(); | ||
| 917 | + | ||
| 918 | + } | ||
| 919 | + | ||
| 920 | + return resultMap ; | ||
| 921 | + } | ||
| 922 | + | ||
| 923 | + @Override | ||
| 924 | + public Map<String, Object> findByMultiLine(String lineIds) { | ||
| 925 | + Map<String, Object> rs = new HashMap<>(); | ||
| 926 | + try{ | ||
| 927 | + List<String> idx = Splitter.on(',').splitToList(lineIds); | ||
| 928 | + //路由 | ||
| 929 | + List<StationRoute> list = new ArrayList<>(); | ||
| 930 | + | ||
| 931 | + | ||
| 932 | + /** | ||
| 933 | + * in 查询符 无法和 @EntityGraph 同时配合使用,这可能是一个bug | ||
| 934 | + * 暂时只能循环单线路查询 | ||
| 935 | + */ | ||
| 936 | + //stationRouteRepository.multiLine(idx) | ||
| 937 | + for(String id : idx){ | ||
| 938 | + list.addAll(stationRouteRepository.findByLineCode(id)); | ||
| 939 | + } | ||
| 940 | + | ||
| 941 | + for(StationRoute sr : list){ | ||
| 942 | + sr.setLine(null); | ||
| 943 | + } | ||
| 944 | + //过滤部分字段 | ||
| 945 | + /*String jsonStr = JSON.toJSONString(list, new PropertyFilter() { | ||
| 946 | + | ||
| 947 | + @Override | ||
| 948 | + public boolean apply(Object object, String name, Object value) { | ||
| 949 | + if(name.equals("line")) | ||
| 950 | + return false; | ||
| 951 | + return true; | ||
| 952 | + } | ||
| 953 | + });*/ | ||
| 954 | + | ||
| 955 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 956 | + rs.put("list", list); | ||
| 957 | + }catch(Exception e){ | ||
| 958 | + logger.error("", e); | ||
| 959 | + rs.put("status", ResponseCode.ERROR); | ||
| 960 | + } | ||
| 961 | + | ||
| 962 | + return rs; | ||
| 963 | + } | ||
| 964 | + | ||
| 965 | + public void matchCode(List<StationRoute> stationRoutes,List<StationMatchData> stationMatchData, List<StationRoute> listMactah){ | ||
| 966 | + int listsSize = stationRoutes.size(); | ||
| 967 | + if(listsSize > 0 && stationMatchData.size() > 0){ | ||
| 968 | + if(stationMatchData.size() == listsSize){ | ||
| 969 | + for (int i=0; i<listsSize; i++) { | ||
| 970 | + if(!StringUtils.isEmpty(stationMatchData.get(i).getStationStandardCode())){ | ||
| 971 | + stationRoutes.get(i).setIndustryCode(stationMatchData.get(i).getStationStandardCode()); | ||
| 972 | + listMactah.add(stationRoutes.get(i)); | ||
| 973 | + } | ||
| 974 | + } | ||
| 975 | + } else { | ||
| 976 | + Map<String,String> smdMap = new HashMap<>(); | ||
| 977 | + for (int i=0; i<listsSize; i++) { | ||
| 978 | + | ||
| 979 | + String name = stationRoutes.get(i).getStationName(); | ||
| 980 | + String names[] = null; | ||
| 981 | + if(name.indexOf("(") != -1){ | ||
| 982 | + names = name.split("("); | ||
| 983 | + } else if(name.indexOf("(") != -1){ | ||
| 984 | + names = name.split("\\("); | ||
| 985 | + } | ||
| 986 | + | ||
| 987 | + for (StationMatchData smd:stationMatchData) { | ||
| 988 | + smdMap.put(smd.getStationName(),smd.getStationStandardCode()); | ||
| 989 | + String stationName =smd.getStationName(); | ||
| 990 | + String stationName2 =smd.getStationName2(); | ||
| 991 | + String industryCode =smd.getStationStandardCode(); | ||
| 992 | + if(StringUtils.isEmpty(industryCode)){ | ||
| 993 | + continue; | ||
| 994 | + } | ||
| 995 | + if(names != null && names.length > 1){ | ||
| 996 | +// if(stationRoutes.get(i).getStationMark().equals(smd.getStationType()) && (stationName.indexOf(names[0]) != -1 || stationName.indexOf(names[1].substring(0,names[1].length()-1)) != -1 || stationName2.indexOf(names[0]) != -1 || stationName2.indexOf(names[1].substring(0,names[1].length()-1)) != -1)){ | ||
| 997 | + if((stationName.indexOf(names[0]) != -1 || stationName.indexOf(names[1].substring(0,names[1].length()-1)) != -1 || stationName2.indexOf(names[0]) != -1 || stationName2.indexOf(names[1].substring(0,names[1].length()-1)) != -1)){ | ||
| 998 | + stationRoutes.get(i).setIndustryCode(industryCode); | ||
| 999 | + listMactah.add(stationRoutes.get(i)); | ||
| 1000 | + break; | ||
| 1001 | + } | ||
| 1002 | + }else { | ||
| 1003 | +// if(stationRoutes.get(i).getStationMark().equals(smd.getStationType()) && (stationName.indexOf(name) != -1 || stationName2.indexOf(name) != -1)){ | ||
| 1004 | + if(stationName.indexOf(name) != -1 || stationName2.indexOf(name) != -1){ | ||
| 1005 | +// if(stationRoutes.get(i).getStationMark().equals(smd.getStationType()) && (name.equals(stationName) || name.equals(stationName2))){ | ||
| 1006 | + | ||
| 1007 | + stationRoutes.get(i).setIndustryCode(industryCode); | ||
| 1008 | + listMactah.add(stationRoutes.get(i)); | ||
| 1009 | + break; | ||
| 1010 | + } | ||
| 1011 | + } | ||
| 1012 | + } | ||
| 1013 | + } | ||
| 1014 | + } | ||
| 1015 | + } | ||
| 1016 | + } | ||
| 1017 | + | ||
| 1018 | + private String subLine2Ftp(LineRegion lineRegion) { | ||
| 1019 | + StringBuilder builder = new StringBuilder(); | ||
| 1020 | + int len = lineRegion.getStationRoutes().size(); | ||
| 1021 | + int idx = 1; | ||
| 1022 | + for (int i = 0;i < len;i++) { | ||
| 1023 | + LsStationRoute route = lineRegion.getStationRoutes().get(i); | ||
| 1024 | + builder.append(route.getCenterPointWgs().getPosition().getCoordinate(0)) | ||
| 1025 | + .append("\t").append(route.getCenterPointWgs().getPosition().getCoordinate(1)) | ||
| 1026 | + .append("\t").append(i == len - 1 ? 2 : 1) | ||
| 1027 | + .append("\t").append(idx).append("\t"); | ||
| 1028 | + for (int j = 0;j < 8 - route.getStationCode().length();j++) { | ||
| 1029 | + builder.append("0"); | ||
| 1030 | + } | ||
| 1031 | + builder.append(route.getStationCode()) | ||
| 1032 | + .append("\t").append((int) route.getDistances().doubleValue() * 1000) | ||
| 1033 | + .append("\t0") | ||
| 1034 | + .append("\t").append(route.getStationName()) | ||
| 1035 | + .append("\t").append(route.getStationNameEn()) | ||
| 1036 | + .append("\r\n"); | ||
| 1037 | + | ||
| 1038 | + idx++; | ||
| 1039 | + } | ||
| 1040 | + | ||
| 1041 | + return builder.toString(); | ||
| 1042 | + } | ||
| 1043 | + | ||
| 1044 | + /** | ||
| 1045 | + * tts合成及打包 | ||
| 1046 | + * @param objects | ||
| 1047 | + * @param line | ||
| 1048 | + * @param languages 语言 如:cn、en、sh | ||
| 1049 | + */ | ||
| 1050 | + private InputStream ttsAndZip(List<Object[]> objects, Line line, Set<String> languages) throws Exception { | ||
| 1051 | + String lineId = line.getLineCode(); | ||
| 1052 | + StringBuilder cnBuilder = new StringBuilder(line.getName()).append("[p1000]"), enBuilder = new StringBuilder("Hello[p1000]"); | ||
| 1053 | + int ups = 0, downs = 0; | ||
| 1054 | + for (int i = 0;i < objects.size();i++) { | ||
| 1055 | + Object[] objArr = objects.get(i); | ||
| 1056 | + int direction = (int) objArr[8]; | ||
| 1057 | + String stationName = objArr[7] == null ? null : objArr[7].toString(), stationNameEn = objArr[9] == null ? null : objArr[9].toString(); | ||
| 1058 | + if (StringUtils.isEmpty(stationName)) { | ||
| 1059 | + throw new RuntimeException("存在异常的中文站点名称"); | ||
| 1060 | + } | ||
| 1061 | + // 如果要生成英语报站语音 | ||
| 1062 | + if (languages.contains("en")) { | ||
| 1063 | + if (StringUtils.isEmpty(stationNameEn)) { | ||
| 1064 | + throw new RuntimeException("存在异常的英文站点名称"); | ||
| 1065 | + } | ||
| 1066 | + enBuilder.append(stationNameEn).append("[p1000]"); | ||
| 1067 | + } | ||
| 1068 | + cnBuilder.append(stationName).append("[p1000]"); | ||
| 1069 | + if (direction == 0) { | ||
| 1070 | + ups++; | ||
| 1071 | + } else if (direction == 1) { | ||
| 1072 | + // 环线 | ||
| 1073 | + if (line.getLinePlayType() == 1) { | ||
| 1074 | + break; | ||
| 1075 | + } | ||
| 1076 | + downs++; | ||
| 1077 | + } | ||
| 1078 | + } | ||
| 1079 | + cnBuilder.delete(cnBuilder.length() - 8, cnBuilder.length() - 1); | ||
| 1080 | + enBuilder.delete(enBuilder.length() - 8, enBuilder.length() - 1); | ||
| 1081 | + | ||
| 1082 | + // 文本转语音并进行分割 | ||
| 1083 | + // 音频存放及压缩文件路径 | ||
| 1084 | + String linePath = String.format(linePathPattern, lineId), voicePath = String.format("%s%s.zip", linePath, lineId); | ||
| 1085 | + try { | ||
| 1086 | + String path = String.format("%scn.mp3", linePath); | ||
| 1087 | + IFlyUtils.textToSpeechCn(cnBuilder.toString(), path); | ||
| 1088 | + AudioOperationUtils.splitBySilence(path, String.format("%scn", linePath), 500, -40); | ||
| 1089 | + } catch (Exception e) { | ||
| 1090 | + throw new RuntimeException(e); | ||
| 1091 | + } | ||
| 1092 | + if (languages.contains("sh")) { | ||
| 1093 | + try { | ||
| 1094 | + String path = String.format("%ssh.mp3", linePath); | ||
| 1095 | + IFlyUtils.textToSpeechSh(cnBuilder.toString(), path); | ||
| 1096 | + AudioOperationUtils.splitBySilence(path, String.format("%ssh", linePath), 500, -40); | ||
| 1097 | + } catch (Exception e) { | ||
| 1098 | + throw new RuntimeException(e); | ||
| 1099 | + } | ||
| 1100 | + } | ||
| 1101 | + if (languages.contains("en")) { | ||
| 1102 | + try { | ||
| 1103 | + String path = String.format("%sen.mp3", linePath); | ||
| 1104 | + IFlyUtils.textToSpeechEn(enBuilder.toString(), path); | ||
| 1105 | + AudioOperationUtils.splitBySilence(path, String.format("%sen", linePath), 500, -40); | ||
| 1106 | + } catch (Exception e) { | ||
| 1107 | + throw new RuntimeException(e); | ||
| 1108 | + } | ||
| 1109 | + } | ||
| 1110 | + // 删除原线路音频 | ||
| 1111 | + File file = new File(linePath); | ||
| 1112 | + for (File f : file.listFiles()) { | ||
| 1113 | + if (f.isFile() && f.getName().endsWith(".mp3")) { | ||
| 1114 | + file.delete(); | ||
| 1115 | + } | ||
| 1116 | + } | ||
| 1117 | + | ||
| 1118 | + // 合并每站起步、到达语音 | ||
| 1119 | + int seq = 1, startSeq = 1, direction = 0; | ||
| 1120 | + seq = merge(lineId, seq, startSeq, direction, ups, languages); | ||
| 1121 | + startSeq = ups + 1; | ||
| 1122 | + direction = 1; | ||
| 1123 | + merge(lineId, seq, startSeq, direction, ups + downs, languages); | ||
| 1124 | + | ||
| 1125 | + // 压缩音频到zip | ||
| 1126 | + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(voicePath)); | ||
| 1127 | + for (File f : file.listFiles()) { | ||
| 1128 | + if (f.isFile() && f.getName().endsWith(".mp3")) { | ||
| 1129 | + addFileToZip(zos, f); | ||
| 1130 | + } | ||
| 1131 | + } | ||
| 1132 | + // Key打头音频 | ||
| 1133 | + file = new File(commonPath); | ||
| 1134 | + for (File f : file.listFiles()) { | ||
| 1135 | + if (f.isFile() && f.getName().startsWith("Key-")) { | ||
| 1136 | + addFileToZip(zos, f); | ||
| 1137 | + } | ||
| 1138 | + } | ||
| 1139 | + zos.flush(); | ||
| 1140 | + zos.close(); | ||
| 1141 | + | ||
| 1142 | + return new FileInputStream(voicePath); | ||
| 1143 | + } | ||
| 1144 | + | ||
| 1145 | + private static void addFileToZip(ZipOutputStream zos, File file) throws IOException { | ||
| 1146 | + FileInputStream fis = new FileInputStream(file); | ||
| 1147 | + ZipEntry zipEntry = new ZipEntry(file.getName()); | ||
| 1148 | + zos.putNextEntry(zipEntry); | ||
| 1149 | + | ||
| 1150 | + byte[] bytes = new byte[4096]; | ||
| 1151 | + int length; | ||
| 1152 | + while ((length = fis.read(bytes)) >= 0) { | ||
| 1153 | + zos.write(bytes, 0, length); | ||
| 1154 | + } | ||
| 1155 | + | ||
| 1156 | + zos.closeEntry(); | ||
| 1157 | + fis.close(); | ||
| 1158 | + } | ||
| 1159 | + | ||
| 1160 | + private int merge(String lineId, int seq, int startSeq, int direction, int terminal, Set<String> languages) throws Exception { | ||
| 1161 | + for (int i = startSeq;i <= terminal;i++) { | ||
| 1162 | + if (i > startSeq) { | ||
| 1163 | + if (i == startSeq + 1) { | ||
| 1164 | + // 生成首站 | ||
| 1165 | + mergeOriginStart(lineId, seq, i, direction, terminal, languages); | ||
| 1166 | + mergeNormalArrive(lineId, seq, i, direction, terminal, languages); | ||
| 1167 | + } else if (i == terminal) { | ||
| 1168 | + // 生成终点站 | ||
| 1169 | + mergeNormalStart(lineId, seq, i, direction, terminal, languages); | ||
| 1170 | + mergeTerminalArrive(lineId, seq, i, direction, terminal, languages); | ||
| 1171 | + } else { | ||
| 1172 | + // 生成中途站 | ||
| 1173 | + mergeNormalStart(lineId, seq, i, direction, terminal, languages); | ||
| 1174 | + mergeNormalArrive(lineId, seq, i, direction, terminal, languages); | ||
| 1175 | + } | ||
| 1176 | + seq++; | ||
| 1177 | + } | ||
| 1178 | + } | ||
| 1179 | + | ||
| 1180 | + return seq; | ||
| 1181 | + } | ||
| 1182 | + | ||
| 1183 | + private void mergeOriginStart(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | ||
| 1184 | + String linePath = String.format(linePathPattern, lineId); | ||
| 1185 | + List<String> arr = Arrays.asList(commonPath + "cn_origin_1.mp3", linePath + String.format("cn/%03d.mp3", 0), commonPath + "cn_origin_2.mp3", linePath + String.format("cn/%03d.mp3", terminal), commonPath + "sh_origin_1.mp3", linePath + String.format("sh/%03d.mp3", 0), commonPath + "sh_origin_2.mp3", linePath + String.format("cn/%03d.mp3", terminal), commonPath + "cn_start_1.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_start_2.mp3", commonPath + "sh_start_1.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_start_2.mp3", commonPath + "en_1.mp3", linePath + String.format("en/%03d.mp3", stationLevel), commonPath + "cn_start_3.mp3", commonPath + "sh_start_3.mp3"); | ||
| 1186 | + List<String> inputPaths = new ArrayList<>(); | ||
| 1187 | + for (String path : arr) { | ||
| 1188 | + for (String lang : languages) { | ||
| 1189 | + if (path.indexOf(lang) > -1) { | ||
| 1190 | + inputPaths.add(path); | ||
| 1191 | + break; | ||
| 1192 | + } | ||
| 1193 | + } | ||
| 1194 | + } | ||
| 1195 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03da%s-%03d-%s-Start.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | ||
| 1196 | + } | ||
| 1197 | + | ||
| 1198 | + private void mergeNormalStart(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | ||
| 1199 | + String linePath = String.format(linePathPattern, lineId); | ||
| 1200 | + List<String> arr = Arrays.asList(commonPath + "cn_start.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_start_2.mp3", commonPath + "sh_start_1.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_start_2.mp3", commonPath + "en_1.mp3", linePath + String.format("en/%03d.mp3", stationLevel), commonPath + "cn_start_3.mp3", commonPath + "sh_start_3.mp3"); | ||
| 1201 | + List<String> inputPaths = new ArrayList<>(); | ||
| 1202 | + for (String path : arr) { | ||
| 1203 | + for (String lang : languages) { | ||
| 1204 | + if (path.indexOf(lang) > -1) { | ||
| 1205 | + inputPaths.add(path); | ||
| 1206 | + break; | ||
| 1207 | + } | ||
| 1208 | + } | ||
| 1209 | + } | ||
| 1210 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03da%s-%03d-%s-Start.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | ||
| 1211 | + } | ||
| 1212 | + | ||
| 1213 | + private void mergeNormalArrive(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | ||
| 1214 | + String linePath = String.format(linePathPattern, lineId); | ||
| 1215 | + List<String> arr = new ArrayList<>(Arrays.asList(commonPath + "cn_arrive.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_arrive_1.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_arrive_1.mp3", commonPath + "en_2.mp3", linePath + String.format("en/%03d.mp3", stationLevel))); | ||
| 1216 | + List<String> inputPaths = new ArrayList<>(); | ||
| 1217 | + if (languages.contains("sh")) { | ||
| 1218 | + for (int i = 0;i < 3;i++) { | ||
| 1219 | + arr.add(linePath + String.format("cn/%03d.mp3", 0)); | ||
| 1220 | + arr.add(commonPath + "cn_origin_2.mp3"); | ||
| 1221 | + arr.add(linePath + String.format("cn/%03d.mp3", terminal)); | ||
| 1222 | + arr.add(linePath + String.format("sh/%03d.mp3", 0)); | ||
| 1223 | + arr.add(commonPath + "sh_origin_2.mp3"); | ||
| 1224 | + arr.add(linePath + String.format("sh/%03d.mp3", terminal)); | ||
| 1225 | + } | ||
| 1226 | + } else { | ||
| 1227 | + arr.add(linePath + String.format("cn/%03d.mp3", 0)); | ||
| 1228 | + arr.add(commonPath + "cn_origin_2.mp3"); | ||
| 1229 | + arr.add(linePath + String.format("cn/%03d.mp3", terminal)); | ||
| 1230 | + } | ||
| 1231 | + for (String path : arr) { | ||
| 1232 | + for (String lang : languages) { | ||
| 1233 | + if (path.indexOf(lang) > -1) { | ||
| 1234 | + inputPaths.add(path); | ||
| 1235 | + break; | ||
| 1236 | + } | ||
| 1237 | + } | ||
| 1238 | + } | ||
| 1239 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03db%s-%03d-%s-Arrive.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | ||
| 1240 | + } | ||
| 1241 | + | ||
| 1242 | + private void mergeTerminalArrive(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | ||
| 1243 | + String linePath = String.format(linePathPattern, lineId); | ||
| 1244 | + List<String> arr = Arrays.asList(commonPath + "cn_terminal.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_arrive_1.mp3", commonPath + "sh_terminal.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_arrive_1.mp3", commonPath + "en_3.mp3", linePath + String.format("en/%03d.mp3", stationLevel), commonPath + "terminal_music.mp3"); | ||
| 1245 | + List<String> inputPaths = new ArrayList<>(); | ||
| 1246 | + for (String path : arr) { | ||
| 1247 | + for (String lang : languages) { | ||
| 1248 | + if (path.indexOf(lang) > -1 || path.indexOf("terminal_music") > -1) { | ||
| 1249 | + inputPaths.add(path); | ||
| 1250 | + break; | ||
| 1251 | + } | ||
| 1252 | + } | ||
| 1253 | + } | ||
| 1254 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03db%s-%03d-%s-Arrive.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | ||
| 1255 | + } | ||
| 1256 | + | ||
| 1257 | + private void description() { | ||
| 1258 | + // Next stop is (en_1.mp3) | ||
| 1259 | + // We are arrival at (en_2.mp3) | ||
| 1260 | + // We are arrival at the terminal (en_3.mp3) | ||
| 1261 | + // 叮咚+欢迎乘坐 (cn_origin_1.mp3) | ||
| 1262 | + // 公交车方向 (cn_origin_2.mp3) | ||
| 1263 | + // 叮咚+车辆起步请拉好扶手投币后请配合朝里走下一站 (cn_start.mp3) | ||
| 1264 | + // 下一站 (cn_start_1.mp3) | ||
| 1265 | + // 请准备从后门下车 (cn_start_2.mp3) | ||
| 1266 | + // 乘客们请给需要帮助的乘客让个座谢谢 (cn_start_3.mp3) | ||
| 1267 | + // 叮咚+车辆进站请注意安全 (cn_arrive.mp3) | ||
| 1268 | + // 到了请配合从后门下车开门请当心 (cn_arrive_1.mp3) | ||
| 1269 | + // 叮咚+终点站 (cn_terminal.mp3) | ||
| 1270 | + // 欢迎乘坐(沪) (sh_origin_1.mp3) | ||
| 1271 | + // 公交车方向(沪) (sh_origin_2.mp3) | ||
| 1272 | + // 下一站(沪) (sh_start_1.mp3) | ||
| 1273 | + // 请准备从后门下车 (sh_start_2.mp3) | ||
| 1274 | + // 乘客们请给需要帮助的乘客让个座谢谢(沪) (sh_start_3.mp3) | ||
| 1275 | + // 到了请配合从后门下车开门请当心(沪) (sh_arrive_1.mp3) | ||
| 1276 | + // 终点站(沪) (sh_terminal.mp3) | ||
| 1277 | + // 终点音乐 (terminal_music.mp3) | ||
| 1278 | + } | ||
| 1279 | +} |
src/main/java/com/bsth/util/AudioOperationUtils.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import org.bytedeco.javacv.FFmpegFrameGrabber; | ||
| 5 | +import org.bytedeco.javacv.FFmpegFrameRecorder; | ||
| 6 | +import org.bytedeco.javacv.Frame; | ||
| 7 | + | ||
| 8 | +import java.io.*; | ||
| 9 | +import java.nio.ShortBuffer; | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +public class AudioOperationUtils { | ||
| 14 | + public static void main(String[] args) throws Exception { | ||
| 15 | +// int duration = 450000; | ||
| 16 | +// double silenceThreshold = -40; // 声音阈值,可以根据需要调整,单位通常是分贝dB | ||
| 17 | +// splitBySilence("D:\\tts.mp3", "D:\\88814\\cn", duration, silenceThreshold); | ||
| 18 | + | ||
| 19 | + List<String> paths = new ArrayList<>(); | ||
| 20 | + paths.add("D:/speech/803111/cn/000.mp3"); | ||
| 21 | + paths.add("D:/speech/803111/cn/001.mp3"); | ||
| 22 | + merge(paths, "D:/speech/803111/results.mp3"); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public static void merge(List<String> inputPaths, String outputPath) throws Exception { | ||
| 26 | + File file = new File(outputPath); | ||
| 27 | + if (!file.getParentFile().exists()) { | ||
| 28 | + file.getParentFile().mkdirs(); | ||
| 29 | + } | ||
| 30 | + FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(new File(outputPath), 1); | ||
| 31 | + | ||
| 32 | + int i = 0; | ||
| 33 | + Frame frame = null; | ||
| 34 | + for (String inputPath : inputPaths) { | ||
| 35 | + FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(inputPath); | ||
| 36 | + grabber.start(); | ||
| 37 | + if (i == 0) { | ||
| 38 | + recorder.setAudioCodec(grabber.getAudioCodec()); | ||
| 39 | + recorder.setFrameRate(grabber.getFrameRate()); | ||
| 40 | + recorder.setFormat(grabber.getFormat()); | ||
| 41 | + recorder.start(); | ||
| 42 | + } | ||
| 43 | + while ((frame = grabber.grabSamples()) != null) { | ||
| 44 | + recorder.record(frame); | ||
| 45 | + } | ||
| 46 | + grabber.stop(); | ||
| 47 | + grabber.close(); | ||
| 48 | + i++; | ||
| 49 | + } | ||
| 50 | + recorder.stop(); | ||
| 51 | + recorder.close(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public static void splitBySilence(String inputPath, String outputPath, int duration, double silenceThreshold) throws Exception { | ||
| 55 | + File file = new File(outputPath); | ||
| 56 | + if (!file.exists()) { | ||
| 57 | + file.mkdirs(); | ||
| 58 | + } | ||
| 59 | + boolean isSilent = false; | ||
| 60 | + FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(inputPath); | ||
| 61 | + grabber.start(); | ||
| 62 | + Frame frame = null; | ||
| 63 | + List<SilenceInfo> silenceInfos = new ArrayList<>(); | ||
| 64 | + long start = 0, end = 0; | ||
| 65 | + while((frame = grabber.grabSamples()) != null) { | ||
| 66 | + ShortBuffer buffer = (ShortBuffer) frame.samples[0]; | ||
| 67 | + double energy = 0; | ||
| 68 | + while (buffer.hasRemaining()) { | ||
| 69 | + short sample = buffer.get(); | ||
| 70 | + energy += sample * sample; | ||
| 71 | + } | ||
| 72 | + energy /= buffer.capacity(); | ||
| 73 | + double db = 20 * Math.log10(Math.sqrt(energy)); | ||
| 74 | + if (db < silenceThreshold) { | ||
| 75 | + if (!isSilent && start == 0) { | ||
| 76 | + isSilent = true; | ||
| 77 | + start = frame.timestamp; | ||
| 78 | + } | ||
| 79 | + } else { | ||
| 80 | + if (start != 0 && frame.timestamp - start >= duration) { | ||
| 81 | + SilenceInfo info = new SilenceInfo(end, start); | ||
| 82 | + silenceInfos.add(info); | ||
| 83 | + end = frame.timestamp; | ||
| 84 | + } | ||
| 85 | + isSilent = false; | ||
| 86 | + start = 0; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + if (silenceInfos.size() > 0) { | ||
| 90 | + SilenceInfo info = new SilenceInfo(end, grabber.getLengthInTime()); | ||
| 91 | + silenceInfos.add(info); | ||
| 92 | + } | ||
| 93 | + grabber.stop(); | ||
| 94 | + grabber.close(); | ||
| 95 | + grabber = new FFmpegFrameGrabber(inputPath); | ||
| 96 | + grabber.start(); | ||
| 97 | + int idx = 0; | ||
| 98 | + boolean flag = false; | ||
| 99 | + FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(new File(String.format("%s%s%03d.mp3", outputPath, File.separator, idx)), 1); | ||
| 100 | + recorder.setAudioCodec(grabber.getAudioCodec()); | ||
| 101 | + recorder.setFrameRate(grabber.getFrameRate()); | ||
| 102 | + recorder.setFormat(grabber.getFormat()); | ||
| 103 | + recorder.start(); | ||
| 104 | + SilenceInfo info = silenceInfos.get(idx); | ||
| 105 | + while ((frame = grabber.grabSamples()) != null) { | ||
| 106 | + if (idx < silenceInfos.size()) { | ||
| 107 | + if (frame.timestamp >= info.start && frame.timestamp <= info.end) { | ||
| 108 | + recorder.record(frame); | ||
| 109 | + flag = false; | ||
| 110 | + } else { | ||
| 111 | + if (!flag) { | ||
| 112 | + flag = true; | ||
| 113 | + recorder.stop(); | ||
| 114 | + recorder.close(); | ||
| 115 | + idx++; | ||
| 116 | + info = silenceInfos.get(idx); | ||
| 117 | + recorder = new FFmpegFrameRecorder(new File(String.format("%s%s%03d.mp3", outputPath, File.separator, idx)), 1); | ||
| 118 | + recorder.start(); | ||
| 119 | + recorder.setAudioCodec(grabber.getAudioCodec()); | ||
| 120 | + recorder.setFrameRate(grabber.getFrameRate()); | ||
| 121 | + recorder.setFormat(grabber.getFormat()); | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + if (recorder != null) { | ||
| 127 | + recorder.stop(); | ||
| 128 | + recorder.close(); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public final static class SilenceInfo { | ||
| 133 | + | ||
| 134 | + private long start; | ||
| 135 | + | ||
| 136 | + private long end; | ||
| 137 | + | ||
| 138 | + public SilenceInfo() {} | ||
| 139 | + | ||
| 140 | + public SilenceInfo(long start, long end) { | ||
| 141 | + this.start = start; | ||
| 142 | + this.end = end; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public long getStart() { | ||
| 146 | + return start; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setStart(long start) { | ||
| 150 | + this.start = start; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public long getEnd() { | ||
| 154 | + return end; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public void setEnd(long end) { | ||
| 158 | + this.end = end; | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | +} |
src/main/java/com/bsth/util/IFlyUtils.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.speech.SpeechRequest; | ||
| 4 | +import com.bsth.entity.speech.SpeechResponse; | ||
| 5 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 6 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 7 | +import org.java_websocket.client.WebSocketClient; | ||
| 8 | +import org.java_websocket.handshake.ServerHandshake; | ||
| 9 | +import org.slf4j.Logger; | ||
| 10 | +import org.slf4j.LoggerFactory; | ||
| 11 | + | ||
| 12 | +import javax.crypto.Mac; | ||
| 13 | +import javax.crypto.spec.SecretKeySpec; | ||
| 14 | +import java.io.*; | ||
| 15 | +import java.net.URI; | ||
| 16 | +import java.net.URL; | ||
| 17 | +import java.net.URLEncoder; | ||
| 18 | +import java.nio.charset.StandardCharsets; | ||
| 19 | +import java.text.SimpleDateFormat; | ||
| 20 | +import java.util.*; | ||
| 21 | + | ||
| 22 | +public class IFlyUtils { | ||
| 23 | + | ||
| 24 | + private final static ObjectMapper mapper = new ObjectMapper(); | ||
| 25 | + | ||
| 26 | + private final static Logger log = LoggerFactory.getLogger(IFlyUtils.class); | ||
| 27 | + | ||
| 28 | + private final static String apiKey = "46780e6779b6b1ba93503f24f097b771"; | ||
| 29 | + | ||
| 30 | + private final static String apiSecret = "ZWFjNzkzMTkzNzI3YmMzMTgwMWUzMWE0"; | ||
| 31 | + | ||
| 32 | + private final static String appId = "b4b21ad4"; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 生成普通话语音 | ||
| 36 | + * text以","进行分割 | ||
| 37 | + * @param text | ||
| 38 | + */ | ||
| 39 | + public static void textToSpeechCn(String text, String outputPath) throws Exception { | ||
| 40 | + File file = new File(outputPath); | ||
| 41 | + if (!file.getParentFile().exists()) { | ||
| 42 | + file.getParentFile().mkdirs(); | ||
| 43 | + } | ||
| 44 | + String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); | ||
| 45 | + SpeechRequest request = new SpeechRequest(); | ||
| 46 | + request.getCommon().put("app_id", appId); | ||
| 47 | + request.getBusiness().put("aue", "lame"); | ||
| 48 | + request.getBusiness().put("sfl", 1); | ||
| 49 | + request.getBusiness().put("vcn", "x4_lingxiaoshan_profnews"); | ||
| 50 | + request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK"))); | ||
| 51 | + request.getData().put("status", 2); | ||
| 52 | + websocketWork(wsUrl, request, new FileOutputStream(file)); | ||
| 53 | + while (!request.isCompleted()) { | ||
| 54 | + Thread.sleep(500); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 生成上海话语音 | ||
| 60 | + * text以","进行分割 | ||
| 61 | + * @param text | ||
| 62 | + */ | ||
| 63 | + public static void textToSpeechSh(String text, String outputPath) throws Exception { | ||
| 64 | + String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); | ||
| 65 | + SpeechRequest request = new SpeechRequest(); | ||
| 66 | + request.getCommon().put("app_id", appId); | ||
| 67 | + request.getBusiness().put("aue", "lame"); | ||
| 68 | + request.getBusiness().put("sfl", 1); | ||
| 69 | + request.getBusiness().put("vcn", "x3_ziling"); | ||
| 70 | + request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK"))); | ||
| 71 | + request.getData().put("status", 2); | ||
| 72 | + websocketWork(wsUrl, request, new FileOutputStream(outputPath)); | ||
| 73 | + while (!request.isCompleted()) { | ||
| 74 | + Thread.sleep(500); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 生成英语语音 | ||
| 80 | + * text以","进行分割 | ||
| 81 | + * @param text | ||
| 82 | + */ | ||
| 83 | + public static void textToSpeechEn(String text, String outputPath) throws Exception { | ||
| 84 | + String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); | ||
| 85 | + SpeechRequest request = new SpeechRequest(); | ||
| 86 | + request.getCommon().put("app_id", appId); | ||
| 87 | + request.getBusiness().put("aue", "lame"); | ||
| 88 | + request.getBusiness().put("sfl", 1); | ||
| 89 | + request.getBusiness().put("vcn", "x4_enus_luna_assist"); | ||
| 90 | + request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(StandardCharsets.UTF_8))); | ||
| 91 | + request.getData().put("status", 2); | ||
| 92 | + websocketWork(wsUrl, request, new FileOutputStream(outputPath)); | ||
| 93 | + while (!request.isCompleted()) { | ||
| 94 | + Thread.sleep(500); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public static void websocketWork(String wsUrl, SpeechRequest request, OutputStream out) { | ||
| 99 | + try { | ||
| 100 | + URI uri = new URI(wsUrl); | ||
| 101 | + WebSocketClient webSocketClient = new WebSocketClient(uri) { | ||
| 102 | + @Override | ||
| 103 | + public void onOpen(ServerHandshake serverHandshake) { | ||
| 104 | + try { | ||
| 105 | + this.send(mapper.writeValueAsString(request)); | ||
| 106 | + } catch (JsonProcessingException e) { | ||
| 107 | + throw new RuntimeException(e); | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @Override | ||
| 112 | + public void onMessage(String text) { | ||
| 113 | + try { | ||
| 114 | + SpeechResponse response = mapper.readValue(text, SpeechResponse.class); | ||
| 115 | + log.info("response: {}", response); | ||
| 116 | + if (response.getCode() != 0) { | ||
| 117 | + log.error("在线语音合成发生错误"); | ||
| 118 | + } | ||
| 119 | + if (response.getData() != null) { | ||
| 120 | + byte[] bytes = Base64.getDecoder().decode(response.getData().getAudio()); | ||
| 121 | + out.write(bytes); | ||
| 122 | + out.flush(); | ||
| 123 | + if (response.getData().getStatus() == 2) { | ||
| 124 | + request.setCompleted(true); | ||
| 125 | + out.close(); | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } catch (IOException e) { | ||
| 129 | + throw new RuntimeException(e); | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + @Override | ||
| 134 | + public void onClose(int i, String s, boolean b) { | ||
| 135 | + System.out.println("ws链接已关闭,本次请求完成..."); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + @Override | ||
| 139 | + public void onError(Exception e) { | ||
| 140 | + log.error("发生错误", e); | ||
| 141 | + } | ||
| 142 | + }; | ||
| 143 | + webSocketClient.connect(); | ||
| 144 | + } catch (Exception e) { | ||
| 145 | + log.error("", e); | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 讯飞语音合成鉴权 | ||
| 151 | + * @param hostUrl | ||
| 152 | + * @param apiKey | ||
| 153 | + * @param apiSecret | ||
| 154 | + * @return | ||
| 155 | + * @throws Exception | ||
| 156 | + */ | ||
| 157 | + public static String getAuthUrl(String hostUrl, String apiKey, String apiSecret) throws Exception { | ||
| 158 | + URL url = new URL(hostUrl); | ||
| 159 | + // 时间 | ||
| 160 | + SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); | ||
| 161 | + format.setTimeZone(TimeZone.getTimeZone("GMT")); | ||
| 162 | + String date = format.format(new Date()); | ||
| 163 | + // 拼接 | ||
| 164 | + String preStr = "host: " + url.getHost() + "\n" + | ||
| 165 | + "date: " + date + "\n" + | ||
| 166 | + "GET " + url.getPath() + " HTTP/1.1"; | ||
| 167 | + // SHA256加密 | ||
| 168 | + Mac mac = Mac.getInstance("hmacsha256"); | ||
| 169 | + SecretKeySpec spec = new SecretKeySpec(apiSecret.getBytes(StandardCharsets.UTF_8), "hmacsha256"); | ||
| 170 | + mac.init(spec); | ||
| 171 | + byte[] hexDigits = mac.doFinal(preStr.getBytes(StandardCharsets.UTF_8)); | ||
| 172 | + // Base64加密 | ||
| 173 | + String sha = Base64.getEncoder().encodeToString(hexDigits); | ||
| 174 | + // 拼接 | ||
| 175 | + String authorization = String.format("api_key=\"%s\", algorithm=\"%s\", headers=\"%s\", signature=\"%s\"", apiKey, "hmac-sha256", "host date request-line", sha); | ||
| 176 | + StringBuilder sb = new StringBuilder(hostUrl); | ||
| 177 | + sb.append("?authorization=").append(Base64.getEncoder().encodeToString(authorization.getBytes(StandardCharsets.UTF_8))) | ||
| 178 | + .append("&date=").append(URLEncoder.encode(date)) | ||
| 179 | + .append("&host=").append(URLEncoder.encode(url.getHost())); | ||
| 180 | +// // 拼接地址 | ||
| 181 | +// HttpUrl httpUrl = Objects.requireNonNull(HttpUrl.parse("https://" + url.getHost() + url.getPath())).newBuilder().// | ||
| 182 | +// addQueryParameter("authorization", Base64.getEncoder().encodeToString(authorization.getBytes(StandardCharsets.UTF_8))).// | ||
| 183 | +// addQueryParameter("date", date).// | ||
| 184 | +// addQueryParameter("host", url.getHost()).// | ||
| 185 | +// build(); | ||
| 186 | + | ||
| 187 | + return sb.toString(); | ||
| 188 | + } | ||
| 189 | +} | ||
| 0 | \ No newline at end of file | 190 | \ No newline at end of file |
src/main/resources/application-cloud.properties
| 1 | -server.port=9088 | ||
| 2 | - | ||
| 3 | -# dubbo����ʹ�ÿ���flag | ||
| 4 | -dubbo.use=false | ||
| 5 | - | ||
| 6 | -#JPA | ||
| 7 | -spring.jpa.hibernate.ddl-auto= none | ||
| 8 | -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | -spring.jpa.database= MYSQL | ||
| 11 | -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | -spring.jpa.show-sql= false | ||
| 13 | -spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | ||
| 14 | - | ||
| 15 | -#DATABASE | ||
| 16 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 17 | -spring.datasource.url= jdbc:mysql://192.170.100.132/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 18 | -spring.datasource.username= root | ||
| 19 | -spring.datasource.password= root2jsp | ||
| 20 | -spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 21 | - | ||
| 22 | -#DATASOURCE SETTING | ||
| 23 | -spring.datasource.hikari.minimum-idle= 8 | ||
| 24 | -spring.datasource.hikari.maximum-pool-size= 100 | ||
| 25 | -#spring.datasource.hikari.auto-commit= true | ||
| 26 | -spring.datasource.hikari.idle-timeout= 60000 | ||
| 27 | -#spring.datasource.hikari.pool-name= HikariPool | ||
| 28 | -spring.datasource.hikari.max-lifetime= 1800000 | ||
| 29 | -spring.datasource.hikari.connection-timeout= 3000 | ||
| 30 | -spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 31 | -spring.datasource.hikari.validation-timeout= 3000 | ||
| 32 | -spring.datasource.hikari.register-mbeans=true | ||
| 33 | - | ||
| 34 | -kafka.use= true | ||
| 35 | -spring.kafka.consumer.bootstrap-servers= 192.170.100.114:9092,192.170.100.114:9093,192.170.100.114:9094 | ||
| 36 | -spring.kafka.key-serializer= org.apache.kafka.common.serialization.StringSerializer | ||
| 37 | -spring.kafka.value-serializer= org.apache.kafka.common.serialization.StringSerializer | ||
| 38 | -spring.kafka.producer.buffer-memory= 33554432 | ||
| 39 | -spring.kafka.producer.acks= all | ||
| 40 | -spring.kafka.consumer.group-id= schedule-system | ||
| 41 | -spring.kafka.consumer.auto-offset-reset= latest | ||
| 42 | - | ||
| 43 | -sso.enabled= true | ||
| 44 | -sso.systemcode = SYS0023 | ||
| 45 | -sso.http.url.login= https://112.64.45.51/portal/index.html#/login | ||
| 46 | -sso.http.url.logout= https://112.64.45.51/information/api/v1/logout | ||
| 47 | -sso.http.url.auth= https://112.64.45.51/information/authenticate/authorityAuthentication | ||
| 48 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +server.port=9088 | ||
| 3 | + | ||
| 4 | +# dubbo����ʹ�ÿ���flag | ||
| 5 | +dubbo.use=false | ||
| 6 | + | ||
| 7 | +#JPA | ||
| 8 | +spring.jpa.hibernate.ddl-auto= none | ||
| 9 | +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 10 | +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 11 | +spring.jpa.database= MYSQL | ||
| 12 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 13 | +spring.jpa.show-sql= false | ||
| 14 | +spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | ||
| 15 | + | ||
| 16 | +#DATABASE | ||
| 17 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 18 | +spring.datasource.url= jdbc:mysql://192.170.100.132/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 19 | +spring.datasource.username= root | ||
| 20 | +spring.datasource.password= root2jsp | ||
| 21 | +spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 22 | + | ||
| 23 | +#DATASOURCE SETTING | ||
| 24 | +spring.datasource.hikari.minimum-idle= 8 | ||
| 25 | +spring.datasource.hikari.maximum-pool-size= 100 | ||
| 26 | +#spring.datasource.hikari.auto-commit= true | ||
| 27 | +spring.datasource.hikari.idle-timeout= 60000 | ||
| 28 | +#spring.datasource.hikari.pool-name= HikariPool | ||
| 29 | +spring.datasource.hikari.max-lifetime= 1800000 | ||
| 30 | +spring.datasource.hikari.connection-timeout= 3000 | ||
| 31 | +spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 32 | +spring.datasource.hikari.validation-timeout= 3000 | ||
| 33 | +spring.datasource.hikari.register-mbeans=true | ||
| 34 | + | ||
| 35 | +kafka.use= true | ||
| 36 | +spring.kafka.consumer.bootstrap-servers= 192.170.100.114:9092,192.170.100.114:9093,192.170.100.114:9094 | ||
| 37 | +spring.kafka.key-serializer= org.apache.kafka.common.serialization.StringSerializer | ||
| 38 | +spring.kafka.value-serializer= org.apache.kafka.common.serialization.StringSerializer | ||
| 39 | +spring.kafka.producer.buffer-memory= 33554432 | ||
| 40 | +spring.kafka.producer.acks= all | ||
| 41 | +spring.kafka.consumer.group-id= schedule-system | ||
| 42 | +spring.kafka.consumer.auto-offset-reset= latest | ||
| 43 | + | ||
| 44 | +sso.enabled= true | ||
| 45 | +sso.systemcode = SYS0023 | ||
| 46 | +sso.http.url.login= https://112.64.45.51/portal/index.html#/login | ||
| 47 | +sso.http.url.logout= https://112.64.45.51/information/api/v1/logout | ||
| 48 | +sso.http.url.auth= https://112.64.45.51/information/authenticate/authorityAuthentication | ||
| 49 | + | ||
| 50 | +path.speech.common = /data/control/speech/common/ | ||
| 51 | +path.speech.line = /data/control/speech/%s/ | ||
| 49 | \ No newline at end of file | 52 | \ No newline at end of file |
src/main/resources/application-dev.properties
| 1 | -server.port=9088 | ||
| 2 | - | ||
| 3 | -# dubbo服务化使用开关flag | ||
| 4 | -dubbo.use=false | ||
| 5 | - | ||
| 6 | -#JPA | ||
| 7 | -spring.jpa.hibernate.ddl-auto= none | ||
| 8 | -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | -spring.jpa.database= MYSQL | ||
| 11 | -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | -spring.jpa.show-sql= true | ||
| 13 | -spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | ||
| 14 | - | ||
| 15 | -#DATABASE | ||
| 16 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 17 | -#spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 18 | -##spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 19 | -#spring.datasource.username= root | ||
| 20 | -#spring.datasource.password= | ||
| 21 | -spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 22 | -spring.datasource.username= root | ||
| 23 | -spring.datasource.password= root | ||
| 24 | -#spring.datasource.url= jdbc:mysql://192.168.168.241/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 25 | -#spring.datasource.username= root | ||
| 26 | -#spring.datasource.password= root2jsp | ||
| 27 | -spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 28 | - | ||
| 29 | -#DATASOURCE SETTING | ||
| 30 | -spring.datasource.hikari.minimum-idle= 8 | ||
| 31 | -spring.datasource.hikari.maximum-pool-size= 100 | ||
| 32 | -#spring.datasource.hikari.auto-commit= true | ||
| 33 | -spring.datasource.hikari.idle-timeout= 60000 | ||
| 34 | -#spring.datasource.hikari.pool-name= HikariPool | ||
| 35 | -spring.datasource.hikari.max-lifetime= 1800000 | ||
| 36 | -spring.datasource.hikari.connection-timeout= 3000 | ||
| 37 | -spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 38 | -spring.datasource.hikari.validation-timeout= 3000 | ||
| 39 | -spring.datasource.hikari.register-mbeans=true | ||
| 40 | - | ||
| 41 | -kafka.use= false | ||
| 42 | -spring.kafka.consumer.bootstrap-servers= localhost:9092 | ||
| 43 | -spring.kafka.consumer.group-id= schedule-system | ||
| 44 | -spring.kafka.consumer.auto-offset-reset= latest | ||
| 45 | -spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 46 | -spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 47 | - | ||
| 48 | -sso.enabled= false | ||
| 49 | -sso.systemcode = SYS0019 | ||
| 50 | -sso.http.url.login= http://180.169.154.251:28090/portal/index.html#/login | ||
| 51 | -sso.http.url.logout= http://180.169.154.251:18080/information/api/v1/logout | ||
| 52 | -sso.http.url.auth= http://180.169.154.251:18080/information/authenticate/authorityAuthentication | ||
| 53 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +server.port=9088 | ||
| 3 | + | ||
| 4 | +# dubbo服务化使用开关flag | ||
| 5 | +dubbo.use=false | ||
| 6 | + | ||
| 7 | +#JPA | ||
| 8 | +spring.jpa.hibernate.ddl-auto= none | ||
| 9 | +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 10 | +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 11 | +spring.jpa.database= MYSQL | ||
| 12 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 13 | +spring.jpa.show-sql= true | ||
| 14 | +spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | ||
| 15 | + | ||
| 16 | +#DATABASE | ||
| 17 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 18 | +#spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 19 | +##spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 20 | +#spring.datasource.username= root | ||
| 21 | +#spring.datasource.password= | ||
| 22 | +spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 23 | +spring.datasource.username= root | ||
| 24 | +spring.datasource.password= root | ||
| 25 | +#spring.datasource.url= jdbc:mysql://192.168.168.241/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 26 | +#spring.datasource.username= root | ||
| 27 | +#spring.datasource.password= root2jsp | ||
| 28 | +spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 29 | + | ||
| 30 | +#DATASOURCE SETTING | ||
| 31 | +spring.datasource.hikari.minimum-idle= 8 | ||
| 32 | +spring.datasource.hikari.maximum-pool-size= 100 | ||
| 33 | +#spring.datasource.hikari.auto-commit= true | ||
| 34 | +spring.datasource.hikari.idle-timeout= 60000 | ||
| 35 | +#spring.datasource.hikari.pool-name= HikariPool | ||
| 36 | +spring.datasource.hikari.max-lifetime= 1800000 | ||
| 37 | +spring.datasource.hikari.connection-timeout= 3000 | ||
| 38 | +spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 39 | +spring.datasource.hikari.validation-timeout= 3000 | ||
| 40 | +spring.datasource.hikari.register-mbeans=true | ||
| 41 | + | ||
| 42 | +kafka.use= false | ||
| 43 | +spring.kafka.consumer.bootstrap-servers= localhost:9092 | ||
| 44 | +spring.kafka.consumer.group-id= schedule-system | ||
| 45 | +spring.kafka.consumer.auto-offset-reset= latest | ||
| 46 | +spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 47 | +spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 48 | + | ||
| 49 | +sso.enabled= false | ||
| 50 | +sso.systemcode = SYS0019 | ||
| 51 | +sso.http.url.login= http://180.169.154.251:28090/portal/index.html#/login | ||
| 52 | +sso.http.url.logout= http://180.169.154.251:18080/information/api/v1/logout | ||
| 53 | +sso.http.url.auth= http://180.169.154.251:18080/information/authenticate/authorityAuthentication | ||
| 54 | + | ||
| 55 | +path.speech.common = /data/control/speech/common/ | ||
| 56 | +path.speech.line = /data/control/speech/%s/ | ||
| 54 | \ No newline at end of file | 57 | \ No newline at end of file |
src/main/resources/application-test.properties
| 1 | -server.port=9088 | ||
| 2 | - | ||
| 3 | -# dubbo����ʹ�ÿ���flag | ||
| 4 | -dubbo.use=false | ||
| 5 | - | ||
| 6 | -#JPA | ||
| 7 | -spring.jpa.hibernate.ddl-auto= none | ||
| 8 | -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 9 | -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 10 | -spring.jpa.database= MYSQL | ||
| 11 | -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 12 | -spring.jpa.show-sql= false | ||
| 13 | -spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | ||
| 14 | - | ||
| 15 | -#DATABASE | ||
| 16 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 17 | -spring.datasource.url= jdbc:mysql://192.170.100.114/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 18 | -spring.datasource.username= root | ||
| 19 | -spring.datasource.password= root2jsp | ||
| 20 | -spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 21 | - | ||
| 22 | -#DATASOURCE SETTING | ||
| 23 | -spring.datasource.hikari.minimum-idle= 8 | ||
| 24 | -spring.datasource.hikari.maximum-pool-size= 100 | ||
| 25 | -#spring.datasource.hikari.auto-commit= true | ||
| 26 | -spring.datasource.hikari.idle-timeout= 60000 | ||
| 27 | -#spring.datasource.hikari.pool-name= HikariPool | ||
| 28 | -spring.datasource.hikari.max-lifetime= 1800000 | ||
| 29 | -spring.datasource.hikari.connection-timeout= 3000 | ||
| 30 | -spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 31 | -spring.datasource.hikari.validation-timeout= 3000 | ||
| 32 | -spring.datasource.hikari.register-mbeans=true | ||
| 33 | - | ||
| 34 | -kafka.use= true | ||
| 35 | -spring.kafka.consumer.bootstrap-servers= 192.170.100.114:9092,192.170.100.114:9093,192.170.100.114:9094 | ||
| 36 | -spring.kafka.consumer.group-id= schedule-system-test | ||
| 37 | -spring.kafka.consumer.auto-offset-reset= latest | ||
| 38 | -spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 39 | -spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 40 | - | ||
| 41 | -sso.enabled= true | ||
| 42 | -sso.systemcode = SYS0023 | ||
| 43 | -sso.http.url.login= https://112.64.45.51/portal/index.html#/login | ||
| 44 | -sso.http.url.logout= https://112.64.45.51/information/api/v1/logout | ||
| 45 | -sso.http.url.auth= https://112.64.45.51/information/authenticate/authorityAuthentication | ||
| 46 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +server.port=9088 | ||
| 3 | + | ||
| 4 | +# dubbo����ʹ�ÿ���flag | ||
| 5 | +dubbo.use=false | ||
| 6 | + | ||
| 7 | +#JPA | ||
| 8 | +spring.jpa.hibernate.ddl-auto= none | ||
| 9 | +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | ||
| 10 | +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | ||
| 11 | +spring.jpa.database= MYSQL | ||
| 12 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | ||
| 13 | +spring.jpa.show-sql= false | ||
| 14 | +spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | ||
| 15 | + | ||
| 16 | +#DATABASE | ||
| 17 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | ||
| 18 | +spring.datasource.url= jdbc:mysql://192.170.100.114/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | ||
| 19 | +spring.datasource.username= root | ||
| 20 | +spring.datasource.password= root2jsp | ||
| 21 | +spring.datasource.type= com.zaxxer.hikari.HikariDataSource | ||
| 22 | + | ||
| 23 | +#DATASOURCE SETTING | ||
| 24 | +spring.datasource.hikari.minimum-idle= 8 | ||
| 25 | +spring.datasource.hikari.maximum-pool-size= 100 | ||
| 26 | +#spring.datasource.hikari.auto-commit= true | ||
| 27 | +spring.datasource.hikari.idle-timeout= 60000 | ||
| 28 | +#spring.datasource.hikari.pool-name= HikariPool | ||
| 29 | +spring.datasource.hikari.max-lifetime= 1800000 | ||
| 30 | +spring.datasource.hikari.connection-timeout= 3000 | ||
| 31 | +spring.datasource.hikari.connection-test-query= SELECT 1 | ||
| 32 | +spring.datasource.hikari.validation-timeout= 3000 | ||
| 33 | +spring.datasource.hikari.register-mbeans=true | ||
| 34 | + | ||
| 35 | +kafka.use= true | ||
| 36 | +spring.kafka.consumer.bootstrap-servers= 192.170.100.114:9092,192.170.100.114:9093,192.170.100.114:9094 | ||
| 37 | +spring.kafka.consumer.group-id= schedule-system-test | ||
| 38 | +spring.kafka.consumer.auto-offset-reset= latest | ||
| 39 | +spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 40 | +spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer | ||
| 41 | + | ||
| 42 | +sso.enabled= true | ||
| 43 | +sso.systemcode = SYS0023 | ||
| 44 | +sso.http.url.login= https://112.64.45.51/portal/index.html#/login | ||
| 45 | +sso.http.url.logout= https://112.64.45.51/information/api/v1/logout | ||
| 46 | +sso.http.url.auth= https://112.64.45.51/information/authenticate/authorityAuthentication | ||
| 47 | + | ||
| 48 | +path.speech.common = /data/control/speech/common/ | ||
| 49 | +path.speech.line = /data/control/speech/%s/ | ||
| 47 | \ No newline at end of file | 50 | \ No newline at end of file |
src/main/resources/application.properties
| 1 | -spring.profiles.active = cloud | ||
| 2 | - | ||
| 3 | -spring.view.suffix=.html | ||
| 4 | -server.session-timeout=-1 | ||
| 5 | - | ||
| 6 | -# File size limit | ||
| 7 | -multipart.maxFileSize = -1 | ||
| 8 | -# Total request size for a multipart/form-data | ||
| 9 | -multipart.maxRequestSize = -1 | ||
| 10 | - | ||
| 11 | -server.compression.enabled=true | ||
| 12 | -server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript | ||
| 13 | - | ||
| 14 | -# batch insert | ||
| 15 | -hibernate.jdbc.batch_size = 50 | ||
| 16 | - | ||
| 17 | -debug=false | 1 | +spring.profiles.active = test |
| 2 | + | ||
| 3 | +spring.view.suffix=.html | ||
| 4 | +server.session-timeout=-1 | ||
| 5 | + | ||
| 6 | +# File size limit | ||
| 7 | +multipart.maxFileSize = -1 | ||
| 8 | +# Total request size for a multipart/form-data | ||
| 9 | +multipart.maxRequestSize = -1 | ||
| 10 | + | ||
| 11 | +server.compression.enabled=true | ||
| 12 | +server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript | ||
| 13 | + | ||
| 14 | +# batch insert | ||
| 15 | +hibernate.jdbc.batch_size = 50 | ||
| 16 | + | ||
| 17 | +debug=false |
src/main/resources/ftp.properties
| 1 | -ftp.url=116.236.238.212 | ||
| 2 | -ftp.port=21 | ||
| 3 | -ftp.username=transport | ||
| 4 | -ftp.password=transport123 | ||
| 5 | -ftp.path=down/ | ||
| 6 | - | ||
| 7 | -#ftp.url=192.168.168.101 | ||
| 8 | -#ftp.port=21 | ||
| 9 | -#ftp.username=testftpservice | ||
| 10 | -#ftp.password= 123 | 1 | +ftp.url=58.247.255.227 |
| 2 | +ftp.port=1369 | ||
| 3 | +ftp.username=pdgjbsth | ||
| 4 | +ftp.password=gpw2io8+3Yg | ||
| 5 | +ftp.path=/transport/down/ | ||
| 6 | + | ||
| 7 | +#ftp.url=192.168.168.101 | ||
| 8 | +#ftp.port=21 | ||
| 9 | +#ftp.username=testftpservice | ||
| 10 | +#ftp.password= 123 | ||
| 11 | #ftp.path= ftptest/ | 11 | #ftp.path= ftptest/ |
| 12 | \ No newline at end of file | 12 | \ No newline at end of file |
src/main/resources/static/login.html renamed to src/main/resources/static/e10adc3949ba59abbe56e057f20f883e.html
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="zh"> | ||
| 3 | -<head> | ||
| 4 | - <meta name="renderer" content="webkit" /> | ||
| 5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| 6 | - <meta charset="utf-8" /> | ||
| 7 | - <title>登录</title> | ||
| 8 | - <link | ||
| 9 | - href="/login_assets/css/font-awesome.min.css" | ||
| 10 | - rel="stylesheet" type="text/css" /> | ||
| 11 | - <!-- Bootstrap style --> | ||
| 12 | - <link href="/login_assets/css/bootstrap.min.css" | ||
| 13 | - rel="stylesheet" type="text/css" /> | ||
| 14 | - | ||
| 15 | - <!-- METRONIC style --> | ||
| 16 | - <link href="/login_assets/css/components.css" rel="stylesheet" | ||
| 17 | - type="text/css" /> | ||
| 18 | - | ||
| 19 | - <style type="text/css"> | ||
| 20 | - body>.wrapper { | ||
| 21 | - background-image: url(/login_assets/img/bg_9b9dcb65ff.png); | ||
| 22 | - background-size: 100px; | ||
| 23 | - background-repeat: repeat; | ||
| 24 | - min-height: 800px; | ||
| 25 | - min-width: 630px; | ||
| 26 | - position: absolute; | ||
| 27 | - top: 0; | ||
| 28 | - bottom: 0; | ||
| 29 | - left: 0; | ||
| 30 | - right: 0; | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - #loginPanel.dialog-shadow { | ||
| 34 | - width: 450px; | ||
| 35 | - /* height: 400px; */ | ||
| 36 | - border: 1px solid #dadada; | ||
| 37 | - border-radius: 10px !important; | ||
| 38 | - position: absolute; | ||
| 39 | - box-shadow: 0 9px 30px -6px rgba(0, 0, 0, .2), 0 18px 20px -10px | ||
| 40 | - rgba(0, 0, 0, .04), 0 18px 20px -10px rgba(0, 0, 0, .04), 0 10px 20px | ||
| 41 | - -10px rgba(0, 0, 0, .04); | ||
| 42 | - background: url(/login_assets/img/dialog-gray-bg_42c40b3eb6.png) #fff bottom | ||
| 43 | - repeat-x; | ||
| 44 | - top: 50%; | ||
| 45 | - left: 50%; | ||
| 46 | - margin-left: -225px; | ||
| 47 | - margin-top: -300px; | ||
| 48 | - text-align: center; | ||
| 49 | - color: #333; | ||
| 50 | - opacity: .5; | ||
| 51 | - | ||
| 52 | - padding-bottom: 56px; | ||
| 53 | - | ||
| 54 | - animation: to_center 1s forwards; | ||
| 55 | - animation-delay: .2s; | ||
| 56 | - | ||
| 57 | - transition: all .3s ease; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - @keyframes to_center | ||
| 61 | - { | ||
| 62 | - 0% {margin-top: -300px;opacity: .5;} | ||
| 63 | - 100% {margin-top: -270px;opacity: 1;} | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - | ||
| 67 | - h3 { | ||
| 68 | - font-size: 25px; | ||
| 69 | - font-weight: 600; | ||
| 70 | - color: #4a4a4a | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - .input-icon input { | ||
| 74 | - height: 48px; | ||
| 75 | - border-radius: 5px !important; | ||
| 76 | - transition: all .5s ease; | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - .input-icon input:FOCUS { | ||
| 80 | - border-color: #c2cad8; | ||
| 81 | - box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12) !important; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - .input-icon>i { | ||
| 85 | - margin-top: 16px; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - #loginPanel #loginBtn.btn{ | ||
| 89 | - border-radius: 6px !important; | ||
| 90 | - width: 378px; | ||
| 91 | - height: 48px; | ||
| 92 | - font-size: 20px; | ||
| 93 | - font-family: 微软雅黑; | ||
| 94 | - transition: all .3s ease; | ||
| 95 | - | ||
| 96 | - background: #5f7ed7; | ||
| 97 | - background: linear-gradient(#6f97e5,#527ed9); | ||
| 98 | - box-shadow: inset 0 1px 2px #7ea1e8 !important; | ||
| 99 | - color: #fff; | ||
| 100 | - text-shadow: #4f70b3 0 -1px 0; | ||
| 101 | - border: none; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - #loginPanel #loginBtn.btn:HOVER { | ||
| 105 | - box-shadow: inset 0 1px 1px #7696de,inset 0 0 2px #627dca,inset 0 -2px 3px #5a77c7,inset 0 0 100px rgba(48,77,147,.4) !important; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - | ||
| 109 | - #loginPanel.show_msg{ | ||
| 110 | - top: calc(50% - 10px); | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - #loginPanel .alert{ | ||
| 114 | - display: none; | ||
| 115 | - padding: 12px; | ||
| 116 | - margin-top: 21px; | ||
| 117 | - border-radius: 0 0 10px 10px !important; | ||
| 118 | - font-size: 13px; | ||
| 119 | - | ||
| 120 | - position: absolute; | ||
| 121 | - width: 100%; | ||
| 122 | - border-bottom: 1px solid #dadada; | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - #loginPanel .alert.login-success{ | ||
| 126 | - color: #27a4b0; | ||
| 127 | - background: #abe7ed; | ||
| 128 | - border-color: #abe7ed; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - #loginPanel .alert i{ | ||
| 132 | - font-size: 16px; | ||
| 133 | - vertical-align: middle; | ||
| 134 | - margin: 0 5px 3px; | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - #loginPanel.show_msg .alert{ | ||
| 138 | - display: block; | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - #captchaWrap{ | ||
| 142 | - display: none; | ||
| 143 | - text-align: left; | ||
| 144 | - border-top: 1px solid #f3f2f2; | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - img.captcha-img{ | ||
| 148 | - cursor: pointer; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - .login-footer{ | ||
| 152 | - position: fixed; | ||
| 153 | - width: 100%; | ||
| 154 | - bottom: 35px; | ||
| 155 | - text-align: center; | ||
| 156 | - color: #a6a6a6; | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - h3.logo-text{ | ||
| 160 | - font-family: 华文楷体,华文细黑; | ||
| 161 | - font-size: 28px; | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - .warn-note{ | ||
| 165 | - width: 100%; | ||
| 166 | - position: absolute; | ||
| 167 | - top: 0; | ||
| 168 | - z-index: 2; | ||
| 169 | - text-align: center; | ||
| 170 | - background: #ff4646; | ||
| 171 | - color: white; | ||
| 172 | - padding: 12px; | ||
| 173 | - display: none; | ||
| 174 | - } | ||
| 175 | - </style> | ||
| 176 | -</head> | ||
| 177 | - | ||
| 178 | -<body> | ||
| 179 | -<div class="warn-note">警告!系统目前仅在 WebKit 内核下完成兼容性测试,请使用 Google | ||
| 180 | - Chrome 浏览器进入系统。</div> | ||
| 181 | -<div class="wrapper ng-scope"> | ||
| 182 | - <div id="loginPanel" class="dialog dialog-shadow"> | ||
| 183 | - <br> | ||
| 184 | - <h3 class="logo-text">浦东公交调度系统</h3> | ||
| 185 | - <hr> | ||
| 186 | - <form style="padding: 0px 35px;"> | ||
| 187 | - <div class="form-group" style="margin-bottom: 0"> | ||
| 188 | - <label></label> | ||
| 189 | - <div class="input-icon"> | ||
| 190 | - <i class="fa fa-user font-gray"></i> <input type="text" | ||
| 191 | - name="userName" class="form-control" placeholder="输入用户名" | ||
| 192 | - autofocus="autofocus" autocomplete="off"> | ||
| 193 | - </div> | ||
| 194 | - </div> | ||
| 195 | - | ||
| 196 | - <div class="form-group"> | ||
| 197 | - <label></label> | ||
| 198 | - <div class="input-icon"> | ||
| 199 | - <i class="fa fa-key font-gray"></i> <input type="password" | ||
| 200 | - name="password" class="form-control" placeholder="输入密码" autocomplete="off"> | ||
| 201 | - </div> | ||
| 202 | - </div> | ||
| 203 | - | ||
| 204 | - <div class="form-group" id="captchaWrap"> | ||
| 205 | - <label></label> | ||
| 206 | - <div class="input-icon"> | ||
| 207 | - <input type="text" name="captcha" style="width: 153px !important;" | ||
| 208 | - class="form-control input-inline input-medium" | ||
| 209 | - placeholder="输入验证码" autocomplete="off"> <span class="help-inline"> <img | ||
| 210 | - alt="验证码" class="captcha-img" title="点击刷新验证码"> | ||
| 211 | - </span> | ||
| 212 | - </div> | ||
| 213 | - </div> | ||
| 214 | - </form> | ||
| 215 | - <br> | ||
| 216 | - <br> | ||
| 217 | - <div class="form-actions"> | ||
| 218 | - <button class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button> | ||
| 219 | - </div> | ||
| 220 | - | ||
| 221 | - <div class="alert alert-danger"></div> | ||
| 222 | - </div> | ||
| 223 | - | ||
| 224 | - <div class="login-footer">© 2016 上海巴士拓华科技发展有限公司 Some Rights | ||
| 225 | - Reserved</div> | ||
| 226 | -</div> | ||
| 227 | - | ||
| 228 | -<script> | ||
| 229 | - delete window.require; | ||
| 230 | - delete window.exports; | ||
| 231 | - delete window.module; | ||
| 232 | -</script> | ||
| 233 | -<!-- jQuery --> | ||
| 234 | -<script src="/login_assets/js/jquery.min.js"></script> | ||
| 235 | -<script src="/login_assets/js/jsencrypt.min.js"></script> | ||
| 236 | -<script> | ||
| 237 | - window.onload=function(){ | ||
| 238 | - var body=document.getElementsByTagName("body")[0]; | ||
| 239 | - if(typeof body.style.WebkitAnimation=="undefined") | ||
| 240 | - $('.warn-note').fadeIn(); | ||
| 241 | - }; | ||
| 242 | - !function(){ | ||
| 243 | - var form = $('#loginPanel form') | ||
| 244 | - ,nameInput = $('input[name=userName]', form) | ||
| 245 | - ,pwdInput = $('input[name=password]', form) | ||
| 246 | - ,msgAlert = $('#loginPanel .alert-danger'); | ||
| 247 | - | ||
| 248 | - $('input', form).on('keyup', checkBtnStatus); | ||
| 249 | - | ||
| 250 | - var keys; | ||
| 251 | - $.get('/user/login/jCryptionKey?t='+Math.random(), function(data){ | ||
| 252 | - keys = data.publickey; | ||
| 253 | - }); | ||
| 254 | - | ||
| 255 | - | ||
| 256 | - | ||
| 257 | - function checkBtnStatus(){ | ||
| 258 | - var es = $('input:visible', form); | ||
| 259 | - for(var i = 0, e; e = es[i++];){ | ||
| 260 | - if($.trim($(e).val()) == ''){ | ||
| 261 | - $('#loginBtn').attr('disabled', 'disabled'); | ||
| 262 | - $('#loginPanel').removeClass('show_msg'); | ||
| 263 | - return; | ||
| 264 | - } | ||
| 265 | - } | ||
| 266 | - $('#loginBtn').removeAttr('disabled'); | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - nameInput.on('blur', checkStatus); | ||
| 270 | - //keyup 事件做延迟 | ||
| 271 | - var uNameKeyup; | ||
| 272 | - nameInput.on('keyup', function(){ | ||
| 273 | - if(uNameKeyup) | ||
| 274 | - return; | ||
| 275 | - uNameKeyup = true; | ||
| 276 | - setTimeout(function(){ | ||
| 277 | - checkStatus(); | ||
| 278 | - uNameKeyup = false; | ||
| 279 | - }, 200); | ||
| 280 | - }); | ||
| 281 | - | ||
| 282 | - //密码框回车事件 | ||
| 283 | - pwdInput.on('keyup', function(e){ | ||
| 284 | - if (e.keyCode == 13) | ||
| 285 | - $('#loginBtn').click(); | ||
| 286 | - }); | ||
| 287 | - //验证码框回车事件 | ||
| 288 | - $('input[name=captcha]').on('keyup', function(e){ | ||
| 289 | - if (e.keyCode == 13) | ||
| 290 | - $('#loginBtn').click(); | ||
| 291 | - }); | ||
| 292 | - | ||
| 293 | - $('#loginBtn').on('click', function(){ | ||
| 294 | - if(lock || $(this).attr('disabled')) return; | ||
| 295 | - var userName = nameInput.val() | ||
| 296 | - ,pwd = pwdInput.val(); | ||
| 297 | - | ||
| 298 | - //RSA加密 | ||
| 299 | - var encrypt = new JSEncrypt(); | ||
| 300 | - encrypt.setPublicKey(keys); | ||
| 301 | - userName = encrypt.encrypt(userName); | ||
| 302 | - pwd = encrypt.encrypt(pwd); | ||
| 303 | - //登录 | ||
| 304 | - login(userName, pwd); | ||
| 305 | - }); | ||
| 306 | - | ||
| 307 | - var lock; | ||
| 308 | - function login(userName, pwd){ | ||
| 309 | - lock = true; | ||
| 310 | - $('#loginBtn').attr('disabled', 'disabled'); | ||
| 311 | - | ||
| 312 | - var params = { | ||
| 313 | - userName: userName, | ||
| 314 | - password: pwd, | ||
| 315 | - captcha: $('input[name=captcha]').val() | ||
| 316 | - }; | ||
| 317 | - $.post('/user/login', params | ||
| 318 | - ,function(rs){ | ||
| 319 | - | ||
| 320 | - $('#loginPanel').addClass('show_msg'); | ||
| 321 | - if(error(rs)){ | ||
| 322 | - lock = false; | ||
| 323 | - $('#loginBtn').removeAttr('disabled'); | ||
| 324 | - msgAlert.html('<i class="fa fa-times-circle"> </i> 登录失败,' + rs.msg); | ||
| 325 | - | ||
| 326 | - _captcha.refresh(); | ||
| 327 | - checkStatus(); | ||
| 328 | - } | ||
| 329 | - else{ | ||
| 330 | - msgAlert.html('<i class="fa fa-check"> </i> 登录成功!'); | ||
| 331 | - msgAlert.addClass('login-success'); | ||
| 332 | - window.location.href = '/'; | ||
| 333 | - } | ||
| 334 | - }); | ||
| 335 | - } | ||
| 336 | - | ||
| 337 | - function checkStatus(){ | ||
| 338 | - var t = nameInput.val(); | ||
| 339 | - if(!t){ | ||
| 340 | - hide(); | ||
| 341 | - return; | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - $.get('/user/login/captchaStatus', {userName: t}, function(rs){ | ||
| 345 | - if(rs > 1) | ||
| 346 | - _captcha.show(); | ||
| 347 | - else | ||
| 348 | - hide(); | ||
| 349 | - }); | ||
| 350 | - | ||
| 351 | - function hide(){ | ||
| 352 | - if(!$("#captchaWrap").is(":hidden")){ | ||
| 353 | - _captcha.hide(); | ||
| 354 | - //隐藏提示消息 | ||
| 355 | - //msgAlert.html(''); | ||
| 356 | - //$('#loginPanel').removeClass('show_msg'); | ||
| 357 | - } | ||
| 358 | - } | ||
| 359 | - } | ||
| 360 | - | ||
| 361 | - | ||
| 362 | - var _captcha = { | ||
| 363 | - show: function(){ | ||
| 364 | - if($("#captchaWrap").is(":hidden")){ | ||
| 365 | - $('#captchaWrap').fadeIn(500); | ||
| 366 | - _captcha.refresh(); | ||
| 367 | - checkBtnStatus(); | ||
| 368 | - } | ||
| 369 | - }, | ||
| 370 | - refresh: function(){ | ||
| 371 | - if($("#captchaWrap").is(":hidden")) | ||
| 372 | - return; | ||
| 373 | - $('#captchaWrap img.captcha-img').attr('src', '/captcha.jpg?t=' + Math.random()); | ||
| 374 | - }, | ||
| 375 | - hide: function(){ | ||
| 376 | - $('#captchaWrap').hide(); | ||
| 377 | - $('input[name=captcha]').val(''); | ||
| 378 | - } | ||
| 379 | - }; | ||
| 380 | - | ||
| 381 | - $('#captchaWrap img.captcha-img').on('click', function(){ | ||
| 382 | - $(this).attr('src', '/captcha.jpg?t=' + Math.random()); | ||
| 383 | - }); | ||
| 384 | - | ||
| 385 | - function error(rs){ | ||
| 386 | - return rs.status == 'ERROR' || rs.status == 500; | ||
| 387 | - } | ||
| 388 | - }(); | ||
| 389 | -</script> | ||
| 390 | -</body> | 1 | +<!DOCTYPE html> |
| 2 | +<html lang="zh"> | ||
| 3 | +<head> | ||
| 4 | + <meta name="renderer" content="webkit" /> | ||
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| 6 | + <meta charset="utf-8" /> | ||
| 7 | + <title>登录</title> | ||
| 8 | + <link | ||
| 9 | + href="/login_assets/css/font-awesome.min.css" | ||
| 10 | + rel="stylesheet" type="text/css" /> | ||
| 11 | + <!-- Bootstrap style --> | ||
| 12 | + <link href="/login_assets/css/bootstrap.min.css" | ||
| 13 | + rel="stylesheet" type="text/css" /> | ||
| 14 | + | ||
| 15 | + <!-- METRONIC style --> | ||
| 16 | + <link href="/login_assets/css/components.css" rel="stylesheet" | ||
| 17 | + type="text/css" /> | ||
| 18 | + | ||
| 19 | + <style type="text/css"> | ||
| 20 | + body>.wrapper { | ||
| 21 | + background-image: url(/login_assets/img/bg_9b9dcb65ff.png); | ||
| 22 | + background-size: 100px; | ||
| 23 | + background-repeat: repeat; | ||
| 24 | + min-height: 800px; | ||
| 25 | + min-width: 630px; | ||
| 26 | + position: absolute; | ||
| 27 | + top: 0; | ||
| 28 | + bottom: 0; | ||
| 29 | + left: 0; | ||
| 30 | + right: 0; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + #loginPanel.dialog-shadow { | ||
| 34 | + width: 450px; | ||
| 35 | + /* height: 400px; */ | ||
| 36 | + border: 1px solid #dadada; | ||
| 37 | + border-radius: 10px !important; | ||
| 38 | + position: absolute; | ||
| 39 | + box-shadow: 0 9px 30px -6px rgba(0, 0, 0, .2), 0 18px 20px -10px | ||
| 40 | + rgba(0, 0, 0, .04), 0 18px 20px -10px rgba(0, 0, 0, .04), 0 10px 20px | ||
| 41 | + -10px rgba(0, 0, 0, .04); | ||
| 42 | + background: url(/login_assets/img/dialog-gray-bg_42c40b3eb6.png) #fff bottom | ||
| 43 | + repeat-x; | ||
| 44 | + top: 50%; | ||
| 45 | + left: 50%; | ||
| 46 | + margin-left: -225px; | ||
| 47 | + margin-top: -300px; | ||
| 48 | + text-align: center; | ||
| 49 | + color: #333; | ||
| 50 | + opacity: .5; | ||
| 51 | + | ||
| 52 | + padding-bottom: 56px; | ||
| 53 | + | ||
| 54 | + animation: to_center 1s forwards; | ||
| 55 | + animation-delay: .2s; | ||
| 56 | + | ||
| 57 | + transition: all .3s ease; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @keyframes to_center | ||
| 61 | + { | ||
| 62 | + 0% {margin-top: -300px;opacity: .5;} | ||
| 63 | + 100% {margin-top: -270px;opacity: 1;} | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + h3 { | ||
| 68 | + font-size: 25px; | ||
| 69 | + font-weight: 600; | ||
| 70 | + color: #4a4a4a | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + .input-icon input { | ||
| 74 | + height: 48px; | ||
| 75 | + border-radius: 5px !important; | ||
| 76 | + transition: all .5s ease; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + .input-icon input:FOCUS { | ||
| 80 | + border-color: #c2cad8; | ||
| 81 | + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12) !important; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + .input-icon>i { | ||
| 85 | + margin-top: 16px; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + #loginPanel #loginBtn.btn{ | ||
| 89 | + border-radius: 6px !important; | ||
| 90 | + width: 378px; | ||
| 91 | + height: 48px; | ||
| 92 | + font-size: 20px; | ||
| 93 | + font-family: 微软雅黑; | ||
| 94 | + transition: all .3s ease; | ||
| 95 | + | ||
| 96 | + background: #5f7ed7; | ||
| 97 | + background: linear-gradient(#6f97e5,#527ed9); | ||
| 98 | + box-shadow: inset 0 1px 2px #7ea1e8 !important; | ||
| 99 | + color: #fff; | ||
| 100 | + text-shadow: #4f70b3 0 -1px 0; | ||
| 101 | + border: none; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + #loginPanel #loginBtn.btn:HOVER { | ||
| 105 | + box-shadow: inset 0 1px 1px #7696de,inset 0 0 2px #627dca,inset 0 -2px 3px #5a77c7,inset 0 0 100px rgba(48,77,147,.4) !important; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + #loginPanel.show_msg{ | ||
| 110 | + top: calc(50% - 10px); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + #loginPanel .alert{ | ||
| 114 | + display: none; | ||
| 115 | + padding: 12px; | ||
| 116 | + margin-top: 21px; | ||
| 117 | + border-radius: 0 0 10px 10px !important; | ||
| 118 | + font-size: 13px; | ||
| 119 | + | ||
| 120 | + position: absolute; | ||
| 121 | + width: 100%; | ||
| 122 | + border-bottom: 1px solid #dadada; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + #loginPanel .alert.login-success{ | ||
| 126 | + color: #27a4b0; | ||
| 127 | + background: #abe7ed; | ||
| 128 | + border-color: #abe7ed; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + #loginPanel .alert i{ | ||
| 132 | + font-size: 16px; | ||
| 133 | + vertical-align: middle; | ||
| 134 | + margin: 0 5px 3px; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + #loginPanel.show_msg .alert{ | ||
| 138 | + display: block; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + #captchaWrap{ | ||
| 142 | + display: none; | ||
| 143 | + text-align: left; | ||
| 144 | + border-top: 1px solid #f3f2f2; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + img.captcha-img{ | ||
| 148 | + cursor: pointer; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + .login-footer{ | ||
| 152 | + position: fixed; | ||
| 153 | + width: 100%; | ||
| 154 | + bottom: 35px; | ||
| 155 | + text-align: center; | ||
| 156 | + color: #a6a6a6; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + h3.logo-text{ | ||
| 160 | + font-family: 华文楷体,华文细黑; | ||
| 161 | + font-size: 28px; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + .warn-note{ | ||
| 165 | + width: 100%; | ||
| 166 | + position: absolute; | ||
| 167 | + top: 0; | ||
| 168 | + z-index: 2; | ||
| 169 | + text-align: center; | ||
| 170 | + background: #ff4646; | ||
| 171 | + color: white; | ||
| 172 | + padding: 12px; | ||
| 173 | + display: none; | ||
| 174 | + } | ||
| 175 | + </style> | ||
| 176 | +</head> | ||
| 177 | + | ||
| 178 | +<body> | ||
| 179 | +<div class="warn-note">警告!系统目前仅在 WebKit 内核下完成兼容性测试,请使用 Google | ||
| 180 | + Chrome 浏览器进入系统。</div> | ||
| 181 | +<div class="wrapper ng-scope"> | ||
| 182 | + <div id="loginPanel" class="dialog dialog-shadow"> | ||
| 183 | + <br> | ||
| 184 | + <h3 class="logo-text">浦东公交调度系统</h3> | ||
| 185 | + <hr> | ||
| 186 | + <form style="padding: 0px 35px;"> | ||
| 187 | + <div class="form-group" style="margin-bottom: 0"> | ||
| 188 | + <label></label> | ||
| 189 | + <div class="input-icon"> | ||
| 190 | + <i class="fa fa-user font-gray"></i> <input type="text" | ||
| 191 | + name="userName" class="form-control" placeholder="输入用户名" | ||
| 192 | + autofocus="autofocus" autocomplete="off"> | ||
| 193 | + </div> | ||
| 194 | + </div> | ||
| 195 | + | ||
| 196 | + <div class="form-group"> | ||
| 197 | + <label></label> | ||
| 198 | + <div class="input-icon"> | ||
| 199 | + <i class="fa fa-key font-gray"></i> <input type="password" | ||
| 200 | + name="password" class="form-control" placeholder="输入密码" autocomplete="off"> | ||
| 201 | + </div> | ||
| 202 | + </div> | ||
| 203 | + | ||
| 204 | + <div class="form-group" id="captchaWrap"> | ||
| 205 | + <label></label> | ||
| 206 | + <div class="input-icon"> | ||
| 207 | + <input type="text" name="captcha" style="width: 153px !important;" | ||
| 208 | + class="form-control input-inline input-medium" | ||
| 209 | + placeholder="输入验证码" autocomplete="off"> <span class="help-inline"> <img | ||
| 210 | + alt="验证码" class="captcha-img" title="点击刷新验证码"> | ||
| 211 | + </span> | ||
| 212 | + </div> | ||
| 213 | + </div> | ||
| 214 | + </form> | ||
| 215 | + <br> | ||
| 216 | + <br> | ||
| 217 | + <div class="form-actions"> | ||
| 218 | + <button class="btn blue-steel" id="loginBtn" disabled="disabled">登录</button> | ||
| 219 | + </div> | ||
| 220 | + | ||
| 221 | + <div class="alert alert-danger"></div> | ||
| 222 | + </div> | ||
| 223 | + | ||
| 224 | + <div class="login-footer">© 2016 上海巴士拓华科技发展有限公司 Some Rights | ||
| 225 | + Reserved</div> | ||
| 226 | +</div> | ||
| 227 | + | ||
| 228 | +<script> | ||
| 229 | + delete window.require; | ||
| 230 | + delete window.exports; | ||
| 231 | + delete window.module; | ||
| 232 | +</script> | ||
| 233 | +<!-- jQuery --> | ||
| 234 | +<script src="/login_assets/js/jquery.min.js"></script> | ||
| 235 | +<script src="/login_assets/js/jsencrypt.min.js"></script> | ||
| 236 | +<script> | ||
| 237 | + window.onload=function(){ | ||
| 238 | + var body=document.getElementsByTagName("body")[0]; | ||
| 239 | + if(typeof body.style.WebkitAnimation=="undefined") | ||
| 240 | + $('.warn-note').fadeIn(); | ||
| 241 | + }; | ||
| 242 | + !function(){ | ||
| 243 | + var form = $('#loginPanel form') | ||
| 244 | + ,nameInput = $('input[name=userName]', form) | ||
| 245 | + ,pwdInput = $('input[name=password]', form) | ||
| 246 | + ,msgAlert = $('#loginPanel .alert-danger'); | ||
| 247 | + | ||
| 248 | + $('input', form).on('keyup', checkBtnStatus); | ||
| 249 | + | ||
| 250 | + var keys; | ||
| 251 | + $.get('/user/login/jCryptionKey?t='+Math.random(), function(data){ | ||
| 252 | + keys = data.publickey; | ||
| 253 | + }); | ||
| 254 | + | ||
| 255 | + | ||
| 256 | + | ||
| 257 | + function checkBtnStatus(){ | ||
| 258 | + var es = $('input:visible', form); | ||
| 259 | + for(var i = 0, e; e = es[i++];){ | ||
| 260 | + if($.trim($(e).val()) == ''){ | ||
| 261 | + $('#loginBtn').attr('disabled', 'disabled'); | ||
| 262 | + $('#loginPanel').removeClass('show_msg'); | ||
| 263 | + return; | ||
| 264 | + } | ||
| 265 | + } | ||
| 266 | + $('#loginBtn').removeAttr('disabled'); | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + nameInput.on('blur', checkStatus); | ||
| 270 | + //keyup 事件做延迟 | ||
| 271 | + var uNameKeyup; | ||
| 272 | + nameInput.on('keyup', function(){ | ||
| 273 | + if(uNameKeyup) | ||
| 274 | + return; | ||
| 275 | + uNameKeyup = true; | ||
| 276 | + setTimeout(function(){ | ||
| 277 | + checkStatus(); | ||
| 278 | + uNameKeyup = false; | ||
| 279 | + }, 200); | ||
| 280 | + }); | ||
| 281 | + | ||
| 282 | + //密码框回车事件 | ||
| 283 | + pwdInput.on('keyup', function(e){ | ||
| 284 | + if (e.keyCode == 13) | ||
| 285 | + $('#loginBtn').click(); | ||
| 286 | + }); | ||
| 287 | + //验证码框回车事件 | ||
| 288 | + $('input[name=captcha]').on('keyup', function(e){ | ||
| 289 | + if (e.keyCode == 13) | ||
| 290 | + $('#loginBtn').click(); | ||
| 291 | + }); | ||
| 292 | + | ||
| 293 | + $('#loginBtn').on('click', function(){ | ||
| 294 | + if(lock || $(this).attr('disabled')) return; | ||
| 295 | + var userName = nameInput.val() | ||
| 296 | + ,pwd = pwdInput.val(); | ||
| 297 | + | ||
| 298 | + //RSA加密 | ||
| 299 | + var encrypt = new JSEncrypt(); | ||
| 300 | + encrypt.setPublicKey(keys); | ||
| 301 | + userName = encrypt.encrypt(userName); | ||
| 302 | + pwd = encrypt.encrypt(pwd); | ||
| 303 | + //登录 | ||
| 304 | + login(userName, pwd); | ||
| 305 | + }); | ||
| 306 | + | ||
| 307 | + var lock; | ||
| 308 | + function login(userName, pwd){ | ||
| 309 | + lock = true; | ||
| 310 | + $('#loginBtn').attr('disabled', 'disabled'); | ||
| 311 | + | ||
| 312 | + var params = { | ||
| 313 | + userName: userName, | ||
| 314 | + password: pwd, | ||
| 315 | + captcha: $('input[name=captcha]').val() | ||
| 316 | + }; | ||
| 317 | + $.post('/user/login', params | ||
| 318 | + ,function(rs){ | ||
| 319 | + | ||
| 320 | + $('#loginPanel').addClass('show_msg'); | ||
| 321 | + if(error(rs)){ | ||
| 322 | + lock = false; | ||
| 323 | + $('#loginBtn').removeAttr('disabled'); | ||
| 324 | + msgAlert.html('<i class="fa fa-times-circle"> </i> 登录失败,' + rs.msg); | ||
| 325 | + | ||
| 326 | + _captcha.refresh(); | ||
| 327 | + checkStatus(); | ||
| 328 | + } | ||
| 329 | + else{ | ||
| 330 | + msgAlert.html('<i class="fa fa-check"> </i> 登录成功!'); | ||
| 331 | + msgAlert.addClass('login-success'); | ||
| 332 | + window.location.href = '/'; | ||
| 333 | + } | ||
| 334 | + }); | ||
| 335 | + } | ||
| 336 | + | ||
| 337 | + function checkStatus(){ | ||
| 338 | + var t = nameInput.val(); | ||
| 339 | + if(!t){ | ||
| 340 | + hide(); | ||
| 341 | + return; | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + $.get('/user/login/captchaStatus', {userName: t}, function(rs){ | ||
| 345 | + if(rs > 1) | ||
| 346 | + _captcha.show(); | ||
| 347 | + else | ||
| 348 | + hide(); | ||
| 349 | + }); | ||
| 350 | + | ||
| 351 | + function hide(){ | ||
| 352 | + if(!$("#captchaWrap").is(":hidden")){ | ||
| 353 | + _captcha.hide(); | ||
| 354 | + //隐藏提示消息 | ||
| 355 | + //msgAlert.html(''); | ||
| 356 | + //$('#loginPanel').removeClass('show_msg'); | ||
| 357 | + } | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + | ||
| 362 | + var _captcha = { | ||
| 363 | + show: function(){ | ||
| 364 | + if($("#captchaWrap").is(":hidden")){ | ||
| 365 | + $('#captchaWrap').fadeIn(500); | ||
| 366 | + _captcha.refresh(); | ||
| 367 | + checkBtnStatus(); | ||
| 368 | + } | ||
| 369 | + }, | ||
| 370 | + refresh: function(){ | ||
| 371 | + if($("#captchaWrap").is(":hidden")) | ||
| 372 | + return; | ||
| 373 | + $('#captchaWrap img.captcha-img').attr('src', '/captcha.jpg?t=' + Math.random()); | ||
| 374 | + }, | ||
| 375 | + hide: function(){ | ||
| 376 | + $('#captchaWrap').hide(); | ||
| 377 | + $('input[name=captcha]').val(''); | ||
| 378 | + } | ||
| 379 | + }; | ||
| 380 | + | ||
| 381 | + $('#captchaWrap img.captcha-img').on('click', function(){ | ||
| 382 | + $(this).attr('src', '/captcha.jpg?t=' + Math.random()); | ||
| 383 | + }); | ||
| 384 | + | ||
| 385 | + function error(rs){ | ||
| 386 | + return rs.status == 'ERROR' || rs.status == 500; | ||
| 387 | + } | ||
| 388 | + }(); | ||
| 389 | +</script> | ||
| 390 | +</body> | ||
| 391 | </html> | 391 | </html> |
| 392 | \ No newline at end of file | 392 | \ No newline at end of file |