【功能优化】Bpm:设备属性上报

This commit is contained in:
YunaiV 2025-01-28 04:56:03 +08:00
parent eb2d4fdbc0
commit 5fbfe49305
18 changed files with 147 additions and 137 deletions

View File

@ -35,7 +35,7 @@ public interface IotDeviceUpstreamApi {
* @param reportReqDTO 上报设备属性数据 DTO
*/
@PostMapping(PREFIX + "/report-property")
CommonResult<Boolean> reportDevicePropertyData(@Valid @RequestBody IotDevicePropertyReportReqDTO reportReqDTO);
CommonResult<Boolean> reportDeviceProperty(@Valid @RequestBody IotDevicePropertyReportReqDTO reportReqDTO);
/**
* 上报设备事件数据
@ -43,6 +43,6 @@ public interface IotDeviceUpstreamApi {
* @param reportReqDTO 设备事件
*/
@PostMapping(PREFIX + "/report-event")
CommonResult<Boolean> reportDeviceEventData(@Valid @RequestBody IotDeviceEventReportReqDTO reportReqDTO);
CommonResult<Boolean> reportDeviceEvent(@Valid @RequestBody IotDeviceEventReportReqDTO reportReqDTO);
}

View File

@ -30,7 +30,6 @@ public interface ErrorCodeConstants {
ErrorCode DEVICE_GATEWAY_NOT_EXISTS = new ErrorCode(1_050_003_004, "网关设备不存在");
ErrorCode DEVICE_NOT_GATEWAY = new ErrorCode(1_050_003_005, "设备不是网关设备");
ErrorCode DEVICE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_050_003_006, "导入设备数据不能为空!");
ErrorCode DEVICE_DATA_CONTENT_JSON_PARSE_ERROR = new ErrorCode(1_050_003_007, "导入设备数据格式错误!");
// ========== 产品分类 1-050-004-000 ==========
ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1_050_004_000, "产品分类不存在");

View File

@ -1,22 +1,32 @@
package cn.iocoder.yudao.module.iot.enums.device;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
/**
* IoT 设备消息类型枚举
*/
@Getter
@RequiredArgsConstructor
public enum IotDeviceMessageTypeEnum {
public enum IotDeviceMessageTypeEnum implements ArrayValuable<String> {
STATE("state"), // 设备状态
PROPERTY("property"), // 设备属性
EVENT("event"); // 设备事件
public static final String[] ARRAYS = Arrays.stream(values()).map(IotDeviceMessageTypeEnum::getType).toArray(String[]::new);
/**
* 属性
*/
private final String type;
@Override
public String[] array() {
return ARRAYS;
}
}

View File

@ -29,14 +29,14 @@ public class IoTDeviceUpstreamApiImpl implements IotDeviceUpstreamApi {
}
@Override
public CommonResult<Boolean> reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO) {
deviceUpstreamService.reportDevicePropertyData(reportReqDTO);
public CommonResult<Boolean> reportDeviceProperty(IotDevicePropertyReportReqDTO reportReqDTO) {
deviceUpstreamService.reportDeviceProperty(reportReqDTO);
return success(true);
}
@Override
public CommonResult<Boolean> reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO) {
deviceUpstreamService.reportDeviceEventData(reportReqDTO);
public CommonResult<Boolean> reportDeviceEvent(IotDeviceEventReportReqDTO reportReqDTO) {
deviceUpstreamService.reportDeviceEvent(reportReqDTO);
return success(true);
}

View File

@ -159,4 +159,12 @@ public class IotDeviceController {
ExcelUtils.write(response, "设备导入模板.xls", "数据", IotDeviceImportExcelVO.class, list);
}
@PostMapping("/simulation-report")
@Operation(summary = "模拟设备上报")
@PreAuthorize("@ss.hasPermission('iot:device:simulation-report')")
public CommonResult<Boolean> simulationReportDevice(@Valid @RequestBody IotDeviceSimulationReportReqVO simulatorReqVO) {
deviceService.simulationReportDevice(simulatorReqVO);
return success(true);
}
}

View File

@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.*;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceLogDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO;
import cn.iocoder.yudao.module.iot.service.device.data.IotDeviceLogService;
import cn.iocoder.yudao.module.iot.service.device.data.IotDevicePropertyService;
import io.swagger.v3.oas.annotations.Operation;
@ -13,7 +13,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@ -47,16 +49,6 @@ public class IotDeviceDataController {
return success(BeanUtils.toBean(list, IotTimeDataRespVO.class));
}
// TODO:功能权限
@PostMapping("/simulator")
@Operation(summary = "模拟设备")
public CommonResult<Boolean> simulatorDevice(@Valid @RequestBody IotDeviceDataSimulatorSaveReqVO simulatorReqVO) {
//TODO:先使用 IotDeviceDataSimulatorSaveReqVO 另外content里数据类型的效验前端也没做后端应该要要效验一下这块后续看看怎么安排
// TODO @super应该 deviceDataService 里面有个 simulatorDevice然后里面去 insert 日志
deviceDataService.simulatorSend(simulatorReqVO);
return success(true);
}
// TODO:功能权限
@GetMapping("/log/page")
@Operation(summary = "获得设备日志分页")

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.iot.controller.admin.device.vo.device;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.iot.enums.device.IotDeviceMessageTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - IoT 模拟设备上报 Request VO") // 属性上报事件上报状态变更等
@Data
public class IotDeviceSimulationReportReqVO {
@Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "177")
@NotNull(message = "设备编号不能为空")
private Long id;
@Schema(description = "消息类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "property")
@NotEmpty(message = "消息类型不能为空")
@InEnum(IotDeviceMessageTypeEnum.class)
private String type;
@Schema(description = "标识符", requiredMode = Schema.RequiredMode.REQUIRED, example = "report")
@NotEmpty(message = "标识符不能为空")
private String identifier; // 参见 IotDeviceMessageIdentifierEnum 枚举类
@Schema(description = "请求参数", requiredMode = Schema.RequiredMode.REQUIRED)
private Object data; // 例如说属性上报的 properties事件上报的 params
}

View File

@ -1,44 +0,0 @@
package cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
// TODO super SaveReqVO => ReqVO
@Schema(description = "管理后台 - IoT 模拟设备数据 Request VO")
@Data
public class IotDeviceDataSimulatorSaveReqVO {
// TODO @super感觉后端随机更合适
@Schema(description = "消息 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "msg123")
private String id;
// TODO @super不用传递 productKey因为 deviceKey 可以推导出来
// TODO 讨论: 日志记录的时候要记录一下productKey目前是前端已经有productKey了所以前端传入如果不传入的话后端要根据deviceKey查询productKey感觉直传是不是效率高一些
@Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "product123")
@NotEmpty(message = "产品标识不能为空")
private String productKey;
@Schema(description = "设备标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "device123")
@NotEmpty(message = "设备标识不能为空")
private String deviceKey;
// TODO @supertypesubType是不是不用传递因为模拟只有属性
// TODO 讨论: 不只模拟属性
@Schema(description = "消息/日志类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "property")
@NotEmpty(message = "消息类型不能为空")
private String type;
@Schema(description = "标识符", requiredMode = Schema.RequiredMode.REQUIRED, example = "temperature")
@NotEmpty(message = "标识符不能为空")
private String subType;
@Schema(description = "数据内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "{\"value\": 25.6}")
@NotEmpty(message = "数据内容不能为空")
private String content;
// TODO @芋艿需要讨论下reportTime 到底以那个为准
@Schema(description = "上报时间", requiredMode = Schema.RequiredMode.REQUIRED)
private Long reportTime;
}

View File

@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.nio.file.Paths;
// TODO @芋艿需要 review
@Slf4j
@Configuration
@ -19,8 +21,8 @@ public class UnifiedConfiguration {
// @DependsOn("deviceDataApiImpl")
public SpringPluginManager pluginManager() {
log.info("[init][实例化 SpringPluginManager]");
// SpringPluginManager springPluginManager = new SpringPluginManager(Paths.get(pluginsDir)) {
SpringPluginManager springPluginManager = new SpringPluginManager() {
SpringPluginManager springPluginManager = new SpringPluginManager(Paths.get(pluginsDir)) {
// SpringPluginManager springPluginManager = new SpringPluginManager() {
@Override
public void startPlugins() {

View File

@ -1,13 +1,8 @@
package cn.iocoder.yudao.module.iot.service.device;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDevicePageReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDeviceSaveReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDeviceStatusUpdateReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDeviceUpdateGroupReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.*;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDeviceImportRespVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDeviceImportExcelVO;
import jakarta.validation.Valid;
import javax.annotation.Nullable;
@ -133,4 +128,11 @@ public interface IotDeviceService {
*/
IotDeviceImportRespVO importDevice(List<IotDeviceImportExcelVO> importDevices, boolean updateSupport);
/**
* 模拟设备上报
*
* @param reportReqVO 上报信息
*/
void simulationReportDevice(IotDeviceSimulationReportReqVO reportReqVO);
}

View File

@ -11,14 +11,17 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
import cn.iocoder.yudao.module.iot.api.device.dto.IotDevicePropertyReportReqDTO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.*;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceGroupDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
import cn.iocoder.yudao.module.iot.dal.mysql.device.IotDeviceMapper;
import cn.iocoder.yudao.module.iot.dal.redis.RedisKeyConstants;
import cn.iocoder.yudao.module.iot.enums.device.IotDeviceMessageTypeEnum;
import cn.iocoder.yudao.module.iot.enums.device.IotDeviceStatusEnum;
import cn.iocoder.yudao.module.iot.enums.product.IotProductDeviceTypeEnum;
import cn.iocoder.yudao.module.iot.service.device.upstream.IotDeviceUpstreamService;
import cn.iocoder.yudao.module.iot.service.product.IotProductService;
import jakarta.annotation.Resource;
import jakarta.validation.ConstraintViolationException;
@ -56,6 +59,9 @@ public class IotDeviceServiceImpl implements IotDeviceService {
@Resource
@Lazy // 延迟加载解决循环依赖
private IotDeviceGroupService deviceGroupService;
@Resource
@Lazy // 延迟加载解决循环依赖
private IotDeviceUpstreamService deviceUpstreamService;
@Override
public Long createDevice(IotDeviceSaveReqVO createReqVO) {
@ -84,6 +90,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
// 2.1 转换 VO DO
// TODO @芋艿state 相关的参数另外到底叫 state还是 status
// TODO @芋艿各种 mqtt 是不是可以简化
IotDeviceDO device = BeanUtils.toBean(createReqVO, IotDeviceDO.class, o -> {
o.setProductKey(product.getProductKey()).setDeviceType(product.getDeviceType());
// 生成并设置必要的字段
@ -392,6 +399,36 @@ public class IotDeviceServiceImpl implements IotDeviceService {
return respVO;
}
@Override
@SuppressWarnings("unchecked")
public void simulationReportDevice(IotDeviceSimulationReportReqVO reportReqVO) {
// 1. 校验存在
IotDeviceDO device = validateDeviceExists(reportReqVO.getId());
// 2.1 情况一属性上报
String requestId = IdUtil.fastSimpleUUID();
if (Objects.equals(reportReqVO.getType(), IotDeviceMessageTypeEnum.PROPERTY.getType())) {
deviceUpstreamService.reportDeviceProperty(IotDevicePropertyReportReqDTO.builder()
.requestId(requestId).reportTime(LocalDateTime.now())
.productKey(device.getProductKey()).deviceName(device.getDeviceName())
.properties((Map<String, Object>) reportReqVO.getData()).build());
return;
}
// 2.2 情况二事件上报
if (Objects.equals(reportReqVO.getType(), IotDeviceMessageTypeEnum.EVENT.getType())) {
// TODO 芋艿待实现
return;
}
// 2.3 情况三状态变更
if (Objects.equals(reportReqVO.getType(), IotDeviceMessageTypeEnum.STATE.getType())) {
// TODO 芋艿待实现
updateDeviceStatus(new IotDeviceStatusUpdateReqVO().setId(device.getId())
.setStatus((Integer) reportReqVO.getData()));
return;
}
throw new IllegalArgumentException("未知的类型:" + reportReqVO.getType());
}
private void deleteDeviceCache(IotDeviceDO device) {
// 保证在 @CacheEvict 之前忽略租户
TenantUtils.executeIgnore(() -> getSelf().deleteDeviceCache0(device));

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.iot.service.device.data;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataPageReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataSimulatorSaveReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO;
import cn.iocoder.yudao.module.iot.mq.message.IotDeviceMessage;
import jakarta.validation.Valid;
@ -31,13 +30,6 @@ public interface IotDevicePropertyService {
*/
void saveDeviceProperty(IotDeviceMessage message);
/**
* 模拟设备
*
* @param simulatorReqVO 设备数据
*/
void simulatorSend(IotDeviceDataSimulatorSaveReqVO simulatorReqVO);
/**
* 获得设备属性最新数据
*

View File

@ -4,12 +4,9 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataPageReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.device.vo.deviceData.IotDeviceDataSimulatorSaveReqVO;
import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelDateOrTextDataSpecs;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO;
@ -34,9 +31,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_DATA_CONTENT_JSON_PARSE_ERROR;
/**
* IoT 设备属性数据 Service 实现类
@ -155,33 +150,6 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService {
entry -> IotDevicePropertyDO.builder().value(entry.getValue()).updateTime(message.getReportTime()).build()));
}
//TODO @芋艿:copy saveDeviceData 的逻辑后续看看这块怎么优化
@Override
public void simulatorSend(IotDeviceDataSimulatorSaveReqVO simulatorReqVO) {
// 1. 根据设备 key 获得设备信息
IotDeviceDO device = deviceService.getDeviceByDeviceKey(simulatorReqVO.getDeviceKey());
// 2. 解析 content JSON 对象
JSONObject contentJson;
try {
contentJson = JSONUtil.parseObj(simulatorReqVO.getContent());
} catch (Exception e) {
throw exception(DEVICE_DATA_CONTENT_JSON_PARSE_ERROR);
}
// TODO @芋艿后续优化
// 3. 构建物模型消息
// IotDeviceMessage thingModelMessage = IotDeviceMessage.builder()
// .params(contentJson) // content 作为 params
// .time(simulatorReqVO.getReportTime()) // 使用上报时间
// .productKey(simulatorReqVO.getProductKey())
// .deviceName(device.getDeviceName())
// .build();
// 4. 发送模拟消息
// simulateSendProducer.sendDeviceMessage(thingModelMessage);
}
@Override
public List<IotDevicePropertyDO> getLatestDeviceProperties(@Valid IotDeviceDataPageReqVO deviceDataReqVO) {
// List<IotDevicePropertyDO> list = new ArrayList<>();

View File

@ -25,13 +25,13 @@ public interface IotDeviceUpstreamService {
*
* @param reportReqDTO 上报设备属性数据 DTO
*/
void reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO);
void reportDeviceProperty(IotDevicePropertyReportReqDTO reportReqDTO);
/**
* 上报设备事件数据
*
* @param reportReqDTO 设备事件
*/
void reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO);
void reportDeviceEvent(IotDeviceEventReportReqDTO reportReqDTO);
}

View File

@ -43,7 +43,7 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
}
@Override
public void reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO) {
public void reportDeviceProperty(IotDevicePropertyReportReqDTO reportReqDTO) {
// 1.1 获得设备
log.info("[reportDevicePropertyData][上报设备属性数据: {}]", reportReqDTO);
IotDeviceDO device = deviceService.getDeviceByProductKeyAndDeviceNameFromCache(
@ -65,7 +65,7 @@ public class IotDeviceUpstreamServiceImpl implements IotDeviceUpstreamService {
}
@Override
public void reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO) {
public void reportDeviceEvent(IotDeviceEventReportReqDTO reportReqDTO) {
log.info("[reportDeviceEventData][上报设备事件数据: {}]", reportReqDTO);
// TODO 芋艿待实现

View File

@ -35,13 +35,13 @@ public class DeviceDataApiClient implements IotDeviceUpstreamApi {
}
@Override
public CommonResult<Boolean> reportDeviceEventData(IotDeviceEventReportReqDTO reportReqDTO) {
public CommonResult<Boolean> reportDeviceEvent(IotDeviceEventReportReqDTO reportReqDTO) {
String url = deviceDataUrl + URL_PREFIX + "/report-event";
return doPost(url, reportReqDTO, "reportDeviceEventData");
}
@Override
public CommonResult<Boolean> reportDevicePropertyData(IotDevicePropertyReportReqDTO reportReqDTO) {
public CommonResult<Boolean> reportDeviceProperty(IotDevicePropertyReportReqDTO reportReqDTO) {
String url = deviceDataUrl + URL_PREFIX + "/report-property";
return doPost(url, reportReqDTO, "reportDevicePropertyData");
}

View File

@ -49,7 +49,7 @@ public class HttpVertxHandler implements Handler<RoutingContext> {
.properties((Map<String, Object>) requestBody.asJsonObject().getMap().get("properties"))
.build();
deviceDataApi.reportDevicePropertyData(reportReqDTO);
deviceDataApi.reportDeviceProperty(reportReqDTO);
ctx.response()
.setStatusCode(200)

View File

@ -45,16 +45,16 @@ spring:
primary: master
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例
url: jdbc:mysql://chaojiniu.top:23306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# 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 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true;useUnicode=true;characterEncoding=utf-8 # SQLServer 连接的示例
# url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
username: root
password: 123456
username: ruoyi-vue-pro
password: ruoyi-@h2ju02hebp
# username: sa # SQL Server 连接的示例
# password: Yudao@2024 # SQL Server 连接的示例
# username: SYSDBA # DM 连接的示例
@ -63,17 +63,25 @@ spring:
# password: Yudao@2024 # OpenGauss 连接的示例
slave: # 模拟从库,可根据自己需要修改
lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://chaojiniu.top:23306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: ruoyi-vue-pro
password: ruoyi-@h2ju02hebp
tdengine: # IOT 数据库
# lazy: true # 开启懒加载,保证启动速度
url: jdbc:TAOS-RS://chaojiniu.top:6041/ruoyi_vue_pro
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
username: root
password: 123456
password: taosdata
druid:
validation-query: SELECT SERVER_STATUS() # TDengine 数据源的有效性检查 SQL
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data:
redis:
host: 127.0.0.1 # 地址
port: 6379 # 端口
database: 0 # 数据库索引
# password: dev # 密码,建议生产环境开启
database: 1 # 数据库索引
# password: 123456 # 密码,建议生产环境开启
--- #################### 定时任务相关配置 ####################
@ -175,20 +183,22 @@ logging:
cn.iocoder.yudao.module.crm.dal.mysql: debug
cn.iocoder.yudao.module.erp.dal.mysql: debug
cn.iocoder.yudao.module.iot.dal.mysql: debug
cn.iocoder.yudao.module.iot.dal.tdengine: DEBUG
cn.iocoder.yudao.module.ai.dal.mysql: debug
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿先禁用Spring Boot 3.X 存在部分错误的 WARN 提示
com.taosdata: DEBUG # TDengine 的日志级别
debug: false
--- #################### 微信公众号、小程序相关配置 ####################
wx:
mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
# app-id: wx041349c6f39b268b # 测试号(牛希尧提供的)
# secret: 5abee519483bc9f8cb37ce280e814bd0
# app-id: wx041349c6f39b268b # 测试号(牛希尧提供的)
# secret: 5abee519483bc9f8cb37ce280e814bd0
app-id: wx5b23ba7a5589ecbb # 测试号(自己的)
secret: 2a7b3b20c537e52e74afd395eb85f61f
# app-id: wxa69ab825b163be19 # 测试号Kongdy 提供的)
# secret: bd4f9fab889591b62aeac0d7b8d8b4a0
# app-id: wxa69ab825b163be19 # 测试号Kongdy 提供的)
# secret: bd4f9fab889591b62aeac0d7b8d8b4a0
# 存储配置,解决 AccessToken 的跨节点的共享
config-storage:
type: RedisTemplate # 采用 RedisTemplate 操作 Redis会自动从 Spring 中获取
@ -197,10 +207,10 @@ wx:
miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档
# appid: wx62056c0d5e8db250 # 测试号(牛希尧提供的)
# secret: 333ae72f41552af1e998fe1f54e1584a
# appid: wx63c280fe3248a3e7 # wenhualian的接口测试号
# secret: 6f270509224a7ae1296bbf1c8cb97aed
# appid: wxc4598c446f8a9cb3 # 测试号Kongdy 提供的)
# secret: 4a1a04e07f6a4a0751b39c3064a92c8b
# appid: wx63c280fe3248a3e7 # wenhualian的接口测试号
# secret: 6f270509224a7ae1296bbf1c8cb97aed
# appid: wxc4598c446f8a9cb3 # 测试号Kongdy 提供的)
# secret: 4a1a04e07f6a4a0751b39c3064a92c8b
appid: wx66186af0759f47c9 # 测试号puhui 提供的)
secret: 3218bcbd112cbc614c7264ceb20144ac
config-storage:
@ -260,7 +270,7 @@ justauth:
iot:
emq:
# 账号
username: anhaohao
username: haohao
# 密码
password: ahh@123456
# 主机地址
@ -273,3 +283,7 @@ iot:
keepalive: 60
# 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
clearSession: true
pf4j:
# pluginsDir: /tmp/
pluginsDir: ../plugins