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 | 39 | |
| 40 | 40 | @Before("@annotation(rateLimiter)") |
| 41 | 41 | public void beforePointCut(JoinPoint joinPoint, RateLimiter rateLimiter) { |
| 42 | - // 获得 IdempotentKeyResolver 对象 | |
| 42 | + // 获得 RateLimiterKeyResolver 对象 | |
| 43 | 43 | RateLimiterKeyResolver keyResolver = keyResolvers.get(rateLimiter.keyResolver()); |
| 44 | 44 | Assert.notNull(keyResolver, "找不到对应的 RateLimiterKeyResolver"); |
| 45 | 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 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| 4 | 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 | 8 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| 6 | 9 | import com.alibaba.excel.annotation.ExcelProperty; |
| 7 | 10 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | 11 | import lombok.Data; |
| 9 | 12 | |
| 13 | +import java.math.BigDecimal; | |
| 10 | 14 | import java.time.LocalDateTime; |
| 11 | 15 | import java.util.Set; |
| 12 | 16 | |
| ... | ... | @@ -82,6 +86,17 @@ public class IotDeviceRespVO { |
| 82 | 86 | @Schema(description = "设备配置", example = "{\"abc\": \"efg\"}") |
| 83 | 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 | 100 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 86 | 101 | @ExcelProperty("创建时间") |
| 87 | 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 | 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 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 6 | import lombok.Data; |
| 5 | 7 | |
| 8 | +import java.math.BigDecimal; | |
| 6 | 9 | import java.util.Set; |
| 7 | 10 | |
| 8 | 11 | @Schema(description = "管理后台 - IoT 设备新增/修改 Request VO") |
| ... | ... | @@ -36,4 +39,14 @@ public class IotDeviceSaveReqVO { |
| 36 | 39 | @Schema(description = "设备配置", example = "{\"abc\": \"efg\"}") |
| 37 | 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 | 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 | 147 | List<IotProductDO> list = productService.getProductList(); |
| 148 | 148 | return success(convertList(list, product -> // 只返回 id、name 字段 |
| 149 | 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 | 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 | 61 | @DictFormat(DictTypeConstants.NET_TYPE) |
| 62 | 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 | 69 | @Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 65 | 70 | @ExcelProperty(value = "数据格式", converter = DictConvert.class) |
| 66 | 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 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | +import cn.iocoder.yudao.module.iot.enums.product.IotLocationTypeEnum; | |
| 4 | 5 | import cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum; |
| 5 | 6 | import cn.iocoder.yudao.module.iot.enums.product.IotProductDeviceTypeEnum; |
| 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -44,6 +45,10 @@ public class IotProductSaveReqVO { |
| 44 | 45 | @InEnum(value = IotNetTypeEnum.class, message = "联网方式必须是 {value}") |
| 45 | 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 | 52 | @Schema(description = "数据格式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| 48 | 53 | @NotEmpty(message = "数据格式不能为空") |
| 49 | 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 | 131 | |
| 132 | 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 | 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 | 69 | * 枚举 {@link cn.iocoder.yudao.module.iot.enums.product.IotNetTypeEnum} |
| 70 | 70 | */ |
| 71 | 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 | 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 | 10 | public static final String PRODUCT_STATUS = "iot_product_status"; |
| 11 | 11 | public static final String PRODUCT_DEVICE_TYPE = "iot_product_device_type"; |
| 12 | 12 | public static final String NET_TYPE = "iot_net_type"; |
| 13 | + public static final String LOACTION_TYPE = "iot_loaction_type"; | |
| 13 | 14 | public static final String CODEC_TYPE = "iot_codec_type"; |
| 14 | 15 | |
| 15 | 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 | +} | ... | ... |