Эх сурвалжийг харах

增加某船的实时位置接口数据

459242451@qq.com 3 жил өмнө
parent
commit
8d451d3d35

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gas/GasCommonController.java

@@ -353,6 +353,18 @@ public class GasCommonController {
         return AjaxResult.success(toMapList(cacheMap, areaLatitude1, areaLatitude2, areaLongitude1, areaLongitude2));
     }
 
+    @GetMapping("/queryCurrentShip")
+    @ApiOperation("获取某个船的实时位置")
+    public AjaxResult queryCurrentShip(@RequestParam String mmsi) {
+        Object cacheMapValue = redisCache.getCacheMapValue("ais:ship", mmsi);
+        if (cacheMapValue == null) {
+            return AjaxResult.error("目前无法定位到该船舶位置!");
+        }
+        cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(cacheMapValue);
+        Object result = jsonObject.getBigDecimal("lng") + "," + jsonObject.getBigDecimal("lat");
+        return AjaxResult.success(result);
+    }
+
     @GetMapping("/queryShipMonitorInfo")
     @ApiOperation("获取船舶监测数据")
     public AjaxResult queryShipMonitorInfo(@RequestParam String mmsi) {