Commit 07efc26d by 刘宇峰

同步围栏到kafka

1 parent d2e642be
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>2.6.1</version> <version>2.4.0a</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -114,7 +114,7 @@ public class EFenceComponent { ...@@ -114,7 +114,7 @@ public class EFenceComponent {
*/ */
private void sendKafkaMessageOptFenceReq(ElectricFence electricFence, int optionStatus) { private void sendKafkaMessageOptFenceReq(ElectricFence electricFence, int optionStatus) {
OptFenceReq optFenceReq = buildOptFenceReq(electricFence, 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(); String electricFenceName = electricFence.getFenceName();
byte[] sendMessage = optFenceReq.toByteArray(); byte[] sendMessage = optFenceReq.toByteArray();
KeyedMessage<byte[], byte[]> message = new KeyedMessage<>(topic, electricFenceName.getBytes(), sendMessage); KeyedMessage<byte[], byte[]> message = new KeyedMessage<>(topic, electricFenceName.getBytes(), sendMessage);
...@@ -263,7 +263,7 @@ public class EFenceComponent { ...@@ -263,7 +263,7 @@ public class EFenceComponent {
*/ */
private boolean power() { private boolean power() {
String swith = PropertiesUtils.getProperty("electricfence.notify.swith"); String swith = PropertiesUtils.getProperty("electricfence.notify.swith");
if (swith.equalsIgnoreCase("on")) { if ("on".equalsIgnoreCase(swith)) {
return true; return true;
} }
log.info("围栏配置推送状态已关闭"); log.info("围栏配置推送状态已关闭");
......
package cn.com.glsx.test; package cn.com.glsx.test;
import cn.com.glsx.Application; 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.ElectricFenceSnsModel;
import cn.com.glsx.admin.modules.model.param.ElectricFenceBO; import cn.com.glsx.admin.modules.model.param.ElectricFenceBO;
import cn.com.glsx.admin.modules.model.param.TrialDriveShopBO; import cn.com.glsx.admin.modules.model.param.TrialDriveShopBO;
...@@ -39,6 +42,10 @@ public class AdminApplicationTests { ...@@ -39,6 +42,10 @@ public class AdminApplicationTests {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired
private EFenceComponent eFenceComponent;
@Autowired
private ElectricFenceMapper electricFenceMapper;
// Should rename to @BeforeTestMethod // Should rename to @BeforeTestMethod
// e.g. Creating an similar object and share for all @Test // e.g. Creating an similar object and share for all @Test
...@@ -118,6 +125,12 @@ public class AdminApplicationTests { ...@@ -118,6 +125,12 @@ public class AdminApplicationTests {
} }
@Test @Test
public void syncAddFence() throws Exception {
ElectricFence electricFence = electricFenceMapper.selectById(1024L);
eFenceComponent.addElectricFence(electricFence);
}
@Test
public void testAddShop() throws Exception { public void testAddShop() throws Exception {
TrialDriveShopBO shopBO = new TrialDriveShopBO(); TrialDriveShopBO shopBO = new TrialDriveShopBO();
shopBO.setShopName("特约店测试-liuyf"); shopBO.setShopName("特约店测试-liuyf");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!