Merge branch 'server_five' of https://gitea.qinmian.online/five-groups/five-groups-couplet into server_five_dongxiaodong

server_five_dongxiaodong
dongxiaodong 2024-04-10 09:11:30 +08:00
commit c5fbb65b62
1 changed files with 22 additions and 23 deletions

View File

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