| | |
| | | package com.ruoyi.utils.mqtt; |
| | | |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.sy.domain.ArdSyCarRtu; |
| | | import com.ruoyi.sy.mapper.ArdSyCarRtuMapper; |
| | | import com.ruoyi.sy.service.ArdSyCarRtuService; |
| | |
| | | @Autowired |
| | | private ArdSyCarRtuService ardSyCarRtuService; |
| | | |
| | | @Autowired |
| | | private ISysConfigService sysConfigService; |
| | | |
| | | // @PostConstruct |
| | | @PostConstruct |
| | | public void init() { |
| | | List<ArdSyCarRtu> rtus = ardSyCarRtuService.allCarTopicList(); |
| | | for (int i = 0; i < rtus.size(); i++) { |
| | |
| | | } |
| | | |
| | | public MqttClient getMqttClient(String carId) throws MqttException { |
| | | ArdSyCarRtuService carRtuService = SpringUtils.getBean(ArdSyCarRtuService.class); |
| | | //获取电磁锁地址 |
| | | String mqttUrl = sysConfigService.selectConfigByKey("ElectromagneticLockUrl"); |
| | | String mqttUrl = carRtuService.url("ElectromagneticLockUrl"); |
| | | MqttClient client = new MqttClient(mqttUrl,carId); |
| | | //log.debug("--创建"+carId+"号车辆电子锁mqtt客户端"); |
| | | return client; |