project-car/cloud-modules/cloud-modules-template/src/main/java/com/template/controller/TemplateController.java

57 lines
1.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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;
/**
* @Authorliuxinyue
* @Packagecom.template.controller
* @Projectcloud-server-c
* @nameTemplateController
* @Date2024/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();
}
}