Commit 428bc4a9fafd8df3fc3cfe607cf10071c39af987
1 parent
2905efec
feat:iot设备手动上传地图功能
Showing
10 changed files
with
89 additions
and
3 deletions
yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/ratelimiter/core/aop/RateLimiterAspect.java
| @@ -39,7 +39,7 @@ public class RateLimiterAspect { | @@ -39,7 +39,7 @@ public class RateLimiterAspect { | ||
| 39 | 39 | ||
| 40 | @Before("@annotation(rateLimiter)") | 40 | @Before("@annotation(rateLimiter)") |
| 41 | public void beforePointCut(JoinPoint joinPoint, RateLimiter rateLimiter) { | 41 | public void beforePointCut(JoinPoint joinPoint, RateLimiter rateLimiter) { |
| 42 | - // 获得 IdempotentKeyResolver 对象 | 42 | + // 获得 RateLimiterKeyResolver 对象 |
| 43 | RateLimiterKeyResolver keyResolver = keyResolvers.get(rateLimiter.keyResolver()); | 43 | RateLimiterKeyResolver keyResolver = keyResolvers.get(rateLimiter.keyResolver()); |
| 44 | Assert.notNull(keyResolver, "找不到对应的 RateLimiterKeyResolver"); | 44 | Assert.notNull(keyResolver, "找不到对应的 RateLimiterKeyResolver"); |
| 45 | // 解析 Key | 45 | // 解析 Key |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/device/IotDeviceRespVO.java
| 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; | 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 3 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | 4 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | 5 | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| 6 | +import cn.iocoder.yudao.module.iot.enums.DictTypeConstants; | ||
| 7 | +import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum; | ||
| 5 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 8 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | import com.alibaba.excel.annotation.ExcelProperty; | 9 | import com.alibaba.excel.annotation.ExcelProperty; |
| 7 | import io.swagger.v3.oas.annotations.media.Schema; | 10 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | import lombok.Data; | 11 | import lombok.Data; |
| 9 | 12 | ||
| 13 | +import java.math.BigDecimal; | ||
| 10 | import java.time.LocalDateTime; | 14 | import java.time.LocalDateTime; |
| 11 | import java.util.Set; | 15 | import java.util.Set; |
| 12 | 16 | ||
| @@ -82,6 +86,17 @@ public class IotDeviceRespVO { | @@ -82,6 +86,17 @@ public class IotDeviceRespVO { | ||
| 82 | @Schema(description = "设备配置", example = "{\"abc\": \"efg\"}") | 86 | @Schema(description = "设备配置", example = "{\"abc\": \"efg\"}") |
| 83 | private String config; | 87 | private String config; |
| 84 | 88 | ||
| 89 | + @Schema(description = "定位方式", example = "2") | ||
| 90 | + @ExcelProperty(value = "定位方式", converter = DictConvert.class) | ||
| 91 | + @DictFormat(DictTypeConstants.LOACTION_TYPE) | ||
| 92 | + private Integer locationType; | ||
| 93 | + | ||
| 94 | + @Schema(description = "设备位置的纬度", example = "45.000000") | ||
| 95 | + private BigDecimal latitude; | ||
| 96 | + | ||
| 97 | + @Schema(description = "设备位置的经度", example = "45.000000") | ||
| 98 | + private BigDecimal longitude; | ||
| 99 | + | ||
| 85 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 100 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 86 | @ExcelProperty("创建时间") | 101 | @ExcelProperty("创建时间") |
| 87 | private LocalDateTime createTime; | 102 | private LocalDateTime createTime; |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/device/IotDeviceSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; | 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | +import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 6 | import lombok.Data; |
| 5 | 7 | ||
| 8 | +import java.math.BigDecimal; | ||
| 6 | import java.util.Set; | 9 | import java.util.Set; |
| 7 | 10 | ||
| 8 | @Schema(description = "管理后台 - IoT 设备新增/修改 Request VO") | 11 | @Schema(description = "管理后台 - IoT 设备新增/修改 Request VO") |
| @@ -36,4 +39,14 @@ public class IotDeviceSaveReqVO { | @@ -36,4 +39,14 @@ public class IotDeviceSaveReqVO { | ||
| 36 | @Schema(description = "设备配置", example = "{\"abc\": \"efg\"}") | 39 | @Schema(description = "设备配置", example = "{\"abc\": \"efg\"}") |
| 37 | private String config; | 40 | private String config; |
| 38 | 41 | ||
| 42 | + @Schema(description = "定位类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 43 | + @InEnum(value = IotLocationTypeEnum.class, message = "定位方式必须是 {value}") | ||
| 44 | + private Integer locationType; | ||
| 45 | + | ||
| 46 | + @Schema(description = "设备位置的纬度", example = "16380") | ||
| 47 | + private BigDecimal latitude; | ||
| 48 | + | ||
| 49 | + @Schema(description = "设备位置的经度", example = "16380") | ||
| 50 | + private BigDecimal longitude; | ||
| 51 | + | ||
| 39 | } | 52 | } |
| 40 | \ No newline at end of file | 53 | \ No newline at end of file |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java
| @@ -147,7 +147,7 @@ public class IotProductController { | @@ -147,7 +147,7 @@ public class IotProductController { | ||
| 147 | List<IotProductDO> list = productService.getProductList(); | 147 | List<IotProductDO> list = productService.getProductList(); |
| 148 | return success(convertList(list, product -> // 只返回 id、name 字段 | 148 | return success(convertList(list, product -> // 只返回 id、name 字段 |
| 149 | new IotProductRespVO().setId(product.getId()).setName(product.getName()) | 149 | new IotProductRespVO().setId(product.getId()).setName(product.getName()) |
| 150 | - .setDeviceType(product.getDeviceType()))); | 150 | + .setDeviceType(product.getDeviceType()).setLocationType(product.getLocationType()))); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | } | 153 | } |
| 154 | \ No newline at end of file | 154 | \ No newline at end of file |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/vo/product/IotProductRespVO.java
| @@ -61,6 +61,11 @@ public class IotProductRespVO { | @@ -61,6 +61,11 @@ public class IotProductRespVO { | ||
| 61 | @DictFormat(DictTypeConstants.NET_TYPE) | 61 | @DictFormat(DictTypeConstants.NET_TYPE) |
| 62 | private Integer netType; | 62 | private Integer netType; |
| 63 | 63 | ||
| 64 | + @Schema(description = "定位方式", example = "2") | ||
| 65 | + @ExcelProperty(value = "定位方式", converter = DictConvert.class) | ||
| 66 | + @DictFormat(DictTypeConstants.LOACTION_TYPE) | ||
| 67 | + private Integer locationType; | ||
| 68 | + | ||
| 64 | @Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 69 | @Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 65 | @ExcelProperty(value = "数据格式", converter = DictConvert.class) | 70 | @ExcelProperty(value = "数据格式", converter = DictConvert.class) |
| 66 | @DictFormat(DictTypeConstants.CODEC_TYPE) | 71 | @DictFormat(DictTypeConstants.CODEC_TYPE) |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/vo/product/IotProductSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product; | 1 | package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | +import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum; | ||
| 4 | import cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum; | 5 | import cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum; |
| 5 | import cn.iocoder.yudao.module.iot.enums.product.IotProductDeviceTypeEnum; | 6 | import cn.iocoder.yudao.module.iot.enums.product.IotProductDeviceTypeEnum; |
| 6 | import io.swagger.v3.oas.annotations.media.Schema; | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| @@ -44,6 +45,10 @@ public class IotProductSaveReqVO { | @@ -44,6 +45,10 @@ public class IotProductSaveReqVO { | ||
| 44 | @InEnum(value = IotNetTypeEnum.class, message = "联网方式必须是 {value}") | 45 | @InEnum(value = IotNetTypeEnum.class, message = "联网方式必须是 {value}") |
| 45 | private Integer netType; | 46 | private Integer netType; |
| 46 | 47 | ||
| 48 | + @Schema(description = "定位类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 49 | + @InEnum(value = IotLocationTypeEnum.class, message = "定位方式必须是 {value}") | ||
| 50 | + private Integer locationType; | ||
| 51 | + | ||
| 47 | @Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | 52 | @Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 48 | @NotEmpty(message = "数据格式不能为空") | 53 | @NotEmpty(message = "数据格式不能为空") |
| 49 | private String codecType; | 54 | private String codecType; |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDO.java
| @@ -131,6 +131,12 @@ public class IotDeviceDO extends TenantBaseDO { | @@ -131,6 +131,12 @@ public class IotDeviceDO extends TenantBaseDO { | ||
| 131 | 131 | ||
| 132 | // TODO @芋艿:【待定 002】:1)设备维护的时候,设置位置?类似 tl?;2)设备上传的时候,设置位置,类似 it? | 132 | // TODO @芋艿:【待定 002】:1)设备维护的时候,设置位置?类似 tl?;2)设备上传的时候,设置位置,类似 it? |
| 133 | /** | 133 | /** |
| 134 | + * 定位方式 | ||
| 135 | + * <p> | ||
| 136 | + * 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum} | ||
| 137 | + */ | ||
| 138 | + private Integer locationType; | ||
| 139 | + /** | ||
| 134 | * 设备位置的纬度 | 140 | * 设备位置的纬度 |
| 135 | */ | 141 | */ |
| 136 | private BigDecimal latitude; | 142 | private BigDecimal latitude; |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/product/IotProductDO.java
| @@ -69,7 +69,12 @@ public class IotProductDO extends TenantBaseDO { | @@ -69,7 +69,12 @@ public class IotProductDO extends TenantBaseDO { | ||
| 69 | * 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum} | 69 | * 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum} |
| 70 | */ | 70 | */ |
| 71 | private Integer netType; | 71 | private Integer netType; |
| 72 | - | 72 | + /** |
| 73 | + * 定位方式 | ||
| 74 | + * <p> | ||
| 75 | + * 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum} | ||
| 76 | + */ | ||
| 77 | + private Integer locationType; | ||
| 73 | /** | 78 | /** |
| 74 | * 数据格式(编解码器类型) | 79 | * 数据格式(编解码器类型) |
| 75 | * <p> | 80 | * <p> |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/DictTypeConstants.java
| @@ -10,6 +10,7 @@ public class DictTypeConstants { | @@ -10,6 +10,7 @@ public class DictTypeConstants { | ||
| 10 | public static final String PRODUCT_STATUS = "iot_product_status"; | 10 | public static final String PRODUCT_STATUS = "iot_product_status"; |
| 11 | public static final String PRODUCT_DEVICE_TYPE = "iot_product_device_type"; | 11 | public static final String PRODUCT_DEVICE_TYPE = "iot_product_device_type"; |
| 12 | public static final String NET_TYPE = "iot_net_type"; | 12 | public static final String NET_TYPE = "iot_net_type"; |
| 13 | + public static final String LOACTION_TYPE = "iot_loaction_type"; | ||
| 13 | public static final String CODEC_TYPE = "iot_codec_type"; | 14 | public static final String CODEC_TYPE = "iot_codec_type"; |
| 14 | 15 | ||
| 15 | public static final String DEVICE_STATE = "iot_device_state"; | 16 | public static final String DEVICE_STATE = "iot_device_state"; |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/product/IotLocationTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.enums.product; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.ArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * IoT 定位方式枚举类 | ||
| 11 | + * | ||
| 12 | + * @author alwayssuper | ||
| 13 | + */ | ||
| 14 | +@AllArgsConstructor | ||
| 15 | +@Getter | ||
| 16 | +public enum IotLocationTypeEnum implements ArrayValuable<Integer> { | ||
| 17 | + MANUAL(0, "手动定位"), | ||
| 18 | + IP(1, "IP定位"), | ||
| 19 | + MODULE(2, "定位模块定位"); | ||
| 20 | + | ||
| 21 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotLocationTypeEnum::getType).toArray(Integer[]::new); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 类型 | ||
| 25 | + */ | ||
| 26 | + private final Integer type; | ||
| 27 | + /** | ||
| 28 | + * 描述 | ||
| 29 | + */ | ||
| 30 | + private final String description; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public Integer[] array() { | ||
| 34 | + return ARRAYS; | ||
| 35 | + } | ||
| 36 | +} |