Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosConnectRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosConnectRoot
Commits
1416f2a1
Commit
1416f2a1
authored
Dec 16, 2019
by
xukaiqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git
parent
3a29e559
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
42 deletions
+110
-42
pom.xml
YeeAmosConnectCommon/pom.xml
+2
-3
RedisKeyEnum.java
...a/com/yeejoin/amos/connect/common/enums/RedisKeyEnum.java
+40
-0
pom.xml
YeeAmosConnectStart/pom.xml
+11
-12
pom.xml
YeeAmosIec104IntfServer/pom.xml
+9
-9
GeneralDataQueue.java
...ejoin/amos/iec104/tcp/client/invoke/GeneralDataQueue.java
+46
-16
pom.xml
YeeAmosTransmitServer/pom.xml
+1
-1
pom.xml
YeeAmosUartServer/pom.xml
+1
-1
No files found.
YeeAmosConnectCommon/pom.xml
View file @
1416f2a1
...
@@ -3,13 +3,13 @@
...
@@ -3,13 +3,13 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
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"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<parent>
<artifactId>
YeeAmos
Iec104Intf
Root
</artifactId>
<artifactId>
YeeAmos
Connect
Root
</artifactId>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
YeeAmosConnectCommon
</artifactId>
<artifactId>
YeeAmosConnectCommon
</artifactId>
</project>
</project>
\ No newline at end of file
YeeAmosConnectCommon/src/main/java/com/yeejoin/amos/connect/common/enums/RedisKeyEnum.java
0 → 100644
View file @
1416f2a1
package
com
.
yeejoin
.
amos
.
connect
.
common
.
enums
;
public
enum
RedisKeyEnum
{
K001
(
"K001"
,
"AlarmParam"
);
/**
* 名称,描述
*/
private
String
key
;
/**
* 编码
*/
private
String
desc
;
public
static
String
buildKey
(
String
bizKey
,
RedisKeyEnum
redisKeyEnum
)
{
return
redisKeyEnum
.
getKey
()
+
"_"
+
bizKey
;
}
RedisKeyEnum
(
String
key
,
String
desc
)
{
this
.
key
=
key
;
this
.
desc
=
desc
;
}
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
YeeAmosConnectStart/pom.xml
View file @
1416f2a1
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
YeeAmosConnectStart
</artifactId>
<name>
YeeAmosConnectStart
</name>
<parent>
<parent>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConnectRoot
</artifactId>
<artifactId>
YeeAmosConnectRoot
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
YeeAmosConnectStart
</artifactId>
<dependencies>
<dependencies>
<!-- 业务模块jar -->
<!-- 业务模块jar -->
<dependency>
<dependency>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConnen
tCommon
</artifactId>
<artifactId>
YeeAmosConnec
tCommon
</artifactId>
<version>
${iec104.version}
</version>
<version>
1.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosIec104IntfServer
</artifactId>
<artifactId>
YeeAmosIec104IntfServer
</artifactId>
<version>
${iec104.version}
</version>
<version>
${iec104.version}
</version>
</dependency>
</dependency>
<dependency
>
<!-- <dependency>--
>
<groupId>
com.yeejoin.amos
</groupId
>
<!-- <groupId>com.yeejoin.amos</groupId>--
>
<artifactId>
YeeAmosUartServer
</artifactId
>
<!-- <artifactId>YeeAmosUartServer</artifactId>--
>
<version>
${iec104.version}
</version
>
<!-- <version>${iec104.version}</version>--
>
</dependency
>
<!-- </dependency>--
>
</dependencies>
</dependencies>
<!-- maven打包时将lib提取到jar同目录,将配置文件提取到jar目录/config/下 -->
<!-- maven打包时将lib提取到jar同目录,将配置文件提取到jar目录/config/下 -->
...
...
YeeAmosIec104IntfServer/pom.xml
View file @
1416f2a1
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConnectRoot
</artifactId>
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
jar
</packaging>
<artifactId>
YeeAmosIec104IntfServer
</artifactId>
<artifactId>
YeeAmosIec104IntfServer
</artifactId>
<name>
YeeAmosIec104IntfServer
</name>
<properties>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<drools.version>
6.5.0.Final
</drools.version>
<drools.version>
6.5.0.Final
</drools.version>
</properties>
</properties>
<parent>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosIec104IntfRoot
</artifactId>
<version>
1.0.0
</version>
</parent>
<dependencies>
<dependencies>
<!-- 安全模块jar -->
<!-- 安全模块jar -->
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConnen
tCommon
</artifactId>
<artifactId>
YeeAmosConnec
tCommon
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConne
n
tCommon
</artifactId>
<artifactId>
YeeAmosConne
c
tCommon
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
...
...
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/client/invoke/GeneralDataQueue.java
View file @
1416f2a1
package
com
.
yeejoin
.
amos
.
iec104
.
tcp
.
client
.
invoke
;
package
com
.
yeejoin
.
amos
.
iec104
.
tcp
.
client
.
invoke
;
import
java.util.LinkedList
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.concurrent.BlockingQueue
;
import
com.yeejoin.amos.connect.common.enums.RedisKeyEnum
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
import
com.yeejoin.amos.connect.dao.entity.PointConfigVo
;
import
com.yeejoin.amos.connect.dao.entity.PointConfigVo
;
import
org.apache.log4j.Logger
;
import
org.springframework.util.ObjectUtils
;
import
com.yeejoin.amos.iec104.business.constants.IEC104Constant
;
import
com.yeejoin.amos.iec104.business.constants.IEC104Constant
;
import
com.yeejoin.amos.iec104.business.param.AlarmParam
;
import
com.yeejoin.amos.iec104.business.param.AlarmParam
;
import
com.yeejoin.amos.iec104.business.service.intfc.IClientListenService
;
import
com.yeejoin.amos.iec104.business.service.intfc.IClientListenService
;
import
com.yeejoin.amos.iec104.business.service.intfc.IConfService
;
import
com.yeejoin.amos.iec104.business.service.intfc.IConfService
;
import
com.yeejoin.amos.iec104.business.service.intfc.IPointConfigService
;
import
com.yeejoin.amos.iec104.business.service.intfc.IPointConfigService
;
import
com.yeejoin.amos.iec104.context.FireAutoIntfContext
;
import
com.yeejoin.amos.iec104.context.FireAutoIntfContext
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.LinkedList
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
public
class
GeneralDataQueue
{
public
class
GeneralDataQueue
{
private
static
final
BlockingQueue
<
AlarmParam
>
blockingQueue
=
new
LinkedBlockingQueue
<
AlarmParam
>();
private
static
final
BlockingQueue
<
AlarmParam
>
blockingQueue
=
new
LinkedBlockingQueue
<
AlarmParam
>();
...
@@ -26,19 +30,22 @@ public class GeneralDataQueue {
...
@@ -26,19 +30,22 @@ public class GeneralDataQueue {
IConfService
confService
;
IConfService
confService
;
private
volatile
static
GeneralDataQueue
instance
=
null
;
private
volatile
static
GeneralDataQueue
instance
=
null
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
private
GeneralDataQueue
()
{
private
GeneralDataQueue
()
{
clientListenService
=
(
IClientListenService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IClientListenService
.
class
);
clientListenService
=
(
IClientListenService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IClientListenService
.
class
);
confService
=
(
IConfService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IConfService
.
class
);
confService
=
(
IConfService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IConfService
.
class
);
pointConfigService
=
(
IPointConfigService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IPointConfigService
.
class
);
pointConfigService
=
(
IPointConfigService
)
FireAutoIntfContext
.
getInstance
().
getBean
(
IPointConfigService
.
class
);
}
}
public
static
GeneralDataQueue
getInstance
(){
public
static
GeneralDataQueue
getInstance
()
{
//先检查实例是否存在,如果不存在才进入下面的同步块
//先检查实例是否存在,如果不存在才进入下面的同步块
if
(
instance
==
null
)
{
if
(
instance
==
null
)
{
//同步块,线程安全的创建实例
//同步块,线程安全的创建实例
synchronized
(
GeneralDataQueue
.
class
)
{
synchronized
(
GeneralDataQueue
.
class
)
{
//再次检查实例是否存在,如果不存在才真的创建实例
//再次检查实例是否存在,如果不存在才真的创建实例
if
(
instance
==
null
)
{
if
(
instance
==
null
)
{
instance
=
new
GeneralDataQueue
();
instance
=
new
GeneralDataQueue
();
}
}
}
}
...
@@ -60,10 +67,31 @@ public class GeneralDataQueue {
...
@@ -60,10 +67,31 @@ public class GeneralDataQueue {
}
}
Runnable
task_runnable
=
new
Runnable
()
{
Runnable
task_runnable
=
new
Runnable
()
{
private
boolean
alarmParamIsChange
(
AlarmParam
alarmParam
)
{
String
redisKey
=
RedisKeyEnum
.
buildKey
(
alarmParam
.
getPointCode
(),
RedisKeyEnum
.
K001
);
String
data
=
redisTemplate
.
opsForValue
().
get
(
redisKey
);
if
(
StringUtils
.
isEmpty
(
data
))
{
redisTemplate
.
opsForValue
().
set
(
redisKey
,
JSONObject
.
toJSONString
(
alarmParam
));
return
true
;
}
else
{
AlarmParam
oldAlarmParam
=
JSONObject
.
parseObject
(
data
,
AlarmParam
.
class
);
if
(
oldAlarmParam
.
getState
().
equals
(
alarmParam
.
getState
()))
{
return
false
;
}
else
{
redisTemplate
.
opsForValue
().
set
(
redisKey
,
JSONObject
.
toJSONString
(
alarmParam
));
return
true
;
}
}
}
public
void
run
()
{
public
void
run
()
{
while
(
true
)
{
while
(
true
)
{
try
{
try
{
AlarmParam
param1
=
blockingQueue
.
take
();
AlarmParam
param1
=
blockingQueue
.
take
();
if
(!
alarmParamIsChange
(
param1
))
{
return
;
}
LinkedList
<
AlarmParam
>
datas
=
new
LinkedList
<
AlarmParam
>();
LinkedList
<
AlarmParam
>
datas
=
new
LinkedList
<
AlarmParam
>();
PointConfigVo
vo
=
pointConfigService
.
findByServicesIdAndInfoAddress
(
param1
.
getServiceId
(),
Integer
.
valueOf
(
param1
.
getInformationAddress
()));
PointConfigVo
vo
=
pointConfigService
.
findByServicesIdAndInfoAddress
(
param1
.
getServiceId
(),
Integer
.
valueOf
(
param1
.
getInformationAddress
()));
param1
.
setPointCode
(
vo
.
getPointCode
());
param1
.
setPointCode
(
vo
.
getPointCode
());
...
@@ -87,7 +115,7 @@ public class GeneralDataQueue {
...
@@ -87,7 +115,7 @@ public class GeneralDataQueue {
}
else
{
}
else
{
isEmpty
=
true
;
isEmpty
=
true
;
}
}
}
while
(!
isEmpty
);
}
while
(!
isEmpty
);
try
{
try
{
if
(!
ObjectUtils
.
isEmpty
(
datas
))
{
if
(!
ObjectUtils
.
isEmpty
(
datas
))
{
clientListenService
.
sendDatas
(
IEC104Constant
.
GENERAL_MESSAGE
,
datas
);
clientListenService
.
sendDatas
(
IEC104Constant
.
GENERAL_MESSAGE
,
datas
);
...
@@ -102,4 +130,6 @@ public class GeneralDataQueue {
...
@@ -102,4 +130,6 @@ public class GeneralDataQueue {
}
}
}
}
};
};
}
}
YeeAmosTransmitServer/pom.xml
View file @
1416f2a1
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConne
n
tCommon
</artifactId>
<artifactId>
YeeAmosConne
c
tCommon
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
...
...
YeeAmosUartServer/pom.xml
View file @
1416f2a1
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.yeejoin.amos
</groupId>
<groupId>
com.yeejoin.amos
</groupId>
<artifactId>
YeeAmosConne
n
tCommon
</artifactId>
<artifactId>
YeeAmosConne
c
tCommon
</artifactId>
<version>
1.0.0
</version>
<version>
1.0.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment