yangys
2024-09-05 312fd03ae1ee528892129a10630d44de92c73c37
collect/src/main/java/com/qianwen/mdc/collect/controller/MqttController.java
@@ -36,19 +36,7 @@
        return "Message sent to topic " + topic;
    }
    
    @GetMapping("/create")
    public String create(@RequestParam String topic, @RequestParam String message) {
       try {
         iotdbCfg.getSessionPool().createTimeseries("root.f2.myt1", TSDataType.UNKNOWN, null, null);
      } catch (IoTDBConnectionException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (StatementExecutionException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
        return "Message sent to topic " + topic;
    }
    @GetMapping("/rec2")
    public void testRec2() {
       //数据格式:{"174":[{"values":{"d1":12},"ts":"1721978780449"}]} 174是应用id
@@ -59,6 +47,15 @@
    }
    
    
    @GetMapping("/recalarm")
    public void testAlarm() {
       //数据格式:{"174":[{"values":{"d1":12},"ts":"1721978780449"}]} 174是应用id
       //多条格式:{"174":[{"values":{"DeviceStatus":2},"ts":"1722478128278"},{"values":{"spindleSpeed":22},"ts":"1722478128281"}]}
       String payload = "{\"174\":[{\"values\":{\"Alarm\":\"告警信息1\"},\"ts\":\"1725504995056\"}]}";
       //payload = "{\"174\":[{\"values\":{\"Output\":11},\"ts\":\"1722478128278\"},{\"values\":{\"SpindleSpeed\":22},\"ts\":\"1722478128281\"}]}";
       recService.handle(payload);
    }
    @GetMapping("/tpl")
    public Object tpl(String tplname) throws StatementExecutionException, IoTDBConnectionException {
       boolean b = iotdbCfg.getSessionPool().checkTimeseriesExists("root.f2.output_22005.*");