【功能新增】IoT:验证通过独立、内嵌模式的调用
This commit is contained in:
parent
a152f6d98f
commit
916024b891
Binary file not shown.
|
@ -0,0 +1,17 @@
|
|||
package cn.iocoder.yudao.framework.common.enums;
|
||||
|
||||
/**
|
||||
* RPC 相关的枚举
|
||||
*
|
||||
* 虽然放在 yudao-spring-boot-starter-rpc 会相对合适,但是每个 API 模块需要使用到,所以暂时只好放在此处
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class RpcConstants {
|
||||
|
||||
/**
|
||||
* RPC API 的前缀
|
||||
*/
|
||||
public static final String RPC_API_PREFIX = "/rpc-api";
|
||||
|
||||
}
|
|
@ -21,6 +21,14 @@
|
|||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
|
||||
</dependency>
|
||||
|
||||
<!-- PF4J -->
|
||||
<!-- TODO 芋艿:这个依赖,要不要放在 api 包 -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
package cn.iocoder.yudao.module.iot.api.device;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
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 cn.iocoder.yudao.module.iot.enums.ApiConstants;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
// TODO 芋艿:名字可能看情况改下
|
||||
/**
|
||||
* 设备数据 API
|
||||
*
|
||||
|
@ -10,11 +19,35 @@ import jakarta.validation.Valid;
|
|||
*/
|
||||
public interface DeviceDataApi {
|
||||
|
||||
// TODO @芋艿:可能会调整
|
||||
String PREFIX = ApiConstants.PREFIX + "/device-data";
|
||||
|
||||
/**
|
||||
* 保存设备数据
|
||||
* 更新设备状态
|
||||
*
|
||||
* @param createDTO 设备数据
|
||||
* @param updateReqDTO 更新请求
|
||||
*/
|
||||
void saveDeviceData(@Valid DeviceDataCreateReqDTO createDTO);
|
||||
@PutMapping(PREFIX + "/update-status")
|
||||
@PermitAll // TODO 芋艿:后续看看怎么优化下
|
||||
CommonResult<Boolean> updateDeviceStatus(@Valid @RequestBody IotDeviceStatusUpdateReqDTO updateReqDTO);
|
||||
|
||||
/**
|
||||
* 上报设备事件数据
|
||||
*
|
||||
* @param reportReqDTO 设备事件
|
||||
*/
|
||||
@PostMapping(PREFIX + "/report-event")
|
||||
@PermitAll // TODO 芋艿:后续看看怎么优化下
|
||||
CommonResult<Boolean> reportDeviceEventData(@Valid @RequestBody IotDeviceEventReportReqDTO reportReqDTO);
|
||||
|
||||
/**
|
||||
* 上报设备属性数据
|
||||
*
|
||||
* @param reportReqDTO 设备数据
|
||||
*/
|
||||
@PostMapping(PREFIX + "/report-property")
|
||||
@PermitAll // TODO 芋艿:后续看看怎么优化下
|
||||
CommonResult<Boolean> reportDevicePropertyData(@Valid @RequestBody IotDevicePropertyReportReqDTO reportReqDTO);
|
||||
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package cn.iocoder.yudao.module.iot.api.device.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class DeviceDataCreateReqDTO {
|
||||
|
||||
/**
|
||||
* 产品标识
|
||||
*/
|
||||
@NotNull(message = "产品标识不能为空")
|
||||
private String productKey;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotNull(message = "设备名称不能为空")
|
||||
private String deviceName;
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
@NotNull(message = "消息不能为空")
|
||||
private String message;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package cn.iocoder.yudao.module.iot.api.device.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* IoT 设备【事件】数据上报 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class IotDeviceEventReportReqDTO {
|
||||
|
||||
// TODO 芋艿:要不要 id
|
||||
// TODO 芋艿:要不要 time
|
||||
|
||||
/**
|
||||
* 产品标识
|
||||
*/
|
||||
@NotEmpty(message = "产品标识不能为空")
|
||||
private String productKey;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotEmpty(message = "设备名称不能为空")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 事件标识
|
||||
*/
|
||||
@NotEmpty(message = "事件标识不能为空")
|
||||
private String identifier;
|
||||
/**
|
||||
* 事件参数
|
||||
*/
|
||||
@NotEmpty(message = "事件参数不能为空")
|
||||
private Map<String, Object> params;
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package cn.iocoder.yudao.module.iot.api.device.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* IoT 设备【属性】数据上报 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class IotDevicePropertyReportReqDTO {
|
||||
|
||||
// TODO 芋艿:要不要 id
|
||||
// TODO 芋艿:要不要 time
|
||||
|
||||
/**
|
||||
* 产品标识
|
||||
*/
|
||||
@NotEmpty(message = "产品标识不能为空")
|
||||
private String productKey;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotEmpty(message = "设备名称不能为空")
|
||||
private String deviceName;
|
||||
/**
|
||||
* 属性参数
|
||||
*/
|
||||
@NotEmpty(message = "属性参数不能为空")
|
||||
private Map<String, Object> params;
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package cn.iocoder.yudao.module.iot.api.device.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.device.IotDeviceStatusEnum;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* IoT 设备状态更新 Request DTO
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class IotDeviceStatusUpdateReqDTO {
|
||||
|
||||
// TODO 芋艿:要不要 id
|
||||
// TODO 芋艿:要不要 time
|
||||
|
||||
/**
|
||||
* 产品标识
|
||||
*/
|
||||
@NotEmpty(message = "产品标识不能为空")
|
||||
private String productKey;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotEmpty(message = "设备名称不能为空")
|
||||
private String deviceName;
|
||||
/**
|
||||
* 设备状态
|
||||
*/
|
||||
@NotEmpty(message = "设备状态不能为空")
|
||||
@InEnum(IotDeviceStatusEnum.class) // 只使用:在线、离线
|
||||
private Integer status;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package cn.iocoder.yudao.module.iot.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.RpcConstants;
|
||||
|
||||
/**
|
||||
* API 相关的枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public class ApiConstants {
|
||||
|
||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/iot";
|
||||
|
||||
public static final String VERSION = "1.0.0";
|
||||
|
||||
}
|
|
@ -1,16 +1,21 @@
|
|||
package cn.iocoder.yudao.module.iot.api.device;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
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 cn.iocoder.yudao.module.iot.service.device.IotDevicePropertyDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 设备数据 API 实现类
|
||||
*/
|
||||
@Service
|
||||
@RestController
|
||||
@Validated
|
||||
public class DeviceDataApiImpl implements DeviceDataApi {
|
||||
|
||||
|
@ -18,8 +23,19 @@ public class DeviceDataApiImpl implements DeviceDataApi {
|
|||
private IotDevicePropertyDataService deviceDataService;
|
||||
|
||||
@Override
|
||||
public void saveDeviceData(DeviceDataCreateReqDTO createDTO) {
|
||||
deviceDataService.saveDeviceData(createDTO);
|
||||
public CommonResult<Boolean> updateDeviceStatus(IotDeviceStatusUpdateReqDTO updateReqDTO) {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO) {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO) {
|
||||
deviceDataService.saveDeviceData(reportReqDTO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package cn.iocoder.yudao.module.iot.emq.service;
|
||||
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.service.device.IotDevicePropertyDataService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -34,10 +34,10 @@ public class EmqxServiceImpl implements EmqxService {
|
|||
String productKey = topic.split("/")[2];
|
||||
String deviceName = topic.split("/")[3];
|
||||
String message = new String(mqttMessage.getPayload());
|
||||
DeviceDataCreateReqDTO createDTO = DeviceDataCreateReqDTO.builder()
|
||||
IotDevicePropertyReportReqDTO createDTO = IotDevicePropertyReportReqDTO.builder()
|
||||
.productKey(productKey)
|
||||
.deviceName(deviceName)
|
||||
.message(message)
|
||||
// .properties(message) // TODO 芋艿:临时去掉,看看
|
||||
.build();
|
||||
iotDeviceDataService.saveDeviceData(createDTO);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
// TODO @芋艿:需要 review 下
|
||||
@Slf4j
|
||||
@Configuration
|
||||
|
@ -21,8 +19,8 @@ public class UnifiedConfiguration {
|
|||
// @DependsOn("deviceDataApiImpl")
|
||||
public SpringPluginManager pluginManager() {
|
||||
log.info("[init][实例化 SpringPluginManager]");
|
||||
SpringPluginManager springPluginManager = new SpringPluginManager(Paths.get(pluginsDir)) {
|
||||
// SpringPluginManager springPluginManager = new SpringPluginManager() {
|
||||
// SpringPluginManager springPluginManager = new SpringPluginManager(Paths.get(pluginsDir)) {
|
||||
SpringPluginManager springPluginManager = new SpringPluginManager() {
|
||||
|
||||
@Override
|
||||
public void startPlugins() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package cn.iocoder.yudao.module.iot.service.device;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDataDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
@ -28,7 +28,7 @@ public interface IotDevicePropertyDataService {
|
|||
*
|
||||
* @param createDTO 设备数据
|
||||
*/
|
||||
void saveDeviceData(DeviceDataCreateReqDTO createDTO);
|
||||
void saveDeviceData(IotDevicePropertyReportReqDTO createDTO);
|
||||
|
||||
/**
|
||||
* 获得设备属性最新数据
|
||||
|
|
|
@ -6,7 +6,7 @@ import cn.hutool.core.map.MapUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelDateOrTextDataSpecs;
|
||||
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
|
||||
|
@ -130,11 +130,12 @@ public class IotDevicePropertyDataServiceImpl implements IotDevicePropertyDataSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void saveDeviceData(DeviceDataCreateReqDTO createDTO) {
|
||||
public void saveDeviceData(IotDevicePropertyReportReqDTO createDTO) {
|
||||
// TODO 芋艿:这块需要实现
|
||||
// 1. 根据产品 key 和设备名称,获得设备信息
|
||||
IotDeviceDO device = deviceService.getDeviceByProductKeyAndDeviceName(createDTO.getProductKey(), createDTO.getDeviceName());
|
||||
// 2. 解析消息,保存数据
|
||||
JSONObject jsonObject = new JSONObject(createDTO.getMessage());
|
||||
JSONObject jsonObject = new JSONObject(createDTO.getParams());
|
||||
log.info("[saveDeviceData][productKey({}) deviceName({}) data({})]", createDTO.getProductKey(), createDTO.getDeviceName(), jsonObject);
|
||||
ThingModelMessage thingModelMessage = ThingModelMessage.builder()
|
||||
.id(jsonObject.getStr("id"))
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
<!-- 其他依赖项 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- PF4J Spring 集成 -->
|
||||
<dependency>
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
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.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,23 +1,59 @@
|
|||
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.DeviceDataCreateReqDTO;
|
||||
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 DeviceDataApi deviceDataApi() {
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplateBuilder().build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DeviceDataApi deviceDataApi(RestTemplate restTemplate) {
|
||||
return new DeviceDataApi() {
|
||||
|
||||
@Override
|
||||
public void saveDeviceData(DeviceDataCreateReqDTO createDTO) {
|
||||
System.out.println("saveDeviceData");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.service;
|
|||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.module.iot.api.device.DeviceDataApi;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.DeviceDataCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.ext.web.RequestBody;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
|
@ -46,12 +46,12 @@ public class HttpVertxHandler implements Handler<RoutingContext> {
|
|||
|
||||
try {
|
||||
// 调用主程序的接口保存数据
|
||||
DeviceDataCreateReqDTO createDTO = DeviceDataCreateReqDTO.builder()
|
||||
IotDevicePropertyReportReqDTO createDTO = IotDevicePropertyReportReqDTO.builder()
|
||||
.productKey(productKey)
|
||||
.deviceName(deviceName)
|
||||
.message(jsonData.toString())
|
||||
.params(jsonData) // TODO 芋艿:这块要优化
|
||||
.build();
|
||||
deviceDataApi.saveDeviceData(createDTO);
|
||||
deviceDataApi.reportDevicePropertyData(createDTO);
|
||||
|
||||
// 构造成功响应内容
|
||||
JSONObject successRes = createResponseJson(
|
||||
|
|
Loading…
Reference in New Issue