!1383 feat【iot】:iot设备定位部分功能
Merge pull request !1383 from alwayssuper/feature/iot
This commit is contained in:
@@ -39,7 +39,7 @@ public class RateLimiterAspect {
|
||||
|
||||
@Before("@annotation(rateLimiter)")
|
||||
public void beforePointCut(JoinPoint joinPoint, RateLimiter rateLimiter) {
|
||||
// 获得 IdempotentKeyResolver 对象
|
||||
// 获得 RateLimiterKeyResolver 对象
|
||||
RateLimiterKeyResolver keyResolver = keyResolvers.get(rateLimiter.keyResolver());
|
||||
Assert.notNull(keyResolver, "找不到对应的 RateLimiterKeyResolver");
|
||||
// 解析 Key
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.iot.enums.DictTypeConstants;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -82,6 +86,17 @@ public class IotDeviceRespVO {
|
||||
@Schema(description = "设备配置", example = "{\"abc\": \"efg\"}")
|
||||
private String config;
|
||||
|
||||
@Schema(description = "定位方式", example = "2")
|
||||
@ExcelProperty(value = "定位方式", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.LOACTION_TYPE)
|
||||
private Integer locationType;
|
||||
|
||||
@Schema(description = "设备位置的纬度", example = "45.000000")
|
||||
private BigDecimal latitude;
|
||||
|
||||
@Schema(description = "设备位置的经度", example = "45.000000")
|
||||
private BigDecimal longitude;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - IoT 设备新增/修改 Request VO")
|
||||
@@ -36,4 +39,14 @@ public class IotDeviceSaveReqVO {
|
||||
@Schema(description = "设备配置", example = "{\"abc\": \"efg\"}")
|
||||
private String config;
|
||||
|
||||
@Schema(description = "定位类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(value = IotLocationTypeEnum.class, message = "定位方式必须是 {value}")
|
||||
private Integer locationType;
|
||||
|
||||
@Schema(description = "设备位置的纬度", example = "16380")
|
||||
private BigDecimal latitude;
|
||||
|
||||
@Schema(description = "设备位置的经度", example = "16380")
|
||||
private BigDecimal longitude;
|
||||
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class IotProductController {
|
||||
List<IotProductDO> list = productService.getProductList();
|
||||
return success(convertList(list, product -> // 只返回 id、name 字段
|
||||
new IotProductRespVO().setId(product.getId()).setName(product.getName())
|
||||
.setDeviceType(product.getDeviceType())));
|
||||
.setDeviceType(product.getDeviceType()).setLocationType(product.getLocationType())));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,6 +61,11 @@ public class IotProductRespVO {
|
||||
@DictFormat(DictTypeConstants.NET_TYPE)
|
||||
private Integer netType;
|
||||
|
||||
@Schema(description = "定位方式", example = "2")
|
||||
@ExcelProperty(value = "定位方式", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.LOACTION_TYPE)
|
||||
private Integer locationType;
|
||||
|
||||
@Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty(value = "数据格式", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.CODEC_TYPE)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.product.IotProductDeviceTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -44,6 +45,10 @@ public class IotProductSaveReqVO {
|
||||
@InEnum(value = IotNetTypeEnum.class, message = "联网方式必须是 {value}")
|
||||
private Integer netType;
|
||||
|
||||
@Schema(description = "定位类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||
@InEnum(value = IotLocationTypeEnum.class, message = "定位方式必须是 {value}")
|
||||
private Integer locationType;
|
||||
|
||||
@Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "数据格式不能为空")
|
||||
private String codecType;
|
||||
|
||||
@@ -130,6 +130,12 @@ public class IotDeviceDO extends TenantBaseDO {
|
||||
private String authType;
|
||||
|
||||
// TODO @芋艿:【待定 002】:1)设备维护的时候,设置位置?类似 tl?;2)设备上传的时候,设置位置,类似 it?
|
||||
/**
|
||||
* 定位方式
|
||||
* <p>
|
||||
* 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum}
|
||||
*/
|
||||
private Integer locationType;
|
||||
/**
|
||||
* 设备位置的纬度
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,12 @@ public class IotProductDO extends TenantBaseDO {
|
||||
* 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum}
|
||||
*/
|
||||
private Integer netType;
|
||||
|
||||
/**
|
||||
* 定位方式
|
||||
* <p>
|
||||
* 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum}
|
||||
*/
|
||||
private Integer locationType;
|
||||
/**
|
||||
* 数据格式(编解码器类型)
|
||||
* <p>
|
||||
|
||||
@@ -10,6 +10,7 @@ public class DictTypeConstants {
|
||||
public static final String PRODUCT_STATUS = "iot_product_status";
|
||||
public static final String PRODUCT_DEVICE_TYPE = "iot_product_device_type";
|
||||
public static final String NET_TYPE = "iot_net_type";
|
||||
public static final String LOACTION_TYPE = "iot_loaction_type";
|
||||
public static final String CODEC_TYPE = "iot_codec_type";
|
||||
|
||||
public static final String DEVICE_STATE = "iot_device_state";
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.iot.enums.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IoT 定位方式枚举类
|
||||
*
|
||||
* @author alwayssuper
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum IotLocationTypeEnum implements ArrayValuable<Integer> {
|
||||
MANUAL(0, "手动定位"),
|
||||
IP(1, "IP定位"),
|
||||
MODULE(2, "定位模块定位");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotLocationTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@
|
||||
AND ts <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY time
|
||||
GROUP BY TIMETRUNCATE(ts, 1h)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user