jinpengyong
2021-09-23 411fa85361e5f4d4094f25a2eaeb0f619f475fce
日数据定时任务update
2 files modified
16 ■■■■■ changed files
screen-job/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java 12 ●●●● patch | view | raw | blame | history
screen-job/src/main/resources/mapper/HistoryHourlyMapper.xml 4 ●●●● patch | view | raw | blame | history
screen-job/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java
@@ -79,18 +79,17 @@
        //存入数据库的结果集
        List<Map<String, Object>> insertData = new ArrayList<>();
        data.forEach((key, value) -> {
        data.forEach((mac, value) -> {
            Map<String, Object> dataMap = new HashMap<>();
            Map<String, Object> jsonMap = new HashMap<>();
            dataMap.put("mac", key);
            dataMap.put("mac", mac);
            dataMap.put("time", start);
            //中间变量,用于计算除臭氧外其它因子
            List<Map<String, Object>> tempValue = new ArrayList<>(value);
            //移除第一天数据(0点的),O3滑动值第一天数据是从1点-8点
            //移除第一天数据(0点的),O3滑动值第一条数据是从1点-8点
            value.removeIf(map -> ((Date) map.get("time")).getTime() == start.getTime());
            Map<String, Object> params = new HashMap<>();
            params.put("data", value);
            params.put("type", "day");
@@ -158,7 +157,6 @@
                            }
                            if (ObjectUtils.isEmpty(sensorValue)) {
                                System.out.println(456);
                                return null;
                            }
@@ -179,10 +177,6 @@
                                    return null;
                                }
                            }
                            if ("a00e12".equals(sensorCode)) {
                                System.out.println(key + "==" + sensorCode + "==" + v.get("time") + "==" + aDouble);
                            }
                            return DoubleStream.of(aDouble);
                        }).average();
                if (optionalDouble.isPresent()) {
screen-job/src/main/resources/mapper/HistoryHourlyMapper.xml
@@ -27,9 +27,9 @@
    </select>
    <select id="selectDailyData" resultType="java.util.Map">
        SELECT mac, `value`
        SELECT mac, `time`, `value`
        FROM history_hourly_${timeUnits}
        WHERE `time` <![CDATA[>=]]> #{start}
        AND `time` <![CDATA[<]]> #{end}
        AND `time` <![CDATA[<=]]> #{end}
    </select>
</mapper>