pom文件:

<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.csq.study</groupId><artifactId>csq-weather-report</artifactId><version>0.0.1-SNAPSHOT</version>
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.5.2.RELEASE</version></parent><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId></dependency><!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-quartz --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-quartz</artifactId><version>2.1.5.RELEASE</version></dependency><!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>
</project>

config配置类

package com.csq.study.springboot.config;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;@Configuration
public class RestConfiguration {@Autowiredprivate RestTemplateBuilder builder;@Beanpublic RestTemplate restTemplate() {return builder.build();}}

controller

package com.csq.study.springboot.controller;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;import com.csq.study.springboot.service.CityDataService;
import com.csq.study.springboot.service.WeatherReportService;@RestController
@RequestMapping("/report")
public class WeatherController {@Autowiredprivate WeatherReportService WeatherReportService;@Autowiredprivate CityDataService  cityDataService;@GetMapping("/cityId/{cityId}")public ModelAndView getReportByCityId(@PathVariable("cityId") String  cityId,Model model)throws Exception {model.addAttribute("title", "天气预报测试");model.addAttribute("cityId", cityId);model.addAttribute("cityList", cityDataService.listCity());model.addAttribute("report", WeatherReportService.getDataByCityId(cityId));return new ModelAndView("report","reportModel",model);}}

service以及实现类

package com.csq.study.springboot.service;import java.util.List;import com.csq.study.springboot.vo.City;接口:public interface CityDataService {/*** * @Title: listCity * @Description: 获取城市列表 * @return* @throws Exception* */List<City> listCity() throws Exception;
}
实现类:
package com.csq.study.springboot.service.impl;import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;import com.csq.study.springboot.service.CityDataService;
import com.csq.study.springboot.util.XmlBuilder;
import com.csq.study.springboot.vo.City;
import com.csq.study.springboot.vo.CityList;
@Service
public class CityDataServiceImpl implements CityDataService{@Overridepublic List<City> listCity() throws Exception {//读取xml文件Resource resource=new ClassPathResource("cityList.xml");BufferedReader br=new BufferedReader(new InputStreamReader(resource.getInputStream(),"utf-8"));StringBuffer buffer=new StringBuffer();String line="";while((line=br.readLine())!=null){buffer.append(line);}br.close();//xml转为Java对象CityList cityList= (CityList) XmlBuilder.xmlStrToObject(CityList.class, buffer.toString());return cityList.getCityList();}}
接口:
package com.csq.study.springboot.service;import com.csq.study.springboot.vo.WeatherResponse;public interface WeatherDataService {//根据城市ID查询天气数据WeatherResponse getDataByCityId(String cityId);//根据城市名称查询天气数据WeatherResponse getDataByCityName(String cityName);//根据城市ID同步天气数据void syncDataByCityId(String cityId);}
实现类:
package com.csq.study.springboot.service.impl;import java.io.IOException;
import java.util.concurrent.TimeUnit;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;import com.csq.study.springboot.service.WeatherDataService;
import com.csq.study.springboot.vo.Weather;
import com.csq.study.springboot.vo.WeatherResponse;
import com.fasterxml.jackson.databind.ObjectMapper;@Service
public class WeatherDataServiceImpl implements WeatherDataService {private final static Logger logger=LoggerFactory.getLogger(WeatherDataServiceImpl.class);private static final String WEATHER_API="http://wthrcdn.etouch.cn/weather_mini?";private final Long TIME_OUT=1800L;@Autowiredprivate RestTemplate  restTemplate;@Autowiredprivate StringRedisTemplate stringRedisTemplate;public WeatherResponse getDataByCityId(String cityId) {String uri=WEATHER_API + "citykey=" + cityId;return this.doGetWeather(uri);}public WeatherResponse getDataByCityName(String cityName) {String uri=WEATHER_API + "city=" + cityName;return this.doGetWeather(uri);}@Overridepublic void syncDataByCityId(String cityId) {String uri=WEATHER_API + "citykey=" + cityId;this.doGetWeather(uri);}private WeatherResponse doGetWeather(String uri) {ValueOperations<String, String> ops = this.stringRedisTemplate.opsForValue();String key=uri;//将调用的URI作为keyString strBody=null;ObjectMapper mapper=new ObjectMapper();WeatherResponse weather=null;//先查缓存,缓存没有在查服务if(!this.stringRedisTemplate.hasKey(key)) {logger.info("没有找到key");ResponseEntity<String> response = restTemplate.getForEntity(uri, String.class); if(response.getStatusCodeValue()==200) {strBody=response.getBody();}ops.set(key, strBody, TIME_OUT, TimeUnit.SECONDS);}else {logger.info("找到key"+key+",value="+ops.get(key));strBody=ops.get(key);}//用json反序列化成我们想要的数据try {/** strBody:要解析的参数内容,从respString获取* WeatherResponse.class:要转成的对象类型*/weather=mapper.readValue(strBody,WeatherResponse.class);}catch(IOException e) {logger.error("Error!",e);}return weather;}}
接口:
package com.csq.study.springboot.service;import com.csq.study.springboot.vo.Weather;public interface  WeatherReportService {//根据城市id查询天气信息Weather getDataByCityId(String cityId);}
实现类:
package com.csq.study.springboot.service.impl;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import com.csq.study.springboot.service.WeatherDataService;
import com.csq.study.springboot.service.WeatherReportService;
import com.csq.study.springboot.vo.Weather;
import com.csq.study.springboot.vo.WeatherResponse;@Service
public class WeatherReportServiceImpl implements WeatherReportService{@Autowiredprivate WeatherDataService weatherDataService;@Overridepublic Weather getDataByCityId(String cityId) {WeatherResponse response = weatherDataService.getDataByCityId(cityId);return response.getData();}}

job类

package com.csq.study.springboot.job;import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;import com.csq.study.springboot.service.CityDataService;
import com.csq.study.springboot.service.WeatherDataService;
import com.csq.study.springboot.vo.City;@Component
public class ScheduledTasks {private static final Logger logger = LoggerFactory.getLogger(ScheduledTasks.class);private static final SimpleDateFormat formate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");@Autowiredprivate CityDataService cityDataService;@Autowiredprivate WeatherDataService watherDataService;@Scheduled(fixedRate = 30000)public void scheduledDemo(){logger.info("天气数据同步任务 开始  every 5 seconds:{}", formate.format(new Date()) );List<City> cityList=null;try {cityList=cityDataService.listCity();} catch (Exception e) {logger.info("获取异常",e);}for (City city : cityList) {String cityId = city.getCityId();logger.info("天气任务同步中,cityId:"+cityId);//根据城市id获取天气watherDataService.syncDataByCityId(cityId);}logger.info("天气任务同步End");}
}

util工具类

package com.csq.study.springboot.util;import java.io.Reader;
import java.io.StringReader;import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;public class XmlBuilder {//将xml转为指定的POJOpublic static Object xmlStrToObject(Class<?> clazz,String xmlStr) throws Exception{Object xmlObject=null;Reader reader=null;JAXBContext context=JAXBContext.newInstance(clazz);//xml转为对象的接口Unmarshaller unmarshaller=context.createUnmarshaller();reader=new StringReader(xmlStr);xmlObject=unmarshaller.unmarshal(reader);if(reader!=null){reader.close();}return xmlObject;}}

vo类

package com.csq.study.springboot.vo;import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;city类//声明为xml的根元素
@XmlRootElement(name = "d")
//声明xml的访问类型为FIELD(字段)
@XmlAccessorType(XmlAccessType.FIELD)
public class City{  //声明为xml的属性@XmlAttribute(name = "d1")private String cityId;//声明为xml的属性@XmlAttribute(name = "d2")private String cityName;//声明为xml的属性@XmlAttribute(name = "d3")private String cityCode;//声明为xml的属性@XmlAttribute(name = "d4")private String province;public String getCityId() {return cityId;}public void setCityId(String cityId) {this.cityId = cityId;}public String getCityName() {return cityName;}public void setCityName(String cityName) {this.cityName = cityName;}public String getCityCode() {return cityCode;}public void setCityCode(String cityCode) {this.cityCode = cityCode;}public String getProvince() {return province;}public void setProvince(String province) {this.province = province;}@Overridepublic String toString() {return "City [cityId=" + cityId + ", cityName=" + cityName + ", cityCode=" + cityCode + ", province="+ province + "]";}}
package com.csq.study.springboot.vo;import java.util.List;import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
CityList 类
@XmlRootElement(name = "c")
@XmlAccessorType(XmlAccessType.FIELD)
public class CityList {@XmlElement(name = "d")private List<City> cityList;public List<City> getCityList() {return cityList;}public void setCityList(List<City> cityList) {this.cityList = cityList;}}
package com.csq.study.springboot.vo;import java.io.Serializable;Forecast 类public class Forecast implements Serializable{/*** @Fields serialVersionUID : TODO*/private static final long serialVersionUID = 1L;private String date;//琪日期private String high;//最高温度private String fengxiang;//风向private String low;//最低温度private String fengli;//风力private String type;//天气类型public String getDate() {return date;}public void setDate(String date) {this.date = date;}public String getHigh() {return high;}public void setHigh(String high) {this.high = high;}public String getFengxiang() {return fengxiang;}public void setFengxiang(String fengxiang) {this.fengxiang = fengxiang;}public String getLow() {return low;}public void setLow(String low) {this.low = low;}public String getFengli() {return fengli;}public void setFengli(String fengli) {this.fengli = fengli;}public String getType() {return type;}public void setType(String type) {this.type = type;}}
package com.csq.study.springboot.vo;import java.io.Serializable;
import java.util.List;Weather 类public class Weather implements Serializable {/*** @Fields serialVersionUID : TODO*/private static final long serialVersionUID = 1L;private String city;private String aqi;//private String wendu;private String ganmao;private Yesterday  yesterday;private List<Forecast> forecast;public String getCity() {return city;}public void setCity(String city) {this.city = city;}public String getAqi() {return aqi;}public void setAqi(String aqi) {this.aqi = aqi;}public String getWendu() {return wendu;}public void setWendu(String wendu) {this.wendu = wendu;}public String getGanmao() {return ganmao;}public void setGanmao(String ganmao) {this.ganmao = ganmao;}public Yesterday getYesterday() {return yesterday;}public void setYesterday(Yesterday yesterday) {this.yesterday = yesterday;}public List<Forecast> getForecast() {return forecast;}public void setForecast(List<Forecast> forecast) {this.forecast = forecast;}}
package com.csq.study.springboot.vo;import java.io.Serializable;WeatherResponse 类public class WeatherResponse implements Serializable{/*** @Fields serialVersionUID : TODO*/private static final long serialVersionUID = 1L;private Weather data; //消息数据private String  status; //消息状态private String desc;//消息描述public Weather getData() {return data;}public void setData(Weather data) {this.data = data;}public String getStatus() {return status;}public void setStatus(String status) {this.status = status;}public String getDesc() {return desc;}public void setDesc(String desc) {this.desc = desc;}}
package com.csq.study.springboot.vo;import java.io.Serializable;Yesterday 类public class Yesterday implements Serializable{/*** @Fields serialVersionUID : TODO*/private static final long serialVersionUID = 1L;private String date;private String high;private String fx;private String low;private String fl;private String type;public String getDate() {return date;}public void setDate(String date) {this.date = date;}public String getHigh() {return high;}public void setHigh(String high) {this.high = high;}public String getFx() {return fx;}public void setFx(String fx) {this.fx = fx;}public String getLow() {return low;}public void setLow(String low) {this.low = low;}public String getFl() {return fl;}public void setFl(String fl) {this.fl = fl;}public String getType() {return type;}public void setType(String type) {this.type = type;}}

启动类

package com.csq.study.springboot;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
public class Aplication {public static void main(String[] args) {SpringApplication.run(Aplication.class, args);}}

js

/*** report页面下拉框事件*/$(function(){$("#selectCityId").change(function () {var cityId=$("#selectCityId").val();var url='/report/cityId/'+cityId;window.location.href=url;})});

report.html

<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/><!-- Bootstrap CSS --><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"/><title>天气预报</title>
</head>
<body><div class="container"><div class="row"><h3 th:text="${reportModel.title}">天气</h3><select class="custom-select" id="selectCityId"><option th:each="city : ${reportModel.cityList}"th:value="${city.cityId}" th:text="${city.cityName}"th:selected="${city.cityId eq reportModel.cityId}"></option></select></div><div class="row"><h1 class="text-success" th:text="${reportModel.report.city}">城市名称</h1></div><div class="row"><p>空气质量指数:<span th:text="${reportModel.report.aqi}"></span></p></div><div class="row"><p>当前温度:<span th:text="${reportModel.report.wendu}"></span></p></div><div class="row"><p>温馨提示:<span th:text="${reportModel.report.ganmao}"></span></p></div><div class="row"><div class="card border-info" th:each="forecast : ${reportModel.report.forecast}"><div class="card-body text-info"><p class="card-text" th:text="${forecast.date}">日期</p><p class="card-text" th:text="${forecast.type}">天气类型</p><p class="card-text" th:text="${forecast.high}">最高温度</p><p class="card-text" th:text="${forecast.low}">最低温度</p><p class="card-text" th:text="${forecast.fengxiang}">风向</p></div></div></div></div><!-- jQuery first, then Popper.js, then Bootstrap JS --><script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script><!-- Optional JavaScript --><script type="text/javascript" th:src="@{/js/report.js}"></script>
</body>
</html>

application.properties

#热部署静态文件
spring.thymeleaf.cache=false

citylist.xml

<?xml version="1.0" encoding="UTF-8" ?>
<c c1="0"><d d1="101010100" d2="北京" d3="beijing" d4="北京"/><d d1="101010200" d2="海淀" d3="haidian" d4="北京"/><d d1="101010300" d2="朝阳" d3="chaoyang" d4="北京"/><d d1="101010400" d2="顺义" d3="shunyi" d4="北京"/><d d1="101010500" d2="怀柔" d3="huairou" d4="北京"/><d d1="101010600" d2="通州" d3="tongzhou" d4="北京"/><d d1="101010700" d2="昌平" d3="changping" d4="北京"/><d d1="101010800" d2="延庆" d3="yanqing" d4="北京"/><d d1="101010900" d2="丰台" d3="fengtai" d4="北京"/><d d1="101011000" d2="石景山" d3="shijingshan" d4="北京"/><d d1="101011100" d2="大兴" d3="daxing" d4="北京"/><d d1="101011200" d2="房山" d3="fangshan" d4="北京"/><d d1="101011300" d2="密云" d3="miyun" d4="北京"/><d d1="101011400" d2="门头沟" d3="mentougou" d4="北京"/><d d1="101011500" d2="平谷" d3="pinggu" d4="北京"/><d d1="101020100" d2="上海" d3="shanghai" d4="上海"/><d d1="101020200" d2="闵行" d3="minhang" d4="上海"/><d d1="101020300" d2="宝山" d3="baoshan" d4="上海"/><d d1="101020500" d2="嘉定" d3="jiading" d4="上海"/><d d1="101020600" d2="南汇" d3="nanhui" d4="上海"/><d d1="101020700" d2="金山" d3="jinshan" d4="上海"/><d d1="101020800" d2="青浦" d3="qingpu" d4="上海"/><d d1="101020900" d2="松江" d3="songjiang" d4="上海"/><d d1="101021000" d2="奉贤" d3="fengxian" d4="上海"/><d d1="101021100" d2="崇明" d3="chongming" d4="上海"/><d d1="101021200" d2="徐家汇" d3="xujiahui" d4="上海"/><d d1="101021300" d2="浦东" d3="pudong" d4="上海"/><d d1="101280101" d2="广州" d3="guangzhou" d4="广东"/><d d1="101280102" d2="番禺" d3="panyu" d4="广东"/><d d1="101280103" d2="从化" d3="conghua" d4="广东"/><d d1="101280104" d2="增城" d3="zengcheng" d4="广东"/><d d1="101280105" d2="花都" d3="huadu" d4="广东"/><d d1="101280201" d2="韶关" d3="shaoguan" d4="广东"/><d d1="101280202" d2="乳源" d3="ruyuan" d4="广东"/><d d1="101280203" d2="始兴" d3="shixing" d4="广东"/><d d1="101280204" d2="翁源" d3="wengyuan" d4="广东"/><d d1="101280205" d2="乐昌" d3="lechang" d4="广东"/><d d1="101280206" d2="仁化" d3="renhua" d4="广东"/><d d1="101280207" d2="南雄" d3="nanxiong" d4="广东"/><d d1="101280208" d2="新丰" d3="xinfeng" d4="广东"/><d d1="101280209" d2="曲江" d3="qujiang" d4="广东"/><d d1="101280210" d2="浈江" d3="chengjiang" d4="广东"/><d d1="101280211" d2="武江" d3="wujiang" d4="广东"/><d d1="101280301" d2="惠州" d3="huizhou" d4="广东"/><d d1="101280302" d2="博罗" d3="boluo" d4="广东"/><d d1="101280303" d2="惠阳" d3="huiyang" d4="广东"/><d d1="101280304" d2="惠东" d3="huidong" d4="广东"/><d d1="101280305" d2="龙门" d3="longmen" d4="广东"/><d d1="101280401" d2="梅州" d3="meizhou" d4="广东"/><d d1="101280402" d2="兴宁" d3="xingning" d4="广东"/><d d1="101280403" d2="蕉岭" d3="jiaoling" d4="广东"/><d d1="101280404" d2="大埔" d3="dabu" d4="广东"/><d d1="101280406" d2="丰顺" d3="fengshun" d4="广东"/><d d1="101280407" d2="平远" d3="pingyuan" d4="广东"/><d d1="101280408" d2="五华" d3="wuhua" d4="广东"/><d d1="101280409" d2="梅县" d3="meixian" d4="广东"/><d d1="101280501" d2="汕头" d3="shantou" d4="广东"/><d d1="101280502" d2="潮阳" d3="chaoyang" d4="广东"/><d d1="101280503" d2="澄海" d3="chenghai" d4="广东"/><d d1="101280504" d2="南澳" d3="nanao" d4="广东"/><d d1="101280601" d2="深圳" d3="shenzhen" d4="广东"/><d d1="101280701" d2="珠海" d3="zhuhai" d4="广东"/><d d1="101280702" d2="斗门" d3="doumen" d4="广东"/><d d1="101280703" d2="金湾" d3="jinwan" d4="广东"/><d d1="101280800" d2="佛山" d3="foshan" d4="广东"/><d d1="101280801" d2="顺德" d3="shunde" d4="广东"/><d d1="101280802" d2="三水" d3="sanshui" d4="广东"/><d d1="101280803" d2="南海" d3="nanhai" d4="广东"/><d d1="101280804" d2="高明" d3="gaoming" d4="广东"/><d d1="101280901" d2="肇庆" d3="zhaoqing" d4="广东"/><d d1="101280902" d2="广宁" d3="guangning" d4="广东"/><d d1="101280903" d2="四会" d3="sihui" d4="广东"/><d d1="101280905" d2="德庆" d3="deqing" d4="广东"/><d d1="101280906" d2="怀集" d3="huaiji" d4="广东"/><d d1="101280907" d2="封开" d3="fengkai" d4="广东"/><d d1="101280908" d2="高要" d3="gaoyao" d4="广东"/><d d1="101281001" d2="湛江" d3="zhanjiang" d4="广东"/><d d1="101281002" d2="吴川" d3="wuchuan" d4="广东"/><d d1="101281003" d2="雷州" d3="leizhou" d4="广东"/><d d1="101281004" d2="徐闻" d3="xuwen" d4="广东"/><d d1="101281005" d2="廉江" d3="lianjiang" d4="广东"/><d d1="101281006" d2="赤坎" d3="chikan" d4="广东"/><d d1="101281007" d2="遂溪" d3="suixi" d4="广东"/><d d1="101281008" d2="坡头" d3="potou" d4="广东"/><d d1="101281009" d2="霞山" d3="xiashan" d4="广东"/><d d1="101281010" d2="麻章" d3="mazhang" d4="广东"/><d d1="101281101" d2="江门" d3="jiangmen" d4="广东"/><d d1="101281103" d2="开平" d3="kaiping" d4="广东"/><d d1="101281104" d2="新会" d3="xinhui" d4="广东"/><d d1="101281105" d2="恩平" d3="enping" d4="广东"/><d d1="101281106" d2="台山" d3="taishan" d4="广东"/><d d1="101281107" d2="蓬江" d3="pengjiang" d4="广东"/><d d1="101281108" d2="鹤山" d3="heshan" d4="广东"/><d d1="101281109" d2="江海" d3="jianghai" d4="广东"/><d d1="101281201" d2="河源" d3="heyuan" d4="广东"/><d d1="101281202" d2="紫金" d3="zijin" d4="广东"/><d d1="101281203" d2="连平" d3="lianping" d4="广东"/><d d1="101281204" d2="和平" d3="heping" d4="广东"/><d d1="101281205" d2="龙川" d3="longchuan" d4="广东"/><d d1="101281206" d2="东源" d3="dongyuan" d4="广东"/><d d1="101281301" d2="清远" d3="qingyuan" d4="广东"/><d d1="101281302" d2="连南" d3="liannan" d4="广东"/><d d1="101281303" d2="连州" d3="lianzhou" d4="广东"/><d d1="101281304" d2="连山" d3="lianshan" d4="广东"/><d d1="101281305" d2="阳山" d3="yangshan" d4="广东"/><d d1="101281306" d2="佛冈" d3="fogang" d4="广东"/><d d1="101281307" d2="英德" d3="yingde" d4="广东"/><d d1="101281308" d2="清新" d3="qingxin" d4="广东"/><d d1="101281401" d2="云浮" d3="yunfu" d4="广东"/><d d1="101281402" d2="罗定" d3="luoding" d4="广东"/><d d1="101281403" d2="新兴" d3="xinxing" d4="广东"/><d d1="101281404" d2="郁南" d3="yunan" d4="广东"/><d d1="101281406" d2="云安" d3="yunan" d4="广东"/><d d1="101281501" d2="潮州" d3="chaozhou" d4="广东"/><d d1="101281502" d2="饶平" d3="raoping" d4="广东"/><d d1="101281503" d2="潮安" d3="chaoan" d4="广东"/><d d1="101281601" d2="东莞" d3="dongguan" d4="广东"/><d d1="101281701" d2="中山" d3="zhongshan" d4="广东"/><d d1="101281801" d2="阳江" d3="yangjiang" d4="广东"/><d d1="101281802" d2="阳春" d3="yangchun" d4="广东"/><d d1="101281803" d2="阳东" d3="yangdong" d4="广东"/><d d1="101281804" d2="阳西" d3="yangxi" d4="广东"/><d d1="101281901" d2="揭阳" d3="jieyang" d4="广东"/><d d1="101281902" d2="揭西" d3="jiexi" d4="广东"/><d d1="101281903" d2="普宁" d3="puning" d4="广东"/><d d1="101281904" d2="惠来" d3="huilai" d4="广东"/><d d1="101281905" d2="揭东" d3="jiedong" d4="广东"/><d d1="101282001" d2="茂名" d3="maoming" d4="广东"/><d d1="101282002" d2="高州" d3="gaozhou" d4="广东"/><d d1="101282003" d2="化州" d3="huazhou" d4="广东"/><d d1="101282004" d2="电白" d3="dianbai" d4="广东"/><d d1="101282005" d2="信宜" d3="xinyi" d4="广东"/><d d1="101282006" d2="茂港" d3="maogang" d4="广东"/><d d1="101282101" d2="汕尾" d3="shanwei" d4="广东"/><d d1="101282102" d2="海丰" d3="haifeng" d4="广东"/><d d1="101282103" d2="陆丰" d3="lufeng" d4="广东"/><d d1="101282104" d2="陆河" d3="luhe" d4="广东"/>
</c>

运行之后,访问:http://localhost:8080/report/cityId/101010900  出现下面 截图就ok

下拉选选择不同的地方出现的就是不同地方的信息 ,若不出现,兹证明有地方没有处理好,需要去检查。

转载注明出处:https://blog.csdn.net/FindHuni/article/details/91047684

利用springboot快速实现一个天气数据查询系统(附带页面)(五)相关推荐

  1. 如何利用springboot快速搭建一个消息推送系统

    最近在完善毕设的路上,由于是设计一个远程控制物联网系统,所以服务端到硬件我选用了MQTT协议.因为MQTT的发布/订阅模式很适合这种场景.接下来就来聊聊遇到的一些问题以及解决思路吧. 毕设技术栈:sp ...

  2. 利用易查分制作分班查询系统,怎么导入数据?

    暑假过半,新学期即将到来,这对学校来说是一个重要的时刻.新学期的开始意味着学校将面临新生入学和老生升入高年级的情况,这就需要进行分班工作的安排.分班工作是一项繁琐而关键的任务,它直接关系到学生们在新学 ...

  3. putty串口打开没反应_如何使用树莓派快速搭建一个串口数据记录器?

    在最近发现同事的某些项目临时增加了一些需求,把测出的能见度数据保存在存储介质中,并且可以随时远程查阅.如果在项目时间与成本允许的情况下,我们会选择在PCB中增加SD卡槽以及以太网接口,用于存储数据和联 ...

  4. windows和Linux利用Python快速搭建一个网站

    windows和Linux利用Python快速搭建一个网站 一.windows 步骤1:安装Python3(自行百度) 步骤2:在cmd窗口输入ipconfig查看本机ip地址,IPV4那一行.如:1 ...

  5. 一个html写的app首页,如何快速开发一个简单好看的APP控制页面

    原标题:如何快速开发一个简单好看的APP控制页面 导读 机智云开源框架为了让开发者快速开发APP,已将用户登录,设备发现,设备配网等功能做成了各个标准模块,仅保留控制页面让开发者自行开发设计,节省了开 ...

  6. 基于springboot+vue的疾病匿名检测查询系统

    基于springboot+vue的疾病匿名检测查询系统 ✌全网粉丝20W+,csdn特邀作者.博客专家.CSDN新星计划导师.java领域优质创作者,博客之星.掘金/华为云/阿里云/InfoQ等平台优 ...

  7. 华测服务器进不去系统,华测网络数据查询系统

    华测网络数据查询系统主要功能是客户手机终端联网查询仪器是否成功登录华测网络服务器.软件能自动保存查询历史,自主访问华测全部四个服务器,极大地方便了使用者. 使用说明: 查看仪器是否在线及工作状态: 打 ...

  8. SpringBoot高级篇JdbcTemplate之数据查询上篇

    前面一篇介绍如何使用JdbcTemplate实现插入数据,接下来进入实际业务中,最常见的查询篇.由于查询的姿势实在太多,对内容进行了拆分,本篇主要介绍几个基本的使用姿势 queryForMap que ...

  9. 教你实现一个天气实时查询微信小程序

    文章目录 博主绪言 组件选择部署阶段 组件选择 组件变量安排 组件布局 js后端逻辑处理环节 API处理环节 函数处理环节 结束语 博主绪言 天气之子app主要功能是选择地区(省,市,区或者县),然后 ...

最新文章

  1. 《Arduino开发实战指南:机器人卷》一3.3 直流电机驱动电路原理
  2. codeforces425C
  3. 服务器虚拟化svc,SVC的虚拟化变革
  4. 15_Python模块化编程_Python编程之路
  5. 开发人员常用的Oracle导入/导出命令
  6. java代码生成Excel文件3000条自定义属性的的域账户名
  7. javascript 遍历数组的常用方法(迭代、for循环 、for… in、for…of、foreach、map、filter、every、some,findindex)
  8. 【C语言】素数/质数
  9. c#数字验证码功能,以及判断用户输入是否正确。
  10. Linux服务器搭建——VMware14安装
  11. vba 输出文本 m Linux,利用VBA实现EXCEL数据输出TXT等文本文件
  12. verilog中pullup和pulldown的用法
  13. How to set up the esp-hosted SDK compilation environment for ESP32-C3
  14. 大数据常见面试题 Hadoop篇(1)
  15. 大数据集群服务器的规划,如何安排服务器
  16. 20201214c列出最简真分数序列
  17. Demo:校验_SAP刘梦_新浪博客
  18. HSWMS——库存管理
  19. macos终端美化_关于macOS终端美化的最轻松的指南Z Shell中的速成课程
  20. 思考致富-55个著名的借口

热门文章

  1. 说说数据库中sum的用法
  2. 微信订餐系统怎么建设?
  3. 虹软java接摄像头_Java使用虹软SDK做人脸识别之十分简单的入门
  4. 戳Web3的神话?戳到铁板。
  5. Tech Talk 活动回顾|云原生 DevOps 的 Kubernetes 技巧
  6. ERP实施过程可能存的问题
  7. ntp 服务:Server dropped: Strata too high
  8. 最简单的Java反射机制
  9. 陪学读书会——《定位》第十一章:搭便车陷阱
  10. umount.nfs: device is busy解决