From a2d9f8585da32fa38f759311effd36da11a99841 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Thu, 28 Sep 2023 14:33:06 +0800
Subject: [PATCH] chore:补充提交

---
 screen-api/src/main/java/com/moral/api/controller/WeatherController.java |   45 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/controller/WeatherController.java b/screen-api/src/main/java/com/moral/api/controller/WeatherController.java
index 740f141..d3cec9d 100644
--- a/screen-api/src/main/java/com/moral/api/controller/WeatherController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/WeatherController.java
@@ -1,12 +1,20 @@
 package com.moral.api.controller;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.moral.api.entity.CityWeather;
+import com.moral.api.service.CityWeatherService;
+import com.moral.constant.Constants;
+import com.moral.constant.ResponseCodeEnum;
 import com.moral.constant.ResultMessage;
+import com.moral.util.WebUtils;
 import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @ClassName WeatherController
@@ -16,13 +24,36 @@
  * @Version TODO
  **/
 @Slf4j
-@Api(tags = {"������������"})
+@Api(tags = {"������"})
 @RestController
 @RequestMapping("/weather")
 @CrossOrigin(origins = "*", maxAge = 3600)
 public class WeatherController {
+
+    @Autowired
+    CityWeatherService cityWeatherService;
+
+    /**
+    * @Description: ���������������������������
+            * @Param: [regionCode]
+            * @return: com.moral.constant.ResultMessage
+            * @Author: ���������
+            * @Date: 2021/10/29
+            */
     @GetMapping("queryByRegionCode")
-    public ResultMessage queryByRegionCode(String regionCode){
-        return null;
+    public ResultMessage queryByRegionCode(Integer regionCode){
+        Map<String, Object> value = cityWeatherService.queryWeatherByRegionCode(regionCode);
+        return ResultMessage.ok(value);
+    }
+
+    @RequestMapping(value = "dressingIndex", method = RequestMethod.GET)
+    public ResultMessage dressingIndex(HttpServletRequest request){
+        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+        Object regionCode = parameters.get("regionCode");
+        if (ObjectUtils.isEmpty(regionCode)){
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+        }
+        Map<String, Object> resultMap = cityWeatherService.dressingIndex(parameters);
+        return ResultMessage.ok(resultMap);
     }
 }

--
Gitblit v1.8.0