|
@@ -40,6 +40,11 @@ public class SimulationTrackImpl implements SimulationTrackService {
|
|
|
|
|
|
private Integer beidouStatus;
|
|
|
|
|
|
+
|
|
|
+ HashSet<Thread> beidouNewThreads = new HashSet<>();
|
|
|
+
|
|
|
+ private Integer beidouNewStatus;
|
|
|
+
|
|
|
HashSet<Thread> hlxOneLevelTherads = new HashSet<>();
|
|
|
|
|
|
private Integer hlxOneLevelStatus;
|
|
@@ -396,7 +401,55 @@ public class SimulationTrackImpl implements SimulationTrackService {
|
|
|
item.interrupt();
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ @Override
|
|
|
+ public void beidouNewTrack(Integer status) {
|
|
|
+ //开始位置 109.11032753891612,19.687745190689267
|
|
|
+ //结束位置 109.16730608884323,19.68914959156775
|
|
|
+ //模拟同船的第一个设备
|
|
|
+ beidouNewStatus = status;
|
|
|
+ if (0 == beidouNewStatus) {
|
|
|
+ Thread thread = new Thread(() -> {
|
|
|
+ while (true) {
|
|
|
+ if (beidouNewStatus == 1) {
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ } else {
|
|
|
+ List<Location> list = LocationUtils.generateLogLat("2023-02-19 14:00:00", "2023-02-19 14:30:00", 109.11032753891612, 19.687745190689267, 109.16730608884323,19.68914959156775);
|
|
|
+ for (Location location : list) {
|
|
|
+ BeidouShipTrackDTO beidouShipTrackDTO = new BeidouShipTrackDTO();
|
|
|
+ beidouShipTrackDTO.setId("202302193");
|
|
|
+ beidouShipTrackDTO.setCurren_time(DateUtil.now());
|
|
|
+ beidouShipTrackDTO.setTrackId(202302193);
|
|
|
+ beidouShipTrackDTO.setDeviceId(202302193);
|
|
|
+ beidouShipTrackDTO.setSendTime(DateUtil.now());
|
|
|
+ beidouShipTrackDTO.setLocationTime(DateUtil.now());
|
|
|
+ beidouShipTrackDTO.setShipName("202302193测试船舶");
|
|
|
+ beidouShipTrackDTO.setReceiveTime(DateUtil.now());
|
|
|
+ beidouShipTrackDTO.setLongitude(location.getLog());
|
|
|
+ beidouShipTrackDTO.setLatitude(location.getLat());
|
|
|
+ String data = JSONUtil.toJsonStr(beidouShipTrackDTO);
|
|
|
+ try {
|
|
|
+ Thread.sleep(1000 * 60);
|
|
|
+ kafkaTemplate.send(TopicConstants.BEIDOU_TOPIC, data);
|
|
|
+ log.info(DateUtil.now() + "模拟北斗船舶:202302193测试船舶,终端号为202302193完成");
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ thread.start();
|
|
|
+ beidouNewThreads.add(thread);
|
|
|
+ }
|
|
|
+ if (1 == beidouNewStatus) {
|
|
|
+ for (Thread item : beidouNewThreads) {
|
|
|
+ item.interrupt();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|