rev:提交aps相关代码
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>hl_one_acs</artifactId>
|
||||
<groupId>org.nl</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.12.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -13,35 +14,77 @@
|
||||
<name>核心模块</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<commons-csv.version>1.8</commons-csv.version>
|
||||
<java.version>1.8</java.version>
|
||||
<log4jdbc.version>1.16</log4jdbc.version>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<druid.version>1.1.22</druid.version>
|
||||
<commons-pool2.version>2.5.0</commons-pool2.version>
|
||||
<mapstruct.version>1.3.1.Final</mapstruct.version>
|
||||
<sa-token.version>1.31.0</sa-token.version>
|
||||
<hutool.version>5.7.14</hutool.version>
|
||||
<jjwt.version>0.11.1</jjwt.version>
|
||||
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
|
||||
<jna.version>5.5.0</jna.version>
|
||||
<elasticsearch.version>7.6.1</elasticsearch.version>
|
||||
<jna.version>5.9.0</jna.version>
|
||||
<configuration.version>1.9</configuration.version>
|
||||
<lucene.version>8.2.0</lucene.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>6.6</version>
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
<artifactId>jansi</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<!-- JetCache Redis 依赖-->
|
||||
<!--<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.50</version>
|
||||
</dependency>-->
|
||||
<!--导出CSV相关-->
|
||||
<dependency>
|
||||
<groupId>com.alicp.jetcache</groupId>
|
||||
<artifactId>jetcache-starter-redis</artifactId>
|
||||
<version>2.5.14</version>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-csv</artifactId>
|
||||
<version>${commons-csv.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alicp.jetcache</groupId>
|
||||
<artifactId>jetcache-starter-redis-lettuce</artifactId>
|
||||
<version>2.5.14</version>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.openscada.jinterop</groupId>
|
||||
<artifactId>org.openscada.jinterop.core</artifactId>
|
||||
<version>2.1.8</version>
|
||||
</dependency>-->
|
||||
<!--<dependency>
|
||||
<groupId>org.openscada.jinterop</groupId>
|
||||
<artifactId>org.openscada.jinterop.deps</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.openscada.utgard</groupId>
|
||||
<artifactId>org.openscada.opc.dcom</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.openscada.utgard</groupId>
|
||||
<artifactId>org.openscada.opc.lib</artifactId>
|
||||
@@ -52,85 +95,65 @@
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.8.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--lucene相关-->
|
||||
<!--WQL-->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>8.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>8.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-smartcn</artifactId>
|
||||
<version>8.4.0</version>
|
||||
<groupId>com.hynnet</groupId>
|
||||
<artifactId>jxl</artifactId>
|
||||
<version>2.6.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>8.4.0</version>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils-core</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ip地址解析-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.2</version>
|
||||
</dependency>-->
|
||||
|
||||
<!--接口限流-->
|
||||
<dependency>
|
||||
<groupId>net.dreamlu</groupId>
|
||||
<artifactId>mica-ip2region</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--导入excel相关-->
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<!--<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>29.0-jre</version>
|
||||
</dependency>-->
|
||||
<!--模板引擎-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.2.6</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--导出CSV相关-->
|
||||
<!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-csv</artifactId>
|
||||
<version>1.8</version>
|
||||
<groupId>commons-configuration</groupId>
|
||||
<artifactId>commons-configuration</artifactId>
|
||||
<version>${configuration.version}</version>
|
||||
</dependency>
|
||||
<!-- ****************** -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.8.0</version>
|
||||
<groupId>com.alicp.jetcache</groupId>
|
||||
<artifactId>jetcache-starter-redis</artifactId>
|
||||
<version>2.5.14</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成模块 -->
|
||||
<dependency>
|
||||
<groupId>org.nl</groupId>
|
||||
<artifactId>nladmin-generator</artifactId>
|
||||
<version>2.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.nl</groupId>
|
||||
<artifactId>nladmin-common</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc5</artifactId>
|
||||
<version>11.2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://www.jianshu.com/p/e40d111c7bfc?utm_source=oschina-app 热部署 https://zhuanlan.zhihu.com/p/63381268-->
|
||||
|
||||
<!-- tools 模块包含了 common 和 logging 模块 -->
|
||||
<dependency>
|
||||
<groupId>org.nl</groupId>
|
||||
<artifactId>nladmin-tools</artifactId>
|
||||
<version>2.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring boot websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -178,35 +201,6 @@
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.nl</groupId>
|
||||
<artifactId>nladmin-wql</artifactId>
|
||||
<version>2.7</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jul-to-slf4j</artifactId>
|
||||
<version>1.7.30</version>
|
||||
</dependency>
|
||||
<!--mysql数据库驱动 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--loki-->
|
||||
<!-- https://loki4j.github.io/loki-logback-appender/#quick-start -->
|
||||
<dependency>
|
||||
@@ -219,21 +213,274 @@
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<!--接口限流-->
|
||||
<!--工具包-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!--Spring boot 核心-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<!--Spring boot Web容器-->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>29.0-jre</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot 测试-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>objenesis</artifactId>
|
||||
<groupId>org.objenesis</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot 安全框架-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- Sa-Token 权限认证 安全框架, 在线文档:http://sa-token.dev33.cn/ -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
||||
<version>${sa-token.version}</version>
|
||||
</dependency>
|
||||
<!-- Sa-Token 整合 jwt -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-jwt</artifactId>
|
||||
<version>${sa-token.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- spring boot 缓存 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot Redis-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--spring boot 集成redis所需common-pool2-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>${commons-pool2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--监控sql日志-->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>${log4jdbc.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI 相关 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<!--Mysql依赖包-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- druid数据源驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dreamlu</groupId>
|
||||
<artifactId>mica-ip2region</artifactId>
|
||||
<version>2.5.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.lionsoul</groupId>
|
||||
<artifactId>ip2region</artifactId>
|
||||
<version>1.7.2</version>
|
||||
</dependency>
|
||||
<!--lombok插件-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi</artifactId>-->
|
||||
<!-- <version>3.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||
<!-- <version>3.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--mapStruct依赖-->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Java图形验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.whvcse</groupId>
|
||||
<artifactId>easy-captcha</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 解析客户端操作系统、浏览器信息 -->
|
||||
<dependency>
|
||||
<groupId>nl.basjes.parse.useragent</groupId>
|
||||
<artifactId>yauaa</artifactId>
|
||||
<version>5.23</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Lucence核心包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-core</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-highlighter</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-common</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.magese</groupId>
|
||||
<artifactId>ik-analyzer</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--支持中文分词 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-analyzers-smartcn</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<!-- Lucene查询解析包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- springboot2.3之后,hibernate-validator依赖缺失 手动添加 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<!--正式版本-->
|
||||
<repository>
|
||||
<!-- nexus服务器中用户名:在settings.xml中<server>的id-->
|
||||
<id>nexus</id>
|
||||
<!-- 这个名称自己定义 -->
|
||||
<name>nexus</name>
|
||||
<url>http://121.40.234.130:8081/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<!--快照
|
||||
<snapshotRepository>
|
||||
<id>nexus-snapshots</id>
|
||||
<name>Snapshots repository</name>
|
||||
<url>http://192.168.1.105/repository/yang/</url>
|
||||
</snapshotRepository>-->
|
||||
</distributionManagement>
|
||||
|
||||
<!-- 打包 -->
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -253,23 +500,6 @@
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>java</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<configuration>
|
||||
<classpathScope>test</classpathScope>
|
||||
<!-- <mainClass>com.itheima.test.MybatisTest</mainClass>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<!--把包路径下所有的文件(如.wql)都编译打包到target中,默认只能打包java文件-->
|
||||
@@ -279,7 +509,11 @@
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
@@ -288,36 +522,6 @@
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<!--单元测试时引用src/main/resources下的资源文件-->
|
||||
<!-- <testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/main/resources</directory>
|
||||
</testResource>
|
||||
</testResources>-->
|
||||
|
||||
</build>
|
||||
|
||||
<!-- <repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>-->
|
||||
|
||||
<!--<repository>
|
||||
<id>nexus</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>-->
|
||||
</project>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.10.RELEASE</version>
|
||||
<version>2.3.12.RELEASE</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -22,7 +22,7 @@
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<druid.version>1.1.22</druid.version>
|
||||
<commons-pool2.version>2.5.0</commons-pool2.version>
|
||||
<mapstruct.version>1.3.1.Final</mapstruct.version>
|
||||
<mapstruct.version>1.4.1.Final</mapstruct.version>
|
||||
<sa-token.version>1.31.0</sa-token.version>
|
||||
<hutool.version>5.7.14</hutool.version>
|
||||
<jjwt.version>0.11.1</jjwt.version>
|
||||
@@ -35,7 +35,7 @@
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
|
||||
<!-- https://onew.me/logback/2018/09/17/logback_win.html-->
|
||||
<dependency>
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
<artifactId>jansi</artifactId>
|
||||
@@ -82,11 +82,11 @@
|
||||
<artifactId>org.openscada.jinterop.deps</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.openscada.utgard</groupId>
|
||||
<artifactId>org.openscada.opc.dcom</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.openscada.utgard</groupId>
|
||||
<artifactId>org.openscada.opc.dcom</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.openscada.utgard</groupId>
|
||||
<artifactId>org.openscada.opc.lib</artifactId>
|
||||
@@ -110,11 +110,11 @@
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.2</version>
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.2</version>
|
||||
</dependency>-->
|
||||
|
||||
<!--接口限流-->
|
||||
<dependency>
|
||||
@@ -157,10 +157,10 @@
|
||||
<!-- https://www.jianshu.com/p/e40d111c7bfc?utm_source=oschina-app 热部署 https://zhuanlan.zhihu.com/p/63381268-->
|
||||
|
||||
<!-- Spring boot websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jwt -->
|
||||
<dependency>
|
||||
@@ -186,16 +186,16 @@
|
||||
</dependency>
|
||||
|
||||
<!-- linux的管理 -->
|
||||
<dependency>
|
||||
<groupId>ch.ethz.ganymed</groupId>
|
||||
<artifactId>ganymed-ssh2</artifactId>
|
||||
<version>build210</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<version>0.1.55</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.ethz.ganymed</groupId>
|
||||
<artifactId>ganymed-ssh2</artifactId>
|
||||
<version>build210</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<version>0.1.55</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
@@ -363,16 +363,16 @@
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi</artifactId>-->
|
||||
<!-- <version>3.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||
<!-- <version>3.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi</artifactId>-->
|
||||
<!-- <version>3.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||
<!-- <version>3.17</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
@@ -451,6 +451,19 @@
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- springboot2.3之后,hibernate-validator依赖缺失 手动添加 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
||||
@@ -14,394 +14,352 @@ import org.openscada.opc.lib.da.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerConnectionStateListener {
|
||||
List<OpcItemDto> protocols;
|
||||
OpcServerManageDto OpcServer;
|
||||
int error_num;
|
||||
String message;
|
||||
int maxResartNum;
|
||||
private Server server;
|
||||
private Group group;
|
||||
boolean flag = false;
|
||||
private int all_null;
|
||||
private Map<String, OpcItemDto> itemSearchCache;
|
||||
|
||||
public DeviceOpcProtocolRunable() {
|
||||
this.error_num = 0;
|
||||
this.all_null = 0;
|
||||
this.message = null;
|
||||
this.itemSearchCache = new HashMap();
|
||||
this.server = null;
|
||||
}
|
||||
|
||||
public List<OpcItemDto> getProtocols() {
|
||||
return this.protocols;
|
||||
}
|
||||
|
||||
public void setProtocols(List<OpcItemDto> protocols) {
|
||||
this.protocols = protocols;
|
||||
}
|
||||
|
||||
public OpcServerManageDto getOpcServer() {
|
||||
return this.OpcServer;
|
||||
}
|
||||
|
||||
public void setOpcServer(OpcServerManageDto opcServer) {
|
||||
this.OpcServer = opcServer;
|
||||
}
|
||||
|
||||
|
||||
private OpcItemDto getItem(String item) {
|
||||
OpcItemDto x = (OpcItemDto) this.itemSearchCache.get(item);
|
||||
if (x == null) {
|
||||
Iterator var3 = this.protocols.iterator();
|
||||
|
||||
while (var3.hasNext()) {
|
||||
OpcItemDto dto = (OpcItemDto) var3.next();
|
||||
if (StrUtil.equals(item, dto.getItem_code())) {
|
||||
x = dto;
|
||||
this.itemSearchCache.put(item, dto);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (OpcConfig.opc_item_read_using_callback) {
|
||||
this.runNew();
|
||||
} else {
|
||||
this.runOld();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void runOld() {
|
||||
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService .class);
|
||||
while (true) {
|
||||
start:
|
||||
try {
|
||||
if (this.group != null) {
|
||||
group.clear();
|
||||
group.remove();
|
||||
log.trace("清理group...");
|
||||
}
|
||||
if (this.server != null) {
|
||||
server.disconnect();
|
||||
log.trace("清理server...");
|
||||
}
|
||||
// this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
|
||||
// this.server.addStateListener(this);
|
||||
// group = this.server.addGroup();
|
||||
group =opcServerService.getServer(this.getOpcServer().getOpc_code());
|
||||
|
||||
List<String> itemsString = new ArrayList();
|
||||
Iterator var3 = this.protocols.iterator();
|
||||
|
||||
while (var3.hasNext()) {
|
||||
OpcItemDto protocol = (OpcItemDto) var3.next();
|
||||
String item = protocol.getItem_code();
|
||||
itemsString.add(item);
|
||||
}
|
||||
|
||||
Map<String, Item> itemsMap = new LinkedHashMap();
|
||||
boolean is_error = false;
|
||||
StringBuilder err_message = new StringBuilder();
|
||||
Iterator var6 = itemsString.iterator();
|
||||
|
||||
while (var6.hasNext()) {
|
||||
String string = (String) var6.next();
|
||||
|
||||
try {
|
||||
Item item = group.addItem(string);
|
||||
itemsMap.put(string, item);
|
||||
log.trace("添加成功 {}", string);
|
||||
} catch (Exception var26) {
|
||||
err_message.append(string + ":" + var26.getMessage());
|
||||
if (!is_error) {
|
||||
is_error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String tag;
|
||||
if (is_error) {
|
||||
tag = err_message.toString();
|
||||
log.warn("{}:{}", OpcConfig.resource_code, tag);
|
||||
}
|
||||
|
||||
if (!OpcStartTag.is_run) {
|
||||
OpcStartTag.is_run = true;
|
||||
}
|
||||
|
||||
tag = "";
|
||||
if (log.isWarnEnabled()) {
|
||||
tag = Thread.currentThread().getName();
|
||||
if (this.OpcServer != null) {
|
||||
tag = tag + this.getOpcGroupID();
|
||||
}
|
||||
}
|
||||
|
||||
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
|
||||
boolean time_out = false;
|
||||
|
||||
while (DeviceOpcSynchronizeAutoRun.isRun) {
|
||||
long begin = System.currentTimeMillis();
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("{} 开始记时{}", tag, DateUtil.now());
|
||||
}
|
||||
|
||||
Map<Item, ItemState> itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
||||
long end = System.currentTimeMillis();
|
||||
long duration = end - begin;
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("{} 读取耗时:{}", tag, duration);
|
||||
}
|
||||
|
||||
if (duration > 1000L) {
|
||||
if (!time_out) {
|
||||
log.warn("{} 读取超时 : {}", tag, duration);
|
||||
}
|
||||
|
||||
time_out = true;
|
||||
} else {
|
||||
time_out = false;
|
||||
}
|
||||
|
||||
boolean valueAllNotNull = false;
|
||||
Set<Item> items = itemStatus.keySet();
|
||||
Iterator var18 = items.iterator();
|
||||
|
||||
while (var18.hasNext()) {
|
||||
Item item = (Item) var18.next();
|
||||
ItemState itemState = (ItemState) itemStatus.get(item);
|
||||
Object value = OpcUtl.getValue(item, itemState);
|
||||
if (value != null) {
|
||||
valueAllNotNull = true;
|
||||
}
|
||||
|
||||
String itemId = item.getId();
|
||||
Object his = accessor_value.getValue(itemId);
|
||||
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
|
||||
log.warn("opc 值不健康 item: {}, 状态: {}", itemId, itemState.getQuality());
|
||||
valueAllNotNull = false;
|
||||
}
|
||||
|
||||
if (!UnifiedDataAppService.isEquals(value, his)) {
|
||||
OpcItemDto itemDto = this.getItem(itemId);
|
||||
if (true) {
|
||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
}
|
||||
if(!ObjectUtil.isEmpty(value)){
|
||||
accessor_value.setValue(itemId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end = System.currentTimeMillis();
|
||||
if (log.isTraceEnabled()) {
|
||||
log.trace("{}", itemsString);
|
||||
log.trace("{} 计算完成耗时{}", tag, end - begin);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) OpcConfig.synchronized_millisecond);
|
||||
if (this.error_num != 0) {
|
||||
this.error_num = 0;
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
if (!valueAllNotNull) {
|
||||
int random = (new Random()).nextInt(10) + 1;
|
||||
random *= 1000;
|
||||
if (this.all_null < 3) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,5000 + random);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) (5000 + random));
|
||||
} else if (this.all_null < 6) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn(tag + "重新创建server");
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,30000 + random);
|
||||
}
|
||||
// ThreadUtl.sleep((long) (30000 + random));
|
||||
ThreadUtl.sleep((long) ((new Random()).nextInt(3) +1) * 10000);
|
||||
break start;
|
||||
} else if (this.all_null < 12) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, '\uea60' + random);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) ('\uea60' + random));
|
||||
} else {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 120000 + random);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) (120000 + random));
|
||||
}
|
||||
|
||||
++this.all_null;
|
||||
} else {
|
||||
this.all_null = 0;
|
||||
}
|
||||
// break start;
|
||||
|
||||
}
|
||||
|
||||
log.warn("opc线程停止。。。");
|
||||
return;
|
||||
} catch (Exception var27) {
|
||||
if (this.server != null) {
|
||||
try {
|
||||
this.server.disconnect();
|
||||
} catch (Exception var25) {
|
||||
}
|
||||
}
|
||||
|
||||
this.server = null;
|
||||
if (!DeviceOpcSynchronizeAutoRun.isRun) {
|
||||
log.warn("opc线程停止2。。。");
|
||||
return;
|
||||
}
|
||||
|
||||
String error_message = "设备信息同步异常";
|
||||
if (!StrUtil.equals(this.message, error_message)) {
|
||||
log.warn(error_message, var27);
|
||||
}
|
||||
|
||||
ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
++this.error_num;
|
||||
if (this.error_num > 3 && !StrUtil.equals(this.message, error_message)) {
|
||||
this.message = error_message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void runNew() {
|
||||
Async20Access accessor = null;
|
||||
|
||||
while (true) {
|
||||
String opcGroupId = this.getOpcGroupID();
|
||||
|
||||
try {
|
||||
if (this.server == null) {
|
||||
this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
|
||||
this.server.addStateListener(this);
|
||||
accessor = new Async20Access(this.server, OpcConfig.synchronized_millisecond, true);
|
||||
Iterator var9 = this.protocols.iterator();
|
||||
|
||||
while (var9.hasNext()) {
|
||||
OpcItemDto protocol = (OpcItemDto) var9.next();
|
||||
String itemId = protocol.getItem_code();
|
||||
accessor.addItem(itemId, this);
|
||||
}
|
||||
|
||||
accessor.bind();
|
||||
log.info("Async20Access bind {}", opcGroupId);
|
||||
}
|
||||
|
||||
Thread.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
} catch (Exception var8) {
|
||||
if (accessor != null) {
|
||||
try {
|
||||
log.warn("Async20Access unbind {}", opcGroupId);
|
||||
accessor.unbind();
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
|
||||
accessor = null;
|
||||
}
|
||||
|
||||
if (this.server != null) {
|
||||
try {
|
||||
this.server.disconnect();
|
||||
} catch (Exception var6) {
|
||||
}
|
||||
public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerConnectionStateListener{
|
||||
List<OpcItemDto> protocols;
|
||||
OpcServerManageDto OpcServer;
|
||||
int error_num;
|
||||
String message;
|
||||
int maxResartNum;
|
||||
private Server server;
|
||||
private Group group;
|
||||
boolean flag = false;
|
||||
private int all_null;
|
||||
private Map<String,OpcItemDto> itemSearchCache;
|
||||
|
||||
public DeviceOpcProtocolRunable() {
|
||||
this.error_num = 0;
|
||||
this.all_null = 0;
|
||||
this.message = null;
|
||||
this.itemSearchCache = new HashMap();
|
||||
this.server = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (var8 instanceof InterruptedException) {
|
||||
log.warn("OPC 同步线程(%s)被中断", opcGroupId);
|
||||
return;
|
||||
}
|
||||
public List<OpcItemDto> getProtocols() {
|
||||
return this.protocols;
|
||||
}
|
||||
|
||||
log.warn("设备信息同步异常", var8);
|
||||
ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
String error_message = var8.getMessage();
|
||||
if (error_message == null) {
|
||||
error_message = var8.toString();
|
||||
}
|
||||
public void setProtocols(List<OpcItemDto> protocols) {
|
||||
this.protocols = protocols;
|
||||
}
|
||||
|
||||
++this.error_num;
|
||||
if (this.error_num > 3 && !StrUtil.equals(this.message, error_message)) {
|
||||
this.message = error_message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public OpcServerManageDto getOpcServer() {
|
||||
return this.OpcServer;
|
||||
}
|
||||
|
||||
public void setOpcServer(OpcServerManageDto opcServer) {
|
||||
this.OpcServer = opcServer;
|
||||
}
|
||||
|
||||
public void connectionStateChanged(boolean connected) {
|
||||
if (!connected) {
|
||||
this.server = null;
|
||||
}
|
||||
private OpcItemDto getItem(String item) {
|
||||
OpcItemDto x = (OpcItemDto) this.itemSearchCache.get(item);
|
||||
if(x == null) {
|
||||
Iterator var3 = this.protocols.iterator();
|
||||
while(var3.hasNext()) {
|
||||
OpcItemDto dto = (OpcItemDto) var3.next();
|
||||
if(StrUtil.equals(item, dto.getItem_code())) {
|
||||
x = dto;
|
||||
this.itemSearchCache.put(item, dto);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
log.warn("opc server {} {}", this.getOpcGroupID(), connected ? "connected" : "disconnected");
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
if(OpcConfig.opc_item_read_using_callback) {
|
||||
this.runNew();
|
||||
}
|
||||
else{
|
||||
this.runOld();
|
||||
}
|
||||
}
|
||||
|
||||
private String getOpcGroupID() {
|
||||
String var10000 = this.OpcServer.getOpc_code();
|
||||
return var10000 + "(" + this.protocols.size() + " items)";
|
||||
}
|
||||
private void runOld() {
|
||||
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService.class);
|
||||
while(true) {
|
||||
start:
|
||||
try {
|
||||
if(this.group != null) {
|
||||
group.clear();
|
||||
group.remove();
|
||||
log.trace("清理group...");
|
||||
}
|
||||
if(this.server != null) {
|
||||
server.disconnect();
|
||||
log.trace("清理server...");
|
||||
}
|
||||
// this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
|
||||
// this.server.addStateListener(this);
|
||||
// group = this.server.addGroup();
|
||||
group = opcServerService.getServer(this.getOpcServer().getOpc_code());
|
||||
List<String> itemsString = new ArrayList();
|
||||
Iterator var3 = this.protocols.iterator();
|
||||
while(var3.hasNext()) {
|
||||
OpcItemDto protocol = (OpcItemDto) var3.next();
|
||||
String item = protocol.getItem_code();
|
||||
itemsString.add(item);
|
||||
}
|
||||
Map<String,Item> itemsMap = new LinkedHashMap();
|
||||
boolean is_error = false;
|
||||
StringBuilder err_message = new StringBuilder();
|
||||
Iterator var6 = itemsString.iterator();
|
||||
while(var6.hasNext()) {
|
||||
String string = (String) var6.next();
|
||||
try {
|
||||
Item item = group.addItem(string);
|
||||
itemsMap.put(string, item);
|
||||
log.trace("添加成功 {}", string);
|
||||
}
|
||||
catch(Exception var26) {
|
||||
err_message.append(string + ":" + var26.getMessage());
|
||||
if(!is_error) {
|
||||
is_error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
String tag;
|
||||
if(is_error) {
|
||||
tag = err_message.toString();
|
||||
log.warn("{}:{}", OpcConfig.resource_code, tag);
|
||||
}
|
||||
if(!OpcStartTag.is_run) {
|
||||
OpcStartTag.is_run = true;
|
||||
}
|
||||
tag = "";
|
||||
if(log.isWarnEnabled()) {
|
||||
tag = Thread.currentThread().getName();
|
||||
if(this.OpcServer != null) {
|
||||
tag = tag + this.getOpcGroupID();
|
||||
}
|
||||
}
|
||||
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
|
||||
boolean time_out = false;
|
||||
while(DeviceOpcSynchronizeAutoRun.isRun) {
|
||||
long begin = System.currentTimeMillis();
|
||||
if(log.isTraceEnabled()) {
|
||||
log.trace("{} 开始记时{}", tag, DateUtil.now());
|
||||
}
|
||||
Map<Item,ItemState> itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
||||
long end = System.currentTimeMillis();
|
||||
long duration = end - begin;
|
||||
if(log.isTraceEnabled()) {
|
||||
log.trace("{} 读取耗时:{}", tag, duration);
|
||||
}
|
||||
if(duration > 1000L) {
|
||||
if(!time_out) {
|
||||
log.warn("{} 读取超时 : {}", tag, duration);
|
||||
}
|
||||
time_out = true;
|
||||
}
|
||||
else{
|
||||
time_out = false;
|
||||
}
|
||||
boolean valueAllNotNull = false;
|
||||
Set<Item> items = itemStatus.keySet();
|
||||
Iterator var18 = items.iterator();
|
||||
while(var18.hasNext()) {
|
||||
Item item = (Item) var18.next();
|
||||
ItemState itemState = (ItemState) itemStatus.get(item);
|
||||
Object value = OpcUtl.getValue(item, itemState);
|
||||
if(value != null) {
|
||||
valueAllNotNull = true;
|
||||
}
|
||||
String itemId = item.getId();
|
||||
Object his = accessor_value.getValue(itemId);
|
||||
if(!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
|
||||
log.warn("opc 值不健康 item: {}, 状态: {}", itemId, itemState.getQuality());
|
||||
valueAllNotNull = false;
|
||||
}
|
||||
if(!UnifiedDataAppService.isEquals(value, his)) {
|
||||
OpcItemDto itemDto = this.getItem(itemId);
|
||||
if(true) {
|
||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
}
|
||||
if(!ObjectUtil.isEmpty(value)) {
|
||||
accessor_value.setValue(itemId, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
end = System.currentTimeMillis();
|
||||
if(log.isTraceEnabled()) {
|
||||
log.trace("{}", itemsString);
|
||||
log.trace("{} 计算完成耗时{}", tag, end - begin);
|
||||
}
|
||||
ThreadUtl.sleep((long) OpcConfig.synchronized_millisecond);
|
||||
if(this.error_num != 0) {
|
||||
this.error_num = 0;
|
||||
this.message = null;
|
||||
}
|
||||
if(!valueAllNotNull) {
|
||||
int random = (new Random()).nextInt(10) + 1;
|
||||
random *= 1000;
|
||||
if(this.all_null < 3) {
|
||||
if(log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 5000 + random);
|
||||
}
|
||||
ThreadUtl.sleep((long) (5000 + random));
|
||||
}
|
||||
else if(this.all_null < 6) {
|
||||
if(log.isWarnEnabled()) {
|
||||
log.warn(tag + "重新创建server");
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null, 30000 + random);
|
||||
}
|
||||
// ThreadUtl.sleep((long) (30000 + random));
|
||||
ThreadUtl.sleep((long) ((new Random()).nextInt(3) + 1) * 10000);
|
||||
break start;
|
||||
}
|
||||
else if(this.all_null < 12) {
|
||||
if(log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, '\uea60' + random);
|
||||
}
|
||||
ThreadUtl.sleep((long) ('\uea60' + random));
|
||||
}
|
||||
else{
|
||||
if(log.isWarnEnabled()) {
|
||||
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 120000 + random);
|
||||
}
|
||||
ThreadUtl.sleep((long) (120000 + random));
|
||||
}
|
||||
++this.all_null;
|
||||
}
|
||||
else{
|
||||
this.all_null = 0;
|
||||
}
|
||||
// break start;
|
||||
}
|
||||
log.warn("opc线程停止。。。");
|
||||
return;
|
||||
}
|
||||
catch(Exception var27) {
|
||||
if(this.server != null) {
|
||||
try {
|
||||
this.server.disconnect();
|
||||
}
|
||||
catch(Exception var25) {
|
||||
}
|
||||
}
|
||||
this.server = null;
|
||||
if(!DeviceOpcSynchronizeAutoRun.isRun) {
|
||||
log.warn("opc线程停止2。。。");
|
||||
return;
|
||||
}
|
||||
String error_message = "设备信息同步异常";
|
||||
if(!StrUtil.equals(this.message, error_message)) {
|
||||
log.warn(error_message, var27);
|
||||
}
|
||||
ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
++this.error_num;
|
||||
if(this.error_num > 3 && !StrUtil.equals(this.message, error_message)) {
|
||||
this.message = error_message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String formatDuring(long mss) {
|
||||
long days = mss / 86400000L;
|
||||
long hours = mss % 86400000L / 3600000L;
|
||||
long minutes = mss % 3600000L / 60000L;
|
||||
long seconds = mss % 60000L / 1000L;
|
||||
return days + " days " + hours + " hours " + minutes + " minutes " + seconds + " seconds ";
|
||||
}
|
||||
private void runNew() {
|
||||
Async20Access accessor = null;
|
||||
while(true) {
|
||||
String opcGroupId = this.getOpcGroupID();
|
||||
try {
|
||||
if(this.server == null) {
|
||||
this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
|
||||
this.server.addStateListener(this);
|
||||
accessor = new Async20Access(this.server, OpcConfig.synchronized_millisecond, true);
|
||||
Iterator var9 = this.protocols.iterator();
|
||||
while(var9.hasNext()) {
|
||||
OpcItemDto protocol = (OpcItemDto) var9.next();
|
||||
String itemId = protocol.getItem_code();
|
||||
accessor.addItem(itemId, this);
|
||||
}
|
||||
accessor.bind();
|
||||
log.info("Async20Access bind {}", opcGroupId);
|
||||
}
|
||||
Thread.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
}
|
||||
catch(Exception var8) {
|
||||
if(accessor != null) {
|
||||
try {
|
||||
log.warn("Async20Access unbind {}", opcGroupId);
|
||||
accessor.unbind();
|
||||
}
|
||||
catch(Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
accessor = null;
|
||||
}
|
||||
if(this.server != null) {
|
||||
try {
|
||||
this.server.disconnect();
|
||||
}
|
||||
catch(Exception var6) {
|
||||
}
|
||||
this.server = null;
|
||||
}
|
||||
if(var8 instanceof InterruptedException) {
|
||||
log.warn("OPC 同步线程(%s)被中断", opcGroupId);
|
||||
return;
|
||||
}
|
||||
log.warn("设备信息同步异常", var8);
|
||||
ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000));
|
||||
String error_message = var8.getMessage();
|
||||
if(error_message == null) {
|
||||
error_message = var8.toString();
|
||||
}
|
||||
++this.error_num;
|
||||
if(this.error_num > 3 && !StrUtil.equals(this.message, error_message)) {
|
||||
this.message = error_message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void connectionStateChanged(boolean connected) {
|
||||
if(!connected) {
|
||||
this.server = null;
|
||||
}
|
||||
log.warn("opc server {} {}", this.getOpcGroupID(), connected ? "connected" : "disconnected");
|
||||
}
|
||||
|
||||
public void changed(Item item, ItemState itemState) {
|
||||
String itemId = item.getId();
|
||||
private String getOpcGroupID() {
|
||||
String var10000 = this.OpcServer.getOpc_code();
|
||||
return var10000 + "(" + this.protocols.size() + " items)";
|
||||
}
|
||||
|
||||
try {
|
||||
Object value = OpcUtl.getValue(item, itemState);
|
||||
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
|
||||
accessor_value.setValue(itemId, value);
|
||||
public static String formatDuring(long mss) {
|
||||
long days = mss / 86400000L;
|
||||
long hours = mss % 86400000L / 3600000L;
|
||||
long minutes = mss % 3600000L / 60000L;
|
||||
long seconds = mss % 60000L / 1000L;
|
||||
return days + " days " + hours + " hours " + minutes + " minutes " + seconds + " seconds ";
|
||||
}
|
||||
|
||||
// if (value != null) {
|
||||
// if (log.isTraceEnabled()) {
|
||||
// log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
|
||||
// }
|
||||
// } else if (log.isInfoEnabled()) {
|
||||
// log.info("Item {} new value: {}, Timestamp: {}, Quality: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime(), itemState.getQuality()});
|
||||
// }
|
||||
log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
|
||||
|
||||
OpcItemDto itemDto = this.getItem(itemId);
|
||||
// if (Boolean.TRUE.equals(itemDto.getNeed_log())) {
|
||||
// this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
// }
|
||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
|
||||
} catch (Exception var7) {
|
||||
log.error(itemId, var7);
|
||||
}
|
||||
|
||||
}
|
||||
public void changed(Item item, ItemState itemState) {
|
||||
String itemId = item.getId();
|
||||
try {
|
||||
Object value = OpcUtl.getValue(item, itemState);
|
||||
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
|
||||
accessor_value.setValue(itemId, value);
|
||||
// if (value != null) {
|
||||
// if (log.isTraceEnabled()) {
|
||||
// log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
|
||||
// }
|
||||
// } else if (log.isInfoEnabled()) {
|
||||
// log.info("Item {} new value: {}, Timestamp: {}, Quality: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime(), itemState.getQuality()});
|
||||
// }
|
||||
log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
|
||||
OpcItemDto itemDto = this.getItem(itemId);
|
||||
// if (Boolean.TRUE.equals(itemDto.getNeed_log())) {
|
||||
// this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
// }
|
||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
}
|
||||
catch(Exception var7) {
|
||||
log.error(itemId, var7);
|
||||
}
|
||||
}
|
||||
|
||||
private void logItemChanged(String itemId, UnifiedDataAccessor accessor_value, Object value, OpcItemDto itemDto) {
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user