| | |
| | | public List getCameraIdleTimeList(String cameraId) {
|
| | | LinkedList<String> timeList = new LinkedList();
|
| | | List<Map> usedPeriods = this.getTaskUsedCameraPeriods(cameraId);
|
| | | for (Map p :
|
| | | usedPeriods) {
|
| | | timeList.add((String) p.get("start_time"));
|
| | | timeList.add((String) p.get("end_time"));
|
| | | }
|
| | | //判断第一个起始点
|
| | | if (timeList.size() > 0) {
|
| | | if ("00:00:00".equals(timeList.getFirst())) {
|
| | | timeList.removeFirst();
|
| | | } else {
|
| | | timeList.addFirst("00:00:00");
|
| | | //事件段为空,则全天作为一个时间段
|
| | | if (usedPeriods.size() == 0) {
|
| | | timeList.add("00:00:00");
|
| | | timeList.add("23:59:59");
|
| | | }else{
|
| | | for (Map p :
|
| | | usedPeriods) {
|
| | | timeList.add((String) p.get("start_time"));
|
| | | timeList.add((String) p.get("end_time"));
|
| | | }
|
| | | //判断最后一个结束时间
|
| | | if ("23:59:59".equals(timeList.getLast())) {
|
| | | timeList.removeLast();
|
| | | } else {
|
| | | timeList.addLast("23:59:59");
|
| | | }
|
| | | //事件段为空,则全天作为一个时间段
|
| | | if (timeList.size() == 0) {
|
| | | timeList.add("00:00:00");
|
| | | timeList.add("23:59:59");
|
| | | }
|
| | | //判断第一个起始点
|
| | | if (timeList.size() > 0) {
|
| | | if ("00:00:00".equals(timeList.getFirst())) {
|
| | | timeList.removeFirst();
|
| | | } else {
|
| | | timeList.addFirst("00:00:00");
|
| | | }
|
| | | //判断最后一个结束时间
|
| | | if ("23:59:59".equals(timeList.getLast())) {
|
| | | timeList.removeLast();
|
| | | } else {
|
| | | timeList.addLast("23:59:59");
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | return timeList;
|
| | | }
|
| | | }
|