fix: resolve xinda vehicles by mysql plate binding
This commit is contained in:
@@ -143,9 +143,9 @@ public final class XindaPushEventMapper implements EventMapper<XindaPushMessage>
|
||||
return IdentityResolution.ok(identityResolver.resolve(new VehicleIdentityLookup(
|
||||
ProtocolId.XINDA_PUSH,
|
||||
firstNonBlank(json, "vin"),
|
||||
firstNonBlank(json, "sim", "phone", "mobile"),
|
||||
firstNonBlank(json, "deviceId", "terminalId", "imei"),
|
||||
firstNonBlank(json, "plateNo", "carNo"))));
|
||||
firstNonBlank(json, "sim", "phone", "mobile", "simCode"),
|
||||
firstNonBlank(json, "deviceId", "terminalId", "imei", "tmnKey", "tmnCode"),
|
||||
plateNo(json))));
|
||||
} catch (RuntimeException e) {
|
||||
return new IdentityResolution(
|
||||
new VehicleIdentity("unknown", false, VehicleIdentitySource.UNKNOWN),
|
||||
@@ -172,9 +172,9 @@ public final class XindaPushEventMapper implements EventMapper<XindaPushMessage>
|
||||
out.put("rawJson", message.json());
|
||||
out.put("vin", normalizedVin(identity));
|
||||
out.put("externalVin", firstNonBlank(json, "vin"));
|
||||
out.put("phone", firstNonBlank(json, "sim", "phone", "mobile"));
|
||||
out.put("deviceId", firstNonBlank(json, "deviceId", "terminalId", "imei"));
|
||||
out.put("plateNo", firstNonBlank(json, "plateNo", "carNo"));
|
||||
out.put("phone", firstNonBlank(json, "sim", "phone", "mobile", "simCode"));
|
||||
out.put("deviceId", firstNonBlank(json, "deviceId", "terminalId", "imei", "tmnKey", "tmnCode"));
|
||||
out.put("plateNo", plateNo(json));
|
||||
out.put("identityResolved", Boolean.toString(identity.identity().resolved()));
|
||||
out.put("identitySource", identity.identity().source().name());
|
||||
if (identity.errorMessage() != null) {
|
||||
@@ -243,6 +243,10 @@ public final class XindaPushEventMapper implements EventMapper<XindaPushMessage>
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String plateNo(JSONObject node) {
|
||||
return firstNonBlank(node, "plateNo", "carNo", "carName");
|
||||
}
|
||||
|
||||
private static double asDouble(JSONObject node, String... keys) {
|
||||
Double value = optionalDouble(node, keys);
|
||||
return value == null ? 0.0 : value;
|
||||
|
||||
Reference in New Issue
Block a user