优化各个配置启动顺序
This commit is contained in:
parent
4446218f9e
commit
2d2832dbe9
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.conf;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -14,6 +15,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
|
|
||||||
@Configuration("mediaConfig")
|
@Configuration("mediaConfig")
|
||||||
|
@Order(0)
|
||||||
public class MediaConfig{
|
public class MediaConfig{
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(MediaConfig.class);
|
private final static Logger logger = LoggerFactory.getLogger(MediaConfig.class);
|
||||||
|
@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
|
|||||||
import org.apache.http.HttpHost;
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.HttpRequest;
|
import org.apache.http.HttpRequest;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -25,6 +26,7 @@ import java.net.ConnectException;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@Order(1)
|
||||||
public class ProxyServletConfig {
|
public class ProxyServletConfig {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ProxyServletConfig.class);
|
private final static Logger logger = LoggerFactory.getLogger(ProxyServletConfig.class);
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "sip", ignoreInvalidFields = true)
|
@ConfigurationProperties(prefix = "sip", ignoreInvalidFields = true)
|
||||||
|
@Order(0)
|
||||||
public class SipConfig {
|
public class SipConfig {
|
||||||
|
|
||||||
private String ip;
|
private String ip;
|
||||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||||||
* @author lin
|
* @author lin
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Order(value=3)
|
@Order(value=13)
|
||||||
public class SipPlatformRunner implements CommandLineRunner {
|
public class SipPlatformRunner implements CommandLineRunner {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.info.Contact;
|
import io.swagger.v3.oas.models.info.Contact;
|
||||||
import io.swagger.v3.oas.models.info.Info;
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
import io.swagger.v3.oas.models.info.License;
|
import io.swagger.v3.oas.models.info.License;
|
||||||
import io.swagger.v3.oas.models.media.StringSchema;
|
import org.junit.jupiter.api.Order;
|
||||||
import io.swagger.v3.oas.models.parameters.HeaderParameter;
|
|
||||||
import org.springdoc.core.GroupedOpenApi;
|
import org.springdoc.core.GroupedOpenApi;
|
||||||
import org.springdoc.core.SpringDocConfigProperties;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -17,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
* @author lin
|
* @author lin
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@Order(1)
|
||||||
public class SpringDocConfig {
|
public class SpringDocConfig {
|
||||||
|
|
||||||
@Value("${doc.enabled: true}")
|
@Value("${doc.enabled: true}")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
@ -12,6 +13,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||||||
* @author lin
|
* @author lin
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@Order(1)
|
||||||
@EnableAsync(proxyTargetClass = true)
|
@EnableAsync(proxyTargetClass = true)
|
||||||
public class ThreadPoolTaskConfig {
|
public class ThreadPoolTaskConfig {
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true)
|
@ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true)
|
||||||
|
@Order(0)
|
||||||
public class UserSetting {
|
public class UserSetting {
|
||||||
|
|
||||||
private Boolean savePositionHistory = Boolean.FALSE;
|
private Boolean savePositionHistory = Boolean.FALSE;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "version")
|
@ConfigurationProperties(prefix = "version")
|
||||||
|
@Order(0)
|
||||||
public class VersionConfig {
|
public class VersionConfig {
|
||||||
|
|
||||||
private String version;
|
private String version;
|
||||||
|
@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.listener.PatternTopic;
|
import org.springframework.data.redis.listener.PatternTopic;
|
||||||
@ -23,6 +24,7 @@ import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@Order(value=1)
|
||||||
public class RedisConfig extends CachingConfigurerSupport {
|
public class RedisConfig extends CachingConfigurerSupport {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.genersoft.iot.vmp.conf.security;
|
package com.genersoft.iot.vmp.conf.security;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -25,6 +26,7 @@ import java.util.List;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||||
|
@Order(1)
|
||||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
|
private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
|
||||||
|
@ -19,7 +19,7 @@ import java.util.*;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Order(value=1)
|
@Order(value=10)
|
||||||
public class SipLayer implements CommandLineRunner {
|
public class SipLayer implements CommandLineRunner {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(SipLayer.class);
|
private final static Logger logger = LoggerFactory.getLogger(SipLayer.class);
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
|||||||
* @author lin
|
* @author lin
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Order(value=4)
|
@Order(value=14)
|
||||||
public class SipRunner implements CommandLineRunner {
|
public class SipRunner implements CommandLineRunner {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -38,6 +38,7 @@ import javax.sip.header.FromHeader;
|
|||||||
import javax.sip.message.Response;
|
import javax.sip.message.Response;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,6 +151,17 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||||||
Element deviceIdElement = rootElement.element("DeviceID");
|
Element deviceIdElement = rootElement.element("DeviceID");
|
||||||
String channelId = deviceIdElement.getTextTrim().toString();
|
String channelId = deviceIdElement.getTextTrim().toString();
|
||||||
Device device = redisCatchStorage.getDevice(deviceId);
|
Device device = redisCatchStorage.getDevice(deviceId);
|
||||||
|
|
||||||
|
if (device == null) {
|
||||||
|
// 根据通道id查询设备Id
|
||||||
|
List<Device> deviceList = deviceChannelService.getDeviceByChannelId(channelId);
|
||||||
|
if (deviceList.size() > 0) {
|
||||||
|
device = deviceList.get(0);
|
||||||
|
}else {
|
||||||
|
logger.warn("[mobilePosition移动位置Notify] 未找到通道{}所属的设备", channelId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
if (!ObjectUtils.isEmpty(device.getName())) {
|
if (!ObjectUtils.isEmpty(device.getName())) {
|
||||||
mobilePosition.setDeviceName(device.getName());
|
mobilePosition.setDeviceName(device.getName());
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.ServiceInfo;
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
||||||
@ -92,7 +91,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
System.out.println(ServiceInfo.getServerPort());
|
// System.out.println(ServiceInfo.getServerPort());
|
||||||
SIPRequest request = (SIPRequest)evt.getRequest();
|
SIPRequest request = (SIPRequest)evt.getRequest();
|
||||||
Response response = null;
|
Response response = null;
|
||||||
boolean passwordCorrect = false;
|
boolean passwordCorrect = false;
|
||||||
|
@ -25,7 +25,7 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Order(value=2)
|
@Order(value=12)
|
||||||
public class ZLMRunner implements CommandLineRunner {
|
public class ZLMRunner implements CommandLineRunner {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ZLMRunner.class);
|
private final static Logger logger = LoggerFactory.getLogger(ZLMRunner.class);
|
||||||
|
@ -51,4 +51,9 @@ public interface IDeviceChannelService {
|
|||||||
* 数据位置信息格式处理
|
* 数据位置信息格式处理
|
||||||
*/
|
*/
|
||||||
boolean updateAllGps(Device device);
|
boolean updateAllGps(Device device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询通道所属的设备
|
||||||
|
*/
|
||||||
|
List<Device> getDeviceByChannelId(String channelId);
|
||||||
}
|
}
|
||||||
|
@ -204,4 +204,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Device> getDeviceByChannelId(String channelId) {
|
||||||
|
return channelMapper.getDeviceByChannelId(channelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.storager.dao;
|
package com.genersoft.iot.vmp.storager.dao;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||||
@ -371,4 +372,7 @@ public interface DeviceChannelMapper {
|
|||||||
"and longitude != 0 " +
|
"and longitude != 0 " +
|
||||||
"and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)")
|
"and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)")
|
||||||
List<DeviceChannel> getChannelsWithoutTransform(String deviceId);
|
List<DeviceChannel> getChannelsWithoutTransform(String deviceId);
|
||||||
|
|
||||||
|
@Select("select de.* from device de left join device_channel dc on de.deviceId = dc.deviceId where dc.channelId=#{channelId}")
|
||||||
|
List<Device> getDeviceByChannelId(String channelId);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||||
<property name="LOG_HOME" value="logs" />
|
<property name="LOG_HOME" value="logs" />
|
||||||
|
|
||||||
<substitutionProperty name="log.pattern" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr(%-80.80logger{79}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<substitutionProperty name="log.pattern" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr(%-1.30logger{0}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
|
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user