| | |
| | | import org.springblade.jfpt.alarm.entity.Alarm; |
| | | import org.springblade.jfpt.alarm.mapper.AlarmMapper; |
| | | import org.springblade.jfpt.alarm.service.IAlarmService; |
| | | import org.springblade.jfpt.alarm.vo.AlarmExcel; |
| | | import org.springblade.jfpt.alarm.vo.AlarmVO; |
| | | import org.springblade.jfpt.parcel.util.DateUtils; |
| | | import org.springblade.jfpt.parcel.vo.ConditionVo; |
| | |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }else { |
| | | long nowTime = new Date().getTime(); |
| | | 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_TIME){ |
| | | count05+=1; |
| | | } |
| | | //5-10分钟 |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && nowTime-alarmTime<AlarmTimeConstant.TEN_TIME){ |
| | | count0510+=1; |
| | | } |
| | | //10-30分钟 |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.TEN_TIME && nowTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ |
| | | count1030+=1; |
| | | } |
| | | //30分钟以上 |
| | | if (nowTime-alarmTime>=AlarmTimeConstant.THIRTY_TIME){ |
| | | count30+=1; |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // else { |
| | | // long nowTime = new Date().getTime(); |
| | | // 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_TIME){ |
| | | // count05+=1; |
| | | // } |
| | | // //5-10分钟 |
| | | // if (nowTime-alarmTime>=AlarmTimeConstant.FIVE_TIME && nowTime-alarmTime<AlarmTimeConstant.TEN_TIME){ |
| | | // count0510+=1; |
| | | // } |
| | | // //10-30分钟 |
| | | // if (nowTime-alarmTime>=AlarmTimeConstant.TEN_TIME && nowTime-alarmTime<AlarmTimeConstant.THIRTY_TIME){ |
| | | // count1030+=1; |
| | | // } |
| | | // //30分钟以上 |
| | | // if (nowTime-alarmTime>=AlarmTimeConstant.THIRTY_TIME){ |
| | | // count30+=1; |
| | | // } |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | } |
| | | //封装数据 |
| | | list.add(count05); |
| | |
| | | } |
| | | return Arrays.asList(0,0,0,0,0,0,0,0,0,0,0,0); |
| | | } |
| | | |
| | | /** |
| | | * 统计时间段内一键求助警情数量数据 |
| | | * @param conditionVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> selectAlarmTimeData(ConditionVo conditionVo) { |
| | | conditionVo.setStartTime(conditionVo.getStartTime().substring(0,10)); |
| | | conditionVo.setEndTime(conditionVo.getEndTime().substring(0,10)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //查询数据 |
| | | List<Integer> list = baseMapper.selectAlarmTimeData(conditionVo); |
| | | //封装数据 |
| | | map.put("alarmData",list); |
| | | //返回数据 |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryYearAlarm(String deviceNumber) { |
| | | List childList = new ArrayList(); |
| | | for (int i = 1; i <= 12; i++) { |
| | | childList.add(i); |
| | | } |
| | | |
| | | return baseMapper.queryYearAlarm(deviceNumber,childList); |
| | | } |
| | | |
| | | /** |
| | | * 导出主动报警数据表格 |
| | | * @param alarmVO 查询条件 |
| | | */ |
| | | @Override |
| | | public List<AlarmExcel> exportAlarm(AlarmVO alarmVO) { |
| | | return baseMapper.exportAlarm(alarmVO); |
| | | } |
| | | } |