| | |
| | | |
| | | import com.zy.asrs.entity.DeviceDataLog; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.SlaveType; |
| | | |
| | | import java.util.UUID; |
| | | |
| | |
| | | String deviceNo = deviceDataLog == null || deviceDataLog.getDeviceNo() == null |
| | | ? "unknown" |
| | | : String.valueOf(deviceDataLog.getDeviceNo()); |
| | | String stationPart = buildStationPart(deviceDataLog, type); |
| | | long millis = deviceDataLog != null && deviceDataLog.getCreateTime() != null |
| | | ? deviceDataLog.getCreateTime().getTime() |
| | | : System.currentTimeMillis(); |
| | | String uuid = UUID.randomUUID().toString().replace("-", ""); |
| | | return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + ":" + millis + ":" + uuid; |
| | | return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + stationPart + ":" + millis + ":" + uuid; |
| | | } |
| | | |
| | | private static String buildStationPart(DeviceDataLog deviceDataLog, String type) { |
| | | if (!String.valueOf(SlaveType.Devp).equals(type)) { |
| | | return ""; |
| | | } |
| | | Integer stationId = deviceDataLog == null ? null : deviceDataLog.getStationId(); |
| | | return stationId == null ? ":station:unknown" : ":station:" + stationId; |
| | | } |
| | | } |