| | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.entity.SysConfig; |
| | | 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; |
| | | import com.ruoyi.system.mapper.SysConfigMapper; |
| | | import com.ruoyi.utils.mqtt.MqttConsumer; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private ArdSyCarRtuMapper ardSyCarRtuMapper; |
| | | @Resource |
| | | private SysConfigMapper configMapper; |
| | | |
| | | @Override |
| | | public List<ArdSyCarRtu> allCarTopic() { |
| | | public String[] allCarTopic() { |
| | | List<ArdSyCarRtu> carRtus = ardSyCarRtuMapper.selectList(null); |
| | | List<String> list = new ArrayList<>(); |
| | | for (int i = 0; i < carRtus.size(); i++) { |
| | | list.add(carRtus.get(i).getTopicPublish()); |
| | | } |
| | | return list.toArray(new String[list.size()]); |
| | | } |
| | | |
| | | @Override |
| | | public List<ArdSyCarRtu> allCarTopicList() { |
| | | return ardSyCarRtuMapper.selectList(null); |
| | | } |
| | | |
| | |
| | | return "已发送开锁指令"; |
| | | } |
| | | |
| | | @Override |
| | | public ArdSyCarRtu subscribeByCarId(String subscribe) { |
| | | QueryWrapper<ArdSyCarRtu> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("topic_subscribe",subscribe); |
| | | return ardSyCarRtuMapper.selectOne(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public String url(String key) { |
| | | // QueryWrapper<SysConfig> queryWrapper = new QueryWrapper<>(); |
| | | // queryWrapper.eq("config_key",key); |
| | | // SysConfig sysConfig = configMapper.selectOne(queryWrapper); |
| | | SysConfig sysConfig = configMapper.checkConfigKeyUnique(key); |
| | | if(sysConfig!=null){ |
| | | return sysConfig.getConfigValue(); |
| | | }else { |
| | | return "配置表无地址数据"; |
| | | } |
| | | } |
| | | |
| | | } |