Browse Source

添加案件时,写入监管人单位

dev_wp
wangping 3 months ago
parent
commit
f7764bf88a
  1. 20
      src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs

20
src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs

@ -522,7 +522,8 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
{ {
CaseId = caseId.Value, CaseId = caseId.Value,
SupervisorId = csp.SupervisedId, SupervisorId = csp.SupervisedId,
SupervisorName = csp.SupervisedName SupervisorName = csp.SupervisedName,
UnitId = GetUnitIdByUserId(csp.SupervisedId)
}); });
var dels = new List<long>(); var dels = new List<long>();
var list = await _appCaseSupervisorRepository.AsQueryable(false, true).Where(w => w.CaseId == caseId).ToListAsync(); var list = await _appCaseSupervisorRepository.AsQueryable(false, true).Where(w => w.CaseId == caseId).ToListAsync();
@ -817,7 +818,8 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
{ {
CaseId = caseId.Value, CaseId = caseId.Value,
SupervisorId = csp.SupervisedId, SupervisorId = csp.SupervisedId,
SupervisorName = csp.SupervisedName SupervisorName = csp.SupervisedName,
UnitId = GetUnitIdByUserId(csp.SupervisedId)
}); });
var Supervisordata = await _appCaseSupervisorRepository.FindAsync(q => q.CaseId == caseId && sList.Select(q => q.SupervisorId).Contains(q.SupervisorId)); var Supervisordata = await _appCaseSupervisorRepository.FindAsync(q => q.CaseId == caseId && sList.Select(q => q.SupervisorId).Contains(q.SupervisorId));
@ -901,7 +903,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.WhereIf(input.KeyWord.NotNull(), a => a.Name.Contains(input.KeyWord)) .WhereIf(input.KeyWord.NotNull(), a => a.Name.Contains(input.KeyWord))
.WhereIf(input.TimeSearch.BeginTime.Length == 2, w => w.CaseBeginTime > input.TimeSearch.BeginTime[0] && w.CaseBeginTime < input.TimeSearch.BeginTime[1].AddDays(1)) .WhereIf(input.TimeSearch.BeginTime.Length == 2, w => w.CaseBeginTime > input.TimeSearch.BeginTime[0] && w.CaseBeginTime < 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.TimeSearch.EndTime.Length == 2, w => w.CaseClosedTime > input.TimeSearch.EndTime[0] && w.CaseClosedTime <= input.TimeSearch.EndTime[1].AddDays(1))
.Where(w=> caseIdList.Contains(w.Id)); .Where(w => caseIdList.Contains(w.Id));
var pageData = await var pageData = await
query.ProjectTo<CaseStatisticsHandlingTimeListDto>(Mapper.ConfigurationProvider) query.ProjectTo<CaseStatisticsHandlingTimeListDto>(Mapper.ConfigurationProvider)
@ -948,7 +950,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.WhereIf(input.KeyWord.NotNull(), a => a.Name.Contains(input.KeyWord)) .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.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.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()).Where(w => caseIds.Contains(w.Id))
.ToListAsync(); .ToListAsync();
var dataGroup = data.GroupBy(w => w.CaseTypeId); var dataGroup = data.GroupBy(w => w.CaseTypeId);
@ -1012,7 +1014,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
SupervisedPersonName = w.AppCaseSupervisedPerson.SupervisedPersonName SupervisedPersonName = w.AppCaseSupervisedPerson.SupervisedPersonName
}).ToListAsync(); }).ToListAsync();
var dataGroup = query.Where(w=> caseIds.Contains(w.CaseId)).GroupBy(w => new var dataGroup = query.Where(w => caseIds.Contains(w.CaseId)).GroupBy(w => new
{ {
w.CaseId, w.CaseId,
w.SupervisedPersonId, w.SupervisedPersonId,
@ -1428,7 +1430,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.WhereIf(input.SupervisedPersonId > 0, w => w.AppCaseSupervisedPerson.SupervisedPersonId == input.SupervisedPersonId) .WhereIf(input.SupervisedPersonId > 0, w => w.AppCaseSupervisedPerson.SupervisedPersonId == input.SupervisedPersonId)
.WhereIf(input.ApprovalStatus.HasValue, w => w.AppCaseSupervisedPerson.ApprovalStatus == input.ApprovalStatus) .WhereIf(input.ApprovalStatus.HasValue, w => w.AppCaseSupervisedPerson.ApprovalStatus == input.ApprovalStatus)
.WhereIf(input.name.NotNull(), w => w.AppCaseSupervisedPerson.SupervisedPersonName.Contains(input.name)) .WhereIf(input.name.NotNull(), w => w.AppCaseSupervisedPerson.SupervisedPersonName.Contains(input.name))
.Where(w=>w.AppCaseManagement !=null &&w.AppCaseSupervisedPerson!=null && w.AppCaseSupervisor != null && caseIds.Contains(w.AppCaseSupervisedPerson.CaseId) && caseIds.Contains(w.AppCaseManagement.Id) && caseIds.Contains(w.AppCaseSupervisor.CaseId)); .Where(w => w.AppCaseManagement != null && w.AppCaseSupervisedPerson != null && w.AppCaseSupervisor != null && caseIds.Contains(w.AppCaseSupervisedPerson.CaseId) && caseIds.Contains(w.AppCaseManagement.Id) && caseIds.Contains(w.AppCaseSupervisor.CaseId));
var caseSpQueryable = await queryable.Where(q => q.AppCaseSupervisedPerson != null).Select(w => Mapper.Map<AppCaseSupervisedPerson, GetSupervisedPersonApprovalStatusOutput>(w.AppCaseSupervisedPerson)).ToListAsync(); var caseSpQueryable = await queryable.Where(q => q.AppCaseSupervisedPerson != null).Select(w => Mapper.Map<AppCaseSupervisedPerson, GetSupervisedPersonApprovalStatusOutput>(w.AppCaseSupervisedPerson)).ToListAsync();
if ((await base.IsAdmin()).IsAdmin) caseSpQueryable = caseSpQueryable.Distinct((x, y) => x.CaseId == y.CaseId && x.SupervisedPersonId == y.SupervisedPersonId).ToList(); if ((await base.IsAdmin()).IsAdmin) caseSpQueryable = caseSpQueryable.Distinct((x, y) => x.CaseId == y.CaseId && x.SupervisedPersonId == y.SupervisedPersonId).ToList();
@ -1933,6 +1935,12 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
} }
#endregion #endregion
private long GetUnitIdByUserId(long id)
{
var user = _appuserRepository.AsQueryable().Where(w => w.Id == id).FirstOrDefault();
return user?.UnitId ?? 0;
}
} }
public class Controller : ControllerBase public class Controller : ControllerBase
{ {

Loading…
Cancel
Save