| | |
| | | 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.beans.factory.annotation.Autowired; |
| | | 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.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | 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); |
| | | } |
| | | } |