Explorar o código

第一次提交

肖佳斌 hai 10 meses
pai
achega
d8c70c6c6e

+ 2 - 0
README.md

@@ -0,0 +1,2 @@
+# raycos-erp
+

+ 129 - 0
pom.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.raycos</groupId>
+    <artifactId>raycos</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <modules> 
+        <module>raycos_common</module>
+        <module>raycos_web_api</module>
+        <module>raycos_datacenter_api</module>
+    </modules>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.6.13</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+
+        <!--spring cloud版本-->
+        <spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
+        <spring-cloud.version>2021.0.5</spring-cloud.version>
+        <!--jdk版本-->
+        <java.version>8</java.version>
+        <skipTests>true</skipTests>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>${spring-cloud.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.alibaba.cloud</groupId>
+                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
+                <version>${spring-cloud-alibaba.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>mybatis-plus-boot-starter</artifactId>
+                <version>3.5.7</version>
+            </dependency>
+        </dependencies>
+
+    </dependencyManagement>
+    <dependencies>
+        <!-- Nacos 服务发现 -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+        <!-- 服务发现:OpenFeign服务调用 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <!-- 负载均衡器 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-loadbalancer</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>spring-milestones</id>
+            <name>Spring Milestones</name>
+            <url>https://repo.spring.io/milestone</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
+
+
+</project>

+ 35 - 0
raycos_common/pom.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.raycos</groupId>
+        <artifactId>raycos</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+<!--    <packaging>jar</packaging>-->
+
+    <artifactId>raycoscommon</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+<!--    <name>raycos_common</name>-->
+<!--    <description>Demo project for Spring Boot</description>-->
+
+    <properties>
+    </properties>
+    <dependencies>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <classifier>exec</classifier>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 16 - 0
raycos_common/src/main/java/com/raycos/raycoscommon/Internal/RaycosCommonApplication.java

@@ -0,0 +1,16 @@
+package com.raycos.raycoscommon.Internal;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/28 11:20
+ */
+
+@SpringBootApplication
+public class RaycosCommonApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(RaycosCommonApplication.class, args);
+    }
+}

+ 15 - 0
raycos_common/src/main/java/com/raycos/raycoscommon/Internal/Result.java

@@ -0,0 +1,15 @@
+package com.raycos.raycoscommon.Internal;
+
+import lombok.Data;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/26 16:15
+ */
+
+@Data
+public class Result<T> {
+    private int code;
+    private String msg;
+    private T data;
+}

+ 38 - 0
raycos_datacenter_api/pom.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.raycos</groupId>
+        <artifactId>raycos</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>raycos_datacenter_api</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>raycos-datacenter-api</name>
+
+    <packaging>jar</packaging>
+    <description>raycos-datacenter-api</description>
+
+
+    <properties>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.raycos</groupId>
+            <artifactId>raycoscommon</artifactId>
+            <version>raycos_common-0.0.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 17 - 0
raycos_datacenter_api/src/main/java/com/raycos/raycosdatacenterapi/RaycosDatacenterApiApplication.java

@@ -0,0 +1,17 @@
+package com.raycos.raycosdatacenterapi;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@EnableDiscoveryClient
+@EnableFeignClients
+@SpringBootApplication
+public class RaycosDatacenterApiApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(RaycosDatacenterApiApplication.class, args);
+    }
+
+}

+ 33 - 0
raycos_datacenter_api/src/main/java/com/raycos/raycosdatacenterapi/nacostest/EchoController.java

@@ -0,0 +1,33 @@
+package com.raycos.raycosdatacenterapi.nacostest;
+
+import com.raycos.raycoscommon.Internal.Result;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+public class EchoController {
+
+
+//    @GetMapping(value = "/echo/{string}")
+//    public Result<String> echo(@PathVariable String string) {
+//        Result<String> result = new Result<>();
+//        result.setCode(200);
+//        result.setMsg("来了老弟" + string);
+//
+//        return result;
+//    }
+    @GetMapping(value = "/echo/{string}")
+    public String echo(@PathVariable String string) {
+
+        return "来了老弟"+string;
+    }
+    @PostMapping("/sayHello")
+    public Result<String> hello(@RequestParam String name) {
+        Result<String> result = new Result<>();
+        System.out.println("  hello  " + name);
+        result.setCode(200);
+        result.setMsg("hello 来了老弟 "+ name );
+        return result;
+    }
+
+
+}

+ 22 - 0
raycos_datacenter_api/src/main/resources/application.yml

@@ -0,0 +1,22 @@
+server:
+  port: 18082
+spring:
+  application:
+    name: service-provider
+  cloud:
+    nacos:
+      serverAddr: 120.46.190.49:8848
+      discovery:
+        username: 'nacos'
+        password: 'nacos'
+        server-addr: 120.46.190.49:8848
+#        namespace: public # 可选,‌命名空间ID,‌用于多环境隔离
+#        group: DEFAULT_GROUP # 可选,‌默认分组
+    loadbalancer:
+      nacos:
+        enabled: true
+      ribbon:
+        enabled: false
+  config:
+    import:
+      - nacos:nacos-config-example.properties?refreshEnabled=true

+ 16 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/RaycosWebApiApplication.java

@@ -0,0 +1,16 @@
+package com.raycos.raycoswebapi;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@EnableDiscoveryClient
+@EnableFeignClients
+@SpringBootApplication
+public class RaycosWebApiApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(RaycosWebApiApplication.class, args);
+    }
+}

+ 193 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/amazon/authorize/AmazonAuthorize.java

@@ -0,0 +1,193 @@
+package com.raycos.raycoswebapi.amazon.authorize;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/31 17:03
+ */
+
+public class AmazonAuthorize {
+
+
+    // 用户通过页面调用Amazon授权 接口
+    // 授权成功后 亚马逊回调  我的接口 入参:
+                /**
+                 * state	步骤 2 中的 state 值。
+                 * selling_partner_id	授权您的应用程序的销售合作伙伴的标识符。
+                 * mws_auth_token	(仅限卖家应用程序)您在为 Amazon Marketplace Web Service 调用创建查询字符串时指定的值。
+                 * spapi_oauth_code	用于生成 LWA 刷新令牌的 Login with Amazon (LWA) 授权码(请参阅第 5 步)。
+                 */
+    //  我拿到 spapi_oauth_code 去调用刷新令牌接口
+    //  发送:
+                /**
+                 * grant_type	请求的访问授权的类型。必须是 。authorization_code
+                 * code	您在步骤 4 中收到的 LWA 授权码。Amazon 会向您发送授权信息。
+                 * redirect_uri	应用程序的重定向 URI。
+                 * client_id	LWA 凭证的一部分。要获取此值,请参阅 查看您的开发者信息。
+                 * client_secret	LWA 凭证的一部分。要获取此值,请参阅 查看您的开发者信息。
+                 */
+    //  接收:
+                /**
+                 * access_token	一个令牌,用于授权您的应用程序代表销售合作伙伴执行某些操作。有关详细信息,请参阅连接到 SP-API。
+                 * token_type	返回的 token 类型。应该是 bearer。
+                 * expires_in	访问令牌失效前的秒数。
+                 * refresh_token	可用于生成新访问令牌的长寿命令牌。有关详细信息,请参阅连接到 SP-API。
+                 */
+
+
+
+
+//
+//    private  static  String  client_id;
+//
+//    public static String getAccessToken(String code) {
+//        try {
+//
+//            String url = "https://api.amazon.com/auth/o2/token";
+//            Map<String, String> map = new HashMap<>();
+//            map.put("grant_type", "authorization_code");
+//            map.put("code", code);
+//            map.put("client_id", client_id);
+//            map.put("redirect_uri", "https://api.mabangerp.com/fba/api/v1/authCode");
+//            map.put("client_secret", client_secret);
+//            Map<String, String> headerMap = new HashMap<>();
+//            logger.info(JSONObject.toJSONString(map));
+//            headerMap.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
+//            String response = HttpClientUtil.httpPostForm(url, map, headerMap, null, 5000);
+//
+//            logger.info(", get accessToken response : " + response);
+//            return response;
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//            logger.error(e.getMessage(), e);
+//        }
+//        return "报错";
+//    }
+//
+//    public static String refreshAccessToken(String refresh_token) {
+//        try {
+//            String url = "https://api.amazon.com/auth/o2/token";
+//            Map<String, String> map = new HashMap<>();
+//            map.put("grant_type", "refresh_token");
+//            map.put("refresh_token", refresh_token);
+//            map.put("client_id", client_id);
+//            map.put("client_secret", client_secret);
+//            Map<String, String> headerMap = new HashMap<>();
+//            logger.info(JSONObject.toJSONString(map));
+//            headerMap.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
+//            String response = HttpClientUtil.httpPostForm(url, map, headerMap, null, 5000);
+//            logger.info("refresh access_token response : " + response);
+//            return response;
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//            logger.error(e.getMessage(), e);
+//        }
+//        return "报错";
+//    }
+//
+//
+//    public static String httpPostForm(String requestUrl, Map<String, String> paramMap,
+//                                      Map<String, String> headerMap, String encode, int timeOut) {
+//        String response = "";
+//        if (encode == null) {
+//            encode = "utf-8";
+//        }
+//
+//        // HttpClients.createDefault() 等价于 HttpClientBuilder.create().build();
+//        CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
+//        HttpPost httpPost = new HttpPost(requestUrl);
+//
+//        // 设置超时时间
+//        RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(timeOut)
+//                .setConnectTimeout(timeOut).setSocketTimeout(timeOut).build();
+//        httpPost.setConfig(requestConfig);
+//
+//        // 设置header
+//        if (headerMap != null && headerMap.size() > 0) {
+//            for (String key : headerMap.keySet()) {
+//                httpPost.setHeader(key, headerMap.get(key));
+//            }
+//        }
+//
+//        // 设置Param
+//        if (paramMap != null && paramMap.size() > 0) {
+//
+//            List<NameValuePair> paramList = new ArrayList<NameValuePair>();
+//            for (String key : paramMap.keySet()) {
+//                paramList.add(new BasicNameValuePair(key, paramMap.get(key)));
+//            }
+//
+//            try {
+//                httpPost.setEntity(new UrlEncodedFormEntity(paramList, encode));
+//            } catch (UnsupportedEncodingException e) {
+//                e.printStackTrace();
+//            }
+//
+//        }
+//
+//        CloseableHttpResponse httpResponse = null;
+//        try {
+//            httpResponse = closeableHttpClient.execute(httpPost);
+//            HttpEntity entity = httpResponse.getEntity();
+//            byte[] bytes = (entity == null ? null : EntityUtils.toByteArray(entity));
+//            String content = (bytes == null ? null : new String(bytes, encode));
+//            response = content;
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        } finally {
+//            try {
+//                if (httpResponse != null) {
+//                    httpResponse.close();
+//                }
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//
+//        try {
+//            // 关闭连接、释放资源
+//            if (closeableHttpClient != null) {
+//                closeableHttpClient.close();
+//            }
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//
+//        return response;
+//    }
+//
+//    /**
+//
+//     https://sellingpartnerapi-na.amazon.com/apps/authorize/consent
+//     https://sellingpartnerapi-eu.amazon.com/apps/authorize/consent
+//     https://sellingpartnerapi-fe.amazon.com/apps/authorize/consent
+//
+//     https://www.amazon.com/ap/oa?client_id=AKIAJQM2XW6X65DC5OWA
+//     &scope=profile
+//     &response_type=code
+//     &state=208257577ll0975l93l2l59l895857093449424
+//     &redirect_uri=https://client.example.com/auth_popup/token
+//     &code_challenge=Fw7s3XHRVb2m1nT7s646UrYiYLMJ54as0ZIU_injyqw
+//     &code_challenge_method=S256
+//
+//     if ($this->site == 'eu') {
+//     return 'https://sellercentral-europe.amazon.com/apps/authorize/consent';
+//     } elseif ($this->site == 'fe') {
+//     if ($this->countryCode == 'au') {
+//     return 'https://sellercentral.amazon.com.au/apps/authorize/consent';
+//     } elseif ($this->countryCode == 'jp') {
+//     return 'https://sellercentral-japan.amazon.com/apps/authorize/consent';
+//     } else {
+//     //新加坡
+//     return 'https://sellercentral.amazon.sg/apps/authorize/consent';
+//     }
+//     } else {
+//     return 'https://sellercentral.amazon.com/apps/authorize/consent';
+//     }
+//
+//     //     https://raycos.com.cn/authorize
+//
+//
+//
+//     */
+
+}

+ 19 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/nacoscase/ConfigProperties.java

@@ -0,0 +1,19 @@
+package com.raycos.raycoswebapi.nacoscase;
+
+
+import org.springframework.stereotype.Component;
+
+@Component
+//@RefreshScope
+public class ConfigProperties {
+//    @Value("${spring.cloud.nacos.config.serveraddr}")
+    private String someConfig;
+
+    public String getSomeConfig() {
+        return someConfig;
+    }
+
+    public void setSomeConfig(String someConfig) {
+        this.someConfig = someConfig;
+    }
+}

+ 44 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/nacoscase/NacosController.java

@@ -0,0 +1,44 @@
+package com.raycos.raycoswebapi.nacoscase;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController()
+@RequestMapping("/nacos")
+public class NacosController {
+
+    @Autowired
+    private ConfigProperties configProperties;
+
+
+    @GetMapping( )
+    public String bean(){
+        String someConfig = configProperties.getSomeConfig();
+        String  str = "查询了老弟" + someConfig;
+
+        return str;
+    }
+
+    @PostMapping( )
+    public String bean1(){
+        String  str = "修改了老弟";
+
+        return str;
+    }
+
+    @PutMapping( )
+    public String bean2(){
+        String  str = "新增了老弟";
+
+        return str;
+    }
+
+    @DeleteMapping( )
+    public String bean3(){
+        String  str = "删除了老弟!!";
+
+        return str;
+    }
+}

+ 43 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/nacoscase/TestController.java

@@ -0,0 +1,43 @@
+package com.raycos.raycoswebapi.nacoscase;
+
+import com.raycos.raycoscommon.Internal.Result;
+import com.raycos.raycoscommon.Internal.webapi.User;
+import com.raycos.raycoswebapi.nacoscase.service.EchoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/26 13:23
+ */
+@RestController
+public class TestController {
+    @Autowired
+    private RestTemplate restTemplate;
+    @Autowired
+    private EchoService echoService;
+
+    @GetMapping(value = "/echo-rest/{str}")
+    public Result<String> rest(@PathVariable String str) {
+        System.out.println("来了来了");
+//        return restTemplate.getForObject("http://service-provider/echo/" + str, Result.class);
+        String forObject = restTemplate.getForObject("http://service-provider/echo/" + str, String.class);
+        Result<String> result = new Result<>();
+        result.setCode(200);
+        result.setMsg(forObject);
+        return result;
+    }
+    @GetMapping(value = "/echo-feign/{str}")
+    public Result<String> feign(@PathVariable String str) {
+        return echoService.echo(str);
+    }
+
+    @PostMapping("/hello")
+    public Result<String> helloConsumer (@RequestBody User user ){
+        System.out.println("9999999999999"+user.toString());
+        return echoService.sayHello( user );
+//        return restTemplate.getForObject("http://service-provider/sayHello/" , Result.class, user);
+    }
+
+}

+ 21 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/nacoscase/config/NacosLoadBalancerConfig.java

@@ -0,0 +1,21 @@
+package com.raycos.raycoswebapi.nacoscase.config;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/27 9:39
+ */
+//@LoadBalancerClients(defaultConfiguration = NacosLoadBalancerConfig.class)
+public class NacosLoadBalancerConfig {
+//    @Resource
+//    private NacosDiscoveryProperties nacosDiscoveryProperties;
+//    @Bean
+//    public ReactorLoadBalancer<ServiceInstance> nacosLoadBalancer(
+//            Environment environment, LoadBalancerClientFactory loadBalancerClientFactory) {
+//        String name = environment.getProperty("loadbalancer.client.name");
+//        return new NacosLoadBalancer(
+//                loadBalancerClientFactory.getLazyProvider(name,
+//                        ServiceInstanceListSupplier.class), name
+//                ,nacosDiscoveryProperties);
+//    }
+
+}

+ 21 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/nacoscase/config/RestTemplateConfig.java

@@ -0,0 +1,21 @@
+package com.raycos.raycoswebapi.nacoscase.config;
+
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/26 13:27
+ */
+
+@Configuration
+public class RestTemplateConfig {
+    @Bean
+    @LoadBalanced
+    public RestTemplate restTemplate() {
+        return new RestTemplate();
+    }
+
+}

+ 24 - 0
raycos_web_api/src/main/java/com/raycos/raycoswebapi/nacoscase/service/EchoService.java

@@ -0,0 +1,24 @@
+package com.raycos.raycoswebapi.nacoscase.service;
+
+import com.raycos.raycoscommon.Internal.Result;
+import com.raycos.raycoscommon.Internal.webapi.User;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.cloud.openfeign.SpringQueryMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @Author: xiaojiabin
+ * @Date: 2024/8/26 13:25
+ */
+
+@FeignClient(name = "service-provider")
+public interface EchoService {
+
+    @GetMapping(value = "/echo/{str}")
+    Result<String> echo(@PathVariable("str") String str);
+
+    @PostMapping(value = "/sayHello")
+    Result<String> sayHello (@SpringQueryMap User user );
+}

+ 28 - 0
raycos_web_api/src/main/resources/application.yml

@@ -0,0 +1,28 @@
+server:
+  port: 18084
+spring:
+  application:
+    #    #项目名称必填,在注册中心唯一
+    #    #最好和之前域名规范、kubernetes service名等保持一致(会作为调用)
+    name: service-consumer
+  cloud:
+    nacos:
+      serverAddr: 127.0.0.1:8848
+      discovery:
+        server-addr: 127.0.0.1:8848
+#        namespace: public # 可选,‌命名空间ID,‌用于多环境隔离
+#        group: DEFAULT_GROUP # 可选,‌默认分组
+
+    loadbalancer:
+      nacos:
+        enabled: true
+      ribbon:
+        enabled: false
+  config:
+    import:
+      - nacos:nacos-config-example.properties?refreshEnabled=true
+
+
+
+
+