CheckUtil.java 537 Bytes
package com.viontech.utils;

import com.viontech.vo.traffic.TrafficMongoModel;

import java.util.Map;
import java.util.Optional;

public class CheckUtil {
    public static boolean checkDeviceId(TrafficMongoModel model) {
        String deviceId = Optional.ofNullable(model)
                .map(x -> x.getEvent_data())
                .map(x -> x.get("device"))
                .map(x -> (String) ((Map) x).get("code")).orElse("");
        if (20 == deviceId.length()) {
            return true;
        }
        return false;
    }
}