From 7381c3f093f3b98d169f5f75b05bb8f01a9e799a Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期五, 22 十二月 2023 12:52:45 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/entity/CommandInfoLog.java |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/asrs/entity/CommandInfoLog.java b/src/main/java/com/zy/asrs/entity/CommandInfoLog.java
index 142f7da..31bdbbf 100644
--- a/src/main/java/com/zy/asrs/entity/CommandInfoLog.java
+++ b/src/main/java/com/zy/asrs/entity/CommandInfoLog.java
@@ -5,6 +5,8 @@
 import com.baomidou.mybatisplus.annotations.TableField;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+
+import com.zy.core.enums.CommandType;
 import org.springframework.format.annotation.DateTimeFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -187,5 +189,37 @@
         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.completeTime);
     }
 
+    /**
+     * 鑾峰彇鎸佺画鏃堕棿
+     */
+    public String getDurationTime() {
+        if (Cools.isEmpty(this.startTime)) {
+            return "";
+        }
+
+        Date endDate = new Date();
+        if (!Cools.isEmpty(this.completeTime)) {
+            endDate = this.completeTime;
+        }
+
+        //鐢ㄦ潵鑾峰彇涓や釜鏃堕棿鐩稿樊鐨勬绉掓暟
+        long l = this.startTime.getTime() - endDate.getTime();
+
+        //鍒嗗埆璁$畻鐩稿樊鐨勫ぉ銆佸皬鏃躲�佸垎銆佺
+        long day = l / (24 * 60 * 60 * 1000);
+        long hour = (l / (60 * 60 * 1000) - day * 24);
+        long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
+        long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+
+        return Math.abs(day) + "澶�" + Math.abs(hour) + "灏忔椂" + Math.abs(min) + "鍒�" + Math.abs(s) + "绉�";
+    }
+
+    public String getCommandType$() {
+        if (Cools.isEmpty(this.commandType)) {
+            return "";
+        }
+        return CommandType.get(this.commandType).desc;
+    }
+
 
 }

--
Gitblit v1.9.1