| | |
| | | } |
| | | |
| | | if (System.currentTimeMillis() - deviceDataLogTime > 1000 * 1) { |
| | | try { |
| | | //采集时间超过5s,保存一次数据记录 |
| | | //保存数据记录 |
| | | if (result != null && result.IsSuccess && result.Content != null) { |
| | | DeviceDataLogService deviceDataLogService = SpringUtils.getBean(DeviceDataLogService.class); |
| | | DeviceDataLog deviceDataLog = new DeviceDataLog(); |
| | | deviceDataLog.setOriginData(Base64.getEncoder().encodeToString(result.Content)); |
| | |
| | | deviceDataLog.setDeviceNo(slave.getId()); |
| | | deviceDataLog.setCreateTime(new Date()); |
| | | deviceDataLogService.insert(deviceDataLog); |
| | | |
| | | } |
| | | } finally { |
| | | //更新采集时间 |
| | | deviceDataLogTime = System.currentTimeMillis(); |
| | | } |
| | | } |
| | | |
| | | if (result.IsSuccess && result2.IsSuccess && result3.IsSuccess && result4.IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |