|
|
|
|
@ -31,6 +31,7 @@ using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
using SixLabors.ImageSharp; |
|
|
|
|
using System.Linq; |
|
|
|
|
using Yitter.IdGenerator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1477,19 +1478,30 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
|
|
|
|
|
/// </remarks> |
|
|
|
|
public async Task<IResultOutput> GetSupervisedPersonList() |
|
|
|
|
{ |
|
|
|
|
var userRole = await _userService.IsAdmin(null); |
|
|
|
|
var supervisorCaseList = await _appCaseSupervisorRepository.AsQueryable(false, true) |
|
|
|
|
.Where(w => w.SupervisorId == User.Id).Select(s => s.CaseId).ToListAsync(); |
|
|
|
|
var position = await _appDictionaryService.GetDicByDicId(User.PositionId); |
|
|
|
|
|
|
|
|
|
var rtn = await (from c in _appCaseManagementRepository.AsQueryable(false, true) |
|
|
|
|
join spr in _appSupervisedPersonRepository.AsQueryable(false, true) on c.Id equals spr.CaseId |
|
|
|
|
//join device in _appDeviceManagementRepository.AsQueryable(false, true) on spr.SupervisedPersonId equals device.SupervisedPersonId into td |
|
|
|
|
//from d in td.DefaultIfEmpty() |
|
|
|
|
//where c.CaseProgress != CaseProgressEnum.Closed && spr.IdCard != null && d == null |
|
|
|
|
where c.CaseProgress != CaseProgressEnum.Closed && spr.IdCard != null |
|
|
|
|
|
|
|
|
|
select new SupervisedPersonDto() |
|
|
|
|
{ |
|
|
|
|
SupervisedPersonId = spr.SupervisedPersonId, |
|
|
|
|
SupervisedPersonName = spr.SupervisedPersonName, |
|
|
|
|
CaseId = c.Id, |
|
|
|
|
IdCard = spr.IdCard |
|
|
|
|
}).ToListAsync(); |
|
|
|
|
IdCard = spr.IdCard, |
|
|
|
|
CaseProgress = c.CaseProgress |
|
|
|
|
}) |
|
|
|
|
.WhereIf(!userRole.IsAdmin,w=> supervisorCaseList.Contains(w.CaseId)) |
|
|
|
|
.WhereIf(position.Code== "police", w=>w.CaseProgress== CaseProgressEnum.Pending|| w.CaseProgress == CaseProgressEnum.InExecution) |
|
|
|
|
.WhereIf(position.Code == "inquisitor", w => w.CaseProgress == CaseProgressEnum.Examination) |
|
|
|
|
.WhereIf(position.Code == "judge", w => w.CaseProgress== CaseProgressEnum.Hear).ToListAsync(); |
|
|
|
|
|
|
|
|
|
//去重 |
|
|
|
|
rtn = rtn.Distinct((x, y) => x.SupervisedPersonId == y.SupervisedPersonId).ToList(); |
|
|
|
|
@ -1591,6 +1603,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
|
|
|
|
|
var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); |
|
|
|
|
|
|
|
|
|
query = query |
|
|
|
|
.Where(w=> caseIds.Contains(w.Id)) |
|
|
|
|
.WhereIf(pageInput.CaseIds.IsNotNullOrEmpty(), w => pageInput.CaseIds.Contains(w.Id)) |
|
|
|
|
.WhereIf(pageInput.CaseName.NotNull(), a => a.Name.Contains(pageInput.CaseName)) |
|
|
|
|
.WhereIf(pageInput.CaseTypeId != null, a => a.CaseTypeId == pageInput.CaseTypeId) |
|
|
|
|
@ -1979,8 +1992,11 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
|
|
|
|
|
var limits = User.limits; |
|
|
|
|
var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) |
|
|
|
|
.Where(w => limits.Contains(w.UnitId.ToString())) |
|
|
|
|
.Select(s=>s.CaseId) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
input.CaseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input.CaseIds = input.CaseIds?.Count>0 ? input.CaseIds.Intersect(selectLimits).ToList() : selectLimits.Distinct().ToList(); |
|
|
|
|
|
|
|
|
|
var express = await GetExpression(input, _appCaseManagementRepository.AsQueryable(false, true)); |
|
|
|
|
|
|
|
|
|
@ -2014,17 +2030,21 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
|
|
|
|
|
public async Task<IActionResult> Getuserexport(GetSupervisedPersonPage input) |
|
|
|
|
{ |
|
|
|
|
input.PageIndex = 1; |
|
|
|
|
input.PageSize = 999999; |
|
|
|
|
input.PageSize = 9999; |
|
|
|
|
var limits = User.limits; |
|
|
|
|
var selectLimits = await _appCaseSupervisorRepository.AsQueryable(false, true) |
|
|
|
|
.Where(w => limits.Contains(w.UnitId.ToString())) |
|
|
|
|
.ToListAsync(); |
|
|
|
|
var caseIds = selectLimits.Select(w => w.CaseId).Distinct().ToList(); |
|
|
|
|
var userRole = await _userService.IsAdmin(null); |
|
|
|
|
var supervisorCaseList = await _appCaseSupervisorRepository.AsQueryable(false, true) |
|
|
|
|
.Where(w => w.SupervisorId == User.Id).Select(s => s.CaseId).ToListAsync(); |
|
|
|
|
var intersection1 = supervisorCaseList.Intersect(caseIds).ToList(); |
|
|
|
|
|
|
|
|
|
//var caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync(); |
|
|
|
|
|
|
|
|
|
var caselist = await (await base.GetCurrentUserCaseListAsync()).Select(w => new { w.AppCaseManagement.Id, w.AppCaseManagement.Name }).ToListAsync(); |
|
|
|
|
var data = await _appSupervisedPersonRepository.AsQueryable(false, true) |
|
|
|
|
.Where(q => caseIds.Contains(q.CaseId)) |
|
|
|
|
.Where(q => intersection1.Contains(q.CaseId)) |
|
|
|
|
.WhereIf(input.name.NotNull(), q => q.SupervisedPersonName.Contains(input.name)) |
|
|
|
|
.OrderByDescending(r => r.CreatedTime) |
|
|
|
|
.ProjectTo<AppSupervisedPersonListexportDto>(Mapper.ConfigurationProvider) |
|
|
|
|
|