56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using JiShe.CollectBus.Enums;
|
|||
|
|
using Volo.Abp.Domain.Entities;
|
|||
|
|
|
|||
|
|
namespace JiShe.CollectBus.Devices
|
|||
|
|
{
|
|||
|
|
public class Device : AggregateRoot<Guid>
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Device
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="number"></param>
|
|||
|
|
/// <param name="firstOnlineTime"></param>
|
|||
|
|
/// <param name="lastOnlineTime"></param>
|
|||
|
|
/// <param name="clientId"></param>
|
|||
|
|
/// <param name="status"></param>
|
|||
|
|
public Device(string number, string clientId, DateTime firstOnlineTime, DateTime lastOnlineTime, DeviceStatus status)
|
|||
|
|
{
|
|||
|
|
Number = number;
|
|||
|
|
FirstOnlineTime = firstOnlineTime;
|
|||
|
|
LastOnlineTime = lastOnlineTime;
|
|||
|
|
ClientId = clientId;
|
|||
|
|
Status = status;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public string Number { get; set; }
|
|||
|
|
|
|||
|
|
public DateTime FirstOnlineTime { get; set; }
|
|||
|
|
|
|||
|
|
public DateTime LastOnlineTime { get; set; }
|
|||
|
|
|
|||
|
|
public string ClientId { get; set; }
|
|||
|
|
|
|||
|
|
public DateTime? LastOfflineTime { get; set; }
|
|||
|
|
|
|||
|
|
public DeviceStatus Status { get; set; }
|
|||
|
|
|
|||
|
|
public void UpdateByLoginAndHeartbeat(string clientId)
|
|||
|
|
{
|
|||
|
|
LastOnlineTime = DateTime.Now;
|
|||
|
|
ClientId = clientId;
|
|||
|
|
Status = DeviceStatus.Online;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void UpdateByOnClosed()
|
|||
|
|
{
|
|||
|
|
LastOfflineTime = DateTime.Now;
|
|||
|
|
Status = DeviceStatus.Offline;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|