Merge "添加更新用户流量的方法,并定时跟新到所有用户"

Change-Id: I558ee7de6767ed1b78685883310a268ea51b198a
diff --git a/src/main/java/com/pt/entity/PeerInfoEntity.java b/src/main/java/com/pt/entity/PeerInfoEntity.java
index c19a269..56125cb 100644
--- a/src/main/java/com/pt/entity/PeerInfoEntity.java
+++ b/src/main/java/com/pt/entity/PeerInfoEntity.java
@@ -25,6 +25,24 @@
     private long downloaded;      // 已下载量
     private long left;            // 剩余下载量
 
+    private String username;  // 添加用户名字段
+
+    public PeerInfoEntity(String ipAddress, int port, String peerId) {
+        this.ip = ipAddress;
+        this.port = port;
+        this.peerId = peerId;
+        this.lastSeen = LocalDateTime.now();
+        this.status = "downloading"; // 默认状态为下载中
+        this.isActive = true; // 默认活跃状态
+        this.uploaded = 0;
+        this.downloaded = 0;
+        this.left = 0;
+    }
+
+    public PeerInfoEntity() {
+
+    }
+
     public Long getId() {
         return id;
     }
@@ -113,4 +131,12 @@
     public void setActive(boolean active) {
         isActive = active;
     }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
 }