Compare commits
1 Commits
71ae772ede
..
wzy
| Author | SHA1 | Date | |
|---|---|---|---|
| d2950ffdd3 |
@@ -1,19 +0,0 @@
|
||||
package com.gis.xian.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 算法服务器配置属性
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "algorithm.server")
|
||||
public class AlgorithmServerProperties {
|
||||
|
||||
/**
|
||||
* 算法服务器地址
|
||||
*/
|
||||
private String url;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.gis.xian.controller;
|
||||
|
||||
import com.gis.xian.service.IFeignService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 专题图触发接口
|
||||
* 统一入口,接收 simulationId 和 type,调用 Python 端处理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/open")
|
||||
public class QgisController {
|
||||
|
||||
@Resource
|
||||
private IFeignService feignService;
|
||||
|
||||
@PostMapping("/qgis/trigger")
|
||||
public void trigger(@RequestParam String simulationId, @RequestParam String type) {
|
||||
log.info("收到专题图触发请求: simulationId={}, type={}", simulationId, type);
|
||||
feignService.trigger(simulationId, type);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.gis.xian.service;
|
||||
|
||||
/**
|
||||
* 专题图触发接口
|
||||
* 只负责调用 Python 端,不返回结果
|
||||
*/
|
||||
public interface IFeignService {
|
||||
|
||||
/**
|
||||
* 触发专题图生成
|
||||
* @param simulationId 模拟ID
|
||||
* @param type 灾害类型(earthquake / rain)
|
||||
*/
|
||||
void trigger(String simulationId, String type);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.gis.xian.service.impl;
|
||||
|
||||
import com.gis.xian.service.IFeignService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 专题图触发服务
|
||||
* 只负责调用 Python QGIS 服务,不处理计算和存库
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FeignServiceImpl implements IFeignService {
|
||||
|
||||
@Resource
|
||||
private RestClient.Builder restClientBuilder;
|
||||
|
||||
@Value("${qgis.url}")
|
||||
private String qgisUrl;
|
||||
|
||||
@Override
|
||||
public void trigger(String simulationId, String type) {
|
||||
if (simulationId == null || simulationId.isBlank()) {
|
||||
log.error("触发参数为空,simulationId={}", simulationId);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("触发专题图生成: simulationId={}, type={}", simulationId, type);
|
||||
|
||||
try {
|
||||
RestClient client = restClientBuilder.build();
|
||||
String result = client.post()
|
||||
.uri(qgisUrl)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.body(Map.of("simulationId", simulationId, "type", type))
|
||||
.retrieve()
|
||||
.body(String.class);
|
||||
log.info("Python 端响应: {}", result);
|
||||
} catch (Exception e) {
|
||||
log.error("调用 Python QGIS 服务失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# 端口
|
||||
# 端口
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
@@ -7,7 +7,6 @@ spring:
|
||||
config:
|
||||
import:
|
||||
- classpath:config/database/application-database-dev.yml
|
||||
- classpath:config/qgis/application-qgis-dev.yml
|
||||
- classpath:config/customize/application-customize-dev.yml
|
||||
|
||||
|
||||
@@ -55,8 +54,3 @@ safety:
|
||||
- /websocket/**
|
||||
- /open/**
|
||||
|
||||
# 算法服务器配置
|
||||
algorithm:
|
||||
server:
|
||||
# 开发环境算法服务器地址
|
||||
url: http://localhost:8082
|
||||
|
||||
@@ -7,7 +7,6 @@ spring:
|
||||
config:
|
||||
import:
|
||||
- classpath:config/database/application-database-prod.yml
|
||||
- classpath:config/qgis/application-qgis-prod.yml
|
||||
- classpath:config/customize/application-customize-prod.yml
|
||||
|
||||
# redis
|
||||
@@ -49,9 +48,3 @@ safety:
|
||||
no-decrypt-paths:
|
||||
- /crypto/sm2/public-key
|
||||
- /websocket/**
|
||||
|
||||
# 算法服务器配置
|
||||
algorithm:
|
||||
server:
|
||||
# 生产环境算法服务器地址
|
||||
url: http://localhost:8081
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# qgis配置
|
||||
qgis:
|
||||
# 地震专题图模板路径
|
||||
eq-maps-template-path: D:/代码/xian_api_new/src/main/resources/template/qgis-template/eq/
|
||||
# 暴雨专题图模板路径
|
||||
rain-maps-template-path: D:/代码/xian_api_new/src/main/resources/template/qgis-template/rain/
|
||||
# QGIS基础路径
|
||||
base-path: F:/files/xian/maps/
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# qgis配置
|
||||
qgis:
|
||||
# 地震专题图模板路径
|
||||
eq-maps-template-path: D:/代码/xian_api_new/src/main/resources/template/qgis-template/eq/
|
||||
# 暴雨专题图模板路径
|
||||
rain-maps-template-path: D:/代码/xian_api_new/src/main/resources/template/qgis-template/rain/
|
||||
# QGIS基础路径
|
||||
base-path: F:/files/xian/maps/
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# qgis配置
|
||||
qgis:
|
||||
url: http://localhost:18998/qgis/make/map
|
||||
@@ -1,3 +0,0 @@
|
||||
# qgis配置
|
||||
qgis:
|
||||
url: http://localhost:18998/qgis/make/map
|
||||
Reference in New Issue
Block a user