feat 设备连接注册,sap人事范围,部门
This commit is contained in:
@@ -11,8 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Entity", "Src\Dlhis.E
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sys", "Sys", "{57074FD8-1A2F-40C7-8476-001778A3F65D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys", "Src\Dlhis.Permission\Dlhis.Sys.csproj", "{5D7096DE-AB81-4423-95AF-6489C0D94CB3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.ScheduledTask", "Src\Dlhis.ScheduledTask\Dlhis.ScheduledTask.csproj", "{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Common", "Src\Dlhis.Common\Dlhis.Common.csproj", "{4C1FADD9-8AFB-4087-9E52-EE6D6523ED38}"
|
||||
@@ -25,6 +23,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Basic", "Src\Dlhis.Ba
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.User", "Src\Dlhis.User\Dlhis.User.csproj", "{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys", "Src\Dlhis.Sys\Dlhis.Sys.csproj", "{925048C9-5940-4B51-8480-4DC908C754A1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{8317C526-3523-4195-9B19-2F17CFD71927}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -35,10 +37,6 @@ Global
|
||||
{53884925-C9B9-4965-8B0D-100076CA0F43}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{53884925-C9B9-4965-8B0D-100076CA0F43}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{53884925-C9B9-4965-8B0D-100076CA0F43}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5D7096DE-AB81-4423-95AF-6489C0D94CB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5D7096DE-AB81-4423-95AF-6489C0D94CB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5D7096DE-AB81-4423-95AF-6489C0D94CB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5D7096DE-AB81-4423-95AF-6489C0D94CB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F1F7144-0BA3-4BDC-814E-E57A4E4A6392}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -59,6 +57,14 @@ Global
|
||||
{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{925048C9-5940-4B51-8480-4DC908C754A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{925048C9-5940-4B51-8480-4DC908C754A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{925048C9-5940-4B51-8480-4DC908C754A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{925048C9-5940-4B51-8480-4DC908C754A1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8317C526-3523-4195-9B19-2F17CFD71927}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8317C526-3523-4195-9B19-2F17CFD71927}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8317C526-3523-4195-9B19-2F17CFD71927}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8317C526-3523-4195-9B19-2F17CFD71927}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -69,6 +75,8 @@ Global
|
||||
{FD8D38C5-0827-49D1-A0BA-7707FBFDA2EC} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||
{D1F81CB7-F3EF-4196-A751-468248368020} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
|
||||
{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||
{925048C9-5940-4B51-8480-4DC908C754A1} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||
{8317C526-3523-4195-9B19-2F17CFD71927} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
|
||||
|
||||
@@ -17,11 +17,13 @@ public class DevicesController : ControllerBase
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly IDeviceTemplateService _deviceTemplateService;
|
||||
private readonly IDeviceConnectService _deviceConnectService;
|
||||
|
||||
public DevicesController(IDeviceService deviceService, IDeviceTemplateService deviceTemplateService)
|
||||
public DevicesController(IDeviceService deviceService, IDeviceTemplateService deviceTemplateService, IDeviceConnectService deviceConnectService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
_deviceTemplateService = deviceTemplateService;
|
||||
_deviceConnectService = deviceConnectService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,4 +69,49 @@ public class DevicesController : ControllerBase
|
||||
{
|
||||
await _deviceService.SaveAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备注册
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("resigter")]
|
||||
public async Task<string> ResigterAsync(DeviceResigterRequest request)
|
||||
{
|
||||
return await _deviceConnectService.ResigterAsync(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取尚未设置营业点的设备
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("businessplaces/incompletion")]
|
||||
public async Task<List<DeviceNotSetBusinessPlaceResponse>> GetNotSetBusinessPlaceDevicesAsync()
|
||||
{
|
||||
return await _deviceConnectService.GetNotSetBusinessPlaceDevicesAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置设备营业点
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("businessplaces")]
|
||||
public async Task SetResigterBusinessPlaceAsync(DeviceSetResigterBusinessPlaceRequest request)
|
||||
{
|
||||
await _deviceConnectService.SetResigterBusinessPlaceAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备心跳
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("heartbeat")]
|
||||
public async Task HeartbeatAsync(DeviceHeartbeatRequest request)
|
||||
{
|
||||
await _deviceConnectService.HeartbeatAsync(request);
|
||||
}
|
||||
}
|
||||
|
||||
7
Src/Dlhis.Basic/Device/Request/DeviceHeartbeatRequest.cs
Normal file
7
Src/Dlhis.Basic/Device/Request/DeviceHeartbeatRequest.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Dlhis.Basic.Device.Request
|
||||
{
|
||||
public class DeviceHeartbeatRequest
|
||||
{
|
||||
public string UniqueNo { get; set; }
|
||||
}
|
||||
}
|
||||
12
Src/Dlhis.Basic/Device/Request/DeviceResigterRequest.cs
Normal file
12
Src/Dlhis.Basic/Device/Request/DeviceResigterRequest.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Dlhis.Basic.Device.Request;
|
||||
|
||||
public class DeviceResigterRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "设备唯一编码不能为空")]
|
||||
public string UniqueNo { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Dlhis.Basic.Device.Request
|
||||
{
|
||||
public class DeviceSetResigterBusinessPlaceRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 唯一编码
|
||||
/// </summary>
|
||||
public string UniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Dlhis.Basic.Device.Response;
|
||||
|
||||
public class DeviceNotSetBusinessPlaceResponse
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,79 @@
|
||||
namespace Dlhis.Basic.Device.Response;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
|
||||
namespace Dlhis.Basic.Device.Response;
|
||||
|
||||
public class DeviceResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备code
|
||||
/// </summary>
|
||||
public Guid Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备唯一码,IP/MAC/SNO
|
||||
/// </summary>
|
||||
public string UniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 心跳间隔
|
||||
/// </summary>
|
||||
public int HeartbeatInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品牌
|
||||
/// </summary>
|
||||
public string Brand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
public string Supplier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备功能
|
||||
/// </summary>
|
||||
public List<DeviceFuncEnumType> Funcs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署点
|
||||
/// </summary>
|
||||
public string DeployPlace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署坐标
|
||||
/// </summary>
|
||||
public string DeployPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部署方向
|
||||
/// </summary>
|
||||
public string DeployDirection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模板code
|
||||
/// </summary>
|
||||
public Guid TemplateCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接信息
|
||||
/// </summary>
|
||||
public string ConnectionInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后使用人
|
||||
/// </summary>
|
||||
public DateTime LastLogId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后使用日期
|
||||
/// </summary>
|
||||
public DateTime LastLogDateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool Enable { get; set; }
|
||||
}
|
||||
|
||||
36
Src/Dlhis.Basic/Device/Services/IDeviceConnectService.cs
Normal file
36
Src/Dlhis.Basic/Device/Services/IDeviceConnectService.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Dlhis.Basic.Device.Request;
|
||||
using Dlhis.Basic.Device.Response;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services;
|
||||
|
||||
public interface IDeviceConnectService
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备注册
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> ResigterAsync(DeviceResigterRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取尚未设置营业点的设备
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<DeviceNotSetBusinessPlaceResponse>> GetNotSetBusinessPlaceDevicesAsync();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置设备营业点
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task SetResigterBusinessPlaceAsync(DeviceSetResigterBusinessPlaceRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 设备心跳
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task HeartbeatAsync(DeviceHeartbeatRequest request);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
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 Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Device.Services.Implements;
|
||||
|
||||
public class DeviceConnectService : IDeviceConnectService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public DeviceConnectService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<string> ResigterAsync(DeviceResigterRequest request)
|
||||
{
|
||||
var device = await GetEnableDeviceAsync(request.UniqueNo);
|
||||
|
||||
var registry = await _dbContext.Queryable<DeviceRegistryEntity>().Where(x => x.DeviceUniqueNo == request.UniqueNo).FirstAsync();
|
||||
if (registry == null)
|
||||
{
|
||||
registry = new DeviceRegistryEntity()
|
||||
{
|
||||
DeviceUniqueNo = request.UniqueNo,
|
||||
LastHeartbeatTime = DateTime.Now,
|
||||
};
|
||||
await _dbContext.InsertAsync(registry);
|
||||
|
||||
return "设备注册成功";
|
||||
}
|
||||
|
||||
return "请勿重复注册设备";
|
||||
}
|
||||
|
||||
public async Task<List<DeviceNotSetBusinessPlaceResponse>> GetNotSetBusinessPlaceDevicesAsync()
|
||||
{
|
||||
var devices = await _dbContext.Queryable<DeviceEntity>().ToListAsync();
|
||||
devices = devices.Where(x => x.Funcs.Any(item => item == DeviceFuncEnumType.Meal)).ToList();
|
||||
|
||||
return devices.Adapt<List<DeviceNotSetBusinessPlaceResponse>>();
|
||||
}
|
||||
|
||||
public async Task SetResigterBusinessPlaceAsync(DeviceSetResigterBusinessPlaceRequest request)
|
||||
{
|
||||
var device = await GetEnableDeviceAsync(request.UniqueNo);
|
||||
if (device.Funcs?.Any(x => x == DeviceFuncEnumType.Meal) != true)
|
||||
{
|
||||
throw new UserFriendlyException("当前设备无用餐功能,无法设置");
|
||||
}
|
||||
|
||||
var registry = await _dbContext.Queryable<DeviceRegistryEntity>().Where(x => x.DeviceUniqueNo == request.UniqueNo).FirstAsync();
|
||||
registry.ThrowIfNull($"{request.UniqueNo}的设备注册信息不存在,无法设置营业点");
|
||||
|
||||
var businessPlace = await _dbContext.Queryable<CanteenBusinessPlaceEntity>().Where(x => x.Code == request.BusinessPlaceCode).FirstAsync();
|
||||
businessPlace.ThrowIfNull("营业点不存在,无法设置到设备注册信息中");
|
||||
|
||||
//更新营业点信息
|
||||
registry.BusinessPlaceCode = businessPlace.Code;
|
||||
registry.BusinessPlaceCustomCode = businessPlace.CustomCode;
|
||||
|
||||
await _dbContext.UpdateAsync(registry);
|
||||
//todo 通知设备重新获取
|
||||
}
|
||||
|
||||
public async Task HeartbeatAsync(DeviceHeartbeatRequest request)
|
||||
{
|
||||
var registry = await _dbContext.Queryable<DeviceRegistryEntity>().Where(x => x.DeviceUniqueNo == request.UniqueNo).FirstAsync();
|
||||
registry.ThrowIfNull($"{request.UniqueNo}的设备注册信息不存在,心跳无效");
|
||||
|
||||
registry.LastHeartbeatTime = DateTime.Now;
|
||||
await _dbContext.UpdateAsync(registry);
|
||||
}
|
||||
|
||||
//******************************************************** help methods **********************************************************
|
||||
|
||||
/// <summary>
|
||||
/// 获取启用的设备
|
||||
/// </summary>
|
||||
/// <param name="uniqueNo"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<DeviceEntity> GetEnableDeviceAsync(string uniqueNo)
|
||||
{
|
||||
var device = await _dbContext.Queryable<DeviceEntity>()
|
||||
.Where(x => x.UniqueNo == uniqueNo)
|
||||
.FirstAsync();
|
||||
|
||||
device.ThrowIfNull($"未知的设备唯一编码{uniqueNo}");
|
||||
device.Enable.ThrowIfFalse("设备尚未启用");
|
||||
|
||||
return device;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
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 Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
@@ -30,7 +32,6 @@ public class DeviceService : IDeviceService
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
public async Task SaveAsync(DeviceSaveRequest request)
|
||||
{
|
||||
await CheckUniqueNoExistsAsync(request);
|
||||
@@ -56,7 +57,7 @@ public class DeviceService : IDeviceService
|
||||
}
|
||||
}
|
||||
|
||||
//******************************************************** help method **********************************************************
|
||||
//******************************************************** help methods **********************************************************
|
||||
|
||||
/// <summary>
|
||||
/// 检查设备模板是否存在
|
||||
@@ -116,5 +117,6 @@ public class DeviceService : IDeviceService
|
||||
|
||||
exists.ThrowIfTrue("唯一号已经存在");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Organization\Request\" />
|
||||
<Folder Include="Organization\Response\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -116,10 +116,5 @@ namespace Dlhis.Basic.MealUser.Services.Implements
|
||||
.AnyAsync();
|
||||
checkGainfoGuestno.ThrowIfTrue($"档案号[{request.gainfoPageResponse.Guestno}]已存在");
|
||||
}
|
||||
|
||||
public Task OnboardingAsync(GainfoDImissionRequest request)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
@@ -11,4 +13,20 @@ namespace Dlhis.Basic.Organization.Controllers;
|
||||
[ApiController]
|
||||
public class DepartmentsController : ControllerBase
|
||||
{
|
||||
private readonly IDepartmentService _departmentService;
|
||||
|
||||
public DepartmentsController(IDepartmentService departmentService)
|
||||
{
|
||||
_departmentService = departmentService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取部门树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
public async Task<List<DepartmentTreeResponse>> GetTreeAsync()
|
||||
{
|
||||
return await _departmentService.GetTreeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class PersonalScopesController : ControllerBase
|
||||
{
|
||||
}
|
||||
26
Src/Dlhis.Basic/Organization/Controllers/WerksController.cs
Normal file
26
Src/Dlhis.Basic/Organization/Controllers/WerksController.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 人事范围
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class WerksController : ControllerBase
|
||||
{
|
||||
private readonly IWerkService _werkService;
|
||||
|
||||
public WerksController(IWerkService werkService)
|
||||
{
|
||||
_werkService = werkService;
|
||||
}
|
||||
|
||||
[HttpGet("list")]
|
||||
public async Task<List<WerkResponse>> GetListAsync()
|
||||
{
|
||||
return await _werkService.GetListAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
public class DepartmentTreeResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 部门号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下级部门
|
||||
/// </summary>
|
||||
public List<DepartmentTreeResponse> Next { get; set; }
|
||||
}
|
||||
23
Src/Dlhis.Basic/Organization/Response/WerkResponse.cs
Normal file
23
Src/Dlhis.Basic/Organization/Response/WerkResponse.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
public class WerkResponse
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可见
|
||||
/// </summary>
|
||||
public bool Visible { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IDepartmentService : IScopeDependency
|
||||
{
|
||||
Task<List<DepartmentTreeResponse>> GetTreeAsync();
|
||||
}
|
||||
8
Src/Dlhis.Basic/Organization/Services/IWerkService.cs
Normal file
8
Src/Dlhis.Basic/Organization/Services/IWerkService.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IWerkService : IScopeDependency
|
||||
{
|
||||
Task<List<WerkResponse>> GetListAsync();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
public class DepartmentService : IDepartmentService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public DepartmentService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<List<DepartmentTreeResponse>> GetTreeAsync()
|
||||
{
|
||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||
var tops = departments.Where(x => x.PCode.IsEmpty()).Adapt<List<DepartmentTreeResponse>>();
|
||||
|
||||
tops.ForEach(x =>
|
||||
{
|
||||
RecursionGetNext(x, departments);
|
||||
});
|
||||
|
||||
return tops;
|
||||
}
|
||||
|
||||
|
||||
private void RecursionGetNext(DepartmentTreeResponse current, List<DepartmentEntity> departments)
|
||||
{
|
||||
var next = departments.Where(x => x.PCode == current.Code).ToList();
|
||||
current.Next = next.Adapt<List<DepartmentTreeResponse>>();
|
||||
foreach (var item in next)
|
||||
{
|
||||
RecursionGetNext(item.Adapt<DepartmentTreeResponse>(), departments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
public class WerkService : IWerkService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public WerkService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<List<WerkResponse>> GetListAsync()
|
||||
{
|
||||
return await _dbContext.Queryable<WerkEntity>()
|
||||
.Select<WerkResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.BalanceRecord.Request;
|
||||
|
||||
public class BalanceRecordRequest : PageDto
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace Dlhis.Canteen.BalanceRecord.Response;
|
||||
|
||||
public class BalanceRecordResponse
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Dlhis.Canteen.BalanceRecord.Request;
|
||||
using Dlhis.Canteen.BalanceRecord.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Canteen.BalanceRecord.Services;
|
||||
|
||||
public interface IBalanceRecordService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<BalanceRecordResponse>> GetPageAsync(BalanceRecordRequest request);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using Dlhis.Canteen.BalanceRecord.Request;
|
||||
using Dlhis.Canteen.BalanceRecord.Response;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Canteen.BalanceRecord.Services.Implements;
|
||||
|
||||
public class BalanceRecordService : IBalanceRecordService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public BalanceRecordService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<BalanceRecordResponse>> GetPageAsync(BalanceRecordRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<BalanceRecordEntity>()
|
||||
.Select<BalanceRecordResponse>()
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="BalanceRecord\Controllers\" />
|
||||
<Folder Include="BalanceRecord\Request\" />
|
||||
<Folder Include="BalanceRecord\Response\" />
|
||||
<Folder Include="BalanceRecord\Services\Implements\" />
|
||||
<Folder Include="OaEMealVoucher\Controllers\" />
|
||||
<Folder Include="OaEMealVoucher\Request\" />
|
||||
<Folder Include="OaEMealVoucher\Response\" />
|
||||
|
||||
@@ -1,5 +1,44 @@
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Request;
|
||||
|
||||
public class OrderAddRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 消费机器唯一信息
|
||||
/// </summary>
|
||||
public string UniqueNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 档案号/QrCode
|
||||
/// </summary>
|
||||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学工号
|
||||
/// </summary>
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(BalanceRecordSourceEnumType))]
|
||||
public BalanceRecordSourceEnumType Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收入/支出
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(BalanceRecordTypeEnumType))]
|
||||
public BalanceRecordTypeEnumType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额 + - 表示
|
||||
/// </summary>
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 餐补月份
|
||||
/// </summary>
|
||||
public string SubsidiesFromMonth { get; set; }
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ public class OrderService : IOrderService
|
||||
return page;
|
||||
}
|
||||
|
||||
public Task AddAsync(OrderAddRequest request)
|
||||
public async Task AddAsync(OrderAddRequest request)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,4 @@ public class SqlSugarPack : BaseAppPack
|
||||
{
|
||||
services.AddSqlSugar();
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
//using var scope = app.ApplicationServices.CreateScope();
|
||||
//var db = scope.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
//var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false)).ToArray();
|
||||
//db.DbMaintenance.CreateDatabase();
|
||||
//db.CodeFirst.InitTables(tables);
|
||||
}
|
||||
}
|
||||
|
||||
28
Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs
Normal file
28
Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity;
|
||||
|
||||
/// <summary>
|
||||
/// 部门
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "Department", TableDescription = "部门")]
|
||||
public class DepartmentEntity : SugarBaseEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 部门号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "部门号")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上级部门号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "上级部门号")]
|
||||
public string PCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "部门名称")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 设备功能
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能")]
|
||||
[SugarColumn(ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能", DefaultValue = "[]")]
|
||||
public List<DeviceFuncEnumType> Funcs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -95,12 +95,5 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
||||
[SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用")]
|
||||
public bool Enable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设别状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "设别状态")]
|
||||
public string Status { get; set; }
|
||||
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -144,9 +144,10 @@ public class GainfoEntity : SugarBaseEntity
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "外文名字")]
|
||||
public string Gname_en { get; set; }
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
/// </summary>
|
||||
|
||||
[SugarColumn(ColumnDescription = "人事范围")]
|
||||
public string Werks { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "卡号")]
|
||||
public string CarNo { get; set; }
|
||||
}
|
||||
|
||||
25
Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs
Normal file
25
Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity;
|
||||
|
||||
[SugarTable(TableName = "Werk", TableDescription = "人事范围")]
|
||||
public class WerkEntity : SugarBaseEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 代号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "代号")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否可见
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否可见", ColumnDataType = "bit")]
|
||||
public bool Visible { get; set; }
|
||||
}
|
||||
@@ -84,12 +84,6 @@ public class BalanceRecordEntity : SugarBaseEntity, ITenantId
|
||||
[SugarColumn(ColumnDescription = "所属成本日期")]
|
||||
public DateTime CostDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "操作人")]
|
||||
public string OperateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费机器唯一信息
|
||||
/// </summary>
|
||||
|
||||
@@ -29,13 +29,13 @@ public enum BalanceRecordSourceEnumType
|
||||
/// <summary>
|
||||
/// 来自本基地补贴
|
||||
/// </summary>
|
||||
[Description("来自本基地补贴")]
|
||||
[Description("本基地补贴")]
|
||||
LocalTenantSubsidies,
|
||||
|
||||
/// <summary>
|
||||
/// 来自其他基地补贴
|
||||
/// </summary>
|
||||
[Description("来自其他基地补贴")]
|
||||
[Description("其他基地补贴")]
|
||||
OtherTenantSubsidies,
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class DeviceRegistryEntity : SugarBaseEntity, ITenantId
|
||||
/// 营业点code(可为空)
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true, ColumnDescription = "注册时间")]
|
||||
public string BusinessPlaceCode { get; set; }
|
||||
public Guid BusinessPlaceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点手工号(可为空)
|
||||
|
||||
Reference in New Issue
Block a user