yangys
2025-11-14 fca5c28c79b061f4db3658f6d9e043024f326962
collect/src/main/java/com/qianwen/mdc/collect/controller/MqttController.java
@@ -36,29 +36,27 @@
        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
       //多条格式:{"174":[{"values":{"DeviceStatus":2},"ts":"1722478128278"},{"values":{"spindleSpeed":22},"ts":"1722478128281"}]}
       String payload = "{\"174\":[{\"values\":{\"DeviceStatus\":2,\"Output\":34},\"ts\":\"1725247557768\"}]}";
       //多条格式:{"174":[{"values":{"DeviceStatus":2},"ts":"1722478128278"},{"values":{"SpindleSpeed":22},"ts":"1722478128281"}]}
       String payload = "{\"182\":[{\"values\":{\"DeviceStatus_n\":2,\"Output\":38},\"ts\":\""+System.currentTimeMillis()+"\"}]}";
       //payload = "{\"174\":[{\"values\":{\"Output\":11},\"ts\":\"1722478128278\"},{\"values\":{\"SpindleSpeed\":22},\"ts\":\"1722478128281\"}]}";
       recService.handle(payload);
    }
    
    
    @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\":\""+System.currentTimeMillis()+"\"}]}";
       //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.*");