|
|
|
@ -5,6 +5,7 @@ import com.shxy.xymanager_service.service.NewCacheService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.eclipse.paho.client.mqttv3.MqttClient;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
@ -20,6 +21,9 @@ import static com.shxy.xymanager_common.constant.Constants.*;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MqttSubscriberService {
|
|
|
|
|
|
|
|
|
|
@Value("${mqtt.enable:false}")
|
|
|
|
|
private boolean enable;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private MqttClient mqttClient;
|
|
|
|
|
@Resource
|
|
|
|
@ -31,6 +35,9 @@ public class MqttSubscriberService {
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
|
public void init() throws Exception {
|
|
|
|
|
if (!enable) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<String> modelList = new ArrayList<>();
|
|
|
|
|
Map<Integer, Terminals> terminalMap = newCacheService.getTerminalMap();
|
|
|
|
|
Iterator<Integer> it = terminalMap.keySet().iterator();
|
|
|
|
|