648540858
2023-02-22 2d2832dbe98967a661323dd0a3fdc1607106b983
优化各个配置启动顺序
19个文件已修改
61 ■■■■ 已修改文件
src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/VersionConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/logback-spring-local.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java
@@ -2,6 +2,7 @@
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 @@
@Configuration("mediaConfig")
@Order(0)
public class MediaConfig{
    private final static Logger logger = LoggerFactory.getLogger(MediaConfig.class);
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
@@ -5,6 +5,7 @@
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 @@
 */
@SuppressWarnings(value = {"rawtypes", "unchecked"})
@Configuration
@Order(1)
public class ProxyServletConfig {
    private final static Logger logger = LoggerFactory.getLogger(ProxyServletConfig.class);
src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java
@@ -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;
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
@@ -18,7 +18,7 @@
 * @author lin
 */
@Component
@Order(value=3)
@Order(value=13)
public class SipPlatformRunner implements CommandLineRunner {
    @Autowired
src/main/java/com/genersoft/iot/vmp/conf/SpringDocConfig.java
@@ -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 @@
 * @author lin
 */
@Configuration
@Order(1)
public class SpringDocConfig {
    @Value("${doc.enabled: true}")
src/main/java/com/genersoft/iot/vmp/conf/ThreadPoolTaskConfig.java
@@ -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 @@
 * @author lin
 */
@Configuration
@Order(1)
@EnableAsync(proxyTargetClass = true)
public class ThreadPoolTaskConfig {
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
@@ -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 @@
 */
@Component
@ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true)
@Order(0)
public class UserSetting {
    private Boolean savePositionHistory = Boolean.FALSE;
src/main/java/com/genersoft/iot/vmp/conf/VersionConfig.java
@@ -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;
src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java
@@ -7,6 +7,7 @@
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 @@
 * 
 */
@Configuration
@Order(value=1)
public class RedisConfig extends CachingConfigurerSupport {
    @Autowired
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
@@ -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 @@
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Order(1)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -19,7 +19,7 @@
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);
src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java
@@ -28,7 +28,7 @@
 * @author lin
 */
@Component
@Order(value=4)
@Order(value=14)
public class SipRunner implements CommandLineRunner {
    @Autowired
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -38,6 +38,7 @@
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 @@
            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());
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
@@ -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 @@
//                }
//            }
            System.out.println(ServiceInfo.getServerPort());
//            System.out.println(ServiceInfo.getServerPort());
            SIPRequest request = (SIPRequest)evt.getRequest();
            Response response = null;
            boolean passwordCorrect = false;
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
@@ -25,7 +25,7 @@
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);
src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java
@@ -51,4 +51,9 @@
     * 数据位置信息格式处理
     */
    boolean updateAllGps(Device device);
    /**
     * 查询通道所属的设备
     */
    List<Device> getDeviceByChannelId(String channelId);
}
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
@@ -204,4 +204,9 @@
        return true;
    }
    @Override
    public List<Device> getDeviceByChannelId(String channelId) {
        return channelMapper.getDeviceByChannelId(channelId);
    }
}
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -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 @@
            "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);
}
src/main/resources/logback-spring-local.xml
@@ -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"/>