优化各个配置启动顺序
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.utils.DateUtil;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -14,6 +15,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@Configuration("mediaConfig")
|
||||
@Order(0)
|
||||
public class MediaConfig{
|
||||
|
||||
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.HttpRequest;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -25,6 +26,7 @@ import java.net.ConnectException;
|
||||
*/
|
||||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||
@Configuration
|
||||
@Order(1)
|
||||
public class ProxyServletConfig {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(ProxyServletConfig.class);
|
||||
|
@ -1,12 +1,14 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sip", ignoreInvalidFields = true)
|
||||
@Order(0)
|
||||
public class SipConfig {
|
||||
|
||||
private String ip;
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
* @author lin
|
||||
*/
|
||||
@Component
|
||||
@Order(value=3)
|
||||
@Order(value=13)
|
||||
public class SipPlatformRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
@ -1,14 +1,11 @@
|
||||
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.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.parameters.HeaderParameter;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springdoc.core.SpringDocConfigProperties;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -17,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author lin
|
||||
*/
|
||||
@Configuration
|
||||
@Order(1)
|
||||
public class SpringDocConfig {
|
||||
|
||||
@Value("${doc.enabled: true}")
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
@ -12,6 +13,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
* @author lin
|
||||
*/
|
||||
@Configuration
|
||||
@Order(1)
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
public class ThreadPoolTaskConfig {
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -11,6 +12,7 @@ import java.util.List;
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true)
|
||||
@Order(0)
|
||||
public class UserSetting {
|
||||
|
||||
private Boolean savePositionHistory = Boolean.FALSE;
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.genersoft.iot.vmp.conf;
|
||||
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "version")
|
||||
@Order(0)
|
||||
public class VersionConfig {
|
||||
|
||||
private String version;
|
||||
|
@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
@ -23,6 +24,7 @@ import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer;
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@Order(value=1)
|
||||
public class RedisConfig extends CachingConfigurerSupport {
|
||||
|
||||
@Autowired
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.genersoft.iot.vmp.conf.security;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -25,6 +26,7 @@ import java.util.List;
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||
@Order(1)
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
|
||||
|
@ -19,7 +19,7 @@ import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Component
|
||||
@Order(value=1)
|
||||
@Order(value=10)
|
||||
public class SipLayer implements CommandLineRunner {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(SipLayer.class);
|
||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||
* @author lin
|
||||
*/
|
||||
@Component
|
||||
@Order(value=4)
|
||||
@Order(value=14)
|
||||
public class SipRunner implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
@ -38,6 +38,7 @@ import javax.sip.header.FromHeader;
|
||||
import javax.sip.message.Response;
|
||||
import java.text.ParseException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
@ -150,6 +151,17 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
||||
Element deviceIdElement = rootElement.element("DeviceID");
|
||||
String channelId = deviceIdElement.getTextTrim().toString();
|
||||
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 (!ObjectUtils.isEmpty(device.getName())) {
|
||||
mobilePosition.setDeviceName(device.getName());
|
||||
|
@ -1,6 +1,5 @@
|
||||
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.UserSetting;
|
||||
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();
|
||||
Response response = null;
|
||||
boolean passwordCorrect = false;
|
||||
|
@ -25,7 +25,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Component
|
||||
@Order(value=2)
|
||||
@Order(value=12)
|
||||
public class ZLMRunner implements CommandLineRunner {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(ZLMRunner.class);
|
||||
|
@ -51,4 +51,9 @@ public interface IDeviceChannelService {
|
||||
* 数据位置信息格式处理
|
||||
*/
|
||||
boolean updateAllGps(Device device);
|
||||
|
||||
/**
|
||||
* 查询通道所属的设备
|
||||
*/
|
||||
List<Device> getDeviceByChannelId(String channelId);
|
||||
}
|
||||
|
@ -204,4 +204,9 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getDeviceByChannelId(String channelId) {
|
||||
return channelMapper.getDeviceByChannelId(channelId);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
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.DeviceChannelInPlatform;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||
@ -371,4 +372,7 @@ public interface DeviceChannelMapper {
|
||||
"and longitude != 0 " +
|
||||
"and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)")
|
||||
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=""/>
|
||||
<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="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
|
Loading…
Reference in New Issue
Block a user