|
|
|
@ -16,6 +16,8 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -79,21 +81,23 @@ public class CameraScheduleServiceImpl implements CameraScheduleService {
|
|
|
|
|
if (item.getProtocol() == 65290 || item.getProtocol() == 65298) {
|
|
|
|
|
list = this.changeSchedule(list);
|
|
|
|
|
} else {
|
|
|
|
|
int before = 0;
|
|
|
|
|
int delay = 0;
|
|
|
|
|
if (list.size() <= 48) {
|
|
|
|
|
before = 2;
|
|
|
|
|
delay = 25;
|
|
|
|
|
} else if (list.size() <= 144) {
|
|
|
|
|
before = 1;
|
|
|
|
|
delay = 8;
|
|
|
|
|
} else if (list.size() <= 288) {
|
|
|
|
|
before = 1;
|
|
|
|
|
delay = 3;
|
|
|
|
|
}
|
|
|
|
|
HashMap<Integer, List<ScheduleDetailsDto>> map = new HashMap<>();
|
|
|
|
|
for (ScheduleDetailsDto detail : list) {
|
|
|
|
|
detail.setBefore(before);
|
|
|
|
|
detail.setDelay(delay);
|
|
|
|
|
if (detail.getPreset() == null) {
|
|
|
|
|
detail.setPreset(255);
|
|
|
|
|
}
|
|
|
|
|
List<ScheduleDetailsDto> child = map.get(detail.getPreset());
|
|
|
|
|
if (child == null) {
|
|
|
|
|
child = new ArrayList<>();
|
|
|
|
|
map.put(detail.getPreset(), child);
|
|
|
|
|
}
|
|
|
|
|
child.add(detail);
|
|
|
|
|
}
|
|
|
|
|
Iterator<Integer> it = map.keySet().iterator();
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
Integer preset = it.next();
|
|
|
|
|
List<ScheduleDetailsDto> child = map.get(preset);
|
|
|
|
|
this.changeChild(child);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
item.setList(list);
|
|
|
|
@ -111,14 +115,14 @@ public class CameraScheduleServiceImpl implements CameraScheduleService {
|
|
|
|
|
int before = 0;
|
|
|
|
|
int delay = 0;
|
|
|
|
|
if (interval >= 30) {
|
|
|
|
|
before = 2;
|
|
|
|
|
delay = 25;
|
|
|
|
|
before = 0;
|
|
|
|
|
delay = 29;
|
|
|
|
|
} else if (interval >= 10) {
|
|
|
|
|
before = 1;
|
|
|
|
|
delay = 8;
|
|
|
|
|
before = 0;
|
|
|
|
|
delay = 9;
|
|
|
|
|
} else if (interval >= 5) {
|
|
|
|
|
before = 1;
|
|
|
|
|
delay = 3;
|
|
|
|
|
before = 0;
|
|
|
|
|
delay = 4;
|
|
|
|
|
}
|
|
|
|
|
int start = second.getHour() * 60 + second.getMinute();
|
|
|
|
|
int end = third.getHour() * 60 + third.getMinute();
|
|
|
|
@ -138,4 +142,24 @@ public class CameraScheduleServiceImpl implements CameraScheduleService {
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void changeChild(List<ScheduleDetailsDto> child) {
|
|
|
|
|
int before = 0;
|
|
|
|
|
int delay = 0;
|
|
|
|
|
if (child.size() <= 48) {
|
|
|
|
|
before = 0;
|
|
|
|
|
delay = 29;
|
|
|
|
|
} else if (child.size() <= 144) {
|
|
|
|
|
before = 0;
|
|
|
|
|
delay = 9;
|
|
|
|
|
} else if (child.size() <= 288) {
|
|
|
|
|
before = 0;
|
|
|
|
|
delay = 4;
|
|
|
|
|
}
|
|
|
|
|
for (ScheduleDetailsDto detail : child) {
|
|
|
|
|
detail.setBefore(before);
|
|
|
|
|
detail.setDelay(delay);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|