feat 记录查询接口
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Basic.Device.Services;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -38,4 +40,15 @@ public class DevicePermissionsController : ControllerBase
|
||||
{
|
||||
return await _devicePermissionService.GetAssignmentsAsync(request.UniqueType, request.AssignType, request.AssignValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户权限设备
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("assignmentsbycode")]
|
||||
public async Task<Pagination<AssigmentByCodeResponse>> GetAssigmentByCodeAsync([FromQuery] AssigmentByCodeRequest request)
|
||||
{
|
||||
return await _devicePermissionService.GetAssigmentByCodeAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
15
Src/Dlhis.Basic/Device/Request/AssigmentByCodeRequest.cs
Normal file
15
Src/Dlhis.Basic/Device/Request/AssigmentByCodeRequest.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request
|
||||
{
|
||||
public class AssigmentByCodeRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string No { get; set; }
|
||||
}
|
||||
}
|
||||
17
Src/Dlhis.Basic/Device/Response/AssigmentByCodeResponse.cs
Normal file
17
Src/Dlhis.Basic/Device/Response/AssigmentByCodeResponse.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Device.Response
|
||||
{
|
||||
public class AssigmentByCodeResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备唯一码,IP/MAC/SNO
|
||||
/// </summary>
|
||||
public string UniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
public string UniqueName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
@@ -47,4 +49,11 @@ public interface IDevicePermissionService : IScopeDependency
|
||||
/// <param name="userNo"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<Guid>> GetAssignDeviceCodesAsync(string userNo);
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户权限设备
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task<Pagination<AssigmentByCodeResponse>> GetAssigmentByCodeAsync(AssigmentByCodeRequest request);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Entity.Sys.Enums;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Attributes;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
@@ -322,6 +325,56 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户权限设备
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Pagination<AssigmentByCodeResponse>> GetAssigmentByCodeAsync(AssigmentByCodeRequest request)
|
||||
{
|
||||
//所有设备guid
|
||||
var gds = await GetAssignmentsAsync(DeviceAssignmentTypeEnumType.Device, AssignTypeEnumType.User, request.No);
|
||||
|
||||
//所有设备组guid
|
||||
var ggs = await GetAssignmentsAsync(DeviceAssignmentTypeEnumType.Group, AssignTypeEnumType.User, request.No);
|
||||
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().ToListAsync();
|
||||
|
||||
if(ggs != null && ggs.Count > 0)
|
||||
{
|
||||
foreach (var gid in ggs)
|
||||
{
|
||||
var ds = await _dbContext.Queryable<DeviceGroupRelationshipEntity>()
|
||||
.Where(x => x.GroupCode == gid)
|
||||
.Select(x => x.DeviceCode)
|
||||
.ToListAsync();
|
||||
gds.AddRange(ds);
|
||||
}
|
||||
}
|
||||
|
||||
var dds = gds.Distinct().ToList();
|
||||
var lst = devices.Where(x => dds.Contains(x.Code))
|
||||
.Select(x => new AssigmentByCodeResponse
|
||||
{
|
||||
UniqueNo = x.UniqueNo,
|
||||
UniqueName = x.Supplier
|
||||
}).ToList();
|
||||
|
||||
// 分页操作
|
||||
var startIndex = (request.PageIndex - 1) * request.PageSize;
|
||||
var pagedData = lst.Skip(startIndex).Take(request.PageSize).ToList();
|
||||
|
||||
var pagination = new Pagination<AssigmentByCodeResponse>
|
||||
{
|
||||
PageIndex = request.PageIndex,
|
||||
PageSize = request.PageSize,
|
||||
Total = lst.Count, // 使用原始列表的总数进行分页
|
||||
Data = pagedData
|
||||
};
|
||||
|
||||
return pagination;
|
||||
|
||||
}
|
||||
|
||||
//************************************************ help methods *******************************************************
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using Kurisu.AspNetCore.MVC;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Controllers;
|
||||
|
||||
@@ -134,5 +135,26 @@ public class GainfosController : ControllerBase
|
||||
{
|
||||
return await _gainfoService.GetFaceByUserCodesAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("gainfolist")]
|
||||
public async Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync([FromQuery]GainfoListRequest request)
|
||||
{
|
||||
return await _gainfoService.GetGainfoListTaskAsync(request);
|
||||
}
|
||||
/// <summary>
|
||||
/// 档案详情
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("gainfodetail")]
|
||||
public async Task<Pagination<GainfoDetailResponse>> GetGainfoDetailTaskAsync([FromQuery] GainfoDetailRequest request)
|
||||
{
|
||||
return await _gainfoService.GetGainfoDetailTaskAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
21
Src/Dlhis.Basic/Organization/Request/GainfoDetailRequest.cs
Normal file
21
Src/Dlhis.Basic/Organization/Request/GainfoDetailRequest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using SqlSugar;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request
|
||||
{
|
||||
public class GainfoDetailRequest : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案类型
|
||||
/// </summary>
|
||||
[Required]
|
||||
public GainfoStatusEnumType Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
}
|
||||
}
|
||||
35
Src/Dlhis.Basic/Organization/Request/GainfoListRequest.cs
Normal file
35
Src/Dlhis.Basic/Organization/Request/GainfoListRequest.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Request
|
||||
{
|
||||
public class GainfoListRequest:PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案类型
|
||||
/// </summary>
|
||||
[Required]
|
||||
public GainfoStatusEnumType Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
114
Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs
Normal file
114
Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response
|
||||
{
|
||||
public class GainfoDetailResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// SAP内部编号
|
||||
/// </summary>
|
||||
public string SapNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 证件类型代码
|
||||
/// </summary>
|
||||
public string IdClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public GenderEnumType Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证籍贯
|
||||
/// </summary>
|
||||
public string NativeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
public DateTime Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位
|
||||
/// </summary>
|
||||
public string Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职等
|
||||
/// </summary>
|
||||
public string Grade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学历
|
||||
/// </summary>
|
||||
public string Degree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
public string Werks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成本中心
|
||||
/// </summary>
|
||||
public string CostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 已婚/未婚
|
||||
/// </summary>
|
||||
public string Marital { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string CountryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 民族代码
|
||||
/// </summary>
|
||||
public string NationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否在职
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; }
|
||||
}
|
||||
}
|
||||
60
Src/Dlhis.Basic/Organization/Response/GainfoListResponse.cs
Normal file
60
Src/Dlhis.Basic/Organization/Response/GainfoListResponse.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response
|
||||
{
|
||||
public class GainfoListResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 档案号
|
||||
/// </summary>
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string IdNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public GenderEnumType Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
/// </summary>
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份证地址
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在职状态
|
||||
/// </summary>
|
||||
public string Employed { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,8 @@ public interface IGainfoService : IScopeDependency
|
||||
Task<string> GetFaceByUserCodeAsync(string userCode);
|
||||
|
||||
Task<Dictionary<string, string>> GetFaceByUserCodesAsync(GetFaceByUserCodesRequest request);
|
||||
|
||||
Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync(GainfoListRequest request);
|
||||
|
||||
Task<Pagination<GainfoDetailResponse>> GetGainfoDetailTaskAsync(GainfoDetailRequest request);
|
||||
}
|
||||
|
||||
@@ -308,6 +308,74 @@ public class GainfoService : IGainfoService
|
||||
return faceDictionary;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Pagination<GainfoListResponse>> GetGainfoListTaskAsync( GainfoListRequest request)
|
||||
{
|
||||
var page = await _gainfoStore.Queryable(request.Status)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.WhereIF(!request.Name.IsEmpty(), ga => ga.Name == request.Name)
|
||||
.WhereIF(!request.IdNo.IsEmpty(), ga => ga.IdNo == request.IdNo)
|
||||
.WhereIF(!request.DepartmentNo.IsEmpty(), ga => ga.DepartmentNo == request.DepartmentNo)
|
||||
.WhereIF(!request.Code.IsEmpty(), ga => ga.Code == request.Code)
|
||||
.Select((ga, de) => new GainfoListResponse
|
||||
{
|
||||
No = ga.No,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
Phone = ga.Phone,
|
||||
DepartmentNo = de.No,
|
||||
DepartmentName = de.Name,
|
||||
Address = ga.Address,
|
||||
Employed = ga.Employed
|
||||
}).ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
/// <summary>
|
||||
/// 档案详情
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Pagination<GainfoDetailResponse>> GetGainfoDetailTaskAsync(GainfoDetailRequest request)
|
||||
{
|
||||
var page = await _gainfoStore.Queryable(request.Status)
|
||||
.LeftJoin<DepartmentEntity>((ga, de) => ga.DepartmentNo == de.No)
|
||||
.LeftJoin<BasicTypeEntity>((ga,de,type) => ga.Native == type.Code && type.Type == "native")
|
||||
.LeftJoin<PositionEntity>((ga, de, type,posi) => ga.Position == posi.Name)
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi,type2) => ga.CountryNo == type2.Code && type2.Type == "country")
|
||||
.LeftJoin<BasicTypeEntity>((ga, de, type, posi, type2,type3) => ga.Nation == type3.Code && type3.Type == "nation")
|
||||
.Where(ga => ga.No == request.No)
|
||||
.Select((ga, de,type,posi,type2, type3) => new GainfoDetailResponse
|
||||
{
|
||||
No = ga.No,
|
||||
SapNo = ga.SapNo,
|
||||
Name = ga.Name,
|
||||
Code = ga.Code,
|
||||
DepartmentName = de.Name,
|
||||
IdClass = ga.IdClass,
|
||||
IdNo = ga.IdNo,
|
||||
Gender = ga.Gender,
|
||||
NativeName = type.Display,
|
||||
Address = ga.Address,
|
||||
Birthday = ga.Birthday,
|
||||
Phone = ga.Phone,
|
||||
Position = ga.Position,
|
||||
Grade = posi.Grade,
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = ga.Marital,
|
||||
CountryName = type2.Display,
|
||||
NationName = type3.Display,
|
||||
IsActive = ga.Employed == "Active" ? true : false,
|
||||
}).ToPageListAsync(request);
|
||||
return page;
|
||||
}
|
||||
|
||||
//-------------------------------------------help methods ------------------------------------------------
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ApkFIileService : IApkFIileService
|
||||
{
|
||||
try
|
||||
{
|
||||
var filePath = "D:\\apk\\";
|
||||
var filePath = "C:\\apk\\";
|
||||
|
||||
// 创建存储文件夹
|
||||
if (!Directory.Exists(filePath))
|
||||
@@ -169,7 +169,7 @@ public class ApkFIileService : IApkFIileService
|
||||
/// <returns></returns>
|
||||
public IActionResult FormLocalDownloadFile(string fileName)
|
||||
{
|
||||
var filePath = "D:\\apk\\";
|
||||
var filePath = "C:\\apk\\";
|
||||
string path = filePath + fileName;
|
||||
return new FileStreamResult(new FileStream(path, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
|
||||
}
|
||||
|
||||
@@ -32,4 +32,14 @@ public class DeviceTaskAssignmentsController : ControllerBase
|
||||
{
|
||||
return await _deviceTaskAssignmentService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// (考勤/门禁/消费机)任务记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("taskrecords")]
|
||||
public async Task<TaskRecordsResponse> GetTaskRecords([FromQuery]TaskRecordsRequest request)
|
||||
{
|
||||
return await _deviceTaskAssignmentService.GetTaskRecords(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Request
|
||||
{
|
||||
public class TaskRecordsRequest : PageDto
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 人员档案号
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string GainfoNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备功能
|
||||
/// </summary>
|
||||
[Required]
|
||||
public DeviceFuncEnumType type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using SqlSugar.DbConvert;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Response
|
||||
{
|
||||
public class TaskDetailResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备唯一号
|
||||
/// </summary>
|
||||
public string DeviceUniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务下发状态
|
||||
/// </summary>
|
||||
public DeviceTaskStatusEnumType Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署点
|
||||
/// </summary>
|
||||
public string DeviceDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接信息
|
||||
/// </summary>
|
||||
public string IP { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Response
|
||||
{
|
||||
public class TaskRecordsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户档案号
|
||||
/// </summary>
|
||||
public string UserNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对应设备任务
|
||||
/// </summary>
|
||||
public List<TaskDetailResponse> Tasks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,6 @@ namespace Dlhis.ScheduledTask.TaskAssignment.Services;
|
||||
public interface IDeviceTaskAssignmentService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<DeviceTaskAssignmentResponse>> GetPageAsync(DeviceTaskAssignmentRequest request);
|
||||
|
||||
Task<TaskRecordsResponse> GetTaskRecords(TaskRecordsRequest request);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.ScheduledTask.TaskAssignment.Request;
|
||||
using Dlhis.ScheduledTask.TaskAssignment.Response;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Dlhis.ScheduledTask.TaskAssignment.Services.Implements;
|
||||
|
||||
@@ -38,4 +40,46 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 考勤任务记录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<TaskRecordsResponse> GetTaskRecords(TaskRecordsRequest request)
|
||||
|
||||
{
|
||||
//获取启用的功能设备
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Where(x => x.Enable && x.Funcs.Contains(request.type))
|
||||
.Select(x => x.UniqueNo)
|
||||
.ToListAsync();
|
||||
devices.ThrowIfNull($"{request.type.GetDescription}功能机器为空");
|
||||
|
||||
var tasks = await _dbContext.Queryable<DeviceTaskEntity>()
|
||||
.LeftJoin<GainfoEntity>((task, ga) => task.UserNo == ga.No)
|
||||
.LeftJoin<DeviceEntity>((task, ga, de) => task.DeviceUniqueNo == de.UniqueNo)
|
||||
.Where(task => task.UserNo == request.GainfoNo)
|
||||
.Where(task => devices.Contains(task.DeviceUniqueNo))
|
||||
.Select((task, ga, de) => new TaskDetailResponse
|
||||
{
|
||||
DeviceUniqueNo = task.DeviceUniqueNo,
|
||||
UserCode = task.UserCode,
|
||||
Name = ga.Name,
|
||||
Status = task.Status,
|
||||
DeviceDescription = de.DeployPlace,
|
||||
IP = de.ConnectionInfo
|
||||
}).ToListAsync();
|
||||
|
||||
var info = await _dbContext.Queryable<GainfoEntity>().Where(x => x.No == request.GainfoNo).FirstAsync();
|
||||
|
||||
var entity = new TaskRecordsResponse
|
||||
{
|
||||
UserNo = info.No,
|
||||
UserCode = info.Code,
|
||||
Name = info.Name,
|
||||
Tasks = tasks,
|
||||
};
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user