From 0b5a5b85fa34e0fd97cc077fa8a8e39dd0c3be58 Mon Sep 17 00:00:00 2001 From: zhaozhenjing Date: Fri, 10 Oct 2025 15:18:32 +0800 Subject: [PATCH] =?UTF-8?q?[MODIFY]=E6=8F=90=E6=B5=8Bbug=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=A4=9A=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Admins/App_Unitcode.cs | 6 +-- .../Impl/Admins/AuthService.cs | 2 +- .../Business/AppBusinessApplicationService.cs | 10 +++- .../Impl/Business/AppEarlyWarningService.cs | 12 ++++- .../Impl/Business/AppManagementService.cs | 12 ++++- .../AppCaseManagementService.cs | 52 ++++++++++++++++--- 6 files changed, 76 insertions(+), 18 deletions(-) diff --git a/src/1.datas/ATS.NonCustodial.Domain/Entities/Admins/App_Unitcode.cs b/src/1.datas/ATS.NonCustodial.Domain/Entities/Admins/App_Unitcode.cs index 60e9aa9..614517d 100644 --- a/src/1.datas/ATS.NonCustodial.Domain/Entities/Admins/App_Unitcode.cs +++ b/src/1.datas/ATS.NonCustodial.Domain/Entities/Admins/App_Unitcode.cs @@ -65,10 +65,6 @@ namespace ATS.NonCustodial.Domain.Entities.Admins [MaxLength(StringLengthConstants.StringLength255)] public string? UnitIsReferToAs { get; set; } - /// - /// 查询界限 - /// - [MaxLength(StringLengthConstants.StringLength2048)] - public string? limits { get; set; } + } } \ No newline at end of file diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs index 326534b..8ecf8d5 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs @@ -414,7 +414,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins if (user == null) return string.Empty; var roles = (await _userService.IsAdmin(user.Id)).Roles.Select(w => w.Id).ToList(); - string limits = _appUnitRepository.AsQueryable(false, true).Where(a => a.Id == user.UnitId).Select(a => a.limits).FirstOrDefault(); + string limits = _appUnitRepository.AsQueryable(false, true).Where(a => a.Id == user.UnitId).Select(a => a.Limits).FirstOrDefault(); TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); var timeLogin = Convert.ToInt64(ts.TotalMilliseconds).ToString(); var token = LazyGetRequiredService().Create(new[] diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs index 33bebf7..a3f441d 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs @@ -301,7 +301,15 @@ namespace ATS.NonCustodial.Application.Impl.Business [HttpGet] public async Task BusAppBusinessWorkbench() { - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var caseIds = await (await base.GetCurrentUserCaseListAsync()).Where(w => w.AppCaseManagement != null && caseIdList.Contains(w.AppCaseManagement.Id)).Select(w => w.AppCaseManagement.Id).ToListAsync(); + + var dataList = await _appBusinessApplicationRepository.AsQueryable(false, true) .Where(w => caseIds.Contains(w.CaseId)) diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs index 8230c44..7e7b965 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs @@ -389,8 +389,16 @@ namespace ATS.NonCustodial.Application.Impl.Business /// /// public async Task EarlyWarningBusinessWorkbench() - { - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); + { + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var caseIds = await (await base.GetCurrentUserCaseListAsync()).Where(w=> w.AppCaseManagement!=null&&caseIdList.Contains(w.AppCaseManagement.Id)).Select(w => w.AppCaseManagement.Id).ToListAsync(); + + var dataList = await _appEarlyWarningRepository.AsQueryable(false, true) .Where(w => caseIds.Contains(w.CaseId)) .OrderByDescending(w => w.CreatedTime) diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs index 9138bed..2124bfc 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs @@ -1196,9 +1196,17 @@ namespace ATS.NonCustodial.Application.Impl.Business /// private async Task> GetCaseListDetail(string? name) { + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var data = (await base.GetCurrentUserCaseListAsync()) - .Where(W => W.AppCaseManagement.CaseProgress != CaseProgressEnum.Closed) - .Where(W => W.AppCaseSupervisedPerson != null) + .Where(W => W.AppCaseManagement!=null&& W.AppCaseManagement.CaseProgress != CaseProgressEnum.Closed && caseIdList.Contains(W.AppCaseManagement.Id)) + .Where(W => W.AppCaseSupervisedPerson != null&& caseIdList.Contains(W.AppCaseSupervisedPerson.CaseId)) + .Where(W=>W.AppCaseSupervisor!=null && caseIdList.Contains(W.AppCaseSupervisor.CaseId)) .WhereIf(name.NotNull(), w => w.AppCaseSupervisedPerson.SupervisedPersonName!.Contains(name)) .Select(w => new { diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs index 00b8ac6..d1b42f4 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs @@ -31,6 +31,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using SixLabors.ImageSharp; +using System.Linq; using Yitter.IdGenerator; @@ -145,9 +146,11 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) .Where(w => limits.Contains(w.UnitId.ToString())) .ToListAsync(); - input.CaseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); var express = await GetExpression(input, _appCaseManagementRepository.AsQueryable(false, true)); + // 先应用案件ID过滤条件 + express = express.Where(w => caseIdList.Contains(w.Id)); var rtn = await base.GetPageAsync(input, express); @@ -239,8 +242,18 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements [HttpPost] public async Task caseStatistics() { + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + //获取案件信息 var express = await base.GetCurrentUserCaseListAsync(); + express = express.Where(w =>w.AppCaseManagement!=null && caseIdList.Contains(w.AppCaseManagement.Id)&& w.AppCaseSupervisedPerson != null && caseIdList.Contains(w.AppCaseSupervisedPerson.CaseId)&& w.AppCaseSupervisor != null && caseIdList.Contains(w.AppCaseSupervisor.CaseId)); + + //案件信息Id var caseIds = await express.Select(w => w.AppCaseManagement.Id).ToListAsync(); //监管人数 @@ -266,9 +279,16 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements [HttpPost] public async Task casetypeStatistics() { + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var diclist = new List(); //获取当前用户能看到的数据Id - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); + var caseIds = await (await base.GetCurrentUserCaseListAsync()).Where(w=>w.AppCaseManagement!=null&& caseIdList.Contains(w.AppCaseManagement.Id)).Select(w => w.AppCaseManagement.Id).ToListAsync(); //获取案件信息 var express = await _appCaseManagementRepository.AsQueryable(false, true).Where(q => caseIds.Contains(q.Id)).ToListAsync(); var otherexpress = express; @@ -947,10 +967,11 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements var caseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); var data = await _appCaseManagementRepository.AsQueryable(false, true) + .Where(w => caseIds.Contains(w.Id)) .WhereIf(input.KeyWord.NotNull(), a => a.Name.Contains(input.KeyWord)) .WhereIf(input.TimeSearch.BeginTime.Length == 2, w => w.CreatedTime > input.TimeSearch.BeginTime[0] && w.CreatedTime < input.TimeSearch.BeginTime[1].AddDays(1)) .WhereIf(input.TimeSearch.EndTime.Length == 2, w => w.CaseClosedTime > input.TimeSearch.EndTime[0] && w.CaseClosedTime < input.TimeSearch.EndTime[1].AddDays(1)) - .WhereIf(input.ajtype.NotNull(), w => w.CaseTypeId == input.ajtype.ToLong()).Where(w => caseIds.Contains(w.Id)) + .WhereIf(input.ajtype.NotNull(), w => w.CaseTypeId == input.ajtype.ToLong()) .ToListAsync(); var dataGroup = data.GroupBy(w => w.CaseTypeId); @@ -1112,7 +1133,15 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements /// public async Task ImBusinessWorkbench() { - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var caseIds = await (await base.GetCurrentUserCaseListAsync()).Where(w => w.AppCaseManagement != null && caseIdList.Contains(w.AppCaseManagement.Id)).Select(w => w.AppCaseManagement.Id).ToListAsync(); + + var imManagementList = await (from cm in _appCaseManagementRepository.AsQueryable(false, true) .Where(w => w.CaseProgress != CaseProgressEnum.Closed && caseIds.Contains(w.Id)) @@ -1138,12 +1167,19 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements /// /// public async Task CaseBusinessWorkbench() - { + { + //获取当前用户权限下的案件ids + var limits = User.limits; + var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => limits.Contains(w.UnitId.ToString())) + .ToListAsync(); + var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); + var dataDict = await _appDictionaryService.GetListNoApiAsync(null); var caseList = (await (await base.GetCurrentUserCaseListAsync()).ToListAsync()) - .Where(w => w.AppCaseManagement.CaseProgress != CaseProgressEnum.Closed) + .Where(w => w.AppCaseManagement!=null && w.AppCaseManagement.CaseProgress != CaseProgressEnum.Closed && caseIdList.Contains(w.AppCaseManagement.Id) + &&w.AppCaseSupervisedPerson!=null && caseIdList.Contains(w.AppCaseSupervisedPerson.CaseId)&&w.AppCaseSupervisor !=null && caseIdList.Contains(w.AppCaseSupervisor.CaseId)) .OrderByDescending(w => w.AppCaseSupervisedPerson?.CreatedTime) - .Where(w => w.AppCaseSupervisedPerson != null) .Skip(0) .Take(5) .Select(caseAgg => @@ -1457,6 +1493,8 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements /// public async Task> GetUserIdListByCurrentUser() { + var limits = User.limits; + var data = await (await base.GetCurrentUserCaseListAsync()).ToListAsync(); var userList = new List();