chore(project): rebranded project as 恭学教育 (GongXue Education)
Some checks failed
Deploy to Runner / deploy (push) Failing after 6m7s
Some checks failed
Deploy to Runner / deploy (push) Failing after 6m7s
- Updated pom.xml project name, description, and URL to 恭学教育. - Changed LICENSE copyright holder to 恭学教育 (GongXue Education). - Rebranded README.md with new project title and tagline. - Replaced @author 芋道源码 with @author 恭学教育 across all Java source files. - Updated Swagger metadata with 恭学教育 API title and admin@gongxue.com. - Added Gitea Actions CI pipeline for automated build and deployment.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
物联网模块
|
||||
<!-- TODO 芋艿:需要补充下说明! -->
|
||||
<!-- TODO 管理员:需要补充下说明! -->
|
||||
</description>
|
||||
|
||||
</project>
|
||||
@@ -14,7 +14,7 @@
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
物联网 模块,主要实现 产品管理、设备管理、协议管理等功能。
|
||||
<!-- TODO 芋艿:后续补充下 -->
|
||||
<!-- TODO 管理员:后续补充下 -->
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
@@ -92,7 +92,7 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<!-- TODO @芋艿:临时打开 -->
|
||||
<!-- TODO @管理员:临时打开 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
|
||||
@@ -13,7 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@Data
|
||||
public class IotDataRulePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "数据流转规则名称", example = "芋艿")
|
||||
@Schema(description = "数据流转规则名称", example = "管理员")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "数据流转规则状态", example = "1")
|
||||
|
||||
@@ -14,7 +14,7 @@ public class IotDataRuleRespVO {
|
||||
@Schema(description = "数据流转规则编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8540")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据流转规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@Schema(description = "数据流转规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "管理员")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "数据流转规则描述", example = "你猜")
|
||||
|
||||
@@ -17,7 +17,7 @@ public class IotDataRuleSaveReqVO {
|
||||
@Schema(description = "数据流转规则编号", example = "8540")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据流转规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@Schema(description = "数据流转规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "管理员")
|
||||
@NotEmpty(message = "数据流转规则名称不能为空")
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 告警配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_alert_config", autoResultMap = true)
|
||||
@KeySequence("iot_alert_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
|
||||
/**
|
||||
* IoT 告警记录 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_alert_record", autoResultMap = true)
|
||||
@KeySequence("iot_alert_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.*;
|
||||
/**
|
||||
* IoT 设备分组 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName("iot_device_group")
|
||||
@KeySequence("iot_device_group_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.*;
|
||||
/**
|
||||
* IoT 设备 Modbus 连接配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName("iot_device_modbus_config")
|
||||
@KeySequence("iot_device_modbus_config_seq")
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.math.BigDecimal;
|
||||
/**
|
||||
* IoT 设备 Modbus 点位配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName("iot_device_modbus_point")
|
||||
@KeySequence("iot_device_modbus_point_seq")
|
||||
|
||||
@@ -15,7 +15,7 @@ import lombok.NoArgsConstructor;
|
||||
*
|
||||
* @see <a href="阿里云 IoT - OTA 升级">https://help.aliyun.com/zh/iot/user-guide/ota-upgrade-overview</a>
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_ota_firmware", autoResultMap = true)
|
||||
@KeySequence("iot_ota_firmware_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
||||
/**
|
||||
* IoT OTA 升级任务 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_ota_task", autoResultMap = true)
|
||||
@KeySequence("iot_ota_task_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -15,7 +15,7 @@ import lombok.NoArgsConstructor;
|
||||
/**
|
||||
* IoT OTA 升级任务记录 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_ota_task_record", autoResultMap = true)
|
||||
@KeySequence("iot_ota_task_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.*;
|
||||
/**
|
||||
* IoT 产品分类 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName("iot_product_category")
|
||||
@KeySequence("iot_product_category_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
*
|
||||
* 监听 {@link SourceConfig} 数据源,转发到 {@link IotDataSinkDO} 数据目的
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_data_rule", autoResultMap = true)
|
||||
@KeySequence("iot_data_rule_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@@ -66,7 +66,7 @@ public class IotDataRuleDO extends BaseDO {
|
||||
@TableField(typeHandler = LongListTypeHandler.class)
|
||||
private List<Long> sinkIds;
|
||||
|
||||
// TODO @芋艿:未来考虑使用 groovy;支持数据处理;
|
||||
// TODO @管理员:未来考虑使用 groovy;支持数据处理;
|
||||
|
||||
/**
|
||||
* 数据源配置
|
||||
|
||||
@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
|
||||
/**
|
||||
* IoT 数据流转目的 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_data_sink", autoResultMap = true)
|
||||
@KeySequence("iot_data_bridge_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 场景联动规则 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_scene_rule", autoResultMap = true)
|
||||
@KeySequence("iot_scene_rule_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -21,7 +21,7 @@ import lombok.NoArgsConstructor;
|
||||
* <p>
|
||||
* 每个 {@link IotProductDO} 和 {@link IotThingModelDO} 是“一对多”的关系,它的每个属性、事件、服务都对应一条记录
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@TableName(value = "iot_thing_model", autoResultMap = true)
|
||||
@KeySequence("iot_thing_model_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 告警配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotAlertConfigMapper extends BaseMapperX<IotAlertConfigDO> {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 告警记录 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotAlertRecordMapper extends BaseMapperX<IotAlertRecordDO> {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备分组 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotDeviceGroupMapper extends BaseMapperX<IotDeviceGroupDO> {
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* IoT 设备 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备 Modbus 连接配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotDeviceModbusConfigMapper extends BaseMapperX<IotDeviceModbusConfigDO> {
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备 Modbus 点位配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotDeviceModbusPointMapper extends BaseMapperX<IotDeviceModbusPointDO> {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 产品分类 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotProductCategoryMapper extends BaseMapperX<IotProductCategoryDO> {
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 数据流转规则 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotDataRuleMapper extends BaseMapperX<IotDataRuleDO> {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 产品物模型 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Mapper
|
||||
public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> {
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO;
|
||||
/**
|
||||
* IoT Redis Key 枚举类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface RedisKeyConstants {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* 设备的最后上报时间的 Redis DAO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Repository
|
||||
public class DeviceReportTimeRedisDAO {
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository;
|
||||
/**
|
||||
* 设备关联的网关 serverId 的 Redis DAO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Repository
|
||||
public class DeviceServerIdRedisDAO {
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.enums;
|
||||
/**
|
||||
* IoT 字典类型的枚举类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class DictTypeConstants {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT 告警的接收方式枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
/**
|
||||
* IoT OTA 升级任务记录的状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT OTA 升级任务的状态
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT 数据目的的类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT 场景触发条件的操作符枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT 条件类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Arrays;
|
||||
* 为什么不直接使用 IotDeviceMessageMethodEnum 呢?
|
||||
* 原因是,物模型属性上报,存在批量上报的情况,不只对应一个 method!!!
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT 数据定义的数据类型枚举类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -6,9 +6,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.time.Duration;
|
||||
|
||||
/**
|
||||
* 芋道 IoT 全局配置类
|
||||
* 恭学 IoT 全局配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
@Data
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.sql.DataSource;
|
||||
/**
|
||||
* IoT 模块的 Job 自动配置类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Configuration
|
||||
public class IotJobConfiguration {
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.Properties;
|
||||
* 疑问:为什么 IoT 模块不复用全局的 SchedulerManager 呢?
|
||||
* 回复:yudao-cloud 项目,使用的是 XXL-Job 作为调度中心,无法动态添加任务。
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotSchedulerManager {
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.lang.annotation.*;
|
||||
/**
|
||||
* TDEngine 数据源
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Set;
|
||||
* 检测逻辑:设备最后一条 {@link IotDeviceMessage} 消息超过一定时间,则认为设备离线
|
||||
*
|
||||
* @see <a href="https://help.aliyun.com/zh/iot/support/faq-about-device-status#98f7056b2957y">阿里云 IoT —— 设备离线分析</a>
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
public class IotDeviceOfflineCheckJob implements JobHandler {
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
/**
|
||||
* IoT OTA 升级推送 Job:查询待推送的 OTA 升级记录,并推送给设备
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -46,7 +46,7 @@ public class IotOtaUpgradeJob implements JobHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO 芋艿:可以优化成批量获取 原因是:1. N+1 问题;2. offline 的设备无需查询
|
||||
// TODO 管理员:可以优化成批量获取 原因是:1. N+1 问题;2. offline 的设备无需查询
|
||||
// 2. 遍历推送记录
|
||||
int successCount = 0;
|
||||
int failureCount = 0;
|
||||
@@ -55,7 +55,7 @@ public class IotOtaUpgradeJob implements JobHandler {
|
||||
try {
|
||||
// 2.1 设备如果不在线,直接跳过
|
||||
IotDeviceDO device = deviceService.getDeviceFromCache(record.getDeviceId());
|
||||
// TODO 芋艿:【优化】当前逻辑跳过了离线的设备,但未充分利用 MQTT 的离线消息能力。
|
||||
// TODO 管理员:【优化】当前逻辑跳过了离线的设备,但未充分利用 MQTT 的离线消息能力。
|
||||
// 1. MQTT 协议本身支持持久化会话(Clean Session=false)和 QoS > 0 的消息,允许 broker 为离线设备缓存消息。
|
||||
// 2. 对于 OTA 升级这类非实时性强的任务,即使设备当前离线,也应该可以推送升级指令。设备在下次上线时即可收到。
|
||||
// 3. 后续可以考虑:增加一个“允许离线推送”的选项。如果开启,即使设备状态为 OFFLINE,也应尝试推送消息,依赖 MQTT Broker 的能力进行离线缓存。
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
/**
|
||||
* IoT 规则场景 Job,用于执行 {@link IotSceneRuleTriggerTypeEnum#TIMER} 类型的规则场景
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Slf4j
|
||||
public class IotSceneRuleJob extends QuartzJobBean {
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* 针对 {@link IotDeviceMessage} 的消费者,处理数据流转
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
|
||||
/**
|
||||
* 针对 {@link IotDeviceMessage} 的消费者,处理规则场景
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 告警配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotAlertConfigService {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.ALERT_CONFIG_
|
||||
/**
|
||||
* IoT 告警配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 告警记录 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotAlertRecordService {
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 告警记录 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -16,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT 设备分组 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceGroupService {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_GROUP_
|
||||
/**
|
||||
* IoT 设备分组 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备 Modbus 连接配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceModbusConfigService {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备 Modbus 连接配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
/**
|
||||
* IoT 设备 Modbus 点位配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceModbusPointService {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*;
|
||||
/**
|
||||
* IoT 设备 Modbus 点位配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -26,7 +26,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT 设备 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceService {
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ import static java.util.Collections.singletonList;
|
||||
/**
|
||||
* IoT 设备 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备消息 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDeviceMessageService {
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_DOWNST
|
||||
/**
|
||||
* IoT 设备消息 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@@ -133,7 +133,7 @@ public class IotDeviceMessageServiceImpl implements IotDeviceMessageService {
|
||||
|
||||
// 2.2 情况二:发送下行消息
|
||||
// 如果是下行消息,需要校验 serverId 存在
|
||||
// TODO 芋艿:【设计】下行消息需要区分 PUSH 和 PULL 模型
|
||||
// TODO 管理员:【设计】下行消息需要区分 PUSH 和 PULL 模型
|
||||
// 1. PUSH 模型:适用于 MQTT 等长连接协议。通过 serverId 将消息路由到指定网关,实时推送。
|
||||
// 2. PULL 模型:适用于 HTTP 等短连接协议。设备无固定 serverId,无法主动推送。
|
||||
// 解决方案:
|
||||
@@ -200,7 +200,7 @@ public class IotDeviceMessageServiceImpl implements IotDeviceMessageService {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO @芋艿:可优化:未来逻辑复杂后,可以独立拆除 Processor 处理器
|
||||
// TODO @管理员:可优化:未来逻辑复杂后,可以独立拆除 Processor 处理器
|
||||
private Object handleUpstreamDeviceMessage0(IotDeviceMessage message, IotDeviceDO device) {
|
||||
// 设备上下线
|
||||
if (Objects.equal(message.getMethod(), IotDeviceMessageMethodEnum.STATE_UPDATE.getMethod())) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.Set;
|
||||
/**
|
||||
* IoT 设备【属性】数据 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDevicePropertyService {
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.getBigD
|
||||
/**
|
||||
* IoT 设备【属性】数据 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -145,7 +145,7 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService {
|
||||
}
|
||||
|
||||
// 1. 根据物模型,拼接合法的属性
|
||||
// TODO @芋艿:【待定 004】赋能后,属性到底以 thingModel 为准(ik),还是 db 的表结构为准(tl)?
|
||||
// TODO @管理员:【待定 004】赋能后,属性到底以 thingModel 为准(ik),还是 db 的表结构为准(tl)?
|
||||
List<IotThingModelDO> thingModels = thingModelService.getThingModelListByProductIdFromCache(device.getProductId());
|
||||
Map<String, Object> properties = new LinkedHashMap<>();
|
||||
params.forEach((key, value) -> {
|
||||
|
||||
@@ -17,7 +17,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT 产品分类 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotProductCategoryService {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.PRODUCT_CATEG
|
||||
/**
|
||||
* IoT 产品分类 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -150,7 +150,7 @@ public class IotProductServiceImpl implements IotProductService {
|
||||
validateProductExists(id);
|
||||
|
||||
// 2. 更新为发布状态,需要创建产品超级表数据模型
|
||||
// TODO @芋艿:【待定 001】1)是否需要操作后,在 redis 进行缓存,实现一个“快照”的情况,类似 tl;
|
||||
// TODO @管理员:【待定 001】1)是否需要操作后,在 redis 进行缓存,实现一个“快照”的情况,类似 tl;
|
||||
if (Objects.equals(status, IotProductStatusEnum.PUBLISHED.getStatus())) {
|
||||
devicePropertyDataService.defineDevicePropertyData(id);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 数据流转规则 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotDataRuleService {
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DATA_RULE_NOT
|
||||
/**
|
||||
* IoT 数据流转规则 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 规则场景规则 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotSceneRuleService {
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.RULE_SCENE_NO
|
||||
/**
|
||||
* IoT 规则场景 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -17,7 +17,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT 告警恢复的 {@link IotSceneRuleAction} 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
public class IotAlertRecoverSceneRuleAction implements IotSceneRuleAction {
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Map;
|
||||
/**
|
||||
* IoT 告警触发的 {@link IotSceneRuleAction} 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT 设备属性设置的 {@link IotSceneRuleAction} 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* IoT 场景联动的执行器接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotSceneRuleAction {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Set;
|
||||
/**
|
||||
* IoT 产品物模型 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public interface IotThingModelService {
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.*;
|
||||
/**
|
||||
* IoT 产品物模型 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
||||
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.*;
|
||||
* handleUpstreamDeviceMessage 与 sendDeviceMessage 下行成功路径依赖 SpringUtil.getBean 的自调用
|
||||
* createDeviceLogAsync,更适合放到集成测试,本类不展开。
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotDeviceMessageServiceImplTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.mockito.Mockito.*;
|
||||
/**
|
||||
* {@link IotDevicePropertyServiceImpl} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotDevicePropertyServiceImplTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class IotDataBridgeExecuteTest extends BaseMockitoUnitTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
// TODO @芋艿:@puhui999:需要调整下;
|
||||
// TODO @管理员:@puhui999:需要调整下;
|
||||
// 创建共享的测试消息
|
||||
//message = IotDeviceMessage.builder().messageId("TEST-001").reportTime(LocalDateTime.now())
|
||||
// .productKey("testProduct").deviceName("testDevice")
|
||||
|
||||
@@ -31,7 +31,7 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* {@link IotDataRuleServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Import(IotDataRuleServiceImpl.class)
|
||||
class IotDataRuleServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@@ -29,7 +29,7 @@ import static org.mockito.Mockito.*;
|
||||
* {@link IotSceneRuleServiceImpl} 的简化单元测试类
|
||||
* 使用 Mockito 进行纯单元测试,不依赖 Spring 容器
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotSceneRuleServiceSimpleTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* {@link IotAlertTriggerSceneRuleAction} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
public class IotAlertTriggerSceneRuleActionTest extends BaseMockitoUnitTest {
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
/**
|
||||
* {@link IotThingModelServiceImpl} 的单元测试
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Import(IotThingModelServiceImpl.class)
|
||||
public class IotThingModelServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@@ -39,9 +39,9 @@ logging:
|
||||
|
||||
--- #################### 监控相关配置 ####################
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
--- #################### 恭学相关配置 ####################
|
||||
|
||||
# 芋道配置项,设置当前项目所有自定义的配置
|
||||
# 恭学配置项,设置当前项目所有自定义的配置
|
||||
yudao:
|
||||
info:
|
||||
base-package: cn.iocoder.yudao
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
/**
|
||||
* IoT 设备认证 Request DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT 设备信息查询 Request DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotDeviceGetReqDTO {
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
/**
|
||||
* IoT 设备信息 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotDeviceRespDTO {
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Set;
|
||||
/**
|
||||
* IoT Modbus 设备配置列表查询 Request DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
/**
|
||||
* IoT Modbus 设备配置 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotModbusDeviceConfigRespDTO {
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.math.BigDecimal;
|
||||
/**
|
||||
* IoT Modbus 点位配置 Response DTO
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotModbusPointRespDTO {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
* <p>
|
||||
* 额外包含了网关设备的标识信息
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Data
|
||||
public class IotSubDeviceRegisterFullReqDTO {
|
||||
|
||||
@@ -22,7 +22,7 @@ public enum IotDeviceMessageMethodEnum implements ArrayValuable<String> {
|
||||
|
||||
STATE_UPDATE("thing.state.update", "设备状态更新", true),
|
||||
|
||||
// TODO 芋艿:要不要加个 ping 消息;
|
||||
// TODO 管理员:要不要加个 ping 消息;
|
||||
|
||||
// ========== 拓扑管理 ==========
|
||||
// 可参考:https://help.aliyun.com/zh/iot/user-guide/manage-topological-relationships
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Arrays;
|
||||
*
|
||||
* 用于定义传输层协议类型
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Arrays;
|
||||
*
|
||||
* 用于定义设备消息的序列化格式
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT Modbus 字节序枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT Modbus 数据帧格式枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT Modbus 工作模式枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* IoT Modbus 原始数据类型枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -38,7 +38,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
/**
|
||||
* IoT 消息总线自动配置
|
||||
*
|
||||
* @author 芋道源码
|
||||
* @author 恭学教育
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(IotMessageBusProperties.class)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user