1. 剔除掉多余的文档以及标记

This commit is contained in:
chenbowen
2025-11-28 18:12:00 +08:00
parent 30bd4810f5
commit 0c22975df0
432 changed files with 705 additions and 1650200 deletions

View File

@@ -6,7 +6,7 @@ import javax.script.ScriptEngine;
import javax.script.ScriptException;
/**
* TODO 芋艿:测试脚本的接入
* TODO ZT:测试脚本的接入
*/
public class ScriptTest {

View File

@@ -1,6 +1,6 @@
/**
* 占位
*
* TODO 芋艿:后续删除
* TODO ZT:后续删除
*/
package com.zt.plat.module.iot.api;

View File

@@ -61,7 +61,7 @@ public class IotDeviceController {
return success(true);
}
// TODO @芋艿参考阿里云1绑定网关2解绑网关
// TODO @ZT参考阿里云1绑定网关2解绑网关
@PutMapping("/update-group")
@Operation(summary = "更新设备分组")

View File

@@ -14,7 +14,7 @@ public class IotDeviceMqttConnectionParamsRespVO {
@ExcelProperty("MQTT 客户端 ID")
private String mqttClientId;
@Schema(description = "MQTT 用户名", example = "芋艿")
@Schema(description = "MQTT 用户名", example = "ZT")
@ExcelProperty("MQTT 用户名")
private String mqttUsername;

View File

@@ -1,2 +1,2 @@
// TODO @芋艿:占位
// TODO @ZT:占位
package com.zt.plat.module.iot.controller.admin.rule.vo;

View File

@@ -120,7 +120,7 @@ public class IotDeviceDO extends TenantBaseDO {
*/
private String firmwareId;
// TODO @芋艿:【待定 003】要不要增加 username目前 tl 有,阿里云之类的没有
// TODO @ZT:【待定 003】要不要增加 username目前 tl 有,阿里云之类的没有
/**
* 设备密钥,用于设备认证,需安全存储
*/
@@ -143,7 +143,7 @@ public class IotDeviceDO extends TenantBaseDO {
// TODO @haohao是不是要枚举哈
private String authType;
// TODO @芋艿:【待定 002】1设备维护的时候设置位置类似 tl2设备上传的时候设置位置类似 it
// TODO @ZT:【待定 002】1设备维护的时候设置位置类似 tl2设备上传的时候设置位置类似 it
/**
* 设备位置的纬度
*/

View File

@@ -45,7 +45,7 @@ public class IotPluginConfigDO extends TenantBaseDO {
* 枚举 {@link IotPluginDeployTypeEnum}
*/
private Integer deployType;
// TODO @芋艿如果是外置的插件fileName 和 version 的选择~
// TODO @ZT如果是外置的插件fileName 和 version 的选择~
/**
* 插件包文件名
*/
@@ -54,7 +54,7 @@ public class IotPluginConfigDO extends TenantBaseDO {
* 插件版本
*/
private String version;
// TODO @芋艿type 字典的定义
// TODO @ZTtype 字典的定义
/**
* 插件类型
* <p>
@@ -64,7 +64,7 @@ public class IotPluginConfigDO extends TenantBaseDO {
/**
* 设备插件协议类型
*/
// TODO @芋艿:枚举字段
// TODO @ZT:枚举字段
private String protocol;
// TODO @haohao这个字段是不是直接用 CommonStatus开启、禁用然后插件实例那online 是否在线
/**
@@ -74,7 +74,7 @@ public class IotPluginConfigDO extends TenantBaseDO {
*/
private Integer status;
// TODO @芋艿configSchema、config 示例字段
// TODO @ZTconfigSchema、config 示例字段
/**
* 插件配置项描述信息
*/
@@ -84,7 +84,7 @@ public class IotPluginConfigDO extends TenantBaseDO {
*/
private String config;
// TODO @芋艿script 后续的使用
// TODO @ZTscript 后续的使用
/**
* 插件脚本
*/

View File

@@ -54,14 +54,14 @@ public class IotAlertRecordDO extends BaseDO {
*/
private String deviceName;
// TODO @芋艿:有没更好的方式
// TODO @ZT:有没更好的方式
/**
* 触发的设备消息
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private IotDeviceMessage deviceMessage;
// TODO @芋艿:换成枚举,枚举对应 ApiErrorLogProcessStatusEnum
// TODO @ZT:换成枚举,枚举对应 ApiErrorLogProcessStatusEnum
/**
* 处理状态
*

View File

@@ -25,7 +25,7 @@ public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> {
.likeIfPresent(IotThingModelDO::getName, reqVO.getName())
.eqIfPresent(IotThingModelDO::getType, reqVO.getType())
.eqIfPresent(IotThingModelDO::getProductId, reqVO.getProductId())
// TODO @芋艿:看看要不要加枚举
// TODO @ZT:看看要不要加枚举
.notIn(IotThingModelDO::getIdentifier, "get", "set", "post")
.orderByDesc(IotThingModelDO::getId));
}
@@ -36,7 +36,7 @@ public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> {
.likeIfPresent(IotThingModelDO::getName, reqVO.getName())
.eqIfPresent(IotThingModelDO::getType, reqVO.getType())
.eqIfPresent(IotThingModelDO::getProductId, reqVO.getProductId())
// TODO @芋艿:看看要不要加枚举
// TODO @ZT:看看要不要加枚举
.notIn(IotThingModelDO::getIdentifier, "get", "set", "post")
.orderByDesc(IotThingModelDO::getId));
}

View File

@@ -26,7 +26,7 @@ public class IotPluginConfiguration {
return new IotPluginStartRunner(pluginManager, pluginConfigService);
}
// TODO @芋艿:需要 review 下
// TODO @ZT:需要 review 下
@Bean
public SpringPluginManager pluginManager(@Value("${pf4j.pluginsDir:pluginsDir}") String pluginsDir) {
log.info("[init][实例化 SpringPluginManager]");

View File

@@ -33,7 +33,7 @@ public class IotDeviceOfflineCheckJob {
/**
* 设备离线超时时间
*
* TODO 芋艿:暂定 10 分钟,后续看看要不要基于设备或者全局有配置文件
* TODO ZT:暂定 10 分钟,后续看看要不要基于设备或者全局有配置文件
*/
public static final Duration OFFLINE_TIMEOUT = Duration.ofMinutes(10);

View File

@@ -21,7 +21,7 @@ public class IotPluginInstancesJob {
/**
* 插件离线超时时间
*
* TODO 芋艿:暂定 10 分钟,后续看要不要做配置
* TODO ZT:暂定 10 分钟,后续看要不要做配置
*/
public static final Duration OFFLINE_TIMEOUT = Duration.ofMinutes(10);

View File

@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
// TODO @芋艿:参考阿里云的物模型,优化 IoT 上下行消息的设计,尽量保持一致(渐进式,不要一口气)!
// TODO @ZT:参考阿里云的物模型,优化 IoT 上下行消息的设计,尽量保持一致(渐进式,不要一口气)!
/**
* IoT 设备消息
*/

View File

@@ -1,4 +1,4 @@
/**
* TODO 芋艿:临时占位
* TODO ZT:临时占位
*/
package com.zt.plat.module.iot.mq.producer;

View File

@@ -1,5 +1,5 @@
/**
* iot 模块,物联网 模块,主要实现 产品管理、设备管理、协议管理等功能。TODO 芋艿:完善下
* iot 模块,物联网 模块,主要实现 产品管理、设备管理、协议管理等功能。TODO ZT:完善下
*
* 1. Controller URL以 /iot/ 开头,避免和其它 Module 冲突
* 2. DataObject 表名:以 iot_ 开头,方便在数据库中区分

View File

@@ -47,7 +47,7 @@ public interface IotDeviceService {
*/
void updateDevice(@Valid IotDeviceSaveReqVO updateReqVO);
// TODO @芋艿:先这么实现。未来看情况,要不要自己实现
// TODO @ZT:先这么实现。未来看情况,要不要自己实现
/**
* 更新设备的所属网关

View File

@@ -57,8 +57,8 @@ public class IotDeviceDownstreamServiceImpl implements IotDeviceDownstreamServic
public IotDeviceMessage downstreamDevice(IotDeviceDownstreamReqVO downstreamReqVO) {
// 校验设备是否存在
IotDeviceDO device = deviceService.validateDeviceExists(downstreamReqVO.getId());
// TODO @芋艿:离线设备,不允许推送
// TODO 芋艿:父设备的处理
// TODO @ZT:离线设备,不允许推送
// TODO ZT:父设备的处理
IotDeviceDO parentDevice = null;
// 服务调用
@@ -88,7 +88,7 @@ public class IotDeviceDownstreamServiceImpl implements IotDeviceDownstreamServic
if (Objects.equals(downstreamReqVO.getType(), IotDeviceMessageTypeEnum.OTA.getType())) {
return otaUpgrade(downstreamReqVO, device, parentDevice);
}
// TODO @芋艿:取消设备的网关的时,要不要下发 REGISTER_UNREGISTER_SUB
// TODO @ZT:取消设备的网关的时,要不要下发 REGISTER_UNREGISTER_SUB
throw new IllegalArgumentException("不支持的下行消息类型:" + downstreamReqVO);
}

View File

@@ -111,7 +111,7 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
// 2. 更新设备状态
deviceService.updateDeviceState(device.getId(), updateReqDTO.getState());
// 3. TODO 芋艿:子设备的关联
// 3. TODO ZT:子设备的关联
// 4. 发送设备消息
IotDeviceMessage message = BeanUtils.toBean(updateReqDTO, IotDeviceMessage.class)
@@ -223,7 +223,7 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
if (CollUtil.isNotEmpty(registerReqDTO.getParams())) {
registerReqDTO.getParams().forEach(subDevice -> registerDevice0(
subDevice.getProductKey(), subDevice.getDeviceName(), device.getId(), registerReqDTO));
// TODO @芋艿:后续要处理,每个设备是否成功
// TODO @ZT:后续要处理,每个设备是否成功
}
// 3. 发送设备消息
@@ -259,7 +259,7 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
addReqDTO.getParams().forEach(subDevice -> {
IotDeviceDO subDeviceDO = deviceService.getDeviceByProductKeyAndDeviceNameFromCache(
subDevice.getProductKey(), subDevice.getDeviceName());
// TODO @芋艿:后续要处理,每个设备是否成功
// TODO @ZT:后续要处理,每个设备是否成功
if (subDeviceDO == null) {
log.error("[addDeviceTopology][子设备({}/{}) 不存在]",
subDevice.getProductKey(), subDevice.getDeviceName());
@@ -280,7 +280,7 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
sendDeviceMessage(message, device);
}
// TODO @芋艿后续需要考虑http 的认证
// TODO @ZT后续需要考虑http 的认证
@Override
public boolean authenticateEmqxConnection(IotDeviceEmqxAuthReqDTO authReqDTO) {
log.info("[authenticateEmqxConnection][认证 Emqx 连接: {}]", authReqDTO);

View File

@@ -51,12 +51,12 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService {
.put(IotDataSpecsDataTypeEnum.INT.getDataType(), TDengineTableField.TYPE_INT)
.put(IotDataSpecsDataTypeEnum.FLOAT.getDataType(), TDengineTableField.TYPE_FLOAT)
.put(IotDataSpecsDataTypeEnum.DOUBLE.getDataType(), TDengineTableField.TYPE_DOUBLE)
.put(IotDataSpecsDataTypeEnum.ENUM.getDataType(), TDengineTableField.TYPE_TINYINT) // TODO 芋艿:为什么要映射为 TINYINT 的说明?
.put(IotDataSpecsDataTypeEnum.BOOL.getDataType(), TDengineTableField.TYPE_TINYINT) // TODO 芋艿:为什么要映射为 TINYINT 的说明?
.put(IotDataSpecsDataTypeEnum.ENUM.getDataType(), TDengineTableField.TYPE_TINYINT) // TODO ZT:为什么要映射为 TINYINT 的说明?
.put(IotDataSpecsDataTypeEnum.BOOL.getDataType(), TDengineTableField.TYPE_TINYINT) // TODO ZT:为什么要映射为 TINYINT 的说明?
.put(IotDataSpecsDataTypeEnum.TEXT.getDataType(), TDengineTableField.TYPE_NCHAR)
.put(IotDataSpecsDataTypeEnum.DATE.getDataType(), TDengineTableField.TYPE_TIMESTAMP)
.put(IotDataSpecsDataTypeEnum.STRUCT.getDataType(), TDengineTableField.TYPE_NCHAR) // TODO 芋艿:怎么映射!!!!
.put(IotDataSpecsDataTypeEnum.ARRAY.getDataType(), TDengineTableField.TYPE_NCHAR) // TODO 芋艿:怎么映射!!!!
.put(IotDataSpecsDataTypeEnum.STRUCT.getDataType(), TDengineTableField.TYPE_NCHAR) // TODO ZT:怎么映射!!!!
.put(IotDataSpecsDataTypeEnum.ARRAY.getDataType(), TDengineTableField.TYPE_NCHAR) // TODO ZT:怎么映射!!!!
.build();
@Resource
@@ -133,7 +133,7 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService {
}
// 2. 根据物模型,拼接合法的属性
// TODO @芋艿:【待定 004】赋能后属性到底以 thingModel 为准ik还是 db 的表结构为准tl
// TODO @ZT:【待定 004】赋能后属性到底以 thingModel 为准ik还是 db 的表结构为准tl
List<IotThingModelDO> thingModels = thingModelService.getThingModelListByProductKeyFromCache(device.getProductKey());
Map<String, Object> properties = new HashMap<>();
((Map<?, ?>) message.getData()).forEach((key, value) -> {

View File

@@ -46,7 +46,7 @@ public class IotOtaFirmwareServiceImpl implements IotOtaFirmwareService {
// TODO @liproductService.getProduct(Convert.toLong(firmware.getProductId())) 放到 1. 后面先做参考校验。逻辑两段1先参数校验2构建对象 + 存储
IotProductDO product = productService.getProduct(Convert.toLong(firmware.getProductId()));
firmware.setProductKey(Objects.requireNonNull(product).getProductKey());
// TODO @芋艿: 附件、附件签名等属性的计算
// TODO @ZT: 附件、附件签名等属性的计算
otaFirmwareMapper.insert(firmware);
return firmware.getId();
}

View File

@@ -69,7 +69,7 @@ public class IotOtaUpgradeRecordServiceImpl implements IotOtaUpgradeRecordServic
}).toList();
// 3.保存数据
upgradeRecordMapper.insertBatch(upgradeRecordList);
// TODO @芋艿:在这里需要处理推送升级任务的逻辑
// TODO @ZT:在这里需要处理推送升级任务的逻辑
}
@@ -140,7 +140,7 @@ public class IotOtaUpgradeRecordServiceImpl implements IotOtaUpgradeRecordServic
@Override
public void cancelUpgradeRecordByTaskId(Long taskId) {
// 暂定只有待推送的升级记录可以取消 TODO @芋艿:可以看看阿里云,哪些可以取消
// 暂定只有待推送的升级记录可以取消 TODO @ZT:可以看看阿里云,哪些可以取消
upgradeRecordMapper.updateUpgradeRecordStatusByTaskIdAndStatus(
IotOtaUpgradeRecordStatusEnum.CANCELED.getStatus(), taskId,
IotOtaUpgradeRecordStatusEnum.PENDING.getStatus());

View File

@@ -123,7 +123,7 @@ public class IotProductServiceImpl implements IotProductService {
validateProductExists(id);
// 2. 更新为发布状态,需要创建产品超级表数据模型
// TODO @芋艿:【待定 001】1是否需要操作后在 redis 进行缓存,实现一个“快照”的情况,类似 tl
// TODO @ZT:【待定 001】1是否需要操作后在 redis 进行缓存,实现一个“快照”的情况,类似 tl
if (Objects.equals(status, IotProductStatusEnum.PUBLISHED.getStatus())) {
devicePropertyDataService.defineDevicePropertyData(id);
}

View File

@@ -37,7 +37,7 @@ public interface IotRuleSceneService {
void executeRuleSceneByTimer(Long id);
/**
* TODO 芋艿:测试方法,需要删除
* TODO ZT:测试方法,需要删除
*/
void test();

View File

@@ -61,7 +61,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
@Resource(name = "iotSchedulerManager")
private IotSchedulerManager schedulerManager;
// TODO 芋艿,缓存待实现
// TODO ZT,缓存待实现
@Override
@TenantIgnore // 忽略租户隔离:因为 IotRuleSceneMessageHandler 调用时,一般未传递租户,所以需要忽略
public List<IotRuleSceneDO> getRuleSceneListByProductKeyAndDeviceNameFromCache(String productKey, String deviceName) {
@@ -164,7 +164,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
.put("color", "red")
.build());
action01.setDeviceControl(actionDeviceControl01);
// ruleScene01.getActions().add(action01); // TODO 芋艿:先不测试了
// ruleScene01.getActions().add(action01); // TODO ZT:先不测试了
// 数据桥接http
IotRuleSceneDO.ActionConfig action02 = new IotRuleSceneDO.ActionConfig();
action02.setType(IotRuleSceneActionTypeEnum.DATA_BRIDGE.getType());
@@ -174,7 +174,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
}
List<IotRuleSceneDO> list = ruleSceneMapper.selectList();
// TODO @芋艿:需要考虑开启状态
// TODO @ZT:需要考虑开启状态
return filterList(list, ruleScene -> {
for (IotRuleSceneDO.TriggerConfig trigger : ruleScene.getTriggers()) {
if (ObjUtil.notEqual(trigger.getProductKey(), productKey)) {
@@ -207,7 +207,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
public void executeRuleSceneByTimer(Long id) {
// 1.1 获得规则场景
// IotRuleSceneDO scene = TenantUtils.executeIgnore(() -> ruleSceneMapper.selectById(id));
// TODO @芋艿:这里,临时测试,后续删除。
// TODO @ZT:这里,临时测试,后续删除。
IotRuleSceneDO scene = new IotRuleSceneDO().setStatus(CommonStatusEnum.ENABLE.getStatus());
if (true) {
scene.setTenantId(1L);
@@ -258,7 +258,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
*/
private List<IotRuleSceneDO> getMatchedRuleSceneListByMessage(IotDeviceMessage message) {
// 1. 匹配设备
// TODO @芋艿:可能需要 getSelf(); 缓存
// TODO @ZT:可能需要 getSelf(); 缓存
List<IotRuleSceneDO> ruleScenes = getRuleSceneListByProductKeyAndDeviceNameFromCache(
message.getProductKey(), message.getDeviceName());
if (CollUtil.isEmpty(ruleScenes)) {
@@ -272,7 +272,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
if (ObjUtil.notEqual(trigger.getType(), IotRuleSceneTriggerTypeEnum.DEVICE.getType())) {
return false;
}
// TODO 芋艿:产品、设备的匹配,要不要这里在做一次???貌似和 1. 部分重复了
// TODO ZT:产品、设备的匹配,要不要这里在做一次???貌似和 1. 部分重复了
// 2.2 条件为空,说明没有匹配的条件,因此不匹配
if (CollUtil.isEmpty(trigger.getConditions())) {
return false;
@@ -298,7 +298,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
});
}
// TODO @芋艿:【可优化】可以考虑增加下单测,边界太多了。
// TODO @ZT:【可优化】可以考虑增加下单测,边界太多了。
/**
* 判断触发器的条件参数是否匹配
*
@@ -392,7 +392,7 @@ public class IotRuleSceneServiceImpl implements IotRuleSceneService {
@Override
@SneakyThrows
public void test() {
// TODO @芋艿:测试思路代码,记得删除!!!
// TODO @ZT:测试思路代码,记得删除!!!
// 1. Job 类IotRuleSceneJob DONE
// 2. 参数id DONE
// 3. jobHandlerNameIotRuleSceneJob + id DONE

View File

@@ -13,7 +13,7 @@ import javax.annotation.Nullable;
*/
public interface IotRuleSceneAction {
// TODO @芋艿groovy 或者 javascript 实现数据的转换;可以考虑基于 hutool 的 ScriptUtil 做
// TODO @ZTgroovy 或者 javascript 实现数据的转换;可以考虑基于 hutool 的 ScriptUtil 做
/**
* 执行场景
*

View File

@@ -17,7 +17,7 @@ public class IotRuleSceneAlertAction implements IotRuleSceneAction {
@Override
public void execute(@Nullable IotDeviceMessage message, IotRuleSceneDO.ActionConfig config) {
// TODO @芋艿:待实现
// TODO @ZT:待实现
}
@Override

View File

@@ -11,10 +11,10 @@ import lombok.extern.slf4j.Slf4j;
import java.time.Duration;
// TODO @芋艿:数据库
// TODO @芋艿mqtt
// TODO @芋艿tcp
// TODO @芋艿websocket
// TODO @ZT:数据库
// TODO @ZTmqtt
// TODO @ZTtcp
// TODO @ZTwebsocket
/**
* 带缓存功能的数据桥梁执行器抽象类

View File

@@ -126,7 +126,7 @@ logging:
file:
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
--- #################### iot相关配置 TODO 芋艿【IOT】再瞅瞅 ####################
--- #################### iot相关配置 TODO ZT【IOT】再瞅瞅 ####################
pf4j:
# pluginsDir: /tmp/
pluginsDir: ../plugins

View File

@@ -136,9 +136,9 @@ logging:
# 配置自己写的 MyBatis Mapper 打印日志
com.zt.plat.module.iot.dal.mysql: debug
com.zt.plat.module.iot.dal.mysql.sms.SmsChannelMapper: INFO # 配置 SmsChannelMapper 的日志级别为 info
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿先禁用Spring Boot 3.X 存在部分错误的 WARN 提示
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO ZT先禁用Spring Boot 3.X 存在部分错误的 WARN 提示
--- #################### iot相关配置 TODO 芋艿【IOT】再瞅瞅 ####################
--- #################### iot相关配置 TODO ZT【IOT】再瞅瞅 ####################
pf4j:
# pluginsDir: /tmp/
pluginsDir: ../plugins

View File

@@ -54,7 +54,7 @@ springdoc:
default-flat-param-object: true # 参见 https://doc.xiaominfo.com/docs/faq/v4/knife4j-parameterobject-flat-param 文档
knife4j:
enable: false # TODO 芋艿需要关闭增强具体原因见https://github.com/xiaoymin/knife4j/issues/874
enable: false # TODO ZT需要关闭增强具体原因见https://github.com/xiaoymin/knife4j/issues/874
setting:
language: zh_cn
@@ -126,7 +126,7 @@ xxl:
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
accessToken: default_token # 执行器通讯TOKEN
--- #################### 芋道相关配置 ####################
--- #################### ZT相关配置 ####################
zt:
info:
@@ -152,6 +152,6 @@ zt:
- iot:thing_model_list
debug: false
# 插件配置 TODO 芋艿【IOT】需要处理下
# 插件配置 TODO ZT【IOT】需要处理下
pf4j:
pluginsDir: /Users/anhaohao/code/gitee/ruoyi-vue-pro/plugins # 插件目录