From c8b9e590efaf5e7a10724b5f26f14de741e3c8a7 Mon Sep 17 00:00:00 2001 From: chenjialing <595168663@qq.com> Date: 星期五, 25 二月 2022 09:23:46 +0800 Subject: [PATCH] 日志优化--优化本地的日志记录方式,增加druid的sql的日志打印和监控面板,修改druid的配置方式 --- src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 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 index 20605b1..39f894c 100644 --- 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,12 +1,18 @@ 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 + * @description:璁惧褰曞儚bean * @author: swwheihei * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:06:54 */ -public class RecordItem { +public class RecordItem implements Comparable<RecordItem>{ private String deviceId; @@ -97,4 +103,21 @@ 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; + } } -- Gitblit v1.8.0