|
@@ -37,22 +37,19 @@ public class CollectionService {
|
|
|
|
|
|
public void saveMeteorologicalData(){
|
|
public void saveMeteorologicalData(){
|
|
List<Coordinate> coordinateList = CacheContext.coordinateList;
|
|
List<Coordinate> coordinateList = CacheContext.coordinateList;
|
|
- //开始时间
|
|
|
|
- long startTime = System.currentTimeMillis();
|
|
|
|
|
|
|
|
coordinateList.stream().forEach(c->{
|
|
coordinateList.stream().forEach(c->{
|
|
String[] models = model.split(",");
|
|
String[] models = model.split(",");
|
|
Arrays.stream(models).forEach(m->{
|
|
Arrays.stream(models).forEach(m->{
|
|
|
|
+ long startTime = System.currentTimeMillis();
|
|
String restUrl = url+m+"?lat="+c.getLat()+"&lon="+c.getLon()+"&units=metric&appid="+weatherkey;
|
|
String restUrl = url+m+"?lat="+c.getLat()+"&lon="+c.getLon()+"&units=metric&appid="+weatherkey;
|
|
String s = RestTemplateUtil.get(restUrl, null);
|
|
String s = RestTemplateUtil.get(restUrl, null);
|
|
redisService.set((c.getForeignkeyid()+"_"+m).toUpperCase(),s);
|
|
redisService.set((c.getForeignkeyid()+"_"+m).toUpperCase(),s);
|
|
- log.info((c.getForeignkeyid()+"_"+m).toUpperCase()+"保存成功");
|
|
|
|
|
|
+ long endTime = System.currentTimeMillis();
|
|
|
|
+ log.info((c.getForeignkeyid()+"_"+m).toUpperCase()+"保存成功,用时"+ (endTime-startTime) + "毫秒,当前时间为"+DateUtils.parseLongToDate(endTime));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- //结束时间
|
|
|
|
- long endTime = System.currentTimeMillis();
|
|
|
|
- redisService.set("test",(endTime-startTime) + "毫秒");
|
|
|
|
- log.info("运行时间为:"+ (endTime-startTime) + "毫秒,当前时间为"+DateUtils.parseLongToDate(endTime));
|
|
|
|
|
|
+
|
|
;
|
|
;
|
|
}
|
|
}
|
|
}
|
|
}
|