|
@@ -1,219 +1,219 @@
|
|
|
-package com.dc.datachange.utils;
|
|
|
-
|
|
|
-import Messenger.Message;
|
|
|
-import com.dc.datachange.core.common.ControlConstants;
|
|
|
-import com.dc.datachange.core.common.MsgConstants;
|
|
|
-import com.dc.datachange.core.common.PlatConstants;
|
|
|
-import com.dc.datachange.core.connection.DDSPublisher;
|
|
|
-import com.dc.datachange.core.entity.networkGroup.NetworkGroup;
|
|
|
-import com.dc.datachange.core.entity.platformInfo.InterferPlatform;
|
|
|
-import com.dc.datachange.core.entity.platformInfo.RadarPlatform;
|
|
|
-import com.dc.datachange.core.exchange.DataManager;
|
|
|
-import com.dc.datachange.networkGroup.controller.NetworkController;
|
|
|
-import com.dc.datachange.networkGroup.entity.NetworkParams;
|
|
|
-import com.dc.datachange.networkGroup.entity.RawGroup;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-@RestController
|
|
|
-@RequestMapping("/test")
|
|
|
-public class Simulator {
|
|
|
- @Autowired
|
|
|
- private DDSPublisher publisher;
|
|
|
- @Autowired
|
|
|
- private DataManager dataManager;
|
|
|
- @Autowired
|
|
|
- private NetworkController networkController;
|
|
|
- private static Integer count=0;
|
|
|
-
|
|
|
- @GetMapping("/add1")
|
|
|
- public R addRadarPulse(){
|
|
|
- count++;
|
|
|
- publisher.sendMessage(
|
|
|
- new Message(
|
|
|
- PlatConstants.RADAR_TASKSYS+" "+PlatConstants.EXCHANGE_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
- MsgConstants.RADAR_PULSE,
|
|
|
- count,
|
|
|
- "雷达 空中 21 127 10000 5000 "+count,
|
|
|
- count));
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/add2")
|
|
|
- public R addEleInter(){
|
|
|
- count++;
|
|
|
- publisher.sendMessage(
|
|
|
- new Message(
|
|
|
- PlatConstants.RADAR_TASKSYS+" "+PlatConstants.EXCHANGE_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
- MsgConstants.ELECTRIC_INTERFERE,
|
|
|
- count,
|
|
|
- "宽带干扰 空中 区域A 宽带干扰 未知 否 "+count,
|
|
|
- count));
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/add3")
|
|
|
- public R addComprehen(){
|
|
|
- count++;
|
|
|
- publisher.sendMessage(
|
|
|
- new Message(
|
|
|
- PlatConstants.RADAR_TASKSYS+" "+PlatConstants.EXCHANGE_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
- MsgConstants.COMPREHEN_INTELL,
|
|
|
- count,
|
|
|
- "综合 "+count+" 否 在侦察完成后立刻启动干扰",
|
|
|
- count));
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/init")
|
|
|
- public R init() throws InterruptedException {
|
|
|
- publisher.sendMessage(
|
|
|
- new Message(PlatConstants.SUPPORT_PLATFORM,
|
|
|
- MsgConstants.INITIAL_MSG,
|
|
|
- count,
|
|
|
- "6 4\n"+
|
|
|
- "104 1 0 1 -1502143.7779720642 5459654.14635412 2925524.054455928\n" +
|
|
|
- "105 1 0 1 -1119974.522455073 5202530.972695272 3503886.1094705067\n" +
|
|
|
- "103 1 0 1 -1569497.379037304 4803025.549234323 3879026.548666874\n" +
|
|
|
- "106 1 0 1 -2853706.7751482297 3559878.3551225117 4441990.145821915\n" +
|
|
|
- "101 1 0 1 -2437977.331981979 5037635.193417693 3049012.3329436616\n" +
|
|
|
- "102 1 0 1 -2088875.7919909689 4487613.197114771 4008771.869184186\n" +
|
|
|
- "201 2 1 1 -2288875.7919909689 4187613.197114771 4058771.869184186\n" +
|
|
|
- "202 2 1 1 -2388875.7919909689 4287613.197114771 4108771.869184186\n" +
|
|
|
- "203 2 1 1 -2188875.7919909689 4387613.197114771 4208771.869184186\n" +
|
|
|
- "204 2 1 1 -2588875.7919909689 4487613.197114771 4078771.869184186",
|
|
|
- count));
|
|
|
- this.addNet1();
|
|
|
- this.addNet2();
|
|
|
- this.addNet1();
|
|
|
- this.addNet2();
|
|
|
- Thread.sleep(1000);
|
|
|
- R r = addParams(1, new ArrayList<Integer>() {{
|
|
|
- add(104);
|
|
|
- add(105);
|
|
|
- }});
|
|
|
- System.out.println(r.toString());
|
|
|
- R r1 = addParams(2, new ArrayList<Integer>() {{
|
|
|
- add(201);
|
|
|
- add(202);
|
|
|
- add(203);
|
|
|
- }});
|
|
|
- System.out.println(r1.toString());
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/initError1")
|
|
|
- public R initError1(){
|
|
|
- return addParams(2,new ArrayList<Integer>(){{add(104);add(202);}});
|
|
|
- }
|
|
|
- @GetMapping("/initError2")
|
|
|
- public R initError2(){
|
|
|
- return addParams(2,new ArrayList<Integer>(){{add(104);add(1111);}});
|
|
|
- }
|
|
|
- @GetMapping("/init2")
|
|
|
- public R init2(){
|
|
|
- publisher.sendMessage(
|
|
|
- new Message(PlatConstants.SUPPORT_PLATFORM+" "+PlatConstants.RADAR_TASKSYS,
|
|
|
- MsgConstants.INITIAL_MSG,
|
|
|
- count,
|
|
|
- "6 4\n" +
|
|
|
- "104 1 0 1 -1502143.7779720642 5459654.14635412 2925524.054455928\n" +
|
|
|
- "105 1 0 1 -1119974.522455073 5202530.972695272 3503886.1094705067\n" +
|
|
|
- "103 1 0 1 -1569497.379037304 4803025.549234323 3879026.548666874\n" +
|
|
|
- "106 1 0 1 -2853706.7751482297 3559878.3551225117 4441990.145821915\n" +
|
|
|
- "101 1 0 1 -2437977.331981979 5037635.193417693 3049012.3329436616\n" +
|
|
|
- "102 1 0 1 -2088875.7919909689 4487613.197114771 4008771.869184186\n" +
|
|
|
- "201 2 1 1 -2288875.7919909689 4187613.197114771 4058771.869184186\n" +
|
|
|
- "202 2 1 1 -2388875.7919909689 4287613.197114771 4108771.869184186\n" +
|
|
|
- "203 2 1 1 -2188875.7919909689 4387613.197114771 4208771.869184186\n" +
|
|
|
- "204 2 1 1 -2588875.7919909689 4487613.197114771 4078771.869184186",
|
|
|
- count));
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/listInter")
|
|
|
- public R listInter(){
|
|
|
- return R.ok().put("data", dataManager.getList(InterferPlatform.class,1,100));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/listRadar")
|
|
|
- public R listRadar(){
|
|
|
- return R.ok().put("data", dataManager.getList(RadarPlatform.class,1,100));
|
|
|
- }
|
|
|
- @GetMapping("/stop")
|
|
|
- public R stop(){
|
|
|
- publisher.sendMessage(new Message(
|
|
|
- PlatConstants.SUPPORT_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
- MsgConstants.DAOTIAO_MSG,
|
|
|
- count,
|
|
|
- ControlConstants.CTRL_FINISH,
|
|
|
- count));
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/addNet1")
|
|
|
- public R addNet1(){
|
|
|
- count++;
|
|
|
- NetworkGroup interference =new NetworkGroup(new RawGroup("interference", count.toString(), count.toString(), true));
|
|
|
- dataManager.addData(interference.getId(),interference);
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/addNet2")
|
|
|
- public R addNet2(){
|
|
|
- count++;
|
|
|
- NetworkGroup radar = new NetworkGroup(new RawGroup("radar", count.toString(), count.toString(), true));
|
|
|
- dataManager.addData(radar.getId(),radar);
|
|
|
- return R.ok();
|
|
|
- }
|
|
|
- @GetMapping("/listNet")
|
|
|
- public R listNet(){
|
|
|
- return R.ok().put("data",dataManager.getList(NetworkGroup.class,1,100));
|
|
|
- }
|
|
|
- @GetMapping("/addParams")
|
|
|
- public R addParams(Integer id, List<Integer> ids){
|
|
|
- count++;
|
|
|
- NetworkParams data = new NetworkParams();
|
|
|
- data.setId(id);
|
|
|
- data.setParams(count.toString());
|
|
|
- data.setPlatformSet(new HashSet<>(ids));
|
|
|
- return networkController.updateNetworkParams(data);
|
|
|
- }
|
|
|
- @GetMapping("/addMessage1")
|
|
|
- public R addMessage1(Integer id1,Integer id2){
|
|
|
- count++;
|
|
|
-
|
|
|
- Message message = new Message(
|
|
|
- id1 + " " + PlatConstants.EXCHANGE_PLATFORM + " " + id2,
|
|
|
- MsgConstants.RADAR_PULSE,
|
|
|
- count,
|
|
|
- "雷达 空中 21 127 10000 5000 " + count,
|
|
|
- count);
|
|
|
- publisher.sendMessage(message);
|
|
|
- return R.ok(message.toString());
|
|
|
- }
|
|
|
- @GetMapping("/addMessage2")
|
|
|
- public R addMessage2(Integer id1,Integer id2){
|
|
|
- count++;
|
|
|
- Message message = new Message(
|
|
|
- id1 + " " + PlatConstants.EXCHANGE_PLATFORM + " " + id2,
|
|
|
- MsgConstants.ELECTRIC_INTERFERE,
|
|
|
- count,
|
|
|
- "宽带干扰 空中 区域A 宽带干扰 未知 否 " + count,
|
|
|
- count);
|
|
|
- publisher.sendMessage(message);
|
|
|
- return R.ok(message.toString());
|
|
|
- }
|
|
|
- @GetMapping("/addMessage3")
|
|
|
- public R addMessage3(Integer id1,Integer id2){
|
|
|
- count++;
|
|
|
-
|
|
|
- Message message = new Message(
|
|
|
- id1 + " " + PlatConstants.EXCHANGE_PLATFORM + " " + id2,
|
|
|
- MsgConstants.COMPREHEN_INTELL,
|
|
|
- count,
|
|
|
- "综合 " + count + " 否 在侦察完成后立刻启动干扰",
|
|
|
- count);
|
|
|
- publisher.sendMessage(message);
|
|
|
- return R.ok(message.toString());
|
|
|
- }
|
|
|
-}
|
|
|
+//package com.dc.datachange.utils;
|
|
|
+//
|
|
|
+//import Messenger.Message;
|
|
|
+//import com.dc.datachange.core.common.ControlConstants;
|
|
|
+//import com.dc.datachange.core.common.MsgConstants;
|
|
|
+//import com.dc.datachange.core.common.PlatConstants;
|
|
|
+//import com.dc.datachange.core.connection.DDSPublisher;
|
|
|
+//import com.dc.datachange.core.entity.networkGroup.NetworkGroup;
|
|
|
+//import com.dc.datachange.core.entity.platformInfo.InterferPlatform;
|
|
|
+//import com.dc.datachange.core.entity.platformInfo.RadarPlatform;
|
|
|
+//import com.dc.datachange.core.exchange.DataManager;
|
|
|
+//import com.dc.datachange.networkGroup.controller.NetworkController;
|
|
|
+//import com.dc.datachange.networkGroup.entity.NetworkParams;
|
|
|
+//import com.dc.datachange.networkGroup.entity.RawGroup;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+//import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+//import org.springframework.web.bind.annotation.RestController;
|
|
|
+//
|
|
|
+//import java.util.ArrayList;
|
|
|
+//import java.util.HashSet;
|
|
|
+//import java.util.List;
|
|
|
+//
|
|
|
+//@RestController
|
|
|
+//@RequestMapping("/test")
|
|
|
+//public class Simulator {
|
|
|
+// @Autowired
|
|
|
+// private DDSPublisher publisher;
|
|
|
+// @Autowired
|
|
|
+// private DataManager dataManager;
|
|
|
+// @Autowired
|
|
|
+// private NetworkController networkController;
|
|
|
+// private static Integer count=0;
|
|
|
+//
|
|
|
+// @GetMapping("/add1")
|
|
|
+// public R addRadarPulse(){
|
|
|
+// count++;
|
|
|
+// publisher.sendMessage(
|
|
|
+// new Message(
|
|
|
+// PlatConstants.RADAR_TASKSYS+" "+PlatConstants.EXCHANGE_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
+// MsgConstants.RADAR_PULSE,
|
|
|
+// count,
|
|
|
+// "雷达 空中 21 127 10000 5000 "+count,
|
|
|
+// count));
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/add2")
|
|
|
+// public R addEleInter(){
|
|
|
+// count++;
|
|
|
+// publisher.sendMessage(
|
|
|
+// new Message(
|
|
|
+// PlatConstants.RADAR_TASKSYS+" "+PlatConstants.EXCHANGE_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
+// MsgConstants.ELECTRIC_INTERFERE,
|
|
|
+// count,
|
|
|
+// "宽带干扰 空中 区域A 宽带干扰 未知 否 "+count,
|
|
|
+// count));
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/add3")
|
|
|
+// public R addComprehen(){
|
|
|
+// count++;
|
|
|
+// publisher.sendMessage(
|
|
|
+// new Message(
|
|
|
+// PlatConstants.RADAR_TASKSYS+" "+PlatConstants.EXCHANGE_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
+// MsgConstants.COMPREHEN_INTELL,
|
|
|
+// count,
|
|
|
+// "综合 "+count+" 否 在侦察完成后立刻启动干扰",
|
|
|
+// count));
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/init")
|
|
|
+// public R init() throws InterruptedException {
|
|
|
+// publisher.sendMessage(
|
|
|
+// new Message(PlatConstants.SUPPORT_PLATFORM,
|
|
|
+// MsgConstants.INITIAL_MSG,
|
|
|
+// count,
|
|
|
+// "6 4\n"+
|
|
|
+// "104 1 0 1 -1502143.7779720642 5459654.14635412 2925524.054455928\n" +
|
|
|
+// "105 1 0 1 -1119974.522455073 5202530.972695272 3503886.1094705067\n" +
|
|
|
+// "103 1 0 1 -1569497.379037304 4803025.549234323 3879026.548666874\n" +
|
|
|
+// "106 1 0 1 -2853706.7751482297 3559878.3551225117 4441990.145821915\n" +
|
|
|
+// "101 1 0 1 -2437977.331981979 5037635.193417693 3049012.3329436616\n" +
|
|
|
+// "102 1 0 1 -2088875.7919909689 4487613.197114771 4008771.869184186\n" +
|
|
|
+// "201 2 1 1 -2288875.7919909689 4187613.197114771 4058771.869184186\n" +
|
|
|
+// "202 2 1 1 -2388875.7919909689 4287613.197114771 4108771.869184186\n" +
|
|
|
+// "203 2 1 1 -2188875.7919909689 4387613.197114771 4208771.869184186\n" +
|
|
|
+// "204 2 1 1 -2588875.7919909689 4487613.197114771 4078771.869184186",
|
|
|
+// count));
|
|
|
+// this.addNet1();
|
|
|
+// this.addNet2();
|
|
|
+// this.addNet1();
|
|
|
+// this.addNet2();
|
|
|
+// Thread.sleep(1000);
|
|
|
+// R r = addParams(1, new ArrayList<Integer>() {{
|
|
|
+// add(104);
|
|
|
+// add(105);
|
|
|
+// }});
|
|
|
+// System.out.println(r.toString());
|
|
|
+// R r1 = addParams(2, new ArrayList<Integer>() {{
|
|
|
+// add(201);
|
|
|
+// add(202);
|
|
|
+// add(203);
|
|
|
+// }});
|
|
|
+// System.out.println(r1.toString());
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/initError1")
|
|
|
+// public R initError1(){
|
|
|
+// return addParams(2,new ArrayList<Integer>(){{add(104);add(202);}});
|
|
|
+// }
|
|
|
+// @GetMapping("/initError2")
|
|
|
+// public R initError2(){
|
|
|
+// return addParams(2,new ArrayList<Integer>(){{add(104);add(1111);}});
|
|
|
+// }
|
|
|
+// @GetMapping("/init2")
|
|
|
+// public R init2(){
|
|
|
+// publisher.sendMessage(
|
|
|
+// new Message(PlatConstants.SUPPORT_PLATFORM+" "+PlatConstants.RADAR_TASKSYS,
|
|
|
+// MsgConstants.INITIAL_MSG,
|
|
|
+// count,
|
|
|
+// "6 4\n" +
|
|
|
+// "104 1 0 1 -1502143.7779720642 5459654.14635412 2925524.054455928\n" +
|
|
|
+// "105 1 0 1 -1119974.522455073 5202530.972695272 3503886.1094705067\n" +
|
|
|
+// "103 1 0 1 -1569497.379037304 4803025.549234323 3879026.548666874\n" +
|
|
|
+// "106 1 0 1 -2853706.7751482297 3559878.3551225117 4441990.145821915\n" +
|
|
|
+// "101 1 0 1 -2437977.331981979 5037635.193417693 3049012.3329436616\n" +
|
|
|
+// "102 1 0 1 -2088875.7919909689 4487613.197114771 4008771.869184186\n" +
|
|
|
+// "201 2 1 1 -2288875.7919909689 4187613.197114771 4058771.869184186\n" +
|
|
|
+// "202 2 1 1 -2388875.7919909689 4287613.197114771 4108771.869184186\n" +
|
|
|
+// "203 2 1 1 -2188875.7919909689 4387613.197114771 4208771.869184186\n" +
|
|
|
+// "204 2 1 1 -2588875.7919909689 4487613.197114771 4078771.869184186",
|
|
|
+// count));
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/listInter")
|
|
|
+// public R listInter(){
|
|
|
+// return R.ok().put("data", dataManager.getList(InterferPlatform.class,1,100));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/listRadar")
|
|
|
+// public R listRadar(){
|
|
|
+// return R.ok().put("data", dataManager.getList(RadarPlatform.class,1,100));
|
|
|
+// }
|
|
|
+// @GetMapping("/stop")
|
|
|
+// public R stop(){
|
|
|
+// publisher.sendMessage(new Message(
|
|
|
+// PlatConstants.SUPPORT_PLATFORM+" "+PlatConstants.EXCHANGE_PLATFORM,
|
|
|
+// MsgConstants.DAOTIAO_MSG,
|
|
|
+// count,
|
|
|
+// ControlConstants.CTRL_FINISH,
|
|
|
+// count));
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/addNet1")
|
|
|
+// public R addNet1(){
|
|
|
+// count++;
|
|
|
+// NetworkGroup interference =new NetworkGroup(new RawGroup("interference", count.toString(), count.toString(), true));
|
|
|
+// dataManager.addData(interference.getId(),interference);
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/addNet2")
|
|
|
+// public R addNet2(){
|
|
|
+// count++;
|
|
|
+// NetworkGroup radar = new NetworkGroup(new RawGroup("radar", count.toString(), count.toString(), true));
|
|
|
+// dataManager.addData(radar.getId(),radar);
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
+// @GetMapping("/listNet")
|
|
|
+// public R listNet(){
|
|
|
+// return R.ok().put("data",dataManager.getList(NetworkGroup.class,1,100));
|
|
|
+// }
|
|
|
+// @GetMapping("/addParams")
|
|
|
+// public R addParams(Integer id, List<Integer> ids){
|
|
|
+// count++;
|
|
|
+// NetworkParams data = new NetworkParams();
|
|
|
+// data.setId(id);
|
|
|
+// data.setParams(count.toString());
|
|
|
+// data.setPlatformSet(new HashSet<>(ids));
|
|
|
+// return networkController.updateNetworkParams(data);
|
|
|
+// }
|
|
|
+// @GetMapping("/addMessage1")
|
|
|
+// public R addMessage1(Integer id1,Integer id2){
|
|
|
+// count++;
|
|
|
+//
|
|
|
+// Message message = new Message(
|
|
|
+// id1 + " " + PlatConstants.EXCHANGE_PLATFORM + " " + id2,
|
|
|
+// MsgConstants.RADAR_PULSE,
|
|
|
+// count,
|
|
|
+// "雷达 空中 21 127 10000 5000 " + count,
|
|
|
+// count);
|
|
|
+// publisher.sendMessage(message);
|
|
|
+// return R.ok(message.toString());
|
|
|
+// }
|
|
|
+// @GetMapping("/addMessage2")
|
|
|
+// public R addMessage2(Integer id1,Integer id2){
|
|
|
+// count++;
|
|
|
+// Message message = new Message(
|
|
|
+// id1 + " " + PlatConstants.EXCHANGE_PLATFORM + " " + id2,
|
|
|
+// MsgConstants.ELECTRIC_INTERFERE,
|
|
|
+// count,
|
|
|
+// "宽带干扰 空中 区域A 宽带干扰 未知 否 " + count,
|
|
|
+// count);
|
|
|
+// publisher.sendMessage(message);
|
|
|
+// return R.ok(message.toString());
|
|
|
+// }
|
|
|
+// @GetMapping("/addMessage3")
|
|
|
+// public R addMessage3(Integer id1,Integer id2){
|
|
|
+// count++;
|
|
|
+//
|
|
|
+// Message message = new Message(
|
|
|
+// id1 + " " + PlatConstants.EXCHANGE_PLATFORM + " " + id2,
|
|
|
+// MsgConstants.COMPREHEN_INTELL,
|
|
|
+// count,
|
|
|
+// "综合 " + count + " 否 在侦察完成后立刻启动干扰",
|
|
|
+// count);
|
|
|
+// publisher.sendMessage(message);
|
|
|
+// return R.ok(message.toString());
|
|
|
+// }
|
|
|
+//}
|