Commit 403cf6dd authored by KeYong's avatar KeYong

更新

parent b4d317d2
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.action;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.model.ContingencyEvent;
......@@ -15,12 +16,13 @@ public class ContingencyLogListener implements ApplicationListener<ContingencyEv
IRuleRunningSnapshotService ruleRunningSnapshotService;
// @Autowired
// IEquipmentHandlerService IEquipmentHandlerService;
// @Lazy
// IEquipmentHandlerService equipmentHandlerService;
@Override
public void onApplicationEvent(ContingencyEvent event) {
ruleRunningSnapshotService.reacordPlan(event.getTopic(), event.getMsgType(), event.getMsgBody(), event.getContingency());
// IEquipmentHandlerService.subscribeTopic();
// equipmentHandlerService.subscribeTopic();
}
}
......@@ -44,7 +44,7 @@ public class SafetyController extends BaseController{
@PostMapping(value = "/save/curCompany")
public CommonResponse saveCurCompany(@RequestBody ReginParams reginParams) {
this.saveSelectedOrgInfo(reginParams);
equipmentHandlerService.subscribeTopic(reginParams);
equipmentHandlerService.subscribeTopic();
return CommonResponseUtil.success();
}
......
......@@ -183,31 +183,31 @@ public class HandlerMqttMessageImpl implements IEquipmentHandlerService {
}
@Override
public void subscribeTopic(ReginParams reginParams) {
// 若登录系统则订阅装备数据
webMqttSubscribe.adapter.removeTopic(defaultTopic);
String orgCode = reginParams.getCompany().getOrgCode();
String topic = String.format("%s.%s%s", serverName, "equipment", "/#");
String[] strs = webMqttSubscribe.adapter.getTopic();
List<String> list = Stream.of(strs).collect(Collectors.toList());
if(list.size() > 0) {
list.forEach(x -> {
if(!(x.equals(topic))) {
webMqttSubscribe.adapter.addTopic(topic);
}
});
} else {
webMqttSubscribe.adapter.addTopic(topic);
}
}
// @Override
// public void subscribeTopic(ReginParams reginParams) {
// // 若登录系统则订阅装备数据
// webMqttSubscribe.adapter.removeTopic(defaultTopic);
// String orgCode = reginParams.getCompany().getOrgCode();
// String topic = String.format("%s.%s%s", serverName, "equipment", "/#");
// String[] strs = webMqttSubscribe.adapter.getTopic();
// List<String> list = Stream.of(strs).collect(Collectors.toList());
// if(list.size() > 0) {
// list.forEach(x -> {
// if(!(x.equals(topic))) {
// webMqttSubscribe.adapter.addTopic(topic);
// }
// });
// } else {
// webMqttSubscribe.adapter.addTopic(topic);
// }
//
// }
@Override
public void subscribeTopic() {
// 若登录系统则订阅装备数据
webMqttSubscribe.adapter.removeTopic(defaultTopic);
String topic = String.format("%s.%s,%s", serverName, "equipment", "/#");
String topic = String.format("%s.%s%s", serverName, "equipment", "/#");
String[] strs = webMqttSubscribe.adapter.getTopic();
List<String> list = Stream.of(strs).collect(Collectors.toList());
if(list.size() > 0) {
......
......@@ -13,7 +13,7 @@ import com.yeejoin.amos.fas.business.vo.ReginParams;
public interface IEquipmentHandlerService {
void handlerMqttMessage(String topic, String message);
void subscribeTopic(ReginParams reginParams);
// void subscribeTopic(ReginParams reginParams);
void subscribeTopic();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment