From 1d2253a5233927a9e1ec56d28d55a5c9ad1b1c59 Mon Sep 17 00:00:00 2001 From: zhaozhenjing Date: Mon, 20 Oct 2025 14:55:07 +0800 Subject: [PATCH] =?UTF-8?q?[MODIFY]=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Impl/Business/AppPunchRecordService.cs | 5 +- .../Business/AppViolationStatisticsService.cs | 71 ++++++++++++++++++- .../IAppViolationStatisticsService.cs | 6 ++ .../Output/ViolationExportDto.cs | 64 +++++++++++++++++ 4 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationExportDto.cs diff --git a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs index 1560407..716229e 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs @@ -213,7 +213,7 @@ namespace ATS.NonCustodial.Application.Impl.Business input.PunchVideo = input.PunchVideo?.Replace("\\", "/"); input.PunchVideo = input.PunchVideo.Substring(input.PunchVideo.LastIndexOf("/upload/admin")); - //就是那个傻逼App开发人员啥都不想传 + var entity = Mapper.Map(input); //[获取当前[被监管挂人员]的案件 @@ -630,7 +630,8 @@ namespace ATS.NonCustodial.Application.Impl.Business SupervisedPersonName = item.SupervisedPersonName, SupervisorId = item.SupervisorId, SupervisorName = item.SupervisorName, - CaseId = item.CaseId + CaseId = item.CaseId, + CaseName = item.CaseName }); } } 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 040cdde..ae0cd04 100644 --- a/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs +++ b/src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs @@ -434,6 +434,71 @@ namespace ATS.NonCustodial.Application.Impl.Business return ResultOutput.Ok(pageResult); } + + /// + /// 越界统计导出 + /// + /// + [HttpPost] + public async Task LeaveAreaStatisticsExportAsync(NotClockedInput input) + { + //获取当前用户权限下的案件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 caseList = await _appCaseManagementRepository.AsQueryable(false, true) + .Where(w => caseIdList.Contains(w.Id)) + .WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId) + .ToListAsync(); + var applicationType = await base.GetDictionariesOutput("early_warning_type", "LeaveArea"); + + List notClockList = new List(); + foreach (var item in caseList) + { + if (item == null) continue; + var caseType = await _appDictionaryService.GetDicByDicId(item.CaseTypeId); + ViolationExportDto notClockListDto = new ViolationExportDto(); + notClockListDto.Bmsah = item.Bmsah; + notClockListDto.CaseId = item.Id; + notClockListDto.CaseName = item.Name; + notClockListDto.CreatedTime = item.CreatedTime; + notClockListDto.CaseTypeName = caseType.Name; + + var unitList = await (from c in _appSupervisorRepository.AsQueryable(false, true) + join u in _userRepository.AsQueryable(false, true) on c.SupervisorId equals u.Id + where c.CaseId == item.Id + select u.Unitname).FirstOrDefaultAsync(); + notClockListDto.SupervisionUnit = unitList; + //根据案件找到被监管 + var supervisedPerson = await _appSupervisedPersonRepository + .AsQueryable(false, true) + .Where(w => w.CaseId == item.Id) + .ToListAsync(); + foreach (var person in supervisedPerson) + { + notClockListDto.SupervisedPersonId = person.SupervisedPersonId; + notClockListDto.SupervisedPersonName = person.SupervisedPersonName; + var earlyList = await _appEarlyWarningRepository + .AsQueryable(false, true) + .Where(w => w.EarlyWarningTypeId == applicationType.Id && w.SupervisedPersonId == person.SupervisedPersonId + && w.CaseId == item.Id) + .WhereIf(input.EndCreatedTime.HasValue, w => w.CreatedTime <= input.EndCreatedTime) + .WhereIf(input.StartCreatedTime.HasValue, w => w.CreatedTime >= input.StartCreatedTime) + .ToListAsync(); + notClockListDto.ViolationCount = earlyList.Count; + notClockList.Add(notClockListDto); + } + + } + var memorySystem = ExcelHelper.ToExcel(notClockList); + return new FileController().File(memorySystem.ToArray(), "application/ms-excel", DateTime.Now.ToString("f") + ".xlsx"); + } + + /// /// 未打卡统计导出 /// @@ -466,7 +531,11 @@ namespace ATS.NonCustodial.Application.Impl.Business notClockListDto.CaseName = item.Name; notClockListDto.CreatedTime = item.CreatedTime; notClockListDto.CaseTypeName = caseType.Name; - notClockListDto.SupervisionUnit = ""; + var unitList = await (from c in _appSupervisorRepository.AsQueryable(false, true) + join u in _userRepository.AsQueryable(false, true) on c.SupervisorId equals u.Id + where c.CaseId == item.Id + select u.Unitname).FirstOrDefaultAsync(); + notClockListDto.SupervisionUnit = unitList; //根据案件找到被监管 var supervisedPerson = await _appSupervisedPersonRepository .AsQueryable(false, true) diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs index 5c6ac4d..38f7818 100644 --- a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs @@ -51,6 +51,12 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationSt /// /// Task LeaveAreaStatisticsPageAsync(NotClockedInput input); + + /// + /// 越界统计导出 + /// + /// + Task LeaveAreaStatisticsExportAsync(NotClockedInput input); /// /// 未打卡统计导出 /// diff --git a/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationExportDto.cs b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationExportDto.cs new file mode 100644 index 0000000..a5e7836 --- /dev/null +++ b/src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationExportDto.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics.Output +{ + public class ViolationExportDto + { + /// + /// 案件Id + /// + public long CaseId { get; set; } + + /// + /// 案件名称 + /// + [DisplayName("案件名称")] + public string? CaseName { get; set; } + + /// + /// 被监管人Id + /// + public long SupervisedPersonId { get; set; } + + /// + /// 被监管人员 + /// + [DisplayName("被监管人员")] + public string? SupervisedPersonName { get; set; } + /// + /// 部门受案号 + /// + [DisplayName("部门受案号")] + public string? Bmsah { get; set; } + + /// + /// 监督单位 + /// + [DisplayName("监督单位")] + public string? SupervisionUnit { get; set; } + + + /// + /// 案件类型 + /// + [DisplayName("案件类型")] + public string? CaseTypeName { get; set; } + + + /// + /// 违规越界次数 + /// + [DisplayName("违规越界次数")] + public int ViolationCount { get; set; } + /// + /// 案件创建日期 + /// + [DisplayName("案件创建日期")] + public DateTime? CreatedTime { get; set; } + } +}