| | |
| | | package com.ruoyi.sy.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | String currents = ardSyCarLock.getCurrents(); |
| | | Double currentInfo = ardSyCarLock.getCurrentInfo(); |
| | | //电流值为4.0是关锁状态 |
| | | if(currentInfo.equals(4.00)){ |
| | | if(currentInfo.equals(4.00) || currentInfo.equals(4)){ |
| | | lockCloseNum += 1; |
| | | }else { |
| | | String key = ""; |
| | |
| | | AjaxResult.error(0,"该锁处于解封状态,远程无法操控,请先执行施封操作!"); |
| | | } |
| | | String key = ""; |
| | | Double currentInfo = ardSyCarLock.getCurrentInfo(); |
| | | if(currentInfo.equals("C01")){ |
| | | String currents = ardSyCarLock.getCurrents(); |
| | | if(currents.equals("C01")){ |
| | | key = "D03"; |
| | | }else if(currentInfo.equals("C02")){ |
| | | }else if(currents.equals("C02")){ |
| | | key = "D04"; |
| | | } |
| | | Number lockState = (Number) lockTypeParam.getNum(); |
| | |
| | | Map<String,Object> map = new HashMap(); |
| | | map.put(key, lockState);//范围是0.01到99.99 |
| | | map.put("res", String.valueOf(System.currentTimeMillis())); |
| | | String mapString = JSON.toJSONString(map); |
| | | System.out.println(mapString); |
| | | MqttOnce mqttOnce = new MqttOnce(); |
| | | try { |
| | | return AjaxResult.success(mqttOnce.publishCar("carId",ardSyCarRtu.getTopicPublish(),String.valueOf(new com.alibaba.fastjson2.JSONObject(map)),"开关锁指令"+lockState)); |
| | | return AjaxResult.success(mqttOnce.publishCar("carId",ardSyCarRtu.getTopicPublish(), mapString,"开关锁指令"+lockTypeParam.getNum())); |
| | | } catch (MqttException e) { |
| | | log.debug("开关锁指令发送失败"+e); |
| | | } |