Commit 07602a7b authored by kang.nie@inzymeits.com's avatar kang.nie@inzymeits.com
Browse files

提交代码

parent e0c7be76
# ivccs
厦门港口
\ No newline at end of file
水平运输线上使用代码分支:
实现了水平运输Web系统功能
\ No newline at end of file
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<!-- 依赖库 -->
<outputDirectory>${project.name}/lib/libs</outputDirectory>
<scope>runtime</scope>
<excludes>
<exclude>${groupId}:${artifactId}</exclude>
</excludes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.basedir}/target/bin</directory>
<outputDirectory>${project.name}/bin</outputDirectory>
<lineEnding>unix</lineEnding>
<fileMode>744</fileMode>
<includes>
<include>*.sh</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/target/classes</directory>
<outputDirectory>${project.name}/config</outputDirectory>
<includes>
<include>application-${spring.profiles.active}.yml</include>
<include>application.yml</include>
<include>logback-spring.xml</include>
<include>ca_cidi.pem</include>
<include>faultCode-template.xlsx</include>
</includes>
</fileSet>
<!-- 将项目启动主jar打包到bin目录中 -->
<fileSet>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.name}/lib</outputDirectory>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com</groupId>
<artifactId>ivccs-vmm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>VmmBackService</name>
<description>Generator project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<elasticsearch.version>6.8.4</elasticsearch.version>
</properties>
<dependencies>
<dependency>
<groupId>com.dfssi.dataplatform</groupId>
<artifactId>rest-service-parent</artifactId>
<version>1.1.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>springfox-swagger2</artifactId>
<groupId>io.springfox</groupId>
</exclusion>
<exclusion>
<artifactId>springfox-swagger-ui</artifactId>
<groupId>io.springfox</groupId>
</exclusion>
<exclusion>
<artifactId>spring-kafka</artifactId>
<groupId>org.springframework.kafka</groupId>
</exclusion>
<exclusion>
<artifactId>spring-data-redis</artifactId>
<groupId>org.springframework.data</groupId>
</exclusion>
<exclusion>
<artifactId>spring-data-elasticsearch</artifactId>
<groupId>org.springframework.data</groupId>
</exclusion>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-websocket</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-test</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-security</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-jdbc</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter-aop</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-starter</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>spring-boot-configuration-processor</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
<exclusion>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<groupId>com.github.pagehelper</groupId>
</exclusion>
<exclusion>
<artifactId>mysql-connector-java</artifactId>
<groupId>mysql</groupId>
</exclusion>
<exclusion>
<artifactId>mybatis-spring-boot-starter</artifactId>
<groupId>org.mybatis.spring.boot</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-slf4j-impl</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>lombok</artifactId>
<groupId>org.projectlombok</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-core</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-1.2-api</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<artifactId>joda-time</artifactId>
<groupId>joda-time</groupId>
</exclusion>
<exclusion>
<artifactId>jetcache-redis-lettuce</artifactId>
<groupId>com.alicp.jetcache</groupId>
</exclusion>
<exclusion>
<artifactId>jetcache-anno</artifactId>
<groupId>com.alicp.jetcache</groupId>
</exclusion>
<exclusion>
<artifactId>jedis</artifactId>
<groupId>redis.clients</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool2</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- es,依赖的lucene等jar包在spring-libs仓库才有,需要添加spring-libs仓库-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<!--集成redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.7.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>jedis</artifactId>
<groupId>redis.clients</groupId>
</exclusion>
</exclusions>
</dependency>
<!--引入AOP依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<!-- webSocket 依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!--easypoi-->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>4.1.3</version>
</dependency>
<!-- poi 处理excel -->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi</artifactId>-->
<!-- <version>3.17</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml-schemas</artifactId>-->
<!-- <version>3.17</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml</artifactId>-->
<!-- <version>3.17</version>-->
<!-- </dependency>-->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<!-- jetcache -->
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-anno</artifactId>
<version>2.5.9</version>
</dependency>
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-redis-lettuce</artifactId>
<version>2.5.9</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.47</version>
</dependency>
<!-- oracle -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- add the x-pack jar as a dependency -->
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>x-pack-transport</artifactId>
<version>6.8.23</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
</dependencies>
<build>
<finalName>VmmBackService</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>ZIP</layout>
<includes>
<include>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>first</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<finalName>IVCCS_${project.name}</finalName>
<plugins>
<plugin>
<groupId>com.dfssi.maven</groupId>
<artifactId>start-script-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<goals>
<goal>start-script</goal>
</goals>
<configuration>
<active>${spring.profiles.active}</active>
<loggingConfig>../config/logback-spring.xml</loggingConfig>
<Xmx>1024m</Xmx>
<Xms>1024m</Xms>
<Xmn>512m</Xmn>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>./assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-libs-release</id>
<name>Spring libs-release Maven Repository</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>spring-libs-milestone</id>
<name>Spring libs-milestone Maven Repository</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring libs-snapshot Maven Repository</name>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>nexus-Repository</name>
<url>http://172.16.16.10:8080/repository/public/</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>nexus</id>-->
<!-- <name>nexus-Repository</name>-->
<!-- <url>http://172.16.16.10:8080/repository/public/</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </snapshots>-->
<!-- </repository>-->
<!-- </repositories>-->
<!-- <pluginRepositories>-->
<!-- <pluginRepository>-->
<!-- <id>nexus</id>-->
<!-- <name>nexus-Repository</name>-->
<!-- <url>http://172.16.16.10:8080/repository/public/</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </snapshots>-->
<!-- </pluginRepository>-->
<!-- </pluginRepositories>-->
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com</groupId>
<artifactId>ivccs-vmm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ivccs-vmm</name>
<description>Generator project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<elasticsearch.version>6.8.4</elasticsearch.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- es,依赖的lucene等jar包在spring-libs仓库才有,需要添加spring-libs仓库-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.49</version>
</dependency>
<!--集成redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.7.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>jedis</artifactId>
<groupId>redis.clients</groupId>
</exclusion>
</exclusions>
</dependency>
<!--引入AOP依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<!-- webSocket 依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!--easypoi-->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>4.1.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>4.1.3</version>
</dependency>
<!-- poi 处理excel -->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi</artifactId>-->
<!-- <version>3.17</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml-schemas</artifactId>-->
<!-- <version>3.17</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml</artifactId>-->
<!-- <version>3.17</version>-->
<!-- </dependency>-->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<!-- jetcache -->
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-anno</artifactId>
<version>2.5.9</version>
</dependency>
<dependency>
<groupId>com.alicp.jetcache</groupId>
<artifactId>jetcache-redis-lettuce</artifactId>
<version>2.5.9</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dev</id>
<properties>
<spring.active>dev</spring.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<spring.active>test</spring.active>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-libs-release</id>
<name>Spring libs-release Maven Repository</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>spring-libs-milestone</id>
<name>Spring libs-milestone Maven Repository</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring libs-snapshot Maven Repository</name>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>nexus</id>-->
<!-- <name>nexus-Repository</name>-->
<!-- <url>http://172.16.16.10:8080/repository/public/</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </snapshots>-->
<!-- </repository>-->
<!-- </repositories>-->
<!-- <pluginRepositories>-->
<!-- <pluginRepository>-->
<!-- <id>nexus</id>-->
<!-- <name>nexus-Repository</name>-->
<!-- <url>http://172.16.16.10:8080/repository/public/</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </snapshots>-->
<!-- </pluginRepository>-->
<!-- </pluginRepositories>-->
</project>
package com.ssi;
import com.dfssi.dataplatform.service.annotation.EnableLogAudit;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* SpringBoot启动类
*/
@EnableLogAudit
@SpringBootApplication
@MapperScan("com.ssi.mapper")
@EnableSwagger2
@EnableCaching
@EnableScheduling
public class SSIApplication {
public static void main(String[] args) {
System.setProperty("es.set.netty.runtime.available.processors", "false");
SpringApplication.run(SSIApplication.class, args);
}
}
package com.ssi.aspect;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.ssi.constant.VehicleConstant;
import com.ssi.constant.enums.Status;
import com.ssi.exception.CustomizeException;
import com.ssi.utils.RestTemplateUtil;
import com.ssi.utils.ToolUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.AuthorizationException;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* 登录校验及接口耗时记录切面
*/
@Aspect
@Component
public class LoginAspect {
@Value("${login-check-url}")
private String loginCheckUrl;
@Value("${OperationLog-Url}")
private String operationLogUrl;
@Value("${ExceptionLog-Url}")
private String exceptionLogUrl;
private static Long time;
private JSONObject operationLogParam = new JSONObject();
private final String POINT_CUT = "(execution(public * com.ssi.controller..*(..)) " +
"|| execution(public * com.ssi.dcvp.DcvpController.*(..))) " +
"&& !execution(public * com.ssi.controller.BigScreenController.*(..))" +
"&& !execution(public * com.ssi.controller.VmsDebugAppController.*(..))" +
"&& !execution(public * com.ssi.controller.platform.TelecontrolTakeOverController.*(..))" +
"&& !execution(public * com.ssi.controller.platform.RtkLocationController.*(..))" +
"&& !execution(public * com.ssi.controller.VmsVehicleController.getVehicleByLocation(..))" +
"&& !execution(public * com.ssi.controller.VmsCranePadBindController.getCraneByMac(..))" +
"&& !execution(public * com.ssi.controller.VmsTosOrdersController.getVehicleByPadMac(..))" +
"&& !execution(public * com.ssi.controller.VmsTosOrdersController.*(..))" +
"&& !execution(public * com.ssi.controller.VmsChargingPileController.list(..))" +
"&& !execution(public * com.ssi.controller.VmsRoadDeviceController.list(..))" +
"&& !execution(public * com.ssi.controller.VmsAreaPositionController.list(..))" +
"&& !execution(public * com.ssi.controller.VmsTerminalController.videoMonitor(..))" +
"&& !execution(public * com.ssi.controller.CraneInfoController.queryCraneList(..))" +
"&& !execution(public * com.ssi.controller.VmsRoadDeviceController.videoPlayUrlList(..))" +
"&& !execution(public * com.ssi.controller.VmsCarControlCommandController.emergency(..))" +
"&& !execution(public * com.ssi.controller.VmsCarControlCommandController.stepping(..))" +
"&& !execution(public * com.ssi.controller.VmsTerminalController.videoMonitor(..))" +
"&& execution(public * com.ssi.controller.VmsShipsDrawingController.saveShipTx(..))" +
"&& !execution(public * com.ssi.dcvp.DcvpController.login(..))";
/**
* 定义切入点,切入点为com.example.demo.aop.AopController中的所有函数 通过@Pointcut注解声明频繁使用的切点表达式
*/
@Pointcut(POINT_CUT)
public void LoginAspect() {
}
/**
* 定义在方法执行前和执行后要增加执行的逻辑,登录校验和接口耗时记录
*/
@Around("LoginAspect()")
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
long startTime = System.currentTimeMillis();
//获取token
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
String token = getRequestToken(request);
// if (StringUtils.isBlank(token)) {
// throw new AuthorizationException();
// }
String result = RestTemplateUtil.get(loginCheckUrl, token);
JSONObject resultObj = JSONObject.parseObject(result);
if ((int) resultObj.get("code") == Status.SUCCESS.getCode()) {
request.getSession()
.setAttribute(VehicleConstant.LOGIN_USER_KEY, resultObj.getJSONObject("data"));
//接口调用开始时间
Object proceed = proceedingJoinPoint.proceed();
//接口调用花费时间
time = System.currentTimeMillis() - startTime;
return proceed;
} else if ((int) resultObj.get("code") == Status.UNAUTHORIZED.getCode()) {
throw new AuthorizationException();
} else {
throw new CustomizeException("登录异常,请重新登录");
}
}
/**
* 获取请求的token
*/
private String getRequestToken(HttpServletRequest httpRequest) {
//从header中获取token
String token = httpRequest.getHeader("Authorization");
//如果header中不存在token,则从参数中获取token
if (org.apache.commons.lang.StringUtils.isBlank(token)) {
token = httpRequest.getParameter("Authorization");
}
return token;
}
/**
* 方法调用前,记录调用记录日志
*/
@Before(value = "LoginAspect()")
public void before(JoinPoint joinPoint) throws Exception {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
Object[] args = joinPoint.getArgs();
Collection collection = selectArgs(args);
Map<String, Object> map = new HashMap<String, Object>();
map.put("operation", joinPoint.getSignature().getName());
map.put("content", new Gson().toJson(collection).toString());
map.put("type", request.getMethod());
map.put("url", request.getRequestURI().toString());
map.put("time", time);
map.put("userAgent", request.getHeader("User-Agent"));
String token = getRequestToken(request);
operationLogParam.put("param", map);
operationLogParam.put("token", token);
}
/**
* 方法返回,插入操作日志
*/
@AfterReturning(value = "LoginAspect()")
public void afterReturning() throws Exception {
Map param = operationLogParam.getObject("param", Map.class);
param.put("time", time);
RestTemplateUtil.post(operationLogUrl, JSONObject.toJSON(param).toString(),
operationLogParam.getString("token"));
}
/**
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
*
* @param joinPoint 切入点
* @param e 异常信息
*/
@AfterThrowing(pointcut = "LoginAspect()", throwing = "e")
public void afterThrowing(JoinPoint joinPoint, Throwable e) throws Exception {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
Map<String, Object> map = new HashMap<String, Object>();
Object[] args = joinPoint.getArgs();
Collection collection = selectArgs(args);
map.put("oContent", new Gson().toJson(collection).toString());
map.put("type", request.getMethod());
map.put("url", request.getRequestURI().toString());
map.put("eContent",
ToolUtils.stackTraceToString(e.getClass().getName(), e.getMessage(), e.getStackTrace()));
map.put("userAgent", request.getHeader("User-Agent"));
String token = getRequestToken(request);
RestTemplateUtil.post(exceptionLogUrl, JSONObject.toJSON(map).toString(), token);
}
private Collection selectArgs(Object[] args) {
Collection collection = null;
if (args.length > 0) {
collection = CollectionUtils.select(Arrays.asList(args),
object -> !(object instanceof ServletResponse) && !(object instanceof ServletRequest));
}
return collection;
}
}
package com.ssi.client;
import com.ssi.utils.AESUtil;
import com.ssi.utils.RestTemplateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
/**
* @author SunnyHotz
* @PackageName:com.ssi.client
* @ClassName:TELDClient
* @Description:
* @date 2022/7/18 19:40
*/
@Component
public class TELDClient {
@Autowired
private RestTemplate restTemplate;
}
package com.ssi.config;
import com.ssi.model.TelecontrolModel;
import com.ssi.websocket.WebSocketServiceForDebugApp;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.annotation.Order;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
/**
* 一些常用bean的配置
*
* @author bin.Y
* @version 2018/4/13 11:32
*/
@Configuration
@Order(1)
public class BeanConfig {
/**
* 设置http请求超时时间
* @return
*/
@Bean
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(15000);
factory.setReadTimeout(30000);
return factory;
}
/**
* 自定义有超时时间的restTemplate
* @param clientHttpRequestFactory
* @return
*/
@Bean
public RestTemplate restTemplate(ClientHttpRequestFactory clientHttpRequestFactory) {
return new RestTemplate(clientHttpRequestFactory);
}
/**
* 自定义线程执行器
* @return
*/
@Bean
public ExecutorService executorService() {
//io密集型 取 2 * Ncpu ; 计算密集型 取 1 + Ncpu
return new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 4,
new BasicThreadFactory.Builder().namingPattern("abs-event-schedule-pool-%d").daemon(true).build());
}
/**
* 设置WebSocketServiceForDebugApp的telecontrolModel
* @return
*/
@Bean
public ApplicationListener<ContextRefreshedEvent> configProps(){
return (ContextRefreshedEvent contextRefreshedEvent) -> {
TelecontrolModel telecontrolModel = contextRefreshedEvent.getApplicationContext().getBean(TelecontrolModel.class);
WebSocketServiceForDebugApp.setTelecontrolModel(telecontrolModel);
};
}
}
\ No newline at end of file
package com.ssi.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 跨域配置,支持浏览器跨域
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.maxAge(3600);
}
}
package com.ssi.config;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 日期类型转换配置
*/
@Component
public class DateConverterConfig implements Converter<String, Date> {
private static final List<String> formarts = new ArrayList<>(4);
static{
formarts.add("yyyy-MM");
formarts.add("yyyy-MM-dd");
formarts.add("yyyy-MM-dd HH:mm");
formarts.add("yyyy-MM-dd HH:mm:ss");
}
/**
* 重写的时间日期转换法方法
* @param source
* @return
*/
@Override
public Date convert(String source) {
String value = source.trim();
if ("".equals(value)) {
return null;
}
if(source.matches("^\\d{4}-\\d{1,2}$")){
return parseDate(source, formarts.get(0));
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")){
return parseDate(source, formarts.get(1));
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")){
return parseDate(source, formarts.get(2));
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")){
return parseDate(source, formarts.get(3));
}else {
throw new IllegalArgumentException("Invalid boolean value '" + source + "'");
}
}
/**
* 格式化日期
* @param dateStr String 字符型日期
* @param format String 格式
* @return Date 日期
*/
public Date parseDate(String dateStr, String format) {
Date date=null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = dateFormat.parse(dateStr);
} catch (Exception e) {
}
return date;
}
}
package com.ssi.config;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import java.util.List;
/**
* Elasticsearch客户端配置
* @author zhoujibo
*/
@Configuration
@ComponentScan(basePackageClasses = ElasticsearchClientFactory.class)
public class ElasticsearchClientConfig {
@Value("${spring.data.elasticsearch.client.connect-num}")
private Integer connectNum;
@Value("${spring.data.elasticsearch.client.connect-per-route}")
private Integer connectPerRoute;
@Value("#{'${spring.data.elasticsearch.hosts}'.split(',')}")
private List<String> hosts;
@Value("${spring.data.elasticsearch.userName}")
private String userName;
@Value("${spring.data.elasticsearch.pwd}")
private String pwd;
@Value("${spring.data.elasticsearch.enable-security}")
private boolean enableSecurity = false;
@Bean(initMethod = "init", destroyMethod = "close")
public ElasticsearchClientFactory getFactory() {
return ElasticsearchClientFactory.build(hosts, connectNum, connectPerRoute, userName, pwd, enableSecurity);
}
@Bean(name = "restHighLevelClient")
@Scope("singleton")
public RestHighLevelClient getRestHighLevelClient() {
return getFactory().getRestHightLevelClient();
}
}
package com.ssi.config;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
/**
* Elasticsearch客户端工厂配置
* @author zhoujibo
*/
public class ElasticsearchClientFactory {
protected Logger logger = LoggerFactory.getLogger(getClass());
public static int CONNECT_TIMEOUT_MILLIS = 1000;
public static int SOCKET_TIMEOUT_MILLIS = 30000;
public static int CONNECTION_REQUEST_TIMEOUT_MILLIS = 500;
public static int MAX_CONN_PER_ROUTE = 10;
public static int MAX_CONN_TOTAL = 30;
public static String userName = "";
public static String pwd = "";
public static boolean enableSecurity = false;
private static HttpHost[] httpHosts;
private RestClientBuilder builder;
private RestHighLevelClient restHighLevelClient;
private static ElasticsearchClientFactory elasticsearchClientFactory = new ElasticsearchClientFactory();
private ElasticsearchClientFactory() {
}
public static ElasticsearchClientFactory build(List<String> hosts, Integer maxConnectNum,
Integer maxConnectPerRoute, String userName, String pwd, boolean enableSecurity) {
HttpHost[] httpHostArray = new HttpHost[hosts.size()];
for (int i = 0; i < hosts.size(); i++) {
String item = hosts.get(i);
httpHostArray[i] = new HttpHost(item.split(":")[0], Integer.parseInt(item.split(":")[1]), "http");
}
return ElasticsearchClientFactory.build(httpHostArray, maxConnectNum, maxConnectPerRoute, userName, pwd, enableSecurity);
}
public static ElasticsearchClientFactory build(HttpHost[] httpHosts, Integer maxConnectNum,
Integer maxConnectPerRoute, String userName, String pwd, boolean enableSecurity) {
ElasticsearchClientFactory.httpHosts = httpHosts;
MAX_CONN_TOTAL = maxConnectNum;
MAX_CONN_PER_ROUTE = maxConnectPerRoute;
ElasticsearchClientFactory.userName = userName;
ElasticsearchClientFactory.pwd = pwd;
ElasticsearchClientFactory.enableSecurity = enableSecurity;
return elasticsearchClientFactory;
}
public static ElasticsearchClientFactory build(HttpHost[] httpHosts, Integer connectTimeOut,
Integer socketTimeOut, Integer connectionRequestTime,
Integer maxConnectNum, Integer maxConnectPerRoute) {
ElasticsearchClientFactory.httpHosts = httpHosts;
CONNECT_TIMEOUT_MILLIS = connectTimeOut;
SOCKET_TIMEOUT_MILLIS = socketTimeOut;
CONNECTION_REQUEST_TIMEOUT_MILLIS = connectionRequestTime;
MAX_CONN_TOTAL = maxConnectNum;
MAX_CONN_PER_ROUTE = maxConnectPerRoute;
return elasticsearchClientFactory;
}
public void init() {
builder = RestClient.builder(httpHosts);
setConnectTimeOutConfig();
setMultiConnectConfig();
restHighLevelClient = new RestHighLevelClient(builder);
}
public void setConnectTimeOutConfig() {
builder.setRequestConfigCallback(requestConfigBuilder -> {
requestConfigBuilder.setConnectTimeout(CONNECT_TIMEOUT_MILLIS);
requestConfigBuilder.setSocketTimeout(SOCKET_TIMEOUT_MILLIS);
requestConfigBuilder.setConnectionRequestTimeout(CONNECTION_REQUEST_TIMEOUT_MILLIS);
return requestConfigBuilder;
});
}
public void setMultiConnectConfig() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, pwd));
builder.setHttpClientConfigCallback(httpClientBuilder -> {
httpClientBuilder.setMaxConnTotal(MAX_CONN_TOTAL);
httpClientBuilder.setMaxConnPerRoute(MAX_CONN_PER_ROUTE);
if (enableSecurity) {
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
return httpClientBuilder;
});
}
public RestHighLevelClient getRestHightLevelClient() {
return restHighLevelClient;
}
public void close() {
if (restHighLevelClient != null) {
try {
restHighLevelClient.close();
} catch (IOException e) {
logger.error("Fail to close elasticsearch rest high client.");
}
}
}
}
package com.ssi.config;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Maps;
import lombok.Getter;
import lombok.ToString;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.net.InetAddress;
import java.util.Map;
/**
* elasticsearch查询配置
*
* @author LiXiaoCong
* @version 2018/4/25 15:09
*/
@Configuration
@Getter
@ToString
public class ElasticsearchConfig {
private final Logger logger = LoggerFactory.getLogger(ElasticsearchConfig.class);
@Value("${spring.data.elasticsearch.cluster-name:es}")
private String clustername;
@Value("${spring.data.elasticsearch.cluster-nodes}")
private String servers;
@Value("${spring.data.elasticsearch.properties.pool:6}")
private String poolSize;
@Value("${es.client.search.type:road_terminal_02001}")
private String typeName;
@Value("${spring.data.elasticsearch.userName}")
private String userName;
@Value("${spring.data.elasticsearch.pwd}")
private String pwd;
@Value("${spring.data.elasticsearch.enable-security}")
private boolean enableSecurity = false;
@Bean
public TransportClient newTransportClient() {
logger.info("Elasticsearch客户端初始化开始...");
TransportClient transportClient = null;
try {
// 配置信息
Settings.Builder builder = Settings.builder();
if (clustername == null) {
builder.put("client.transport.ignore_cluster_name", true);
} else {
builder.put("cluster.name", clustername);
}
builder.put("client.transport.sniff", false);
builder.put("client.transport.ping_timeout", "180s");
builder.put("thread_pool.search.size", Integer.parseInt(poolSize));
if(enableSecurity){
builder.put("xpack.security.user", userName + ":" + pwd);
Settings esSetting = builder.build();
transportClient = new PreBuiltXPackTransportClient(esSetting);
}else{
Settings esSetting = builder.build();
//配置信息Settings自定义,下面设置为EMPTY
transportClient = new PreBuiltTransportClient(esSetting);
}
logger.info(String.format("es.client.servers = %s", servers));
HashMultimap<String, Integer> hostAndPort = HashMultimap.create();
String[] hps = servers.split(",");
String[] kv;
for (String hp : hps) {
kv = hp.split(":");
if (kv.length == 2) {
hostAndPort.put(kv[0], Integer.parseInt(kv[1]));
} else {
logger.error(String.format("es.client.servers: %s 配置有误, 示例: host:port", hp));
}
}
Preconditions.checkArgument(!hostAndPort.isEmpty(), "es.client.servers 中无可用的服务节点配置。");
for (Map.Entry<String, Integer> hp : hostAndPort.entries()) {
transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(hp.getKey()), hp.getValue()));
}
logger.info("Elasticsearch客户端初始化成功。");
} catch (Exception e) {
logger.error("elasticsearch TransportClient create error!!!", e);
}
return transportClient;
}
public static TransportClient getClient() {
TransportClient transportClient = null;
try {
System.setProperty("es.set.netty.runtime.available.processors", "false");
// 配置信息
Settings.Builder builder = Settings.builder();
builder.put("cluster.name", "my-application");
builder.put("client.transport.sniff", false);
builder.put("client.transport.ping_timeout", "180s");
builder.put("thread_pool.search.size", 6);
Settings esSetting = builder.build();
//配置信息Settings自定义,下面设置为EMPTY
transportClient = new PreBuiltTransportClient(esSetting);
HashMultimap<String, Integer> hostAndPort = HashMultimap.create();
String[] hps = "172.16.15.50:9300,172.16.15.51:9300,172.16.15.52:9300".split(",");
String[] kv;
for (String hp : hps) {
kv = hp.split(":");
if (kv.length == 2) {
hostAndPort.put(kv[0], Integer.parseInt(kv[1]));
}
}
Preconditions.checkArgument(!hostAndPort.isEmpty(), "es.client.servers 中无可用的服务节点配置。");
for (Map.Entry<String, Integer> hp : hostAndPort.entries()) {
transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(hp.getKey()), hp.getValue()));
}
} catch (Exception e) {
System.out.println("elasticsearch TransportClient create error!!!" + e);
}
return transportClient;
}
public static void main(String[] args) throws Exception {
TransportClient transportClient = getClient();
Map<String, Object> record = Maps.newHashMap();
record.put("id", "0001");
record.put("originalMsg", "wrwerer234234");
record.put("table", "my_template_demo");
record.put("index", "my_template_demo");
record.put("location", new GeoPoint(30.505715, 114.19597));
record.put("speed", 20.5);
record.put("age", 22);
record.put("address", "武汉");
String s = JSON.toJSONString(record);
System.out.println(s);
transportClient.prepareIndex("my_template_demo20200110", "my_template_demo", "0001")
.setSource(record)
.get();
}
}
package com.ssi.config;
import javax.annotation.PostConstruct;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
/**
* 测试需要
* @author 成东
* @since 2022-01-28 15:59
*/
//@Order(-1)
//@Configuration
public class InitConfig {
@PostConstruct
public void init() {
System.setProperty("es.set.netty.runtime.available.processors", "false");
}
}
package com.ssi.config;
import com.alicp.jetcache.anno.CacheConsts;
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import com.alicp.jetcache.anno.support.GlobalCacheConfig;
import com.alicp.jetcache.anno.support.SpringConfigProvider;
import com.alicp.jetcache.embedded.EmbeddedCacheBuilder;
import com.alicp.jetcache.embedded.LinkedHashMapCacheBuilder;
import com.alicp.jetcache.redis.lettuce.RedisLettuceCacheBuilder;
import com.alicp.jetcache.support.FastjsonKeyConvertor;
import com.alicp.jetcache.support.JavaValueDecoder;
import com.alicp.jetcache.support.JavaValueEncoder;
import com.google.common.base.Joiner;
import io.lettuce.core.RedisClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
/**
* JetCache缓存配置
*/
@Configuration
@EnableMethodCache(basePackages = {
"com.ssi.model",
"com.ssi.service"
})
@EnableCreateCacheAnnotation
public class JetCacheConfig {
private final String clientName = "JetCacheClient";
@Autowired
private JetCacheRedisConfig jetCacheRedisConfig;
@Bean
public RedisClient pool() {
JetCacheRedisConfig.Sentinel sentinel = jetCacheRedisConfig.getSentinel();
Duration timeout = jetCacheRedisConfig.getTimeout();
int t = timeout == null ? 5000 : (int) timeout.toMillis();
String url = jetCacheRedisConfig.getUrl();
if (url == null) {
if (sentinel != null) {
url = String.format("redis-sentinel://user:%s@%s/?sentinelMasterId=%s&database=%s&timeout=%s",
jetCacheRedisConfig.getPassword(),
Joiner.on(",").skipNulls().join(sentinel.getNodes()),
sentinel.getMaster(),
jetCacheRedisConfig.getDatabase(),
t);
} else {
url = String.format("redis://user:%s@%s:%s?database=%s&timeout=%s",
jetCacheRedisConfig.getPassword(),
jetCacheRedisConfig.getHost(),
jetCacheRedisConfig.getPort(),
jetCacheRedisConfig.getDatabase(),
t);
}
}
return RedisClient.create(url);
}
@Bean
public SpringConfigProvider springConfigProvider() {
return new SpringConfigProvider();
}
@Bean
public GlobalCacheConfig config(SpringConfigProvider configProvider, RedisClient redisClient) {
Map localBuilders = new HashMap();
EmbeddedCacheBuilder localBuilder = LinkedHashMapCacheBuilder
.createLinkedHashMapCacheBuilder()
.keyConvertor(FastjsonKeyConvertor.INSTANCE);
localBuilders.put(CacheConsts.DEFAULT_AREA, localBuilder);
Map remoteBuilders = new HashMap();
RedisLettuceCacheBuilder remoteCacheBuilder = RedisLettuceCacheBuilder.createRedisLettuceCacheBuilder()
.keyConvertor(FastjsonKeyConvertor.INSTANCE)
.valueEncoder(JavaValueEncoder.INSTANCE)
.valueDecoder(JavaValueDecoder.INSTANCE)
.redisClient(redisClient);
remoteCacheBuilder.setKeyPrefix("ivccs:vms:");
remoteBuilders.put(CacheConsts.DEFAULT_AREA, remoteCacheBuilder);
GlobalCacheConfig globalCacheConfig = new GlobalCacheConfig();
globalCacheConfig.setConfigProvider(configProvider);
globalCacheConfig.setLocalCacheBuilders(localBuilders);
globalCacheConfig.setRemoteCacheBuilders(remoteBuilders);
globalCacheConfig.setStatIntervalMinutes(15);
globalCacheConfig.setHiddenPackages(new String[]{"com.dfssi.dataplatform.v2x"});
globalCacheConfig.setAreaInCacheName(false);
return globalCacheConfig;
}
}
\ No newline at end of file
package com.ssi.config;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.time.Duration;
import java.util.List;
/**
* JetCache使用redis做缓存配置
* 和 spring boot redis 使用同一份配置
*
* @author LiXiaoCong
* @version 2018/11/18 9:52
*/
@Slf4j
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "spring.redis")
public class JetCacheRedisConfig {
/**
* Database index used by the connection factory.
*/
private int database = 0;
/**
* Connection URL. Overrides host, port, and password. User is ignored. Example:
* redis://user:password@example.com:6379
*/
private String url;
/**
* Redis server host.
*/
private String host = "localhost";
/**
* Login password of the redis server.
*/
private String password;
/**
* Redis server port.
*/
private int port = 6379;
/**
* Whether to enable SSL support.
*/
private boolean ssl;
/**
* Connection timeout.
*/
private Duration timeout;
private Sentinel sentinel;
private SingleConfig singleNode;
private Pool pool;
private final Jedis jedis = new Jedis();
private final Lettuce lettuce = new Lettuce();
public Jedis getJedis() {
this.jedis.setPool(pool);
return this.jedis;
}
/**
* Pool properties.
*/
public static class Pool {
/**
* Maximum number of "idle" connections in the pool. Use a negative value to
* indicate an unlimited number of idle connections.
*/
private int maxIdle = 8;
/**
* Target for the minimum number of idle connections to maintain in the pool. This
* setting only has an effect if it is positive.
*/
private int minIdle = 0;
/**
* Maximum number of connections that can be allocated by the pool at a given
* time. Use a negative value for no limit.
*/
private int maxActive = 8;
/**
* Maximum amount of time a connection allocation should block before throwing an
* exception when the pool is exhausted. Use a negative value to block
* indefinitely.
*/
private Duration maxWait = Duration.ofMillis(-1);
public int getMaxIdle() {
return this.maxIdle;
}
public void setMaxIdle(int maxIdle) {
this.maxIdle = maxIdle;
}
public int getMinIdle() {
return this.minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public int getMaxActive() {
return this.maxActive;
}
public void setMaxActive(int maxActive) {
this.maxActive = maxActive;
}
public Duration getMaxWait() {
return this.maxWait;
}
public void setMaxWait(Duration maxWait) {
this.maxWait = maxWait;
}
}
/**
* Redis sentinel properties.
*/
public static class Sentinel {
/**
* Name of the Redis server.
*/
private String master;
/**
* Comma-separated list of "host:port" pairs.
*/
private List<String> nodes;
public String getMaster() {
return this.master;
}
public void setMaster(String master) {
this.master = master;
}
public List<String> getNodes() {
return this.nodes;
}
public void setNodes(List<String> nodes) {
this.nodes = nodes;
}
}
/**
* Jedis client properties.
*/
public static class Jedis {
/**
* Jedis pool configuration.
*/
private Pool pool;
public Pool getPool() {
return this.pool;
}
public void setPool(Pool pool) {
this.pool = pool;
}
}
/**
* Lettuce client properties.
*/
public static class Lettuce {
/**
* Shutdown timeout.
*/
private Duration shutdownTimeout = Duration.ofMillis(100);
/**
* Lettuce pool configuration.
*/
private Pool pool;
public Duration getShutdownTimeout() {
return this.shutdownTimeout;
}
public void setShutdownTimeout(Duration shutdownTimeout) {
this.shutdownTimeout = shutdownTimeout;
}
public Pool getPool() {
return this.pool;
}
public void setPool(Pool pool) {
this.pool = pool;
}
}
public static class SingleConfig {
private String host;
private Integer port;
private Integer database;
private String password;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public Integer getDatabase() {
return database;
}
public void setDatabase(Integer database) {
this.database = database;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
}
\ No newline at end of file
package com.ssi.config;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.config.KafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
import org.springframework.kafka.listener.ContainerProperties;
import java.util.HashMap;
import java.util.Map;
/**
* kafka消费者配置
*
* @author Lvjiapeng
*/
@Configuration
public class KafkaConsumerConfig {
@Value("${spring.kafka.bootstrap-servers:192.168.6.2:9092,192.168.6.3:9092,192.168.6.4:9092}")
private String servers;
@Value("${spring.kafka.consumer.enable-auto-commit:true}")
private boolean enableAutoCommit;
@Value("${spring.kafka.consumer.auto-commit-interval:1000}")
private String autoCommitInterval;
@Value("${spring.kafka.consumer.auto-offset-reset:earliest}")
private String autoOffsetReset;
@Value("${spring.kafka.consumer.group-id}")
private String groupId;
@Value("${spring.kafka.listener.concurrency:1}")
private int concurrency;
@Value("${spring.kafka.listener.missing-topics-fatal: false}")
private boolean missingTopicsFatal;
@Value("${spring.kafka.listener.ack-mode: MANUAL_IMMEDIATE}")
private ContainerProperties.AckMode ackMode;
@Bean
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
factory.setConcurrency(concurrency);
factory.getContainerProperties().setAckMode(ackMode);
factory.getContainerProperties().setMissingTopicsFatal(missingTopicsFatal);
factory.getContainerProperties().setPollTimeout(1500);
return factory;
}
public ConsumerFactory<String, String> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(consumerConfigs());
}
public Map<String, Object> consumerConfigs() {
Map<String, Object> propsMap = new HashMap<>();
propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, servers);
propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, enableAutoCommit);
propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, autoCommitInterval);
propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
propsMap.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
propsMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, autoOffsetReset);
return propsMap;
}
}
package com.ssi.config;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
/**
* @author SunnyHotz
* @PackageName:com.ssi.config
* @ClassName:LogbackConfig
* @Description:
* @date 2022/12/16 19:24
*/
public class LogbackConfig extends Filter<ILoggingEvent> {
@Override
public FilterReply decide(ILoggingEvent event) {
String loggerName = event.getLoggerName();
if(loggerName.startsWith("com.ssi.utils.grid")||loggerName.startsWith("com.ssi.kafka.listener.VehicleRealTimeInfoListener")){
return FilterReply.DENY;
}
Level level = event.getLevel();
if(level.levelInt<level.INFO_INT){
return FilterReply.DENY;
}
return FilterReply.NEUTRAL;
}
}
package com.ssi.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* MybatisPlus的一些配置
*/
@Configuration
@ConditionalOnClass(value = {PaginationInterceptor.class})
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
return paginationInterceptor;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment