diff --git a/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs b/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs
index baa4deb1..00b9eae8 100644
--- a/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs
+++ b/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs
@@ -1,16 +1,11 @@
-using System.ComponentModel.DataAnnotations;
-using System.Data;
+using System.Data;
using Dlhis.Canteen.Order.Request;
using Dlhis.Canteen.Order.Response;
using Dlhis.Canteen.Order.Services;
-using Dlhis.Entity.Canteen.Entities;
-using Kurisu.AspNetCore;
using Kurisu.AspNetCore.DataAccess.Dto;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
-using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using SqlSugar;
namespace Dlhis.Canteen.Order.Controllers;
diff --git a/Src/Dlhis.Canteen/Setting/Controllers/WalletsController.cs b/Src/Dlhis.Canteen/Setting/Controllers/WalletsController.cs
new file mode 100644
index 00000000..2bcbf0dc
--- /dev/null
+++ b/Src/Dlhis.Canteen/Setting/Controllers/WalletsController.cs
@@ -0,0 +1,50 @@
+using Dlhis.Canteen.Order.Repository;
+using Dlhis.Canteen.Setting.Response;
+using Dlhis.Canteen.Setting.Services;
+using Kurisu.AspNetCore.Authentication.Abstractions;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Dlhis.Canteen.Setting.Controllers;
+
+///
+/// 钱包
+///
+[Authorize]
+[Route("api/[controller]")]
+[ApiController]
+public class WalletsController : ControllerBase
+{
+ private readonly IWalletService _walletService;
+ private readonly IBalanceRepository _balanceRepository;
+ private readonly ICurrentUser _currentUser;
+
+ public WalletsController(IWalletService walletService, IBalanceRepository balanceRepository, ICurrentUser currentUser)
+ {
+ _walletService = walletService;
+ _balanceRepository = balanceRepository;
+ _currentUser = currentUser;
+ }
+
+ ///
+ /// 钱包列表
+ ///
+ ///
+ [HttpGet("list")]
+ public async Task> GetListAsync()
+ {
+ return await _walletService.GetListAsync();
+ }
+
+ ///
+ /// 余额
+ ///
+ ///
+ ///
+ [HttpGet("balance")]
+ public async Task GetBalanceAsync(string factory)
+ {
+ var code = _currentUser.GetUserClaim("jinko-code");
+ return await _balanceRepository.GetBalanceAsync(code, factory);
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Canteen/Setting/Response/WalletResponse.cs b/Src/Dlhis.Canteen/Setting/Response/WalletResponse.cs
new file mode 100644
index 00000000..6e4879a3
--- /dev/null
+++ b/Src/Dlhis.Canteen/Setting/Response/WalletResponse.cs
@@ -0,0 +1,19 @@
+namespace Dlhis.Canteen.Setting.Response;
+
+public class WalletResponse
+{
+ ///
+ /// 钱包编码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 钱包名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 厂区
+ ///
+ public List Factories { get; set; }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Canteen/Setting/Services/IWalletService.cs b/Src/Dlhis.Canteen/Setting/Services/IWalletService.cs
new file mode 100644
index 00000000..614c7c1f
--- /dev/null
+++ b/Src/Dlhis.Canteen/Setting/Services/IWalletService.cs
@@ -0,0 +1,8 @@
+using Dlhis.Canteen.Setting.Response;
+
+namespace Dlhis.Canteen.Setting.Services;
+
+public interface IWalletService : IScopeDependency
+{
+ Task> GetListAsync();
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Canteen/Setting/Services/Implements/WalletService.cs b/Src/Dlhis.Canteen/Setting/Services/Implements/WalletService.cs
new file mode 100644
index 00000000..819cfabe
--- /dev/null
+++ b/Src/Dlhis.Canteen/Setting/Services/Implements/WalletService.cs
@@ -0,0 +1,30 @@
+using Dlhis.Canteen.Setting.Response;
+using Dlhis.Entity.Canteen.Entities;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
+using SqlSugar;
+
+namespace Dlhis.Canteen.Setting.Services.Implements;
+
+public class WalletService : IWalletService
+{
+ private readonly IDbContext _dbContext;
+
+ public WalletService(IDbContext dbContext)
+ {
+ _dbContext = dbContext;
+ }
+
+ ///
+ public async Task> GetListAsync()
+ {
+ return await _dbContext.Queryable()
+ .GroupBy(x => new { x.Code, x.Name })
+ .Select(x => new WalletResponse
+ {
+ Code = x.Code,
+ Name = x.Name,
+ Factories = SqlFunc.Subqueryable().Where(p => p.Code == x.Code).ToList(p => p.Factory)
+ })
+ .ToListAsync();
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Entity/Canteen/Entities/WalletEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/WalletEntity.cs
index 8f698195..f396b88a 100644
--- a/Src/Dlhis.Entity/Canteen/Entities/WalletEntity.cs
+++ b/Src/Dlhis.Entity/Canteen/Entities/WalletEntity.cs
@@ -24,6 +24,6 @@ public class WalletEntity : SugarBaseEntity
///
/// 厂区
///
- [SugarColumn(IsNullable = false, UniqueGroupNameList = new[] { "idx_wallets_facotry" })]
+ [SugarColumn(IsNullable = false, UniqueGroupNameList = new[] { "idx_wallets_factry" })]
public string Factory { get; set; }
}
\ No newline at end of file