| | |
| | | import org.jetbrains.annotations.NotNull;
|
| | |
|
| | | import java.text.ParseException;
|
| | | import java.util.Date;
|
| | | import java.time.Instant;
|
| | | import java.time.temporal.TemporalAccessor;
|
| | |
|
| | | /**
|
| | | * @description:设备录像bean
|
| | |
| | |
|
| | | @Override
|
| | | public int compareTo(@NotNull RecordItem recordItem) {
|
| | | try {
|
| | | Date startTime_now = DateUtil.format.parse(startTime);
|
| | | Date startTime_param = DateUtil.format.parse(recordItem.getStartTime());
|
| | | if (startTime_param.compareTo(startTime_now) > 0) {
|
| | | TemporalAccessor startTimeNow = DateUtil.formatter.parse(startTime);
|
| | | TemporalAccessor startTimeParam = DateUtil.formatter.parse(recordItem.getStartTime());
|
| | | Instant startTimeParamInstant = Instant.from(startTimeParam);
|
| | | Instant startTimeNowInstant = Instant.from(startTimeNow);
|
| | | if (startTimeNowInstant.equals(startTimeParamInstant)) {
|
| | | return 0;
|
| | | }else if (Instant.from(startTimeParam).isAfter(Instant.from(startTimeNow)) ) {
|
| | | return -1;
|
| | | }else {
|
| | | return 1;
|
| | | }
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return 0;
|
| | |
|
| | | }
|
| | | }
|