diff --git a/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs b/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs
index f75a4927..ab61d200 100644
--- a/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs
+++ b/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs
@@ -146,7 +146,16 @@ public class BalancesController : ControllerBase
return await _balanceService.GetConsumeNumberAsync();
}
-
+ ///
+ /// 获取消费机详情
+ ///
+ ///
+ ///
+ [HttpGet("consumeDevices")]
+ public async Task> GetConsumeDeviceAsync([FromQuery] GetConsumeDeviceRequest request)
+ {
+ return await _balanceService.GetConsumeDeviceAsync(request);
+ }
diff --git a/Src/Dlhis.Canteen/Order/Request/GetConsumeDeviceRequest.cs b/Src/Dlhis.Canteen/Order/Request/GetConsumeDeviceRequest.cs
new file mode 100644
index 00000000..ee74d2fb
--- /dev/null
+++ b/Src/Dlhis.Canteen/Order/Request/GetConsumeDeviceRequest.cs
@@ -0,0 +1,9 @@
+using Kurisu.Core.DataAccess.Dto;
+
+namespace Dlhis.Canteen.Order.Request
+{
+ public class GetConsumeDeviceRequest : PageDto
+ {
+ public bool IsOff { get; set; }
+ }
+}
diff --git a/Src/Dlhis.Canteen/Order/Response/DevicePageResponseResponse.cs b/Src/Dlhis.Canteen/Order/Response/DevicePageResponseResponse.cs
new file mode 100644
index 00000000..1b3724d1
--- /dev/null
+++ b/Src/Dlhis.Canteen/Order/Response/DevicePageResponseResponse.cs
@@ -0,0 +1,104 @@
+using Dlhis.Entity.Device.Enums;
+using Kurisu.AspNetCore.Utils.Extensions;
+
+namespace Dlhis.Canteen.Order.Response
+{
+ public class DevicePageResponse
+ {
+ public long Id { get; set; }
+
+ ///
+ /// 设备code
+ ///
+ public Guid Code { get; set; }
+
+ ///
+ /// 设备唯一码,IP/MAC/SNO
+ ///
+ public string UniqueNo { get; set; }
+
+ ///
+ /// 心跳间隔
+ ///
+ public int HeartbeatInterval { get; set; }
+
+ ///
+ /// 品牌
+ ///
+ public string Brand { get; set; }
+
+ ///
+ /// 供应商
+ ///
+ public string Supplier { get; set; }
+
+ ///
+ /// 设备功能 DeviceFuncEnumType
+ ///
+ public List Funcs
+ {
+ get
+ {
+ if (FuncsStr.IsEmpty()) FuncsStr = "[]";
+
+ return FuncsStr.ToObject>();
+ }
+ }
+
+ public string FuncsStr { get; set; }
+
+ ///
+ /// 设备机功能类型
+ ///
+ public DeviceTypeEnumType Type { get; set; }
+
+ public string TypeDescription => Type.GetDescription();
+
+ ///
+ /// 部署点
+ ///
+ public string DeployPlace { get; set; }
+
+ ///
+ /// 部署坐标
+ ///
+ public string DeployPosition { get; set; }
+
+ ///
+ /// 部署方向
+ ///
+ public string DeployDirection { get; set; }
+
+ ///
+ /// 模板code
+ ///
+ public Guid TemplateCode { get; set; }
+
+ ///
+ /// 连接信息
+ ///
+ public string ConnectionInfo { get; set; }
+
+
+ ///
+ /// 是否启用
+ ///
+ public bool Enable { get; set; }
+
+ ///
+ /// 是否在线
+ ///
+ public bool IsOnline { get; set; }
+
+ ///
+ /// 消费总额
+ ///
+ public decimal Amount { get; set; }
+
+ ///
+ /// 消费人次
+ ///
+ public int UserCount { get; set; }
+
+ }
+}
diff --git a/Src/Dlhis.Canteen/Order/Services/IBalanceService.cs b/Src/Dlhis.Canteen/Order/Services/IBalanceService.cs
index f90026d8..342553b4 100644
--- a/Src/Dlhis.Canteen/Order/Services/IBalanceService.cs
+++ b/Src/Dlhis.Canteen/Order/Services/IBalanceService.cs
@@ -27,7 +27,7 @@ public interface IBalanceService : IScopeDependency
Task GetConsumeNumberAsync();
-
+ Task> GetConsumeDeviceAsync(GetConsumeDeviceRequest request);
Task> GetOaEMealVoucherAsync([FromQuery] OaEMealVoucherRequest request);
diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs
index 3dc1a432..1a7c47f4 100644
--- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs
+++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs
@@ -551,7 +551,7 @@ public class BalanceService : IBalanceService
public async Task GetConsumeNumberAsync()
{
var devices = await _dbContext.Queryable()
- .Where(x => x.Type == DeviceTypeEnumType.Meal && x.Enable)
+ .Where(x => x.Type == DeviceTypeEnumType.Meal)
.ToListAsync();
var offCount = await GetOfflineDevicesCount(devices);
@@ -593,6 +593,47 @@ public class BalanceService : IBalanceService
}
+ public async Task> GetConsumeDeviceAsync(GetConsumeDeviceRequest request)
+ {
+ if (request.IsOff)
+ {
+ //消费机离线设备
+ var devices = await _dbContext.Queryable()
+ .Where(x => x.Type == DeviceTypeEnumType.Meal)
+ .ToListAsync();
+
+ var offs = await GetOfflineDevicesCount(devices);
+ var offUniqueNos = offs.Select(x => x.UniqueNo).ToList();
+
+ var offpage = await _dbContext.Queryable()
+ .LeftJoin((d, dt) => d.TemplateCode == dt.Code)
+ .Where(d => offUniqueNos.Contains(d.UniqueNo))
+ .Select((d, dt) => new DevicePageResponse
+ {
+ FuncsStr = d.Funcs.ToString(),
+ Brand = dt.Brand,
+ Type = d.Type,
+
+ }, true)
+ .ToPageListAsync(request);
+ return offpage;
+ }
+ //消费机总数
+ var page = await _dbContext.Queryable()
+ .LeftJoin((d, dt) => d.TemplateCode == dt.Code)
+ .Where(d => d.Type == DeviceTypeEnumType.Meal)
+ .Select((d, dt) => new DevicePageResponse
+ {
+ FuncsStr = d.Funcs.ToString(),
+ Brand = dt.Brand,
+ Type = d.Type,
+
+ }, true)
+ .ToPageListAsync(request);
+ return page;
+ }
+
+
///
/// 获取离线设备
///