city change

master
修改密码漏洞修复完成 9 months ago
parent 3456af55ff
commit a6f669e0ee

@ -38,7 +38,7 @@ public class ScheduledService {
* @description:
* @Param: null
*/
//@Scheduled(cron = "0 49 * * * *")
@Scheduled(cron = "0 14 * * * *")
public void getNmcWeatherProvince() {
System.out.println("scheduledGetWeather");
System.out.println("=====>>>>>使用cron:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
@ -65,13 +65,16 @@ public class ScheduledService {
System.out.println(body);
if (StringUtils.hasText(body)) {
Gson gson = new Gson();
List<NmcProvince> provinces = gson.fromJson(body, new TypeToken<List<NmcProvince>>() {
}.getType());
;
List<NmcProvince> provinces = gson.fromJson(body, new TypeToken<List<NmcProvince>>() {}.getType());
for (NmcProvince province : provinces) {
System.out.println(gson.toJson(province));
NmcProvince provinceDb=this.nmcCityService.findProvinceByCode(province.getCode());
if(provinceDb==null){
this.nmcCityService.saveProvince(province);
}else{
getNmcWeatherCityByCode(province.getCode());
}
try {
Thread.sleep(500);
} catch (Exception e) {
@ -114,13 +117,15 @@ public class ScheduledService {
System.out.println(body);
if (StringUtils.hasText(body)) {
Gson gson = new Gson();
List<NmcCity> citys = gson.fromJson(body, new TypeToken<List<NmcCity>>() {
}.getType());
;
List<NmcCity> citys = gson.fromJson(body, new TypeToken<List<NmcCity>>() {}.getType());
for (NmcCity city : citys) {
System.out.println(gson.toJson(city));
NmcCity cityDB=this.nmcCityService.findCityByCode(city.getCode());
if(cityDB==null){
this.nmcCityService.saveCity(city);
}
}
System.out.println(citys.size());
}
} catch (IOException e) {
@ -134,7 +139,7 @@ public class ScheduledService {
* @description:
* @Param: null
*/
@Scheduled(cron = "0 15 * * * *")
//@Scheduled(cron = "0 15 * * * *")
public void getNmcNowWeather() {
System.out.println("scheduledGetWeather");
System.out.println("=====>>>>>使用cron:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

@ -9,8 +9,8 @@ spring:
# url: jdbc:mysql://127.0.0.1:3306/head_office_data_center?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&allowMultiQueries=true
# url: jdbc:mysql://localhost:3306/head_office_data_center?useUnicode=true&characterEncoding=utf-8&useSSL=true&nullCatalogMeansCurrent=true&serverTimezone=UTC
# url: jdbc:mysql://192.168.2.18:3306/disruptor_nmc?useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true
#url: jdbc:mysql://192.168.3.7:3306/disruptor_nmc?useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true
url: jdbc:mysql://127.0.0.1:3306/disruptor_nmc?useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true
url: jdbc:mysql://192.168.3.7:3306/disruptor_nmc?useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true
#url: jdbc:mysql://127.0.0.1:3306/disruptor_nmc?useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true
username: root
password: Skyinno251,
# driverClassName: oracle.jdbc.driver.OracleDriver

Loading…
Cancel
Save