jinpengyong
2020-12-16 0d667ba939460c3dc6cdb0c974841bd0be5dc432
report_avg_datas接口更新
1 files modified
23 ■■■■■ changed files
src/main/java/com/moral/controller/ScreenController.java 23 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/controller/ScreenController.java
@@ -726,14 +726,18 @@
            parameters.put("sensors", Arrays.asList(sensorKey));
            // monitorPointService.isCompensateCalculation(parameters);
            list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
            /* 0点的数据是昨天11点到今天0点的,界面显示1-24点的,所以不需要0点的数据,但需要单独查询24点的数据
                因为改动以前24点的数据是23-24,现在24点的数据是第二天0点的数据,
             */
            /*改动范围start-------------------------------------------------------------------------*/
            list.remove(0);
            //if (list.size() == 23) {
            Iterator<Map<String, Object>> iterator = list.iterator();
            while (iterator.hasNext()) {
                Map<String, Object> next = iterator.next();
                String hour = next.get("time").toString().substring(11, 13);
                if ("00".equals(hour)) {
                    iterator.remove();
                }
            }
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
                //获取全格式时间yyyy-MM-dd HH:mm:ss
@@ -747,11 +751,14 @@
                List<Map<String, Object>> nextDayList = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters);
                if(!ObjectUtils.isEmpty(nextDayList)){
                    time1=time1.replaceAll(" 00:00:00"," 24");
                    Map<String, Object> datas = nextDayList.get(0);
                    datas.put("time",time1);
                    list.add(datas);
                for (Map<String, Object> map : nextDayList) {
                    String time = map.get("time").toString().substring(11, 13);
                    if("00".equals(time)){
                        map.put("time", time1);
                        list.add(map);
                }
            //}
                }
            }
            /*改动范围end-------------------------------------------------------------------------*/