| | |
| | | liftProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | | |
| | | //将提升机状态保存至数据库 |
| | | BasLiftService basLiftService = SpringUtils.getBean(BasLiftService.class); |
| | | BasLift basLift = basLiftService.getOne(new LambdaQueryWrapper<BasLift>() |
| | | .eq(BasLift::getLiftNo, device.getDeviceNo()) |
| | | .eq(BasLift::getHostId, device.getHostId())); |
| | | if (basLift == null) { |
| | | basLift = new BasLift(); |
| | | //提升机号 |
| | | basLift.setLiftNo(Integer.valueOf(device.getDeviceNo())); |
| | | basLift.setStatus(1); |
| | | basLift.setDeleted(0); |
| | | basLift.setHostId(device.getHostId()); |
| | | basLift.setDeviceId(device.getId()); |
| | | basLiftService.save(basLift); |
| | | } |
| | | //任务号 |
| | | basLift.setTaskNo(liftProtocol.getTaskNo().intValue()); |
| | | //修改时间 |
| | | basLift.setUpdateTime(new Date()); |
| | | //设备状态 |
| | | basLift.setProtocol(JSON.toJSONString(liftProtocol)); |
| | | if (basLiftService.updateById(basLift)) { |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), device.getDeviceNo())); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】读取提升机状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort())); |
| | | } |