| | |
| | | package com.moral.service.impl; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | |
| | |
| | | |
| | | @Override |
| | | public int insertRealWeather() throws ParseException { |
| | | DecimalFormat df = new DecimalFormat("0.0"); |
| | | Calendar c = Calendar.getInstance(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | resultMap.put("cityCode",map.get("cityCode").toString()); |
| | | resultMap.put("time",now); |
| | | Map<String, Object> jsonMap = (Map<String, Object>) map.get("data"); |
| | | |
| | | //风速km/h->m/s |
| | | Double windSpeed = Double.valueOf(jsonMap.get("windSpeed").toString()); |
| | | windSpeed = windSpeed * 1000 / 3600; |
| | | jsonMap.put("windSpeed",df.format(windSpeed)); |
| | | jsonMap.remove("obsTime"); |
| | | jsonMap.remove("icon"); |
| | | String text = jsonMap.get("text").toString(); |