Browse Source

[MODIFY]问题bug修改

dev-zzj
zhaozhenjing 2 months ago
parent
commit
4b39b2c425
  1. 45
      src/2.services/ATS.NonCustodial.Application/Base/AdminCommonService.cs
  2. 11
      src/2.services/ATS.NonCustodial.Application/Impl/Admins/AppDictionaryService.cs
  3. 2
      src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs
  4. 39
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs
  5. 12
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs
  6. 1
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs
  7. 99
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs
  8. 4
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppEarlyWarnings/Input/AppEarlyWarningAddInput.cs
  9. 5
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs
  10. 56
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationListDto.cs

45
src/2.services/ATS.NonCustodial.Application/Base/AdminCommonService.cs

@ -13,17 +13,16 @@ using ATS.NonCustodial.Domain.Shared.Enums;
using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore; using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore;
using ATS.NonCustodial.Shared.Common.Dtos; using ATS.NonCustodial.Shared.Common.Dtos;
using ATS.NonCustodial.Shared.Common.Enums; using ATS.NonCustodial.Shared.Common.Enums;
using ATS.NonCustodial.Shared.Configurations.Options;
using ATS.NonCustodial.Shared.Extensions;
using Castle.Components.DictionaryAdapter; using Castle.Components.DictionaryAdapter;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Net.Cache;
using System.Net; using System.Net;
using System.Net.Cache;
using System.Security.Cryptography;
using System.Text; using System.Text;
using Yitter.IdGenerator; using Yitter.IdGenerator;
using ATS.NonCustodial.Shared.Configurations.Options;
using ATS.NonCustodial.Shared.Extensions;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
using System.Security.Cryptography;
namespace ATS.NonCustodial.Application.Base namespace ATS.NonCustodial.Application.Base
@ -161,7 +160,7 @@ namespace ATS.NonCustodial.Application.Base
//获取当前被监管人的【监管人】列表 //获取当前被监管人的【监管人】列表
ChatPersonTypeEnum.SupervisedPerson => caseAgg ChatPersonTypeEnum.SupervisedPerson => caseAgg
.WhereIf(!userRole.IsAdmin,w => w.AppCaseSupervisedPerson!.SupervisedPersonId == User.Id) .WhereIf(!userRole.IsAdmin, w => w.AppCaseSupervisedPerson!.SupervisedPersonId == User.Id)
.Select(w => new ChatListDto() .Select(w => new ChatListDto()
{ {
@ -193,21 +192,21 @@ namespace ATS.NonCustodial.Application.Base
{ {
queryData.Add(dto); queryData.Add(dto);
if (User.ChatPersonType == ChatPersonTypeEnum.SupervisedPerson) //if (User.ChatPersonType == ChatPersonTypeEnum.SupervisedPerson)
{ //{
//管理员 // //管理员
queryData.AddRange(allAdmins.Select(w => new ChatListDto() // queryData.AddRange(allAdmins.Select(w => new ChatListDto()
{ // {
CaseId = dto.CaseId, // CaseId = dto.CaseId,
CaseName = dto.CaseName, // CaseName = dto.CaseName,
SenderId = User.Id, // SenderId = User.Id,
SenderName = User.Name, // SenderName = User.Name,
SenderAvatar = User.Avatar, // SenderAvatar = User.Avatar,
ReceiverId = w.Id, // ReceiverId = w.Id,
ReceiverName = w.UserName ?? w.NickName, // ReceiverName = w.UserName ?? w.NickName,
ChatPersonType = w.ChatPersonType // ChatPersonType = w.ChatPersonType
})); // }));
} //}
} }
queryData = queryData.Distinct((x, y) => x.CaseId == y.CaseId && x.ReceiverId == y.ReceiverId).ToList(); queryData = queryData.Distinct((x, y) => x.CaseId == y.CaseId && x.ReceiverId == y.ReceiverId).ToList();
@ -445,7 +444,7 @@ namespace ATS.NonCustodial.Application.Base
/// post /// post
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected string GetpostQuery(string sUrl, dynamic obj_model,string token) protected string GetpostQuery(string sUrl, dynamic obj_model, string token)
{ {
var re = ""; var re = "";
try try
@ -539,7 +538,7 @@ namespace ATS.NonCustodial.Application.Base
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));//当地时区 System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));//当地时区
var time = startTime.AddMilliseconds($"{sData.expire_time}".ToDouble()); var time = startTime.AddMilliseconds($"{sData.expire_time}".ToDouble());
Cache.Set("token", $"{$"{sData.token}"}", new TimeSpan(23, 0,0)); Cache.Set("token", $"{$"{sData.token}"}", new TimeSpan(23, 0, 0));
} }
} }
} }

11
src/2.services/ATS.NonCustodial.Application/Impl/Admins/AppDictionaryService.cs

@ -90,6 +90,17 @@ namespace ATS.NonCustodial.Application.Impl.Admins
public async Task<IResultOutput> GetListAsync(string? code) public async Task<IResultOutput> GetListAsync(string? code)
{ {
var rtn = await GetListNoApiAsync(code); var rtn = await GetListNoApiAsync(code);
foreach (var item in rtn)
{
if(item ==null) continue;
// 修复:添加 null 检查并转换为 List
if (item.Dictionaries != null)
{
item.Dictionaries = item.Dictionaries
.Where(wd => wd.DataStatus == 0)
.ToList(); // 添加 ToList() 转换
}
}
//返回 //返回
return ResultOutput.Ok(rtn); return ResultOutput.Ok(rtn);
} }

2
src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs

@ -844,7 +844,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
var rtn = await _userRepository.AsQueryable(false, true) var rtn = await _userRepository.AsQueryable(false, true)
.Where(w => w.ChatPersonType != ChatPersonTypeEnum.SupervisedPerson && w.DataStatus != DataStatusEnum.Disable&&!w.UserName.Contains("_aks")) .Where(w => w.ChatPersonType != ChatPersonTypeEnum.SupervisedPerson && w.DataStatus != DataStatusEnum.Disable&&!w.UserName.Contains("_aks"))
.WhereIf(!userRoles.IsAdmin, w => w.Id == User.Id) // .WhereIf(!userRoles.IsAdmin, w => w.Id == User.Id) 2025 -10-20 段肖确认修改
.Select(w => new KeyValueDto() .Select(w => new KeyValueDto()
{ {
Id = w.Id, Id = w.Id,

39
src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs

@ -6,6 +6,7 @@ using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessAppl
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications.Input; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications.Input;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessApplications.Output; 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;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement.Input;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.Apps.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.Apps.Output;
using ATS.NonCustodial.Application.Impl.Business.IM; using ATS.NonCustodial.Application.Impl.Business.IM;
using ATS.NonCustodial.Domain.Entities.Admins; using ATS.NonCustodial.Domain.Entities.Admins;
@ -45,6 +46,8 @@ namespace ATS.NonCustodial.Application.Impl.Business
private readonly IHubContext<NonCustodialHub> _hubContext; private readonly IHubContext<NonCustodialHub> _hubContext;
private readonly IEfRepository<AppUser, long> _appUserRepository; private readonly IEfRepository<AppUser, long> _appUserRepository;
private readonly ISMSService _smsService; private readonly ISMSService _smsService;
private readonly IEfRepository<AppCaseSupervisedPerson, long> _appSupervisedPersonRepository;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -83,6 +86,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
_hubContext = hubContext; _hubContext = hubContext;
_appUserRepository = appUserRepository; _appUserRepository = appUserRepository;
_smsService = smsService; _smsService = smsService;
_appSupervisedPersonRepository = appCaseSupervisedPersonRepository;
} }
#endregion Identity #endregion Identity
@ -119,11 +123,16 @@ namespace ATS.NonCustodial.Application.Impl.Business
//rtn.Data = rtn.Data.Where(w => caseIdList.Contains(w.CaseId)).ToList(); //rtn.Data = rtn.Data.Where(w => caseIdList.Contains(w.CaseId)).ToList();
foreach (var item in rtn.Data) foreach (var item in rtn.Data)
{ {
if (item.EndSupervisionDate.HasValue) var dic= await _appDictionaryService.GetDicByDicId(item.ApplicationTypeId);
if (dic.Code == "end_supervision")
{ {
item.ActiveTimePeriodBegin = null; item.ActiveTimePeriodBegin = null;
item.ActiveTimePeriodEnd = null; item.ActiveTimePeriodEnd = null;
} }
else
{
item.EndSupervisionDate = null;
}
} }
return ResultOutput.Ok(rtn); return ResultOutput.Ok(rtn);
} }
@ -303,7 +312,30 @@ namespace ATS.NonCustodial.Application.Impl.Business
}); });
await _appBusinessApplicationRepository.UpdateAsync(dataList); await _appBusinessApplicationRepository.UpdateAsync(dataList);
foreach (var item in dataList)
{
var caseType = await _appDictionaryService.GetDicByDicId(item.ApplicationTypeId);
if (input.AuditStatus == AuditStatusEnum.Pass && caseType.Code == "end_supervision")
{
var caseId = await _appSupervisedPersonRepository.AsQueryable(false, true)
.Where(w => w.SupervisedPersonId == item.SupervisedPersonId)
.ToListAsync();
if (caseId.Count > 0)
{
var caseList = await _appSupervisedPersonRepository.AsQueryable(false, true)
.Where(w => w.CaseId == caseId.FirstOrDefault().CaseId)
.ToListAsync();
if (caseList.Count == 1)
{
BatchHandleCaseProgressInput ids = new BatchHandleCaseProgressInput();
ids.CaseProgress = CaseProgressEnum.Closed;
ids.Ids = new List<long> { caseId.FirstOrDefault().CaseId };
await _appCaseManagementService.BatchHandleCaseProgress(ids);
}
}
}
}
foreach (var item in dataList) foreach (var item in dataList)
{ {
var user = await _appUserRepository.AsQueryable(false, true).Where(w => w.Id == item.SupervisedPersonId).ToListAsync(); var user = await _appUserRepository.AsQueryable(false, true).Where(w => w.Id == item.SupervisedPersonId).ToListAsync();
@ -311,9 +343,6 @@ namespace ATS.NonCustodial.Application.Impl.Business
//[审批完成通知] {1}您好,您于{2}年{3}月{4}日提交的{5}申请已完成审批,请及时登录系统查看处理结果。 //[审批完成通知] {1}您好,您于{2}年{3}月{4}日提交的{5}申请已完成审批,请及时登录系统查看处理结果。
await _smsService.SendMessageSMS(MessageAlertTypeEnum.Approved, "", user.FirstOrDefault().Phone, item.CreatedTime, item.ApplicationTypeName, "", item.SupervisedPersonName); await _smsService.SendMessageSMS(MessageAlertTypeEnum.Approved, "", user.FirstOrDefault().Phone, item.CreatedTime, item.ApplicationTypeName, "", item.SupervisedPersonName);
} }
//返回结果 //返回结果
return ResultOutput.Ok(); return ResultOutput.Ok();
} }
@ -333,8 +362,6 @@ namespace ATS.NonCustodial.Application.Impl.Business
var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList(); 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 caseIds = await (await base.GetCurrentUserCaseListAsync()).Where(w => w.AppCaseManagement != null && caseIdList.Contains(w.AppCaseManagement.Id)).Select(w => w.AppCaseManagement.Id).ToListAsync();
var dataList = await _appBusinessApplicationRepository.AsQueryable(false, true) var dataList = await _appBusinessApplicationRepository.AsQueryable(false, true)
.Where(w => caseIds.Contains(w.CaseId)) .Where(w => caseIds.Contains(w.CaseId))
.OrderByDescending(w => w.CreatedTime) .OrderByDescending(w => w.CreatedTime)

12
src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs

@ -845,13 +845,15 @@ namespace ATS.NonCustodial.Application.Impl.Business
.AsQueryable(false, true) .AsQueryable(false, true)
.Where(w => w.CaseId == currentUserCase.CaseId) .Where(w => w.CaseId == currentUserCase.CaseId)
.ToListAsync(); .ToListAsync();
var applicationType = await base.GetDictionariesOutput("application_type", "df"); var dic = await _appDictionaryService.GetDicByDicId(input.ApplicationTypeId);
//var applicationType = await base.GetDictionariesOutput("application_type", "df");
foreach (var supervisor in supervisorList) foreach (var supervisor in supervisorList)
{ {
var user = await _appUserRepository.AsQueryable(false, true).Where(w => w.Id == supervisor.SupervisorId).ToListAsync(); var user = await _appUserRepository.AsQueryable(false, true).Where(w => w.Id == supervisor.SupervisorId).ToListAsync();
//发短信给监管人,提醒处理审批 //发短信给监管人,提醒处理审批
await _smsService.SendMessageSMS(MessageAlertTypeEnum.ReviewNotification, user.FirstOrDefault().UserName, user.FirstOrDefault().Phone, DateTime.Now, applicationType.Name, "", currentUserCase.SupervisedPersonName); await _smsService.SendMessageSMS(MessageAlertTypeEnum.ReviewNotification, user.FirstOrDefault().UserName, user.FirstOrDefault().Phone, DateTime.Now, dic.Name, "", currentUserCase.SupervisedPersonName);
} }
return await _appBusinessApplicationService.CreateOrModify(input); return await _appBusinessApplicationService.CreateOrModify(input);
} }
@ -1150,7 +1152,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
var earlyList = await GetRemindListByCurrentUserPageAsync(new AppRemindPageInput() var earlyList = await GetRemindListByCurrentUserPageAsync(new AppRemindPageInput()
{ {
PageIndex = 1, PageIndex = 1,
PageSize = 999999, PageSize = 100,
CheckStatus = CheckStatusEnum.NotChecked CheckStatus = CheckStatusEnum.NotChecked
}); });
@ -1177,7 +1179,9 @@ namespace ATS.NonCustodial.Application.Impl.Business
//预警信息 //预警信息
var earlyList = await (from e in _appEarlyWarningRepository.AsQueryable(false, true) var earlyList = await (from e in _appEarlyWarningRepository.AsQueryable(false, true)
join ev in _appEarlyWarningViewStatisticsRepository.AsQueryable(false, true) on e.Id equals ev.AppEarlyWarningId join ev in _appEarlyWarningViewStatisticsRepository.AsQueryable(false, true) on e.Id equals ev.AppEarlyWarningId
where ev.SubscriberId == User.Id && caseIdList.Contains(e.CaseId) join cm in _appCaseManagementRepository.AsQueryable(false, true) on e.CaseId equals
cm.Id
where ev.SubscriberId == User.Id && caseIdList.Contains(e.CaseId) && cm.CaseProgress!=CaseProgressEnum.Closed
select new AppRemindListDto() select new AppRemindListDto()
{ {
Id = e.Id, Id = e.Id,

1
src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs

@ -651,6 +651,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
Title = dict == null ? "" : dict.Name, Title = dict == null ? "" : dict.Name,
CaseId = w.CaseId.Value, CaseId = w.CaseId.Value,
Content = w.Content, Content = w.Content,
CaseName = w.CaseName,
EarlyWarningTypeId = dict?.Id ?? default, EarlyWarningTypeId = dict?.Id ?? default,
SupervisedPersonId = w.SupervisedPersonId, SupervisedPersonId = w.SupervisedPersonId,
SupervisedPersonName = w.SupervisedPersonName, SupervisedPersonName = w.SupervisedPersonName,

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

@ -1,17 +1,21 @@
using ATS.NonCustodial.Application.Base; using ATS.NonCustodial.Application.Base;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.AppDictionaries; using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.AppDictionaries;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.User; using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.User;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement.Output;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppEarlyWarnings.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppEarlyWarnings.Output;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics.Input; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics.Input;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics.Output; using ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics.Output;
using ATS.NonCustodial.Domain.Entities.Admins;
using ATS.NonCustodial.Domain.Entities.Business; using ATS.NonCustodial.Domain.Entities.Business;
using ATS.NonCustodial.Domain.Entities.Business.CaseManagements; using ATS.NonCustodial.Domain.Entities.Business.CaseManagements;
using ATS.NonCustodial.Domain.Entities.Business.EarlyWarning; using ATS.NonCustodial.Domain.Entities.Business.EarlyWarning;
using ATS.NonCustodial.Domain.Shared.AggRootEntities.Dtos; using ATS.NonCustodial.Domain.Shared.AggRootEntities.Dtos;
using ATS.NonCustodial.Domain.Shared.Enums;
using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore; using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore;
using ATS.NonCustodial.DynamicApi; using ATS.NonCustodial.DynamicApi;
using ATS.NonCustodial.DynamicApi.Attributes; using ATS.NonCustodial.DynamicApi.Attributes;
using ATS.NonCustodial.Shared.Common.Auth;
using ATS.NonCustodial.Shared.Common.Dtos; using ATS.NonCustodial.Shared.Common.Dtos;
using ATS.NonCustodial.Shared.Common.UnifiedResults; using ATS.NonCustodial.Shared.Common.UnifiedResults;
using ATS.NonCustodial.Shared.Extensions; using ATS.NonCustodial.Shared.Extensions;
@ -40,6 +44,8 @@ namespace ATS.NonCustodial.Application.Impl.Business
private readonly IEfRepository<AppEarlyWarning, long> _appEarlyWarningRepository; private readonly IEfRepository<AppEarlyWarning, long> _appEarlyWarningRepository;
private readonly IUserService _userService; private readonly IUserService _userService;
private readonly IEfRepository<AppCaseSupervisedPerson, long> _appSupervisedPersonRepository; private readonly IEfRepository<AppCaseSupervisedPerson, long> _appSupervisedPersonRepository;
private readonly IEfRepository<AppCaseSupervisor, long> _appSupervisorRepository;
private readonly IEfRepository<AppUser?, long> _userRepository;
/// <summary> /// <summary>
/// ///
@ -48,7 +54,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
/// <param name="appDictionaryService"></param> /// <param name="appDictionaryService"></param>
/// <param name="appEarlyWarningRepository"></param> /// <param name="appEarlyWarningRepository"></param>
/// <param name="userService"></param> /// <param name="userService"></param>
public AppViolationStatisticsService(IEfRepository<AppViolationStatistics, long> appViolationStatisticsRepository, public AppViolationStatisticsService(IEfRepository<AppUser?, long> userRepository, IEfRepository<AppCaseSupervisor, long> appSupervisorRepository, IEfRepository<AppViolationStatistics, long> appViolationStatisticsRepository,
IAppDictionaryService appDictionaryService, IAppDictionaryService appDictionaryService,
IEfRepository<AppEarlyWarning, long> appEarlyWarningRepository, IEfRepository<AppEarlyWarning, long> appEarlyWarningRepository,
IUserService userService, IUserService userService,
@ -63,11 +69,13 @@ namespace ATS.NonCustodial.Application.Impl.Business
appDictionaryService, appDictionaryService,
asprl) asprl)
{ {
_appSupervisorRepository = appSupervisorRepository;
_appViolationStatisticsRepository = appViolationStatisticsRepository; _appViolationStatisticsRepository = appViolationStatisticsRepository;
_appDictionaryService = appDictionaryService; _appDictionaryService = appDictionaryService;
_appEarlyWarningRepository = appEarlyWarningRepository; _appEarlyWarningRepository = appEarlyWarningRepository;
_userService = userService; _userService = userService;
_appSupervisedPersonRepository = appCaseSupervisedPersonRepository; _appSupervisedPersonRepository = appCaseSupervisedPersonRepository;
_userRepository = userRepository;
} }
#endregion Identity #endregion Identity
@ -308,6 +316,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
.Where(w => caseIdList.Contains(w.Id)) .Where(w => caseIdList.Contains(w.Id))
.WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId) .WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId)
.ToListAsync(); .ToListAsync();
var applicationType = await base.GetDictionariesOutput("early_warning_type", "notClocked");
List<NotClockListDto> notClockList = new List<NotClockListDto>(); List<NotClockListDto> notClockList = new List<NotClockListDto>();
foreach (var item in caseList) foreach (var item in caseList)
@ -320,7 +329,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)
@ -332,7 +345,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
notClockListDto.SupervisedPersonName = person.SupervisedPersonName; notClockListDto.SupervisedPersonName = person.SupervisedPersonName;
var earlyList = await _appEarlyWarningRepository var earlyList = await _appEarlyWarningRepository
.AsQueryable(false, true) .AsQueryable(false, true)
.Where(w => w.Title == "未打卡" && w.SupervisedPersonId == person.SupervisedPersonId .Where(w => w.EarlyWarningTypeId == applicationType.Id && w.SupervisedPersonId == person.SupervisedPersonId
&& w.CaseId == item.Id) && w.CaseId == item.Id)
.WhereIf(input.EndCreatedTime.HasValue, w => w.CreatedTime <= input.EndCreatedTime) .WhereIf(input.EndCreatedTime.HasValue, w => w.CreatedTime <= input.EndCreatedTime)
.WhereIf(input.StartCreatedTime.HasValue, w => w.CreatedTime >= input.StartCreatedTime) .WhereIf(input.StartCreatedTime.HasValue, w => w.CreatedTime >= input.StartCreatedTime)
@ -342,8 +355,83 @@ namespace ATS.NonCustodial.Application.Impl.Business
} }
} }
var pageData = notClockList.Skip((input.PageIndex - 1) * input.PageSize)
.Take(input.PageSize).ToList();
var pageResult = new PagedList<NotClockListDto>()
{
TotalCount = notClockList.Count(),
Data = pageData
};
return ResultOutput.Ok(pageResult);
}
/// <summary>
/// 越界统计
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<IResultOutput> LeaveAreaStatisticsPageAsync(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");
return ResultOutput.Ok(notClockList); List<ViolationListDto> notClockList = new List<ViolationListDto>();
foreach (var item in caseList)
{
if (item == null) continue;
var caseType = await _appDictionaryService.GetDicByDicId(item.CaseTypeId);
ViolationListDto notClockListDto = new ViolationListDto();
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 pageData = notClockList.Skip((input.PageIndex - 1) * input.PageSize)
.Take(input.PageSize).ToList();
var pageResult = new PagedList<ViolationListDto>()
{
TotalCount = notClockList.Count(),
Data = pageData
};
return ResultOutput.Ok(pageResult);
} }
/// <summary> /// <summary>
@ -365,6 +453,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
.Where(w => caseIdList.Contains(w.Id)) .Where(w => caseIdList.Contains(w.Id))
.WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId) .WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId)
.ToListAsync(); .ToListAsync();
var applicationType = await base.GetDictionariesOutput("early_warning_type", "notClocked");
List<NotClockExportDto> notClockList = new List<NotClockExportDto>(); List<NotClockExportDto> notClockList = new List<NotClockExportDto>();
foreach (var item in caseList) foreach (var item in caseList)
@ -389,7 +478,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
notClockListDto.SupervisedPersonName = person.SupervisedPersonName; notClockListDto.SupervisedPersonName = person.SupervisedPersonName;
var earlyList = await _appEarlyWarningRepository var earlyList = await _appEarlyWarningRepository
.AsQueryable(false, true) .AsQueryable(false, true)
.Where(w => w.Title == "未打卡" && w.SupervisedPersonId == person.SupervisedPersonId .Where(w => w.EarlyWarningTypeId== applicationType.Id && w.SupervisedPersonId == person.SupervisedPersonId
&& w.CaseId == item.Id) && w.CaseId == item.Id)
.WhereIf(input.EndCreatedTime.HasValue, w => w.CreatedTime <= input.EndCreatedTime) .WhereIf(input.EndCreatedTime.HasValue, w => w.CreatedTime <= input.EndCreatedTime)
.WhereIf(input.StartCreatedTime.HasValue, w => w.CreatedTime >= input.StartCreatedTime) .WhereIf(input.StartCreatedTime.HasValue, w => w.CreatedTime >= input.StartCreatedTime)

4
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppEarlyWarnings/Input/AppEarlyWarningAddInput.cs

@ -32,6 +32,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppEarlyWar
/// </summary> /// </summary>
public long CaseId { get; set; } public long CaseId { get; set; }
/// <summary>
/// 案件名称
/// </summary>
public string? CaseName { get; set; }
/// <summary> /// <summary>
/// 预警类型Id(来自数据字典) /// 预警类型Id(来自数据字典)
/// </summary> /// </summary>

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

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

56
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationListDto.cs

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.ViolationStatistics.Output
{
public class ViolationListDto
{
/// <summary>
/// 案件Id
/// </summary>
public long CaseId { get; set; }
/// <summary>
/// 案件名称
/// </summary>
public string? CaseName { get; set; }
/// <summary>
/// 被监管人Id
/// </summary>
public long SupervisedPersonId { get; set; }
/// <summary>
/// 被监管人员
/// </summary>
public string? SupervisedPersonName { get; set; }
/// <summary>
/// 部门受案号
/// </summary>
public string? Bmsah { get; set; }
/// <summary>
/// 监督单位
/// </summary>
public string? SupervisionUnit { get; set; }
/// <summary>
/// 案件类型
/// </summary>
public string? CaseTypeName { get; set; }
/// <summary>
/// 违规越界次数
/// </summary>
public int ViolationCount { get; set; }
/// <summary>
/// 案件创建日期
/// </summary>
public DateTime? CreatedTime { get; set; }
}
}
Loading…
Cancel
Save