Compare commits

...

1 Commits

Author SHA1 Message Date
lijiayao e0452fbdf5 修改bug 2024-04-09 18:54:04 +08:00
1 changed files with 22 additions and 23 deletions

View File

@ -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);
}
}
}