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
a40cd118
Commit
a40cd118
authored
Jul 27, 2020
by
高东东
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gaodongdong' into develop
parents
e35de3be
f16c5869
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
37 deletions
+40
-37
RedisKeyEnum.java
...a/com/yeejoin/amos/connect/common/enums/RedisKeyEnum.java
+4
-0
application-dev.properties
...onnectStart/src/main/resources/application-dev.properties
+3
-16
ApduQueue.java
.../com/yeejoin/amos/iec104/tcp/client/invoke/ApduQueue.java
+14
-5
GeneralDataQueue.java
...ejoin/amos/iec104/tcp/client/invoke/GeneralDataQueue.java
+1
-1
RecDataQueue.java
...m/yeejoin/amos/iec104/tcp/client/invoke/RecDataQueue.java
+3
-0
IeCP56Time2a.java
...java/com/yeejoin/amos/iec104/tcp/entity/IeCP56Time2a.java
+1
-1
IeInteger.java
...in/java/com/yeejoin/amos/iec104/tcp/entity/IeInteger.java
+7
-7
InformationObject.java
...com/yeejoin/amos/iec104/tcp/entity/InformationObject.java
+6
-5
Session.java
...a/com/yeejoin/amos/iec104/tcp/server/session/Session.java
+1
-2
No files found.
YeeAmosConnectCommon/src/main/java/com/yeejoin/amos/connect/common/enums/RedisKeyEnum.java
View file @
a40cd118
...
@@ -17,6 +17,10 @@ public enum RedisKeyEnum {
...
@@ -17,6 +17,10 @@ public enum RedisKeyEnum {
return
redisKeyEnum
.
getKey
()
+
"_"
+
bizKey
;
return
redisKeyEnum
.
getKey
()
+
"_"
+
bizKey
;
}
}
public
static
String
buildKey
(
String
bizKey
,
String
serverId
,
RedisKeyEnum
redisKeyEnum
)
{
return
"ForwardingTable"
+
":"
+
serverId
+
":"
+
bizKey
;
}
RedisKeyEnum
(
String
key
,
String
desc
)
{
RedisKeyEnum
(
String
key
,
String
desc
)
{
this
.
key
=
key
;
this
.
key
=
key
;
this
.
desc
=
desc
;
this
.
desc
=
desc
;
...
...
YeeAmosConnectStart/src/main/resources/application-dev.properties
View file @
a40cd118
...
@@ -19,7 +19,7 @@ ribbon.ConnectTimeout = 30000
...
@@ -19,7 +19,7 @@ ribbon.ConnectTimeout = 30000
#DB properties:
#DB properties:
#spring.datasource.url = jdbc:mysql://172.233.0.6:3306/amos_beijing_command_dev?useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
#spring.datasource.url = jdbc:mysql://172.233.0.6:3306/amos_beijing_command_dev?useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
spring.datasource.url
=
jdbc:mysql://172.16.11.33:3306/amos_iec?useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
spring.datasource.url
=
jdbc:mysql://172.16.11.33:3306/amos_iec
_dev
?useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
admin_1234
spring.datasource.password
=
admin_1234
...
@@ -68,10 +68,10 @@ liquibase.enabled: true
...
@@ -68,10 +68,10 @@ liquibase.enabled: true
#redis database index
#redis database index
spring.redis.database
=
5
spring.redis.database
=
5
#redis ip
#redis ip
spring.redis.host
=
172.16.1
1.33
spring.redis.host
=
172.16.1
0.85
spring.redis.port
=
6379
spring.redis.port
=
6379
#redis password (default is empty)
#redis password (default is empty)
spring.redis.password
=
1234560
spring.redis.password
=
amos2019Redis
#max connect number
#max connect number
spring.redis.pool.max-active
=
200
spring.redis.pool.max-active
=
200
# redis max wait time ( -1 is not limit)
# redis max wait time ( -1 is not limit)
...
@@ -79,15 +79,3 @@ spring.redis.pool.max-wait=-1
...
@@ -79,15 +79,3 @@ spring.redis.pool.max-wait=-1
spring.redis.pool.max-idle
=
10
spring.redis.pool.max-idle
=
10
spring.redis.pool.min-idle
=
0
spring.redis.pool.min-idle
=
0
spring.redis.timeout
=
1000
spring.redis.timeout
=
1000
#iec104.debug = false
#iec104.tcp.service.reomteIp=172.233.0.4
#iec104.tcp.service.reomtePort=2404
#iec104.server.Id=1
#iec104.tcp.bind.port=2404
#iec104.client.commonAddress=0000
#iec104.server.start.infomation.address = 1
#iec104.server.consecutive.transmissions.number = 6
#iec104.server.zz.max.transmissions.number = 100
#iec104.server.soe.max.transmissions.number = 10
#
iec104.server.sec.max.transmissions.number
=
10
\ No newline at end of file
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/client/invoke/ApduQueue.java
View file @
a40cd118
...
@@ -102,10 +102,13 @@ public class ApduQueue {
...
@@ -102,10 +102,13 @@ public class ApduQueue {
data
.
setCommonAddress
(
asdu
.
getCommonAddress
());
data
.
setCommonAddress
(
asdu
.
getCommonAddress
());
data
.
setCreatedTime
(
new
Date
());
data
.
setCreatedTime
(
new
Date
());
data
.
setDataType
(
2
);
data
.
setDataType
(
2
);
// data.setSoe(1);
data
.
setInformationAddress
(
informationObjectAddress
);
data
.
setInformationAddress
(
informationObjectAddress
);
IeFloat
shortFloat
=
(
IeFloat
)
informationElement
[
0
][
0
];
IeInteger
shortFloat
=
(
IeInteger
)
informationElement
[
0
][
0
];
IeQuality
ieQuality
=
(
IeQuality
)
informationElement
[
0
][
1
];
IeQuality
ieQuality
=
(
IeQuality
)
informationElement
[
0
][
1
];
data
.
setValue
(
String
.
format
(
"%.2f"
,
shortFloat
.
getValue
()));
data
.
setValue
(
String
.
format
(
"%d"
,
shortFloat
.
getValue
()));
data
.
setQuality
(
ieQuality
.
toJson
().
toString
());
data
.
setQuality
(
ieQuality
.
toJson
().
toString
());
data
.
setIsBlocked
(
ieQuality
.
isBlocked
()
?
0
:
1
);
data
.
setIsBlocked
(
ieQuality
.
isBlocked
()
?
0
:
1
);
data
.
setIsSubstituted
(
ieQuality
.
isSubstituted
()
?
0
:
1
);
data
.
setIsSubstituted
(
ieQuality
.
isSubstituted
()
?
0
:
1
);
...
@@ -117,6 +120,7 @@ public class ApduQueue {
...
@@ -117,6 +120,7 @@ public class ApduQueue {
RecDataQueue
.
getInstance
().
add
(
data
);
RecDataQueue
.
getInstance
().
add
(
data
);
// }
// }
}
}
break
;
case
13
:
case
13
:
InformationObject
[]
floatInformationObjects
=
asdu
.
getInformationObjects
();
InformationObject
[]
floatInformationObjects
=
asdu
.
getInformationObjects
();
numberOfSequenceElements
=
asdu
.
getSequenceLength
();
numberOfSequenceElements
=
asdu
.
getSequenceLength
();
...
@@ -125,14 +129,16 @@ public class ApduQueue {
...
@@ -125,14 +129,16 @@ public class ApduQueue {
InformationElement
[][]
informationElement
=
obj
.
getInformationElements
();
InformationElement
[][]
informationElement
=
obj
.
getInformationElements
();
int
informationObjectAddress
=
obj
.
getInformationObjectAddress
();
int
informationObjectAddress
=
obj
.
getInformationObjectAddress
();
// for (int i = 0; i < numberOfSequenceElements; i++) {
RecData
data
=
new
RecData
(
serverId
);
RecData
data
=
new
RecData
(
serverId
);
data
.
setCommonAddress
(
asdu
.
getCommonAddress
());
data
.
setCommonAddress
(
asdu
.
getCommonAddress
());
data
.
setCreatedTime
(
new
Date
());
data
.
setCreatedTime
(
new
Date
());
data
.
setDataType
(
2
);
data
.
setDataType
(
2
);
// data.setSoe(1);
data
.
setInformationAddress
(
informationObjectAddress
);
data
.
setInformationAddress
(
informationObjectAddress
);
IeShortFloat
shortFloat
=
(
IeShortFloat
)
informationElement
[
0
][
0
];
IeShortFloat
shortFloat
=
(
IeShortFloat
)
informationElement
[
0
][
0
];
IeQuality
ieQuality
=
(
IeQuality
)
informationElement
[
0
][
1
];
IeQuality
ieQuality
=
(
IeQuality
)
informationElement
[
0
][
1
];
data
.
setValue
(
String
.
format
(
"%.2f"
,
shortFloat
.
getValue
()));
data
.
setValue
(
String
.
format
(
"%.2f"
,
shortFloat
.
getValue
()));
data
.
setQuality
(
ieQuality
.
toJson
().
toString
());
data
.
setQuality
(
ieQuality
.
toJson
().
toString
());
data
.
setIsBlocked
(
ieQuality
.
isBlocked
()
?
0
:
1
);
data
.
setIsBlocked
(
ieQuality
.
isBlocked
()
?
0
:
1
);
...
@@ -159,9 +165,12 @@ public class ApduQueue {
...
@@ -159,9 +165,12 @@ public class ApduQueue {
data
.
setCommonAddress
(
asdu
.
getCommonAddress
());
data
.
setCommonAddress
(
asdu
.
getCommonAddress
());
data
.
setCreatedTime
(
new
Date
());
data
.
setCreatedTime
(
new
Date
());
data
.
setDataType
(
2
);
data
.
setDataType
(
2
);
// data.setSoe(1);
data
.
setInformationAddress
(
informationObjectAddress
);
data
.
setInformationAddress
(
informationObjectAddress
);
IeShortFloat
shortFloat
=
(
IeShortFloat
)
informationElement
[
0
][
0
];
data
.
setValue
(
String
.
format
(
"%.2f"
,
shortFloat
.
getValue
()));
IeInteger
shortFloat
=
(
IeInteger
)
informationElement
[
0
][
0
];
data
.
setValue
(
String
.
format
(
"%d"
,
shortFloat
.
getValue
()));
informationObjectAddress
++;
informationObjectAddress
++;
RecDataQueue
.
getInstance
().
add
(
data
);
RecDataQueue
.
getInstance
().
add
(
data
);
...
...
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/client/invoke/GeneralDataQueue.java
View file @
a40cd118
...
@@ -76,7 +76,7 @@ public class GeneralDataQueue {
...
@@ -76,7 +76,7 @@ public class GeneralDataQueue {
Runnable
task_runnable
=
new
Runnable
()
{
Runnable
task_runnable
=
new
Runnable
()
{
private
boolean
alarmParamIsChange
(
AlarmParam
alarmParam
)
{
private
boolean
alarmParamIsChange
(
AlarmParam
alarmParam
)
{
String
redisKey
=
RedisKeyEnum
.
buildKey
(
alarmParam
.
getPointCode
(),
RedisKeyEnum
.
K001
);
String
redisKey
=
RedisKeyEnum
.
buildKey
(
alarmParam
.
getPointCode
(),
alarmParam
.
getServiceId
(),
RedisKeyEnum
.
K001
);
String
data
=
redisTemplate
.
opsForValue
().
get
(
redisKey
);
String
data
=
redisTemplate
.
opsForValue
().
get
(
redisKey
);
if
(
StringUtils
.
isEmpty
(
data
))
{
if
(
StringUtils
.
isEmpty
(
data
))
{
redisTemplate
.
opsForValue
().
set
(
redisKey
,
JSONObject
.
toJSONString
(
alarmParam
));
redisTemplate
.
opsForValue
().
set
(
redisKey
,
JSONObject
.
toJSONString
(
alarmParam
));
...
...
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/client/invoke/RecDataQueue.java
View file @
a40cd118
...
@@ -6,6 +6,7 @@ import java.util.concurrent.LinkedBlockingQueue;
...
@@ -6,6 +6,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ScheduledExecutorService
;
import
com.yeejoin.amos.connect.dao.entity.PointConfigVo
;
import
com.yeejoin.amos.connect.dao.entity.PointConfigVo
;
import
com.yeejoin.amos.iec104.tcp.utils.ChangeUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
com.yeejoin.amos.iec104.business.constants.IEC104Constant
;
import
com.yeejoin.amos.iec104.business.constants.IEC104Constant
;
...
@@ -112,6 +113,8 @@ public class RecDataQueue {
...
@@ -112,6 +113,8 @@ public class RecDataQueue {
alarm
.
setServiceId
(
data
.
getServerId
());
alarm
.
setServiceId
(
data
.
getServerId
());
alarm
.
setIsInvalid
(
data
.
getIsInvalid
());
alarm
.
setIsInvalid
(
data
.
getIsInvalid
());
PointConfigVo
vo
=
pointConfigService
.
findByServicesIdAndInfoAddress
(
data
.
getServerId
(),
data
.
getInformationAddress
());
PointConfigVo
vo
=
pointConfigService
.
findByServicesIdAndInfoAddress
(
data
.
getServerId
(),
data
.
getInformationAddress
());
Logger
.
getLogger
(
this
.
getClass
()).
debug
(
"给业务发送数据: "
+
vo
.
toString
());
// PointConfigVo vo = pointConfigService.findByServicesIdAndInfoAddress(data.getServerId(), informationAddress, informationType);
alarm
.
setPointCode
(
vo
.
getPointCode
());
alarm
.
setPointCode
(
vo
.
getPointCode
());
alarm
.
setSoe
(
data
.
getSoe
());
alarm
.
setSoe
(
data
.
getSoe
());
try
{
try
{
...
...
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/entity/IeCP56Time2a.java
View file @
a40cd118
...
@@ -17,7 +17,7 @@ public class IeCP56Time2a extends InformationElement{
...
@@ -17,7 +17,7 @@ public class IeCP56Time2a extends InformationElement{
// protected byte[] date = { (byte) 0xAD, (byte)0x39 , (byte)0x1C, (byte)0x10, (byte)0x7A , (byte)0x0B, (byte)0x05};
// protected byte[] date = { (byte) 0xAD, (byte)0x39 , (byte)0x1C, (byte)0x10, (byte)0x7A , (byte)0x0B, (byte)0x05};
public
IeCP56Time2a
(
ByteBuf
is
)
throws
IOException
{
public
IeCP56Time2a
(
ByteBuf
is
)
throws
IOException
{
if
(
is
.
readableBytes
()
>
7
)
{
if
(
is
.
readableBytes
()
>
=
7
)
{
is
.
readBytes
(
date
);
is
.
readBytes
(
date
);
}
}
}
}
...
...
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/entity/Ie
Float
.java
→
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/entity/Ie
Integer
.java
View file @
a40cd118
...
@@ -4,22 +4,22 @@ import io.netty.buffer.ByteBuf;
...
@@ -4,22 +4,22 @@ import io.netty.buffer.ByteBuf;
import
java.io.IOException
;
import
java.io.IOException
;
public
class
Ie
Float
extends
InformationElement
{
public
class
Ie
Integer
extends
InformationElement
{
private
final
floa
t
value
;
private
final
in
t
value
;
public
Ie
Float
(
floa
t
value
)
{
public
Ie
Integer
(
in
t
value
)
{
this
.
value
=
value
;
this
.
value
=
value
;
}
}
public
Ie
Float
(
ByteBuf
is
)
throws
IOException
{
public
Ie
Integer
(
ByteBuf
is
)
throws
IOException
{
value
=
Float
.
intBitsToFloat
((
is
.
readByte
()
&
0xff
)
|
((
is
.
readByte
()
&
0xff
)
<<
8
)
);
value
=
(
is
.
readByte
()
&
0xff
)
|
((
is
.
readByte
()
&
0xff
)
<<
8
);
}
}
@Override
@Override
public
int
encode
(
byte
[]
buffer
,
int
i
)
{
public
int
encode
(
byte
[]
buffer
,
int
i
)
{
int
tempVal
=
Float
.
floatToIntBits
(
value
)
;
int
tempVal
=
value
;
buffer
[
i
++]
=
(
byte
)
tempVal
;
buffer
[
i
++]
=
(
byte
)
tempVal
;
buffer
[
i
]
=
(
byte
)
(
tempVal
>>
8
);
buffer
[
i
]
=
(
byte
)
(
tempVal
>>
8
);
...
@@ -32,6 +32,6 @@ public class IeFloat extends InformationElement {
...
@@ -32,6 +32,6 @@ public class IeFloat extends InformationElement {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"
短浮点
数值: "
+
value
;
return
"
归一化
数值: "
+
value
;
}
}
}
}
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/entity/InformationObject.java
View file @
a40cd118
...
@@ -44,10 +44,11 @@ public class InformationObject {
...
@@ -44,10 +44,11 @@ public class InformationObject {
case
9
:
case
9
:
informationElements
=
new
InformationElement
[
numberOfSequenceElements
][
2
];
informationElements
=
new
InformationElement
[
numberOfSequenceElements
][
2
];
for
(
int
i
=
0
;
i
<
numberOfSequenceElements
;
i
++)
{
for
(
int
i
=
0
;
i
<
numberOfSequenceElements
;
i
++)
{
informationElements
[
i
][
0
]
=
new
Ie
Float
(
is
);
informationElements
[
i
][
0
]
=
new
Ie
Integer
(
is
);
informationElements
[
i
][
1
]
=
new
IeQuality
(
is
);
informationElements
[
i
][
1
]
=
new
IeQuality
(
is
);
log
.
debug
(
"9 浮点型遥测1: "
+
i
+
"--->"
+
informationElements
[
i
][
0
].
toString
());
log
.
debug
(
"9 地址: "
+
i
+
"--->"
+
this
.
informationObjectAddress
);
log
.
debug
(
"9 浮点型遥测2: "
+
i
+
"--->"
+
informationElements
[
i
][
1
].
toString
());
log
.
debug
(
"9 归一化值: "
+
i
+
"--->"
+
informationElements
[
i
][
0
].
toString
());
log
.
debug
(
"9 品质: "
+
i
+
"--->"
+
informationElements
[
i
][
1
].
toString
());
}
}
break
;
break
;
// 13 浮点型遥测
// 13 浮点型遥测
...
@@ -64,8 +65,8 @@ public class InformationObject {
...
@@ -64,8 +65,8 @@ public class InformationObject {
case
21
:
case
21
:
informationElements
=
new
InformationElement
[
numberOfSequenceElements
][
1
];
informationElements
=
new
InformationElement
[
numberOfSequenceElements
][
1
];
for
(
int
i
=
0
;
i
<
numberOfSequenceElements
;
i
++)
{
for
(
int
i
=
0
;
i
<
numberOfSequenceElements
;
i
++)
{
informationElements
[
i
][
0
]
=
new
Ie
Float
(
is
);
informationElements
[
i
][
0
]
=
new
Ie
Integer
(
is
);
log
.
debug
(
"21
浮点型遥测,
不带品质描述词的规一化值: "
+
i
+
"--->"
+
informationElements
[
i
][
0
].
toString
());
log
.
debug
(
"21 不带品质描述词的规一化值: "
+
i
+
"--->"
+
informationElements
[
i
][
0
].
toString
());
}
}
break
;
break
;
// 30 带 CP56Time2a 时标的单点信息
// 30 带 CP56Time2a 时标的单点信息
...
...
YeeAmosIec104IntfServer/src/main/java/com/yeejoin/amos/iec104/tcp/server/session/Session.java
View file @
a40cd118
...
@@ -42,8 +42,7 @@ public class Session {
...
@@ -42,8 +42,7 @@ public class Session {
long
timeRecorder
=
0
;
long
timeRecorder
=
0
;
private
long
recordTime
=
0
;
private
long
recordTime
=
0
;
private
ReentrantLock
serialLock
=
new
ReentrantLock
();
private
ReentrantLock
serialLock
=
new
ReentrantLock
();
// private Semaphore secruitingSemaphore = new Semaphore(1);
// boolean startCommunication = false;
boolean
stopCommunication
=
false
;
boolean
stopCommunication
=
false
;
boolean
startRecruiting
=
false
;
boolean
startRecruiting
=
false
;
CountDownLatch
latch
;
CountDownLatch
latch
;
...
...
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