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 8ecf8d5..112d557 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs @@ -430,6 +430,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins new Claim(ClaimAttributes.phone,user?.Phone??""), new Claim(ClaimAttributes.logtime,timeLogin), new Claim(ClaimAttributes.limits,limits??""), + new Claim(ClaimAttributes.positionId,user.PositionId.ToString()), new Claim(ClaimAttributes.IsAdmin,user.IsAdmin?"true":"false"), new Claim(ClaimAttributes.personType,user?.ChatPersonType.ToString()!) }); diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs index 7483ad7..e8c85fd 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs @@ -855,7 +855,26 @@ namespace ATS.NonCustodial.Application.Impl.Admins return (ResultOutput>)ResultOutput.Ok(rtn); } + /// + /// 新建案件时 根据当前登录用户查询下拉列表 + /// + /// + public async Task>> GetNewUserSelectList() + { + var userRoles = await this.IsAdmin(null); + // var limits = User.UnitId; + var rtn = await _userRepository.AsQueryable(false, true) + .Where(w => w.ChatPersonType != ChatPersonTypeEnum.SupervisedPerson && w.DataStatus != DataStatusEnum.Disable && !w.UserName.Contains("_aks")&& w.UnitId == User.UnitId) + .Select(w => new KeyValueDto() + { + Id = w.Id, + Text = w.UserName ?? w.Name, + Value = w.Id.ToString(), + Phone = w.Phone.ToString() + }).ToListAsync(); + return (ResultOutput>)ResultOutput.Ok(rtn); + } /// /// 获取所有的管理员 /// 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 ca3f12f..a05c2db 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs @@ -7,6 +7,7 @@ using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessAppl using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement.Input; +using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.Apps.Output; using ATS.NonCustodial.Application.Impl.Business.IM; using ATS.NonCustodial.Domain.Entities.Admins; @@ -121,9 +122,14 @@ namespace ATS.NonCustodial.Application.Impl.Business express = express.Where(w => caseIdList.Contains(w.CaseId)); var rtn = await base.GetPageAsync(input, express); //rtn.Data = rtn.Data.Where(w => caseIdList.Contains(w.CaseId)).ToList(); + + var position = await _appDictionaryService.GetDicByDicId(User.PositionId); + + //不同的申请,显示字段不一样 foreach (var item in rtn.Data) { var dic= await _appDictionaryService.GetDicByDicId(item.ApplicationTypeId); + if (dic.Code == "end_supervision") { item.ActiveTimePeriodBegin = null; @@ -133,6 +139,24 @@ namespace ATS.NonCustodial.Application.Impl.Business { item.EndSupervisionDate = null; } + var caseDto = await base.GetWithDataAsync(_appCaseManagementRepository, item.CaseId); + item.ReviewPermission = "0"; + //当前案件状态和登录人员职位相匹配时,才能修改 + var permissionGranted = (caseDto.CaseProgress, position.Code) switch + { + (CaseProgressEnum.Pending, "police") => true, + (CaseProgressEnum.InExecution, "police") => true, + (CaseProgressEnum.Examination, "inquisitor") => true, + (CaseProgressEnum.Hear, "judge") => true, + _ => false + }; + + if (permissionGranted) + { + item.ReviewPermission = "1"; + } + + } return ResultOutput.Ok(rtn); } diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs index ae0cd04..a41bd76 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs @@ -123,6 +123,7 @@ namespace ATS.NonCustodial.Application.Impl.Business //查询记录 var query = await _appEarlyWarningRepository .AsQueryable(false, true).Where(q => spIds.Contains(q.SupervisedPersonId)) + .Where(w=> caseIdList.Contains(w.CaseId)) .WhereIf(input.CaseId != default, a => a.CaseId == input.CaseId) .WhereIf(input.SupervisedPersonId != default, w => w.SupervisedPersonId == input.SupervisedPersonId) .WhereIf(input.SupervisedPersonName.HasValue(), w => w.SupervisedPersonName.Contains(input.SupervisedPersonName)) 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 fdcc533..9a0f68b 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 @@ -16,7 +16,6 @@ using ATS.NonCustodial.Domain.Shared.Enums; using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore; using ATS.NonCustodial.DynamicApi; using ATS.NonCustodial.DynamicApi.Attributes; -using ATS.NonCustodial.Shared.Common.Auth; using ATS.NonCustodial.Shared.Common.Dtos; using ATS.NonCustodial.Shared.Common.Enums; using ATS.NonCustodial.Shared.Common.UnifiedResults; @@ -30,9 +29,7 @@ using Castle.Components.DictionaryAdapter; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.ChangeTracking; using SixLabors.ImageSharp; -using System.Linq; using Yitter.IdGenerator; @@ -155,9 +152,46 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements var rtn = await base.GetPageAsync(input, express); + var position = await _appDictionaryService.GetDicByDicId(User.PositionId); foreach (var listDto in rtn.Data) { - listDto.Supervisor = selectLimits.Where(w => w.CaseId == listDto.Id).Select(w => w.SupervisorName).JoinAsString(","); + listDto.Supervisor = (await _appCaseSupervisorRepository.AsQueryable(false, true) + .Where(w => w.CaseId == listDto.Id).Select(w => w.SupervisorName).ToListAsync()).JoinAsString(","); + + if (listDto.CaseProgress == CaseProgressEnum.Pending) + { + listDto.ReviewPermission = "0";//显示编辑按钮 + } + else if (listDto.CaseProgress == CaseProgressEnum.InExecution) + { + listDto.ReviewPermission = "1";//显示编辑按钮 移送检察院按钮 + } + else if (listDto.CaseProgress == CaseProgressEnum.Examination) + { + if (position.Code == "inquisitor" || User.IsAdmin) + { + listDto.ReviewPermission = "3";//显示移送法院 结束案件 + } + else + { + listDto.ReviewPermission = "2";//显示查看按钮 + } + } + else if (listDto.CaseProgress == CaseProgressEnum.Hear) + { + if (position.Code == "judge" || User.IsAdmin) + { + listDto.ReviewPermission = "4";//显示查看 结束案件 + } + else + { + listDto.ReviewPermission = "2";//显示查看按钮 + } + } + else + { + listDto.ReviewPermission = "2";//显示查看按钮 + } } return ResultOutput.Ok(rtn); @@ -252,7 +286,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements //获取案件信息 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)); + 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 @@ -289,7 +323,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements var diclist = new List(); //获取当前用户能看到的数据Id - var caseIds = await (await base.GetCurrentUserCaseListAsync()).Where(w=>w.AppCaseManagement!=null&& caseIdList.Contains(w.AppCaseManagement.Id)).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; @@ -517,11 +551,11 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements var validSpCase = await ValidSupervisedPerson(input); if (!validSpCase.Success) return validSpCase; - if(input.Threshold>=int.MaxValue) + if (input.Threshold >= int.MaxValue) { return ResultOutput.NotOk("预警阈值输入数字过大"); } - if (input.Threshold <0) + if (input.Threshold < 0) { return ResultOutput.NotOk("预警阈值不能为负数"); } @@ -541,7 +575,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements else { var entity = Mapper.Map(input); - if(entity.Threshold==0) + if (entity.Threshold == 0) { entity.Threshold = 5; } @@ -1154,7 +1188,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements 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)) @@ -1180,7 +1214,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements /// /// public async Task CaseBusinessWorkbench() - { + { //获取当前用户权限下的案件ids var limits = User.limits; var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) @@ -1190,8 +1224,8 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements var dataDict = await _appDictionaryService.GetListNoApiAsync(null); var caseList = (await (await base.GetCurrentUserCaseListAsync()).ToListAsync()) - .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)) + .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) .Skip(0) .Take(5) @@ -1633,11 +1667,12 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements //var appSupervisedlist = from a in base._appCaseManagementRepository.AsQueryable(false, true).Where(q => q.CaseProgress != CaseProgressEnum.Closed) // join b in _appSupervisedPersonRepository.AsQueryable(false, true) on a.Id equals b.CaseId // select b; + var caseIdList = caselist.Where(w => caseIds.Contains(w.Id)).Select(s => s.Id); var appSupervisedlist = from a in base._appCaseManagementRepository.AsQueryable(false, true) join b in _appSupervisedPersonRepository.AsQueryable(false, true) on a.Id equals b.CaseId select b; var data = await appSupervisedlist - .Where(q => caseIds.Contains(q.CaseId)) + .Where(q => caseIdList.Contains(q.CaseId)) .WhereIf(input.TimeSearch?.BeginTime != null && input.TimeSearch?.EndTime != null, q => q.CreatedTime >= input.TimeSearch.BeginTime && q.CreatedTime <= $"{input.TimeSearch.EndTime.Value.ToString("yyyy-MM-dd")} 23:59:59".ToDateTime()) .WhereIf(input.name.NotNull(), q => q.SupervisedPersonName.Contains(input.name)) .OrderByDescending(r => r.CreatedTime) diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationGetDto.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationGetDto.cs index 6bbb935..4485a3b 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationGetDto.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationGetDto.cs @@ -76,5 +76,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusiness /// 审核时间 /// public DateTime? AuditTime { get; set; } + + /// + /// 结束监管日期 + /// + public DateTime? EndSupervisionDate { get; set; } } } \ No newline at end of file diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationListDto.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationListDto.cs index fa1f26d..d01d3ed 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationListDto.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationListDto.cs @@ -90,6 +90,9 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusiness /// public string? ApplicationDescription { get; set; } - + /// + /// 审核权限(1 有权限 2 无权限) + /// + public string? ReviewPermission { get; set; } } } \ No newline at end of file diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppCaseManagements/AppCaseManagement/Output/AppCaseManagementListDto.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppCaseManagements/AppCaseManagement/Output/AppCaseManagementListDto.cs index 6a4d73e..6a7b8a4 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppCaseManagements/AppCaseManagement/Output/AppCaseManagementListDto.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppCaseManagements/AppCaseManagement/Output/AppCaseManagementListDto.cs @@ -78,5 +78,11 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseMana /// 监管人名 /// public string? Supervisor { get; set; } + + /// + /// 按钮权限 + /// + public string? ReviewPermission { get; set; } + } } \ No newline at end of file diff --git a/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/CaseProgressEnum.cs b/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/CaseProgressEnum.cs index 3250714..57fa66e 100644 --- a/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/CaseProgressEnum.cs +++ b/src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/CaseProgressEnum.cs @@ -34,7 +34,7 @@ namespace ATS.NonCustodial.Domain.Shared.Enums Examination = 3, /// - /// 审查起诉阶段 + /// 审理阶段 /// [Description("审理阶段")] Hear = 4, diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs index 4b42b87..ee6a642 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs @@ -86,7 +86,10 @@ namespace ATS.NonCustodial.Shared.Common.Auth /// public const string personType = "persontype"; - + /// + /// 职位类型转换为枚举 + /// + public const string positionId = "positionId"; /// /// 查询界限 /// diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs index 16cfb2b..0994667 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs @@ -51,6 +51,11 @@ namespace ATS.NonCustodial.Shared.Common.Auth /// string NickName { get; } + /// + /// 职位(检察官、公安、法官) + /// + long PositionId { get; } + /// /// 查询界限 diff --git a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs index 05b2b91..e9702ad 100644 --- a/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs +++ b/src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs @@ -159,7 +159,7 @@ namespace ATS.NonCustodial.Shared.Common.Auth } /// - /// 昵称 + /// 查询权限 /// public string limits { @@ -175,7 +175,23 @@ namespace ATS.NonCustodial.Shared.Common.Auth return ""; } } + /// + /// 职位(检察官、公安、法官) + /// + public long PositionId + { + get + { + var positionId = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.positionId); + if (positionId != null && positionId.Value.NotNull()) + { + return (long)positionId.Value.ToLong(); + } + + return 0; + } + } /// /// 是否管理员 ///