| | |
| | | package com.moral.service.impl; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | |
| | | Calendar c = Calendar.getInstance(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | DecimalFormat df = new DecimalFormat("0.0"); |
| | | c.add(Calendar.DAY_OF_MONTH, 1); |
| | | String nextDay = sdf.format(c.getTime()); |
| | | c.setTime(c.getTime()); |
| | |
| | | hashMap.put("parentCode", parentCode); |
| | | hashSet.add(hashMap); |
| | | } |
| | | |
| | | Map<String, Object> bmap = new HashMap<>(); |
| | | bmap.put("name1", "北京市"); |
| | | bmap.put("parentName", "北京市"); |
| | | bmap.put("cityCode", 110000); |
| | | bmap.put("parentCode", 110000); |
| | | hashSet.add(bmap); |
| | | Map<String, Object> kunShanMap = new HashMap<>(); |
| | | kunShanMap.put("name1", "苏州市"); |
| | | kunShanMap.put("parentName", "江苏省"); |
| | | kunShanMap.put("cityCode", 320500); |
| | | hashSet.add(kunShanMap); |
| | | |
| | | List<Element> elements = Dom4jUtils.readDocument(); |
| | | String cityID = "101190404"; |
| | | for (Map<String, Object> map : hashSet) { |
| | |
| | | } |
| | | nextDayList.remove(0); |
| | | for (Map<String, Object> nextDayMap : nextDayList) { |
| | | //风速km/h->m/s |
| | | Double windSpeed = Double.valueOf(nextDayMap.get("windSpeed").toString()); |
| | | windSpeed = windSpeed * 1000 / 3600; |
| | | nextDayMap.put("windSpeed",df.format(windSpeed)); |
| | | String text = nextDayMap.get("text").toString(); |
| | | String condition = ""; |
| | | if ("晴".equals(text)) { |