新增 netty整合mqtt协议,与车位相机通讯并保存通讯信息

This commit is contained in:
Lemon
2023-12-20 16:17:34 +08:00
parent 7015cb1234
commit 5fbce62752
16 changed files with 972 additions and 23 deletions

View File

@@ -199,6 +199,16 @@ public class CacheConstants {
*/
public static final String CAMERA_IMAGE_BY_PLATE_NUMBER = "CAMERA_IMAGE_BY_PLATE_NUMBER_";
/**
* 相机心跳数据
*/
public static final String CAMERA_HEARTBEAT = "CAMERA_HEARTBEAT_";
/**
* 相机设备 sn 和 channelId 进行绑定
*/
public static final String MQTT_CONNECT_CHANNEL = "MQTT_CONNECT_CHANNEL_";
/**
* 桩硬件故障
*/

View File

@@ -1,5 +1,10 @@
package com.jsowell.common.util.bean;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -11,7 +16,11 @@ import java.util.regex.Pattern;
*
* @author jsowell
*/
public class BeanUtils extends org.springframework.beans.BeanUtils {
@Component
public class BeanUtils extends org.springframework.beans.BeanUtils implements ApplicationContextAware {
protected static ApplicationContext applicationContext;
/**
* Bean方法名中属性名开始的下标
*/
@@ -101,4 +110,18 @@ public class BeanUtils extends org.springframework.beans.BeanUtils {
public static boolean isMethodPropEquals(String m1, String m2) {
return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX));
}
@Override
public void setApplicationContext(ApplicationContext app) throws BeansException {
if (applicationContext == null) {
applicationContext = app;
}
}
/**
* 通过类的class从容器中手动获取对象
*/
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
}