diff --git a/src/main/java/com/gis/xian/config/QgisProperties.java b/src/main/java/com/gis/xian/config/QgisProperties.java deleted file mode 100644 index dc2477f..0000000 --- a/src/main/java/com/gis/xian/config/QgisProperties.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.gis.xian.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * QGIS 制图服务配置属性 - */ -@Data -@Component -@ConfigurationProperties(prefix = "qgis") -public class QgisProperties { - - /** - * QGIS 服务 URL - */ - private String url; -} diff --git a/src/main/java/com/gis/xian/service/qgis/base/impl/FeignServiceImpl.java b/src/main/java/com/gis/xian/service/qgis/base/impl/FeignServiceImpl.java index fb8cd5b..d11f55f 100644 --- a/src/main/java/com/gis/xian/service/qgis/base/impl/FeignServiceImpl.java +++ b/src/main/java/com/gis/xian/service/qgis/base/impl/FeignServiceImpl.java @@ -1,12 +1,12 @@ package com.gis.xian.service.qgis.base.impl; import com.alibaba.fastjson2.JSON; -import com.gis.xian.config.QgisProperties; import com.gis.xian.dto.qgis.base.QgisTriggerDTO; import com.gis.xian.service.qgis.base.IFeignService; import com.gis.xian.utils.HttpRequestClientUtils; import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.core.ParameterizedTypeReference; import org.springframework.stereotype.Service; @@ -21,23 +21,22 @@ public class FeignServiceImpl implements IFeignService { @Resource private HttpRequestClientUtils restclient; - @Resource - private QgisProperties qgisProperties; + @Value("${qgis.url}") + private String qgisUrl; @Override public void trigger(QgisTriggerDTO triggerDTO) { - if (triggerDTO == null || triggerDTO.getSimulationId() == null || triggerDTO.getType() == null) { - log.error("触发参数为空,simulationId={}, type={}", - triggerDTO != null ? triggerDTO.getSimulationId() : null, - triggerDTO != null ? triggerDTO.getType() : null); + if (triggerDTO == null || triggerDTO.getSimulationId() == null) { + log.error("触发参数为空,simulationId={}", + triggerDTO != null ? triggerDTO.getSimulationId() : null); return; } - log.info("触发专题图生成: simulationId={}, type={}", triggerDTO.getSimulationId(), triggerDTO.getType()); + log.info("触发专题图生成: simulationId={}", triggerDTO.getSimulationId()); try { ParameterizedTypeReference res = new ParameterizedTypeReference() {}; - String result = restclient.post(qgisProperties.getUrl(), JSON.toJSON(triggerDTO), res); + String result = restclient.post(qgisUrl, JSON.toJSON(triggerDTO), res); log.info("Python 端响应: {}", result); } catch (Exception e) { log.error("调用 Python QGIS 服务失败: {}", e.getMessage(), e);