| | |
| | | import com.zy.core.network.ZyRgvConnectDriver; |
| | | import com.zy.core.network.entity.ZyRgvStatusEntity; |
| | | import com.zy.core.thread.RgvThread; |
| | | import com.zy.core.utils.DeviceLogRedisKeyBuilder; |
| | | import com.zy.core.task.DeviceAsyncLogPublisher; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | private ZyRgvConnectDriver zyRgvConnectDriver; |
| | | private RgvProtocol rgvProtocol; |
| | | private int deviceLogCollectTime = 200; |
| | | private final DeviceAsyncLogPublisher deviceAsyncLogPublisher; |
| | | |
| | | public ZyRgvThread(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | | this.redisUtil = redisUtil; |
| | | this.deviceAsyncLogPublisher = SpringUtils.getBean(DeviceAsyncLogPublisher.class); |
| | | } |
| | | |
| | | @Override |
| | |
| | | deviceDataLog.setType(String.valueOf(SlaveType.Rgv)); |
| | | deviceDataLog.setDeviceNo(rgvProtocol.getRgvNo()); |
| | | deviceDataLog.setCreateTime(new Date()); |
| | | redisUtil.set(DeviceLogRedisKeyBuilder.build(deviceDataLog), deviceDataLog, 60 * 60 * 24); |
| | | deviceAsyncLogPublisher.publishLatest(deviceDataLog); |
| | | rgvProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | | |