From c084d6c98af1ef4d36a61adc719df5db76589428 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期六, 07 十月 2023 18:00:08 +0800 Subject: [PATCH] 优化国标级联心跳失败判断逻辑 --- src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java | 176 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 144 insertions(+), 32 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 7d3eec5..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,32 +1,144 @@ -package com.genersoft.iot.vmp.gb28181.bean; - -import lombok.Data; - -/** - * @Description:璁惧褰曞儚bean - * @author: swwheihei - * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:06:54 - */ - -@Data -public class 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; - -} +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