Commit d9dda54ccedb9dbf9ea13dc1190f95a136f55db5

Authored by alwayssuper
1 parent 8a7e1464

local

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/tdengine/IotDeviceLogDataMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.dal.tdengine;
  2 +
  3 +import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceLogDO;
  4 +import cn.iocoder.yudao.module.iot.framework.tdengine.core.annotation.TDengineDS;
  5 +import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
  6 +import org.apache.ibatis.annotations.Mapper;
  7 +import org.apache.ibatis.annotations.Param;
  8 +
  9 +/**
  10 + * IoT 设备日志 Mapper
  11 + *
  12 + * @author alwayssuper
  13 + */
  14 +@Mapper
  15 +@TDengineDS
  16 +@InterceptorIgnore(tenantLine = "true") // 避免 SQL 解析,因为 JSqlParser 对 TDengine 的 SQL 解析会报错
  17 +public interface IotDeviceLogDataMapper {
  18 +
  19 + /**
  20 + * 创建设备日志超级表
  21 + * 初始化只创建一次
  22 + */
  23 + void createDeviceLogSTable();
  24 +
  25 + /**
  26 + * 创建设备日志子表
  27 + *
  28 + * @param deviceKey 设备标识
  29 + */
  30 + void createDeviceLogTable( @Param("deviceKey") String deviceKey);
  31 +
  32 + /**
  33 + * 插入设备日志数据
  34 + *
  35 + * @param log 设备日志数据
  36 + */
  37 + void insert(@Param("log") IotDeviceLogDO log);
  38 +
  39 +}
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/device/IotDeviceLogDataService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.service.device;
  2 +
  3 +import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataSimulatorSaveReqVO;
  4 +
  5 +/**
  6 + * IoT 设备日志数据 Service 接口
  7 + *
  8 + * @author alwayssuper
  9 + */
  10 +public interface IotDeviceLogDataService {
  11 +
  12 + /**
  13 + * 初始化 TDengine 表
  14 + */
  15 + void initTDengineSTable();
  16 +
  17 + /**
  18 + * 模拟设备创建设备日志
  19 + * @param simulatorReqVO 模拟设备信息
  20 + */
  21 + void createDeviceLog(IotDeviceDataSimulatorSaveReqVO simulatorReqVO);
  22 +}
... ...
yudao-server/src/main/resources/application-local.yaml
... ... @@ -45,7 +45,7 @@ spring:
45 45 primary: master
46 46 datasource:
47 47 master:
48   - url: jdbc:mysql://127.0.0.1:3307/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
  48 + url: jdbc:mysql://chaojiniu.top:23306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
49 49 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
50 50 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
51 51 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
... ... @@ -53,8 +53,8 @@ spring:
53 53 # url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
54 54 # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
55 55 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
56   - username: root
57   - password: ahh@123456
  56 + username: ruoyi-vue-pro
  57 + password: ruoyi-@h2ju02hebp
58 58 # username: sa # SQL Server 连接的示例
59 59 # password: Yudao@2024 # SQL Server 连接的示例
60 60 # username: SYSDBA # DM 连接的示例
... ... @@ -63,17 +63,25 @@ spring:
63 63 # password: Yudao@2024 # OpenGauss 连接的示例
64 64 slave: # 模拟从库,可根据自己需要修改
65 65 lazy: true # 开启懒加载,保证启动速度
66   - url: jdbc:mysql://127.0.0.1:3307/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
  66 + url: jdbc:mysql://chaojiniu.top:23306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
  67 + username: ruoyi-vue-pro
  68 + password: ruoyi-@h2ju02hebp
  69 + tdengine: # IOT 数据库
  70 +# lazy: true # 开启懒加载,保证启动速度
  71 + url: jdbc:TAOS-RS://chaojiniu.top:6041/ruoyi_vue_pro
  72 + driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
67 73 username: root
68   - password: ahh@123456
  74 + password: taosdata
  75 + druid:
  76 + validation-query: SELECT SERVER_STATUS() # TDengine 数据源的有效性检查 SQL
69 77  
70 78 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
71 79 data:
72 80 redis:
73   - host: 127.0.0.1 # 地址
  81 + host: chaojiniu.top # 地址
74 82 port: 6379 # 端口
75   - database: 0 # 数据库索引
76   -# password: dev # 密码,建议生产环境开启
  83 + database: 15 # 数据库索引
  84 + password: fsknKD7UvQYZsyf2hXXn # 密码,建议生产环境开启
77 85  
78 86 --- #################### 定时任务相关配置 ####################
79 87  
... ... @@ -175,8 +183,10 @@ logging:
175 183 cn.iocoder.yudao.module.crm.dal.mysql: debug
176 184 cn.iocoder.yudao.module.erp.dal.mysql: debug
177 185 cn.iocoder.yudao.module.iot.dal.mysql: debug
  186 + cn.iocoder.yudao.module.iot.dal.tdengine: DEBUG
178 187 cn.iocoder.yudao.module.ai.dal.mysql: debug
179 188 org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿:先禁用,Spring Boot 3.X 存在部分错误的 WARN 提示
  189 + com.taosdata: DEBUG # TDengine 的日志级别
180 190  
181 191 debug: false
182 192  
... ... @@ -259,7 +269,7 @@ justauth:
259 269 iot:
260 270 emq:
261 271 # 账号
262   - username: anhaohao
  272 + username: haohao
263 273 # 密码
264 274 password: ahh@123456
265 275 # 主机地址
... ... @@ -271,4 +281,5 @@ iot:
271 281 # 保持连接
272 282 keepalive: 60
273 283 # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
274   - clearSession: true
275 284 \ No newline at end of file
  285 + clearSession: true
  286 +
... ...
yudao-server/src/main/resources/application.yaml
... ... @@ -328,4 +328,7 @@ yudao:
328 328 key: pLXUGAwK5305
329 329 customer: E77DF18BE109F454A5CD319E44BF5177
330 330  
331   -debug: false
332 331 \ No newline at end of file
  332 +debug: false
  333 +# 插件配置
  334 +pf4j:
  335 + pluginsDir: /Users/anhaohao/code/gitee/ruoyi-vue-pro/plugins # 插件目录
333 336 \ No newline at end of file
... ...