【功能完善】IoT: 更新 MQTT 主题配置为数组,重构 EMQX 认证逻辑,优化异常处理和响应格式

This commit is contained in:
安浩浩
2025-03-02 20:47:50 +08:00
parent c6b58b0ebf
commit 3c9985978b
8 changed files with 47 additions and 92 deletions

View File

@@ -1,39 +0,0 @@
package cn.iocoder.yudao.module.iot.framework.tdengine.core;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import java.sql.Timestamp;
import java.util.Map;
// TODO @haohao这个还需要的么
/**
* TaosAspect 是一个处理 Taos 数据库返回值的切面。
*/
@Aspect
@Component
@Slf4j
public class TaosAspect {
@Around("execution(java.util.Map<String,Object> cn.iocoder.yudao.module.iot.dal.tdengine.*.*(..))")
public Object handleType(ProceedingJoinPoint joinPoint) {
Map<String, Object> result = null;
try {
result = (Map<String, Object>) joinPoint.proceed();
result.replaceAll((key, value) -> {
if (value instanceof byte[]) {
return new String((byte[]) value);
} else if (value instanceof Timestamp) {
return ((Timestamp) value).getTime();
}
return value;
});
} catch (Throwable e) {
log.error("TaosAspect handleType error", e);
}
return result;
}
}