Compare commits

...

5 Commits

  1. 156
      README.md
  2. 1
      src/1.datas/ATS.NonCustodial.Domain/Entities/Admins/AppSMS.cs
  3. 1
      src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs
  4. 12
      src/2.services/ATS.NonCustodial.Application/Impl/Admins/SMSService.cs
  5. 9
      src/2.services/ATS.NonCustodial.Application/Impl/Admins/UnitcodeService.cs
  6. 81
      src/2.services/ATS.NonCustodial.Application/Impl/Admins/UserService.cs
  7. 59
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppBusinessApplicationService.cs
  8. 10
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs
  9. 15
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppManagementService.cs
  10. 5
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppPunchRecordService.cs
  11. 90
      src/2.services/ATS.NonCustodial.Application/Impl/Business/AppViolationStatisticsService.cs
  12. 87
      src/2.services/ATS.NonCustodial.Application/Impl/Business/CaseManagements/AppCaseManagementService.cs
  13. 6
      src/2.services/ATS.NonCustodial.Application/Impl/Business/MaterialManager/AppFileAccessRecordsService.cs
  14. 10
      src/2.services/ATS.NonCustodial.Application/Impl/Logs/OperationLogService.cs
  15. 5
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/SMS/Output/SmsListDto.cs
  16. 7
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Unitcode/Output/UnitcodeListOutput.cs
  17. 4
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/User/IUserService.cs
  18. 14
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationGetDto.cs
  19. 5
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationListDto.cs
  20. 6
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppCaseManagements/AppCaseManagement/Output/AppCaseManagementListDto.cs
  21. 6
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/IAppViolationStatisticsService.cs
  22. 64
      src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/ViolationStatistics/Output/ViolationExportDto.cs
  23. 2
      src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/CaseProgressEnum.cs
  24. 5
      src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs
  25. 5
      src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs
  26. 18
      src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs

156
README.md

@ -1,3 +1,159 @@
# NonDetainmentSoft
非羁押人员管理系统
## 1. 项目概述
ATS.NonCustodial.Admin 是一个基于 .NET 9.0 开发的后端管理系统,主要用于非监禁人员管理业务,提供案件管理、业务申请、设备管理等功能模块。系统采用分层架构设计,具有良好的扩展性和可维护性。
## 2. 技术栈
- 开发框架 :.NET 9.0
- ORM框架 :Entity Framework Core 9.0.8
- 数据库 :MySQL
- 身份认证 :JWT / IdentityServer4
- 依赖注入 :Autofac
- 实时通信 :SignalR
- 任务调度 :Quartz
- API文档 :Swagger
- 缓存 :Redis
- 日志 :Serilog
- 数据映射 :AutoMapper
## 3. 项目架构
项目采用典型的分层架构设计,各层职责明确:
```
src/
├── 1.datas/ # 数据层
│ ├── ATS.NonCustodial.DbMigrations/ # 数据库迁移
│ ├── ATS.NonCustodial.Domain/ # 领域模型
│ └── ATS.NonCustodial.EntityFrameworkCore/ # EF Core 实现
├── 2.services/ # 业务服务层
│ └── ATS.NonCustodial.Application/ # 应用服务实现
├── 3.contracts/ # 接口层
│ └── ATS.NonCustodial.Application.Contracts/ # 服务接口定义
├── 4.apps/ # 应用层
│ └── ATS.NonCustodial.Admin.Api/ # Web API 应用
└── 5.shared/ # 共享层
├── ATS.NonCustodial.Admin.Jobs/ # 定时任务
├── ATS.NonCustodial.AdminUi/ # 管理UI组件
├── ATS.NonCustodial.AuditLogging/ # 审计日志
├── ATS.NonCustodial.Domain.Shared/ # 领域共享
├── ATS.NonCustodial.DynamicApi/ # 动态API
└── ATS.NonCustodial.Shared/ # 通用工具
```
## 4. 核心模块
### 4.1 案件管理模块
负责非监禁人员案件的创建、查询、更新和删除,包含案件信息、监管人员和被监管人员管理。
主要实体:
- AppCaseManagement :案件管理实体
- AppCaseSupervisor :监管人员实体
- AppCaseSupervisedPerson :被监管人员实体
### 4.2 业务申请模块
处理被监管人员的各类业务申请,如请假、外出活动等,包含申请提交、审核、统计等功能。
主要服务:
- AppBusinessApplicationService :业务申请服务
- 提供申请创建、查询、审核、统计等功能
### 4.3 设备管理模块
管理与被监管人员关联的电子设备,如定位设备等。
主要服务:
- AppDeviceManagementService :设备管理服务
### 4.4 用户权限管理
处理系统用户、角色和权限的管理。
主要服务:
- RoleService :角色管理服务
- UserService :用户管理服务
### 4.5 文件管理模块
提供文件上传、下载、管理功能,支持多种文件类型。
主要配置:
- UploadConfigConfiguration :文件上传配置,支持头像、图片、资料等类型
## 5. 系统配置
### 5.1 数据库配置
系统使用 MySQL 数据库,配置位于 appsettings.json 的 ConnectionStringsConfiguration 节点:
```
"ConnectionStringsConfiguration": {
"AdminAuditLogDbConnection": "Server=localhost;database=fsl_cs;uid=root;pwd=sa@admin;...",
"AdminDbConnection": "Server=localhost;database=fsl_cs;uid=root;pwd=sa@admin;..."
},
"DatabaseProviderConfiguration": {
"ProviderType": "MySql"
}
```
### 5.2 身份认证配置
支持 JWT 和 IdentityServer4 两种认证方式,JWT 配置如下:
```
"JwtConfiguration": {
"Issuer": "http://127.0.0.1:8006",
"Audience": "http://127.0.0.1:8006",
"SymmetricSecurityKey": "ertJKl#521*a@790asD&1#0123456789",
"Expires": 1440,
"RefreshTokenExpires": 1440
}
```
### 5.3 文件上传配置
定义了多种文件类型的上传规则:
```
"UploadConfigConfiguration": {
"Avatar": {
"UploadPath": "../upload/admin/avatar",
"RequestPath": "/upload/admin/avatar",
"MaxSize": 1048576
},
"Image": {
"UploadPath": "../upload/admin/image",
"RequestPath": "/upload/admin/image",
"MaxSize": 10485760
},
"MaterialManager": {
"UploadPath": "../upload/admin/materials",
"RequestPath": "/upload/admin/materials"
}
}
```
## 6. 服务启动流程
1. 入口点 : Program.cs 调用 HostApp.Run() 方法启动服务
2. 配置加载 :通过 ConfigHelper 加载配置文件
3. 依赖注入 :使用 Autofac 注册服务组件
4. 数据库初始化 :应用数据库迁移和种子数据
5. 中间件配置 :配置认证授权、CORS、路由等中间件
6. 服务运行 :启动 Web 服务器和 SignalR 服务
## 7. 关键特性
### 7.1 动态 API
使用自定义的 DynamicApi 属性自动生成 API 接口,简化开发流程。
### 7.2 实时通信
通过 SignalR 实现监管人员和系统之间的实时消息推送和通知。
### 7.3 审计日志
系统内置审计日志功能,记录用户操作和系统事件。
### 7.4 定时任务
使用 Quartz 框架实现系统定时任务,如数据同步、状态更新等。
### 7.5 多数据库支持
通过 EF Core 支持多种数据库,当前使用 MySQL。
## 8. 部署配置
系统支持 Docker 容器化部署,提供了 Dockerfile 用于构建镜像。默认监听端口为 8006。
## 9. 安全措施
- JWT/IdentityServer4 身份认证
- 基于角色的访问控制
- 输入验证和防注入
- CORS 跨域配置
- 请求限流(使用 AspNetCoreRateLimit)

1
src/1.datas/ATS.NonCustodial.Domain/Entities/Admins/AppSMS.cs

@ -20,6 +20,7 @@ namespace ATS.NonCustodial.Domain.Entities.Admins
{
Id = id;
}
public string? receiver { get; set; }
public string phone { get; set; } = string.Empty;

1
src/2.services/ATS.NonCustodial.Application/Impl/Admins/AuthService.cs

@ -430,6 +430,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
new Claim(ClaimAttributes.phone,user?.Phone??""),
new Claim(ClaimAttributes.logtime,timeLogin),
new Claim(ClaimAttributes.limits,limits??""),
new Claim(ClaimAttributes.positionId,user.PositionId.ToString()),
new Claim(ClaimAttributes.IsAdmin,user.IsAdmin?"true":"false"),
new Claim(ClaimAttributes.personType,user?.ChatPersonType.ToString()!)
});

12
src/2.services/ATS.NonCustodial.Application/Impl/Admins/SMSService.cs

@ -66,9 +66,9 @@ namespace ATS.NonCustodial.Application.Impl.Admins
foreach (var item in rtn.Data)
{
var peoson = await _appUserRepository.AsQueryable(false, true).Where(w => w.Phone == item.Phone).ToListAsync();
item.Name = peoson.FirstOrDefault()?.UserName;
switch(item.Type)
item.Name = item.Receiver;
switch (item.Type)
{
case "CheckCode":
item.TypeDes = "验证码"; break;
@ -217,6 +217,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
sendMessage = new string[] { supervisedPerson, year, month, day, msg };
templateId = "2534751";
addSMS.type = "Alert";
addSMS.receiver = supervisedPerson;
}
else if (alert == MessageAlertTypeEnum.Approved)
{
@ -224,6 +225,8 @@ namespace ATS.NonCustodial.Application.Impl.Admins
sendMessage = new string[] { supervisedPerson, year, month, day, msg };
templateId = "2535130";
addSMS.type = "Approved";
addSMS.receiver = supervisedPerson;
}
else if (alert == MessageAlertTypeEnum.ReviewNotification)
{
@ -231,6 +234,8 @@ namespace ATS.NonCustodial.Application.Impl.Admins
sendMessage = new string[] { supervisor, supervisedPerson, year, month, day, msg };
templateId = "2535127";
addSMS.type = "ReviewNotification";
addSMS.receiver = supervisor;
}
else
{
@ -238,6 +243,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
sendMessage = new string[] { supervisor, supervisedPerson, year, month, day, msg };
templateId = "2535150";
addSMS.type = "RegulatoryAlert";
addSMS.receiver = supervisor;
}
// 发送短信
var sendResult = SendSMS(phone, sendMessage, templateId);

9
src/2.services/ATS.NonCustodial.Application/Impl/Admins/UnitcodeService.cs

@ -299,6 +299,15 @@ namespace ATS.NonCustodial.Application.Impl.Admins
var entity = Mapper.Map<App_Unitcode>(input);
entity.Id = YitIdHelper.NextId();
entity.Limits = entity.Id.ToString();
if(input.ParentUnitCode.HasValue)
{
var rtn = await base.GetAsync<App_Unitcode, UnitcodeListOutput, long>(_appUnitcodeRepository, input.ParentUnitCode.Value);
entity.UnitLevel =(int.Parse(rtn.UnitLevel??"0")+1).ToString();
}
else
{
entity.UnitLevel = "1";
}
var App_Unitcode = await _appUnitcodeRepository.InsertAsync(entity);
//添加父级单位权限
if (entity.ParentUnitCode.HasValue)

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

@ -1,5 +1,6 @@
using ATS.NonCustodial.Application.Base;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.AppDictionaries;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.AppDictionaries.Output;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Auth.Output;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Menu.Output;
using ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Role.Output;
@ -12,7 +13,6 @@ using ATS.NonCustodial.Domain.Shared.OrmRepositories.Basic.EfCore;
using ATS.NonCustodial.DynamicApi;
using ATS.NonCustodial.DynamicApi.Attributes;
using ATS.NonCustodial.Shared.Common.Attributes;
using ATS.NonCustodial.Shared.Common.Auth;
using ATS.NonCustodial.Shared.Common.Constants;
using ATS.NonCustodial.Shared.Common.Dtos;
using ATS.NonCustodial.Shared.Common.Dtos.Query;
@ -27,10 +27,7 @@ using AutoMapper.QueryableExtensions;
using Castle.Components.DictionaryAdapter;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Xml.Linq;
using Yitter.IdGenerator;
namespace ATS.NonCustodial.Application.Impl.Admins
@ -111,7 +108,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
[HttpGet]
public async Task<IResultOutput> GetuserroleAsync(long id)
{
var userrole = await _userRoleRepository.AsQueryable(false, true).Where(q=>q.RoleId== id).Select(q=>q.UserId).ToListAsync();
var userrole = await _userRoleRepository.AsQueryable(false, true).Where(q => q.RoleId == id).Select(q => q.UserId).ToListAsync();
return ResultOutput.Ok(userrole);
}
@ -134,16 +131,16 @@ namespace ATS.NonCustodial.Application.Impl.Admins
// select new {urpm}).ToListAsync();
var usermenulis = await _MenuRepository.AsQueryable(false, true).ToListAsync();
var menulist = Mapper.Map<List<MenuListOutput>>(usermenulis);
foreach (var item in menulist.Distinct().Where(q => q.pid == 0||q.pid==null).OrderBy(q=>q.sort).ToList())
foreach (var item in menulist.Distinct().Where(q => q.pid == 0 || q.pid == null).OrderBy(q => q.sort).ToList())
{
rtnlist.Add(new
{
Id=item.Id,
Id = item.Id,
name = item.menuName,
route = item.menuUrl,
icon=item.icon,
icon = item.icon,
iconName = item.iconName,
Sublevel= menulist.Where(q=>q.pid== item.Id).ToList().OrderBy(q=> q.sort).Select(q=>new { q.Id, name=q.menuName, route=q.menuUrl}).ToList()
Sublevel = menulist.Where(q => q.pid == item.Id).ToList().OrderBy(q => q.sort).Select(q => new { q.Id, name = q.menuName, route = q.menuUrl }).ToList()
});
}
return ResultOutput.Ok(rtnlist);
@ -159,20 +156,28 @@ namespace ATS.NonCustodial.Application.Impl.Admins
{
var rtnlist = new List<dynamic>();
//查找当前用户角色权限菜单
var usermenulist = await (from ur in _userRoleRepository.AsQueryable(false, true).Where(q=>q.UserId==User.Id)
var usermenulist = await (from ur in _userRoleRepository.AsQueryable(false, true).Where(q => q.UserId == User.Id)
join urp in _rolePermissionRepository.AsQueryable(false, true) on ur.RoleId equals urp.RoleId
join urpm in _MenuRepository.AsQueryable(false, true) on urp.PermissionId equals urpm.Id
select new App_Menu{ Id=urpm.Id, menuName=urpm.menuName, icon=urpm.icon, iconName=urpm.iconName, pid=urpm.pid, sort=urpm.sort,
select new App_Menu
{
Id = urpm.Id,
menuName = urpm.menuName,
icon = urpm.icon,
iconName = urpm.iconName,
pid = urpm.pid,
sort = urpm.sort,
route = urpm.route,
menuUrl =urpm.menuUrl }).ToListAsync();
menuUrl = urpm.menuUrl
}).ToListAsync();
var menulist = Mapper.Map<List<MenuListOutput>>(usermenulist);
if (User.Name.Contains("aks"))
{
var list = await _MenuRepository.AsQueryable(false, true).ToListAsync();
menulist = Mapper.Map<List<MenuListOutput>>(list);
}
menulist= menulist.Where((x, i) => menulist.FindIndex(s => s.Id == x.Id) == i).ToList();
foreach (var item in menulist.Distinct().Where((q,x) => q.pid == 0 || q.pid == null).OrderBy(q => q.sort).ToList())
menulist = menulist.Where((x, i) => menulist.FindIndex(s => s.Id == x.Id) == i).ToList();
foreach (var item in menulist.Distinct().Where((q, x) => q.pid == 0 || q.pid == null).OrderBy(q => q.sort).ToList())
{
rtnlist.Add(new
{
@ -180,7 +185,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
name = item.menuName,
route = item.menuUrl,
icon = item.icon,
routes=item.route,
routes = item.route,
iconName = item.iconName,
Sublevel = menulist.Distinct().Where(q => q.pid == item.Id).ToList().OrderBy(q => q.sort).Select(q => new { q.Id, name = q.menuName, route = q.menuUrl, routes = q.route }).ToList()
});
@ -196,7 +201,7 @@ namespace ATS.NonCustodial.Application.Impl.Admins
[HttpPost]
public async Task<IResultOutput> GetPageAsync(UserGetPageDto input)
{
var express = GetExpression(input, _userRepository.AsQueryable(false, true).Where(q=>!q.UserName.Contains("aks")));
var express = GetExpression(input, _userRepository.AsQueryable(false, true).Where(q => !q.UserName.Contains("aks")));
var pageData = await base.GetPageAsync<AppUser, UserGetPageDto, UserListOutput>(input, express);
var userIds = pageData.Data.Select(w => w.Id).ToList();
@ -416,13 +421,13 @@ namespace ATS.NonCustodial.Application.Impl.Admins
var userRole = await IsAdmin(null);
if (inputlist == null) return ResultOutput.Ok();
else
await _userRoleRepository.DeleteAsync(q=>q.RoleId== inputlist[0].RoleId);//删除所有用户角色
await _userRoleRepository.DeleteAsync(q => q.RoleId == inputlist[0].RoleId);//删除所有用户角色
foreach (var item in inputlist)
{
item.Id = YitIdHelper.NextId();
}
await _userRoleRepository.InsertAsync(Mapper.Map<List<UserRoleAddInput>,List<AppUserRole>>(inputlist));
await _userRoleRepository.InsertAsync(Mapper.Map<List<UserRoleAddInput>, List<AppUserRole>>(inputlist));
return ResultOutput.Ok();
}
@ -533,7 +538,11 @@ namespace ATS.NonCustodial.Application.Impl.Admins
w => w.DataStatus)!);
if (input.RoleIds != null && input.RoleIds.Count() > 0)
{
await _userRoleRepository.DeleteAsync(a => a.UserId == user.Id && input.RoleIds.Contains(a.RoleId));
var roleList = await _roleRepository.AsQueryable(false, true)
.Where(w=> w.Code == "admin" || w.Code == "supervisor")
.Select(s=>s.Id).ToListAsync();
await _userRoleRepository.DeleteAsync(a => a.UserId == user.Id && roleList.Contains(a.RoleId));
if (input.RoleIds == null || !input.RoleIds.Any()) return ResultOutput.Ok();
{
@ -837,13 +846,24 @@ namespace ATS.NonCustodial.Application.Impl.Admins
/// <summary>
/// 根据当前登录用户查询下拉列表
/// </summary>
/// <param name="isCourt">移交给检察院 0 移交法院 1</param>
/// <returns></returns>
public async Task<ResultOutput<List<KeyValueDto>>> GetUserSelectList()
public async Task<ResultOutput<List<KeyValueDto>>> GetUserSelectList(int isCourt = 0)
{
var userRoles = await this.IsAdmin(null);
var dataDict = await _appDictionaryService.GetListNoApiAsync("job_position");
// 安全地处理可能的空值
var codeList = dataDict?.FirstOrDefault()?.Dictionaries?
.Where(w => w.Code == (isCourt == 0 ? "inquisitor" : "judge"))
.ToList() ?? new List<DictionaryGetOutput>();
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(codeList.Count>0,w=> w.PositionId == codeList.FirstOrDefault().Id)
// .WhereIf(!userRoles.IsAdmin, w => w.Id == User.Id) 2025 -10-20 段肖确认修改
.Select(w => new KeyValueDto()
{
@ -855,7 +875,26 @@ namespace ATS.NonCustodial.Application.Impl.Admins
return (ResultOutput<List<KeyValueDto>>)ResultOutput.Ok(rtn);
}
/// <summary>
/// 新建案件时 根据当前登录用户查询下拉列表
/// </summary>
/// <returns></returns>
public async Task<ResultOutput<List<KeyValueDto>>> GetNewUserSelectList()
{
var userRoles = await this.IsAdmin(null);
// var limits = User.UnitId;
var rtn = await _userRepository.AsQueryable(false, true)
.Where(w => w.ChatPersonType != ChatPersonTypeEnum.SupervisedPerson && w.DataStatus != DataStatusEnum.Disable && !w.UserName.Contains("_aks") && w.UnitId == User.UnitId)
.Select(w => new KeyValueDto()
{
Id = w.Id,
Text = w.UserName ?? w.Name,
Value = w.Id.ToString(),
Phone = w.Phone.ToString()
}).ToListAsync();
return (ResultOutput<List<KeyValueDto>>)ResultOutput.Ok(rtn);
}
/// <summary>
/// 获取所有的管理员
/// </summary>

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

@ -7,6 +7,7 @@ using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusinessAppl
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.Input;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseManagements.AppCaseManagement.Output;
using ATS.NonCustodial.Application.Contracts.Interfaces.Business.Apps.Output;
using ATS.NonCustodial.Application.Impl.Business.IM;
using ATS.NonCustodial.Domain.Entities.Admins;
@ -99,6 +100,32 @@ namespace ATS.NonCustodial.Application.Impl.Business
public async Task<IResultOutput> GetAsync(long id)
{
var rtn = await base.GetAsync<AppBusinessApplication, AppBusinessApplicationGetDto, long>(_appBusinessApplicationRepository, id);
if (rtn != null&& User.PositionId !=0)
{
//获取用户职位
var position = await _appDictionaryService.GetDicByDicId(User.PositionId);
var caseDto = await base.GetWithDataAsync<AppCaseManagement, AppCaseManagementGetDto, long>(_appCaseManagementRepository, rtn.CaseId);
//当前案件状态和登录人员职位相匹配时,才能修改
var permissionGranted = (caseDto.CaseProgress, position.Code) switch
{
(CaseProgressEnum.Pending, "police") => true,
(CaseProgressEnum.InExecution, "police") => true,
(CaseProgressEnum.Examination, "inquisitor") => true,
(CaseProgressEnum.Hear, "judge") => true,
_ => false
};
if (permissionGranted)
{
rtn.ReviewPermission = "1";
}
else
{
rtn.ReviewPermission = "0";
}
}
return ResultOutput.Ok(rtn);
}
@ -121,9 +148,14 @@ namespace ATS.NonCustodial.Application.Impl.Business
express = express.Where(w => caseIdList.Contains(w.CaseId));
var rtn = await base.GetPageAsync<AppBusinessApplication, AppBusinessApplicationGetPageInput, AppBusinessApplicationListDto>(input, express);
//rtn.Data = rtn.Data.Where(w => caseIdList.Contains(w.CaseId)).ToList();
var position = await _appDictionaryService.GetDicByDicId(User.PositionId);
//不同的申请,显示字段不一样
foreach (var item in rtn.Data)
{
var dic= await _appDictionaryService.GetDicByDicId(item.ApplicationTypeId);
var dic = await _appDictionaryService.GetDicByDicId(item.ApplicationTypeId);
if (dic.Code == "end_supervision")
{
item.ActiveTimePeriodBegin = null;
@ -133,6 +165,24 @@ namespace ATS.NonCustodial.Application.Impl.Business
{
item.EndSupervisionDate = null;
}
var caseDto = await base.GetWithDataAsync<AppCaseManagement, AppCaseManagementGetDto, long>(_appCaseManagementRepository, item.CaseId);
item.ReviewPermission = "0";
//当前案件状态和登录人员职位相匹配时,才能修改
var permissionGranted = (caseDto.CaseProgress, position.Code) switch
{
(CaseProgressEnum.Pending, "police") => true,
(CaseProgressEnum.InExecution, "police") => true,
(CaseProgressEnum.Examination, "inquisitor") => true,
(CaseProgressEnum.Hear, "judge") => true,
_ => false
};
if (permissionGranted)
{
item.ReviewPermission = "1";
}
}
return ResultOutput.Ok(rtn);
}
@ -196,10 +246,10 @@ namespace ATS.NonCustodial.Application.Impl.Business
w = w.AndNotNull(w =>
w.ApplicationTypeId == input.ApplicationTypeId &&
w.ActiveTimePeriodBegin == input.ActiveTimePeriodBegin &&
w.ActiveTimePeriodEnd == input.ActiveTimePeriodEnd
w.ActiveTimePeriodEnd == input.ActiveTimePeriodEnd &&
w.SupervisedPersonId == User.Id
, input.ApplicationTypeId != default);
msg = $"当前申请类型{input.ApplicationTypeId}在当前时间段:{input.ActiveTimePeriodBegin}-{input.ActiveTimePeriodEnd}已存在";
msg = $"当前申请类型{applicationType.Name}在当前时间段:{input.ActiveTimePeriodBegin}-{input.ActiveTimePeriodEnd}已存在";
return (w, msg);
});
@ -312,6 +362,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
});
await _appBusinessApplicationRepository.UpdateAsync(dataList);
//当被监管人申请结束监管,判断此案件只有一个被监管人时,结束案件
foreach (var item in dataList)
{
var caseType = await _appDictionaryService.GetDicByDicId(item.ApplicationTypeId);

10
src/2.services/ATS.NonCustodial.Application/Impl/Business/AppEarlyWarningService.cs

@ -305,6 +305,8 @@ namespace ATS.NonCustodial.Application.Impl.Business
var express = await GetExpression(input, _appEarlyWarningRepository.AsQueryable(false, true));
// 先应用案件ID过滤条件
express = express.Where(w => caseIdList.Contains(w.CaseId));
// 然后再获取分页数据
return await base.GetEntityAddPageAsync<AppEarlyWarning, AppEarlyWarningGetPageInput, AppEarlyWarningListDto>(input, express);
}
@ -475,7 +477,15 @@ namespace ATS.NonCustodial.Application.Impl.Business
.WhereIf(pageInput.UserSearch != null, p => p.SupervisedPersonId == pageInput.UserSearch!.ModifiedUserId);
var express = base.GetEntityAddExpression<AppEarlyWarning, AppEarlyWarningGetPageInput, long>(pageInput, query);
var userRole = await _userService.IsAdmin(null);
//非管理员只能看到自己监管的案件
if (!userRole.IsAdmin)
{
var supervisorCaseList = await _appCaseSupervisorRepository.AsQueryable(false, true)
.Where(w => w.SupervisorId == User.Id).Select(s => s.CaseId).ToListAsync();
express = express.Where(w => supervisorCaseList.Contains(w.Id));
}
return express;
}

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

@ -448,7 +448,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
var data = await _appCaseManagementService.GetCaseSuperviseList();
var caseIds = data.Where(w=> caseIdList.Contains(w.CaseId)).Select(w => w.CaseId).ToList();
var caseIds = data.Where(w => caseIdList.Contains(w.CaseId)).Select(w => w.CaseId).ToList();
//业务申请列表
var businessList = await _appBusinessApplicationRepository
@ -837,6 +837,9 @@ namespace ATS.NonCustodial.Application.Impl.Business
/// <returns></returns>
[HttpPost]
public async Task<IResultOutput> AddAppBusinessAsync(AppBusinessApplicationCreateOrModifyInput input)
{
var result = await _appBusinessApplicationService.CreateOrModify(input);
if (result.Code == 200)
{
//根据案件找监管人,找到多个,均发送消息提醒
var currentUserCase = await base.GetCurrentSupervisePersonProcessingCase(User.Id);
@ -855,7 +858,8 @@ namespace ATS.NonCustodial.Application.Impl.Business
//发短信给监管人,提醒处理审批
await _smsService.SendMessageSMS(MessageAlertTypeEnum.ReviewNotification, user.FirstOrDefault().UserName, user.FirstOrDefault().Phone, DateTime.Now, dic.Name, "", currentUserCase.SupervisedPersonName);
}
return await _appBusinessApplicationService.CreateOrModify(input);
}
return result;
}
/// <summary>
@ -1181,7 +1185,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
join ev in _appEarlyWarningViewStatisticsRepository.AsQueryable(false, true) on e.Id equals ev.AppEarlyWarningId
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
where ev.SubscriberId == User.Id && caseIdList.Contains(e.CaseId) && cm.CaseProgress != CaseProgressEnum.Closed
select new AppRemindListDto()
{
Id = e.Id,
@ -1197,7 +1201,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
EarlyWarningTypeId = e.EarlyWarningTypeId
})
.WhereIf(input.CheckStatus.HasValue, w => w.CheckStatus == input.CheckStatus)
.WhereIf(input.EarlyWarningTypeId.HasValue,w=>w.EarlyWarningTypeId == input.EarlyWarningTypeId)
.WhereIf(input.EarlyWarningTypeId.HasValue, w => w.EarlyWarningTypeId == input.EarlyWarningTypeId)
.ToListAsync();
earlyList = earlyList.Distinct((x, y) => x.CaseId == y.CaseId && x.SupervisedPersonId == y.SupervisedPersonId && x.CreatedTime == y.CreatedTime).OrderByDescending(q => q.CreatedTime).ToList();
if (!input.CheckStatus.HasValue)
@ -1318,6 +1322,9 @@ namespace ATS.NonCustodial.Application.Impl.Business
.ToListAsync();
var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList();
var data = (await base.GetCurrentUserCaseListAsync())
.Where(W => W.AppCaseManagement != null && W.AppCaseSupervisedPerson != null && W.AppCaseSupervisor != null && W.AppCaseManagement.CaseProgress != CaseProgressEnum.Pending && caseIdList.Contains(W.AppCaseManagement.Id) && caseIdList.Contains(W.AppCaseSupervisedPerson.CaseId) && caseIdList.Contains(W.AppCaseSupervisor.CaseId))
.WhereIf(name.NotNull(), w => w.AppCaseSupervisedPerson.SupervisedPersonName!.Contains(name))

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.Substring(input.PunchVideo.LastIndexOf("/upload/admin"));
//就是那个傻逼App开发人员啥都不想传
var entity = Mapper.Map<AppPunchRecordStatistics>(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
});
}
}

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

@ -123,6 +123,7 @@ namespace ATS.NonCustodial.Application.Impl.Business
//查询记录
var query = await _appEarlyWarningRepository
.AsQueryable(false, true).Where(q => spIds.Contains(q.SupervisedPersonId))
.Where(w=> caseIdList.Contains(w.CaseId))
.WhereIf(input.CaseId != default, a => a.CaseId == input.CaseId)
.WhereIf(input.SupervisedPersonId != default, w => w.SupervisedPersonId == input.SupervisedPersonId)
.WhereIf(input.SupervisedPersonName.HasValue(), w => w.SupervisedPersonName.Contains(input.SupervisedPersonName))
@ -310,11 +311,14 @@ namespace ATS.NonCustodial.Application.Impl.Business
.Where(w => limits.Contains(w.UnitId.ToString()))
.ToListAsync();
var caseIdList = 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 caseList = await _appCaseManagementRepository.AsQueryable(false, true)
.Where(w => caseIdList.Contains(w.Id))
.WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId)
.WhereIf(!userRole.IsAdmin, w => supervisorCaseList.Contains(w.Id))
.ToListAsync();
var applicationType = await base.GetDictionariesOutput("early_warning_type", "notClocked");
@ -378,11 +382,14 @@ namespace ATS.NonCustodial.Application.Impl.Business
.Where(w => limits.Contains(w.UnitId.ToString()))
.ToListAsync();
var caseIdList = 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 caseList = await _appCaseManagementRepository.AsQueryable(false, true)
.Where(w => caseIdList.Contains(w.Id))
.WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId)
.WhereIf(!userRole.IsAdmin, w => supervisorCaseList.Contains(w.Id))
.ToListAsync();
var applicationType = await base.GetDictionariesOutput("early_warning_type", "LeaveArea");
@ -434,6 +441,74 @@ namespace ATS.NonCustodial.Application.Impl.Business
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 userRole = await _userService.IsAdmin(null);
var supervisorCaseList = await _appCaseSupervisorRepository.AsQueryable(false, true)
.Where(w => w.SupervisorId == User.Id).Select(s => s.CaseId).ToListAsync();
var caseList = await _appCaseManagementRepository.AsQueryable(false, true)
.Where(w => caseIdList.Contains(w.Id))
.WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId)
.WhereIf(!userRole.IsAdmin, w => supervisorCaseList.Contains(w.Id))
.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>
@ -447,11 +522,14 @@ namespace ATS.NonCustodial.Application.Impl.Business
.Where(w => limits.Contains(w.UnitId.ToString()))
.ToListAsync();
var caseIdList = 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 caseList = await _appCaseManagementRepository.AsQueryable(false, true)
.Where(w => caseIdList.Contains(w.Id))
.WhereIf(input.CaseId.HasValue, w => w.Id == input.CaseId)
.WhereIf(!userRole.IsAdmin, w => supervisorCaseList.Contains(w.Id))
.ToListAsync();
var applicationType = await base.GetDictionariesOutput("early_warning_type", "notClocked");
@ -466,7 +544,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)

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

@ -30,9 +30,7 @@ using Castle.Components.DictionaryAdapter;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using SixLabors.ImageSharp;
using System.Linq;
using Yitter.IdGenerator;
@ -149,15 +147,65 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.ToListAsync();
var caseIdList = selectLimits.Select(w => w.CaseId).Distinct().ToList();
//当前用户角色
var userRole = await _userService.IsAdmin(null);
var express = await GetExpression(input, _appCaseManagementRepository.AsQueryable(false, true));
// 先应用案件ID过滤条件
express = express.Where(w => caseIdList.Contains(w.Id));
//非管理员只能看到自己监管的案件
if(!userRole.IsAdmin)
{
var supervisorCaseList = await _appCaseSupervisorRepository.AsQueryable(false, true)
.Where(w => w.SupervisorId == User.Id).Select(s => s.CaseId).ToListAsync();
express= express.Where(w => supervisorCaseList.Contains(w.Id));
}
var rtn = await base.GetPageAsync<AppCaseManagement, AppCaseManagementGetPageInput, AppCaseManagementListDto>(input, express);
var position = await _appDictionaryService.GetDicByDicId(User.PositionId);
foreach (var listDto in rtn.Data)
{
listDto.Supervisor = selectLimits.Where(w => w.CaseId == listDto.Id).Select(w => w.SupervisorName).JoinAsString(",");
listDto.Supervisor = (await _appCaseSupervisorRepository.AsQueryable(false, true)
.Where(w => w.CaseId == listDto.Id).Select(w => w.SupervisorName).ToListAsync()).JoinAsString(",");
if (listDto.CaseProgress == CaseProgressEnum.Pending)
{
listDto.ReviewPermission = "0";//显示编辑按钮
}
else if (listDto.CaseProgress == CaseProgressEnum.InExecution)
{
listDto.ReviewPermission = "1";//显示编辑按钮 移送检察院按钮
}
else if (listDto.CaseProgress == CaseProgressEnum.Examination)
{
if (position.Code == "inquisitor" )
{
listDto.ReviewPermission = "3";//显示移送法院 结束案件
}
else
{
listDto.ReviewPermission = "2";//显示查看按钮
}
}
else if (listDto.CaseProgress == CaseProgressEnum.Hear)
{
if (position.Code == "judge")
{
listDto.ReviewPermission = "4";//显示查看 结束案件
}
else
{
listDto.ReviewPermission = "2";//显示查看按钮
}
}
else
{
listDto.ReviewPermission = "2";//显示查看按钮
}
}
return ResultOutput.Ok(rtn);
@ -252,7 +300,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
//获取案件信息
var express = await base.GetCurrentUserCaseListAsync();
express = express.Where(w =>w.AppCaseManagement!=null && caseIdList.Contains(w.AppCaseManagement.Id)&& w.AppCaseSupervisedPerson != null && caseIdList.Contains(w.AppCaseSupervisedPerson.CaseId)&& w.AppCaseSupervisor != null && caseIdList.Contains(w.AppCaseSupervisor.CaseId));
express = express.Where(w => w.AppCaseManagement != null && caseIdList.Contains(w.AppCaseManagement.Id) && w.AppCaseSupervisedPerson != null && caseIdList.Contains(w.AppCaseSupervisedPerson.CaseId) && w.AppCaseSupervisor != null && caseIdList.Contains(w.AppCaseSupervisor.CaseId));
//案件信息Id
@ -289,7 +337,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
var diclist = new List<dynamic>();
//获取当前用户能看到的数据Id
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 express = await _appCaseManagementRepository.AsQueryable(false, true).Where(q => caseIds.Contains(q.Id)).ToListAsync();
var otherexpress = express;
@ -517,11 +565,11 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
var validSpCase = await ValidSupervisedPerson(input);
if (!validSpCase.Success) return validSpCase;
if(input.Threshold>=int.MaxValue)
if (input.Threshold >= int.MaxValue)
{
return ResultOutput.NotOk("预警阈值输入数字过大");
}
if (input.Threshold <0)
if (input.Threshold < 0)
{
return ResultOutput.NotOk("预警阈值不能为负数");
}
@ -541,7 +589,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
else
{
var entity = Mapper.Map<AppCaseManagement>(input);
if(entity.Threshold==0)
if (entity.Threshold == 0)
{
entity.Threshold = 5;
}
@ -929,22 +977,27 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.Where(w => limits.Contains(w.UnitId.ToString()))
.ToListAsync();
var caseIdList = 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 query = _appCaseManagementRepository
.AsQueryable(false, true)
.Where(w => w.CaseProgress == CaseProgressEnum.Closed)
.Where(w => w.CaseProgress == CaseProgressEnum.Closed && caseIdList.Contains(w.Id))
.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.EndTime.Length == 2, w => w.CaseClosedTime > input.TimeSearch.EndTime[0] && w.CaseClosedTime <= input.TimeSearch.EndTime[1].AddDays(1))
.Where(w => caseIdList.Contains(w.Id));
.WhereIf(!userRole.IsAdmin , w=>supervisorCaseList.Contains(w.Id));
var pageData = await
query.ProjectTo<CaseStatisticsHandlingTimeListDto>(Mapper.ConfigurationProvider)
.PagedAsync(input)
.ConfigureAwait(false);
var caseIds = pageData.Data.Select(w => w.Id);
//涉事人员(被监管人员)
var personInvolvedList = await _appSupervisedPersonRepository
.AsQueryable(false, true)
@ -978,6 +1031,10 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.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 data = await _appCaseManagementRepository.AsQueryable(false, true)
.Where(w => caseIds.Contains(w.Id))
@ -985,6 +1042,7 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
.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.ajtype.NotNull(), w => w.CaseTypeId == input.ajtype.ToLong())
.WhereIf(!userRole.IsAdmin, w => supervisorCaseList.Contains(w.Id))
.ToListAsync();
var dataGroup = data.GroupBy(w => w.CaseTypeId);
@ -1190,8 +1248,8 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
var dataDict = await _appDictionaryService.GetListNoApiAsync(null);
var caseList = (await (await base.GetCurrentUserCaseListAsync()).ToListAsync())
.Where(w => w.AppCaseManagement!=null && w.AppCaseManagement.CaseProgress != CaseProgressEnum.Closed && caseIdList.Contains(w.AppCaseManagement.Id)
&&w.AppCaseSupervisedPerson!=null && caseIdList.Contains(w.AppCaseSupervisedPerson.CaseId)&&w.AppCaseSupervisor !=null && caseIdList.Contains(w.AppCaseSupervisor.CaseId))
.Where(w => w.AppCaseManagement != null && w.AppCaseManagement.CaseProgress != CaseProgressEnum.Closed && caseIdList.Contains(w.AppCaseManagement.Id)
&& w.AppCaseSupervisedPerson != null && caseIdList.Contains(w.AppCaseSupervisedPerson.CaseId) && w.AppCaseSupervisor != null && caseIdList.Contains(w.AppCaseSupervisor.CaseId))
.OrderByDescending(w => w.AppCaseSupervisedPerson?.CreatedTime)
.Skip(0)
.Take(5)
@ -1633,11 +1691,12 @@ namespace ATS.NonCustodial.Application.Impl.Business.CaseManagements
//var appSupervisedlist = from a in base._appCaseManagementRepository.AsQueryable(false, true).Where(q => q.CaseProgress != CaseProgressEnum.Closed)
// join b in _appSupervisedPersonRepository.AsQueryable(false, true) on a.Id equals b.CaseId
// select b;
var caseIdList = caselist.Where(w => caseIds.Contains(w.Id)).Select(s => s.Id);
var appSupervisedlist = from a in base._appCaseManagementRepository.AsQueryable(false, true)
join b in _appSupervisedPersonRepository.AsQueryable(false, true) on a.Id equals b.CaseId
select b;
var data = await appSupervisedlist
.Where(q => caseIds.Contains(q.CaseId))
.Where(q => caseIdList.Contains(q.CaseId))
.WhereIf(input.TimeSearch?.BeginTime != null && input.TimeSearch?.EndTime != null, q => q.CreatedTime >= input.TimeSearch.BeginTime && q.CreatedTime <= $"{input.TimeSearch.EndTime.Value.ToString("yyyy-MM-dd")} 23:59:59".ToDateTime())
.WhereIf(input.name.NotNull(), q => q.SupervisedPersonName.Contains(input.name))
.OrderByDescending(r => r.CreatedTime)

6
src/2.services/ATS.NonCustodial.Application/Impl/Business/MaterialManager/AppFileAccessRecordsService.cs

@ -161,10 +161,14 @@ namespace ATS.NonCustodial.Application.Impl.Business.MaterialManager
.Where(w => limits.Contains(w.UnitId.ToString()))
.ToListAsync();
var caseIdList = 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 caseIds = await (await base.GetCurrentUserCaseListAsync()).Select(w => w.AppCaseManagement.Id).ToListAsync();
var SupervisedPersonIds = await base._appSupervisedPersonRepository.AsQueryable(false, true).Where(q => caseIdList.Contains(q.CaseId)).Select(q=>q.SupervisedPersonId).ToListAsync();
var SupervisedPersonIds = await base._appSupervisedPersonRepository.AsQueryable(false, true).Where(q => caseIdList.Contains(q.CaseId))
.WhereIf(!userRole.IsAdmin, w => supervisorCaseList.Contains(w.CaseId)).Select(q=>q.SupervisedPersonId).ToListAsync();
//获取监管人查阅次数
var queryable = await GetExpression(input, _appFileAccessRecordsRepository.AsQueryable(false, true).Where(q=> SupervisedPersonIds.Contains(q.SupervisedPersonId)))
.ToListAsync();

10
src/2.services/ATS.NonCustodial.Application/Impl/Logs/OperationLogService.cs

@ -53,7 +53,7 @@ namespace ATS.NonCustodial.Application.Impl.Logs
[HttpPost]
public async Task<IResultOutput> GetPageAsync(LogGetPageDto input)
{
var express = await GetExpression(input, _oprationLogRepository.AsQueryable(false, true).Take(3000));
var express = await GetExpression(input);
var rtn = await base.GetPageAsync<AppOperationLog, LogGetPageDto, OprationLogListOutput>(input, express);
return ResultOutput.Ok(rtn);
@ -133,15 +133,17 @@ namespace ATS.NonCustodial.Application.Impl.Logs
/// <param name="pageInput"></param>
/// <param name="query"></param>
/// <returns></returns>
private async Task<IQueryable<AppOperationLog>> GetExpression(LogGetPageDto pageInput, IQueryable<AppOperationLog?> query)
private async Task<IQueryable<AppOperationLog>> GetExpression(LogGetPageDto pageInput)
{
var userIds = await _appCaseManagementService.GetUserIdListByCurrentUser();
query = query
var query = _oprationLogRepository.AsQueryable(false, true)
.Where(w => w.CreatedUserId != null && userIds.Contains(w.CreatedUserId.Value))
.WhereIf(pageInput.OperatorName.NotNull(), w => w.CreatedUserName.Contains(pageInput.OperatorName))
.WhereIf(pageInput.Device.NotNull(), w => w.Device==pageInput.Device)
.WhereIf(pageInput.NickName.NotNull(), w => w.NickName==pageInput.NickName);
.WhereIf(pageInput.NickName.NotNull(), w => w.NickName==pageInput.NickName)
.OrderByDescending(w=>w.CreatedTime)
.Take(3000);
var express = base.GetEntityAddExpression<AppOperationLog, LogGetPageDto, long>(pageInput, query);

5
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/SMS/Output/SmsListDto.cs

@ -46,5 +46,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.SMS.Output
/// 详细描述
/// </summary>
public string? Message { get; set; }
/// <summary>
/// 接收人姓名
/// </summary>
public string? Receiver { get; set; }
}
}

7
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/Unitcode/Output/UnitcodeListOutput.cs

@ -1,4 +1,6 @@
using ATS.NonCustodial.Domain.Shared.AggRootEntities;
using ATS.NonCustodial.Domain.Shared.Constants;
using System.ComponentModel.DataAnnotations;
namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Unitcode.Output
{
@ -18,5 +20,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.Unitcode.Outp
/// 父级编码
/// </summary>
public long? ParentUnitCode { get; set; }
/// <summary>
/// 单位级别
/// </summary>
public string? UnitLevel { get; set; }
}
}

4
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Admins/User/IUserService.cs

@ -218,8 +218,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Admins.User
/// 根据当前登录用户查询下拉列表
/// </summary>
/// <returns></returns>
Task<ResultOutput<List<KeyValueDto>>> GetUserSelectList();
Task<ResultOutput<List<KeyValueDto>>> GetUserSelectList(int isCourt = 0);
Task<ResultOutput<List<KeyValueDto>>> GetNewUserSelectList();
/// <summary>
/// 获取所有的管理员
/// </summary>

14
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationGetDto.cs

@ -17,6 +17,10 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusiness
/// </summary>
public AuditStatusEnum AuditStatus { get; set; }
/// <summary>
/// 案子Id
/// </summary>
public long CaseId { get; set; }
/// <summary>
/// 审核状态描述
/// </summary>
@ -76,5 +80,15 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusiness
/// 审核时间
/// </summary>
public DateTime? AuditTime { get; set; }
/// <summary>
/// 结束监管日期
/// </summary>
public DateTime? EndSupervisionDate { get; set; }
/// <summary>
/// 审核权限(1 有权限 0 无权限)
/// </summary>
public string? ReviewPermission { get; set; }
}
}

5
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppBusinessApplications/Output/AppBusinessApplicationListDto.cs

@ -90,6 +90,9 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppBusiness
/// </summary>
public string? ApplicationDescription { get; set; }
/// <summary>
/// 审核权限(1 有权限 0 无权限)
/// </summary>
public string? ReviewPermission { get; set; }
}
}

6
src/3.contracts/ATS.NonCustodial.Application.Contracts/Interfaces/Business/AppCaseManagements/AppCaseManagement/Output/AppCaseManagementListDto.cs

@ -78,5 +78,11 @@ namespace ATS.NonCustodial.Application.Contracts.Interfaces.Business.AppCaseMana
/// 监管人名
/// </summary>
public string? Supervisor { get; set; }
/// <summary>
/// 按钮权限
/// </summary>
public string? ReviewPermission { get; set; }
}
}

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>
/// <returns></returns>
Task<IResultOutput> LeaveAreaStatisticsPageAsync(NotClockedInput input);
/// <summary>
/// 越界统计导出
/// </summary>
/// <returns></returns>
Task<IActionResult> LeaveAreaStatisticsExportAsync(NotClockedInput input);
/// <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; }
}
}

2
src/5.shared/ATS.NonCustodial.Domain.Shared/Enums/CaseProgressEnum.cs

@ -34,7 +34,7 @@ namespace ATS.NonCustodial.Domain.Shared.Enums
Examination = 3,
/// <summary>
/// 审查起诉阶段
/// 审阶段
/// </summary>
[Description("审理阶段")]
Hear = 4,

5
src/5.shared/ATS.NonCustodial.Shared/Common/Auth/ClaimAttributes.cs

@ -86,7 +86,10 @@ namespace ATS.NonCustodial.Shared.Common.Auth
/// </summary>
public const string personType = "persontype";
/// <summary>
/// 职位类型转换为枚举
/// </summary>
public const string positionId = "positionId";
/// <summary>
/// 查询界限
/// </summary>

5
src/5.shared/ATS.NonCustodial.Shared/Common/Auth/IUser.cs

@ -51,6 +51,11 @@ namespace ATS.NonCustodial.Shared.Common.Auth
/// </summary>
string NickName { get; }
/// <summary>
/// 职位(检察官、公安、法官)
/// </summary>
long PositionId { get; }
/// <summary>
/// 查询界限

18
src/5.shared/ATS.NonCustodial.Shared/Common/Auth/User.cs

@ -159,7 +159,7 @@ namespace ATS.NonCustodial.Shared.Common.Auth
}
/// <summary>
/// 昵称
/// 查询权限
/// </summary>
public string limits
{
@ -175,7 +175,23 @@ namespace ATS.NonCustodial.Shared.Common.Auth
return "";
}
}
/// <summary>
/// 职位(检察官、公安、法官)
/// </summary>
public long PositionId
{
get
{
var positionId = _accessor?.HttpContext?.User?.FindFirst(ClaimAttributes.positionId);
if (positionId != null && positionId.Value.NotNull())
{
return (long)positionId.Value.ToLong();
}
return 0;
}
}
/// <summary>
/// 是否管理员
/// </summary>

Loading…
Cancel
Save