‘liusuyi’
2023-11-20 2dad62bb75aa57948f9b5b2d4bc88625fa7def0f
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
@@ -1,5 +1,6 @@
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;
@@ -259,7 +260,7 @@
                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 = "";
@@ -312,10 +313,10 @@
            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();
@@ -329,9 +330,11 @@
        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);
        }