| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int activateDevice(Long deviceId) { |
| | | public int activateDevice(String deviceId) { |
| | | // 1. 根据deviceId查询设备 |
| | | SysVisitorMachine device = visitorMachineMapper.selectById(deviceId); |
| | | SysVisitorMachine device = visitorMachineMapper.checkDeviceIdUnique(deviceId, null); |
| | | if (device == null || device.getDelFlag().equals("1")) { |
| | | throw new ServiceException("设备不存在,请先添加设备"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deactivateDevice(Long deviceId) { |
| | | public int deactivateDevice(String deviceId) { |
| | | // 1. 根据deviceId查询设备 |
| | | SysVisitorMachine device = visitorMachineMapper.selectById(deviceId); |
| | | SysVisitorMachine device = visitorMachineMapper.checkDeviceIdUnique(deviceId, null); |
| | | if (device == null || device.getDelFlag().equals("1")) { |
| | | throw new ServiceException("设备不存在"); |
| | | } |
| | |
| | | |
| | | // 3. 更新状态为离线/未激活 |
| | | SysVisitorMachine update = new SysVisitorMachine(); |
| | | update.setMachineId(deviceId); |
| | | update.setMachineId(device.getMachineId()); |
| | | update.setOnlineStatus("OFFLINE"); // 或 "UNACTIVATED" |
| | | update.setUpdateTime(new Date()); |
| | | |