lizijie
2020-08-07 2edb89372b20625cedf80821dc90b7f7ae8c310c
src/main/java/com/moral/service/impl/WeatherServiceImpl.java
@@ -346,10 +346,10 @@
            } else {
                String s = sdf1.format(now).split(" ")[1].split(":")[0];
                Integer hour = Integer.valueOf(s);
                if (hour > 7) {
                    hashMap.put("fxTime", (format + " 07:00").substring(5, 16));
                } else if (hour > 3 && hour < 7) {
                if (hour > 15) {
                    hashMap.put("fxTime", (format + " 15:00").substring(5, 16));
                } else if (hour > 7 && hour < 15) {
                    hashMap.put("fxTime", (format + " 07:00").substring(5, 16));
                }
            }
            Map<String, Object> jsonMap = (Map<String, Object>) JSONObject.parse(map.get("json").toString());
@@ -437,6 +437,7 @@
            beamList = historyHourlyMapper.getBeamByMacs(parameters);
        }
        List<Map<String, Object>> realList = realWeatherMapper.getRealWeather(parameters);
        List<Map<String, Object>> realWeatherList = new ArrayList<>();
        for (Map<String, Object> realMap : realList) {
@@ -451,9 +452,9 @@
        for (Map<String, Object> realMap : realWeatherList) {
            String rtime = realMap.get("time").toString();
            for (Map<String, Object> beamMap : beamList) {
                String btime = realMap.get("time").toString();
                String btime = beamMap.get("time").toString();
                if (btime.equals(rtime)) {
                    realMap.put("beam", beamMap.get("beam").toString());
                    realMap.put("beam", beamMap.get("beam").toString().split("\\.")[0]);
                }
            }
            Calendar calendar = Calendar.getInstance();
@@ -538,6 +539,22 @@
        for (Map<String, Object> map : resultList) {
            String date = map.get("time").toString().substring(0, 16);
            map.put("time", date);
            if (map.get("AQI") != null) {
                String aqi = map.get("AQI").toString().split("\\.")[0];
                map.put("AQI", aqi);
            }
            if (map.get("precip") != null) {
                String aqi = map.get("precip").toString();
                if (aqi.equals("0.0")) {
                    map.put("precip", "");
                }
            }
            if (map.get("precip6") != null) {
                String aqi = map.get("precip6").toString();
                if (aqi.equals("0.0")) {
                    map.put("precip6", "");
                }
            }
        }
        return resultList;
    }