You've already forked FrameTour-BE
refactor(scenic): 重构景区配置相关代码
- 为 FeignClient 添加 contextId 属性,提高服务调用的可读性 - 更新 ScenicIntegrationService 中的接口调用方式 - 修改 ScenicConfigEntity 和 ScenicConfigResp 中的字段类型 -重构 ScenicRepository 中的配置解析逻辑,使用 ConfigValueUtil 工具类
This commit is contained in:
@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = "zt-scenic", path = "/api/scenic/default-config")
|
||||
@FeignClient(name = "zt-scenic", contextId = "scenic-default-config", path = "/api/scenic/default-config")
|
||||
public interface DefaultConfigClient {
|
||||
|
||||
@GetMapping("/")
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = "zt-scenic", path = "/api/scenic/config/v2")
|
||||
@FeignClient(name = "zt-scenic", contextId = "scenic-config-v2", path = "/api/scenic/config/v2")
|
||||
public interface ScenicConfigV2Client {
|
||||
|
||||
@GetMapping("/{scenicId}")
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@FeignClient(name = "zt-scenic", path = "/api/scenic/config-with-default")
|
||||
@FeignClient(name = "zt-scenic", contextId = "scenic-config-with-default", path = "/api/scenic/config-with-default")
|
||||
public interface ScenicConfigWithDefaultClient {
|
||||
|
||||
@GetMapping("/{scenicId}/{configKey}")
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = "zt-scenic", path = "/api/scenic/meta")
|
||||
@FeignClient(name = "zt-scenic", contextId = "scenic-meta", path = "/api/scenic/meta")
|
||||
public interface ScenicMetaClient {
|
||||
|
||||
@GetMapping("/{scenicId}/fields/enabled")
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = "zt-scenic", path = "/api/scenic/v2")
|
||||
@FeignClient(name = "zt-scenic", contextId = "scenic-v2", path = "/api/scenic/v2")
|
||||
public interface ScenicV2Client {
|
||||
|
||||
@GetMapping("/{scenicId}")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ycwl.basic.integration.scenic.service;
|
||||
|
||||
import com.ycwl.basic.integration.common.exception.IntegrationException;
|
||||
import com.ycwl.basic.integration.common.response.CommonResponse;
|
||||
import com.ycwl.basic.integration.scenic.client.ScenicConfigV2Client;
|
||||
import com.ycwl.basic.integration.scenic.client.ScenicV2Client;
|
||||
import com.ycwl.basic.integration.scenic.dto.filter.ScenicFilterPageResponse;
|
||||
import com.ycwl.basic.integration.scenic.dto.filter.ScenicFilterRequest;
|
||||
@@ -21,6 +22,7 @@ import java.util.Map;
|
||||
public class ScenicIntegrationService {
|
||||
|
||||
private final ScenicV2Client scenicV2Client;
|
||||
private final ScenicConfigV2Client scenicConfigV2Client;
|
||||
|
||||
public ScenicV2DTO getScenic(Long scenicId) {
|
||||
log.info("获取景区信息, scenicId: {}", scenicId);
|
||||
@@ -36,7 +38,7 @@ public class ScenicIntegrationService {
|
||||
|
||||
public Map<String, Object> getScenicFlatConfig(Long scenicId) {
|
||||
log.info("获取景区扁平化配置, scenicId: {}", scenicId);
|
||||
CommonResponse<Map<String, Object>> response = scenicV2Client.getScenicFlatConfig(scenicId);
|
||||
CommonResponse<Map<String, Object>> response = scenicConfigV2Client.getFlatConfigs(scenicId);
|
||||
return handleResponse(response, "获取景区扁平化配置失败");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user