city change

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

@ -38,7 +38,7 @@ public class ScheduledService {
* @description: * @description:
* @Param: null * @Param: null
*/ */
//@Scheduled(cron = "0 49 * * * *") @Scheduled(cron = "0 14 * * * *")
public void getNmcWeatherProvince() { public void getNmcWeatherProvince() {
System.out.println("scheduledGetWeather"); System.out.println("scheduledGetWeather");
System.out.println("=====>>>>>使用cron:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 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); System.out.println(body);
if (StringUtils.hasText(body)) { if (StringUtils.hasText(body)) {
Gson gson = new Gson(); Gson gson = new Gson();
List<NmcProvince> provinces = gson.fromJson(body, new TypeToken<List<NmcProvince>>() { List<NmcProvince> provinces = gson.fromJson(body, new TypeToken<List<NmcProvince>>() {}.getType());
}.getType());
;
for (NmcProvince province : provinces) { for (NmcProvince province : provinces) {
System.out.println(gson.toJson(province)); System.out.println(gson.toJson(province));
this.nmcCityService.saveProvince(province); NmcProvince provinceDb=this.nmcCityService.findProvinceByCode(province.getCode());
getNmcWeatherCityByCode(province.getCode()); if(provinceDb==null){
this.nmcCityService.saveProvince(province);
}else{
getNmcWeatherCityByCode(province.getCode());
}
try { try {
Thread.sleep(500); Thread.sleep(500);
} catch (Exception e) { } catch (Exception e) {
@ -114,12 +117,14 @@ public class ScheduledService {
System.out.println(body); System.out.println(body);
if (StringUtils.hasText(body)) { if (StringUtils.hasText(body)) {
Gson gson = new Gson(); Gson gson = new Gson();
List<NmcCity> citys = gson.fromJson(body, new TypeToken<List<NmcCity>>() { List<NmcCity> citys = gson.fromJson(body, new TypeToken<List<NmcCity>>() {}.getType());
}.getType());
;
for (NmcCity city : citys) { for (NmcCity city : citys) {
System.out.println(gson.toJson(city)); System.out.println(gson.toJson(city));
this.nmcCityService.saveCity(city); NmcCity cityDB=this.nmcCityService.findCityByCode(city.getCode());
if(cityDB==null){
this.nmcCityService.saveCity(city);
}
} }
System.out.println(citys.size()); System.out.println(citys.size());
} }
@ -134,7 +139,7 @@ public class ScheduledService {
* @description: * @description:
* @Param: null * @Param: null
*/ */
@Scheduled(cron = "0 15 * * * *") //@Scheduled(cron = "0 15 * * * *")
public void getNmcNowWeather() { public void getNmcNowWeather() {
System.out.println("scheduledGetWeather"); System.out.println("scheduledGetWeather");
System.out.println("=====>>>>>使用cron:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); 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://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://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.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://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://127.0.0.1:3306/disruptor_nmc?useUnicode=true&characterEncoding=utf-8&useSSL=false&autoReconnect=true
username: root username: root
password: Skyinno251, password: Skyinno251,
# driverClassName: oracle.jdbc.driver.OracleDriver # driverClassName: oracle.jdbc.driver.OracleDriver

Loading…
Cancel
Save