|
@@ -1,9 +1,12 @@
|
|
|
package com.songhua.system.service.impl;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import com.songhua.common.utils.DateUtils;
|
|
|
import com.songhua.common.utils.uuid.IdUtils;
|
|
|
+import com.songhua.system.domain.BasicCruiseShip;
|
|
|
+import com.songhua.system.mapper.BasicCruiseShipMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.songhua.system.mapper.CruiseShipMappingMapper;
|
|
@@ -19,6 +22,9 @@ public class CruiseShipMappingServiceImpl implements ICruiseShipMappingService
|
|
|
@Autowired
|
|
|
private CruiseShipMappingMapper cruiseShipMappingMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BasicCruiseShipMapper basicCruiseShipMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询
|
|
|
*/
|
|
@@ -74,4 +80,28 @@ public class CruiseShipMappingServiceImpl implements ICruiseShipMappingService
|
|
|
{
|
|
|
return cruiseShipMappingMapper.deleteCruiseShipMappingById(id);
|
|
|
}
|
|
|
+
|
|
|
+ private List<String> color = Arrays.asList("white", "ivory", "lightyellow", "yellow", "snow", "floralwhite","red","blue","orange","wheat","lightgreen");
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> getShipRouteData() {
|
|
|
+ List<Map<String, Object>> combinedData = new ArrayList<>();
|
|
|
+ // 获取近一小时的经纬度信息
|
|
|
+ List<CruiseShipMapping> recentLocations = cruiseShipMappingMapper.getShipRouteData();
|
|
|
+ for (int i = 0; i < recentLocations.size(); i++) {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ String[] lon = recentLocations.get(i).getLongitude().split(",");
|
|
|
+ String[] lat = recentLocations.get(i).getLatitude().split(",");
|
|
|
+ for (int j = 0; j < lon.length; j++) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("lng", lon[j]);
|
|
|
+ map.put("lat", lat[j]);
|
|
|
+ data.put("polylinePath",map);
|
|
|
+ }
|
|
|
+ data.put("color", color.get(i));
|
|
|
+ data.put("shipName", recentLocations.get(i).getShipName());
|
|
|
+ combinedData.add(data);
|
|
|
+ }
|
|
|
+ return combinedData;
|
|
|
+ }
|
|
|
}
|