From 3639d2224d423ccfd937a302af62b71a7cad925f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 18 四月 2024 17:22:25 +0800 Subject: [PATCH] 临时提交 --- src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java | 267 ++++++++++++++++++++++++++++------------------------ 1 files changed, 144 insertions(+), 123 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java old mode 100644 new mode 100755 index 1533b66..452e138 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java @@ -1,123 +1,144 @@ -package com.genersoft.iot.vmp.gb28181.bean; - - -import org.jetbrains.annotations.NotNull; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * @Description:璁惧褰曞儚bean - * @author: swwheihei - * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:06:54 - */ -public class RecordItem implements Comparable<RecordItem>{ - - private String deviceId; - - private String name; - - private String filePath; - - private String address; - - private String startTime; - - private String endTime; - - private int secrecy; - - private String type; - - private String recorderId; - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getEndTime() { - return endTime; - } - - public void setEndTime(String endTime) { - this.endTime = endTime; - } - - public int getSecrecy() { - return secrecy; - } - - public void setSecrecy(int secrecy) { - this.secrecy = secrecy; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getRecorderId() { - return recorderId; - } - - public void setRecorderId(String recorderId) { - this.recorderId = recorderId; - } - - @Override - public int compareTo(@NotNull RecordItem recordItem) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - Date startTime_now = sdf.parse(startTime); - Date startTime_param = sdf.parse(recordItem.getStartTime()); - if (startTime_param.compareTo(startTime_now) > 0) { - return -1; - }else { - return 1; - } - } catch (ParseException e) { - e.printStackTrace(); - } - return 0; - } -} +package com.genersoft.iot.vmp.gb28181.bean; + + +import com.genersoft.iot.vmp.utils.DateUtil; +import io.swagger.v3.oas.annotations.media.Schema; +import org.jetbrains.annotations.NotNull; + +import java.time.Instant; +import java.time.temporal.TemporalAccessor; + +/** + * @description:璁惧褰曞儚bean + * @author: swwheihei + * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:06:54 + */ +@Schema(description = "璁惧褰曞儚璇︽儏") +public class RecordItem implements Comparable<RecordItem>{ + + @Schema(description = "璁惧缂栧彿") + private String deviceId; + + @Schema(description = "鍚嶇О") + private String name; + + @Schema(description = "鏂囦欢璺緞鍚� (鍙��)") + private String filePath; + + @Schema(description = "褰曞儚鏂囦欢澶у皬,鍗曚綅:Byte(鍙��)") + private String fileSize; + + @Schema(description = "褰曞儚鍦板潃(鍙��)") + private String address; + + @Schema(description = "褰曞儚寮�濮嬫椂闂�(鍙��)") + private String startTime; + + @Schema(description = "褰曞儚缁撴潫鏃堕棿(鍙��)") + private String endTime; + + @Schema(description = "淇濆瘑灞炴��(蹇呴��)缂虹渷涓�0;0:涓嶆秹瀵�,1:娑夊瘑") + private int secrecy; + + @Schema(description = "褰曞儚浜х敓绫诲瀷(鍙��)time鎴朼larm 鎴� manua") + private String type; + + @Schema(description = "褰曞儚瑙﹀彂鑰匢D(鍙��)") + private String recorderId; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public int getSecrecy() { + return secrecy; + } + + public void setSecrecy(int secrecy) { + this.secrecy = secrecy; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getRecorderId() { + return recorderId; + } + + public void setRecorderId(String recorderId) { + this.recorderId = recorderId; + } + + public String getFileSize() { + return fileSize; + } + + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + + @Override + public int compareTo(@NotNull RecordItem recordItem) { + 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; + } + + } +} -- Gitblit v1.8.0