【同步】BOOT 和 CLOUD 的功能

This commit is contained in:
YunaiV 2025-10-02 18:51:27 +08:00
parent cd685e2304
commit bf0c7dadc7
2 changed files with 4 additions and 8 deletions

View File

@ -48,7 +48,7 @@ public class YudaoWebAutoConfiguration {
@Override
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
var mapping = new RequestMappingHandlerMapping();
RequestMappingHandlerMapping mapping = new RequestMappingHandlerMapping();
// 实例化时就带上前缀
mapping.setPathPrefixes(buildPathPrefixes(webProperties));
return mapping;

View File

@ -240,24 +240,20 @@ public class IotSceneRuleServiceImpl implements IotSceneRuleService {
* @return 规则场景列表
*/
private List<IotSceneRuleDO> getMatchedSceneRuleListByMessage(IotDeviceMessage message) {
// 1. 匹配设备
// TODO 缓存 @puhui999可能需要 getSelf()
// 1.1 通过 deviceId 获取设备信息
IotDeviceDO device = getSelf().deviceService.getDeviceFromCache(message.getDeviceId());
if (device == null) {
log.warn("[getMatchedSceneRuleListByMessage][设备({}) 不存在]", message.getDeviceId());
return List.of();
return ListUtil.of();
}
// 1.2 通过 productId 获取产品信息
IotProductDO product = getSelf().productService.getProductFromCache(device.getProductId());
if (product == null) {
log.warn("[getMatchedSceneRuleListByMessage][产品({}) 不存在]", device.getProductId());
return List.of();
return ListUtil.of();
}
// 1.3 获取匹配的规则场景
List<IotSceneRuleDO> sceneRules = getSceneRuleListByProductIdAndDeviceIdFromCache(
List<IotSceneRuleDO> sceneRules = getSelf().getSceneRuleListByProductIdAndDeviceIdFromCache(
product.getId(), device.getId());
if (CollUtil.isEmpty(sceneRules)) {
return sceneRules;