jinpengyong
2020-08-13 f0ebb071ac4828e1a5b55eccbba8d8dd9a4d80ad
根据臭氧预测算法更新接口
2 files modified
22 ■■■■ changed files
src/main/java/com/moral/service/impl/WeatherServiceImpl.java 20 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/ForecastWeatherMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/WeatherServiceImpl.java
@@ -234,8 +234,8 @@
                    hour = "24";
                }
                map.put("time", Integer.valueOf(hour));
                if (forecastMap.get("result") != null) {
                    values.add(forecastMap.get("result").toString().replace("\"", ""));
                if (forecastMap.get("O3") != null) {
                    values.add(forecastMap.get("O3").toString().replace("\"", ""));
                } else {
                    values.add("");
                }
@@ -252,8 +252,8 @@
                    hour = "24";
                }
                map.put("time", Integer.valueOf(hour));
                if (forecastMap.get("result") != null) {
                    values.add(forecastMap.get("result").toString().replace("\"", ""));
                if (forecastMap.get("O3") != null) {
                    values.add(forecastMap.get("O3").toString().replace("\"", ""));
                } else {
                    values.add("");
                }
@@ -344,7 +344,9 @@
            hashMap.put("SO2C", "");
            hashMap.put("NO2C", "");
            hashMap.put("COC", "");
            hashMap.put("O3C", "");
            if (forecastMap.get("O3C") == null) {
                hashMap.put("O3C", "");
            }
            hashMap.put("PM25C", "");
            hashMap.put("PM10C", "");
            hashMap.put("city", parameters.get("name").toString());
@@ -441,7 +443,7 @@
        List<String> macList = new ArrayList<>();
        List<String> macList1 = new ArrayList<>();
        List<Map<String, Object>> beamList = new ArrayList<>();
        List<Map<String, Object>> tvocList=new ArrayList<>();
        List<Map<String, Object>> tvocList = new ArrayList<>();
        if (deviceList.size() != 0) {
            for (Device device : deviceList) {
                macList.add(device.getMac());
@@ -451,7 +453,7 @@
            beamList = historyHourlyMapper.getBeamByMacs(parameters);
            Map<String, Object> map = new HashMap<>();
            if (name.equals("沧州市")) {
                List<Integer> list=new ArrayList<>();
                List<Integer> list = new ArrayList<>();
                list.add(48);
                List<Device> pointIds = deviceMapper.getDeviceListByMonitorPointIds(list);
                for (Device device : pointIds) {
@@ -459,8 +461,8 @@
                        macList1.add(device.getMac());
                    }
                }
            }else {
                macList1=macList;
            } else {
                macList1 = macList;
            }
            map.put("macs", macList1);
            map.put("start", parameters.get("start"));
src/main/resources/mapper/ForecastWeatherMapper.xml
@@ -7,7 +7,7 @@
    <select id="getForecastHour" resultType="java.util.Map">
        SELECT
        DATE_FORMAT(time, #{typeFormat}) time,
        (case when result is null then json->'$.temp' else result end) result
        json->'$.O3C' 'O3'
        from forecast_weather
        where time >= #{start}
        AND time <![CDATA[<]]> #{end}