Browse Source

交易市场平台(供应商)

wwh 1 week ago
parent
commit
8a69e0d5cf
14 changed files with 121 additions and 315 deletions
  1. 6 50
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyFarmClientImpl.java
  2. 78 0
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyFarmingHttpSupport.java
  3. 5 5
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyFarmProperties.java
  4. 10 33
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakAlertClientImpl.java
  5. 0 84
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakAlertProperties.java
  6. 10 32
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakClientImpl.java
  7. 0 85
      baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakProperties.java
  8. 6 20
      baqing-admin/src/main/resources/application.yml
  9. 1 1
      doc/产业数据模型及服务/牦牛疾病预警/牦牛疾病预警技术方案.md
  10. BIN
      doc/产业数据模型及服务/牧业金融生物资产管理/20260611111807_455_398.jpg
  11. 1 1
      doc/产业数据模型及服务/牧业金融生物资产管理/牦牛资产档案管理功能需求-草稿.md
  12. 1 1
      doc/产业数据模型及服务/牧业金融生物资产管理/牦牛资产档案管理技术方案.md
  13. 2 2
      doc/产业数据模型及服务/牧场管理/牧场管理技术方案.md
  14. 1 1
      doc/产业数据模型及服务/牧场管理/牧场管理管理测试用例.md

+ 6 - 50
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyFarmClientImpl.java

@@ -2,19 +2,15 @@ package com.ruoyi.web.modules.industryservice.support;
2 2
 
3 3
 import java.io.InputStream;
4 4
 import java.nio.charset.StandardCharsets;
5
-import java.text.SimpleDateFormat;
6 5
 import java.util.ArrayList;
7 6
 import java.util.Collections;
8 7
 import java.util.List;
9
-import java.util.TimeZone;
10 8
 import org.springframework.beans.factory.annotation.Autowired;
11 9
 import org.springframework.core.io.ClassPathResource;
12 10
 import org.springframework.http.HttpEntity;
13 11
 import org.springframework.http.HttpHeaders;
14 12
 import org.springframework.http.HttpMethod;
15
-import org.springframework.http.MediaType;
16 13
 import org.springframework.http.ResponseEntity;
17
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
18 14
 import org.springframework.stereotype.Component;
19 15
 import org.springframework.util.CollectionUtils;
20 16
 import org.springframework.util.StreamUtils;
@@ -39,10 +35,10 @@ public class ThirdPartyFarmClientImpl implements ThirdPartyFarmClient
39 35
 
40 36
     private static final String LIST_PATH = "/open-api/v1/farming/farms";
41 37
 
42
-    private final ObjectMapper objectMapper = createObjectMapper();
38
+    private final ObjectMapper objectMapper = ThirdPartyFarmingHttpSupport.createObjectMapper();
43 39
 
44 40
     @Autowired
45
-    private ThirdPartyFarmProperties properties;
41
+    private ThirdPartyFarmingProperties properties;
46 42
 
47 43
     @Override
48 44
     public List<OpenFarmDto> fetchAllFarms()
@@ -87,22 +83,16 @@ public class ThirdPartyFarmClientImpl implements ThirdPartyFarmClient
87 83
 
88 84
     private List<OpenFarmDto> fetchFromHttp()
89 85
     {
90
-        if (!StringUtils.hasText(properties.getBaseUrl()))
91
-        {
92
-            throw new ServiceException("第三方养殖场 base-url 未配置");
93
-        }
94
-        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
95
-        factory.setConnectTimeout(properties.getConnectTimeoutMs());
96
-        factory.setReadTimeout(properties.getReadTimeoutMs());
97
-        RestTemplate restTemplate = new RestTemplate(factory);
98
-        HttpHeaders headers = buildHeaders();
86
+        ThirdPartyFarmingHttpSupport.requireBaseUrl(properties, "第三方生产管理系统 base-url 未配置");
87
+        RestTemplate restTemplate = ThirdPartyFarmingHttpSupport.createRestTemplate(properties);
88
+        HttpHeaders headers = ThirdPartyFarmingHttpSupport.buildOpenApiHeaders(properties);
99 89
         List<OpenFarmDto> all = new ArrayList<>();
100 90
         int pageNum = 1;
101 91
         int pageSize = Math.min(Math.max(properties.getPageSize(), 1), 200);
102 92
         Long total = null;
103 93
         while (true)
104 94
         {
105
-            String url = UriComponentsBuilder.fromHttpUrl(trimTrailingSlash(properties.getBaseUrl()) + LIST_PATH)
95
+            String url = UriComponentsBuilder.fromHttpUrl(ThirdPartyFarmingHttpSupport.resolveUrl(properties, LIST_PATH))
106 96
                     .queryParam("pageNum", pageNum)
107 97
                     .queryParam("pageSize", pageSize)
108 98
                     .toUriString();
@@ -159,38 +149,4 @@ public class ThirdPartyFarmClientImpl implements ThirdPartyFarmClient
159 149
         return all;
160 150
     }
161 151
 
162
-    private HttpHeaders buildHeaders()
163
-    {
164
-        HttpHeaders headers = new HttpHeaders();
165
-        headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
166
-        if (StringUtils.hasText(properties.getAppKey()))
167
-        {
168
-            headers.set("X-App-Key", properties.getAppKey());
169
-        }
170
-        if (StringUtils.hasText(properties.getAppSecret()))
171
-        {
172
-            headers.set("X-App-Secret", properties.getAppSecret());
173
-        }
174
-        return headers;
175
-    }
176
-
177
-    private static String trimTrailingSlash(String baseUrl)
178
-    {
179
-        String url = baseUrl.trim();
180
-        while (url.endsWith("/"))
181
-        {
182
-            url = url.substring(0, url.length() - 1);
183
-        }
184
-        return url;
185
-    }
186
-
187
-    private static ObjectMapper createObjectMapper()
188
-    {
189
-        ObjectMapper mapper = new ObjectMapper();
190
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
191
-        df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
192
-        mapper.setDateFormat(df);
193
-        mapper.findAndRegisterModules();
194
-        return mapper;
195
-    }
196 152
 }

+ 78 - 0
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyFarmingHttpSupport.java

@@ -0,0 +1,78 @@
1
+package com.ruoyi.web.modules.industryservice.support;
2
+
3
+import java.text.SimpleDateFormat;
4
+import java.util.Collections;
5
+import java.util.TimeZone;
6
+import org.springframework.http.HttpHeaders;
7
+import org.springframework.http.MediaType;
8
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
9
+import org.springframework.util.StringUtils;
10
+import org.springframework.web.client.RestTemplate;
11
+import com.fasterxml.jackson.databind.ObjectMapper;
12
+import com.ruoyi.common.exception.ServiceException;
13
+
14
+/**
15
+ * 第三方生产管理系统 HTTP 调用共用工具。
16
+ */
17
+public final class ThirdPartyFarmingHttpSupport
18
+{
19
+    private ThirdPartyFarmingHttpSupport()
20
+    {
21
+    }
22
+
23
+    public static void requireBaseUrl(ThirdPartyFarmingProperties properties, String hint)
24
+    {
25
+        if (!StringUtils.hasText(properties.getBaseUrl()))
26
+        {
27
+            throw new ServiceException(hint);
28
+        }
29
+    }
30
+
31
+    public static RestTemplate createRestTemplate(ThirdPartyFarmingProperties properties)
32
+    {
33
+        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
34
+        factory.setConnectTimeout(properties.getConnectTimeoutMs());
35
+        factory.setReadTimeout(properties.getReadTimeoutMs());
36
+        return new RestTemplate(factory);
37
+    }
38
+
39
+    public static HttpHeaders buildOpenApiHeaders(ThirdPartyFarmingProperties properties)
40
+    {
41
+        HttpHeaders headers = new HttpHeaders();
42
+        headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
43
+        if (StringUtils.hasText(properties.getAppKey()))
44
+        {
45
+            headers.set("X-App-Key", properties.getAppKey());
46
+        }
47
+        if (StringUtils.hasText(properties.getAppSecret()))
48
+        {
49
+            headers.set("X-App-Secret", properties.getAppSecret());
50
+        }
51
+        return headers;
52
+    }
53
+
54
+    public static String resolveUrl(ThirdPartyFarmingProperties properties, String path)
55
+    {
56
+        return trimTrailingSlash(properties.getBaseUrl()) + path;
57
+    }
58
+
59
+    public static String trimTrailingSlash(String baseUrl)
60
+    {
61
+        String url = baseUrl.trim();
62
+        while (url.endsWith("/"))
63
+        {
64
+            url = url.substring(0, url.length() - 1);
65
+        }
66
+        return url;
67
+    }
68
+
69
+    public static ObjectMapper createObjectMapper()
70
+    {
71
+        ObjectMapper mapper = new ObjectMapper();
72
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
73
+        df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
74
+        mapper.setDateFormat(df);
75
+        mapper.findAndRegisterModules();
76
+        return mapper;
77
+    }
78
+}

+ 5 - 5
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyFarmProperties.java

@@ -4,19 +4,19 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
4 4
 import org.springframework.stereotype.Component;
5 5
 
6 6
 /**
7
- * 第三方养殖场开放接口配置,前缀 {@code third-party.farm}
7
+ * 第三方生产管理系统(牧场、牦牛资产等同源开放接口)共用连接配置
8 8
  * <p>
9
- * 对接 {@code GET /open-api/v1/farming/farms};http 模式需配置 baseUrl 与鉴权头
9
+ * 前缀 {@code third-party.farming};各业务客户端仅使用各自 API 路径,共享 baseUrl 与鉴权
10 10
  * </p>
11 11
  */
12 12
 @Component
13
-@ConfigurationProperties(prefix = "third-party.farm")
14
-public class ThirdPartyFarmProperties
13
+@ConfigurationProperties(prefix = "third-party.farming")
14
+public class ThirdPartyFarmingProperties
15 15
 {
16 16
     /** 拉取模式:stub=classpath 样例 JSON,http=调用远程开放接口 */
17 17
     private String mode = "stub";
18 18
 
19
-    /** 是否允许执行同步;false 时调用方收到「第三方养殖场同步未启用」 */
19
+    /** 是否允许执行同步;false 时各同步接口收到「第三方…同步未启用」 */
20 20
     private boolean enabled = true;
21 21
 
22 22
     /** 第三方服务根地址(不含路径),如 https://api.example.com */

+ 10 - 33
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakAlertClientImpl.java

@@ -2,21 +2,16 @@ package com.ruoyi.web.modules.industryservice.support;
2 2
 
3 3
 import java.io.InputStream;
4 4
 import java.nio.charset.StandardCharsets;
5
-import java.text.SimpleDateFormat;
6 5
 import java.util.Collections;
7 6
 import java.util.List;
8
-import java.util.TimeZone;
9 7
 import org.springframework.beans.factory.annotation.Autowired;
10 8
 import org.springframework.core.io.ClassPathResource;
11 9
 import org.springframework.http.HttpEntity;
12 10
 import org.springframework.http.HttpHeaders;
13 11
 import org.springframework.http.HttpMethod;
14
-import org.springframework.http.MediaType;
15 12
 import org.springframework.http.ResponseEntity;
16
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
17 13
 import org.springframework.stereotype.Component;
18 14
 import org.springframework.util.StreamUtils;
19
-import org.springframework.util.StringUtils;
20 15
 import org.springframework.web.client.RestClientException;
21 16
 import org.springframework.web.client.RestTemplate;
22 17
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -25,17 +20,19 @@ import com.ruoyi.common.exception.ServiceException;
25 20
 import com.ruoyi.web.modules.industryservice.domain.dto.YakDiseaseWarningDto;
26 21
 
27 22
 /**
28
- * 第三方预警客户端:stub 读取 classpath JSON;http 调用远程列表
23
+ * 第三方牦牛疾病预警客户端:stub 读取 classpath JSON;http 调用同源开放接口
29 24
  */
30 25
 @Component
31 26
 public class ThirdPartyYakAlertClientImpl implements ThirdPartyYakAlertClient
32 27
 {
33 28
     private static final String STUB_RESOURCE = "thirdparty/stub-yak-alerts.json";
34 29
 
35
-    private final ObjectMapper objectMapper = createObjectMapper();
30
+    private static final String LIST_PATH = "/open-api/v1/farming/yak-alerts";
31
+
32
+    private final ObjectMapper objectMapper = ThirdPartyFarmingHttpSupport.createObjectMapper();
36 33
 
37 34
     @Autowired
38
-    private ThirdPartyYakAlertProperties properties;
35
+    private ThirdPartyFarmingProperties properties;
39 36
 
40 37
     @Override
41 38
     public List<YakDiseaseWarningDto> fetchAlerts()
@@ -80,23 +77,13 @@ public class ThirdPartyYakAlertClientImpl implements ThirdPartyYakAlertClient
80 77
 
81 78
     private List<YakDiseaseWarningDto> fetchFromHttp()
82 79
     {
83
-        if (!StringUtils.hasText(properties.getBaseUrl()))
84
-        {
85
-            throw new ServiceException("第三方预警 base-url 未配置");
86
-        }
87
-        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
88
-        factory.setConnectTimeout(properties.getConnectTimeoutMs());
89
-        factory.setReadTimeout(properties.getReadTimeoutMs());
90
-        RestTemplate restTemplate = new RestTemplate(factory);
91
-        HttpHeaders headers = new HttpHeaders();
92
-        headers.setContentType(MediaType.APPLICATION_JSON);
93
-        if (StringUtils.hasText(properties.getApiKey()))
94
-        {
95
-            headers.set("Authorization", "Bearer " + properties.getApiKey());
96
-        }
80
+        ThirdPartyFarmingHttpSupport.requireBaseUrl(properties, "第三方生产管理系统 base-url 未配置");
81
+        RestTemplate restTemplate = ThirdPartyFarmingHttpSupport.createRestTemplate(properties);
82
+        HttpHeaders headers = ThirdPartyFarmingHttpSupport.buildOpenApiHeaders(properties);
83
+        String url = ThirdPartyFarmingHttpSupport.resolveUrl(properties, LIST_PATH);
97 84
         try
98 85
         {
99
-            ResponseEntity<String> response = restTemplate.exchange(properties.getBaseUrl(), HttpMethod.GET,
86
+            ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET,
100 87
                     new HttpEntity<>(headers), String.class);
101 88
             if (!response.getStatusCode().is2xxSuccessful() || response.getBody() == null)
102 89
             {
@@ -119,14 +106,4 @@ public class ThirdPartyYakAlertClientImpl implements ThirdPartyYakAlertClient
119 106
             throw new ServiceException("解析第三方预警数据失败:" + e.getMessage());
120 107
         }
121 108
     }
122
-
123
-    private static ObjectMapper createObjectMapper()
124
-    {
125
-        ObjectMapper mapper = new ObjectMapper();
126
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
127
-        df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
128
-        mapper.setDateFormat(df);
129
-        mapper.findAndRegisterModules();
130
-        return mapper;
131
-    }
132 109
 }

+ 0 - 84
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakAlertProperties.java

@@ -1,84 +0,0 @@
1
-package com.ruoyi.web.modules.industryservice.support;
2
-
3
-import org.springframework.boot.context.properties.ConfigurationProperties;
4
-import org.springframework.stereotype.Component;
5
-
6
-/**
7
- * 第三方牦牛疾病预警配置 third-party.yak-alert.*
8
- */
9
-@Component
10
-@ConfigurationProperties(prefix = "third-party.yak-alert")
11
-public class ThirdPartyYakAlertProperties
12
-{
13
-    private String mode = "stub";
14
-
15
-    private boolean enabled = true;
16
-
17
-    private String baseUrl = "";
18
-
19
-    private String apiKey = "";
20
-
21
-    private int connectTimeoutMs = 15000;
22
-
23
-    private int readTimeoutMs = 60000;
24
-
25
-    public String getMode()
26
-    {
27
-        return mode;
28
-    }
29
-
30
-    public void setMode(String mode)
31
-    {
32
-        this.mode = mode;
33
-    }
34
-
35
-    public boolean isEnabled()
36
-    {
37
-        return enabled;
38
-    }
39
-
40
-    public void setEnabled(boolean enabled)
41
-    {
42
-        this.enabled = enabled;
43
-    }
44
-
45
-    public String getBaseUrl()
46
-    {
47
-        return baseUrl;
48
-    }
49
-
50
-    public void setBaseUrl(String baseUrl)
51
-    {
52
-        this.baseUrl = baseUrl;
53
-    }
54
-
55
-    public String getApiKey()
56
-    {
57
-        return apiKey;
58
-    }
59
-
60
-    public void setApiKey(String apiKey)
61
-    {
62
-        this.apiKey = apiKey;
63
-    }
64
-
65
-    public int getConnectTimeoutMs()
66
-    {
67
-        return connectTimeoutMs;
68
-    }
69
-
70
-    public void setConnectTimeoutMs(int connectTimeoutMs)
71
-    {
72
-        this.connectTimeoutMs = connectTimeoutMs;
73
-    }
74
-
75
-    public int getReadTimeoutMs()
76
-    {
77
-        return readTimeoutMs;
78
-    }
79
-
80
-    public void setReadTimeoutMs(int readTimeoutMs)
81
-    {
82
-        this.readTimeoutMs = readTimeoutMs;
83
-    }
84
-}

+ 10 - 32
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakClientImpl.java

@@ -2,21 +2,16 @@ package com.ruoyi.web.modules.industryservice.support;
2 2
 
3 3
 import java.io.InputStream;
4 4
 import java.nio.charset.StandardCharsets;
5
-import java.text.SimpleDateFormat;
6 5
 import java.util.Collections;
7 6
 import java.util.List;
8
-import java.util.TimeZone;
9 7
 import org.springframework.beans.factory.annotation.Autowired;
10 8
 import org.springframework.core.io.ClassPathResource;
11 9
 import org.springframework.http.HttpEntity;
12 10
 import org.springframework.http.HttpHeaders;
13 11
 import org.springframework.http.HttpMethod;
14
-import org.springframework.http.MediaType;
15 12
 import org.springframework.http.ResponseEntity;
16
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
17 13
 import org.springframework.stereotype.Component;
18 14
 import org.springframework.util.StreamUtils;
19
-import org.springframework.util.StringUtils;
20 15
 import org.springframework.web.client.RestClientException;
21 16
 import org.springframework.web.client.RestTemplate;
22 17
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -25,27 +20,20 @@ import com.ruoyi.common.exception.ServiceException;
25 20
 import com.ruoyi.web.modules.industryservice.domain.dto.YakAssetBundleDto;
26 21
 
27 22
 /**
28
- * 第三方客户端:stub 读取 classpath JSON;http 调用远程列表接口。
23
+ * 第三方牦牛资产客户端:stub 读取 classpath JSON;http 调用同源开放接口。
29 24
  */
30 25
 @Component
31 26
 public class ThirdPartyYakClientImpl implements ThirdPartyYakClient
32 27
 {
33 28
     private static final String STUB_RESOURCE = "thirdparty/stub-yak-bundles.json";
34 29
 
35
-    private final ObjectMapper objectMapper = createObjectMapper();
30
+    /** 入栏建档列表(与牧场接口同平台,路径以 Apifox 文档为准) */
31
+    private static final String LIST_PATH = "/open-api/v1/farming/entry-filings";
36 32
 
37
-    private static ObjectMapper createObjectMapper()
38
-    {
39
-        ObjectMapper mapper = new ObjectMapper();
40
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
41
-        df.setTimeZone(TimeZone.getTimeZone("GMT+8"));
42
-        mapper.setDateFormat(df);
43
-        mapper.findAndRegisterModules();
44
-        return mapper;
45
-    }
33
+    private final ObjectMapper objectMapper = ThirdPartyFarmingHttpSupport.createObjectMapper();
46 34
 
47 35
     @Autowired
48
-    private ThirdPartyYakProperties properties;
36
+    private ThirdPartyFarmingProperties properties;
49 37
 
50 38
     @Override
51 39
     public List<YakAssetBundleDto> fetchAll()
@@ -86,24 +74,14 @@ public class ThirdPartyYakClientImpl implements ThirdPartyYakClient
86 74
 
87 75
     private List<YakAssetBundleDto> fetchFromHttp()
88 76
     {
89
-        if (!StringUtils.hasText(properties.getBaseUrl()))
90
-        {
91
-            throw new ServiceException("第三方接口地址未配置");
92
-        }
93
-        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
94
-        factory.setConnectTimeout(properties.getConnectTimeoutMs());
95
-        factory.setReadTimeout(properties.getReadTimeoutMs());
96
-        RestTemplate restTemplate = new RestTemplate(factory);
97
-        HttpHeaders headers = new HttpHeaders();
98
-        headers.setContentType(MediaType.APPLICATION_JSON);
99
-        if (StringUtils.hasText(properties.getApiKey()))
100
-        {
101
-            headers.set("Authorization", "Bearer " + properties.getApiKey());
102
-        }
77
+        ThirdPartyFarmingHttpSupport.requireBaseUrl(properties, "第三方生产管理系统 base-url 未配置");
78
+        RestTemplate restTemplate = ThirdPartyFarmingHttpSupport.createRestTemplate(properties);
79
+        HttpHeaders headers = ThirdPartyFarmingHttpSupport.buildOpenApiHeaders(properties);
80
+        String url = ThirdPartyFarmingHttpSupport.resolveUrl(properties, LIST_PATH);
103 81
         try
104 82
         {
105 83
             ResponseEntity<String> response = restTemplate.exchange(
106
-                    properties.getBaseUrl(),
84
+                    url,
107 85
                     HttpMethod.GET,
108 86
                     new HttpEntity<>(headers),
109 87
                     String.class);

+ 0 - 85
baqing-admin/src/main/java/com/ruoyi/web/modules/industryservice/support/ThirdPartyYakProperties.java

@@ -1,85 +0,0 @@
1
-package com.ruoyi.web.modules.industryservice.support;
2
-
3
-import org.springframework.boot.context.properties.ConfigurationProperties;
4
-import org.springframework.stereotype.Component;
5
-
6
-/**
7
- * 第三方牦牛生产系统配置 third-party.yak.*
8
- */
9
-@Component
10
-@ConfigurationProperties(prefix = "third-party.yak")
11
-public class ThirdPartyYakProperties
12
-{
13
-    /** stub:本地样例;http:调用远程接口 */
14
-    private String mode = "stub";
15
-
16
-    private boolean enabled = true;
17
-
18
-    private String baseUrl = "";
19
-
20
-    private String apiKey = "";
21
-
22
-    private int connectTimeoutMs = 15000;
23
-
24
-    private int readTimeoutMs = 120000;
25
-
26
-    public String getMode()
27
-    {
28
-        return mode;
29
-    }
30
-
31
-    public void setMode(String mode)
32
-    {
33
-        this.mode = mode;
34
-    }
35
-
36
-    public boolean isEnabled()
37
-    {
38
-        return enabled;
39
-    }
40
-
41
-    public void setEnabled(boolean enabled)
42
-    {
43
-        this.enabled = enabled;
44
-    }
45
-
46
-    public String getBaseUrl()
47
-    {
48
-        return baseUrl;
49
-    }
50
-
51
-    public void setBaseUrl(String baseUrl)
52
-    {
53
-        this.baseUrl = baseUrl;
54
-    }
55
-
56
-    public String getApiKey()
57
-    {
58
-        return apiKey;
59
-    }
60
-
61
-    public void setApiKey(String apiKey)
62
-    {
63
-        this.apiKey = apiKey;
64
-    }
65
-
66
-    public int getConnectTimeoutMs()
67
-    {
68
-        return connectTimeoutMs;
69
-    }
70
-
71
-    public void setConnectTimeoutMs(int connectTimeoutMs)
72
-    {
73
-        this.connectTimeoutMs = connectTimeoutMs;
74
-    }
75
-
76
-    public int getReadTimeoutMs()
77
-    {
78
-        return readTimeoutMs;
79
-    }
80
-
81
-    public void setReadTimeoutMs(int readTimeoutMs)
82
-    {
83
-        this.readTimeoutMs = readTimeoutMs;
84
-    }
85
-}

+ 6 - 20
baqing-admin/src/main/resources/application.yml

@@ -45,28 +45,14 @@ bigscreen:
45 45
     read-timeout-ms: 15000
46 46
     cache-ttl-minutes: 5
47 47
 
48
-# 第三方牦牛生产系统(档案同步
48
+# 第三方生产管理系统(牧场、牦牛资产、疾病预警等同源开放接口
49 49
 third-party:
50
-  yak:
50
+  farming:
51 51
     enabled: true
52
-    mode: stub
53
-    base-url: ""
54
-    api-key: ""
55
-    connect-timeout-ms: 15000
56
-    read-timeout-ms: 120000
57
-  yak-alert:
58
-    enabled: true
59
-    mode: stub
60
-    base-url: ""
61
-    api-key: ""
62
-    connect-timeout-ms: 15000
63
-    read-timeout-ms: 60000
64
-  farm:
65
-    enabled: true
66
-    mode: stub
67
-    base-url: ""
68
-    app-key: ""
69
-    app-secret: ""
52
+    mode: http
53
+    base-url: "http://117.180.211.11/api"
54
+    app-key: "farm-open-b0f2076e3f04f10da"
55
+    app-secret: "84df79f4d75b6afc89738872b3e41625330b052dcfcf2bc421450df0290a67e0"
70 56
     connect-timeout-ms: 15000
71 57
     read-timeout-ms: 120000
72 58
     page-size: 200

+ 1 - 1
doc/产业数据模型及服务/牦牛疾病预警/牦牛疾病预警技术方案.md

@@ -209,7 +209,7 @@ WHERE alert_time >= ? AND alert_time < ?
209 209
 
210 210
 | 项 | 说明 |
211 211
 | --- | --- |
212
-| 配置键 | `third-party.yak-alert.base-url`、`api-key`、`connect-timeout`、`read-timeout`(可与资产共用 `third-party.yak` 节点) |
212
+| 配置键 | `third-party.farming`(与牧场、牦牛资产同源:`base-url`、`app-key`、`app-secret`、超时) |
213 213
 | 客户端 | `ThirdPartyYakAlertClient.fetchAlerts()` → `List<YakDiseaseWarningDTO>` |
214 214
 | 映射 | 第三方牧场编码 → `biz_pasture.id`;失败仅写 `pasture_name` |
215 215
 | 合并 | `INSERT ... ON DUPLICATE KEY UPDATE` 或先 `selectByExternalId` 再 insert/update |

BIN
doc/产业数据模型及服务/牧业金融生物资产管理/20260611111807_455_398.jpg


+ 1 - 1
doc/产业数据模型及服务/牧业金融生物资产管理/牦牛资产档案管理功能需求-草稿.md

@@ -4,7 +4,7 @@
4 4
 
5 5
 1. 查询牦牛资产档案列表:支持牦牛编号模糊匹配、资产状态分页列出牦牛资产档案列表,列表字段包括:牦牛编号、所属牧场、性别、月龄(月)、实时体温、实时运动量、资产状态、变更日期。
6 6
 3. 资产状态:正常/死淘/丢失/出栏。
7
-4. 牦牛资产档案数据可能对接第三方的生产管理系统,所以现有指标不是最终对接的指标
7
+4. 牦牛资产档案数据对接第三方的生产管理系统,接口地址:https://s.apifox.cn/f94a7c39-05e1-4fff-996e-2dc0453d57f6/%E6%9F%A5%E8%AF%A2%E5%85%A5%E6%A0%8F%E5%BB%BA%E6%A1%A3%E5%88%97%E8%A1%A8-471164137e0;字段参考:20260611111807_455_398.jpg
8 8
 4. 点击“同步”按钮可以从第三方拉取牦牛资产档案信息。
9 9
 5. 查看牦牛资产档案:包括基础信息、系谱信息、个体生理、生长性状、繁殖性能、饲喂数据。
10 10
 6. 基础数据:牦牛编号、所属牧场、批次编号、性别(公/母)、出生日期(YYYY-MM-DD )、月龄(单位为月)、入栏日期(YYYY-MM-DD )、入栏体重(单位为kg)、来源(自繁/外购/引进)、养殖方式(半舍饲/散养/圈养)、资产状态、状态变更原因、圈舍位置、预计出栏日期、补饲方案。

+ 1 - 1
doc/产业数据模型及服务/牧业金融生物资产管理/牦牛资产档案管理技术方案.md

@@ -253,7 +253,7 @@ CREATE TABLE `biz_yak_asset` (
253 253
 
254 254
 | 项 | 说明 |
255 255
 | --- | --- |
256
-| 配置 | `application.yml`:`third-party.yak.base-url`、`api-key`、超时 |
256
+| 配置 | `application.yml`:`third-party.farming`(与牧场管理同源:`base-url`、`app-key`、`app-secret`、超时) |
257 257
 | 客户端 | `ThirdPartyYakClient.fetchAll()` → `List<YakAssetBundleDTO>`(主表+子表) |
258 258
 | 映射 | `YakAssetStatusMapper`:第三方状态码 → `asset_status` |
259 259
 | 牧场 | 第三方牧场编码 → `biz_pasture`;失败则仅写 `pasture_name` |

+ 2 - 2
doc/产业数据模型及服务/牧场管理/牧场管理技术方案.md

@@ -25,7 +25,7 @@
25 25
 | 列表/详情 | `del_flag=0`;排序 `create_time DESC, id DESC`;可按角色脱敏手机 |
26 26
 | 并发 | `AtomicBoolean` 防重入;重复同步抛「正在同步,请稍候」 |
27 27
 
28
-**配置**(`application.yml` → `third-party.farm`)
28
+**配置**(`application.yml` → `third-party.farming`,与牦牛资产等同源
29 29
 
30 30
 | 键 | 说明 |
31 31
 | --- | --- |
@@ -129,7 +129,7 @@
129 129
 - [x] `sql/biz_pasture.sql`、`sql/biz_pasture_sync_alter.sql`
130 130
 - [x] `BizPasture` Domain / Mapper / Service / Controller
131 131
 - [x] `ThirdPartyFarmClient`、`PastureSyncService`、`PastureSyncTxService`
132
-- [x] `thirdparty/stub-farms.json`、`third-party.farm` 配置
132
+- [x] `thirdparty/stub-farms.json`、`third-party.farming` 配置
133 133
 - [x] 单元测试 / MockMvc(列表、详情、同步)
134 134
 
135 135
 ---

+ 1 - 1
doc/产业数据模型及服务/牧场管理/牧场管理管理测试用例.md

@@ -3,7 +3,7 @@
3 3
 > 依据:`牧场管理功能需求.md`、`牧场管理技术方案.md`  
4 4
 > **接口 Base Path**:`/dataModel/pasture`;鉴权与若依一致(Cookie / Token)。
5 5
 
6
-**通用前置**:具备本模块菜单与按钮权限的账号已登录;开发环境 `third-party.farm.mode=stub` 可使用 classpath 样例数据。**牧场性质**:`1` 个体、`2` 企业。
6
+**通用前置**:具备本模块菜单与按钮权限的账号已登录;开发环境 `third-party.farming.mode=stub` 可使用 classpath 样例数据。**牧场类型**:`1` 个体、`2` 企业。
7 7
 
8 8
 **界面(UI)测试**:**Playwright** + **Chromium**。
9 9