Browse Source

HelloWorld增加createAlarm

menglu 3 years ago
parent
commit
37cba5b24a
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/main/java/com/persagy/controller/HelloWorld.java

+ 9 - 0
src/main/java/com/persagy/controller/HelloWorld.java

@@ -37,6 +37,15 @@ public class HelloWorld {
     AlarmRecordRepository alarmRecordRepository;
     @Autowired
     NettyClient nettyClient;
+    
+    @PostMapping("/createAlarm")
+    public String createAlarm(@RequestBody JSONObject jsonObject) throws Exception {
+        NettyMessage nettyMessage = new NettyMessage(5);
+        nettyMessage.setRemark("连接已经建立;");
+        nettyMessage.setContent(Arrays.asList(jsonObject));
+        nettyClient.sendMessage(nettyMessage);
+        return "hello world!";
+    }
 
     @PostMapping("/")
     public String world(@RequestBody JSONObject jsonObject) throws Exception {