【代码评审】IoT:场景联动的 review
This commit is contained in:
parent
2585c4753a
commit
516e3a2387
|
@ -185,11 +185,12 @@ public class IotDeviceController {
|
||||||
return success(deviceService.getMqttConnectionParams(deviceId));
|
return success(deviceService.getMqttConnectionParams(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @haohao:可以使用 @RequestParam("productKey") String productKey, @RequestParam("deviceNames") List<String> deviceNames 来接收哇?
|
||||||
@GetMapping("/list-by-product-key-and-names")
|
@GetMapping("/list-by-product-key-and-names")
|
||||||
@Operation(summary = "通过产品标识和设备名称列表获取设备")
|
@Operation(summary = "通过产品标识和设备名称列表获取设备")
|
||||||
@PreAuthorize("@ss.hasPermission('iot:device:query')")
|
@PreAuthorize("@ss.hasPermission('iot:device:query')")
|
||||||
public CommonResult<List<IotDeviceRespVO>> getDevicesByProductKeyAndNames(@Valid IotDeviceByProductKeyAndNamesReqVO reqVO) {
|
public CommonResult<List<IotDeviceRespVO>> getDevicesByProductKeyAndNames(@Valid IotDeviceByProductKeyAndNamesReqVO reqVO) {
|
||||||
List<IotDeviceDO> devices = deviceService.getDevicesByProductKeyAndNames(reqVO.getProductKey(), reqVO.getDeviceNames());
|
List<IotDeviceDO> devices = deviceService.getDeviceListByProductKeyAndNames(reqVO.getProductKey(), reqVO.getDeviceNames());
|
||||||
return success(BeanUtils.toBean(devices, IotDeviceRespVO.class));
|
return success(BeanUtils.toBean(devices, IotDeviceRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,9 @@ public class IotProductController {
|
||||||
@PreAuthorize("@ss.hasPermission('iot:product:query')")
|
@PreAuthorize("@ss.hasPermission('iot:product:query')")
|
||||||
public CommonResult<IotProductRespVO> getProduct(@RequestParam("id") Long id) {
|
public CommonResult<IotProductRespVO> getProduct(@RequestParam("id") Long id) {
|
||||||
IotProductDO product = productService.getProduct(id);
|
IotProductDO product = productService.getProduct(id);
|
||||||
|
if (product == null) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId());
|
IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId());
|
||||||
return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> {
|
return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> {
|
||||||
|
@ -99,6 +102,9 @@ public class IotProductController {
|
||||||
@PreAuthorize("@ss.hasPermission('iot:product:query')")
|
@PreAuthorize("@ss.hasPermission('iot:product:query')")
|
||||||
public CommonResult<IotProductRespVO> getProductByKey(@RequestParam("productKey") String productKey) {
|
public CommonResult<IotProductRespVO> getProductByKey(@RequestParam("productKey") String productKey) {
|
||||||
IotProductDO product = productService.getProductByProductKey(productKey);
|
IotProductDO product = productService.getProductByProductKey(productKey);
|
||||||
|
if (product == null) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
// 拼接数据
|
// 拼接数据
|
||||||
IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId());
|
IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId());
|
||||||
return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> {
|
return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> {
|
||||||
|
|
|
@ -145,6 +145,7 @@ public class IotRuleSceneDO extends TenantBaseDO {
|
||||||
public static class TriggerConditionParameter {
|
public static class TriggerConditionParameter {
|
||||||
|
|
||||||
// TODO @芋艿: identifier0 存事件和服务的 identifier 属性的情况 identifier0 就为 null 解决前端回显问题
|
// TODO @芋艿: identifier0 存事件和服务的 identifier 属性的情况 identifier0 就为 null 解决前端回显问题
|
||||||
|
// TODO @haohao:可以根据 TriggerCondition.type 判断,是服务、还是事件、还是属性么?
|
||||||
/**
|
/**
|
||||||
* 标识符(事件、服务)
|
* 标识符(事件、服务)
|
||||||
*
|
*
|
||||||
|
|
|
@ -226,6 +226,6 @@ public interface IotDeviceService {
|
||||||
* @param deviceNames 设备名称列表
|
* @param deviceNames 设备名称列表
|
||||||
* @return 设备列表
|
* @return 设备列表
|
||||||
*/
|
*/
|
||||||
List<IotDeviceDO> getDevicesByProductKeyAndNames(String productKey, List<String> deviceNames);
|
List<IotDeviceDO> getDeviceListByProductKeyAndNames(String productKey, List<String> deviceNames);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,7 +452,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IotDeviceDO> getDevicesByProductKeyAndNames(String productKey, List<String> deviceNames) {
|
public List<IotDeviceDO> getDeviceListByProductKeyAndNames(String productKey, List<String> deviceNames) {
|
||||||
if (StrUtil.isBlank(productKey) || CollUtil.isEmpty(deviceNames)) {
|
if (StrUtil.isBlank(productKey) || CollUtil.isEmpty(deviceNames)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue