diff --git a/Src/Dlhis.Canteen/Dlhis.Canteen.csproj b/Src/Dlhis.Canteen/Dlhis.Canteen.csproj index 8ad57920..a17298ed 100644 --- a/Src/Dlhis.Canteen/Dlhis.Canteen.csproj +++ b/Src/Dlhis.Canteen/Dlhis.Canteen.csproj @@ -18,8 +18,8 @@ - + @@ -37,6 +37,7 @@ + diff --git a/Src/Dlhis.Canteen/Dockerfile b/Src/Dlhis.Canteen/Dockerfile index 5e510329..f9585740 100644 --- a/Src/Dlhis.Canteen/Dockerfile +++ b/Src/Dlhis.Canteen/Dockerfile @@ -8,8 +8,8 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["Src/Dlhis.Canteen/Dlhis.Canteen.csproj", "Src/Dlhis.Canteen/"] COPY ["Src/Dlhis.Basic.Api/Dlhis.Basic.Api.csproj", "Src/Dlhis.Basic.Api/"] -COPY ["Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj", "Src/Dlhis.Common.Api/"] COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"] +COPY ["Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj", "Src/Dlhis.Sys.Api/"] RUN dotnet restore "Src/Dlhis.Canteen/Dlhis.Canteen.csproj" COPY . . WORKDIR "/src/Src/Dlhis.Canteen" diff --git a/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs b/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs index a94dc314..974c31ae 100644 --- a/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs +++ b/Src/Dlhis.Canteen/Order/Controllers/BalancesController.cs @@ -1,6 +1,7 @@ using Dlhis.Canteen.Order.Request; using Dlhis.Canteen.Order.Response; using Dlhis.Canteen.Order.Services; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; using Kurisu.Core.DataAccess.Dto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -28,6 +29,7 @@ public class BalancesController : ControllerBase /// /// /// + [DataPermission] [HttpGet] public async Task> GetPageAsync([FromQuery] BalanceRecordPageRequest request) { @@ -89,7 +91,7 @@ public class BalancesController : ControllerBase [HttpGet("recordByCostId")] public async Task> RecordByCostIdAsync([FromQuery] BalanceRecordPageByCostIdRequest request) { - return await _balanceService.RecordByCostIdAsync(request); + return await _balanceService.RecordByCostIdAsync(request); } /// @@ -166,9 +168,9 @@ public class BalancesController : ControllerBase /// /// [HttpPost("disposition")] - public async Task DispositionDeviceAsync([FromQuery]DispositionDeviceRequest request) + public async Task DispositionDeviceAsync([FromQuery] DispositionDeviceRequest request) { - await _balanceService.DispositionDeviceAsync(request); + await _balanceService.DispositionDeviceAsync(request); } diff --git a/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs b/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs index d8ffb6ad..dcb63bab 100644 --- a/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs +++ b/Src/Dlhis.Canteen/Order/Response/BalanceRecordResponse.cs @@ -119,4 +119,14 @@ public class BalanceRecordResponse /// 汇总金额 /// public decimal Sum { get; set; } + + /// + /// 厂区id + /// + public string TenantId { get; set; } + + /// + /// 厂区名称 + /// + public string TenantName { get; set; } } diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs index 94370d33..18342e69 100644 --- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs +++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs @@ -5,6 +5,7 @@ using Dlhis.Entity.Canteen.Entities; using Dlhis.Entity.Canteen.Enums; using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; +using Dlhis.Sys.Api; using Kurisu.AspNetCore.UnifyResultAndValidation; using Kurisu.AspNetCore.Utils.Extensions; using Kurisu.Core.DataAccess.Dto; @@ -12,7 +13,6 @@ using Kurisu.Core.DataAccess.Entity; using Kurisu.Core.User.Abstractions; using Kurisu.SqlSugar.Extensions; using Kurisu.SqlSugar.Services; -using Microsoft.AspNetCore.Mvc; using SqlSugar; namespace Dlhis.Canteen.Order.Services.Implements; @@ -22,12 +22,14 @@ public class BalanceService : IBalanceService private readonly IDbContext _dbContext; private readonly ICurrentUser _currentUser; private readonly ILogger _logger; + private readonly ITenantApi _tenantApi; - public BalanceService(IDbContext dbContext, ICurrentUser currentUser, ILogger logger) + public BalanceService(IDbContext dbContext, ICurrentUser currentUser, ILogger logger ,ITenantApi tenantApi) { _dbContext = dbContext; _currentUser = currentUser; _logger = logger; + _tenantApi = tenantApi; } public async Task> GetPageAsync(BalanceRecordPageRequest request) @@ -71,10 +73,26 @@ public class BalanceService : IBalanceService DepartmentName = department.Name, BusinessPlaceName = bplace.Name, BusinessShiftName = type.Display, - CostDateTime = record.CostDateTime + CostDateTime = record.CostDateTime, + TenantId = record.TenantId, }) .ToPageListAsync(request); + try + { + var tenantResult = await _tenantApi.GetTenantsInternalAsync(); + var tenants = tenantResult.Data; + + page.Data.ForEach(item => + { + item.TenantName = tenants.FirstOrDefault(x => x.Code == item.TenantId)?.Name; + }); + + } + catch (Exception) + { + } + return page; } /// @@ -562,7 +580,7 @@ public class BalanceService : IBalanceService var offCount = await GetOfflineDevicesCount(devices); var places = await _dbContext.Queryable() - .Where(x =>x.Status == CanteenBusinessPlaceStatusEnumType.Opened) + .Where(x => x.Status == CanteenBusinessPlaceStatusEnumType.Opened) .ToListAsync(); var time = DateTime.Now.ToString("yyyy-MM-dd"); @@ -747,7 +765,7 @@ public class BalanceService : IBalanceService var devices = await _dbContext.Queryable().ToListAsync(); - if (request.UniqueNos!=null && request.UniqueNos.Count > 0) + if (request.UniqueNos != null && request.UniqueNos.Count > 0) { foreach (var no in request.UniqueNos) { diff --git a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj index 96b47437..9efffeb1 100644 --- a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj +++ b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj @@ -20,7 +20,7 @@ - + diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/DeviceTaskAssignmentsController.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/DeviceTaskAssignmentsController.cs index 52822708..5d488ed9 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/DeviceTaskAssignmentsController.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/DeviceTaskAssignmentsController.cs @@ -1,6 +1,7 @@ using Dlhis.ScheduledTask.TaskAssignment.Request; using Dlhis.ScheduledTask.TaskAssignment.Response; using Dlhis.ScheduledTask.TaskAssignment.Services; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; using Kurisu.Core.DataAccess.Dto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -28,6 +29,7 @@ public class DeviceTaskAssignmentsController : ControllerBase /// /// [HttpGet("page")] + [DataPermission] public async Task> GetPageAsync([FromQuery] DeviceTaskAssignmentRequest request) { return await _deviceTaskAssignmentService.GetPageAsync(request); diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Response/DeviceTaskAssignmentResponse.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/DeviceTaskAssignmentResponse.cs index 7eb69334..73ad0d63 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Response/DeviceTaskAssignmentResponse.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Response/DeviceTaskAssignmentResponse.cs @@ -66,4 +66,15 @@ public class DeviceTaskAssignmentResponse /// 数据状态最新修改时间 /// public DateTime LastUpdateTime { get; set; } + + + /// + /// 厂区id + /// + public string TenantId { get; set; } + + /// + /// 厂区名称 + /// + public string TenantName { get; set; } } diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs index f2cff78a..8e7b2cb9 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs @@ -3,6 +3,7 @@ using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; using Dlhis.ScheduledTask.TaskAssignment.Request; using Dlhis.ScheduledTask.TaskAssignment.Response; +using Dlhis.Sys.Api; using Kurisu.AspNetCore.Utils.Extensions; using Kurisu.Core.DataAccess.Dto; using Kurisu.SqlSugar.Extensions; @@ -14,10 +15,12 @@ namespace Dlhis.ScheduledTask.TaskAssignment.Services.Implements; public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService { private readonly IDbContext _dbContext; + private readonly ITenantApi _tenantApi; - public DeviceTaskAssignmentService(IDbContext dbContext) + public DeviceTaskAssignmentService(IDbContext dbContext, ITenantApi tenantApi) { _dbContext = dbContext; + _tenantApi = tenantApi; } public async Task> GetPageAsync(DeviceTaskAssignmentRequest request) @@ -27,6 +30,7 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService .WhereIF(!request.Search.IsEmpty(), (deviceTask, ga) => deviceTask.UserNo == request.Search || ga.Name.Contains(request.Search)) .WhereIF(request.Type.HasValue, deviceTask => deviceTask.Type == request.Type) .WhereIF(request.Status.HasValue, deviceTask => deviceTask.Status == request.Status) + .Where(deviceTask => 1 == 1) .OrderBy(deviceTask => deviceTask.CreateTime, OrderByType.Desc) .Select((deviceTask, ga) => new DeviceTaskAssignmentResponse { @@ -40,10 +44,27 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService UserCode = ga.Code, Type = deviceTask.Type, CreateTime = deviceTask.CreateTime, - LastUpdateTime = deviceTask.ModifiedTime + LastUpdateTime = deviceTask.ModifiedTime, + TenantId = deviceTask.TenantId, }) .ToPageListAsync(request); + + try + { + var tenantResult = await _tenantApi.GetTenantsInternalAsync(); + var tenants = tenantResult.Data; + + page.Data.ForEach(item => + { + item.TenantName = tenants.FirstOrDefault(x => x.Code == item.TenantId)?.Name; + }); + + } + catch (Exception) + { + } + return page; }