!26 openapi模块接口更新推送

Merge pull request !26 from dev-V0.4.5
V0.5.x
花木水之间 2023-08-11 02:29:16 +00:00 committed by Gitee
commit 11dcbd59b5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 50 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import cc.iotkit.model.InvokeResult;
import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.openapi.dto.bo.device.OpenapiDeviceBo;
import cc.iotkit.openapi.dto.bo.device.OpenapiSetDeviceServicePropertyBo;
import cc.iotkit.openapi.dto.vo.OpenDeviceInfoVo;
import cc.iotkit.openapi.dto.vo.OpenDevicePropertyVo;
import cc.iotkit.openapi.service.OpenBaseService;
import cc.iotkit.openapi.service.OpenDeviceService;
@ -40,7 +41,7 @@ public class OpenDeviceController {
@ApiOperation(value = "单个设备注册")
@PostMapping("/v1/registerDevice")
public boolean createDevice(@RequestBody @Validated Request<OpenapiDeviceBo> bo) {
public OpenDeviceInfoVo createDevice(@RequestBody @Validated Request<OpenapiDeviceBo> bo) {
return openDeviceService.addDevice(bo.getData());
}

View File

@ -0,0 +1,43 @@
package cc.iotkit.openapi.dto.vo;
import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.model.product.ThingModel;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel(value = "OpenDeviceInfoVo")
@Data
@AutoMapper(target = DeviceInfo.class)
public class OpenDeviceInfoVo {
private String id;
private String deviceId;
/**
* key
*/
private String productKey;
private String deviceName;
/**
*
*/
private String model;
/**
*
*/
private String secret;
private String parentId;
/**
* ID
*/
private String uid;
private Long createAt;
}

View File

@ -2,6 +2,7 @@ package cc.iotkit.openapi.service;
import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.openapi.dto.bo.device.OpenapiDeviceBo;
import cc.iotkit.openapi.dto.vo.OpenDeviceInfoVo;
import cc.iotkit.openapi.dto.vo.OpenDevicePropertyVo;
import java.util.Map;
@ -15,7 +16,7 @@ import java.util.Map;
public interface OpenDeviceService {
DeviceInfo getDetail(OpenapiDeviceBo bo);
boolean addDevice(OpenapiDeviceBo bo);
OpenDeviceInfoVo addDevice(OpenapiDeviceBo bo);
boolean deleteDevice(OpenapiDeviceBo bo);

View File

@ -14,6 +14,7 @@ import cc.iotkit.model.device.message.ThingModelMessage;
import cc.iotkit.model.product.Product;
import cc.iotkit.model.product.ThingModel;
import cc.iotkit.openapi.dto.bo.device.OpenapiDeviceBo;
import cc.iotkit.openapi.dto.vo.OpenDeviceInfoVo;
import cc.iotkit.openapi.dto.vo.OpenDevicePropertyVo;
import cc.iotkit.openapi.dto.vo.OpenPropertyVo;
import cc.iotkit.openapi.service.OpenDeviceService;
@ -55,7 +56,7 @@ public class OpenDeviceServiceImpl implements OpenDeviceService {
}
@Override
public boolean addDevice(OpenapiDeviceBo bo) {
public OpenDeviceInfoVo addDevice(OpenapiDeviceBo bo) {
String productKey = bo.getProductKey();
String deviceName = bo.getDeviceName();
String parentId = bo.getParentId();
@ -91,7 +92,7 @@ public class OpenDeviceServiceImpl implements OpenDeviceService {
device.setParentId(parentId);
}
deviceInfoData.save(device);
return true;
return MapstructUtils.convert(device, OpenDeviceInfoVo.class);
}
@Override