Quellcode durchsuchen

fix(sb-position): 修改矩形坐标验证逻辑

- 将矩形坐标验证从四个角点改为左上角和右下角两个坐标
- 更新错误提示信息以反映新的坐标要求
- 修正注释说明从四个角点到两个角点的矩形边界提取逻辑
dazhaxie vor 3 Tagen
Ursprung
Commit
efc2d482af

+ 3 - 3
platform-service/src/main/java/com/platform/service/sb/impl/SbPositionServiceImpl.java

@@ -241,8 +241,8 @@ public class SbPositionServiceImpl extends BaseServiceImpl<SbPositionMapper, SbP
         List<String> positionIds = request.getPositionIds();
         String mapName = request.getMapName();
         Integer isShow = request.getIsShow();
-        if (points == null || points.size() != 4) {
-            throw new BusinessException("请提供矩形的四个角点坐标");
+        if (points == null || points.size() != 2) {
+            throw new BusinessException("请提供矩形的左上角和右下角两个坐标");
         }
         if (positionIds == null || positionIds.isEmpty()) {
             throw new BusinessException("请选择至少一个设备位置");
@@ -254,7 +254,7 @@ public class SbPositionServiceImpl extends BaseServiceImpl<SbPositionMapper, SbP
             throw new BusinessException("请设置是否显示");
         }
 
-        // 1. 从四个角点中提取矩形边界
+        // 1. 从两个角点(左上、右下)中提取矩形边界
         double lngMin = points.stream().mapToDouble(p -> p.getLongitude().doubleValue()).min().orElse(0);
         double lngMax = points.stream().mapToDouble(p -> p.getLongitude().doubleValue()).max().orElse(0);
         double latMin = points.stream().mapToDouble(p -> p.getLatitude().doubleValue()).min().orElse(0);