From 336bd22b721af9ff7fcaa23eb54c307b9047ffaa Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 19 九月 2024 08:54:54 +0800 Subject: [PATCH] http tag --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java | 31 ++++++---- /dev/null | 68 ---------------------- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java | 6 + iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql | 28 +++++---- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusTagEntity.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java | 6 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java | 4 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java | 4 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java | 5 + 9 files changed, 49 insertions(+), 105 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql b/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql index 89bbaa5..9ef32c6 100644 --- a/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql +++ b/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql @@ -214,14 +214,14 @@ CREATE TABLE `t_http_token` ( - `id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, - `api_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `login_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `client_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `client_secret` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `username` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, - `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, - `token` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'token', + `id` varchar(36) NOT NULL COMMENT 'ID', + `api_id` varchar(36) NOT NULL COMMENT '接口ID', + `login_url` varchar(200) DEFAULT NULL COMMENT '登录地址', + `client_id` varchar(100) DEFAULT NULL COMMENT 'ClientId', + `client_secret` varchar(100) DEFAULT NULL COMMENT 'ClientSecret', + `username` varchar(50) DEFAULT NULL COMMENT '用户名', + `password` varchar(50) DEFAULT NULL COMMENT '密码', + `token` varchar(2000) DEFAULT NULL COMMENT 'token', `expire_time` datetime DEFAULT NULL COMMENT '过期时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, @@ -229,14 +229,16 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='接口Token'; CREATE TABLE `t_http_tag` ( - `id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '查询号', - `http_api_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'HTTP 接口代码', - `tag_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点编码', - `tag_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点名称', + `id` varchar(36) NOT NULL COMMENT 'ID', + `api_id` varchar(36) NOT NULL COMMENT '接口ID', + `tag_name` varchar(64) NOT NULL COMMENT '标签名称', + `data_type` varchar(16) NOT NULL COMMENT '数据类型', + `enabled` tinyint(1) DEFAULT NULL COMMENT '是否启用', + `tag_desc` varchar(64) DEFAULT NULL COMMENT '描述', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='接口Tag表'; +) ENGINE=InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT='接口Tag表'; -- 指标管理------------ CREATE TABLE t_ind_data_set( diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java index 1d8dac9..2cbf40a 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java @@ -12,6 +12,7 @@ import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Date; import java.util.List; import java.util.UUID; @@ -53,8 +54,8 @@ @PreAuthorize("@ss.hasPermission('data:channel-http:create')") @PostMapping("/create") public CommonResult<Boolean> create(@RequestBody HttpApiEntity httpApiEntity){ - String id = UUID.randomUUID().toString(); - httpApiEntity.setId(id); + httpApiEntity.setId(UUID.randomUUID().toString()); + httpApiEntity.setCreateTime(new Date()); httpApiService.add(httpApiEntity); return success(true); } @@ -63,6 +64,7 @@ @PutMapping("/update") public CommonResult<Boolean> update(@RequestBody HttpApiEntity httpApiEntity) { httpApiService.update(httpApiEntity); + httpApiEntity.setUpdateTime(new Date()); return success(true); } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java index 94e7768..07b08cc 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java @@ -12,6 +12,7 @@ import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Date; import java.util.List; import java.util.UUID; @@ -54,8 +55,8 @@ @PreAuthorize("@ss.hasPermission('data:channel-http:create')") @PostMapping("/create") public CommonResult<Boolean> add(@RequestBody HttpTagEntity httpTagEntity){ - String id = UUID.randomUUID().toString(); - httpTagEntity.setId(id); + httpTagEntity.setId(UUID.randomUUID().toString()); + httpTagEntity.setCreateTime(new Date()); tagService.add(httpTagEntity); return success(true); } @@ -63,6 +64,7 @@ @PreAuthorize("@ss.hasPermission('data:channel-http:update')") @PutMapping("/update") public CommonResult<Boolean> update(@RequestBody HttpTagEntity httpTagEntity) { + httpTagEntity.setUpdateTime(new Date()); tagService.update(httpTagEntity); return success(true); } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java index 7895f66..2ca79c7 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java @@ -12,6 +12,7 @@ import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Date; import java.util.List; import java.util.UUID; @@ -53,8 +54,8 @@ @PreAuthorize("@ss.hasPermission('data:channel-http:create')") @PostMapping("/create") public CommonResult<Boolean> create(@RequestBody HttpTokenEntity HttpTokenEntity){ - String id = UUID.randomUUID().toString(); - HttpTokenEntity.setId(id); + HttpTokenEntity.setId(UUID.randomUUID().toString()); + HttpTokenEntity.setUpdateTime(new Date()); httpTokenService.add(HttpTokenEntity); return success(true); } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java index d693d62..aee37f1 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java @@ -13,8 +13,8 @@ public interface HttpTagDao extends BaseMapperX<HttpTagEntity> { default PageResult<HttpTagEntity> selectPage(HttpTagPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX<HttpTagEntity>() - .likeIfPresent(HttpTagEntity::getTagType, reqVO.getTagType()) - .likeIfPresent(HttpTagEntity::getTagCode, reqVO.getTagCode()) + .likeIfPresent(HttpTagEntity::getTagName, reqVO.getTagType()) + .likeIfPresent(HttpTagEntity::getTagName, reqVO.getTagCode()) .likeIfPresent(HttpTagEntity::getTagName, reqVO.getTagName()) .orderByDesc(HttpTagEntity::getCreateTime)); } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java deleted file mode 100644 index b3016e0..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.iailab.module.data.channel.http.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * @author PanZhibao - * @Description - * @createTime 2023年12月18日 16:53:00 - */ -@Data -@TableName("t_ele_low_tag") -public class EleLowTagEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * ID - */ - @Schema(description = "ID") - @TableId(value = "id", type = IdType.INPUT) - private String id; - - /** - * 位置 - */ - private String location; - - /** - * 所在柜号 - */ - private String boxNum; - - /** - * 开关位置 - */ - private String switchLocation; - - /** - * 测点名称 - */ - private String tagName; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 更新时间 - */ - private Date updateTime; -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java deleted file mode 100644 index 456e9cb..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.iailab.module.data.channel.http.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * @author DongYukun - * @Description - * @createTime 2024年01月17日 13:19:00 - */ -@Data -@TableName("t_fxjy_tag") -public class FxjyTagEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @Schema(description = "主键") - @TableId(value = "id", type = IdType.INPUT) - private String id; - - /** - * 测点类型 - */ - private String tagType; - - /** - * 测点编码 - */ - private String tagCode; - - /** - * 测点名称 - */ - private String tagName; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 更新时间 - */ - private Date updateTime; -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java index fba20f9..4ab81e1 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java @@ -27,26 +27,31 @@ private String id; /** - * HTTP api code + * 接口ID */ - private String httpApiCode; + private String apiId; /** - * 测点类型 - */ - private String tagType; - - /** - * 测点编码 - */ - private String tagCode; - - /** - * 测点名称 + * 标签名称 */ private String tagName; /** + * 数据类型 + */ + private String dataType; + + /** + * 标签描述 + */ + private String tagDesc; + + /** + * 是否启用 + */ + private Boolean enabled; + + /** * 创建时间 */ private Date createTime; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java deleted file mode 100644 index 009e565..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.iailab.module.data.channel.http.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -@Data -@TableName("T_XST_TAG") -public class XSTTagEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - @Schema(description = "主键") - @TableId(value = "id", type = IdType.INPUT) - private String id; - - /** - * 设备编码 - */ - private String deviceCode; - - /** - * 设备名称 - */ - private String deviceName; - - /** - * 测点名称 - */ - private String pointName; - - /** - * 测点编码 - */ - private String pointCode; - - /** - * 单位 - */ - private String unit; - - /** - * 传感器标识符 - */ - private String identifier; - - /** - * Tag编号 - */ - private String tagno; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 更新时间 - */ - private Date updateTime; -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusTagEntity.java index 4c24b18..b2a1bca 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusTagEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/entity/ChannelModBusTagEntity.java @@ -37,7 +37,7 @@ private String dataType; /** - * 是否可以tag,如果为false,即使定义了但是runtime不会读取该数据 + * 是否启用 */ private Boolean enabled; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java index 7813746..a946b31 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java @@ -157,8 +157,8 @@ List<TagOptionDTO> op2 = new ArrayList<>(); tags.forEach(item1 -> { TagOptionDTO op3 = new TagOptionDTO(); - op3.setValue(item1.getTagCode()); - op3.setLabel(item1.getTagCode()); + op3.setValue(item1.getTagName()); + op3.setLabel(item1.getTagName()); op2.add(op3); }); op1.setChildren(op2); -- Gitblit v1.9.3