Refactoring
This commit is contained in:
parent
5338d8e094
commit
c24db73a37
@ -42,9 +42,9 @@ public class SessionInfoCreator {
|
||||
if (!"null".equals(msg.getDeviceInfo().getAdditionalInfo())) {
|
||||
try {
|
||||
JsonNode infoNode = context.getMapper().readTree(msg.getDeviceInfo().getAdditionalInfo());
|
||||
if (infoNode.get("gateway").asBoolean(false)) {
|
||||
if (infoNode.get("gateway").asBoolean()) {
|
||||
boolean activityTimeFromGatewayDevice = false;
|
||||
if (infoNode.get("activityTimeFromGatewayDevice") != null) {
|
||||
if (infoNode.has("activityTimeFromGatewayDevice")) {
|
||||
activityTimeFromGatewayDevice = infoNode.get("activityTimeFromGatewayDevice").asBoolean();
|
||||
}
|
||||
builder.setActivityTimeFromGatewayDevice(activityTimeFromGatewayDevice);
|
||||
|
||||
@ -649,10 +649,10 @@ public class DefaultTransportService implements TransportService {
|
||||
Optional<Device> deviceOpt = dataDecodingEncodingService.decode(msg.getData().toByteArray());
|
||||
if (deviceOpt.isPresent()) {
|
||||
Device device = deviceOpt.get();
|
||||
if (device.getAdditionalInfo().get("gateway") != null && device.getAdditionalInfo().get("gateway").asBoolean()) {
|
||||
if (device.getAdditionalInfo().has("gateway") && device.getAdditionalInfo().get("gateway").asBoolean()) {
|
||||
sessions.forEach((uuid, currentMD) -> {
|
||||
if (device.getId().equals(new DeviceId(new UUID(currentMD.getSessionInfo().getDeviceIdMSB(), currentMD.getSessionInfo().getDeviceIdLSB())))) {
|
||||
boolean newActivityTimeFromGatewayDevice = device.getAdditionalInfo().get("activityTimeFromGatewayDevice").asBoolean(false);
|
||||
boolean newActivityTimeFromGatewayDevice = device.getAdditionalInfo().get("activityTimeFromGatewayDevice").asBoolean();
|
||||
if (currentMD.getSessionInfo().getActivityTimeFromGatewayDevice() != newActivityTimeFromGatewayDevice) {
|
||||
SessionInfoProto currentSessionInfo = currentMD.getSessionInfo();
|
||||
SessionInfoProto newSessionInfo = SessionInfoProto.newBuilder()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user