diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs
index 3cd649ae..2b6026e6 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs
@@ -1,6 +1,7 @@
using Dlhis.Basic.Device.Dtos;
using Dlhis.Basic.Device.Filters;
using Dlhis.Basic.Device.Request;
+using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Device.Services;
using Dlhis.Basic.Organization.Dto;
using Kurisu.AspNetCore.DataAccess.Dto;
@@ -79,7 +80,7 @@ public class DevicePermissionsController : ControllerBase
///
///
[HttpGet("gainfos/page")]
- public async Task> GetGainfoPageByDeviceAsync([FromQuery] DeviceWithGainfoRequest request)
+ public async Task> GetGainfoPageByDeviceAsync([FromQuery] DeviceWithGainfoRequest request)
{
return await _devicePermissionService.GetGainfoPageByDeviceAsync(request);
}
diff --git a/Src/Dlhis.Basic/Device/Response/DeviceGainfoResponse.cs b/Src/Dlhis.Basic/Device/Response/DeviceGainfoResponse.cs
new file mode 100644
index 00000000..4c49c46f
--- /dev/null
+++ b/Src/Dlhis.Basic/Device/Response/DeviceGainfoResponse.cs
@@ -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; }
+
+ ///
+ /// 工号
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 工作地
+ ///
+ public string Workplace { get; set; }
+
+ ///
+ /// 厂区
+ ///
+ public string Factory { get; set; }
+
+ ///
+ /// 任务下发状态
+ ///
+ public DeviceTaskStatusEnumType Status { get; set; }
+
+ ///
+ /// 任务下发状态描述
+ ///
+ public string StatusDesc => Status.GetDescription();
+
+ ///
+ /// 处理结果
+ ///
+ public string ResultMessage { get; set; }
+
+ ///
+ /// 最后变更时间
+ ///
+ public DateTime ModifiedTime { get; set; }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Device/Services/IDevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/IDevicePermissionService.cs
index 5713b9f7..62ecea62 100644
--- a/Src/Dlhis.Basic/Device/Services/IDevicePermissionService.cs
+++ b/Src/Dlhis.Basic/Device/Services/IDevicePermissionService.cs
@@ -1,5 +1,6 @@
using Dlhis.Basic.Device.Dtos;
using Dlhis.Basic.Device.Request;
+using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Organization.Dto;
using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.DataAccess.Dto;
@@ -59,5 +60,5 @@ public interface IDevicePermissionService : IScopeDependency
Task ReGeneratePermissionUsersInfoAsync(PermissionUsersInfoDto beforeDto);
- Task> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request);
+ Task> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request);
}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs
index 788fa493..863c3039 100644
--- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs
+++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs
@@ -1,12 +1,14 @@
using Dlhis.Basic.DataPermissions;
using Dlhis.Basic.Device.Dtos;
using Dlhis.Basic.Device.Request;
+using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Organization.Dto;
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 Dlhis.Sys.Api;
using Kurisu.AspNetCore.Authentication.Abstractions;
using Kurisu.AspNetCore.DataAccess.Dto;
using Kurisu.AspNetCore.DataAccess.Entity;
@@ -21,14 +23,16 @@ public class DevicePermissionService : IDevicePermissionService
{
private readonly IDbContext _dbContext;
private readonly IMyDataPermissionService _myDataPermissionService;
+ private readonly ITenantApi _tenantApi;
private readonly ICurrentUser _currentUser;
private readonly ILogger _logger;
- public DevicePermissionService(IDbContext dbContext, IMyDataPermissionService myDataPermissionService,
+ public DevicePermissionService(IDbContext dbContext, IMyDataPermissionService myDataPermissionService, ITenantApi tenantApi,
ICurrentUser currentUser, ILogger logger)
{
_dbContext = dbContext;
_myDataPermissionService = myDataPermissionService;
+ _tenantApi = tenantApi;
_currentUser = currentUser;
_logger = logger;
}
@@ -351,7 +355,7 @@ public class DevicePermissionService : IDevicePermissionService
}
- public async Task> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request)
+ public async Task> GetGainfoPageByDeviceAsync(DeviceWithGainfoRequest request)
{
var device = await _dbContext.Queryable().Where(x => x.UniqueNo == request.DeviceUniqueNo).SingleAsync();
@@ -397,11 +401,48 @@ public class DevicePermissionService : IDevicePermissionService
}
}
- return await _dbContext.Queryable()
+ var page = await _dbContext.Queryable()
.Where(x => ids.Contains(x.Id))
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name.Contains(request.Search))
- .Select()
+ .Select()
.ToPageListAsync(request);
+
+ var userNos = page.Data.Select(x => x.No).ToList();
+
+ var downStatus = await _dbContext.Queryable()
+ .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)
diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
index f1205510..a892529f 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
@@ -36,6 +36,17 @@ public class GainfosController : ControllerBase
{
return await _gainfoService.GetPageAsync(request);
}
+
+ ///
+ /// 档案详情
+ ///
+ ///
+ ///
+ [HttpGet("detail")]
+ public async Task GetGainfoDetailAsync([FromQuery] GainfoDetailRequest request)
+ {
+ return await _gainfoService.GetGainfoDetailAsync(request);
+ }
///
/// 档案分页(所有人)
@@ -154,18 +165,6 @@ public class GainfosController : ControllerBase
return await _gainfoService.GetGainfoListAsync(request);
}
- ///
- /// 档案详情
- ///
- ///
- ///
- [HttpGet("detail")]
- public async Task GetGainfoDetailAsync([FromQuery] GainfoDetailRequest request)
- {
- return await _gainfoService.GetGainfoDetailAsync(request);
- }
-
-
///
/// 数据迁移
///
diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs
index 3891996b..c147c32d 100644
--- a/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs
+++ b/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs
@@ -140,9 +140,14 @@ public class GainfoDetailResponse
///
public DateTime? EntryDate { get; set; }
-
+ ///
+ /// 卡类型
+ ///
public int? CardType { get; set; }
+ ///
+ /// 卡类型名称
+ ///
public string CardTypeName { get; set; }
diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs
index f2508852..54386fd3 100644
--- a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs
+++ b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs
@@ -120,4 +120,15 @@ public class GainfoPageResponse
/// 人事范围
///
public string Werks { get; set; }
+
+
+ ///
+ /// 卡类型
+ ///
+ public int? CardType { get; set; }
+
+ ///
+ /// 卡类型名称
+ ///
+ public string CardTypeName { get; set; }
}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
index 808c3082..603ba74c 100644
--- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
@@ -89,19 +89,22 @@ public class GainfoService : IGainfoService
|| gainfo.Code == request.Search
|| gainfo.IdNo == request.Search)
.LeftJoin((x, department) => x.DepartmentNo == department.No)
- .Select((x, department) => new GainfoPageResponse
+ .LeftJoin((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)
.ToPageListAsync(request);
-
+ //外包人员部门号处理
if (request.SearchType == GainfoSearchEnumType.Outsource)
{
var codes = page.Data.Select(x => x.Code).ToList();
var outsourceInfos = await _dbContext.Queryable().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;
@@ -310,7 +313,7 @@ public class GainfoService : IGainfoService
if (info != null)
{
- var searchTypes = new List() { "native", "country", "nation", "cls" };
+ var searchTypes = new List { "native", "country", "nation", "cls" };
var types = await _dbContext.Queryable().Where(x => searchTypes.Contains(x.Type)).ToListAsync();
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)
{
+ //ignore
}
}
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
index 61e93e16..7cb59e4f 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
@@ -59,4 +59,4 @@ public class AssignmentsController : ControllerBase
{
await _assignmentService.UpdateDeviceTaskStatusAsync(requests);
}
-}
+}
\ No newline at end of file