| | |
| | | List<Map<String, Object>> aqiList = hangzhouAqiMapper.getAqiDataByAreaCode(parameters);
|
| | | List<Map<String, Object>> forecastList = forecastWeatherMapper.getForecastHour(parameters);
|
| | |
|
| | | String timeUnits=time.substring(5,7);
|
| | | if(aqiList.size() == 0){
|
| | | String timeUnits = time.substring(5, 7);
|
| | | if (aqiList.size() == 0) {
|
| | | parameters.put("timeUnits", timeUnits);
|
| | | aqiList = hangzhouAqiMapper.getHistoryO3(parameters);
|
| | | if (aqiList.size() == 0) {
|
| | | parameters.put("cityCode", monitorPoint.getCityCode());
|
| | | aqiList = hangzhouAqiMapper.getAqiDataByAreaCode(parameters);
|
| | | if(aqiList.size() == 0){
|
| | | if (aqiList.size() == 0) {
|
| | | parameters.put("cityCode", monitorPoint.getAreaCode());
|
| | | aqiList = hangzhouAqiMapper.getHistoryO3(parameters);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | DecimalFormat df = new DecimalFormat(".####");
|
| | | DecimalFormat df1 = new DecimalFormat("#.#");
|
| | | List<Map<String, Object>> realAqilist = new ArrayList<>();
|
| | |
| | | for (Map<String, Object> realMap : realList) {
|
| | | Map<String, Object> hashMap = new HashMap<>();
|
| | | hashMap.put("time", realMap.get("time"));
|
| | | Map<String, Object> jsonMap = new HashMap<>();
|
| | | Map<String, Object> jsonMap;
|
| | | if (x == 0) {
|
| | | jsonMap = (Map<String, Object>) JSONObject.parse(realMap.get("json").toString());
|
| | | } else {
|
| | |
| | | realWeatherList.add(hashMap);
|
| | | }
|
| | |
|
| | | for (Map<String, Object> realMap : realWeatherList) {
|
| | | String rtime = realMap.get("time").toString();
|
| | | //光照数据
|
| | | for (Map<String, Object> beamMap : beamList) {
|
| | | if (beamMap.get("time").equals(rtime)) {
|
| | | realMap.put("beam", beamMap.get("beam").toString());
|
| | | }
|
| | | }
|
| | | //TVOC
|
| | | //Tvoc,光照合并
|
| | | for (Map<String, Object> beamMap : beamList) {
|
| | | for (Map<String, Object> tvocMap : tvocList) {
|
| | | if (tvocMap.get("time").equals(rtime)) {
|
| | | realMap.put("TVOC", tvocMap.get("TVOC").toString());
|
| | | Object bTime = beamMap.get("time");
|
| | | Object Ttime = tvocMap.get("time");
|
| | | if (bTime.equals(Ttime)) {
|
| | | beamMap.putAll(tvocMap);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> list = new ArrayList<>();
|
| | | for (int i = 0; i < 24; i++) {
|
| | | Map<String, Object> map = new HashMap<>();
|
| | | String tt = time + " " + (i + 1) + ":00:00";
|
| | | if ((i + 1) < 10) {
|
| | | tt = time + " 0" + (i + 1) + ":00:00";
|
| | | } else if (i == 23) {
|
| | | tt = sdf.format(end) + " 00:00:00";
|
| | | }
|
| | | map.put("time", tt);
|
| | | list.add(map);
|
| | | }
|
| | |
|
| | | for (Map<String, Object> map1 : list) {
|
| | | String time1 = map1.get("time").toString();
|
| | | for (Map<String, Object> map2 : beamList) {
|
| | | if (time1.equals(map2.get("time"))) {
|
| | | map1.putAll(map2);
|
| | | }
|
| | | }
|
| | |
|
| | | for (Map<String, Object> realMap : realWeatherList) {
|
| | | if (time1.equals(realMap.get("time"))) {
|
| | | map1.putAll(realMap);
|
| | | }
|
| | | }
|
| | |
|
| | | //过去6小时降水量(实测)
|
| | | Date endTime = sdf1.parse(rtime);
|
| | | Date endTime = sdf1.parse(time1);
|
| | | cal.setTime(endTime);
|
| | | cal.add(Calendar.HOUR, -6);
|
| | | Date startTime = cal.getTime();
|
| | |
| | | hashMap.put("end", endTime);
|
| | | Map<String, Object> precip6HourMap = realWeatherMapper.getPrecip6Hour(hashMap);
|
| | | if (precip6HourMap != null) {
|
| | | realMap.put("precip6", precip6HourMap.get("precip6").toString());
|
| | | map1.put("precip6", precip6HourMap.get("precip6").toString());
|
| | | }
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> list = new ArrayList<>();
|
| | | for (int i = 0; i < 24; i++) {
|
| | | list.add(null);
|
| | | }
|
| | |
|
| | | for (Map<String, Object> map : realWeatherList) {
|
| | | Integer t1 = Integer.valueOf(map.get("time").toString().split(" ")[1].split(":")[0]);
|
| | | if (t1 == 0) {
|
| | | list.set(list.size() - 1, map);
|
| | | } else {
|
| | | list.set(t1 - 1, map);
|
| | | }
|
| | | }
|
| | |
|
| | | for (Map<String, Object> map : realAqilist) {
|
| | | Integer t1 = Integer.valueOf(map.get("time").toString().split(" ")[1].split(":")[0]);
|
| | | if (t1 == 0) {
|
| | | Map<String, Object> map1 = list.get(list.size() - 1);
|
| | | if (map1 == null) {
|
| | | list.set(list.size() - 1, map);
|
| | | } else {
|
| | | map1.putAll(map);
|
| | | list.set(list.size() - 1, map1);
|
| | | }
|
| | | } else {
|
| | | Map<String, Object> map1 = list.get(t1 - 1);
|
| | | if (map1 == null) {
|
| | | list.set(t1 - 1, map);
|
| | | } else {
|
| | | map1.putAll(map);
|
| | | list.set(t1 - 1, map1);
|
| | | for (Map<String, Object> listMap : list) {
|
| | | listMap.put("type", "实测");
|
| | | listMap.put("city", name);
|
| | | String time1 = listMap.get("time").toString();
|
| | | for (Map<String, Object> aqiMap : realAqilist) {
|
| | | if(time1.equals(aqiMap.get("time"))){
|
| | | listMap.putAll(aqiMap);
|
| | | }
|
| | | }
|
| | | }
|
| | | list.removeAll(Collections.singleton(null));
|
| | | for (Map<String, Object> map : list) {
|
| | | map.put("type", "实测");
|
| | | map.put("city", name);
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> resultList = new ArrayList<>();
|
| | |
|
| | | if (foreList.size() == 0) {
|
| | | cal.setTime(selectTime);
|
| | | for (long d = cal.getTimeInMillis(); d <= end.getTime();
|
| | | for (long d = cal.getTimeInMillis(); d < end.getTime();
|
| | | cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + 1),
|
| | | d = cal.getTimeInMillis()) {
|
| | | Map<String, Object> hashMap = new LinkedHashMap<>();
|
| | |
| | | map.put("COC", map.get("CO").toString());
|
| | | map.remove("CO");
|
| | | }
|
| | | if ((!map.containsKey("PM25C")) && (map.containsKey("PM2_5")||map.containsKey("PM25"))) {
|
| | | if ((!map.containsKey("PM25C")) && (map.containsKey("PM2_5") || map.containsKey("PM25"))) {
|
| | | if (map.get("PM2_5") != null) {
|
| | | map.put("PM25C", map.get("PM2_5").toString().replace("\\.", ""));
|
| | | map.remove("PM2_5");
|
| | | }
|
| | | if(map.get("PM25") != null){
|
| | | if (map.get("PM25") != null) {
|
| | | map.put("PM25C", map.get("PM25").toString().replace("\\.", ""));
|
| | | map.remove("PM25");
|
| | | }
|