fix 已知问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Dlhis.Basic.Device.Dtos;
|
using Dlhis.Basic.Device.Dtos;
|
||||||
using Dlhis.Basic.Device.Filters;
|
using Dlhis.Basic.Device.Filters;
|
||||||
using Dlhis.Basic.Device.Request;
|
using Dlhis.Basic.Device.Request;
|
||||||
|
using Dlhis.Basic.Device.Response;
|
||||||
using Dlhis.Basic.Device.Services;
|
using Dlhis.Basic.Device.Services;
|
||||||
using Dlhis.Basic.Organization.Dto;
|
using Dlhis.Basic.Organization.Dto;
|
||||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||||
@@ -79,7 +80,7 @@ public class DevicePermissionsController : ControllerBase
|
|||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("gainfos/page")]
|
[HttpGet("gainfos/page")]
|
||||||
public async Task<Pagination<GainfoDto>> GetGainfoPageByDeviceAsync([FromQuery] DeviceWithGainfoRequest request)
|
public async Task<Pagination<DeviceGainfoResponse>> GetGainfoPageByDeviceAsync([FromQuery] DeviceWithGainfoRequest request)
|
||||||
{
|
{
|
||||||
return await _devicePermissionService.GetGainfoPageByDeviceAsync(request);
|
return await _devicePermissionService.GetGainfoPageByDeviceAsync(request);
|
||||||
}
|
}
|
||||||
|
|||||||
49
Src/Dlhis.Basic/Device/Response/DeviceGainfoResponse.cs
Normal file
49
Src/Dlhis.Basic/Device/Response/DeviceGainfoResponse.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Dlhis.Entity.Device.Enums;
|
||||||
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
|
|
||||||
|
namespace Dlhis.Basic.Device.Response;
|
||||||
|
|
||||||
|
public class DeviceGainfoResponse
|
||||||
|
{
|
||||||
|
public string No { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工号
|
||||||
|
/// </summary>
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 姓名
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工作地
|
||||||
|
/// </summary>
|
||||||
|
public string Workplace { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 厂区
|
||||||
|
/// </summary>
|
||||||
|
public string Factory { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务下发状态
|
||||||
|
/// </summary>
|
||||||
|
public DeviceTaskStatusEnumType Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务下发状态描述
|
||||||
|
/// </summary>
|
||||||
|
public string StatusDesc => Status.GetDescription();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 处理结果
|
||||||
|
/// </summary>
|
||||||
|
public string ResultMessage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最后变更时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime ModifiedTime { get; set; }
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using Dlhis.Basic.Device.Dtos;
|
using Dlhis.Basic.Device.Dtos;
|
||||||
using Dlhis.Basic.Device.Request;
|
using Dlhis.Basic.Device.Request;
|
||||||
|
using Dlhis.Basic.Device.Response;
|
||||||
using Dlhis.Basic.Organization.Dto;
|
using Dlhis.Basic.Organization.Dto;
|
||||||
using Dlhis.Entity.Device.Enums;
|
using Dlhis.Entity.Device.Enums;
|
||||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||||
@@ -59,5 +60,5 @@ public interface IDevicePermissionService : IScopeDependency
|
|||||||
|
|
||||||
Task<int> ReGeneratePermissionUsersInfoAsync(PermissionUsersInfoDto beforeDto);
|
Task<int> ReGeneratePermissionUsersInfoAsync(PermissionUsersInfoDto beforeDto);
|
||||||
|
|
||||||
Task<Pagination<GainfoDto>> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request);
|
Task<Pagination<DeviceGainfoResponse>> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request);
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
using Dlhis.Basic.DataPermissions;
|
using Dlhis.Basic.DataPermissions;
|
||||||
using Dlhis.Basic.Device.Dtos;
|
using Dlhis.Basic.Device.Dtos;
|
||||||
using Dlhis.Basic.Device.Request;
|
using Dlhis.Basic.Device.Request;
|
||||||
|
using Dlhis.Basic.Device.Response;
|
||||||
using Dlhis.Basic.Organization.Dto;
|
using Dlhis.Basic.Organization.Dto;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
using Dlhis.Entity.Device.Entities;
|
using Dlhis.Entity.Device.Entities;
|
||||||
using Dlhis.Entity.Device.Enums;
|
using Dlhis.Entity.Device.Enums;
|
||||||
using Dlhis.Entity.Sys.Entities;
|
using Dlhis.Entity.Sys.Entities;
|
||||||
using Dlhis.Entity.Sys.Enums;
|
using Dlhis.Entity.Sys.Enums;
|
||||||
|
using Dlhis.Sys.Api;
|
||||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||||
@@ -21,14 +23,16 @@ public class DevicePermissionService : IDevicePermissionService
|
|||||||
{
|
{
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly IMyDataPermissionService _myDataPermissionService;
|
private readonly IMyDataPermissionService _myDataPermissionService;
|
||||||
|
private readonly ITenantApi _tenantApi;
|
||||||
private readonly ICurrentUser _currentUser;
|
private readonly ICurrentUser _currentUser;
|
||||||
private readonly ILogger<DevicePermissionService> _logger;
|
private readonly ILogger<DevicePermissionService> _logger;
|
||||||
|
|
||||||
public DevicePermissionService(IDbContext dbContext, IMyDataPermissionService myDataPermissionService,
|
public DevicePermissionService(IDbContext dbContext, IMyDataPermissionService myDataPermissionService, ITenantApi tenantApi,
|
||||||
ICurrentUser currentUser, ILogger<DevicePermissionService> logger)
|
ICurrentUser currentUser, ILogger<DevicePermissionService> logger)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_myDataPermissionService = myDataPermissionService;
|
_myDataPermissionService = myDataPermissionService;
|
||||||
|
_tenantApi = tenantApi;
|
||||||
_currentUser = currentUser;
|
_currentUser = currentUser;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
@@ -351,7 +355,7 @@ public class DevicePermissionService : IDevicePermissionService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<Pagination<GainfoDto>> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request)
|
public async Task<Pagination<DeviceGainfoResponse>> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request)
|
||||||
{
|
{
|
||||||
var device = await _dbContext.Queryable<DeviceEntity>().Where(x => x.UniqueNo == request.DeviceUniqueNo).SingleAsync();
|
var device = await _dbContext.Queryable<DeviceEntity>().Where(x => x.UniqueNo == request.DeviceUniqueNo).SingleAsync();
|
||||||
|
|
||||||
@@ -397,11 +401,48 @@ public class DevicePermissionService : IDevicePermissionService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await _dbContext.Queryable<GainfoEntity>()
|
var page = await _dbContext.Queryable<GainfoEntity>()
|
||||||
.Where(x => ids.Contains(x.Id))
|
.Where(x => ids.Contains(x.Id))
|
||||||
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name.Contains(request.Search))
|
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name.Contains(request.Search))
|
||||||
.Select<GainfoDto>()
|
.Select<DeviceGainfoResponse>()
|
||||||
.ToPageListAsync(request);
|
.ToPageListAsync(request);
|
||||||
|
|
||||||
|
var userNos = page.Data.Select(x => x.No).ToList();
|
||||||
|
|
||||||
|
var downStatus = await _dbContext.Queryable<DeviceTaskEntity>()
|
||||||
|
.Where(x => userNos.Contains(x.UserNo))
|
||||||
|
.Where(x => x.DeviceUniqueNo == device.UniqueNo)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
num = SqlFunc.RowNumber(SqlFunc.Desc(x.ModifiedTime), x.UserNo),
|
||||||
|
x.UserNo,
|
||||||
|
x.Status,
|
||||||
|
x.ResultMessage,
|
||||||
|
x.ModifiedTime
|
||||||
|
}).MergeTable()
|
||||||
|
.Where(x => x.num == 1)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
|
||||||
|
var tenants = tenantsResult.Data;
|
||||||
|
|
||||||
|
page.Data.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.Workplace = tenants.FirstOrDefault(item => item.Code == x.Workplace)?.Name;
|
||||||
|
x.Factory = tenants.FirstOrDefault(item => item.Code == x.Factory)?.Name;
|
||||||
|
|
||||||
|
var d = downStatus.FirstOrDefault(item => item.UserNo == x.No);
|
||||||
|
if (d == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x.Status = d.Status;
|
||||||
|
x.ResultMessage = d.ResultMessage;
|
||||||
|
x.ModifiedTime = d.ModifiedTime;
|
||||||
|
});
|
||||||
|
|
||||||
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task GenerateDeviceTasksAsync(string userNo, DeviceTaskEnumType taskType)
|
public async Task GenerateDeviceTasksAsync(string userNo, DeviceTaskEnumType taskType)
|
||||||
|
|||||||
@@ -36,6 +36,17 @@ public class GainfosController : ControllerBase
|
|||||||
{
|
{
|
||||||
return await _gainfoService.GetPageAsync(request);
|
return await _gainfoService.GetPageAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 档案详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("detail")]
|
||||||
|
public async Task<GainfoDetailResponse> GetGainfoDetailAsync([FromQuery] GainfoDetailRequest request)
|
||||||
|
{
|
||||||
|
return await _gainfoService.GetGainfoDetailAsync(request);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 档案分页(所有人)
|
/// 档案分页(所有人)
|
||||||
@@ -154,18 +165,6 @@ public class GainfosController : ControllerBase
|
|||||||
return await _gainfoService.GetGainfoListAsync(request);
|
return await _gainfoService.GetGainfoListAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 档案详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("detail")]
|
|
||||||
public async Task<GainfoDetailResponse> GetGainfoDetailAsync([FromQuery] GainfoDetailRequest request)
|
|
||||||
{
|
|
||||||
return await _gainfoService.GetGainfoDetailAsync(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据迁移
|
/// 数据迁移
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -140,9 +140,14 @@ public class GainfoDetailResponse
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? EntryDate { get; set; }
|
public DateTime? EntryDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 卡类型
|
||||||
|
/// </summary>
|
||||||
public int? CardType { get; set; }
|
public int? CardType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 卡类型名称
|
||||||
|
/// </summary>
|
||||||
public string CardTypeName { get; set; }
|
public string CardTypeName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -120,4 +120,15 @@ public class GainfoPageResponse
|
|||||||
/// 人事范围
|
/// 人事范围
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Werks { get; set; }
|
public string Werks { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 卡类型
|
||||||
|
/// </summary>
|
||||||
|
public int? CardType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 卡类型名称
|
||||||
|
/// </summary>
|
||||||
|
public string CardTypeName { get; set; }
|
||||||
}
|
}
|
||||||
@@ -89,19 +89,22 @@ public class GainfoService : IGainfoService
|
|||||||
|| gainfo.Code == request.Search
|
|| gainfo.Code == request.Search
|
||||||
|| gainfo.IdNo == request.Search)
|
|| gainfo.IdNo == request.Search)
|
||||||
.LeftJoin<DepartmentEntity>((x, department) => x.DepartmentNo == department.No)
|
.LeftJoin<DepartmentEntity>((x, department) => x.DepartmentNo == department.No)
|
||||||
.Select((x, department) => new GainfoPageResponse
|
.LeftJoin<BasicTypeEntity>((x, department, type) => type.Code == x.CardType.ToString() && type.Type == "timeperiod")
|
||||||
|
.Select((x, department, type) => new GainfoPageResponse
|
||||||
{
|
{
|
||||||
DepartmentName = department.Name
|
DepartmentName = department.Name,
|
||||||
|
CardType = x.CardType,
|
||||||
|
CardTypeName = type.Display
|
||||||
}, true)
|
}, true)
|
||||||
.ToPageListAsync(request);
|
.ToPageListAsync(request);
|
||||||
|
|
||||||
|
//外包人员部门号处理
|
||||||
if (request.SearchType == GainfoSearchEnumType.Outsource)
|
if (request.SearchType == GainfoSearchEnumType.Outsource)
|
||||||
{
|
{
|
||||||
var codes = page.Data.Select(x => x.Code).ToList();
|
var codes = page.Data.Select(x => x.Code).ToList();
|
||||||
var outsourceInfos = await _dbContext.Queryable<OutsourceEntity>().Where(x => codes.Contains(x.Code)).Select(x => new { x.Code, x.Supplier }).ToListAsync();
|
var outsourceInfos = await _dbContext.Queryable<OutsourceEntity>().Where(x => codes.Contains(x.Code)).Select(x => new { x.Code, x.Supplier }).ToListAsync();
|
||||||
|
|
||||||
page.Data.ForEach(item => { item.DepartmentNo = outsourceInfos.FirstOrDefault(x => x.Code == item.Code)?.Supplier; });
|
page.Data.ForEach(item => { item.DepartmentName = outsourceInfos.FirstOrDefault(x => x.Code == item.Code)?.Supplier; });
|
||||||
}
|
}
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
@@ -310,7 +313,7 @@ public class GainfoService : IGainfoService
|
|||||||
|
|
||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
var searchTypes = new List<string>() { "native", "country", "nation", "cls" };
|
var searchTypes = new List<string> { "native", "country", "nation", "cls" };
|
||||||
var types = await _dbContext.Queryable<BasicTypeEntity>().Where(x => searchTypes.Contains(x.Type)).ToListAsync();
|
var types = await _dbContext.Queryable<BasicTypeEntity>().Where(x => searchTypes.Contains(x.Type)).ToListAsync();
|
||||||
|
|
||||||
info.NativeName = types.Where(x => x.Type == "native").FirstOrDefault(x => x.Code == info.NativeName)?.Display;
|
info.NativeName = types.Where(x => x.Type == "native").FirstOrDefault(x => x.Code == info.NativeName)?.Display;
|
||||||
@@ -333,6 +336,7 @@ public class GainfoService : IGainfoService
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
//ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,4 +59,4 @@ public class AssignmentsController : ControllerBase
|
|||||||
{
|
{
|
||||||
await _assignmentService.UpdateDeviceTaskStatusAsync(requests);
|
await _assignmentService.UpdateDeviceTaskStatusAsync(requests);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user