chenwei 3 luni în urmă
părinte
comite
0b16a2eb7f
22 a modificat fișierele cu 712 adăugiri și 127 ștergeri
  1. 3 3
      VMMB.Blazor.Web-master/EasyTemplate.Blazor.Web/Properties/launchSettings.json
  2. 5 4
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/CardManagement/CorporateCard.razor
  3. 101 47
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/CardManagement/CorporateCard.razor.cs
  4. 1 0
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/CardManagement/PersonalCard.razor
  5. 3 1
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/MemberManagement/CorporateCustomer.razor.cs
  6. 38 2
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/MemberManagement/IndividualCustomer.razor
  7. 54 34
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/MemberManagement/IndividualCustomer.razor.cs
  8. 2 2
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/Report/FuelTransactionReport.razor
  9. 16 12
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/Report/FuelTransactionReport.razor.cs
  10. 15 2
      VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/Report/RevenueReport.razor.cs
  11. 375 17
      VMMB.Blazor.Web-master/EasyTemplate.Service/AuthService.cs
  12. 4 0
      VMMB.Blazor.Web-master/EasyTemplate.Service/EasyTemplate.Service.csproj
  13. 5 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Dto/CardManagement/CardInfoDto.cs
  14. 1 1
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Dto/MemberManagement/Customer.cs
  15. 1 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Dto/MemberManagement/UserInfoDto.cs
  16. 1 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/SystemUser.cs
  17. 5 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/ElectronicAccount/AccountBalanceChangeEntity.cs
  18. 16 1
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/ElectronicAccount/ElectronicAccountEntity.cs
  19. 2 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/Payment/RechargeRecordEntity.cs
  20. 13 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/UserInfo/UserInfoEntity.cs
  21. 50 0
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Util/HttpRequestReader.cs
  22. 1 1
      VMMB.Blazor.Web-master/EasyTemplate.Tool/Util/Jwt.cs

+ 3 - 3
VMMB.Blazor.Web-master/EasyTemplate.Blazor.Web/Properties/launchSettings.json

@@ -7,7 +7,7 @@
         "ASPNETCORE_ENVIRONMENT": "Development"
       },
       "dotnetRunMessages": true,
-      "applicationUrl": "http://localhost:5076"
+      "applicationUrl": "http://10.153.140.8:5076"
     },
     "IIS Express": {
       "commandName": "IISExpress",
@@ -19,10 +19,10 @@
     "WSL": {
       "commandName": "WSL2",
       "launchBrowser": true,
-      "launchUrl": "http://localhost:5076",
+      "launchUrl": "http://10.153.140.8:5076",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development",
-        "ASPNETCORE_URLS": "http://localhost:5076"
+        "ASPNETCORE_URLS": "http://10.153.140.8:5076"
       },
       "distributionName": ""
     }

+ 5 - 4
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/CardManagement/CorporateCard.razor

@@ -1,4 +1,5 @@
 @page "/cardManagement/corporateCard"
+@page "/cardManagement/corporateCard/{customerId:int}"
 @attribute [ReuseTabsPage(Title = "公司卡")]
 
 <style>
@@ -795,15 +796,15 @@
                                     <label class="form-label">可用开始时间</label>
                                     <input type="datetime-local"
                                            class="form-input"
-                                           @bind="_cardAllocation.AvailableStartTime"
-                                           @bind:format="yyyy-MM-ddTHH:mm" />
+                                           value="@FormatDateTime(_cardAllocation.AvailableStartTime)"
+                                           @onchange="@(e => HandleDateTimeChange(e, "start"))" />
                                 </div>
                                 <div class="form-group half-width">
                                     <label class="form-label">可用结束时间</label>
                                     <input type="datetime-local"
                                            class="form-input"
-                                           @bind="_cardAllocation.AvailableEndTime"
-                                           @bind:format="yyyy-MM-ddTHH:mm" />
+                                           value="@FormatDateTime(_cardAllocation.AvailableEndTime)"
+                                           @onchange="@(e => HandleDateTimeChange(e, "end"))" />
                                 </div>
                             </div>
 

+ 101 - 47
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/CardManagement/CorporateCard.razor.cs

@@ -1,4 +1,5 @@
 using AntDesign;
+using EasyTemplate.Page.Pages.Order;
 using EasyTemplate.Tool;
 using EasyTemplate.Tool.Dto.CardManagement;
 using EasyTemplate.Tool.Dto.RechargeRecords;
@@ -15,9 +16,13 @@ using System.Globalization;
 using System.Linq;
 using System.Threading.Tasks;
 using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.Company;
+using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.Device;
+using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.Driver;
 using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.ElectronicAccount;
+using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.Payment;
 using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.UserInfo;
 using static EasyTemplate.Page.Pages.Report.FuelTransactionReport;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
 
 namespace EasyTemplate.Page.Pages.CardManagement
 {
@@ -106,6 +111,8 @@ namespace EasyTemplate.Page.Pages.CardManagement
         private CardAllocationModel _cardAllocation = new();
         private List<OilTypeOption> _oilTypes = new();
         private string _accountSearchKeyword = string.Empty;
+        [Parameter]
+        public int? CustomerId { get; set; }
         #endregion
 
         #region 生命周期方法
@@ -197,26 +204,39 @@ namespace EasyTemplate.Page.Pages.CardManagement
 
         private async Task<List<CardInfoDto>> GenerateMockData()
         {
-            return await _CardInforepository.AsQueryable()
+            var query = _CardInforepository.AsQueryable()
                 .LeftJoin<CompanyEntity>((a, b) => a.AccountId == b.AccountId)
                 .LeftJoin<ElectronicAccountEntity>((a, b, c) => c.Id == a.AccountId)
-                .LeftJoin<BusinessUnitInfoEntity>((a, b, c, e) => e.Id == a.IssueSiteId)
-                .Where((a, b, c, e) => a.CardType == 2 
-                && (!string.IsNullOrEmpty(CardNo) ? a.CardNo == CardNo : true)
-                && (!string.IsNullOrEmpty(CompanyName) ? b.CustomerName == CompanyName : true))
-                .Select((a, b, c, e) => new CardInfoDto
-                {
-                    AccountID = c.Id,
-                    StationName = e.Name,
-                    CompanyName = b.CustomerName,
-                    CardNo = a.CardNo,
-                    Id = a.Id,
-                    CardType = a.CardType == 1 ? "个人卡" : a.CardType == 2 ? "公司卡" : a.CardType == 3 ? "司机卡" : "未知",
-                    AccountBalance = c.Balance,
-                    IssueTime = a.IssueTime,
-                    LossTime = a.LossTime,
-                    Status = a.Status == 1 ? "正常" : a.Status == 2 ? "挂失" : a.Status == 3 ? "注销" : a.Status == 4 ? "冻结" : "未知"
-                }).ToListAsync();
+                .LeftJoin<BusinessUnitInfoEntity>((a, b, c, e) => e.Id == a.IssueSiteId);
+            query = query.Where((a, b, c, e) => a.CardType == 2);
+            if (!string.IsNullOrEmpty(CardNo))
+                query = query.Where((a, b, c, e) => a.CardNo == CardNo);
+
+            if (!string.IsNullOrEmpty(CompanyName))
+                query = query.Where((a, b, c, e) => b.CustomerName == CompanyName);
+
+            if (CustomerId != null)
+            {
+                query = query.Where((a, b, c, e) => c.Id == CustomerId);
+            }
+            var baseQuery = query.Select((a, b, c, e) => new CardInfoDto
+            {
+                AccountID = c.Id,
+                StationName = e.Name,
+                CompanyName = b.CustomerName,
+                CardNo = a.CardNo,
+                Id = a.Id,
+                CardType = a.CardType == 1 ? "个人卡" : a.CardType == 2 ? "公司卡" : a.CardType == 3 ? "司机卡" : "未知",
+                AccountBalance = c.Balance,
+                IssueTime = a.IssueTime,
+                LossTime = a.LossTime,
+                Status = a.Status == 1 ? "正常" : a.Status == 2 ? "挂失" : a.Status == 3 ? "注销" : a.Status == 4 ? "冻结" : "未知"
+            });
+            TotalCount = await baseQuery.CountAsync();
+            return await baseQuery
+                           .Skip((CurrentPage - 1) * PageSize)
+                           .Take(PageSize)
+                           .ToListAsync(); 
         }
 
         // 格式化方法
@@ -232,11 +252,6 @@ namespace EasyTemplate.Page.Pages.CardManagement
             return value.Value.ToString("N2", CultureInfo.CreateSpecificCulture("zh-CN"));
         }
 
-        protected string FormatDateTime(DateTime? value)
-        {
-            if (value == null) return "-";
-            return value.Value.ToString("yyyy-MM-dd HH:mm:ss");
-        }
         #endregion
 
         #region 卡分配相关方法
@@ -355,8 +370,8 @@ namespace EasyTemplate.Page.Pages.CardManagement
         {
             try
             {
-                // 验证数据
-                if (string.IsNullOrEmpty(_cardAllocation.CardNo))
+                // 验证数据 _selectedCard?.CardNo
+                if (string.IsNullOrEmpty(_selectedCard.CardNo))
                 {
                     await ShowAlert("错误", "卡号不能为空");
                     return;
@@ -374,31 +389,32 @@ namespace EasyTemplate.Page.Pages.CardManagement
                     return;
                 }
                 //查询是否有规则
+                var CompanyCardRule = new CompanyCardRuleEntity();
                 var account = await _CompanyCardRuleRepository.AsQueryable()
                     .Where(_ => _.UserAccountId == 1 && _.CompanyAccountId == 1).ToListAsync();
+
+                string ProductsName = string.Join(",", _oilTypes.Where(_ => _.Selected).Select(o => o.Type));
+                CompanyCardRule.SiteId = 1;
+                CompanyCardRule.CompanyAccountId = _selectedCard.AccountID;
+                CompanyCardRule.UserAccountId = _assignedAccounts.Where(_ => _.IsSelected).FirstOrDefault()?.AccountId;
+                CompanyCardRule.CardNumber = _selectedCard.CardNo;
+                CompanyCardRule.ValidStartTime = _cardAllocation.AvailableStartTime;
+                CompanyCardRule.ValidEndTime = _cardAllocation.AvailableEndTime;
+                CompanyCardRule.OilProducts = ProductsName;
+                CompanyCardRule.SingleAmountLimit = _cardAllocation.SingleConsumptionLimit;
+                CompanyCardRule.TotalAmountLimit = _cardAllocation.TotalConsumptionLimit;
+                CompanyCardRule.TotalCountLimit = _cardAllocation.TotalConsumptionCountLimit;
+                CompanyCardRule.RefuelTimesPerUse = _cardAllocation.DailyRefuelCountLimit;
+                CompanyCardRule.DailyAmountLimit = _cardAllocation.DailyConsumptionLimit;
+                CompanyCardRule.Latitude = _cardAllocation.Latitude;
+                CompanyCardRule.Longitude = _cardAllocation.Longitude;
+                CompanyCardRule.UsageDistance = _cardAllocation.AllowedDistance;
                 if (account.Count() > 0)
-                { 
-                
+                {
+                    _CompanyCardRuleRepository.UpdateAsync(CompanyCardRule);
                 }
                 else
                 {
-                    string ProductsName = string.Join(",", _oilTypes.Where(_ => _.Selected).Select(o => o.Type));
-                    var CompanyCardRule = new CompanyCardRuleEntity();
-                    CompanyCardRule.SiteId = 1;
-                    CompanyCardRule.CompanyAccountId = _selectedCard.AccountID;
-                    CompanyCardRule.UserAccountId = _assignedAccounts.Where(_ => _.IsSelected).FirstOrDefault()?.AccountId;
-                    CompanyCardRule.CardNumber = _selectedCard.CardNo;
-                    CompanyCardRule.ValidStartTime = _cardAllocation.AvailableStartTime;
-                    CompanyCardRule.ValidEndTime = _cardAllocation.AvailableEndTime;
-                    CompanyCardRule.OilProducts = ProductsName;
-                    CompanyCardRule.SingleAmountLimit = _cardAllocation.SingleConsumptionLimit;
-                    CompanyCardRule.TotalAmountLimit = _cardAllocation.TotalConsumptionLimit;
-                    CompanyCardRule.TotalCountLimit = _cardAllocation.TotalConsumptionCountLimit;
-                    CompanyCardRule.RefuelTimesPerUse = _cardAllocation.DailyRefuelCountLimit;
-                    CompanyCardRule.DailyAmountLimit = _cardAllocation.DailyConsumptionLimit;
-                    CompanyCardRule.Latitude = _cardAllocation.Latitude;
-                    CompanyCardRule.Longitude = _cardAllocation.Longitude;
-                    CompanyCardRule.UsageDistance = _cardAllocation.AllowedDistance;
                    _CompanyCardRuleRepository.AsInsertable(CompanyCardRule).ExecuteReturnIdentity();
                 }
 
@@ -480,13 +496,21 @@ namespace EasyTemplate.Page.Pages.CardManagement
                     new OilTypeOption { Type = "98#", Selected = false }
                 };
                 var OilProducts = CompanyCardRule.OilProducts.Split(',');
-                OilProducts.ForEach(_ => {
-                    var item = _oilTypes.FirstOrDefault(x => x.Type == _);
+                foreach (var product in OilProducts)
+                {
+                    var item = _oilTypes.FirstOrDefault(x => x.Type == product);
                     if (item != null)
                     {
                         item.Selected = true;
                     }
-                });
+                }
+                //OilProducts.ForEach(_ => {
+                //    var item = _oilTypes.FirstOrDefault(x => x.Type == _);
+                //    if (item != null)
+                //    {
+                //        item.Selected = true;
+                //    }
+                //});
             }
             else
             {
@@ -500,7 +524,37 @@ namespace EasyTemplate.Page.Pages.CardManagement
                 };
             }
         }
+        private string FormatDateTime(DateTime? dateTime)
+        {
+            return dateTime?.ToString("yyyy-MM-ddTHH:mm") ?? "";
+        }
 
+        private void HandleDateTimeChange(ChangeEventArgs e, string type)
+        {
+            if (e.Value is string value && !string.IsNullOrEmpty(value))
+            {
+                var dateTime = DateTime.Parse(value);
+                if (type == "start")
+                {
+                    _cardAllocation.AvailableStartTime = dateTime;
+                }
+                else
+                {
+                    _cardAllocation.AvailableEndTime = dateTime;
+                }
+            }
+            else
+            {
+                if (type == "start")
+                {
+                    _cardAllocation.AvailableStartTime = null;
+                }
+                else
+                {
+                    _cardAllocation.AvailableEndTime = null;
+                }
+            }
+        }
         // 切换选择账户弹窗中的选中状态
         private void ToggleAccountSelection(AccountInfo account)
         {

+ 1 - 0
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/CardManagement/PersonalCard.razor

@@ -1,4 +1,5 @@
 @page "/cardManagement/personalCard"
+@page "/cardManagement/personalCard/{customerId:int}"
 @attribute [ReuseTabsPage(Title = "个人卡")]
 
 <style>

+ 3 - 1
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/MemberManagement/CorporateCustomer.razor.cs

@@ -74,6 +74,7 @@ namespace EasyTemplate.Page.Pages.MemberManagement
         {
             return await _repository.AsQueryable()
                                            .Select(_ => new Customer{
+                                               Id = _.AccountId,
                                                CustomerName = _.CustomerName,
                                                CustomerCode = _.CustomerCode,
                                                SiteID = _.SiteId,
@@ -318,7 +319,8 @@ namespace EasyTemplate.Page.Pages.MemberManagement
         #region 卡管理操作
         protected void ShowCardManagement(Customer customer)
         {
-            NavigationManager.NavigateTo($"/cardManagement/corporateCard?customerId={customer.Id}");
+            var Id = customer.Id != null ? customer.Id : 0;
+            NavigationManager.NavigateTo($"/cardManagement/corporateCard/{Id}");
         }
         #endregion
 

+ 38 - 2
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/MemberManagement/IndividualCustomer.razor

@@ -8,20 +8,27 @@
     <!-- 查询区域 -->
     <div class="search-section">
         <div class="ant-row ant-row-start" style="margin-bottom: 20px;">
-            <div class="ant-col ant-col-6" style="padding-right: 8px;">
+            <div class="ant-col ant-col-3" style="padding-right: 8px;">
                 <input type="text"
                        class="ant-input"
                        placeholder="客户名称"
                        @bind="SearchCustomerName"
                        @bind:event="oninput" />
             </div>
-            <div class="ant-col ant-col-6" style="padding-right: 8px;">
+            <div class="ant-col ant-col-3" style="padding-right: 8px;">
                 <input type="text"
                        class="ant-input"
                        placeholder="客户编号"
                        @bind="SearchCustomerCode"
                        @bind:event="oninput" />
             </div>
+            <div class="ant-col ant-col-3" style="padding-right: 8px;">
+                <input type="text"
+                       class="ant-input"
+                       placeholder="客户手机号"
+                       @bind="SearchCustomerMobile"
+                       @bind:event="oninput" />
+            </div>
             <!-- 操作按钮 -->
             <div class="ant-col ant-col-12" style="text-align: right;">
                 <Button Type="@ButtonType.Primary" Icon="search" OnClick="HandleSearch">
@@ -65,6 +72,7 @@
                                     <col style="width: 15%;" />
                                     <col style="width: 10%;" />
                                     <col style="width: 10%;" />
+                                    <col style="width: 10%;" />
                                 </colgroup>
                                 <thead class="ant-table-thead">
                                     <tr>
@@ -77,6 +85,7 @@
                                         <th class="ant-table-cell">微信头像</th>
                                         <th class="ant-table-cell">最近行为</th>
                                         <th class="ant-table-cell">最后活跃时间</th>
+                                        <th class="ant-table-cell">操作</th>
                                     </tr>
                                 </thead>
                                 <tbody class="ant-table-tbody">
@@ -106,6 +115,20 @@
                                             <td class="ant-table-cell" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
                                                 @customer.LastActiveTime
                                             </td>
+                                            <td class="ant-table-cell">
+                                                <div style="display: flex; gap: 4px; flex-wrap: nowrap;">
+                                                    <button type="button" class="ant-btn ant-btn-link ant-btn-sm"
+                                                            @onclick="() => ShowCardManagement(customer)"
+                                                            title="卡管理">
+                                                        卡管理
+                                                    </button>
+                                                    <button type="button" class="ant-btn ant-btn-link ant-btn-sm"
+                                                            @onclick="() => ShowEditModal(customer)"
+                                                            title="编辑">
+                                                        编辑
+                                                    </button>
+                                                </div>
+                                            </td>
                                         </tr>
                                     }
                                 </tbody>
@@ -113,6 +136,19 @@
                         </div>
                     </div>
                 </div>
+                <!-- 分页 -->
+                @if (TotalCount > 0)
+                {
+                    <div style="margin-top: 16px; text-align: right;">
+                        <Pagination Total="@TotalCount"
+                                    PageSize="@PageSize"
+                                    Current="@CurrentPage"
+                                    OnChange="@HandlePageChange"
+                                    OnShowSizeChange="@HandlePageSizeChange"
+                                    ShowSizeChanger
+                                    ShowQuickJumper />
+                    </div>
+                }
             </div>
         }
     </div>

+ 54 - 34
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/MemberManagement/IndividualCustomer.razor.cs

@@ -9,6 +9,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text.Json;
 using System.Text.RegularExpressions;
+using System.Threading.Tasks;
 using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.ElectronicAccount;
 using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.UserInfo;
 
@@ -42,8 +43,13 @@ namespace EasyTemplate.Page.Pages.MemberManagement
         protected bool Loading { get; set; } = false;
         protected string SearchCustomerName { get; set; } = "";
         protected string SearchCustomerCode { get; set; } = "";
+        protected string SearchCustomerMobile { get; set; } = "";
 
         protected string? ErrorMessage { get; set; }
+
+        protected int TotalCount { get; set; }
+        protected int CurrentPage { get; set; } = 1;
+        protected int PageSize { get; set; } = 20;
         #endregion
 
         #region 生命周期方法
@@ -58,16 +64,14 @@ namespace EasyTemplate.Page.Pages.MemberManagement
         {
             Loading = true;
 
-            // 模拟API调用延迟
-            await Task.Delay(500);
 
             // 初始化示例数据
             if (Customers.Count == 0)
             {
-                Customers = await GetSampleCustomers();
+               // Customers = await GetSampleCustomers();
             }
 
-            ApplyFilter();
+           await ApplyFilter();
             Loading = false;
         }
 
@@ -78,6 +82,7 @@ namespace EasyTemplate.Page.Pages.MemberManagement
                  .LeftJoin<BusinessUnitInfoEntity>((a, b, c) => a.SiteId == c.Id)
                 .Select((a, b, c) => new UserInfoDto
                 {
+                    Id = b.Id,
                     AccountNo = b.AccountNo,
                     AvatarUrl = a.AvatarUrl,
                     Balance = b.Balance,
@@ -90,27 +95,63 @@ namespace EasyTemplate.Page.Pages.MemberManagement
                 }).ToListAsync();
         }
 
-        protected void ApplyFilter()
+        protected async Task ApplyFilter()
         {
-            var query = Customers.AsEnumerable();
+            var query = _UserInforepository.AsQueryable()
+                .LeftJoin<ElectronicAccountEntity>((a, b) => a.Id == b.UserId)
+                 .LeftJoin<BusinessUnitInfoEntity>((a, b, c) => a.SiteId == c.Id);
 
             if (!string.IsNullOrWhiteSpace(SearchCustomerName))
             {
-                query = query.Where(c => c.Name.Contains(SearchCustomerName, StringComparison.OrdinalIgnoreCase));
+                query = query.Where((a, b, c) => a.UserName.Contains(SearchCustomerName, StringComparison.OrdinalIgnoreCase));
             }
 
             if (!string.IsNullOrWhiteSpace(SearchCustomerCode))
             {
-                query = query.Where(c => c.AccountNo.Contains(SearchCustomerCode, StringComparison.OrdinalIgnoreCase));
+                query = query.Where((a, b, c) => b.AccountNo.Contains(SearchCustomerCode, StringComparison.OrdinalIgnoreCase));
             }
-
-            FilteredCustomers = query.ToList();
+            if (!string.IsNullOrWhiteSpace(SearchCustomerMobile))
+            {
+                query = query.Where((a, b, c) => a.Mobile.Contains(SearchCustomerMobile, StringComparison.OrdinalIgnoreCase));
+            }
+            var baseQuery = query.Select((a, b, c) => new UserInfoDto
+            {
+                Id = b.Id,
+                AccountNo = b.AccountNo,
+                AvatarUrl = a.AvatarUrl,
+                Balance = b.Balance,
+                LastActiveTime = a.LastActiveTime,
+                Mobile = a.Mobile,
+                Name = a.UserName,
+                RecentBehavior = a.RecentBehavior,
+                RegisterTime = a.RegisterTime,
+                StationName = c.Name
+            });
+          TotalCount = await baseQuery.CountAsync();
+            FilteredCustomers = await baseQuery.Skip((CurrentPage - 1) * PageSize)
+                            .Take(PageSize)
+                            .ToListAsync();
+            Customers = FilteredCustomers;
         }
 
         protected void HandleSearch()
         {
             ApplyFilter();
         }
+        // 页码变化
+        protected async Task HandlePageChange(PaginationEventArgs args)
+        {
+            CurrentPage = args.Page;
+            await LoadCustomers();
+        }
+
+        // 每页大小变化 - 使用 PaginationEventArgs
+        protected async Task HandlePageSizeChange(PaginationEventArgs args)
+        {
+            PageSize = args.PageSize;
+            CurrentPage = 1;
+            await LoadCustomers();
+        }
         #endregion
 
         #region 模态框操作
@@ -127,29 +168,8 @@ namespace EasyTemplate.Page.Pages.MemberManagement
             ErrorMessage = null;
         }
 
-        protected void ShowEditModal(Customer customer)
+        protected void ShowEditModal(UserInfoDto customer)
         {
-            // 创建副本以避免直接修改原始对象
-            CurrentCustomer = new Customer
-            {
-                Id = customer.Id,
-                CustomerName = customer.CustomerName,
-                CustomerCode = customer.CustomerCode,
-                Site = customer.Site,
-                InvoiceTitle = customer.InvoiceTitle,
-                TaxNumber = customer.TaxNumber,
-                CompanyRegisteredAddress = customer.CompanyRegisteredAddress,
-                CompanyPhone = customer.CompanyPhone,
-                ContactAddress = customer.ContactAddress,
-                CompanyEmail = customer.CompanyEmail,
-                CardBalance = customer.CardBalance,
-                Status = customer.Status,
-                RegisterTime = customer.RegisterTime
-            };
-            ModalTitle = "编辑客户";
-            ShowModal = true;
-            IsCreating = false;
-            ErrorMessage = null;
         }
 
         protected void CloseModal()
@@ -179,9 +199,9 @@ namespace EasyTemplate.Page.Pages.MemberManagement
         #endregion
 
         #region 卡管理操作
-        protected void ShowCardManagement(Customer customer)
+        protected void ShowCardManagement(UserInfoDto customer)
         {
-            NavigationManager.NavigateTo($"/cardManagement/corporateCard?customerId={customer.Id}");
+           NavigationManager.NavigateTo($"/cardManagement/personalCard?customerId={customer.Id}");
         }
         #endregion
 

+ 2 - 2
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/Report/FuelTransactionReport.razor

@@ -356,8 +356,8 @@
                     <Pagination Total="@TotalCount"
                                 PageSize="@PageSize"
                                 Current="@CurrentPage"
-                                OnPageIndexChange="@OnPageChange"
-                                OnPageSizeChange="@OnPageSizeChange"
+                                OnChange="@HandlePageChange"
+                                OnShowSizeChange="@HandlePageSizeChange"
                                 ShowSizeChanger
                                 ShowQuickJumper />
                 </div>

+ 16 - 12
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/Report/FuelTransactionReport.razor.cs

@@ -1,4 +1,5 @@
-using EasyTemplate.Page.Pages.SiteConfiguration;
+using AntDesign;
+using EasyTemplate.Page.Pages.SiteConfiguration;
 using EasyTemplate.Tool;
 using EasyTemplate.Tool.Entity.System.VehicleTerminal.CardInfo;
 using Masuit.Tools;
@@ -138,12 +139,10 @@ namespace EasyTemplate.Page.Pages.Report
 
             try
             {
-                // 模拟API调用延迟
-                await Task.Delay(300);
 
                 // 生成模拟数据
                 TransactionData = await GenerateMockData();
-                TotalCount = TransactionData.Count(); // 模拟总记录数
+                //TotalCount = TransactionData.Count(); // 模拟总记录数
             }
             finally
             {
@@ -201,7 +200,8 @@ namespace EasyTemplate.Page.Pages.Report
                     query = query.Where((a, b, c, e, f) =>
                         a.TransactionTime > StartTime && a.TransactionTime < EndTime);
 
-                return await query
+                var baseQuery = query
+                    .OrderByDescending((a, b, c, e, f) => a.TransactionTime)
                     .Select((a, b, c, e, f) => new TransactionItem
                     {
                         Id = a.Id.ToString(),
@@ -223,8 +223,12 @@ namespace EasyTemplate.Page.Pages.Report
                                        a.PaymentStatus == 2 ? "支付失败" : "",
                         OrderStatus = a.OrderStatus == 0 ? "未支付" :
                                      a.OrderStatus == 1 ? "已完成" : ""
-                    })
-                    .ToListAsync();
+                    });
+                TotalCount = await baseQuery.CountAsync();
+                return  await baseQuery
+                            .Skip((CurrentPage - 1) * PageSize) 
+                            .Take(PageSize)
+                            .ToListAsync(); ;
             }
             catch (Exception ex) 
             {
@@ -287,16 +291,16 @@ namespace EasyTemplate.Page.Pages.Report
         }
 
         // 页码变化
-        protected async Task OnPageChange(int page)
+        protected async Task HandlePageChange(PaginationEventArgs args)
         {
-            CurrentPage = page;
+            CurrentPage = args.Page;
             await LoadDataAsync();
         }
 
-        // 每页大小变化
-        protected async Task OnPageSizeChange(int pageSize)
+        // 每页大小变化 - 使用 PaginationEventArgs
+        protected async Task HandlePageSizeChange(PaginationEventArgs args)
         {
-            PageSize = pageSize;
+            PageSize = args.PageSize;
             CurrentPage = 1;
             await LoadDataAsync();
         }

+ 15 - 2
VMMB.Blazor.Web-master/EasyTemplate.Page/Pages/Report/RevenueReport.razor.cs

@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Components;
 using Org.BouncyCastle.Asn1.X509;
 using System;
+using AntDesign;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
@@ -252,7 +253,8 @@ namespace EasyTemplate.Page.Pages.Report
             var PaymentMethod = trxs.GroupBy(x => x.PaymentMethod).ToList();
             foreach (var item in PaymentMethod)
             {
-                trxs.Where(_ => _.PaymentMethod == item.Key).ToList().GroupBy(_ => _.OilProduct).ForEach(a => {
+                foreach (var a in trxs.Where(_ => _.PaymentMethod == item.Key).ToList().GroupBy(_ => _.OilProduct).ToList())
+                {
                     PaymentDetails.Add(new PaymentDetailItem
                     {
                         PaymentMethod = Paytype.Where(_ => _.Id == item.Key).FirstOrDefault()?.Name,
@@ -262,7 +264,18 @@ namespace EasyTemplate.Page.Pages.Report
                         ReceivableAmount = a.Sum(_ => _.PayableAmount),
                         ActualAmount = a.Sum(_ => _.PayableAmount)
                     });
-                });
+                }
+                //trxs.Where(_ => _.PaymentMethod == item.Key).ToList().GroupBy(_ => _.OilProduct).ForEach(a => {
+                //    PaymentDetails.Add(new PaymentDetailItem
+                //    {
+                //        PaymentMethod = Paytype.Where(_ => _.Id == item.Key).FirstOrDefault()?.Name,
+                //        Category = a.Key,
+                //        OrderCount = a.Count(),
+                //        SalesLiters = a.Sum(_ => _.OilVolume),
+                //        ReceivableAmount = a.Sum(_ => _.PayableAmount),
+                //        ActualAmount = a.Sum(_ => _.PayableAmount)
+                //    });
+                //});
 
             }
 

+ 375 - 17
VMMB.Blazor.Web-master/EasyTemplate.Service/AuthService.cs

@@ -1,11 +1,20 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
+using AntDesign;
+using DFS.Infrastructure.Extension.SM;
 using EasyTemplate.Service.Common;
-using EasyTemplate.Tool.Entity;
 using EasyTemplate.Tool;
+using EasyTemplate.Tool.Dto.CardManagement;
+using EasyTemplate.Tool.Entity;
+using EasyTemplate.Tool.Entity.System.VehicleTerminal.CardInfo;
+using EasyTemplate.Tool.Entity.System.VehicleTerminal.Company;
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System.Reflection.Emit;
+using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.Company;
+using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.ElectronicAccount;
+using ZhonTai.Admin.Contracts.Domain.VehicleTerminal.UserInfo;
 using static EasyTemplate.Tool.Entity.PublicEnum;
-using Microsoft.AspNetCore.Authorization;
 
 namespace EasyTemplate.Service;
 
@@ -17,15 +26,32 @@ public class AuthService : BaseService
     /// 注意,非blazor环境,不能使用[Inject]方式注入
     /// </summary>
     private readonly SqlSugarRepository<SystemUser> _user;
+   private SqlSugarRepository<CardInfoEntity> _CardInforepository { get; set; }
+   private SqlSugarRepository<CompanyEntity> _Companyrepository { get; set; }
+   private SqlSugarRepository<ElectronicAccountEntity> _Accountrepository { get; set; }
+   private SqlSugarRepository<UserInfoEntity> _UserInforepository { get; set; }
+   private SqlSugarRepository<UserCardRelationEntity> _UserCardRelationrepository { get; set; }
+    private SqlSugarRepository<CompanyCardRuleEntity> _CompanyCardRuleRepository { get; set; }
     /// <summary>
     /// 
     /// </summary>
     private readonly IHttpContextAccessor _contextAccessor;
 
-    public AuthService(IHttpContextAccessor contextAccessor, SqlSugarRepository<SystemUser> user)
+    public AuthService(IHttpContextAccessor contextAccessor, 
+        SqlSugarRepository<SystemUser> user, 
+        SqlSugarRepository<CardInfoEntity> CardInforepository,
+        SqlSugarRepository<CompanyEntity> Companyrepository,
+        SqlSugarRepository<ElectronicAccountEntity> Accountrepository,
+        SqlSugarRepository<UserInfoEntity> UserInforepository,
+        SqlSugarRepository<CompanyCardRuleEntity> CompanyCardRuleRepository)
     {
         _contextAccessor = contextAccessor;
         _user = user;
+        _CardInforepository = CardInforepository;
+        _Companyrepository = Companyrepository;
+        _Accountrepository = Accountrepository;
+        _UserInforepository = UserInforepository;
+        _CompanyCardRuleRepository = CompanyCardRuleRepository;
     }
 
     /// <summary>
@@ -38,19 +64,351 @@ public class AuthService : BaseService
     [HttpPost]
     public async Task<object> Login(LoginInput input)
     {
-        var user = await _user.AsQueryable()
-            .Where(x => x.Account.Equals(input.Account) && x.Password.Equals(input.Password))
-            .FirstAsync();
-        _ = user ?? throw Oops.Oh(ErrorCode.E1000);
+        try
+        {
+            var Password = Crypto.MD5Encrypt(input.Password);
+            var user = await _user.AsQueryable()
+                .Where(x => x.Account.Equals(input.Account) && x.Password.Equals(Password))
+                .FirstAsync();
+            _ = user ?? throw Oops.Oh(ErrorCode.E1000);
+
+            //生成Token令牌
+            var token = Jwt.Serialize(new TokenModelJwt
+            {
+                UserId = user.Id,
+                Name = user.Account,
+                UserType = PublicEnum.UserType.Admin,
+            });
+            string Buid = "c75b2e74-d51e-42ae-bc89-2d39312c9c30";
+            _contextAccessor.HttpContext.Response.Headers["access-token"] = token;
+            return new { token , Buid };
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+
+    /// <summary>
+    /// 获取企业密钥
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    /// <remarks><code>{"username":"admin","password":"123456"}</code></remarks>
+    [HttpPost]
+    public async Task<object> GetEnterpriseSecretKey()
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var EnterpriseSecretKey = "1234234532345234".SM4Encrypt_ECB("54CD806F28AF7FAF61A48DF82DF17C96");
+            return  EnterpriseSecretKey;
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+
+    /// <summary>
+    /// 开卡or销卡
+    /// </summary>
+    /// <param name="CardNo"></param>
+    /// <param name="AccountID"></param>
+    /// <param name="operatetype">开卡:“newcard”;销卡“cancelcard”</param>
+    /// <returns></returns>
+    [HttpPost]
+    public async Task<object> IssueCard(string CardNo, string operatetype)
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var CardInfo = await _CardInforepository.AsQueryable()
+                 .LeftJoin<ElectronicAccountEntity>((a, b) => b.Id == a.AccountId)
+                 .LeftJoin<UserInfoEntity>((a, b, c) => c.Id == b.UserId)
+                .Where((a, b, c) => a.CardNo == CardNo)
+                .Select((a, b, c) => new CardInfoDto
+                {
+                    Type = a.CardType,
+                    UserName = c.UserName
+                }).FirstAsync();
+            if (CardInfo == null)
+            {
+                return new
+                {
+                    result = false,
+                    message = "卡不存在",
+                    cardtype = 0,
+                    accountname = ""
+                }; ;
+            }
+            if (operatetype == "newcard")
+            {
+                return new
+                {
+                    result = true,
+                    message = "开卡成功",
+                    cardtype = CardInfo.CardType,
+                    accountname = CardInfo.UserName
+                }; ;
+            }
+            else if(operatetype == "cancelcard")
+            {
+                return new
+                {
+                    result = true,
+                    message = "销卡成功",
+                    cardtype = CardInfo.CardType,
+                    accountname = CardInfo.UserName
+                }; ;
+            }
+            return null;
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+
+    /// <summary>
+    /// 获取卡信息
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    /// <remarks><code>{"username":"admin","password":"123456"}</code></remarks>
+    [HttpPost]
+    public async Task<object> GetCardInfo(string CardNo)
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var CardInfo = await _CardInforepository.AsQueryable()
+                 .LeftJoin<ElectronicAccountEntity>((a, b) => b.Id == a.AccountId)
+                 .LeftJoin<UserInfoEntity>((a, b,c) => c.Id == b.UserId)
+                .Where((a, b, c) => a.CardNo == CardNo)
+                .Select((a, b, c) => new CardInfoDto
+                {
+                    Type = a.CardType,
+                    UserName = c.UserName
+                }).FirstAsync();
+            var result = new {
+                code = CardInfo != null ? 200 : 201,
+                message = "",
+                cardtype = CardInfo.Type,
+                accountname = CardInfo.UserName
+            };
+            return result;
+        }
+        catch (Exception ex)
+        {   
+            throw Oops.Oh(ex.Message);
+        }
+    }
 
-        //生成Token令牌
-        var token = Jwt.Serialize(new TokenModelJwt
+    /// <summary>
+    /// 查询是否可以发卡
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    /// <remarks><code>{"username":"admin","password":"123456"}</code></remarks>
+    [HttpPost]
+    public async Task<object> CanIssueCard(string CardNo, string PhyNo)
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var CardInfo = await _CardInforepository.AsQueryable()
+                 .LeftJoin<ElectronicAccountEntity>((a, b) => b.Id == a.AccountId)
+                 .LeftJoin<UserInfoEntity>((a, b, c) => c.Id == b.UserId)
+                .Where((a, b, c) => a.CardNo == CardNo)
+                .Select((a, b, c) => new CardInfoDto
+                {
+                    Type = a.CardType,
+                    UserName = c.UserName
+                }).FirstAsync();
+            if (CardInfo == null)
+            {
+                return new
+                {
+                    result = false,
+                    code = 201,
+                    message = "账户没有该卡",
+                    cardtype = 0,
+                    accountname = ""
+                };
+            }
+            var resultJson = new
+            {
+                result = true,
+                code = 200,
+                message = "",
+                cardtype = CardInfo.Type,
+                accountname = CardInfo.UserName
+            };
+            return resultJson;
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+    /// <summary>
+    /// 申请发卡
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    /// <remarks><code>{"username":"admin","password":"123456"}</code></remarks>
+    [HttpPost]
+    public async Task<object> ApplyForCard(string CardNo,string PhyNo)
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var CardInfo = await _CardInforepository.AsQueryable()
+                           .LeftJoin<ElectronicAccountEntity>((a, b) => b.Id == a.AccountId)
+                           .LeftJoin<UserInfoEntity>((a, b, c) => c.Id == b.UserId)
+                          .Where((a, b, c) => a.CardNo == CardNo)
+                          .Select((a, b, c) => new CardInfoDto
+                          {
+                              Type = a.CardType,
+                              UserName = c.UserName
+                          }).FirstAsync();
+            if (CardInfo == null)
+            {
+                return new
+                {
+                    result = false,
+                    code = 201,
+                    message = "卡不存在",
+                    cardtype = 0,
+                    accountname = ""
+                }; ;
+            }
+            return new
+            {
+                result = true,
+                code = 200,
+                message = "开卡成功",
+                cardtype = CardInfo.Type,
+                accountname = CardInfo.UserName
+            };
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+
+    /// <summary>
+    /// 查询是否可以销卡
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    /// <remarks><code>{"username":"admin","password":"123456"}</code></remarks>
+    [HttpPost]
+    public async Task<object> CanCancelCard(string CardNo, string PhyNo)
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var CardInfo = await _CardInforepository.AsQueryable()
+                 .LeftJoin<ElectronicAccountEntity>((a, b) => b.Id == a.AccountId)
+                 .LeftJoin<UserInfoEntity>((a, b, c) => c.Id == b.UserId)
+                .Where((a, b, c) => a.CardNo == CardNo)
+                .Select((a, b, c) => new CardInfoDto
+                {
+                    Type = a.CardType,
+                    UserName = c.UserName,
+                    AccountBalance = b.Balance
+                }).FirstAsync();
+            if (CardInfo == null)
+            {
+                return new
+                {
+                    result = false,
+                    code = 201,
+                    message = "卡不存在",
+                    cardtype = 0,
+                    accountname = ""
+                }; 
+            }
+            if (CardInfo.AccountBalance > 0)
+            {
+                return new
+                {
+                    result = false,
+                    code = 203,
+                    message = "账户余额大于0",
+                    cardtype = 0,
+                    accountname = ""
+                };
+            }
+            var result = new
+            {
+                result = true,
+                code = 200,
+                message = "",
+                cardtype = CardInfo.Type,
+                accountname = CardInfo.UserName
+            };
+            return result;
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+
+    /// <summary>
+    /// 申请销卡
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    /// <remarks><code>{"username":"admin","password":"123456"}</code></remarks>
+    [HttpPost]
+    public async Task<object> ApplyForCardCancellation(string CardNo, string PhyNo)
+    {
+        try
+        {
+            var CurrentBuId = _contextAccessor.HttpContext.Response.Headers["CurrentBuId"];
+            var CardInfo = await _CardInforepository.AsQueryable()
+                 .LeftJoin<ElectronicAccountEntity>((a, b) => b.Id == a.AccountId)
+                 .LeftJoin<UserInfoEntity>((a, b, c) => c.Id == b.UserId)
+                .Where((a, b, c) => a.CardNo == CardNo)
+                .Select((a, b, c) => new CardInfoDto
+                {
+                    Type = a.CardType,
+                    UserName = c.UserName
+                }).FirstAsync();
+            return new
+            {
+                result = true,
+                coo = "200",
+                message = "销卡成功",
+                cardtype = CardInfo.Type,
+                accountname = CardInfo.UserName
+            }; ;
+        }
+        catch (Exception ex)
+        {
+            throw Oops.Oh(ex.Message);
+        }
+    }
+    /// <summary>
+    /// 刷新Token
+    /// </summary>
+    /// <param name="token"></param>
+    /// <returns></returns>
+    [HttpGet]
+    public async Task<object> Refresh(string token)
+    {
+        try
+        {
+            return new { token };
+        }
+        catch (Exception ex)
         {
-            UserId = user.Id,
-            Name = user.Account,
-            UserType = PublicEnum.UserType.Admin
-        });
-        _contextAccessor.HttpContext.Response.Headers["access-token"] = token;
-        return token;
+            throw Oops.Oh(ex.Message);
+        }
     }
 }

+ 4 - 0
VMMB.Blazor.Web-master/EasyTemplate.Service/EasyTemplate.Service.csproj

@@ -10,6 +10,10 @@
     <FrameworkReference Include="Microsoft.AspNetCore.App" />
   </ItemGroup>
 
+  <ItemGroup>
+    <PackageReference Include="DFS.Infrastructure" Version="8.0.0" />
+  </ItemGroup>
+
   <ItemGroup>
     <ProjectReference Include="..\EasyTemplate.Tool\EasyTemplate.Tool.csproj" />
   </ItemGroup>

+ 5 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Dto/CardManagement/CardInfoDto.cs

@@ -23,6 +23,10 @@ namespace EasyTemplate.Tool.Dto.CardManagement
         /// 卡类型(如:Personal, Corporate, Driver)
         /// </summary>
         public string CardType { get; set; }
+        /// <summary>
+        /// 卡类型
+        /// </summary>
+        public byte? Type { get; set; }
 
         /// <summary>
         /// 卡号
@@ -60,5 +64,6 @@ namespace EasyTemplate.Tool.Dto.CardManagement
         /// 持卡人名称
         /// </summary>
         public string Name { get; set; }
+        public string UserName { get; set; }
     }
 }

+ 1 - 1
VMMB.Blazor.Web-master/EasyTemplate.Tool/Dto/MemberManagement/Customer.cs

@@ -6,7 +6,7 @@ namespace EasyTemplate.Tool.Dto.MemberManagement
 {
     public class Customer
     {
-        public string Id { get; set; } = Guid.NewGuid().ToString();
+        public long? Id { get; set; }
         public string CustomerName { get; set; } = string.Empty;
         public string CustomerCode { get; set; } = string.Empty;
         public string Site { get; set; } = string.Empty;

+ 1 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Dto/MemberManagement/UserInfoDto.cs

@@ -6,6 +6,7 @@ namespace EasyTemplate.Tool.Dto.MemberManagement
 {
     public class UserInfoDto
     {
+        public long? Id { get; set; }
         public string Name { get; set; }
         public string AccountNo { get; set; }
         public string StationName { get; set; }

+ 1 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/SystemUser.cs

@@ -163,4 +163,5 @@ public class LoginInput
     public string LoginType { get; set; }
 
     public bool AutoLogin { get; set; }
+    public string EquipmentID { get; set; }
 }

+ 5 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/ElectronicAccount/AccountBalanceChangeEntity.cs

@@ -52,6 +52,11 @@ namespace EasyTemplate.Tool.Entity.System.VehicleTerminal.ElectronicAccount
         /// 所属站点ID
         /// </summary>
         public long? SiteId { get; set; }
+        /// <summary>
+        /// 账户id
+        /// </summary>
+        [SugarColumn(IsNullable = true)]
+        public long? AccountId { get; set; }
 
     }
 }

+ 16 - 1
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/ElectronicAccount/ElectronicAccountEntity.cs

@@ -20,41 +20,56 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.ElectronicAccount
         /// <summary>
         /// 所属站点ID
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public long? SiteId { get; set; }
 
         /// <summary>
         /// 用户ID(关联用户表)
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public long? UserId { get; set; }
 
         /// <summary>
         /// 账户类型:1-个人账户,2-公司账户
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public byte? AccountType { get; set; }
         /// <summary>
         /// 账户编号
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string? AccountNo { get; set; }
 
         /// <summary>
         /// 账户余额
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public decimal? Balance { get; set; }
 
         /// <summary>
         /// 注册时间
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public DateTime? RegistrationTime { get; set; }
 
         /// <summary>
         /// 加密编码(用于余额防篡改)
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string IntegrityCode { get; set; }
 
         /// <summary>
         /// 开票余额
         /// </summary>
-        public long? InvoiceBalance { get; set; }
+        [SugarColumn(IsNullable = true)]
+        public decimal? InvoiceBalance { get; set; }
+        [SugarColumn(IsNullable = true)]
+        public Guid Buid { get; set; }
+        /// <summary>
+        /// 账户余额最后一条记录id
+        /// </summary>
+        [SugarColumn(IsNullable = true)]
+        public long? ChangesId { get; set; }
 
     }
 }

+ 2 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/Payment/RechargeRecordEntity.cs

@@ -106,5 +106,7 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.Payment
         /// </summary>
         [SugarColumn(IsNullable = true)]
         public int PaymentStatus { get; set; }
+        [SugarColumn(IsNullable = true)]
+        public Guid Buid { get; set; }
     }
 }

+ 13 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/UserInfo/UserInfoEntity.cs

@@ -34,21 +34,25 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.UserInfo
         /// <summary>
         /// 性别:0-未知,1-男,2-女
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public byte? Gender { get; set; }
 
         /// <summary>
         /// 出生年月
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public DateTime? BirthDate { get; set; }
 
         /// <summary>
         /// 站点ID
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public long? SiteId { get; set; }
 
         /// <summary>
         /// 车牌号
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string CarPlate { get; set; }
 
         /// <summary>
@@ -69,6 +73,7 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.UserInfo
         /// <summary>
         /// 最近行为
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string RecentBehavior { get; set; }
 
         /// <summary>
@@ -79,12 +84,20 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.UserInfo
         /// <summary>
         /// 发票抬头
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string InvoiceTitle { get; set; }
 
         /// <summary>
         /// 用户类型,如:1-个人,2-企业
         /// </summary>
         public byte? UserType { get; set; }
+        [SugarColumn(IsNullable = true)]
+        public Guid Buid { get; set; }
+        /// <summary>
+        /// 密码
+        /// </summary>
+        [SugarColumn(IsNullable = true)]
+        public string PassWord { get; set; }
 
 
     }

+ 50 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Util/HttpRequestReader.cs

@@ -0,0 +1,50 @@
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace EasyTemplate.Tool.Util
+{
+    public static class HttpRequestReader
+    {
+        private static IHttpContextAccessor? _httpContextAccessor;
+
+        // 使用依赖注入配置静态属性
+        public static void Configure(IHttpContextAccessor httpContextAccessor)
+        {
+            _httpContextAccessor = httpContextAccessor;
+        }
+        public static Guid GetCurrentBuId()
+        {
+            if (_httpContextAccessor == null || _httpContextAccessor.HttpContext == null)
+            {
+                return Guid.Empty;
+            }
+            var httpContext = _httpContextAccessor.HttpContext;
+            var headerValue = httpContext.Request.Headers["CurrentBuId"].ToString();
+            if (string.IsNullOrEmpty(headerValue))
+            {
+                headerValue = httpContext.Request.Headers["currentbuid"].ToString();
+            }
+            if (Guid.TryParse(headerValue, out Guid buId))
+            {
+                return buId;
+            }
+            return Guid.Empty;
+        }
+        /// <summary>
+        /// 小程序用户id
+        /// </summary>
+        /// <returns></returns>
+        public static string GetWachatID()
+        {
+            if (_httpContextAccessor == null || _httpContextAccessor.HttpContext == null)
+            {
+                return null;
+            }
+            var httpContext = _httpContextAccessor.HttpContext;
+            var headerValue = httpContext.Request.Headers["WachatID"].ToString();
+            return headerValue;
+        }
+    }
+}

+ 1 - 1
VMMB.Blazor.Web-master/EasyTemplate.Tool/Util/Jwt.cs

@@ -26,7 +26,7 @@ public class Jwt
         */
         var iss = "vue";
         var aud = "datacapture";
-        var secret = "zhangminbianjibushujucaiji";
+        var secret = "zhangmin-bianji-bushuju-caiji-2024-very-long-key!";
         var claims = new List<Claim>
           {
              /*