diff --git a/common/src/main/java/cn/skcks/docking/gb28181/common/json/JsonResponse.java b/common/src/main/java/cn/skcks/docking/gb28181/common/json/JsonResponse.java
index bbb1bd2..38f707c 100644
--- a/common/src/main/java/cn/skcks/docking/gb28181/common/json/JsonResponse.java
+++ b/common/src/main/java/cn/skcks/docking/gb28181/common/json/JsonResponse.java
@@ -2,7 +2,9 @@ package cn.skcks.docking.gb28181.common.json;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor
@Data
@SuppressWarnings("unused")
@Schema(title = "θΏεη»ζ")
diff --git a/starter/src/test/java/cn/skcks/docking/gb28181/Gb28181DockingPlatformApplicationTest.java b/starter/src/test/java/cn/skcks/docking/gb28181/Gb28181DockingPlatformApplicationTest.java
index a3cc818..f2ec067 100644
--- a/starter/src/test/java/cn/skcks/docking/gb28181/Gb28181DockingPlatformApplicationTest.java
+++ b/starter/src/test/java/cn/skcks/docking/gb28181/Gb28181DockingPlatformApplicationTest.java
@@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-@SpringBootApplication
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class Gb28181DockingPlatformApplicationTest {
public static void main(String[] args) {
SpringApplication.run(Gb28181DockingPlatformApplication.class, args);
diff --git a/zlmediakit-service/pom.xml b/zlmediakit-service/pom.xml
index 628cd2f..d2c54ea 100644
--- a/zlmediakit-service/pom.xml
+++ b/zlmediakit-service/pom.xml
@@ -18,6 +18,12 @@
+
+ cn.skcks.docking.gb28181
+ annotation
+ ${project.version}
+
+
org.springframework.boot
spring-boot-starter-web
@@ -48,5 +54,11 @@
spring-test
test
+
+ cn.skcks.docking.gb28181
+ common
+ 0.0.1-SNAPSHOT
+ compile
+
-
\ No newline at end of file
+
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/ZLMediaHttpService.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/ZLMediaHttpService.java
deleted file mode 100644
index edca52d..0000000
--- a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/ZLMediaHttpService.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package cn.skcks.docking.gb28181.media;
-
-import org.springframework.web.service.annotation.GetExchange;
-import org.springframework.web.service.annotation.HttpExchange;
-
-@HttpExchange()
-public interface ZLMediaHttpService {
- @GetExchange("/")
- void test();
-}
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/config/MediaConfig.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/config/ZlmMediaConfig.java
similarity index 78%
rename from zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/config/MediaConfig.java
rename to zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/config/ZlmMediaConfig.java
index 1e82b65..50e453b 100644
--- a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/config/MediaConfig.java
+++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/config/ZlmMediaConfig.java
@@ -7,6 +7,8 @@ import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "media")
-public class MediaConfig {
+public class ZlmMediaConfig {
private String url;
+ private String id;
+ private String secret;
}
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/ApiConfig.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/ApiConfig.java
new file mode 100644
index 0000000..0cc8249
--- /dev/null
+++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/ApiConfig.java
@@ -0,0 +1,9 @@
+package cn.skcks.docking.gb28181.media.dto.config;
+
+import lombok.Data;
+
+@Data
+public class ApiConfig {
+ private String apiDebug;
+ private String secret;
+}
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/FFMpegConfig.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/FFMpegConfig.java
new file mode 100644
index 0000000..2b8dec7
--- /dev/null
+++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/FFMpegConfig.java
@@ -0,0 +1,10 @@
+package cn.skcks.docking.gb28181.media.dto.config;
+
+import lombok.Data;
+
+@Data
+public class FFMpegConfig {
+ private String bin;
+ private String cmd;
+ private String log;
+}
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/ServerConfig.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/ServerConfig.java
new file mode 100644
index 0000000..a3c887c
--- /dev/null
+++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/config/ServerConfig.java
@@ -0,0 +1,14 @@
+package cn.skcks.docking.gb28181.media.dto.config;
+
+
+import com.fasterxml.jackson.annotation.JsonUnwrapped;
+import lombok.Data;
+
+@Data
+public class ServerConfig {
+ @JsonUnwrapped(prefix = "api.")
+ private ApiConfig api;
+
+ @JsonUnwrapped(prefix = "ffmpeg.")
+ private FFMpegConfig ffmpeg;
+}
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpService.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpService.java
new file mode 100644
index 0000000..e5e5a54
--- /dev/null
+++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpService.java
@@ -0,0 +1,16 @@
+package cn.skcks.docking.gb28181.media.proxy;
+
+import cn.skcks.docking.gb28181.common.json.JsonResponse;
+import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.service.annotation.GetExchange;
+import org.springframework.web.service.annotation.HttpExchange;
+
+import java.util.List;
+
+@HttpExchange
+public interface ZlmMediaHttpService {
+
+ @GetExchange("/index/api/getServerConfig")
+ JsonResponse> getServerConfig(@RequestParam String secret);
+}
diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmProxy.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmProxy.java
new file mode 100644
index 0000000..7d7bd87
--- /dev/null
+++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmProxy.java
@@ -0,0 +1,31 @@
+package cn.skcks.docking.gb28181.media.proxy;
+
+import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+import org.springframework.web.reactive.function.client.WebClient;
+import org.springframework.web.reactive.function.client.support.WebClientAdapter;
+import org.springframework.web.service.invoker.HttpServiceProxyFactory;
+
+@RequiredArgsConstructor
+@Component
+public class ZlmProxy {
+ private final ZlmMediaConfig mediaConfig;
+
+ @Bean
+ public WebClient zlmClient() {
+ return WebClient.builder()
+ .baseUrl(mediaConfig.getUrl())
+ .build();
+ }
+
+ @Bean
+ public ZlmMediaHttpService zlMediaHttpService(@Qualifier("zlmClient") WebClient zlmClient){
+ HttpServiceProxyFactory proxyFactory =
+ HttpServiceProxyFactory.builder(WebClientAdapter.forClient(zlmClient))
+ .build();
+ return proxyFactory.createClient(ZlmMediaHttpService.class);
+ }
+}
diff --git a/zlmediakit-service/src/main/resources/application.yml b/zlmediakit-service/src/main/resources/application.yml
index 896f91a..faed907 100644
--- a/zlmediakit-service/src/main/resources/application.yml
+++ b/zlmediakit-service/src/main/resources/application.yml
@@ -1,2 +1,4 @@
media:
- url: 'http://10.10.10.200:5080'
\ No newline at end of file
+ url: 'http://10.10.10.200:5080'
+ id: amrWMKmbKqoBjRQ9
+ secret: 4155cca6-2f9f-11ee-85e6-8de4ce2e7333
diff --git a/zlmediakit-service/src/test/java/cn/skcks/docking/gb28181/test/MediaServiceTest.java b/zlmediakit-service/src/test/java/cn/skcks/docking/gb28181/test/MediaServiceTest.java
index 12b8726..24ebde4 100644
--- a/zlmediakit-service/src/test/java/cn/skcks/docking/gb28181/test/MediaServiceTest.java
+++ b/zlmediakit-service/src/test/java/cn/skcks/docking/gb28181/test/MediaServiceTest.java
@@ -1,35 +1,31 @@
package cn.skcks.docking.gb28181.test;
-import cn.skcks.docking.gb28181.media.config.MediaConfig;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
+import cn.skcks.docking.gb28181.media.proxy.ZlmMediaHttpService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Bean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.springframework.web.reactive.function.client.WebClient;
+
@Slf4j
@SpringBootTest
+@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@ExtendWith(SpringExtension.class)
public class MediaServiceTest {
@Autowired
- private MediaConfig mediaConfig;
+ private ZlmMediaConfig config;
- @Bean
- WebClient webClient(ObjectMapper objectMapper) {
- return WebClient.builder()
- .baseUrl(mediaConfig.getUrl())
- .build();
- }
+ @Autowired
+ private ZlmMediaHttpService zlMediaHttpService;
@Test
- void context(WebClient webClient){
-// log.info("mediaConfig {}", mediaConfig);
-// HttpServiceProxyFactory httpServiceProxyFactory =
-// HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient))
-// .build();
+ void context(){
+ var test = zlMediaHttpService.getServerConfig(config.getSecret());
+ log.info("{}", test);
}
}