feat(支持springboot3): 支持springboot3框架

This commit is contained in:
zhuangpeng.li
2025-04-27 17:56:52 +08:00
parent 5b6ec185c4
commit 4d8e1c5167
156 changed files with 528 additions and 549 deletions

View File

@@ -2,11 +2,10 @@ package com.fastbee.base.core.hanler;
import com.fastbee.common.core.protocol.Message;
import com.fastbee.base.session.Session;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collection;
/**
* 基础处理类
@@ -34,8 +33,9 @@ public abstract class BaseHandler {
this.targetMethod = targetMethod;
this.returnVoid = targetMethod.getReturnType().isAssignableFrom(Void.TYPE);
this.async = async;
if (desc == null || desc.isEmpty())
if (desc == null || desc.isEmpty()) {
desc = targetMethod.getName();
}
this.desc = desc;
Type[] types = targetMethod.getGenericParameterTypes();
@@ -44,8 +44,21 @@ public abstract class BaseHandler {
for (int i = 0; i < types.length; i++) {
Type type = types[i];
Class<?> clazz;
if (type instanceof ParameterizedTypeImpl) {
clazz = (Class<?>) ((ParameterizedTypeImpl) type).getActualTypeArguments()[0];
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
// 检查是否为List/Collection等容器类型
if (pt.getRawType() instanceof Class &&
((Class<?>) pt.getRawType()).isArray() ||
Collection.class.isAssignableFrom((Class<?>) pt.getRawType())) {
Type[] actualTypes = pt.getActualTypeArguments();
if (actualTypes.length > 0) {
clazz = (Class<?>) actualTypes[0];
} else {
clazz = Object.class; // 默认类型
}
} else {
clazz = (Class<?>) pt.getRawType(); // 处理非容器类型的参数化类型
}
} else {
clazz = (Class<?>) type;
}

View File

@@ -15,7 +15,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
/**
* 客户端认证
@@ -49,7 +49,9 @@ public class AuthService {
*/
public boolean auth(String clientId, String username, String password) {
//不需要账号密码校验,直接返回true
if (!mustPass) return true;
if (!mustPass) {
return true;
}
if (StringUtils.isEmpty(clientId) || StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
log.error("=>客户端参数缺少,clientId:{},username:{},password:{}", clientId, username, password);
return false;

View File

@@ -1,6 +1,5 @@
package com.fastbee.mqtt.handler;
import com.fastbee.common.constant.FastBeeConstant;
import com.fastbee.common.core.redis.RedisCache;
import com.fastbee.common.enums.ServerType;
import com.fastbee.common.utils.DateUtils;
@@ -21,7 +20,7 @@ import io.netty.util.CharsetUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.net.InetSocketAddress;

View File

@@ -27,7 +27,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.Objects;

View File

@@ -19,7 +19,7 @@ import io.netty.handler.codec.mqtt.*;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

View File

@@ -12,7 +12,7 @@ import io.netty.handler.codec.mqtt.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.nio.charset.StandardCharsets;

View File

@@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -117,6 +117,7 @@ public class DataHandlerImpl implements IDataHandler {
/**
* 上报设备信息
*/
@Override
public void reportDevice(ReportDataBo bo) {
try {
// 设备实体

View File

@@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.util.Optional;
/**

View File

@@ -45,7 +45,7 @@ import com.fastbee.ruleEngine.context.MsgContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

View File

@@ -9,7 +9,6 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.mqtt.*;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

View File

@@ -22,6 +22,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
<!-- ttl -->

View File

@@ -2,7 +2,7 @@ package com.fastbee.sip.model;
import lombok.Data;
import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;
import java.text.Collator;
import java.util.Comparator;
@Data

View File

@@ -19,7 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -155,6 +155,7 @@ public class VideoMqttService implements IMqttService {
}
}
@Override
public void publishChannelsProperty(String DeviceSipId, List<SipDeviceChannel> channels) {
SipConfig sipConfig = sipConfigService.selectSipConfigBydeviceSipId(DeviceSipId);
if (null != sipConfig) {
@@ -180,6 +181,7 @@ public class VideoMqttService implements IMqttService {
}
}
@Override
public void publishProperty(Long productId, String deviceNum, List<ThingsModelSimpleItem> thingsList, int delay) {
String pre = "";
if (delay > 0) {