diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java index f06e875..fbc76a1 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/service/impl/ElectronicFenceServiceImpl.java @@ -49,31 +49,30 @@ public class ElectronicFenceServiceImpl implements IncidentService { log.info("电子围栏事件redis存在......."); for (Fence fence : cacheSet) { String fenceLongitudeLatitude = fence.getFenceLongitudeLatitude(); - if (!StringUtils.isEmpty(fenceLongitudeLatitude)){ - log.info("电子围栏没有数据鸭..."); - } - /** - * 先通过;后切割 - */ - String[] split = fenceLongitudeLatitude.split(";"); - for (String s : split) { - String[] strings = s.split(","); - if (strings.length == 2) { - // 经度 - Double trim = Double.valueOf(strings[0].trim()); - // 纬度 - Double trim1 = Double.valueOf(strings[1].trim()); - boolean a = trim <= Double.valueOf(coupletMsgData.getLongitude()); - boolean b = trim1 <= Double.valueOf(coupletMsgData.getLatitude()); - if (a && b) { - log.info("电子围栏报警啦!!!!您的车驶出范围啦!!!"); + if (StringUtils.isEmpty(fenceLongitudeLatitude)){ + /** + * 先通过;后切割 + */ + String[] split = fenceLongitudeLatitude.split(";"); + for (String s : split) { + String[] strings = s.split(","); + if (strings.length == 2) { + // 经度 + Double trim = Double.valueOf(strings[0].trim()); + // 纬度 + Double trim1 = Double.valueOf(strings[1].trim()); + boolean a = trim <= Double.valueOf(coupletMsgData.getLongitude()); + boolean b = trim1 <= Double.valueOf(coupletMsgData.getLatitude()); + if (a && b) { + log.info("电子围栏报警啦!!!!您的车驶出范围啦!!!"); + } else { + log.info("电子围栏报警啦!!!!正常啦!!!"); + } + log.info("经度是:" + trim); + log.info("纬度是:" + trim1); } else { - log.info("电子围栏报警啦!!!!正常啦!!!"); + throw new RuntimeException("电子围栏经纬度格式错误" + strings); } - log.info("经度是:" + trim); - log.info("纬度是:" + trim1); - } else { - throw new RuntimeException("电子围栏经纬度格式错误" + strings); } } }