diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue
index 8153c452..57a7a03d 100644
--- a/ruoyi-ui/src/layout/components/Navbar.vue
+++ b/ruoyi-ui/src/layout/components/Navbar.vue
@@ -18,42 +18,22 @@
|
- 今天
+ 今天({{cast.week}})
- 明天
+ 明天({{cast.week}})
- 后天
+ 后天({{cast.week}})
- 大后天
+ 大后天({{cast.week}})
{{cast.dayweather}}
{{cast.nighttemp+"℃~"+cast.daytemp+"℃"}}
-
- 星期一
-
-
- 星期二
-
-
- 星期三
-
-
- 星期四
-
-
- 星期五
-
-
- 星期六
-
-
- 星期日
-
+
diff --git a/xjs-business/xjs-business-openapi/src/main/java/com/xjs/weather/controller/WeatherController.java b/xjs-business/xjs-business-openapi/src/main/java/com/xjs/weather/controller/WeatherController.java
index 2c723da7..75713c11 100644
--- a/xjs-business/xjs-business-openapi/src/main/java/com/xjs/weather/controller/WeatherController.java
+++ b/xjs-business/xjs-business-openapi/src/main/java/com/xjs/weather/controller/WeatherController.java
@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.security.annotation.RequiresLogin;
+import com.xjs.weather.domain.ForecastWeather;
import com.xjs.weather.domain.NowWeather;
import com.xjs.weather.service.WeatherService;
import io.swagger.annotations.Api;
@@ -45,11 +46,12 @@ public class WeatherController {
@Log(title = "获取预报天气")
@RequiresLogin
public AjaxResult getForecastWeatherApiData() {
- return AjaxResult.success(weatherService.cacheForecastWeather());
+ ForecastWeather forecastWeather = weatherService.cacheForecastWeather();
+ this.weekConvert(forecastWeather);
+ return AjaxResult.success(forecastWeather);
}
-
@GetMapping("getWeatherForRPC")
@ApiOperation("远程调用获取天气信息ForRPC")
public R getWeatherForRPC() {
@@ -57,4 +59,40 @@ public class WeatherController {
return Objects.nonNull(nowWeather.getCity()) ? R.ok() : R.fail();
}
+
+ /**
+ * week类型转换
+ *
+ * @return ForecastWeather
+ */
+ private void weekConvert(ForecastWeather forecastWeather) {
+ forecastWeather.getCasts().forEach(cast -> {
+ switch (cast.getWeek()) {
+ case "1":
+ cast.setWeek("周一");
+ break;
+ case "2":
+ cast.setWeek("周二");
+ break;
+ case "3":
+ cast.setWeek("周三");
+ break;
+ case "4":
+ cast.setWeek("周四");
+ break;
+ case "5":
+ cast.setWeek("周五");
+ break;
+ case "6":
+ cast.setWeek("周六");
+ break;
+ case "7":
+ cast.setWeek("周日");
+ break;
+ }
+ });
+
+ }
+
+
}