【功能完善】IoT: 重命名插件模块,重构插件管理逻辑,优化代码结构,更新配置文件以支持新插件架构。
This commit is contained in:
parent
916024b891
commit
698cec92bd
|
@ -10,7 +10,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>yudao-module-iot-api</module>
|
<module>yudao-module-iot-api</module>
|
||||||
<module>yudao-module-iot-biz</module>
|
<module>yudao-module-iot-biz</module>
|
||||||
<module>yudao-module-iot-plugin</module>
|
<module>yudao-module-iot-plugins</module>
|
||||||
</modules>
|
</modules>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>yudao-module-iot-plugin</artifactId>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<version>2.2.0-snapshot</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>yudao-module-iot-plugin-http</artifactId>
|
|
||||||
<name>${project.artifactId}</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>物联网 插件模块 - http 插件</description>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
<version>3.2.4</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>shade</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<transformers>
|
|
||||||
<transformer>
|
|
||||||
<mainClass>com.example.HttpPluginSpringbootApplication</mainClass>
|
|
||||||
</transformer>
|
|
||||||
</transformers>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<properties>
|
|
||||||
<plugin.id>${project.artifactId}</plugin.id>
|
|
||||||
<plugin.description>${project.artifactId}-${project.version}</plugin.description>
|
|
||||||
<plugin.class>cn.iocoder.yudao.module.iot.config.HttpVertxPlugin</plugin.class>
|
|
||||||
<plugin.version>${project.version}</plugin.version>
|
|
||||||
<plugin.provider>yudao</plugin.provider>
|
|
||||||
</properties>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
plugin.id=yudao-module-iot-plugin-http
|
|
||||||
plugin.class=cn.iocoder.yudao.module.iot.config.HttpVertxPlugin
|
|
||||||
plugin.version=1.0.0
|
|
||||||
plugin.provider=yudao
|
|
||||||
plugin.dependencies=
|
|
||||||
plugin.description=yudao-module-iot-plugin-http-1.0.0
|
|
|
@ -1,26 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.iot;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.WebApplicationType;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
// TODO @haohao:建议包名:cn.iocoder.yudao.module.iot.plugin.${pluginName},例如说 http。然后子包如下:
|
|
||||||
// config:方配置类,以及 HttpVertxPlugin 初始化
|
|
||||||
// service:放 HttpVertxHandler 逻辑;
|
|
||||||
@SpringBootApplication
|
|
||||||
public class HttpPluginSpringbootApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// SpringApplication.run(HttpPluginSpringbootApplication.class, args);
|
|
||||||
SpringApplication application = new SpringApplication(HttpPluginSpringbootApplication.class);
|
|
||||||
application.setWebApplicationType(WebApplicationType.NONE);
|
|
||||||
application.run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO @haohao:如下是 sdk 的包:cn.iocoder.yudao.module.iot.plugin.sdk
|
|
||||||
// 1. api 包:实现 DeviceDataApi 接口,通过 resttemplate 调用
|
|
||||||
// 2. config 包:初始化 DeviceDataApi 等等
|
|
||||||
|
|
||||||
// 3. 其中 resttemplate 调用的后端地址,通过每个服务的 application.yaml 进行注入。
|
|
|
@ -1,69 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.iot.config;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi;
|
|
||||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDeviceEventReportReqDTO;
|
|
||||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
|
|
||||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDeviceStatusUpdateReqDTO;
|
|
||||||
import org.pf4j.DefaultPluginManager;
|
|
||||||
import org.pf4j.PluginWrapper;
|
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
// TODO 芋艿:临时实现;
|
|
||||||
@Configuration
|
|
||||||
public class TestConfiguration {
|
|
||||||
|
|
||||||
// @Resource
|
|
||||||
// private RestTemplate restTemplate;
|
|
||||||
|
|
||||||
// TODO 芋艿:这里,后续看看怎么创建好点
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate() {
|
|
||||||
return new RestTemplateBuilder().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public DeviceDataApi deviceDataApi(RestTemplate restTemplate) {
|
|
||||||
return new DeviceDataApi() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<Boolean> updateDeviceStatus(IotDeviceStatusUpdateReqDTO updateReqDTO) {
|
|
||||||
// TODO haohao:待实现
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<Boolean> reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO) {
|
|
||||||
// TODO haohao:待实现
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommonResult<Boolean> reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO) {
|
|
||||||
// TODO haohao:待完整实现
|
|
||||||
String url = "http://127.0.0.1:48080/rpc-api/iot/device-data/report-property";
|
|
||||||
try {
|
|
||||||
restTemplate.postForObject(url, reportReqDTO, CommonResult.class);
|
|
||||||
return success(true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return CommonResult.error(400, "error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO @haohao:可能要看下,有没更好的方式
|
|
||||||
@Bean(initMethod = "start")
|
|
||||||
public HttpVertxPlugin HttpVertxPlugin() {
|
|
||||||
PluginWrapper pluginWrapper = new PluginWrapper(new DefaultPluginManager(), null, null, null);
|
|
||||||
return new HttpVertxPlugin(pluginWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,6 +8,7 @@
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>yudao-module-iot-plugin-common</module>
|
||||||
<module>yudao-module-iot-plugin-http</module>
|
<module>yudao-module-iot-plugin-http</module>
|
||||||
<module>yudao-module-iot-plugin-mqtt</module>
|
<module>yudao-module-iot-plugin-mqtt</module>
|
||||||
<module>yudao-module-iot-plugin-emqx</module>
|
<module>yudao-module-iot-plugin-emqx</module>
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>yudao-module-iot-plugin</artifactId>
|
<artifactId>yudao-module-iot-plugins</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>yudao-module-iot-plugins</artifactId>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>yudao-module-iot-plugin-common</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
物联网 插件 模块 - 通用功能
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 项目依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-iot-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 其他依赖项 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- PF4J -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.pf4j</groupId>
|
||||||
|
<artifactId>pf4j-spring</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,60 @@
|
||||||
|
package cn.iocoder.yudao.module.iot.plugin.common.api;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi;
|
||||||
|
import cn.iocoder.yudao.module.iot.api.device.dto.IotDeviceEventReportReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.iot.api.device.dto.IotDeviceStatusUpdateReqDTO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class DeviceDataApiClient implements DeviceDataApi {
|
||||||
|
|
||||||
|
private final RestTemplate restTemplate;
|
||||||
|
private final String deviceDataUrl;
|
||||||
|
|
||||||
|
// 可以通过构造器把 RestTemplate 和 baseUrl 注入进来
|
||||||
|
public DeviceDataApiClient(RestTemplate restTemplate, String deviceDataUrl) {
|
||||||
|
this.restTemplate = restTemplate;
|
||||||
|
this.deviceDataUrl = deviceDataUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> updateDeviceStatus(IotDeviceStatusUpdateReqDTO updateReqDTO) {
|
||||||
|
// 示例:如果对应的远程地址是 /rpc-api/iot/device-data/update-status
|
||||||
|
String url = deviceDataUrl + "/rpc-api/iot/device-data/update-status";
|
||||||
|
return doPost(url, updateReqDTO, "updateDeviceStatus");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO) {
|
||||||
|
// 示例:如果对应的远程地址是 /rpc-api/iot/device-data/report-event
|
||||||
|
String url = deviceDataUrl + "/rpc-api/iot/device-data/report-event";
|
||||||
|
return doPost(url, reportReqDTO, "reportDeviceEventData");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO) {
|
||||||
|
// 示例:如果对应的远程地址是 /rpc-api/iot/device-data/report-property
|
||||||
|
String url = deviceDataUrl + "/rpc-api/iot/device-data/report-property";
|
||||||
|
return doPost(url, reportReqDTO, "reportDevicePropertyData");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将与远程服务交互的通用逻辑抽取成一个私有方法
|
||||||
|
*/
|
||||||
|
private <T> CommonResult<Boolean> doPost(String url, T requestBody, String actionName) {
|
||||||
|
log.info("[{}] Sending request to URL: {}", actionName, url);
|
||||||
|
try {
|
||||||
|
// 这里指定返回类型为 CommonResult<?>,根据后台服务返回的实际结构做调整
|
||||||
|
restTemplate.postForObject(url, requestBody, CommonResult.class);
|
||||||
|
return success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[{}] Error sending request to URL: {}", actionName, url, e);
|
||||||
|
return CommonResult.error(400, "Request error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package cn.iocoder.yudao.module.iot.plugin.common.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi;
|
||||||
|
import cn.iocoder.yudao.module.iot.plugin.common.api.DeviceDataApiClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class DeviceDataApiInitializer {
|
||||||
|
|
||||||
|
@Value("${iot.device-data.url}")
|
||||||
|
private String deviceDataUrl;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate() {
|
||||||
|
// 如果你有更多的自定义需求,比如连接池、超时时间等,可以在这里设置
|
||||||
|
return new RestTemplateBuilder().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DeviceDataApi deviceDataApi(RestTemplate restTemplate) {
|
||||||
|
// 返回我们自定义的 Client 实例
|
||||||
|
return new DeviceDataApiClient(restTemplate, deviceDataUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
package cn.iocoder.yudao.module.iot.plugin.common;
|
|
@ -4,7 +4,7 @@
|
||||||
http://maven.apache.org/POM/4.0.0
|
http://maven.apache.org/POM/4.0.0
|
||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>yudao-module-iot-plugin</artifactId>
|
<artifactId>yudao-module-iot-plugins</artifactId>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
|
@ -0,0 +1,6 @@
|
||||||
|
plugin.id=yudao-module-iot-plugin-http
|
||||||
|
plugin.class=cn.iocoder.yudao.module.iot.plugin.http.config.HttpVertxPlugin
|
||||||
|
plugin.version=1.0.0
|
||||||
|
plugin.provider=yudao
|
||||||
|
plugin.dependencies=
|
||||||
|
plugin.description=yudao-module-iot-plugin-http-1.0.0
|
|
@ -4,7 +4,7 @@
|
||||||
http://maven.apache.org/POM/4.0.0
|
http://maven.apache.org/POM/4.0.0
|
||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>yudao-module-iot-plugin</artifactId>
|
<artifactId>yudao-module-iot-plugins</artifactId>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<!-- 插件相关 -->
|
<!-- 插件相关 -->
|
||||||
<plugin.id>${project.artifactId}</plugin.id>
|
<plugin.id>${project.artifactId}</plugin.id>
|
||||||
<plugin.class>cn.iocoder.yudao.module.iot.config.HttpVertxPlugin</plugin.class>
|
<plugin.class>cn.iocoder.yudao.module.iot.plugin.http.config.HttpVertxPlugin</plugin.class>
|
||||||
<plugin.version>${project.version}</plugin.version>
|
<plugin.version>${project.version}</plugin.version>
|
||||||
<plugin.provider>yudao</plugin.provider>
|
<plugin.provider>yudao</plugin.provider>
|
||||||
<plugin.description>${project.artifactId}-${project.version}</plugin.description>
|
<plugin.description>${project.artifactId}-${project.version}</plugin.description>
|
||||||
|
@ -121,26 +121,12 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 其他依赖项 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- PF4J Spring 集成 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.pf4j</groupId>
|
|
||||||
<artifactId>pf4j-spring</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- 项目依赖 -->
|
<!-- 项目依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>yudao-module-iot-api</artifactId>
|
<artifactId>yudao-module-iot-plugin-common</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Vert.x Web -->
|
<!-- Vert.x Web -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.vertx</groupId>
|
<groupId>io.vertx</groupId>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.iocoder.yudao.module.iot.plugin.http;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.WebApplicationType;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication(scanBasePackages = "cn.iocoder.yudao.module.iot.plugin")
|
||||||
|
public class HttpPluginSpringbootApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication application = new SpringApplication(HttpPluginSpringbootApplication.class);
|
||||||
|
application.setWebApplicationType(WebApplicationType.NONE);
|
||||||
|
application.run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.iocoder.yudao.module.iot.config;
|
package cn.iocoder.yudao.module.iot.plugin.http.config;
|
||||||
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi;
|
import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi;
|
||||||
import cn.iocoder.yudao.module.iot.service.HttpVertxHandler;
|
import cn.iocoder.yudao.module.iot.plugin.http.service.HttpVertxHandler;
|
||||||
import io.vertx.core.Vertx;
|
import io.vertx.core.Vertx;
|
||||||
import io.vertx.ext.web.Router;
|
import io.vertx.ext.web.Router;
|
||||||
import io.vertx.ext.web.handler.BodyHandler;
|
import io.vertx.ext.web.handler.BodyHandler;
|
|
@ -0,0 +1,16 @@
|
||||||
|
package cn.iocoder.yudao.module.iot.plugin.http.config;
|
||||||
|
|
||||||
|
import org.pf4j.DefaultPluginManager;
|
||||||
|
import org.pf4j.PluginWrapper;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class HttpVertxPluginConfiguration {
|
||||||
|
|
||||||
|
@Bean(initMethod = "start")
|
||||||
|
public HttpVertxPlugin httpVertxPlugin() {
|
||||||
|
PluginWrapper pluginWrapper = new PluginWrapper(new DefaultPluginManager(), null, null, null);
|
||||||
|
return new HttpVertxPlugin(pluginWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.iocoder.yudao.module.iot.service;
|
package cn.iocoder.yudao.module.iot.plugin.http.service;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
|
@ -1,3 +1,7 @@
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: yudao-module-iot-plugin-http
|
name: yudao-module-iot-plugin-http
|
||||||
|
|
||||||
|
iot:
|
||||||
|
device-data:
|
||||||
|
url: http://127.0.0.1:48080
|
|
@ -4,7 +4,7 @@
|
||||||
http://maven.apache.org/POM/4.0.0
|
http://maven.apache.org/POM/4.0.0
|
||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>yudao-module-iot-plugin</artifactId>
|
<artifactId>yudao-module-iot-plugins</artifactId>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
Loading…
Reference in New Issue