Commit 9b9fd30c90bfb88d1ad61ef314ffab73e18264ea
1 parent
3a2c691a
【代码重构】IoT:产品放到 product 子目录下
Showing
11 changed files
with
65 additions
and
63 deletions
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java
| ... | ... | @@ -3,10 +3,9 @@ package cn.iocoder.yudao.module.iot.controller.admin.product; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductRespVO; | |
| 8 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSaveReqVO; | |
| 9 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSimpleRespVO; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductRespVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO; | |
| 10 | 9 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 11 | 10 | import cn.iocoder.yudao.module.iot.service.product.IotProductService; |
| 12 | 11 | import io.swagger.v3.oas.annotations.Operation; |
| ... | ... | @@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.*; |
| 21 | 20 | import java.util.List; |
| 22 | 21 | |
| 23 | 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 24 | 24 | |
| 25 | 25 | @Tag(name = "管理后台 - IoT 产品") |
| 26 | 26 | @RestController |
| ... | ... | @@ -86,9 +86,10 @@ public class IotProductController { |
| 86 | 86 | @GetMapping("/simple-list") |
| 87 | 87 | @Operation(summary = "获得所有产品列表") |
| 88 | 88 | @PreAuthorize("@ss.hasPermission('iot:product:query')") |
| 89 | - public CommonResult<List<IotProductSimpleRespVO>> getSimpleProductList() { | |
| 89 | + public CommonResult<List<IotProductRespVO>> getSimpleProductList() { | |
| 90 | 90 | List<IotProductDO> list = productService.getProductList(); |
| 91 | - return success(BeanUtils.toBean(list, IotProductSimpleRespVO.class)); | |
| 91 | + return success(convertList(list, product -> // 只返回 id、name 字段 | |
| 92 | + new IotProductRespVO().setId(product.getId()).setName(product.getName()))); | |
| 92 | 93 | } |
| 93 | 94 | |
| 94 | 95 | } |
| 95 | 96 | \ 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/IotProductSimpleRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.product.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -@Schema(description = "管理后台 - IoT 产品 Response VO") | |
| 7 | -@Data | |
| 8 | -public class IotProductSimpleRespVO { | |
| 9 | - | |
| 10 | - @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "26087") | |
| 11 | - private Long id; | |
| 12 | - | |
| 13 | - @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") | |
| 14 | - private String name; | |
| 15 | - | |
| 16 | -} | |
| 17 | 0 | \ 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/IotProductPageReqVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/vo/product/IotProductPageReqVO.java
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/vo/IotProductRespVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/vo/product/IotProductRespVO.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.product.vo; | |
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.product.vo.product; | |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | 4 | import com.alibaba.excel.annotation.ExcelProperty; |
| ... | ... | @@ -20,34 +20,23 @@ public class IotProductRespVO { |
| 20 | 20 | @ExcelProperty("产品名称") |
| 21 | 21 | private String name; |
| 22 | 22 | |
| 23 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 24 | - @ExcelProperty("创建时间") | |
| 25 | - private LocalDateTime createTime; | |
| 26 | - | |
| 27 | 23 | @Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED) |
| 28 | 24 | @ExcelProperty("产品标识") |
| 29 | 25 | private String productKey; |
| 30 | 26 | |
| 31 | - @Schema(description = "接入网关协议", example = "2") | |
| 32 | - @ExcelProperty("接入网关协议") | |
| 33 | - private Integer protocolType; | |
| 27 | + @Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 28 | + private Long categoryId; | |
| 34 | 29 | |
| 35 | - @Schema(description = "协议编号(脚本解析 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13177") | |
| 36 | - @ExcelProperty("协议编号(脚本解析 id)") | |
| 37 | - private Long protocolId; | |
| 30 | + @Schema(description = "产品图标", example = "https://iocoder.cn/1.svg") | |
| 31 | + private String icon; | |
| 38 | 32 | |
| 39 | - @Schema(description = "产品所属品类标识符", example = "14237") | |
| 40 | - @ExcelProperty("产品所属品类标识符") | |
| 41 | - private Long categoryId; | |
| 33 | + @Schema(description = "产品图标", example = "https://iocoder.cn/1.png") | |
| 34 | + private String picUrl; | |
| 42 | 35 | |
| 43 | 36 | @Schema(description = "产品描述", example = "你猜") |
| 44 | 37 | @ExcelProperty("产品描述") |
| 45 | 38 | private String description; |
| 46 | 39 | |
| 47 | - @Schema(description = "数据校验级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 48 | - @ExcelProperty("数据校验级别") | |
| 49 | - private Integer validateType; | |
| 50 | - | |
| 51 | 40 | @Schema(description = "产品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 52 | 41 | @ExcelProperty("产品状态") |
| 53 | 42 | private Integer status; |
| ... | ... | @@ -60,8 +49,24 @@ public class IotProductRespVO { |
| 60 | 49 | @ExcelProperty("联网方式") |
| 61 | 50 | private Integer netType; |
| 62 | 51 | |
| 52 | + @Schema(description = "接入网关协议", example = "2") | |
| 53 | + @ExcelProperty("接入网关协议") | |
| 54 | + private Integer protocolType; | |
| 55 | + | |
| 56 | + @Schema(description = "协议编号(脚本解析 id)", requiredMode = Schema.RequiredMode.REQUIRED, example = "13177") | |
| 57 | + @ExcelProperty("协议编号(脚本解析 id)") | |
| 58 | + private Long protocolId; | |
| 59 | + | |
| 63 | 60 | @Schema(description = "数据格式") |
| 64 | 61 | @ExcelProperty("数据格式") |
| 65 | 62 | private Integer dataFormat; |
| 66 | 63 | |
| 64 | + @Schema(description = "数据校验级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 65 | + @ExcelProperty("数据校验级别") | |
| 66 | + private Integer validateType; | |
| 67 | + | |
| 68 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 69 | + @ExcelProperty("创建时间") | |
| 70 | + private LocalDateTime createTime; | |
| 71 | + | |
| 67 | 72 | } |
| 68 | 73 | \ 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/IotProductSaveReqVO.java renamed to 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; | |
| 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 | 4 | import cn.iocoder.yudao.module.iot.enums.product.*; |
| ... | ... | @@ -14,16 +14,25 @@ public class IotProductSaveReqVO { |
| 14 | 14 | @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.AUTO, example = "1") |
| 15 | 15 | private Long id; |
| 16 | 16 | |
| 17 | + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "温湿度") | |
| 18 | + @NotEmpty(message = "产品名称不能为空") | |
| 19 | + private String name; | |
| 20 | + | |
| 17 | 21 | @Schema(description = "产品 Key", requiredMode = Schema.RequiredMode.AUTO, example = "12345abc") |
| 18 | 22 | private String productKey; |
| 19 | 23 | |
| 20 | - // TODO 芋艿:品类 | |
| 24 | + @Schema(description = "产品分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 25 | + @NotNull(message = "产品分类编号不能为空") | |
| 26 | + private Long categoryId; | |
| 21 | 27 | |
| 22 | - // TODO 芋艿:【待确定】保活时长、产品图标、产品图片 | |
| 28 | + @Schema(description = "产品图标", example = "https://iocoder.cn/1.svg") | |
| 29 | + private String icon; | |
| 23 | 30 | |
| 24 | - @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "温湿度") | |
| 25 | - @NotEmpty(message = "产品名称不能为空") | |
| 26 | - private String name; | |
| 31 | + @Schema(description = "产品图标", example = "https://iocoder.cn/1.png") | |
| 32 | + private String picUrl; | |
| 33 | + | |
| 34 | + @Schema(description = "产品描述", example = "描述") | |
| 35 | + private String description; | |
| 27 | 36 | |
| 28 | 37 | @Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") |
| 29 | 38 | @InEnum(value = IotProductDeviceTypeEnum.class, message = "设备类型必须是 {value}") |
| ... | ... | @@ -48,7 +57,4 @@ public class IotProductSaveReqVO { |
| 48 | 57 | @NotNull(message = "数据校验级别不能为空") |
| 49 | 58 | private Integer validateType; |
| 50 | 59 | |
| 51 | - @Schema(description = "产品描述", example = "描述") | |
| 52 | - private String description; | |
| 53 | - | |
| 54 | 60 | } |
| 55 | 61 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/product/IotProductDO.java
| ... | ... | @@ -22,7 +22,7 @@ import lombok.*; |
| 22 | 22 | public class IotProductDO extends BaseDO { |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * 产品ID | |
| 25 | + * 产品 ID | |
| 26 | 26 | */ |
| 27 | 27 | @TableId |
| 28 | 28 | private Long id; |
| ... | ... | @@ -30,18 +30,25 @@ public class IotProductDO extends BaseDO { |
| 30 | 30 | * 产品名称 |
| 31 | 31 | */ |
| 32 | 32 | private String name; |
| 33 | - // TODO @haohao:这个字段,要不改成 identifier,和阿里云更统一些 | |
| 34 | 33 | /** |
| 35 | 34 | * 产品标识 |
| 36 | 35 | */ |
| 37 | 36 | private String productKey; |
| 38 | 37 | /** |
| 39 | - * 产品所属品类编号 | |
| 38 | + * 产品分类编号 | |
| 40 | 39 | * <p> |
| 41 | - * TODO 外键:后续加 | |
| 40 | + * 关联 {@link IotProductCategoryDO#getId()} | |
| 42 | 41 | */ |
| 43 | 42 | private Long categoryId; |
| 44 | 43 | /** |
| 44 | + * 产品图标 | |
| 45 | + */ | |
| 46 | + private String icon; | |
| 47 | + /** | |
| 48 | + * 产品图片 | |
| 49 | + */ | |
| 50 | + private String picUrl; | |
| 51 | + /** | |
| 45 | 52 | * 产品描述 |
| 46 | 53 | */ |
| 47 | 54 | private String description; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/product/IotProductMapper.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.dal.mysql.product; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductPageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO; | |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductService.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.service.product; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductPageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSaveReqVO; | |
| 4 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO; | |
| 5 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO; | |
| 6 | 6 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 7 | 7 | import jakarta.validation.Valid; |
| 8 | 8 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/product/IotProductServiceImpl.java
| ... | ... | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.iot.service.product; |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.product.vo.IotProductSaveReqVO; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductSaveReqVO; | |
| 8 | 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 9 | 9 | import cn.iocoder.yudao.module.iot.dal.mysql.product.IotProductMapper; |
| 10 | 10 | import cn.iocoder.yudao.module.iot.enums.product.IotProductStatusEnum; |
| ... | ... | @@ -14,7 +14,6 @@ import jakarta.annotation.Resource; |
| 14 | 14 | |
| 15 | 15 | import org.springframework.context.annotation.Lazy; |
| 16 | 16 | import org.springframework.stereotype.Service; |
| 17 | -import org.springframework.transaction.annotation.Transactional; | |
| 18 | 17 | import org.springframework.validation.annotation.Validated; |
| 19 | 18 | |
| 20 | 19 | import java.util.List; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyLogDO.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/notify/PayNotifyTaskDO.java
| ... | ... | @@ -52,7 +52,7 @@ public class PayNotifyTaskDO extends TenantBaseDO { |
| 52 | 52 | /** |
| 53 | 53 | * 通知类型 |
| 54 | 54 | * |
| 55 | - * 外键 {@link PayNotifyTypeEnum} | |
| 55 | + * 枚举 {@link PayNotifyTypeEnum} | |
| 56 | 56 | */ |
| 57 | 57 | private Integer type; |
| 58 | 58 | /** |
| ... | ... | @@ -73,7 +73,7 @@ public class PayNotifyTaskDO extends TenantBaseDO { |
| 73 | 73 | /** |
| 74 | 74 | * 通知状态 |
| 75 | 75 | * |
| 76 | - * 外键 {@link PayNotifyStatusEnum} | |
| 76 | + * 枚举 {@link PayNotifyStatusEnum} | |
| 77 | 77 | */ |
| 78 | 78 | private Integer status; |
| 79 | 79 | /** | ... | ... |