| | |
| | | Date startDate = DateUtils.getAPeriodOfTime(endDate, -6, Calendar.DATE); |
| | | Integer start = Integer.parseInt(DateUtils.getYyyyMmDdHh(startDate)); |
| | | |
| | | |
| | | |
| | | |
| | | Map<String, List<Map<String, Object>>> result = new HashMap<>(); |
| | | List<Map<String, Object>> warnList = qxshMapper.count7DayForWarn(start, end); |
| | | result.put("warningDayCount", warnList); |
| | | |
| | | Map<String, Object> param = new HashMap<String, Object>(); |
| | | Date now = new Date(); |
| | | Date last = DateUtils.getAPeriodOfTime(now, -7, Calendar.DATE); // 上周的今天 |
| | | param.put("startTime", DateUtils.getYyyyMmDdHhMmSs(last)); |
| | | param.put("endTime", DateUtils.getYyyyMmDdHhMmSs(now)); |
| | | |
| | | param.put("type", 0); |
| | | List<Map<String, Object>> alarmDayCount = warningDetailMapper.selectWarningDayCountByMap(param); |
| | | result.put("alarmDayCount", alarmDayCount); |
| | | |
| | | param.put("type", 1); |
| | | List<Map<String, Object>> warningDayCount = warningDetailMapper.selectWarningDayCountByMap(param); |
| | | result.put("warningDayCount", warningDayCount); |
| | | List<Map<String, Object>> alarmList = qxshMapper.count7DayForAlarm(start, end); |
| | | result.put("alarmDayCount", alarmList); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public Map<String, List<Double>> selectEachLocationDataChange() { |
| | | /*Map<String, List<Double>> result = new LinkedHashMap<>(); |
| | | List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d(); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate)); |
| | | Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY))); |
| | | List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); |
| | | checkPoints.forEach(c -> { |
| | | List<String> tableNames = new ArrayList<>(); |
| | | recordList.forEach(r -> { |
| | | tableNames.add(r.getTableName()); |
| | | }); |
| | | List<Double> values = new ArrayList<>(); |
| | | if (StringUtils.isNotNull(tableNames)) { |
| | | List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId()); |
| | | data.forEach(v -> { |
| | | values.add(v.getValue()); |
| | | }); |
| | | result.put(c.getName(), values); |
| | | } |
| | | }); |
| | | return result;*/ |
| | | |
| | | Map<String, List<Double>> result = new LinkedHashMap<>(); |
| | | List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d(); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate)); |
| | | Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY))); |
| | | List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); |
| | | |
| | | List<String> tableNames = new ArrayList<>(); |
| | | for (DictRecord dr : recordList) { |
| | | if (suYuanMapper.isTableExists(dr.getTableName()) > 0) { |
| | | tableNames.add(dr.getTableName()); |
| | | } |
| | | } |
| | | if (tableNames.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | for (MonitorPointPosition c : checkPoints) { |
| | | List<Double> values = new ArrayList<>(); |
| | | List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId()); |
| | | if (null != data && data.size() > 0) { |
| | | for (SuYuanMonitorData v : data) { |
| | | values.add(v.getValue()); |
| | | } |
| | | } |
| | | result.put(c.getName(), values); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | public List<Map<String, Object>> selectThisMonthLocationValueDataTop10() { |
| | | /*List<Map<String, Object>> result = new ArrayList<>(); |
| | | List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d(); |
| | | Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart())); |
| | | Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd())); |
| | | List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); |
| | | checkPoints.forEach(c -> { |
| | | List<String> tableNames = new ArrayList<>(); |
| | | recordList.forEach(r -> { |
| | | tableNames.add(r.getTableName()); |
| | | }); |
| | | Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId()); |
| | | if (StringUtils.isNotNull(map) && StringUtils.isNotEmpty(map)) { |
| | | String suYuanId = map.get("id").toString(); |
| | | map.put("name", commonService.select3dCheckPointById(suYuanId).getName()); |
| | | map.remove("id"); |
| | | } |
| | | result.add(map); |
| | | }); |
| | | return CalculateUtils.sort(result, "value", true).subList(0, 10);*/ |
| | | |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d(); |
| | | Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthStart())); |
| | | Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd())); |
| | | //startTime = 2023040100L; |
| | | //endTime = 2023043023L; |
| | | |
| | | List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); |
| | | |
| | | List<String> tableNames = new ArrayList<>(); |
| | | for (DictRecord dr : recordList) { |
| | | if (suYuanMapper.isTableExists(dr.getTableName()) > 0) { |
| | | tableNames.add(dr.getTableName()); |
| | | } |
| | | } |
| | | if (tableNames.isEmpty()) { |
| | | return result; |
| | | } |
| | | |
| | | /*List<String> idList = new ArrayList<>(); |
| | | for (MonitorPointPosition c : checkPoints) { |
| | | idList.add("'" + c.getId() + "'"); |
| | | } |
| | | String ids = String.join(",", idList);*/ |
| | | |
| | | for (MonitorPointPosition c : checkPoints) { |
| | | Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId()); |
| | | if (null != map && map.size() > 0) { |
| | | //String suYuanId = map.get("id").toString(); |
| | | //map.put("name", commonService.select3dCheckPointById(suYuanId).getName()); |
| | | //map.remove("id"); |
| | | map.put("name", c.getName()); |
| | | result.add(map); |
| | | } |
| | | } |
| | | |
| | | return CalculateUtils.sort(result, "value", true).subList(0, 10); |
| | | } |
| | | |
| | | /** |