Ver Fonte

获取数链仿真数据/机载PHM数据接口

wanggaokun há 1 ano atrás
pai
commit
9189c5b4d5

+ 26 - 16
PHM-admin/phm-netty/src/main/java/com/phm/netty/controller/NettyUdpClientController.java

@@ -1,21 +1,17 @@
 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.core.controller.BaseController;
-import com.phm.common.core.page.TableDataInfo;
 import com.phm.manage.domain.common.CommonResult;
 import com.phm.netty.client.NettyUdpClient;
 import com.phm.netty.domain.Message;
 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
@@ -29,17 +25,31 @@ public class NettyUdpClientController extends BaseController {
     @Autowired
     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客户端,向服务端发送获取数据请求服务
-        udpClient.bind("", 0, null);
+        udpClient.bind("127.0.0.1", 19000, Message.msgToBytes(message));
         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.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客户端,向服务端发送获取数据请求服务
         udpClient.bind("127.0.0.1", 19000, Message.msgToBytes(message));
         return CommonResult.buildSuccess();