|
@@ -48,6 +48,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
@@ -289,6 +290,7 @@ public class GasCommonController {
|
|
|
List<AisShip> aisShipAddressList = aisShipService.queryShipAddressList(1);
|
|
|
// 组装一段时间内的经纬度数据
|
|
|
Map<String, List<String>> collect = aisShipAddressList.stream().collect(Collectors.groupingBy(AisShip::getMmsi, Collectors.mapping(a -> a.getLng() + "," + a.getLat(), Collectors.toList())));
|
|
|
+ Map<String, List<BigDecimal>> headCollect = aisShipAddressList.stream().collect(Collectors.groupingBy(AisShip::getMmsi, Collectors.mapping(AisShip::getHead, Collectors.toList())));
|
|
|
for (IllegalInfo illegalInfo : pageList) {
|
|
|
if (StrUtil.isNotBlank(illegalInfo.getMmsi())) {
|
|
|
AisShip aisShip = aisShipMap.get(illegalInfo.getMmsi());
|
|
@@ -300,7 +302,18 @@ public class GasCommonController {
|
|
|
illegalInfo.setSpeed(ObjectUtil.isEmpty(aisShip.getSpeed()) ? "-" : aisShip.getSpeed() + "节");
|
|
|
illegalInfo.setCourse(ObjectUtil.isEmpty(aisShip.getCourse()) ? "-" : aisShip.getCourse() + "");
|
|
|
}
|
|
|
- illegalInfo.setLnglat(collect.get(illegalInfo.getMmsi()));
|
|
|
+ // 数组转二维数组
|
|
|
+ List<String> lnglat = collect.get(illegalInfo.getMmsi());
|
|
|
+ Double[][] covert = new Double[lnglat.size()][];
|
|
|
+ for (int i = 0; i < lnglat.size(); i++) {
|
|
|
+ String[] second = lnglat.get(i).split(",");
|
|
|
+ covert[i] = new Double[second.length];
|
|
|
+ for (int j = 0; j < second.length; j++) {
|
|
|
+ covert[i][j] = Double.parseDouble(second[j]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ illegalInfo.setLnglat(covert);
|
|
|
+ illegalInfo.setHeads(headCollect.get(illegalInfo.getMmsi()));
|
|
|
}
|
|
|
}
|
|
|
pageList =
|