jinpengyong
2020-12-01 dc9091d686b412eab84d461d13d0611f79e65810
src/main/java/com/moral/service/impl/WeatherServiceImpl.java
@@ -133,8 +133,12 @@
                hashMap.put("end", end);
                hashMap.put("typeFormat", "%Y-%m-%d %H:%i:%s");
                int condition = Integer.parseInt(nextDayMap.get("condition").toString());
                double temp = Double.parseDouble(nextDayMap.get("temp").toString());
                int temp = Integer.parseInt(nextDayMap.get("temp").toString());
                int pressure = Integer.parseInt(nextDayMap.get("pressure").toString());
                //明日此小时风向
                String windDir = nextDayMap.get("windDir").toString();
                //风级
                String windScale = nextDayMap.get("windScale").toString();
                String time = nextDayMap.remove("time").toString();
                //当前小时
                hours.add(time.substring(11, 13));
@@ -162,8 +166,8 @@
                Collections.addAll(years, timeUnits1, timeUnits2, timeUnits3, timeUnits4);
                List<String> O3Samples = getSample(hashMap, years);
                if (O3Samples.size() > 100) {
                    hashMap.put("startTemp", temp - 1.0);
                    hashMap.put("endTemp", temp + 1.0);
                    hashMap.put("startTemp", temp - 1);
                    hashMap.put("endTemp", temp + 1);
                    O3Samples = getSample(hashMap, years);
                    if (O3Samples.size() > 100) {
                        hashMap.put("startPressure", pressure - 5);
@@ -190,23 +194,20 @@
                Double O3Avg3 = getAvg(params, times3);
                Double resultO3 = O3Avg1 * 0.7 + O3Avg2 * 0.15 + O3Avg3 * 0.15;
                nextDayMap.put("O3C", String.valueOf(Math.round(resultO3)));
                //pm2.5,pm10颗粒物预测
                //月份,pm2.5,pm10去往年同月取
                String month = time.substring(5, 7);
                //明日此小时风向
                String windDir = nextDayMap.get("windDir").toString();
                //风级
                String windScale = nextDayMap.get("windScale").toString();
                //pm2.5,pm10颗粒物预测,温度,风向风级,气压
                Map<String, Object> hashMap1 = new HashMap<>();
                hashMap1.put("cityCode", cityCode);
                hashMap1.put("start", start);
                hashMap1.put("end", end);
                hashMap1.put("typeFormat", "%Y-%m-%d %H:%i:%s");
                hashMap1.put("month", month);
                hashMap1.put("startTemp", temp - 1);
                hashMap1.put("endTemp", temp + 1);
                List<String> pmSamples = getSample(hashMap1, years);
                if (pmSamples.size() > 100) {
                    hashMap1.put("windDir", windDir);
                    hashMap1.put("windScale", windScale);
                    pmSamples = getSample(hashMap1, years);
                    if (pmSamples.size() > 100) {
                        hashMap1.put("windDir", windDir);
                    pmSamples = getSample(hashMap1, years);
                    if (pmSamples.size() > 100) {
                        hashMap1.put("startPressure", pressure - 5);
@@ -214,6 +215,7 @@
                        pmSamples = getSample(hashMap1, years);
                    }
                }
                }
                hashMap1.put("slicedTime1", slicedTime1);
                hashMap1.put("slicedTime2", slicedTime2);
                Map<String, List<String>> sectionTimesMap1 = getSectionTimes(hashMap1, pmSamples, years);