Merge branch 'development' of https://git.dlhis.com/liguoyang/jinko.yikatong into development
This commit is contained in:
@@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Sys", "Src\Dlhis.Sys\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{8317C526-3523-4195-9B19-2F17CFD71927}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.Canteen\Dlhis.Canteen.csproj", "{8317C526-3523-4195-9B19-2F17CFD71927}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dlhis.User.Api", "Src\Dlhis.User.Api\Dlhis.User.Api.csproj", "{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -65,6 +67,10 @@ Global
|
|||||||
{8317C526-3523-4195-9B19-2F17CFD71927}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
|
||||||
{8317C526-3523-4195-9B19-2F17CFD71927}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8317C526-3523-4195-9B19-2F17CFD71927}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -77,6 +83,7 @@ Global
|
|||||||
{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
{9F9BC299-3CDD-4CCE-80CA-5FE57332B1F0} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||||
{925048C9-5940-4B51-8480-4DC908C754A1} = {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}
|
{8317C526-3523-4195-9B19-2F17CFD71927} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
|
||||||
|
{F294CD7D-0412-48AD-A7E9-E72B9BA0E48E} = {57074FD8-1A2F-40C7-8476-001778A3F65D}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
|
SolutionGuid = {7439494A-E2FD-4FEA-8ABF-74AE57A4A5A0}
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public class BusinessPlacesController : ControllerBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
[HttpGet("shifts")]
|
[HttpGet("shifts")]
|
||||||
public async Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeHttpGetAsync([FromQuery] BusinessPlaceGetShiftsRequest request)
|
public async Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeHttpGetAsync([FromQuery] BusinessPlaceGetShiftsRequest request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public class DevicesController : ControllerBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
[HttpPost("resigter")]
|
[HttpPost("resigter")]
|
||||||
public async Task<string> ResigterAsync(DeviceResigterRequest request)
|
public async Task<string> ResigterAsync(DeviceResigterRequest request)
|
||||||
{
|
{
|
||||||
@@ -114,4 +115,14 @@ public class DevicesController : ControllerBase
|
|||||||
{
|
{
|
||||||
await _deviceConnectService.HeartbeatAsync(request);
|
await _deviceConnectService.HeartbeatAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查设备是否存在
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("exists")]
|
||||||
|
public async Task<bool> CheckExistsAsync(string deviceUniqueNo)
|
||||||
|
{
|
||||||
|
return await _deviceService.CheckExistsAsync(deviceUniqueNo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ public interface IDeviceService : IScopeDependency
|
|||||||
Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request);
|
Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request);
|
||||||
|
|
||||||
Task SaveAsync(DeviceSaveRequest request);
|
Task SaveAsync(DeviceSaveRequest request);
|
||||||
|
|
||||||
|
Task<bool> CheckExistsAsync(string deviceUniqueNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,10 @@ public class DeviceConnectService : IDeviceConnectService
|
|||||||
RegisterTime = DateTime.Now,
|
RegisterTime = DateTime.Now,
|
||||||
BusinessPlaceCode = businessPlace?.Code,
|
BusinessPlaceCode = businessPlace?.Code,
|
||||||
BusinessPlaceCustomCode = businessPlace?.CustomCode,
|
BusinessPlaceCustomCode = businessPlace?.CustomCode,
|
||||||
|
TenantId = device.TenantId,
|
||||||
};
|
};
|
||||||
await _dbContext.InsertAsync(registry);
|
|
||||||
|
|
||||||
|
await _dbContext.InsertAsync(registry);
|
||||||
return "设备注册成功";
|
return "设备注册成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,8 +94,8 @@ public class DeviceConnectService : IDeviceConnectService
|
|||||||
private async Task<DeviceEntity> GetEnableDeviceAsync(string uniqueNo)
|
private async Task<DeviceEntity> GetEnableDeviceAsync(string uniqueNo)
|
||||||
{
|
{
|
||||||
var device = await _dbContext.Queryable<DeviceEntity>()
|
var device = await _dbContext.Queryable<DeviceEntity>()
|
||||||
.Where(x => x.UniqueNo == uniqueNo)
|
.Where(x => x.UniqueNo == uniqueNo)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|
||||||
device.ThrowIfNull($"未知的设备唯一编码{uniqueNo}");
|
device.ThrowIfNull($"未知的设备唯一编码{uniqueNo}");
|
||||||
device.Enable.ThrowIfFalse("设备尚未启用");
|
device.Enable.ThrowIfFalse("设备尚未启用");
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using Dlhis.Basic.Device.Request;
|
using Dlhis.Basic.Device.Request;
|
||||||
using Dlhis.Basic.Device.Response;
|
using Dlhis.Basic.Device.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
|
using Dlhis.Entity.Device.Entities;
|
||||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
using Kurisu.Core.DataAccess.Dto;
|
using Kurisu.Core.DataAccess.Dto;
|
||||||
|
using Kurisu.SqlSugar.Attributes;
|
||||||
using Kurisu.SqlSugar.Extensions;
|
using Kurisu.SqlSugar.Extensions;
|
||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
@@ -34,6 +36,7 @@ public class DeviceService : IDeviceService
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Transactional]
|
||||||
public async Task SaveAsync(DeviceSaveRequest request)
|
public async Task SaveAsync(DeviceSaveRequest request)
|
||||||
{
|
{
|
||||||
await CheckUniqueNoExistsAsync(request);
|
await CheckUniqueNoExistsAsync(request);
|
||||||
@@ -46,6 +49,21 @@ public class DeviceService : IDeviceService
|
|||||||
entity.Code = Guid.NewGuid();
|
entity.Code = Guid.NewGuid();
|
||||||
entity.Brand = template.Brand;
|
entity.Brand = template.Brand;
|
||||||
await _dbContext.InsertAsync(entity);
|
await _dbContext.InsertAsync(entity);
|
||||||
|
//同时保存注册信息
|
||||||
|
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,
|
||||||
|
RegisterTime = DateTime.Now,
|
||||||
|
BusinessPlaceCode = null,
|
||||||
|
BusinessPlaceCustomCode = null,
|
||||||
|
};
|
||||||
|
|
||||||
|
await _dbContext.InsertAsync(registry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -119,5 +137,13 @@ public class DeviceService : IDeviceService
|
|||||||
|
|
||||||
exists.ThrowIfTrue("唯一号已经存在");
|
exists.ThrowIfTrue("唯一号已经存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreTenant]
|
||||||
|
public async Task<bool> CheckExistsAsync(string deviceUniqueNo)
|
||||||
|
{
|
||||||
|
return await _dbContext.Queryable<DeviceEntity>()
|
||||||
|
.Where(x => x.UniqueNo == deviceUniqueNo && x.Enable)
|
||||||
|
.AnyAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class MealUserService : IMealUserService
|
|||||||
//todo 获取档案信息
|
//todo 获取档案信息
|
||||||
|
|
||||||
var gainfoEntity = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
var gainfoEntity = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||||
.Where(x => x.Guestno.ToString() == request.UserId)
|
.Where(x => x.No.ToString() == request.UserId)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|
||||||
gainfoEntity.ThrowIfNull($"档案[{request.UserId}]不存在");
|
gainfoEntity.ThrowIfNull($"档案[{request.UserId}]不存在");
|
||||||
@@ -44,7 +44,7 @@ public class MealUserService : IMealUserService
|
|||||||
{
|
{
|
||||||
UserId = request.UserId,
|
UserId = request.UserId,
|
||||||
UserType = request.UserType,
|
UserType = request.UserType,
|
||||||
UserCode = gainfoEntity.Ename,
|
UserCode = gainfoEntity.Code,
|
||||||
CarNo = gainfoEntity.CarNo,
|
CarNo = gainfoEntity.CarNo,
|
||||||
Balance = 0,
|
Balance = 0,
|
||||||
BalanceOfRecharge = 0,
|
BalanceOfRecharge = 0,
|
||||||
|
|||||||
@@ -31,4 +31,14 @@ public class WerksController : ControllerBase
|
|||||||
{
|
{
|
||||||
return await _werkService.GetListAsync();
|
return await _werkService.GetListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当前组织信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("current")]
|
||||||
|
public async Task<WerkResponse> GetCurrentAsync()
|
||||||
|
{
|
||||||
|
return await _werkService.GetCurrentAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
using Dlhis.Entity.Basic.Enums;
|
using Dlhis.Entity.Basic.Enums;
|
||||||
using Dlhis.Entity.Canteen.Enums;
|
|
||||||
using Kurisu.Core.DataAccess.Dto;
|
using Kurisu.Core.DataAccess.Dto;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Dlhis.Basic.Organization.Request
|
namespace Dlhis.Basic.Organization.Request;
|
||||||
|
|
||||||
|
public class GainfoPageRequest : PageDto
|
||||||
{
|
{
|
||||||
public class GainfoPageRequest : PageDto
|
/// <summary>
|
||||||
{
|
/// 档案类型
|
||||||
[EnumDataType(typeof(GainfoStatusEnumType))]
|
/// </summary>
|
||||||
public GainfoStatusEnumType gainfoStatus { get; set; }
|
[EnumDataType(typeof(GainfoStatusEnumType))]
|
||||||
}
|
public GainfoStatusEnumType Status { get; set; } = GainfoStatusEnumType.Working;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 部门号(部门树传入)
|
||||||
|
/// </summary>
|
||||||
|
public List<string> DepartmentNos { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,45 +2,47 @@
|
|||||||
|
|
||||||
public class GainfoPageResponse
|
public class GainfoPageResponse
|
||||||
{
|
{
|
||||||
/// <summary>
|
public string No { get; set; }
|
||||||
/// 档案号
|
|
||||||
/// </summary>
|
|
||||||
public string Guestno { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SAP内部编号
|
/// SAP内部编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Ano { get; set; }
|
public string SapNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 人员类型
|
/// 人员类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Class { get; set; }
|
public string GType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 姓名
|
/// 姓名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Gname { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 外文名字
|
||||||
|
/// </summary>
|
||||||
|
public string NameEn { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 工号
|
/// 工号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Ename { get; set; }
|
public string Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 国家代码
|
/// 国家代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Country { get; set; }
|
public string CountryNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 证件类型代码
|
/// 证件类型代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Idcls { get; set; }
|
public string IdClass { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 身份证号
|
/// 身份证号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IdNO { get; set; }
|
public string IdNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 身份证籍贯区域代码
|
/// 身份证籍贯区域代码
|
||||||
@@ -50,7 +52,7 @@ public class GainfoPageResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 性别
|
/// 性别
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Sex { get; set; }
|
public string Gender { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生日
|
/// 生日
|
||||||
@@ -65,12 +67,12 @@ public class GainfoPageResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 已婚/未婚
|
/// 已婚/未婚
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Postcode { get; set; }
|
public string Marital { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 部门编码
|
/// 部门编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Appellation { get; set; }
|
public string DepartmentNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 民族代码
|
/// 民族代码
|
||||||
@@ -82,11 +84,6 @@ public class GainfoPageResponse
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 联系电话
|
|
||||||
/// </summary>
|
|
||||||
public string Mobile { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 学历
|
/// 学历
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -95,7 +92,12 @@ public class GainfoPageResponse
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 岗位
|
/// 岗位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Web { get; set; }
|
public string Position { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 卡号
|
||||||
|
/// </summary>
|
||||||
|
public string CarNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注
|
/// 备注
|
||||||
@@ -103,42 +105,12 @@ public class GainfoPageResponse
|
|||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作账号
|
/// 人事范围
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Log_id { get; set; }
|
public string Werks { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 操作班次
|
/// 在职状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Log_shift { get; set; }
|
public string Employed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Log_date { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作IP
|
|
||||||
/// </summary>
|
|
||||||
public string Log_ip { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否在职 F 在职 T离职
|
|
||||||
/// </summary>
|
|
||||||
public string Isowner { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Createdate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 外文名字
|
|
||||||
/// </summary>
|
|
||||||
public string Gname_en { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 卡号
|
|
||||||
/// </summary>
|
|
||||||
public string CarNo { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ namespace Dlhis.Basic.Organization.Services;
|
|||||||
public interface IWerkService : IScopeDependency
|
public interface IWerkService : IScopeDependency
|
||||||
{
|
{
|
||||||
Task<List<WerkResponse>> GetListAsync();
|
Task<List<WerkResponse>> GetListAsync();
|
||||||
|
|
||||||
|
Task<WerkResponse> GetCurrentAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class GainfoService : IGainfoService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<Pagination<GainfoPageResponse>> GetPageAsync(GainfoPageRequest request)
|
public Task<Pagination<GainfoPageResponse>> GetPageAsync(GainfoPageRequest request)
|
||||||
{
|
{
|
||||||
var page = _gainfoStore.Queryable(request.gainfoStatus)
|
var page = _gainfoStore.Queryable(request.Status)
|
||||||
.Select<GainfoPageResponse>()
|
.Select<GainfoPageResponse>()
|
||||||
.ToPageListAsync(request);
|
.ToPageListAsync(request);
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class GainfoService : IGainfoService
|
|||||||
var gainfos = new List<GainfoEntity>();
|
var gainfos = new List<GainfoEntity>();
|
||||||
GainfoEntity aginfoEntity = request.Adapt<GainfoEntity>();
|
GainfoEntity aginfoEntity = request.Adapt<GainfoEntity>();
|
||||||
|
|
||||||
aginfoEntity.Guestno = "F" + Guid.NewGuid().ToString();
|
aginfoEntity.No = "F" + Guid.NewGuid().ToString();
|
||||||
gainfos.Add(aginfoEntity);
|
gainfos.Add(aginfoEntity);
|
||||||
|
|
||||||
await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos);
|
await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos);
|
||||||
@@ -84,7 +84,7 @@ public class GainfoService : IGainfoService
|
|||||||
public async Task DimissionAsync(GainfoDImissionRequest request)
|
public async Task DimissionAsync(GainfoDImissionRequest request)
|
||||||
{
|
{
|
||||||
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
|
||||||
.Where(x => x.Guestno == request.UserId)
|
.Where(x => x.No == request.UserId)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
gainfo.ThrowIfNull($"该档案不存在");
|
gainfo.ThrowIfNull($"该档案不存在");
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class GainfoService : IGainfoService
|
|||||||
public async Task OnboardingAsync(GainfoDImissionRequest request)
|
public async Task OnboardingAsync(GainfoDImissionRequest request)
|
||||||
{
|
{
|
||||||
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External)
|
var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External)
|
||||||
.Where(x => x.Guestno == request.UserId)
|
.Where(x => x.No == request.UserId)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
gainfo.ThrowIfNull($"该档案不存在");
|
gainfo.ThrowIfNull($"该档案不存在");
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class GainfoStore : IGainfoStore
|
|||||||
if (gainfoStatus.HasValue && gainfoStatus != GainfoStatusEnumType.Working)
|
if (gainfoStatus.HasValue && gainfoStatus != GainfoStatusEnumType.Working)
|
||||||
{
|
{
|
||||||
var tableName = typeof(GainfoEntity).GetCustomAttribute<SugarTable>().TableName;
|
var tableName = typeof(GainfoEntity).GetCustomAttribute<SugarTable>().TableName;
|
||||||
return _dbContext.Queryable<GainfoEntity>().AS(tableName + "_" + gainfoStatus);
|
return _dbContext.Queryable<GainfoEntity>().AS(tableName + gainfoStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _dbContext.Queryable<GainfoEntity>();
|
return _dbContext.Queryable<GainfoEntity>();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Dlhis.Basic.Organization.Response;
|
using Dlhis.Basic.Organization.Response;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
|
using Kurisu.Core.User.Abstractions;
|
||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
|
|
||||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||||
@@ -7,10 +8,12 @@ namespace Dlhis.Basic.Organization.Services.Implements;
|
|||||||
public class WerkService : IWerkService
|
public class WerkService : IWerkService
|
||||||
{
|
{
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
|
private readonly ICurrentUser _currentUser;
|
||||||
|
|
||||||
public WerkService(IDbContext dbContext)
|
public WerkService(IDbContext dbContext, ICurrentUser currentUser)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
|
_currentUser = currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<WerkResponse>> GetListAsync()
|
public async Task<List<WerkResponse>> GetListAsync()
|
||||||
@@ -19,4 +22,13 @@ public class WerkService : IWerkService
|
|||||||
.Select<WerkResponse>()
|
.Select<WerkResponse>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<WerkResponse> GetCurrentAsync()
|
||||||
|
{
|
||||||
|
var tenant = _currentUser.GetStringTenantId();
|
||||||
|
return await _dbContext.Queryable<WerkEntity>()
|
||||||
|
.Where(x => x.Code == tenant)
|
||||||
|
.Select<WerkResponse>()
|
||||||
|
.FirstAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ public class OrderService : IOrderService
|
|||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|
||||||
var gafinfo = await _dbContext.Queryable<GainfoEntity>()
|
var gafinfo = await _dbContext.Queryable<GainfoEntity>()
|
||||||
.Where(x => x.Guestno == canteenUser.UserId)
|
.Where(x => x.No == canteenUser.UserId)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|
||||||
var settings = await _canteenSettingService.GetUserSettingAsync(gafinfo.Guestno);
|
var settings = await _canteenSettingService.GetUserSettingAsync(gafinfo.No);
|
||||||
var switchTime = GetSetting<TimeOnly>(settings, CanteenSettingItemEnumType.BusinessSwitchTime);
|
var switchTime = GetSetting<TimeOnly>(settings, CanteenSettingItemEnumType.BusinessSwitchTime);
|
||||||
//金额处理
|
//金额处理
|
||||||
request.Amount = request.Type == BalanceRecordTypeEnumType.In ? Math.Abs(request.Amount) : -Math.Abs(request.Amount);
|
request.Amount = request.Type == BalanceRecordTypeEnumType.In ? Math.Abs(request.Amount) : -Math.Abs(request.Amount);
|
||||||
@@ -100,7 +100,7 @@ public class OrderService : IOrderService
|
|||||||
ThirdNo = request.ThirdNo,
|
ThirdNo = request.ThirdNo,
|
||||||
Type = request.Type.Value,
|
Type = request.Type.Value,
|
||||||
OrderStatus = CanteenOrderStatusEnumType.Wait,
|
OrderStatus = CanteenOrderStatusEnumType.Wait,
|
||||||
Name = gafinfo.Gname,
|
Name = gafinfo.Name,
|
||||||
Source = request.Source,
|
Source = request.Source,
|
||||||
UserId = canteenUser.UserId,
|
UserId = canteenUser.UserId,
|
||||||
UserCode = canteenUser.UserCode,
|
UserCode = canteenUser.UserCode,
|
||||||
@@ -109,7 +109,7 @@ public class OrderService : IOrderService
|
|||||||
BusinessShiftCode = shift?.Code,
|
BusinessShiftCode = shift?.Code,
|
||||||
CostDate = costDate.Date,
|
CostDate = costDate.Date,
|
||||||
CostId = canteenUser.CostId,
|
CostId = canteenUser.CostId,
|
||||||
DepartmentNo = gafinfo.Appellation,
|
DepartmentNo = gafinfo.DepartmentNo,
|
||||||
DeviceInfo = device.Code.ToString(),
|
DeviceInfo = device.Code.ToString(),
|
||||||
|
|
||||||
No = "O" + SnowFlakeHelper.Instance.NextId(),
|
No = "O" + SnowFlakeHelper.Instance.NextId(),
|
||||||
|
|||||||
@@ -79,14 +79,14 @@ public class DeviceEntity : SugarBaseEntity, ITenantId
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最后使用人
|
/// 最后使用人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "最后使用人")]
|
[SugarColumn(IsNullable = true, ColumnDescription = "最后使用人")]
|
||||||
public DateTime LastLogId { get; set; }
|
public DateTime? LastLogId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最后使用日期
|
/// 最后使用日期
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "最后使用日期")]
|
[SugarColumn(IsNullable = true, ColumnDescription = "最后使用日期")]
|
||||||
public DateTime LastLogDateTime { get; set; }
|
public DateTime? LastLogDateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using SqlSugar;
|
using Dlhis.Entity.Basic.Enums;
|
||||||
|
using SqlSugar;
|
||||||
|
using SqlSugar.DbConvert;
|
||||||
|
|
||||||
namespace Dlhis.Entity.Basic.Entity;
|
namespace Dlhis.Entity.Basic.Entity;
|
||||||
|
|
||||||
@@ -12,49 +14,55 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
/// 档案号
|
/// 档案号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "档案号")]
|
[SugarColumn(ColumnDescription = "档案号")]
|
||||||
public string Guestno { get; set; }
|
public string No { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SAP内部编号
|
/// SAP内部编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "SAP内部编号")]
|
[SugarColumn(ColumnDescription = "SAP内部编号")]
|
||||||
public string Ano { get; set; }
|
public string SapNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 人员类型
|
/// 人员类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "人员类型")]
|
[SugarColumn(ColumnDescription = "人员类型")]
|
||||||
public string Class { get; set; }
|
public string GType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 姓名
|
/// 姓名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "姓名")]
|
[SugarColumn(ColumnDescription = "姓名")]
|
||||||
public string Gname { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 外文名字
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "外文名字")]
|
||||||
|
public string NameEn { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 工号
|
/// 工号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "工号")]
|
[SugarColumn(ColumnDescription = "工号")]
|
||||||
public string Ename { get; set; }
|
public string Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 国家代码
|
/// 国家代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "国家代码")]
|
[SugarColumn(ColumnDescription = "国家代码")]
|
||||||
public string Country { get; set; }
|
public string CountryNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 证件类型代码
|
/// 证件类型代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "证件类型代码")]
|
[SugarColumn(ColumnDescription = "证件类型代码")]
|
||||||
public string Idcls { get; set; }
|
public string IdClass { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 身份证号
|
/// 身份证号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "身份证号")]
|
[SugarColumn(ColumnDescription = "身份证号")]
|
||||||
public string IdNO { get; set; }
|
public string IdNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 身份证籍贯区域代码
|
/// 身份证籍贯区域代码
|
||||||
@@ -65,8 +73,8 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 性别
|
/// 性别
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "性别")]
|
[SugarColumn(ColumnDescription = "性别", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||||
public string Sex { get; set; }
|
public GenderEnumType Gender { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生日
|
/// 生日
|
||||||
@@ -84,13 +92,13 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
/// 已婚/未婚
|
/// 已婚/未婚
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "已婚/未婚")]
|
[SugarColumn(ColumnDescription = "已婚/未婚")]
|
||||||
public string Postcode { get; set; }
|
public string Marital { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 部门编码
|
/// 部门编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "部门编码")]
|
[SugarColumn(ColumnDescription = "部门编码")]
|
||||||
public string Appellation { get; set; }
|
public string DepartmentNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 民族代码
|
/// 民族代码
|
||||||
@@ -104,12 +112,6 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
[SugarColumn(ColumnDescription = "手机号码")]
|
[SugarColumn(ColumnDescription = "手机号码")]
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 联系电话
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "联系电话")]
|
|
||||||
public string Mobile { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 学历
|
/// 学历
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -120,55 +122,7 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
/// 岗位
|
/// 岗位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "岗位")]
|
[SugarColumn(ColumnDescription = "岗位")]
|
||||||
public string Web { get; set; }
|
public string Position { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "备注")]
|
|
||||||
public string Remark { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作账号
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "操作账号")]
|
|
||||||
public string Log_id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作班次
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "操作班次")]
|
|
||||||
public string Log_shift { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "操作时间")]
|
|
||||||
public DateTime Log_date { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 操作IP
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "操作IP")]
|
|
||||||
public string Log_ip { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否在职 F 在职 T离职
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "是否在职 F 在职 T离职")]
|
|
||||||
public string Isowner { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "创建时间")]
|
|
||||||
public DateTime Createdate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 外文名字
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "外文名字")]
|
|
||||||
public string Gname_en { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 卡号
|
/// 卡号
|
||||||
@@ -176,6 +130,12 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
[SugarColumn(ColumnDescription = "卡号")]
|
[SugarColumn(ColumnDescription = "卡号")]
|
||||||
public string CarNo { get; set; }
|
public string CarNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "备注")]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 人事范围
|
/// 人事范围
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -183,14 +143,8 @@ public class GainfoEntity : SugarBaseEntity
|
|||||||
public string Werks { get; set; }
|
public string Werks { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 人员号
|
/// 在职状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "人员号")]
|
[SugarColumn(ColumnDescription = "在职状态")]
|
||||||
public string Pernr { get; set; }
|
public string Employed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 邮箱
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnDescription = "邮箱")]
|
|
||||||
public string Email { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Dlhis.Entity.Basic.Enums;
|
|||||||
public enum GainfoStatusEnumType
|
public enum GainfoStatusEnumType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 在职
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("在职")]
|
[Description("在职")]
|
||||||
Working = 1,
|
Working = 1,
|
||||||
@@ -21,7 +21,7 @@ public enum GainfoStatusEnumType
|
|||||||
Leave = 2,
|
Leave = 2,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 外部人员
|
/// 外部
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("外部")]
|
[Description("外部")]
|
||||||
External = 3
|
External = 3
|
||||||
|
|||||||
25
Src/Dlhis.Entity/Basic/Enums/GenderEnumType.cs
Normal file
25
Src/Dlhis.Entity/Basic/Enums/GenderEnumType.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Dlhis.Entity.Basic.Enums;
|
||||||
|
|
||||||
|
[Description("性别类型")]
|
||||||
|
public enum GenderEnumType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 女性
|
||||||
|
/// </summary>
|
||||||
|
[Description("女性")]
|
||||||
|
Female = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 男性
|
||||||
|
/// </summary>
|
||||||
|
[Description("男性")]
|
||||||
|
Male = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 未知
|
||||||
|
/// </summary>
|
||||||
|
[Description("未知")]
|
||||||
|
Unknown = 99,
|
||||||
|
}
|
||||||
@@ -12,10 +12,10 @@ namespace Dlhis.Entity.Sys.Entities;
|
|||||||
public class MenuPermissionEntity : SugarBaseEntity, ITenantId, ISoftDeleted
|
public class MenuPermissionEntity : SugarBaseEntity, ITenantId, ISoftDeleted
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 权限类型
|
/// 权限分配类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDataType = "varchar(50)", ColumnDescription = "权限类型", SqlParameterDbType = typeof(EnumToStringConvert))]
|
[SugarColumn(ColumnDataType = "varchar(50)", ColumnDescription = "权限分配类型", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||||
public MenuPermissionTypeEnumType UniqueType { get; set; }
|
public MenuAssignmentTypeEnumType UniqueType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 类型值
|
/// 类型值
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace Dlhis.Entity.Sys.Enums;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 权限类型
|
/// 权限类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("权限类型")]
|
[Description("权限分配类型")]
|
||||||
public enum MenuPermissionTypeEnumType
|
public enum MenuAssignmentTypeEnumType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户
|
/// 用户
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
namespace Dlhis.ScheduledTask.Configurations
|
namespace Dlhis.ScheduledTask.Configurations
|
||||||
{
|
{
|
||||||
//[Configuration]
|
[Configuration]
|
||||||
public class ServiceSettings
|
public class ServiceSettings
|
||||||
{
|
{
|
||||||
public string ServerUrl { get; private set; }
|
public string ServerUrl { get; private set; }
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.4.7" />
|
<PackageReference Include="Kurisu.AspNetCore" Version="0.4.7" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ EXPOSE 80
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
||||||
|
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||||
RUN dotnet restore "Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj"
|
RUN dotnet restore "Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/Src/Dlhis.ScheduledTask"
|
WORKDIR "/src/Src/Dlhis.ScheduledTask"
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
using Dlhis.ScheduledTask.Configurations;
|
|
||||||
using Dlhis.ScheduledTask.Job;
|
|
||||||
using Hangfire;
|
|
||||||
using Hangfire.Dashboard.BasicAuthorization;
|
|
||||||
using Hangfire.MySql;
|
|
||||||
using Kurisu.AspNetCore.Startup;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Dlhis.ScheduledTask
|
|
||||||
{
|
|
||||||
public class HangfirePack : BaseAppPack
|
|
||||||
{
|
|
||||||
public override bool IsBeforeUseRouting { get; }
|
|
||||||
|
|
||||||
public override void ConfigureServices(IServiceCollection services)
|
|
||||||
{
|
|
||||||
|
|
||||||
services.Configure<ServiceSettings>(Configuration.GetSection("ServiceSettings"));
|
|
||||||
services.AddHangfire(configuration =>
|
|
||||||
{
|
|
||||||
var options = new MySqlStorageOptions
|
|
||||||
{
|
|
||||||
TablesPrefix = "Hangfire"
|
|
||||||
};
|
|
||||||
|
|
||||||
configuration.UseSimpleAssemblyNameTypeSerializer()
|
|
||||||
.UseRecommendedSerializerSettings()
|
|
||||||
.UseStorage(new MySqlStorage(Configuration.GetConnectionString("HangfireConnection"), options));
|
|
||||||
|
|
||||||
});
|
|
||||||
services.UseHangfireto();
|
|
||||||
services.AddHangfireServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
||||||
{
|
|
||||||
|
|
||||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
|
||||||
{
|
|
||||||
AppPath = null,
|
|
||||||
DashboardTitle = "hangfire",
|
|
||||||
Authorization = new[]
|
|
||||||
{
|
|
||||||
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
|
|
||||||
{
|
|
||||||
RequireSsl = false,
|
|
||||||
SslRedirect = false,
|
|
||||||
Users = new []
|
|
||||||
{
|
|
||||||
new BasicAuthAuthorizationUser
|
|
||||||
{
|
|
||||||
Login ="admin",
|
|
||||||
PasswordClear = "admin"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
app.UseHangfireDashboard();
|
|
||||||
BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job."));
|
|
||||||
RecurringJob.AddOrUpdate<SyncOrgInfoJob>("SyncOrgInfoJob_id", s => s.SyncOrgInfo(), "0 0 0 * * ?");
|
|
||||||
RecurringJob.AddOrUpdate<SyncPositionJob>("SyncPositionJob_id", s =>s.SyncPositionInfo(), "0 0 1 * * ?");
|
|
||||||
RecurringJob.AddOrUpdate<SyncPersonJob>("SyncPersonJob_id", s => s.SyncPersonInfo(), "0 0 2 * * ?");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,9 +22,9 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task SyncOrgInfo()
|
|
||||||
|
public async Task SyncOrgInfo()
|
||||||
{
|
{
|
||||||
HttpClient httpClient = new HttpClient();
|
HttpClient httpClient = new HttpClient();
|
||||||
httpClient.Timeout = TimeSpan.FromMinutes(10);
|
httpClient.Timeout = TimeSpan.FromMinutes(10);
|
||||||
@@ -32,8 +32,7 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
|
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
|
||||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
|
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
|
||||||
|
|
||||||
string apiUrl =
|
string apiUrl = "http://sappidap.jinkosolar.cn:51000/RESTAdapter/Rest/EHR_ORGANIZATION/";
|
||||||
"http://sappidap.jinkosolar.cn:51000/RESTAdapter/Rest/EHR_ORGANIZATION/";
|
|
||||||
|
|
||||||
|
|
||||||
string requestBody = "{\"I_DATE\":\"2021-01-01\",\"I_DATE_TO\":\"2022-05-29\",\"I_LANGU\":\"1\",\"T_ID\":{\"item\":[{\"OBJID\":\"50007967\"},{\"OBJID\":\"50008308\"}]}}";
|
string requestBody = "{\"I_DATE\":\"2021-01-01\",\"I_DATE_TO\":\"2022-05-29\",\"I_LANGU\":\"1\",\"T_ID\":{\"item\":[{\"OBJID\":\"50007967\"},{\"OBJID\":\"50008308\"}]}}";
|
||||||
@@ -43,7 +42,7 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
string responseData = await response.Content.ReadAsStringAsync();
|
string responseData = await response.Content.ReadAsStringAsync();
|
||||||
ZHRS_ORGResult orgResult = JsonSerializer.Deserialize<ZHRS_ORGResult>(responseData);
|
ZHRS_ORGResult orgResult = JsonSerializer.Deserialize<ZHRS_ORGResult>(responseData);
|
||||||
|
|
||||||
if (orgResult.T_ORG != null && orgResult.T_ORG.item.Count > 0)
|
if (orgResult.T_ORG != null && orgResult.T_ORG.item.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -52,10 +51,10 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
// 使用 SQLSugar 将新数据同步到数据库
|
// 使用 SQLSugar 将新数据同步到数据库
|
||||||
await SaveOrg(modifiedOrgList);
|
await SaveOrg(modifiedOrgList);
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
// Console.WriteLine($"HTTP请求失败,状态码:{response.StatusCode}");
|
// Console.WriteLine($"HTTP请求失败,状态码:{response.StatusCode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,19 +69,17 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
return sapList.Except(needRemove, new ZHRS_ORGComparer()).ToList();
|
return sapList.Except(needRemove, new ZHRS_ORGComparer()).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveOrg(List<ZHRS_ORG> modifiedOrgList)
|
private async Task SaveOrg(List<ZHRS_ORG> modifiedOrgList)
|
||||||
{
|
{
|
||||||
if (modifiedOrgList == null || modifiedOrgList.Count == 0) return;
|
if (modifiedOrgList == null || modifiedOrgList.Count == 0) return;
|
||||||
|
|
||||||
foreach (ZHRS_ORG item in modifiedOrgList)
|
foreach (ZHRS_ORG item in modifiedOrgList)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var existingOrgs = await _dbContext.Queryable<ZHRF_SYN_01Entity>().Where(x => x.OBJID == item.OBJID).FirstAsync();
|
var existingOrgs = await _dbContext.Queryable<ZHRF_SYN_01Entity>().Where(x => x.OBJID == item.OBJID).FirstAsync();
|
||||||
|
|
||||||
if (existingOrgs != null)
|
if (existingOrgs != null)
|
||||||
{
|
{
|
||||||
var org = item.Adapt(existingOrgs);
|
var org = item.Adapt(existingOrgs);
|
||||||
await _dbContext.UpdateAsync(org);
|
await _dbContext.UpdateAsync(org);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -90,7 +87,7 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
var org = item.Adapt<ZHRF_SYN_01Entity>();
|
var org = item.Adapt<ZHRF_SYN_01Entity>();
|
||||||
await _dbContext.InsertAsync(org);
|
await _dbContext.InsertAsync(org);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
//var existsWorkCodes = conn.Query<string>($"select ename from gainfo_sap where ename in ( {string.Join(",", searchCodes.Select(x => $"'{x}'"))} )")
|
//var existsWorkCodes = conn.Query<string>($"select ename from gainfo_sap where ename in ( {string.Join(",", searchCodes.Select(x => $"'{x}'"))} )")
|
||||||
// .ToList();
|
// .ToList();
|
||||||
var existsWorkCodes = _dbContext.Queryable<GainfoEntity>()
|
var existsWorkCodes = _dbContext.Queryable<GainfoEntity>()
|
||||||
.Where(x => searchCodes.Contains(x.Ename))
|
.Where(x => searchCodes.Contains(x.Code))
|
||||||
.Select(x => x.Ename)
|
.Select(x => x.Code)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var originUpdates = persons.Where(x => existsWorkCodes.Contains(x.ZWORKCODE)).ToList();
|
var originUpdates = persons.Where(x => existsWorkCodes.Contains(x.ZWORKCODE)).ToList();
|
||||||
@@ -120,7 +120,7 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
i++;
|
i++;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await UpdatePerson(item);
|
await UpdatePerson(item);
|
||||||
//conn.Execute(SqlGeneration.UpdateSql, item);
|
//conn.Execute(SqlGeneration.UpdateSql, item);
|
||||||
//log.Debug($"执行更新{i}/{currentTotal} name:{item.gname},ename:{item.ename}");
|
//log.Debug($"执行更新{i}/{currentTotal} name:{item.gname},ename:{item.ename}");
|
||||||
}
|
}
|
||||||
@@ -142,19 +142,18 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
|
|
||||||
private async Task SavePerson(GainfoSap item)
|
private async Task SavePerson(GainfoSap item)
|
||||||
{
|
{
|
||||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNO == item.idno).FirstAsync();
|
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == item.idno).FirstAsync();
|
||||||
if (gainfo != null)
|
if (gainfo != null)
|
||||||
{
|
{
|
||||||
gainfo.Pernr = item.PERNR;
|
gainfo.SapNo = item.PERNR;
|
||||||
gainfo.Gname = item.gname;
|
gainfo.Name = item.gname;
|
||||||
gainfo.Ename = item.ename;
|
gainfo.Code = item.ename;
|
||||||
gainfo.Web = item.web;
|
gainfo.Position = item.web;
|
||||||
gainfo.Phone = item.phone;
|
gainfo.Phone = item.phone;
|
||||||
gainfo.Appellation = item.appellation;
|
gainfo.DepartmentNo = item.appellation;
|
||||||
gainfo.Isowner = item.isowner;
|
gainfo.Employed = item.isowner;
|
||||||
gainfo.Remark = item.remark;
|
gainfo.Remark = item.remark;
|
||||||
gainfo.Email = item.email;
|
gainfo.Degree = item.email;
|
||||||
gainfo.Createdate = (DateTime)item.createdate;
|
|
||||||
gainfo.Werks = item.WERKS;
|
gainfo.Werks = item.WERKS;
|
||||||
await _dbContext.UpdateAsync(gainfo);
|
await _dbContext.UpdateAsync(gainfo);
|
||||||
}
|
}
|
||||||
@@ -162,30 +161,29 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
{
|
{
|
||||||
var info = new GainfoEntity()
|
var info = new GainfoEntity()
|
||||||
{
|
{
|
||||||
Ano = item.ano,
|
SapNo = item.ano,
|
||||||
Guestno = item.guestno,
|
No = item.guestno,
|
||||||
Class = item.@class,
|
GType = item.@class,
|
||||||
Gname = item.gname,
|
Name = item.gname,
|
||||||
Ename = item.ename,
|
Code = item.ename,
|
||||||
Country = item.country,
|
CountryNo = item.country,
|
||||||
Idcls = item.idcls,
|
IdClass = item.idcls,
|
||||||
Native = item.native,
|
Native = item.native,
|
||||||
Sex = item.sex,
|
Gender = item.sex,
|
||||||
Birthday = (DateTime)item.birthday,
|
Birthday = (DateTime)item.birthday,
|
||||||
Address = item.address,
|
Address = item.address,
|
||||||
//Occupation = item.occupation,
|
//Occupation = item.occupation,
|
||||||
Appellation = item.appellation,
|
DepartmentNo = item.appellation,
|
||||||
Nation = item.nation,
|
Nation = item.nation,
|
||||||
Phone = item.phone,
|
Phone = item.phone,
|
||||||
Web = item.web,
|
Position = item.web,
|
||||||
Log_id = item.log_id,
|
//Log_id = item.log_id,
|
||||||
Log_shift = item.log_shift,
|
//Log_shift = item.log_shift,
|
||||||
Log_date = (DateTime)item.log_date,
|
//Log_date = (DateTime)item.log_date,
|
||||||
Log_ip = item.log_ip,
|
//Log_ip = item.log_ip,
|
||||||
Isowner = item.isowner,
|
Employed = item.isowner,
|
||||||
Remark = item.remark,
|
Remark = item.remark,
|
||||||
Email = item.email,
|
Degree = item.email,
|
||||||
Createdate = (DateTime)item.createdate,
|
|
||||||
Werks = item.WERKS,
|
Werks = item.WERKS,
|
||||||
};
|
};
|
||||||
await _dbContext.InsertAsync(info);
|
await _dbContext.InsertAsync(info);
|
||||||
@@ -193,46 +191,44 @@ namespace Dlhis.ScheduledTask.Job
|
|||||||
}
|
}
|
||||||
private async Task UpdatePerson(GainfoSap item)
|
private async Task UpdatePerson(GainfoSap item)
|
||||||
{
|
{
|
||||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNO == item.idno).FirstAsync();
|
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.IdNo == item.idno).FirstAsync();
|
||||||
if (gainfo != null)
|
if (gainfo != null)
|
||||||
{
|
{
|
||||||
_dbContext.Updateable<GainfoEntity>().SetColumns(g => new GainfoEntity
|
_dbContext.Updateable<GainfoEntity>().SetColumns(g => new GainfoEntity
|
||||||
{
|
{
|
||||||
Pernr = item.PERNR,
|
SapNo = item.PERNR,
|
||||||
Gname = item.gname,
|
Name = item.gname,
|
||||||
Ename = item.ename,
|
Code = item.ename,
|
||||||
Web = item.web,
|
Position = item.web,
|
||||||
Phone = item.phone,
|
Phone = item.phone,
|
||||||
Appellation = item.appellation,
|
DepartmentNo = item.appellation,
|
||||||
Isowner = item.isowner,
|
Employed = item.isowner,
|
||||||
Remark = item.remark,
|
Remark = item.remark,
|
||||||
Email = item.email,
|
Degree = item.email,
|
||||||
Createdate = (DateTime)item.createdate,
|
|
||||||
Werks = item.WERKS
|
Werks = item.WERKS
|
||||||
})
|
})
|
||||||
.Where(g => g.IdNO == item.idno
|
.Where(g => g.IdNo == item.idno
|
||||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNO == item.idno && g.Pernr != item.PERNR && g.Isowner == "T")
|
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNo == item.idno && g.SapNo != item.PERNR && g.Employed == "T")
|
||||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNO == item.idno && int.Parse(g.Pernr) > int.Parse(item.PERNR) && g.Isowner == item.isowner));
|
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNo == item.idno && int.Parse(g.SapNo) > int.Parse(item.PERNR) && g.Employed == item.isowner));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_dbContext.Updateable<GainfoEntity>().SetColumns(g => new GainfoEntity
|
_dbContext.Updateable<GainfoEntity>().SetColumns(g => new GainfoEntity
|
||||||
{
|
{
|
||||||
Pernr = item.PERNR,
|
SapNo = item.PERNR,
|
||||||
Gname = item.gname,
|
Name = item.gname,
|
||||||
Ename = item.ename,
|
Code = item.ename,
|
||||||
Web = item.web,
|
Position = item.web,
|
||||||
Phone = item.phone,
|
Phone = item.phone,
|
||||||
Appellation = item.appellation,
|
DepartmentNo = item.appellation,
|
||||||
Isowner = item.isowner,
|
Employed = item.isowner,
|
||||||
Remark = item.remark,
|
Remark = item.remark,
|
||||||
Email = item.email,
|
Degree = item.email,
|
||||||
Createdate = (DateTime)item.createdate,
|
|
||||||
Werks = item.WERKS
|
Werks = item.WERKS
|
||||||
})
|
})
|
||||||
.Where(g => g.Ano == item.PERNR
|
.Where(g => g.SapNo == item.PERNR
|
||||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.Ename == item.ename && g.Isowner == "T")
|
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.Code == item.ename && g.Employed == "T")
|
||||||
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNO == item.idno && int.Parse(g.Pernr) > int.Parse(item.PERNR) && g.Isowner == item.isowner));
|
&& !_dbContext.Queryable<GainfoEntity>().Any(g => g.IdNo == item.idno && int.Parse(g.SapNo) > int.Parse(item.PERNR) && g.Employed == item.isowner));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
67
Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs
Normal file
67
Src/Dlhis.ScheduledTask/Packs/HangfirePack.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using Dlhis.ScheduledTask.Configurations;
|
||||||
|
using Dlhis.ScheduledTask.Job;
|
||||||
|
using Hangfire;
|
||||||
|
using Hangfire.Dashboard.BasicAuthorization;
|
||||||
|
using Hangfire.MySql;
|
||||||
|
using Kurisu.AspNetCore.Startup;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Dlhis.ScheduledTask.Packs;
|
||||||
|
|
||||||
|
public class HangfirePack : BaseAppPack
|
||||||
|
{
|
||||||
|
public override bool IsBeforeUseRouting { get; }
|
||||||
|
|
||||||
|
public override void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
|
||||||
|
services.Configure<ServiceSettings>(Configuration.GetSection("ServiceSettings"));
|
||||||
|
services.AddHangfire(configuration =>
|
||||||
|
{
|
||||||
|
var options = new MySqlStorageOptions
|
||||||
|
{
|
||||||
|
TablesPrefix = "Hangfire"
|
||||||
|
};
|
||||||
|
|
||||||
|
configuration.UseSimpleAssemblyNameTypeSerializer()
|
||||||
|
.UseRecommendedSerializerSettings()
|
||||||
|
.UseStorage(new MySqlStorage(Configuration.GetConnectionString("HangfireConnection"), options));
|
||||||
|
|
||||||
|
});
|
||||||
|
services.UseHangfireto();
|
||||||
|
services.AddHangfireServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
|
||||||
|
app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
||||||
|
{
|
||||||
|
AppPath = null,
|
||||||
|
DashboardTitle = "hangfire",
|
||||||
|
Authorization = new[]
|
||||||
|
{
|
||||||
|
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions
|
||||||
|
{
|
||||||
|
RequireSsl = false,
|
||||||
|
SslRedirect = false,
|
||||||
|
Users = new []
|
||||||
|
{
|
||||||
|
new BasicAuthAuthorizationUser
|
||||||
|
{
|
||||||
|
Login ="admin",
|
||||||
|
PasswordClear = "admin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.UseHangfireDashboard();
|
||||||
|
|
||||||
|
BackgroundJob.Enqueue(() => Console.WriteLine("This is a background job."));
|
||||||
|
RecurringJob.AddOrUpdate<SyncOrgInfoJob>("SyncOrgInfoJob_id", s => s.SyncOrgInfo(), "0 0 0 * * ?");
|
||||||
|
RecurringJob.AddOrUpdate<SyncPositionJob>("SyncPositionJob_id", s => s.SyncPositionInfo(), "0 0 1 * * ?");
|
||||||
|
RecurringJob.AddOrUpdate<SyncPersonJob>("SyncPersonJob_id", s => s.SyncPersonInfo(), "0 0 2 * * ?");
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
Normal file
15
Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Kurisu.AspNetCore.Startup;
|
||||||
|
using Kurisu.SqlSugar.Extensions;
|
||||||
|
|
||||||
|
namespace Dlhis.ScheduledTask.Packs;
|
||||||
|
|
||||||
|
public class SqlSugarPack : BaseAppPack
|
||||||
|
{
|
||||||
|
public override bool IsBeforeUseRouting { get; }
|
||||||
|
|
||||||
|
public override void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHttpContextAccessor();
|
||||||
|
services.AddSqlSugar();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,5 @@ public class Startup : DefaultStartup
|
|||||||
{
|
{
|
||||||
public Startup(IConfiguration configuration) : base(configuration)
|
public Startup(IConfiguration configuration) : base(configuration)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using Dlhis.ScheduledTask.Entities;
|
|
||||||
|
|
||||||
namespace Dlhis
|
|
||||||
{
|
|
||||||
public class SqlGeneration
|
|
||||||
{
|
|
||||||
private static string _insertSql;
|
|
||||||
private static string _updateSql;
|
|
||||||
|
|
||||||
static SqlGeneration()
|
|
||||||
{
|
|
||||||
//""
|
|
||||||
var properties = typeof(GainfoSap).GetProperties();
|
|
||||||
|
|
||||||
var insertFields = properties
|
|
||||||
.Where(x => !x.IsDefined(typeof(IgnoreColumnAttribute), false))
|
|
||||||
.Where(x => !x.IsDefined(typeof(PkColumnAttribute), false))
|
|
||||||
.Select(x => x.Name);
|
|
||||||
_insertSql = $" insert into gainfo_sap({string.Join(",", insertFields)}) \r\n values \r\n ({string.Join(",", insertFields.Select(x => $"@{x}"))})";
|
|
||||||
|
|
||||||
var updateFields = properties
|
|
||||||
.Where(x => !x.IsDefined(typeof(IgnoreColumnAttribute), false))
|
|
||||||
.Where(x => !x.IsDefined(typeof(PkColumnAttribute), false))
|
|
||||||
.Where(x => !x.IsDefined(typeof(UpdateColumnAttribute), false))
|
|
||||||
.Select(x => x.Name);
|
|
||||||
_updateSql = $" update gainfo_sap set {string.Join(",", updateFields.Select(x => $"{x}=@{x}"))} \t\n where ename=@ename";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string InsertSql => _insertSql;
|
|
||||||
public static string UpdateSql => _updateSql;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using Kurisu.AspNetCore.Startup;
|
|
||||||
using Kurisu.AspNetCore;
|
|
||||||
using Kurisu.SqlSugar.Extensions;
|
|
||||||
using SqlSugar;
|
|
||||||
|
|
||||||
namespace Dlhis.ScheduledTask
|
|
||||||
{
|
|
||||||
public class SqlSugarPack : BaseAppPack
|
|
||||||
{
|
|
||||||
public override bool IsBeforeUseRouting { get; }
|
|
||||||
|
|
||||||
public override void ConfigureServices(IServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddHttpContextAccessor();
|
|
||||||
services.AddSqlSugar();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
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);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,10 +18,12 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.4.7" />
|
<PackageReference Include="Kurisu.AspNetCore" Version="0.4.7" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
<ProjectReference Include="..\Dlhis.Entity\Dlhis.Entity.csproj" />
|
||||||
|
<ProjectReference Include="..\Dlhis.User.Api\Dlhis.User.Api.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -6,17 +6,18 @@ EXPOSE 80
|
|||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["Src/Dlhis.Permission/Dlhis.Permission.csproj", "Src/Dlhis.Permission/"]
|
COPY ["Src/Dlhis.Sys/Dlhis.Sys.csproj", "Src/Dlhis.Sys/"]
|
||||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||||
RUN dotnet restore "Src/Dlhis.Permission/Dlhis.Permission.csproj"
|
COPY ["Src/Dlhis.User.Api/Dlhis.User.Api.csproj", "Src/Dlhis.User.Api/"]
|
||||||
|
RUN dotnet restore "Src/Dlhis.Sys/Dlhis.Sys.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/Src/Dlhis.Permission"
|
WORKDIR "/src/Src/Dlhis.Sys"
|
||||||
RUN dotnet build "Dlhis.Permission.csproj" -c Release -o /app/build
|
RUN dotnet build "Dlhis.Sys.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "Dlhis.Permission.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
RUN dotnet publish "Dlhis.Sys.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
ENTRYPOINT ["dotnet", "Dlhis.Permission.dll"]
|
ENTRYPOINT ["dotnet", "Dlhis.Sys.dll"]
|
||||||
@@ -8,6 +8,9 @@ using Dlhis.Entity.Sys.Enums;
|
|||||||
|
|
||||||
namespace Dlhis.Sys.Menu.Controllers;
|
namespace Dlhis.Sys.Menu.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单
|
||||||
|
/// </summary>
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
@@ -23,14 +26,11 @@ public class MenusController : ControllerBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单列表
|
/// 菜单列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="platform">菜单平台类型 PlatformEnumType</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("list")]
|
[HttpGet("list")]
|
||||||
public async Task<List<MenuResponse>> GetListAsync([EnumDataType(typeof(PlatformEnumType))] PlatformEnumType? platform)
|
public async Task<List<MenuResponse>> GetListAsync([EnumDataType(typeof(PlatformEnumType))] PlatformEnumType? platform = PlatformEnumType.PCAdmin)
|
||||||
{
|
{
|
||||||
if (!platform.HasValue)
|
|
||||||
{
|
|
||||||
platform = PlatformEnumType.UserMobile;
|
|
||||||
}
|
|
||||||
return await _menuService.GetListAsync(platform.Value);
|
return await _menuService.GetListAsync(platform.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,17 +59,19 @@ public class MenusController : ControllerBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前类型的权限分配
|
/// 当前类型的权限分配
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="permissionType">权限类型</param>
|
/// <param name="uniqueType">权限分配类型 MenuAssignmentTypeEnumType</param>
|
||||||
/// <param name="uniqueValue">类型对应的唯一值</param>
|
/// <param name="uniqueValue">类型对应的唯一值</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("assignments")]
|
[HttpGet("assignments")]
|
||||||
public async Task<List<string>> GetAssignmentsAsync([EnumDataType(typeof(MenuPermissionTypeEnumType))] MenuPermissionTypeEnumType permissionType, [Required] string uniqueValue)
|
public async Task<List<string>> GetAssignmentsAsync(
|
||||||
|
[EnumDataType(typeof(MenuAssignmentTypeEnumType))] MenuAssignmentTypeEnumType uniqueType,
|
||||||
|
[Required] string uniqueValue)
|
||||||
{
|
{
|
||||||
return await _menuService.GetAssignmentCodesAsync(permissionType, uniqueValue);
|
return await _menuService.GetAssignmentCodesAsync(uniqueType, uniqueValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取所有权限分配
|
/// 获取我的所有权限
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("assignments/all")]
|
[HttpGet("assignments/all")]
|
||||||
@@ -79,7 +81,7 @@ public class MenusController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 我的菜单
|
/// 获取我的菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("my")]
|
[HttpGet("my")]
|
||||||
@@ -89,7 +91,7 @@ public class MenusController : ControllerBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置
|
/// 重置所有路由
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ namespace Dlhis.Sys.Menu.Request;
|
|||||||
public class MenuPermissionAssignmentRequest
|
public class MenuPermissionAssignmentRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 权限类型
|
/// 权限类型 MenuAssignmentTypeEnumType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[EnumDataType(typeof(MenuPermissionTypeEnumType))]
|
[EnumDataType(typeof(MenuAssignmentTypeEnumType))]
|
||||||
public MenuPermissionTypeEnumType UniqueType { get; set; }
|
public MenuAssignmentTypeEnumType UniqueType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 唯一值
|
/// 唯一值
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ public class SaveMenuRequest : IValidatableObject
|
|||||||
public int Sequence { get; set; }
|
public int Sequence { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单类型
|
/// 菜单类型 MenuEnumType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[EnumDataType(typeof(MenuEnumType))]
|
[EnumDataType(typeof(MenuEnumType))]
|
||||||
public MenuEnumType MenuType { get; set; }
|
public MenuEnumType MenuType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 平台
|
/// 平台 PlatformEnumType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[EnumDataType(typeof(PlatformEnumType))]
|
[EnumDataType(typeof(PlatformEnumType))]
|
||||||
public PlatformEnumType Platform { get; set; }
|
public PlatformEnumType Platform { get; set; }
|
||||||
|
|||||||
@@ -68,12 +68,6 @@ public class MenuResponse
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PlatformEnumType Platform { get; set; }
|
public PlatformEnumType Platform { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 手机端才会有
|
|
||||||
/// </summary>
|
|
||||||
public List<string> HotelIds { get; set; } = new List<string>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子菜单
|
/// 子菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Dlhis.Sys.Menu.Response;
|
|||||||
|
|
||||||
namespace Dlhis.Sys.Menu.Services;
|
namespace Dlhis.Sys.Menu.Services;
|
||||||
|
|
||||||
public interface IMenuService
|
public interface IMenuService : IScopeDependency
|
||||||
{
|
{
|
||||||
Task<List<MenuResponse>> GetListAsync(PlatformEnumType platform);
|
Task<List<MenuResponse>> GetListAsync(PlatformEnumType platform);
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ public interface IMenuService
|
|||||||
|
|
||||||
Task AssignmentAsync(MenuPermissionAssignmentRequest request);
|
Task AssignmentAsync(MenuPermissionAssignmentRequest request);
|
||||||
|
|
||||||
Task<List<string>> GetAssignmentCodesAsync(MenuPermissionTypeEnumType permissionType, string uniqueData);
|
Task<List<string>> GetAssignmentCodesAsync(MenuAssignmentTypeEnumType permissionType, string uniqueData);
|
||||||
|
|
||||||
Task<List<string>> GetAllAssignmentPermissionsAsync();
|
Task<List<string>> GetAllAssignmentPermissionsAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
using Dlhis.Entity.Sys.Enums;
|
using Dlhis.Entity.Sys.Enums;
|
||||||
using Dlhis.Sys.Menu.Request;
|
using Dlhis.Sys.Menu.Request;
|
||||||
using Dlhis.Sys.Menu.Response;
|
using Dlhis.Sys.Menu.Response;
|
||||||
|
using Dlhis.User.Api;
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
using Kurisu.Core.User.Abstractions;
|
using Kurisu.Core.User.Abstractions;
|
||||||
|
using Kurisu.SqlSugar.Attributes;
|
||||||
using Kurisu.SqlSugar.Services;
|
using Kurisu.SqlSugar.Services;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
|
||||||
@@ -13,11 +15,13 @@ public class MenuService : IMenuService
|
|||||||
{
|
{
|
||||||
private readonly IDbContext _dbContext;
|
private readonly IDbContext _dbContext;
|
||||||
private readonly ICurrentUser _currentUser;
|
private readonly ICurrentUser _currentUser;
|
||||||
|
private readonly IUserApi _userApi;
|
||||||
|
|
||||||
public MenuService(IDbContext dbContext, ICurrentUser currentUser)
|
public MenuService(IDbContext dbContext, ICurrentUser currentUser, IUserApi userApi)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
_currentUser = currentUser;
|
_currentUser = currentUser;
|
||||||
|
_userApi = userApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<MenuResponse>> GetListAsync(PlatformEnumType platform)
|
public async Task<List<MenuResponse>> GetListAsync(PlatformEnumType platform)
|
||||||
@@ -37,6 +41,7 @@ public class MenuService : IMenuService
|
|||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Transactional]
|
||||||
public async Task SaveMenuAsync(SaveMenuRequest request)
|
public async Task SaveMenuAsync(SaveMenuRequest request)
|
||||||
{
|
{
|
||||||
await CheckAsync(request);
|
await CheckAsync(request);
|
||||||
@@ -57,27 +62,9 @@ public class MenuService : IMenuService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task ChangeIfCodeEditAsync(string beforeCode, string pcode)
|
|
||||||
{
|
|
||||||
if (beforeCode != pcode)
|
|
||||||
{
|
|
||||||
//修改下级的PCode为当前的code
|
|
||||||
var menus = await _dbContext.Queryable<MenuEntity>().Where(x => x.PCode == beforeCode).ToListAsync();
|
|
||||||
menus.ForEach(x => { x.PCode = pcode; });
|
|
||||||
|
|
||||||
//修改权限code为当前的code,避免权限丢失
|
|
||||||
var permissions = await _dbContext.Queryable<MenuPermissionEntity>().Where(x => x.Code == beforeCode).ToListAsync();
|
|
||||||
permissions.ForEach(x => { x.Code = pcode; });
|
|
||||||
|
|
||||||
await _dbContext.UpdateAsync(menus);
|
|
||||||
await _dbContext.UpdateAsync(permissions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AssignmentAsync(MenuPermissionAssignmentRequest request)
|
public async Task AssignmentAsync(MenuPermissionAssignmentRequest request)
|
||||||
{
|
{
|
||||||
(request.UniqueType == MenuPermissionTypeEnumType.Role).ThrowIfTrue("暂不支持角色分配");
|
(request.UniqueType == MenuAssignmentTypeEnumType.Role).ThrowIfTrue("暂不支持角色分配");
|
||||||
|
|
||||||
//清空覆盖
|
//清空覆盖
|
||||||
var permissionsToDelete = await _dbContext.Queryable<MenuPermissionEntity>()
|
var permissionsToDelete = await _dbContext.Queryable<MenuPermissionEntity>()
|
||||||
@@ -98,15 +85,57 @@ public class MenuService : IMenuService
|
|||||||
await _dbContext.InsertAsync(permissions);
|
await _dbContext.InsertAsync(permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<string>> GetAssignmentCodesAsync(MenuPermissionTypeEnumType permissionType, string uniqueData)
|
public async Task<List<string>> GetAssignmentCodesAsync(MenuAssignmentTypeEnumType uniqueType, string uniqueData)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var permissionCodes = await _dbContext.Queryable<MenuPermissionEntity>()
|
||||||
|
.Where(x => x.UniqueType == uniqueType)
|
||||||
|
.Where(x => x.UniqueValue == uniqueData)
|
||||||
|
.Select(x => x.Code)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var menus = await GetListAsync(PlatformEnumType.PCAdmin);
|
||||||
|
|
||||||
|
foreach (var menu in menus)
|
||||||
|
{
|
||||||
|
if (menu.Items.Any())
|
||||||
|
{
|
||||||
|
var codes = RecursionHandler(menu.Items, permissionCodes);
|
||||||
|
permissionCodes.RemoveAll(x => codes.Contains(x));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return permissionCodes;
|
||||||
|
|
||||||
|
static List<string> RecursionHandler(List<MenuResponse> menus, List<string> innerPermissions)
|
||||||
|
{
|
||||||
|
var codes = new HashSet<string>();
|
||||||
|
foreach (var menu in menus)
|
||||||
|
{
|
||||||
|
if (menu.Items.Any())
|
||||||
|
{
|
||||||
|
var innerPermissionCodes = RecursionHandler(menu.Items, innerPermissions);
|
||||||
|
foreach (var item in innerPermissionCodes)
|
||||||
|
{
|
||||||
|
codes.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!innerPermissions.Contains(menu.Code))
|
||||||
|
{
|
||||||
|
foreach (var item in menu.Items.Select(x => x.Code))
|
||||||
|
{
|
||||||
|
codes.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return codes.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<string>> GetAllAssignmentPermissionsAsync()
|
public async Task<List<string>> GetAllAssignmentPermissionsAsync()
|
||||||
{
|
{
|
||||||
var all = await GetAllAssignmentCodesAsync();
|
var all = await GetAllAssignmentCodesAsync();
|
||||||
|
|
||||||
return await _dbContext.Queryable<MenuEntity>().Where(x => all.Contains(x.Code)).Select(x => x.Permission).ToListAsync();
|
return await _dbContext.Queryable<MenuEntity>().Where(x => all.Contains(x.Code)).Select(x => x.Permission).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,20 +267,34 @@ public class MenuService : IMenuService
|
|||||||
|
|
||||||
private async Task<List<string>> GetAllAssignmentCodesAsync()
|
private async Task<List<string>> GetAllAssignmentCodesAsync()
|
||||||
{
|
{
|
||||||
var user = await _dbContext.Queryable<UserEntity>().Where(x => x.Id == _currentUser.GetIntSubjectId()).FirstAsync();
|
var userApiResult = await _userApi.GetUserByIdAsync(_currentUser.GetIntSubjectId());
|
||||||
if (user == null)
|
(userApiResult.Code == Kurisu.Core.Result.ApiStateCode.Success).ThrowIfFalse(userApiResult.Msg);
|
||||||
|
var user = userApiResult.Data;
|
||||||
|
|
||||||
|
// var groupCodes = await GetAssignmentCodesAsync(MenuPermissionTypeEnumType.Group, manager.usergrp);
|
||||||
|
|
||||||
|
//user
|
||||||
|
var userCodes = await GetAssignmentCodesAsync(MenuAssignmentTypeEnumType.User, user.Id.ToString());
|
||||||
|
var all = userCodes;// gP.Concat(uP).Distinct().ToList();
|
||||||
|
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task ChangeIfCodeEditAsync(string beforeCode, string pcode)
|
||||||
|
{
|
||||||
|
if (beforeCode != pcode)
|
||||||
{
|
{
|
||||||
return new List<string>();
|
//修改下级的PCode为当前的code
|
||||||
|
var menus = await _dbContext.Queryable<MenuEntity>().Where(x => x.PCode == beforeCode).ToListAsync();
|
||||||
|
menus.ForEach(x => { x.PCode = pcode; });
|
||||||
|
|
||||||
|
//修改权限code为当前的code,避免权限丢失
|
||||||
|
var permissions = await _dbContext.Queryable<MenuPermissionEntity>().Where(x => x.Code == beforeCode).ToListAsync();
|
||||||
|
permissions.ForEach(x => { x.Code = pcode; });
|
||||||
|
|
||||||
|
await _dbContext.UpdateAsync(menus);
|
||||||
|
await _dbContext.UpdateAsync(permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
// var gP = await GetAssignmentCodesAsync(MenuPermissionTypeEnumType.Group, manager.usergrp);
|
|
||||||
//
|
|
||||||
// //user
|
|
||||||
// var uP = await GetAssignmentCodesAsync(MenuPermissionTypeEnumType.User, manager.account);
|
|
||||||
// var all = gP.Concat(uP).Distinct().ToList();
|
|
||||||
|
|
||||||
//return all;
|
|
||||||
|
|
||||||
return new List<string>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,20 @@
|
|||||||
using Kurisu.AspNetCore.Startup;
|
using Kurisu.AspNetCore.Startup;
|
||||||
using Kurisu.Startup;
|
using Kurisu.Startup;
|
||||||
|
|
||||||
namespace Dlhis.Sys
|
namespace Dlhis.Sys;
|
||||||
|
|
||||||
|
class Program
|
||||||
{
|
{
|
||||||
class Program
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
KurisuHost.Run<Startup>(true, args);
|
||||||
{
|
|
||||||
KurisuHost.Run<Startup>(true, args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class Startup : DefaultStartup
|
public class Startup : DefaultStartup
|
||||||
|
{
|
||||||
|
public Startup(IConfiguration configuration) : base(configuration)
|
||||||
{
|
{
|
||||||
public Startup(IConfiguration configuration) : base(configuration)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,12 @@
|
|||||||
{
|
{
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"Dlhis.Permission": {
|
"Dlhis.Sys": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"applicationUrl": "http://localhost:5003"
|
"applicationUrl": "http://localhost:5003"
|
||||||
},
|
|
||||||
"Docker": {
|
|
||||||
"commandName": "Docker",
|
|
||||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_URLS": "http://+:80"
|
|
||||||
},
|
|
||||||
"publishAllPorts": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
14
Src/Dlhis.Sys/SqlSugarPack.cs
Normal file
14
Src/Dlhis.Sys/SqlSugarPack.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using Kurisu.AspNetCore.Startup;
|
||||||
|
using Kurisu.SqlSugar.Extensions;
|
||||||
|
|
||||||
|
namespace Dlhis.Sys;
|
||||||
|
|
||||||
|
public class SqlSugarPack : BaseAppPack
|
||||||
|
{
|
||||||
|
public override bool IsBeforeUseRouting { get; }
|
||||||
|
|
||||||
|
public override void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSqlSugar();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,5 +4,32 @@
|
|||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"InternalRequest": {
|
||||||
|
"CommonRequestUrl": "http://common",
|
||||||
|
"UserRequestUrl": "http://localhost:5010"
|
||||||
|
},
|
||||||
|
"SwaggerOptions": {
|
||||||
|
"Enable": true,
|
||||||
|
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
||||||
|
"ClientId": "4fb184324eac4180",
|
||||||
|
"ClientSecret": "8ac8f235152f1524",
|
||||||
|
"Scopes": {
|
||||||
|
"openid": "openid",
|
||||||
|
"profile": "profile",
|
||||||
|
"yikatong": "yikatong"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IdentityServerOptions": {
|
||||||
|
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
||||||
|
"RequireHttpsMetadata": true,
|
||||||
|
"Issuer": "identity.isawesome.cn",
|
||||||
|
"Audience": "",
|
||||||
|
"Pat": {
|
||||||
|
"Enable": false,
|
||||||
|
"Scheme": "token",
|
||||||
|
"ClientId": "reference",
|
||||||
|
"ClientSecret": "123456"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,18 +6,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
"InternalRequest": {
|
||||||
|
"CommonRequestUrl": "http://common",
|
||||||
|
"UserRequestUrl": "http://user"
|
||||||
|
},
|
||||||
|
"SqlSugarOptions": {
|
||||||
|
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
|
||||||
|
"SlaveConnectionString": [],
|
||||||
|
"Timeout": 30,
|
||||||
|
"SlowSqlTime": 1,
|
||||||
|
"EnableSqlLog": true
|
||||||
|
},
|
||||||
"SwaggerOptions": {
|
"SwaggerOptions": {
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
"Authority": "http://identity.oauth.svc.cluster.local",
|
||||||
"ClientId": "4fb184324eac4180",
|
"ClientId": "4fb184324eac4180",
|
||||||
"ClientSecret": "8ac8f235152f1524",
|
"ClientSecret": "8ac8f235152f1524",
|
||||||
"Scopes": {
|
"Scopes": {
|
||||||
"openid": "openid"
|
"openid": "openid",
|
||||||
|
"profile": "profile",
|
||||||
|
"yikatong": "yikatong"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"IdentityServerOptions": {
|
"IdentityServerOptions": {
|
||||||
"Authority": "https://yikatong.isawesome.cn/oauth2",
|
"Authority": "http://identity.oauth.svc.cluster.local",
|
||||||
"RequireHttpsMetadata": true,
|
"RequireHttpsMetadata": false,
|
||||||
"Issuer": "identity.isawesome.cn",
|
"Issuer": "identity.isawesome.cn",
|
||||||
"Audience": "",
|
"Audience": "",
|
||||||
"Pat": {
|
"Pat": {
|
||||||
|
|||||||
13
Src/Dlhis.User.Api/Dlhis.User.Api.csproj
Normal file
13
Src/Dlhis.User.Api/Dlhis.User.Api.csproj
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Kurisu.RemoteCall" Version="0.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
13
Src/Dlhis.User.Api/IUserApi.cs
Normal file
13
Src/Dlhis.User.Api/IUserApi.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Dlhis.User.Api.Response;
|
||||||
|
using Kurisu.Core.Result;
|
||||||
|
using Kurisu.RemoteCall.Attributes;
|
||||||
|
|
||||||
|
namespace Dlhis.User.Api;
|
||||||
|
|
||||||
|
[EnableRemoteClient(Name = "user-service", BaseUrl = "${InternalRequest:UserRequestUrl}")]
|
||||||
|
public interface IUserApi
|
||||||
|
{
|
||||||
|
[Auth]
|
||||||
|
[Get("/api/users")]
|
||||||
|
Task<DefaultApiResult<UserResponse>> GetUserByIdAsync(int id);
|
||||||
|
}
|
||||||
28
Src/Dlhis.User.Api/Response/UserResponse.cs
Normal file
28
Src/Dlhis.User.Api/Response/UserResponse.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
namespace Dlhis.User.Api.Response;
|
||||||
|
|
||||||
|
public class UserResponse
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
public string NormalizedUserName { get; set; }
|
||||||
|
|
||||||
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
public string NormalizedEmail { get; set; }
|
||||||
|
|
||||||
|
public bool EmailConfirmed { get; set; }
|
||||||
|
|
||||||
|
public string PhoneNumber { get; set; }
|
||||||
|
|
||||||
|
public string PhoneNumberConfirmed { get; set; }
|
||||||
|
|
||||||
|
public bool TwoFactorEnabled { get; set; }
|
||||||
|
|
||||||
|
public bool LockoutEnd { get; set; }
|
||||||
|
|
||||||
|
public bool LockoutEnabled { get; set; }
|
||||||
|
|
||||||
|
public int AccessFailedCount { get; set; }
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<DockerfileContext>..\..</DockerfileContext>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
|
|
||||||
namespace Dlhis.User.Identity.Controllers;
|
namespace Dlhis.User.Identity.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 角色
|
||||||
|
/// </summary>
|
||||||
[Authorize(Roles = "admin")]
|
[Authorize(Roles = "admin")]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
@@ -19,6 +22,11 @@ public class RolesController : ControllerBase
|
|||||||
_roleService = roleService;
|
_roleService = roleService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取角色分页
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<Pagination<RoleRespone>> GetPageAsync(RolePageRequest request)
|
public async Task<Pagination<RoleRespone>> GetPageAsync(RolePageRequest request)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
|
|
||||||
namespace Dlhis.User.Identity.Controllers;
|
namespace Dlhis.User.Identity.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户
|
||||||
|
/// </summary>
|
||||||
[Authorize(Roles = "admin")]
|
[Authorize(Roles = "admin")]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
@@ -29,4 +32,21 @@ public class UsersController : ControllerBase
|
|||||||
{
|
{
|
||||||
return await _userService.GetPageAsync(request);
|
return await _userService.GetPageAsync(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("list")]
|
||||||
|
public async Task<List<UserResponse>> GetUsersAsync()
|
||||||
|
{
|
||||||
|
return await _userService.GetUsersAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<UserResponse> GetUserByIdAsync(int id)
|
||||||
|
{
|
||||||
|
return await _userService.GetUserByIdAsync(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,8 @@ public interface IUserService : IScopeDependency
|
|||||||
Task<Pagination<UserResponse>> GetPageAsync(UserPageRequest request);
|
Task<Pagination<UserResponse>> GetPageAsync(UserPageRequest request);
|
||||||
|
|
||||||
Task ResetAccessFailedCountAsync(int id);
|
Task ResetAccessFailedCountAsync(int id);
|
||||||
|
|
||||||
|
Task<List<UserResponse>> GetUsersAsync();
|
||||||
|
|
||||||
|
Task<UserResponse> GetUserByIdAsync(int id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,17 @@ public class UserService : IUserService
|
|||||||
user.AccessFailedCount = 0;
|
user.AccessFailedCount = 0;
|
||||||
await _dbContext.UpdateAsync(user);
|
await _dbContext.UpdateAsync(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<UserResponse>> GetUsersAsync()
|
||||||
|
{
|
||||||
|
//todo tenant
|
||||||
|
var users = await _dbContext.Queryable<UserEntity>().Select<UserResponse>().ToListAsync();
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<UserResponse> GetUserByIdAsync(int id)
|
||||||
|
{
|
||||||
|
var user = await _dbContext.Queryable<UserEntity>().Where(x => x.Id == id).Select<UserResponse>().FirstAsync();
|
||||||
|
return user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"Dlhis.User": {
|
"Dlhis.User": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"applicationUrl": "http://localhost:5010",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "http://localhost:5010"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
"$schema": "https://json.schemastore.org/launchsettings.json"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user