♻️Refactor: 简化微服务

This commit is contained in:
2025-10-29 16:08:19 +08:00
parent c0b89fcd95
commit 060466b7b7
26 changed files with 20 additions and 195 deletions
-10
View File
@@ -28,16 +28,6 @@
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
public class HealthController {
@GetMapping("health")
@GetMapping("/health")
public String health() {
return "Hello wonder!";
}
@@ -1,6 +1,6 @@
package cn.hezhaohui.weather.controller;
import cn.hezhaohui.weather.entity.Weather;
import cn.hezhaohui.entity.Weather;
import cn.hezhaohui.weather.util.WeatherUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
public class WeatherController {
@GetMapping("get")
@GetMapping("/get")
public Weather getWeather() {
return WeatherUtil.getWeather();
}
@@ -1,6 +1,6 @@
package cn.hezhaohui.weather.service;
import cn.hezhaohui.weather.common.AIConstant;
import cn.hezhaohui.common.AIConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Service;
@@ -1,14 +1,14 @@
package cn.hezhaohui.weather.util;
import cn.hezhaohui.weather.common.AIConstant;
import cn.hezhaohui.weather.entity.Weather;
import cn.hezhaohui.common.AIConstant;
import cn.hezhaohui.entity.Weather;
import cn.hezhaohui.weather.service.ChatService;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import static cn.hezhaohui.weather.common.WeatherConstant.*;
import static cn.hezhaohui.common.WeatherConstant.*;
@Slf4j
public class WeatherUtil {
@@ -18,8 +18,6 @@ public class WeatherUtil {
*
*/
private static String createUrl() {
String url = API_BASE_URL +
"?key=" +
@@ -1,7 +1,6 @@
spring:
application:
name: service-weather
ai:
openai:
api-key: sk-ihsqnxhnzmgsaojdkxomcmgdypdfpzojymfndfklgzfchlgz
@@ -10,10 +9,6 @@ spring:
options:
model: Pro/Qwen/Qwen2.5-7B-Instruct
temperature: 0.7
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/
server:
port: 8083
@@ -1,6 +1,6 @@
package cn.hezhaohui.weather.service;
import cn.hezhaohui.weather.common.AIConstant;
import cn.hezhaohui.common.AIConstant;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@@ -1,6 +1,6 @@
package cn.hezhaohui.weather.util;
import cn.hezhaohui.weather.entity.Weather;
import cn.hezhaohui.entity.Weather;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;