| | |
| | | long czTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getCzTime()).getTime(); |
| | | long alarmTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getTime(); |
| | | //0-5分钟 |
| | | if (czTime-alarmTime>0 && czTime-alarmTime<AlarmTimeConstant.FIVE){ |
| | | if (czTime-alarmTime>0 && czTime-alarmTime<AlarmTimeConstant.FIVE_TIME){ |
| | | count05+=1; |
| | | } |
| | | //5-10分钟 |
| | | if (czTime-alarmTime>=AlarmTimeConstant.FIVE && czTime-alarmTime<AlarmTimeConstant.TEN){ |
| | | if (czTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && czTime-alarmTime<AlarmTimeConstant.TEN_TIME){ |
| | | count0510+=1; |
| | | } |
| | | //10-30分钟 |
| | | if (czTime-alarmTime>=AlarmTimeConstant.TEN && czTime-alarmTime<AlarmTimeConstant.THIRTY){ |
| | | if (czTime-alarmTime>=AlarmTimeConstant.TEN_TIME && czTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ |
| | | count1030+=1; |
| | | } |
| | | //30分钟以上 |
| | | if (czTime-alarmTime>=AlarmTimeConstant.THIRTY){ |
| | | if (czTime-alarmTime>=AlarmTimeConstant.THIRTY_TIME){ |
| | | count30+=1; |
| | | } |
| | | } catch (ParseException e) { |
| | |
| | | try { |
| | | long alarmTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getTime(); |
| | | //0-5分钟 |
| | | if (nowTime-alarmTime>0 && nowTime-alarmTime<AlarmTimeConstant.FIVE){ |
| | | if (nowTime-alarmTime>0 && nowTime-alarmTime<AlarmTimeConstant.FIVE_TIME){ |
| | | count05+=1; |
| | | } |
| | | //5-10分钟 |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.FIVE && nowTime-alarmTime<AlarmTimeConstant.TEN){ |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && nowTime-alarmTime<AlarmTimeConstant.TEN_TIME){ |
| | | count0510+=1; |
| | | } |
| | | //10-30分钟 |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.TEN && nowTime-alarmTime<AlarmTimeConstant.THIRTY){ |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.TEN_TIME && nowTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ |
| | | count1030+=1; |
| | | } |
| | | //30分钟以上 |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.THIRTY){ |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.THIRTY_TIME){ |
| | | count30+=1; |
| | | } |
| | | } catch (ParseException e) { |
| | |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 查询当前时间段区间时间一键求助报警个数 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Integer> selAlarmTimeDis(ConditionVo conditionVo) { |
| | | //查询当前时间段内一键求助报警的数据集合 |
| | | List<Alarm> alarmList = baseMapper.selectAlarmList(conditionVo); |
| | | if (alarmList.size()>0) { |
| | | List<Integer> list = new ArrayList<>(); |
| | | int count02 = 0; |
| | | int count0204 = 0; |
| | | int count0406 = 0; |
| | | int count0608 = 0; |
| | | int count0810 = 0; |
| | | int count1012 = 0; |
| | | int count1214 = 0; |
| | | int count1416 = 0; |
| | | int count1618 = 0; |
| | | int count1820 = 0; |
| | | int count2022 = 0; |
| | | int count2224 = 0; |
| | | //遍历集合 |
| | | for (Alarm alarm : alarmList) { |
| | | try { |
| | | int hours = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(alarm.getAlarmTime()).getHours(); |
| | | if (hours > 0 && hours < AlarmTimeConstant.TWO) { |
| | | count02 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWO && hours < AlarmTimeConstant.FOUR) { |
| | | count0204 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.FOUR && hours < AlarmTimeConstant.SIX) { |
| | | count0406 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.SIX && hours < AlarmTimeConstant.EIGHT) { |
| | | count0608 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.EIGHT && hours < AlarmTimeConstant.TEN) { |
| | | count0810 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TEN && hours < AlarmTimeConstant.TWEKVE) { |
| | | count1012 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWEKVE && hours < AlarmTimeConstant.FOURTEEN) { |
| | | count1214 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.FOURTEEN && hours < AlarmTimeConstant.SIXTEEN) { |
| | | count1416 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.SIXTEEN && hours < AlarmTimeConstant.EIGHTEEN) { |
| | | count1618 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.EIGHTEEN && hours < AlarmTimeConstant.TWENTY) { |
| | | count1820 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWENTY && hours < AlarmTimeConstant.TWENTY_TWO) { |
| | | count2022 += 1; |
| | | } |
| | | if (hours >= AlarmTimeConstant.TWENTY_TWO && hours < AlarmTimeConstant.TWENTY_FOUR) { |
| | | count2224 += 1; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | //封装数据 |
| | | list.add(count02); |
| | | list.add(count0204); |
| | | list.add(count0406); |
| | | list.add(count0608); |
| | | list.add(count0810); |
| | | list.add(count1012); |
| | | list.add(count1214); |
| | | list.add(count1416); |
| | | list.add(count1618); |
| | | list.add(count1820); |
| | | list.add(count2022); |
| | | list.add(count2224); |
| | | //返回数据 |
| | | return list; |
| | | } |
| | | return Arrays.asList(0,0,0,0,0,0,0,0,0,0,0,0); |
| | | } |
| | | } |