|
@@ -304,100 +304,99 @@ public class SimulationTrackImpl implements SimulationTrackService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void tianaoTrack(Integer status,Integer type) {
|
|
|
+ public void tianaoTrack(Integer status, Integer type) {
|
|
|
tianaoStatus = status;
|
|
|
tianaoType = type;
|
|
|
if (0 == tianaoStatus) {
|
|
|
Thread thread = new Thread(() -> {
|
|
|
while (true) {
|
|
|
- if (tianaoStatus == 1) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- } else {
|
|
|
- //开始位置1 109.09300314810106,19.671012727042697
|
|
|
- //结束位置1 109.09690281197237,19.669125831751618
|
|
|
- List<Location> list1 = LocationUtils.generateLogLatTianao("2023-02-19 14:00:00", "2023-02-19 14:30:00", 109.09300314810106, 19.671012727042697, 109.09690281197237, 19.669125831751618);
|
|
|
- for (Location location : list1) {
|
|
|
- TianaoNewRadar tianaoRadar = new TianaoNewRadar();
|
|
|
- tianaoRadar.setTrackId("202302191");
|
|
|
- tianaoRadar.setAltitude(10.6D);
|
|
|
- tianaoRadar.setCollectTime(DateUtil.now());
|
|
|
- tianaoRadar.setCourse(180D);
|
|
|
- tianaoRadar.setFusionBatchNum("202302191");
|
|
|
- tianaoRadar.setFusionTime(DateUtil.now());
|
|
|
- tianaoRadar.setRadarBatchNum("202302191");
|
|
|
- tianaoRadar.setRadarCode(202302191);
|
|
|
- tianaoRadar.setReceiveTime(DateUtil.now());
|
|
|
- tianaoRadar.setReliability("100.0");
|
|
|
- tianaoRadar.setSpeed(18.8D);
|
|
|
- tianaoRadar.setTargetProper(0D);
|
|
|
- tianaoRadar.setTargetSize(10.0D);
|
|
|
- tianaoRadar.setTraceState("84");
|
|
|
- tianaoRadar.setLatitude(location.getLat());
|
|
|
- tianaoRadar.setLongitude(location.getLog());
|
|
|
-
|
|
|
- String data = JSONUtil.toJsonStr(tianaoRadar);
|
|
|
-
|
|
|
- if(0 == tianaoType){
|
|
|
- try {
|
|
|
- Thread.sleep(2500);
|
|
|
- kafkaTemplate.send(TopicConstants.TIANAO_TOPIC, data);
|
|
|
- log.info(DateUtil.now() + "模拟天奥船舶:天奥模拟船舶1,FusionBatchNum为202302191完成");
|
|
|
- } catch (InterruptedException e) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- if(1 == tianaoType){
|
|
|
+ boolean interrupted = Thread.currentThread().isInterrupted();
|
|
|
+ if (interrupted) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //开始位置1 109.09300314810106,19.671012727042697
|
|
|
+ //结束位置1 109.09690281197237,19.669125831751618
|
|
|
+ List<Location> list1 = LocationUtils.generateLogLatTianao("2023-02-19 14:00:00", "2023-02-19 14:30:00", 109.09300314810106, 19.671012727042697, 109.09690281197237, 19.669125831751618);
|
|
|
+ for (Location location : list1) {
|
|
|
+ TianaoNewRadar tianaoRadar = new TianaoNewRadar();
|
|
|
+ tianaoRadar.setTrackId("202302191");
|
|
|
+ tianaoRadar.setAltitude(10.6D);
|
|
|
+ tianaoRadar.setCollectTime(DateUtil.now());
|
|
|
+ tianaoRadar.setCourse(180D);
|
|
|
+ tianaoRadar.setFusionBatchNum("202302191");
|
|
|
+ tianaoRadar.setFusionTime(DateUtil.now());
|
|
|
+ tianaoRadar.setRadarBatchNum("202302191");
|
|
|
+ tianaoRadar.setRadarCode(202302191);
|
|
|
+ tianaoRadar.setReceiveTime(DateUtil.now());
|
|
|
+ tianaoRadar.setReliability("100.0");
|
|
|
+ tianaoRadar.setSpeed(18.8D);
|
|
|
+ tianaoRadar.setTargetProper(0D);
|
|
|
+ tianaoRadar.setTargetSize(10.0D);
|
|
|
+ tianaoRadar.setTraceState("84");
|
|
|
+ tianaoRadar.setLatitude(location.getLat());
|
|
|
+ tianaoRadar.setLongitude(location.getLog());
|
|
|
+ String data = JSONUtil.toJsonStr(tianaoRadar);
|
|
|
+ if (0 == tianaoType) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(2500);
|
|
|
kafkaTemplate.send(TopicConstants.TIANAO_TOPIC, data);
|
|
|
log.info(DateUtil.now() + "模拟天奥船舶:天奥模拟船舶1,FusionBatchNum为202302191完成");
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
}
|
|
|
}
|
|
|
+ if (1 == tianaoType) {
|
|
|
+ kafkaTemplate.send(TopicConstants.TIANAO_TOPIC, data);
|
|
|
+ log.info(DateUtil.now() + "模拟天奥船舶:天奥模拟船舶1,FusionBatchNum为202302191完成");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
Thread thread1 = new Thread(() -> {
|
|
|
while (true) {
|
|
|
- if (tianaoStatus == 1) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- } else {
|
|
|
- //开始位置2 109.0929925146248,19.67097869991864
|
|
|
- //结束位置2 109.0968340253979,19.66891947202822
|
|
|
- List<Location> list2 = LocationUtils.generateLogLatTianao("2023-02-19 14:00:00", "2023-02-19 14:30:00", 109.0929925146248, 19.67097869991864, 109.0968340253979, 19.66891947202822);
|
|
|
- for (Location location : list2) {
|
|
|
- TianaoNewRadar tianaoRadar = new TianaoNewRadar();
|
|
|
- tianaoRadar.setTrackId("202302192");
|
|
|
- tianaoRadar.setAltitude(10.6D);
|
|
|
- tianaoRadar.setCollectTime(DateUtil.now());
|
|
|
- tianaoRadar.setCourse(180D);
|
|
|
- tianaoRadar.setFusionBatchNum("202302192");
|
|
|
- tianaoRadar.setFusionTime(DateUtil.now());
|
|
|
- tianaoRadar.setRadarBatchNum("202302192");
|
|
|
- tianaoRadar.setRadarCode(202302192);
|
|
|
- tianaoRadar.setReceiveTime(DateUtil.now());
|
|
|
- tianaoRadar.setReliability("100.0");
|
|
|
- tianaoRadar.setSpeed(18.8D);
|
|
|
- tianaoRadar.setTargetProper(0D);
|
|
|
- tianaoRadar.setTargetSize(10.0D);
|
|
|
- tianaoRadar.setTraceState("84");
|
|
|
- tianaoRadar.setLatitude(location.getLat());
|
|
|
- tianaoRadar.setLongitude(location.getLog());
|
|
|
- String data = JSONUtil.toJsonStr(tianaoRadar);
|
|
|
- if(0 == tianaoType){
|
|
|
- try {
|
|
|
- Thread.sleep(2500);
|
|
|
- kafkaTemplate.send(TopicConstants.TIANAO_TOPIC, data);
|
|
|
- log.info(DateUtil.now() + "模拟天奥船舶:天奥模拟船舶2,FusionBatchNum为202302192完成");
|
|
|
- } catch (InterruptedException e) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- if(1 == tianaoType){
|
|
|
+ boolean interrupted = Thread.currentThread().isInterrupted();
|
|
|
+ if (interrupted) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //开始位置2 109.0929925146248,19.67097869991864
|
|
|
+ //结束位置2 109.0968340253979,19.66891947202822
|
|
|
+ List<Location> list2 = LocationUtils.generateLogLatTianao("2023-02-19 14:00:00", "2023-02-19 14:30:00", 109.0929925146248, 19.67097869991864, 109.0968340253979, 19.66891947202822);
|
|
|
+ for (Location location : list2) {
|
|
|
+ TianaoNewRadar tianaoRadar = new TianaoNewRadar();
|
|
|
+ tianaoRadar.setTrackId("202302192");
|
|
|
+ tianaoRadar.setAltitude(10.6D);
|
|
|
+ tianaoRadar.setCollectTime(DateUtil.now());
|
|
|
+ tianaoRadar.setCourse(180D);
|
|
|
+ tianaoRadar.setFusionBatchNum("202302192");
|
|
|
+ tianaoRadar.setFusionTime(DateUtil.now());
|
|
|
+ tianaoRadar.setRadarBatchNum("202302192");
|
|
|
+ tianaoRadar.setRadarCode(202302192);
|
|
|
+ tianaoRadar.setReceiveTime(DateUtil.now());
|
|
|
+ tianaoRadar.setReliability("100.0");
|
|
|
+ tianaoRadar.setSpeed(18.8D);
|
|
|
+ tianaoRadar.setTargetProper(0D);
|
|
|
+ tianaoRadar.setTargetSize(10.0D);
|
|
|
+ tianaoRadar.setTraceState("84");
|
|
|
+ tianaoRadar.setLatitude(location.getLat());
|
|
|
+ tianaoRadar.setLongitude(location.getLog());
|
|
|
+ String data = JSONUtil.toJsonStr(tianaoRadar);
|
|
|
+ if (0 == tianaoType) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(2500);
|
|
|
kafkaTemplate.send(TopicConstants.TIANAO_TOPIC, data);
|
|
|
log.info(DateUtil.now() + "模拟天奥船舶:天奥模拟船舶2,FusionBatchNum为202302192完成");
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ ;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+ if (1 == tianaoType) {
|
|
|
+ kafkaTemplate.send(TopicConstants.TIANAO_TOPIC, data);
|
|
|
+ log.info(DateUtil.now() + "模拟天奥船舶:天奥模拟船舶2,FusionBatchNum为202302192完成");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -415,7 +414,7 @@ public class SimulationTrackImpl implements SimulationTrackService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void beidouNewTrack(Integer status,Integer type) {
|
|
|
+ public void beidouNewTrack(Integer status, Integer type) {
|
|
|
//开始位置 109.11032753891612,19.687745190689267
|
|
|
//结束位置 109.16730608884323,19.68914959156775
|
|
|
//模拟同船的第一个设备
|
|
@@ -424,39 +423,39 @@ public class SimulationTrackImpl implements SimulationTrackService {
|
|
|
if (0 == beidouNewStatus) {
|
|
|
Thread thread = new Thread(() -> {
|
|
|
while (true) {
|
|
|
- if (beidouNewStatus == 1) {
|
|
|
- Thread.currentThread().interrupt();
|
|
|
- } else {
|
|
|
- List<Location> list = LocationUtils.generateLogLatBeidou("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);
|
|
|
- if(0 == beidouType){
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
- if(1 == beidouType){
|
|
|
+ boolean interrupted = Thread.currentThread().isInterrupted();
|
|
|
+ if(interrupted){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ List<Location> list = LocationUtils.generateLogLatBeidou("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);
|
|
|
+ if (0 == beidouType) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(1000);
|
|
|
kafkaTemplate.send(TopicConstants.BEIDOU_TOPIC, data);
|
|
|
log.info(DateUtil.now() + "模拟北斗船舶:202302193测试船舶,终端号为202302193完成");
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ Thread.currentThread().interrupt();
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+ if (1 == beidouType) {
|
|
|
+ kafkaTemplate.send(TopicConstants.BEIDOU_TOPIC, data);
|
|
|
+ log.info(DateUtil.now() + "模拟北斗船舶:202302193测试船舶,终端号为202302193完成");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
});
|