57 lines
1.6 KiB
Java
57 lines
1.6 KiB
Java
package com.template.controller;
|
||
|
||
import com.muyu.common.core.domain.Result;
|
||
import com.template.domain.Template;
|
||
import com.template.service.TemplateService;
|
||
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
||
import org.apache.iotdb.rpc.StatementExecutionException;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.web.bind.annotation.PostMapping;
|
||
import org.springframework.web.bind.annotation.RequestMapping;
|
||
import org.springframework.web.bind.annotation.RequestParam;
|
||
import org.springframework.web.bind.annotation.RestController;
|
||
|
||
import java.sql.SQLException;
|
||
import java.util.List;
|
||
import java.util.concurrent.ExecutionException;
|
||
|
||
/**
|
||
* @Author:liuxinyue
|
||
* @Package:com.template.controller
|
||
* @Project:cloud-server-c
|
||
* @name:TemplateController
|
||
* @Date:2024/9/20 12:12
|
||
*/
|
||
@RestController
|
||
@RequestMapping("/template")
|
||
public class TemplateController {
|
||
|
||
@Autowired
|
||
private TemplateService templateService;
|
||
|
||
|
||
/**
|
||
* 报文模版列表
|
||
* @return
|
||
*/
|
||
@PostMapping("/templateList")
|
||
public Result<List<Template>> templateList() {
|
||
return Result.success(templateService.templateList());
|
||
}
|
||
|
||
|
||
/**
|
||
* 解析报文
|
||
* @param templateMessage
|
||
* @return
|
||
*/
|
||
@PostMapping("/messageParsing")
|
||
public Result messageParsing(@RequestParam("templateMessage") String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException, ExecutionException, InterruptedException {
|
||
templateService.messageParsing(templateMessage);
|
||
return Result.success();
|
||
}
|
||
|
||
|
||
|
||
}
|