Browse Source

[MODIFY]测试问题修改,导出功能开发

dev-zzj
zhaozhenjing 2 months ago
parent
commit
1d2253a523
  1. 5
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs
  2. 71
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs
  3. 6
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs
  4. 64
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationExportDto.cs

5
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?.Replace("\\", "/");
input.PunchVideo = input.PunchVideo.Substring(input.PunchVideo.LastIndexOf("/upload/admin")); input.PunchVideo = input.PunchVideo.Substring(input.PunchVideo.LastIndexOf("/upload/admin"));
//就是那个傻逼App开发人员啥都不想传
var entity = Mapper.Map<AppPunchRecordStatistics>(input); var entity = Mapper.Map<AppPunchRecordStatistics>(input);
//[获取当前[被监管挂人员]的案件 //[获取当前[被监管挂人员]的案件
@ -630,7 +630,8 @@ namespace ATS.NonCustodial.Application.Impl.Business
SupervisedPersonName = item.SupervisedPersonName, SupervisedPersonName = item.SupervisedPersonName,
SupervisorId = item.SupervisorId, SupervisorId = item.SupervisorId,
SupervisorName = item.SupervisorName, SupervisorName = item.SupervisorName,
CaseId = item.CaseId CaseId = item.CaseId,
CaseName = item.CaseName
}); });
} }
} }

71
src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs

@ -434,6 +434,71 @@ namespace ATS.NonCustodial.Application.Impl.Business
return ResultOutput.Ok(pageResult); return ResultOutput.Ok(pageResult);
} }
/// <summary>
/// 越界统计导出
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> 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<ViolationExportDto> notClockList = new List<ViolationExportDto>();
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");
}
/// <summary> /// <summary>
/// 未打卡统计导出 /// 未打卡统计导出
/// </summary> /// </summary>
@ -466,7 +531,11 @@ namespace ATS.NonCustodial.Application.Impl.Business
notClockListDto.CaseName = item.Name; notClockListDto.CaseName = item.Name;
notClockListDto.CreatedTime = item.CreatedTime; notClockListDto.CreatedTime = item.CreatedTime;
notClockListDto.CaseTypeName = caseType.Name; 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 var supervisedPerson = await _appSupervisedPersonRepository
.AsQueryable(false, true) .AsQueryable(false, true)

6
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs

@ -51,6 +51,12 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationSt
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
Task<IResultOutput> LeaveAreaStatisticsPageAsync(NotClockedInput input); Task<IResultOutput> LeaveAreaStatisticsPageAsync(NotClockedInput input);
/// <summary>
/// 越界统计导出
/// </summary>
/// <returns></returns>
Task<IActionResult> LeaveAreaStatisticsExportAsync(NotClockedInput input);
/// <summary> /// <summary>
/// 未打卡统计导出 /// 未打卡统计导出
/// </summary> /// </summary>

64
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
{
/// <summary>
/// 案件Id
/// </summary>
public long CaseId { get; set; }
/// <summary>
/// 案件名称
/// </summary>
[DisplayName("案件名称")]
public string? CaseName { get; set; }
/// <summary>
/// 被监管人Id
/// </summary>
public long SupervisedPersonId { get; set; }
/// <summary>
/// 被监管人员
/// </summary>
[DisplayName("被监管人员")]
public string? SupervisedPersonName { get; set; }
/// <summary>
/// 部门受案号
/// </summary>
[DisplayName("部门受案号")]
public string? Bmsah { get; set; }
/// <summary>
/// 监督单位
/// </summary>
[DisplayName("监督单位")]
public string? SupervisionUnit { get; set; }
/// <summary>
/// 案件类型
/// </summary>
[DisplayName("案件类型")]
public string? CaseTypeName { get; set; }
/// <summary>
/// 违规越界次数
/// </summary>
[DisplayName("违规越界次数")]
public int ViolationCount { get; set; }
/// <summary>
/// 案件创建日期
/// </summary>
[DisplayName("案件创建日期")]
public DateTime? CreatedTime { get; set; }
}
}
Loading…
Cancel
Save