Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 07efc26d
authored
May 28, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
同步围栏到kafka
1 parent
d2e642be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
pom.xml
src/main/java/cn/com/glsx/admin/modules/component/EFenceComponent.java
src/test/java/cn/com/glsx/test/AdminApplicationTests.java
pom.xml
View file @
07efc26
...
...
@@ -61,7 +61,7 @@
<dependency>
<groupId>
com.google.protobuf
</groupId>
<artifactId>
protobuf-java
</artifactId>
<version>
2.
6.1
</version>
<version>
2.
4.0a
</version>
</dependency>
<dependency>
...
...
src/main/java/cn/com/glsx/admin/modules/component/EFenceComponent.java
View file @
07efc26
...
...
@@ -114,7 +114,7 @@ public class EFenceComponent {
*/
private
void
sendKafkaMessageOptFenceReq
(
ElectricFence
electricFence
,
int
optionStatus
)
{
OptFenceReq
optFenceReq
=
buildOptFenceReq
(
electricFence
,
optionStatus
);
String
topic
=
PropertiesUtils
.
getProperty
(
"mq.kafka.
edun
.eFenceTopic"
);
String
topic
=
PropertiesUtils
.
getProperty
(
"mq.kafka.
neshield
.eFenceTopic"
);
String
electricFenceName
=
electricFence
.
getFenceName
();
byte
[]
sendMessage
=
optFenceReq
.
toByteArray
();
KeyedMessage
<
byte
[],
byte
[]>
message
=
new
KeyedMessage
<>(
topic
,
electricFenceName
.
getBytes
(),
sendMessage
);
...
...
@@ -263,7 +263,7 @@ public class EFenceComponent {
*/
private
boolean
power
()
{
String
swith
=
PropertiesUtils
.
getProperty
(
"electricfence.notify.swith"
);
if
(
swith
.
equalsIgnoreCase
(
"on"
))
{
if
(
"on"
.
equalsIgnoreCase
(
swith
))
{
return
true
;
}
log
.
info
(
"围栏配置推送状态已关闭"
);
...
...
src/test/java/cn/com/glsx/test/AdminApplicationTests.java
View file @
07efc26
package
cn
.
com
.
glsx
.
test
;
import
cn.com.glsx.Application
;
import
cn.com.glsx.admin.modules.component.EFenceComponent
;
import
cn.com.glsx.admin.modules.entity.ElectricFence
;
import
cn.com.glsx.admin.modules.mapper.ElectricFenceMapper
;
import
cn.com.glsx.admin.modules.model.ElectricFenceSnsModel
;
import
cn.com.glsx.admin.modules.model.param.ElectricFenceBO
;
import
cn.com.glsx.admin.modules.model.param.TrialDriveShopBO
;
...
...
@@ -39,6 +42,10 @@ public class AdminApplicationTests {
@Autowired
private
UserService
userService
;
@Autowired
private
EFenceComponent
eFenceComponent
;
@Autowired
private
ElectricFenceMapper
electricFenceMapper
;
// Should rename to @BeforeTestMethod
// e.g. Creating an similar object and share for all @Test
...
...
@@ -118,6 +125,12 @@ public class AdminApplicationTests {
}
@Test
public
void
syncAddFence
()
throws
Exception
{
ElectricFence
electricFence
=
electricFenceMapper
.
selectById
(
1024L
);
eFenceComponent
.
addElectricFence
(
electricFence
);
}
@Test
public
void
testAddShop
()
throws
Exception
{
TrialDriveShopBO
shopBO
=
new
TrialDriveShopBO
();
shopBO
.
setShopName
(
"特约店测试-liuyf"
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment