|
@@ -1,21 +1,17 @@
|
|
package com.phm.netty.controller;
|
|
package com.phm.netty.controller;
|
|
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
import com.phm.common.annotation.Anonymous;
|
|
import com.phm.common.annotation.Anonymous;
|
|
import com.phm.common.core.controller.BaseController;
|
|
import com.phm.common.core.controller.BaseController;
|
|
-import com.phm.common.core.page.TableDataInfo;
|
|
|
|
import com.phm.manage.domain.common.CommonResult;
|
|
import com.phm.manage.domain.common.CommonResult;
|
|
import com.phm.netty.client.NettyUdpClient;
|
|
import com.phm.netty.client.NettyUdpClient;
|
|
import com.phm.netty.domain.Message;
|
|
import com.phm.netty.domain.Message;
|
|
import com.phm.netty.enums.OrderEnum;
|
|
import com.phm.netty.enums.OrderEnum;
|
|
-import com.phm.system.domain.SysConfig;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
-
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description NettyUdpClientController
|
|
* @Description NettyUdpClientController
|
|
@@ -29,17 +25,31 @@ public class NettyUdpClientController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private NettyUdpClient udpClient;
|
|
private NettyUdpClient udpClient;
|
|
|
|
|
|
- @PostMapping("/getInfo")
|
|
|
|
- public CommonResult<String> getInfo() {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取数链仿真系统数据
|
|
|
|
+ *
|
|
|
|
+ * @return res
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/simulation")
|
|
|
|
+ public CommonResult<String> getSimulationInfo() {
|
|
|
|
+ Message message = new Message();
|
|
|
|
+ message.setType(OrderEnum.ORDER_CONFIG.getType()).setTarget("GPHM").setSource("SPHM")
|
|
|
|
+ .setData("{\"cmdId\": \"getConfig\"}");
|
|
// udp客户端,向服务端发送获取数据请求服务
|
|
// udp客户端,向服务端发送获取数据请求服务
|
|
- udpClient.bind("", 0, null);
|
|
|
|
|
|
+ udpClient.bind("127.0.0.1", 19000, Message.msgToBytes(message));
|
|
return CommonResult.buildSuccess();
|
|
return CommonResult.buildSuccess();
|
|
}
|
|
}
|
|
|
|
|
|
- @PostMapping("/getInfo2")
|
|
|
|
- public CommonResult<String> getInfo2() {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取机载数据
|
|
|
|
+ *
|
|
|
|
+ * @return res
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/airborne/{id}")
|
|
|
|
+ public CommonResult<String> getAirborneInfo(@PathVariable("id") Long id) {
|
|
Message message = new Message();
|
|
Message message = new Message();
|
|
- message.setType(OrderEnum.ORDER_CONFIG.getType()).setTarget("GPHM").setSource("SPHM").setData("{\"cmdId\": \"getConfig\"}");
|
|
|
|
|
|
+ message.setType(OrderEnum.ORDER_CONFIG.getType()).setTarget("GPHM").setSource("SPHM")
|
|
|
|
+ .setData("{\"cmdId\": \"getConfig\"}");
|
|
// udp客户端,向服务端发送获取数据请求服务
|
|
// udp客户端,向服务端发送获取数据请求服务
|
|
udpClient.bind("127.0.0.1", 19000, Message.msgToBytes(message));
|
|
udpClient.bind("127.0.0.1", 19000, Message.msgToBytes(message));
|
|
return CommonResult.buildSuccess();
|
|
return CommonResult.buildSuccess();
|