Fixed send command failed
This commit is contained in:
parent
539efbbf18
commit
552192772f
|
@ -4,9 +4,10 @@ import cn.hutool.core.map.MapUtil;
|
||||||
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
import com.isu.gaswellwatch.dto.modbus.ModbusCommandDto;
|
||||||
import com.isu.gaswellwatch.entity.Response;
|
import com.isu.gaswellwatch.entity.Response;
|
||||||
import com.isu.gaswellwatch.modbus.CommandService;
|
import com.isu.gaswellwatch.modbus.CommandService;
|
||||||
import com.isu.gaswellwatch.service.DeviceOptLogService;
|
|
||||||
import com.isu.gaswellwatch.modbus.data.PersistenceHandler;
|
import com.isu.gaswellwatch.modbus.data.PersistenceHandler;
|
||||||
import com.isu.gaswellwatch.modbus.data.Redis2DBPersistenceService;
|
import com.isu.gaswellwatch.modbus.data.Redis2DBPersistenceService;
|
||||||
|
import com.isu.gaswellwatch.service.DeviceOptLogService;
|
||||||
|
import com.isu.gaswellwatch.utils.HexUtil;
|
||||||
import com.isu.gaswellwatch.vo.command.Command;
|
import com.isu.gaswellwatch.vo.command.Command;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
@ -53,8 +54,9 @@ public class CommandServiceImpl implements CommandService {
|
||||||
flag = 1;
|
flag = 1;
|
||||||
} else if (Command.KNPCV1_TURN_OFF_THE_WELL.equals(command.getCode())) {
|
} else if (Command.KNPCV1_TURN_OFF_THE_WELL.equals(command.getCode())) {
|
||||||
flag = 0;
|
flag = 0;
|
||||||
};
|
}
|
||||||
deviceOptLogService.saveGasWellOptLog(flag,command.getDeviceId());
|
;
|
||||||
|
this.deviceOptLogService.saveGasWellOptLog(flag, command.getDeviceId());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +98,10 @@ public class CommandServiceImpl implements CommandService {
|
||||||
return Response.failed("Modbus command return message length failed");
|
return Response.failed("Modbus command return message length failed");
|
||||||
}
|
}
|
||||||
identifier = MapUtil.getStr(deviceInfoMap, "gateway_sn");
|
identifier = MapUtil.getStr(deviceInfoMap, "gateway_sn");
|
||||||
|
if (StringUtils.isBlank(identifier)) {
|
||||||
|
return Response.failed("Device gateway SN is empty");
|
||||||
|
}
|
||||||
|
identifier = HexUtil.bytesToHexString(identifier.getBytes());
|
||||||
item.setKey(StringUtils.joinWith("/", identifier,
|
item.setKey(StringUtils.joinWith("/", identifier,
|
||||||
MapUtil.getStr(deviceInfoMap, "deviceId"),
|
MapUtil.getStr(deviceInfoMap, "deviceId"),
|
||||||
MapUtil.getStr(deviceInfoMap, "commandId"),
|
MapUtil.getStr(deviceInfoMap, "commandId"),
|
||||||
|
|
Loading…
Reference in New Issue