fix 逻辑优化
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Dlhis.Basic.Common.ApiLog.Request;
|
||||
using Dlhis.Basic.Common.ApiLog.Response;
|
||||
using Dlhis.Basic.Common.ApiLog.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation.Aop;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.Basic.Common.ApiLog.Controller;
|
||||
|
||||
/// <summary>
|
||||
/// API日志控制器
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class OperateLogsController : ControllerBase
|
||||
{
|
||||
private readonly IOperateLog _operateLog;
|
||||
|
||||
public OperateLogsController(IOperateLog operateLog)
|
||||
{
|
||||
_operateLog = operateLog;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取操作日志
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisableApiLog]
|
||||
[HttpGet("page")]
|
||||
public async Task<Pagination<OperateLogResponse>> GetOperateLogPageAsync([FromQuery] OperateLogPageRequest request)
|
||||
{
|
||||
return await _operateLog.GetOperateLogPageAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Common.ApiLog.Request
|
||||
{
|
||||
public class OperateLogPageRequest : PageDto
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
10
Src/Dlhis.Basic/Common/ApiLog/Response/OperateLogResponse.cs
Normal file
10
Src/Dlhis.Basic/Common/ApiLog/Response/OperateLogResponse.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Dlhis.Basic.Common.ApiLog.Response;
|
||||
|
||||
public class OperateLogResponse
|
||||
{
|
||||
public string Content { get; set; }
|
||||
|
||||
public string Operator { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
using Dlhis.Basic.Common.ApiLog.Request;
|
||||
using Dlhis.Basic.Common.ApiLog.Response;
|
||||
using Dlhis.Entity.Common.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
|
||||
namespace Dlhis.Basic.Common.ApiLog.Services;
|
||||
|
||||
public interface IOperateLog : IScopeDependency
|
||||
{
|
||||
Task LogAsync(OperateLogType type, string content);
|
||||
|
||||
Task<Pagination<OperateLogResponse>> GetOperateLogPageAsync(OperateLogPageRequest request);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using Dlhis.Basic.Common.ApiLog.Request;
|
||||
using Dlhis.Basic.Common.ApiLog.Response;
|
||||
using Dlhis.Entity.Common.Entities;
|
||||
using Dlhis.Entity.Common.Enums;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.Common.ApiLog.Services.Implements;
|
||||
@@ -43,4 +47,17 @@ public class OperateLogService : IOperateLog
|
||||
_logger.LogError(e, "记录操作日志失败:{error}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Pagination<OperateLogResponse>> GetOperateLogPageAsync(OperateLogPageRequest request)
|
||||
{
|
||||
return await _dbContext.Queryable<OperateLogEntity>()
|
||||
.Select(x => new OperateLogResponse
|
||||
{
|
||||
Content = x.Content,
|
||||
Operator = x.Operator,
|
||||
CreateTime = x.CreateTime
|
||||
})
|
||||
.ToPageListAsync(request);
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,10 @@ public interface IFactorySettingService : IScopeDependency
|
||||
Task SaveAsync(FactorySettingSaveRequest request);
|
||||
|
||||
Task<FactorySettingResponse> GetFactorySettingAsync(string factory, bool usePermission);
|
||||
|
||||
Task<TimeOnly> GetWorkGridSetLimitAsync();
|
||||
|
||||
Task CheckWorkGridSetLimitAsync(DateOnly date);
|
||||
|
||||
Task<bool> IsWorkGridSetLimitAsync(DateOnly date);
|
||||
}
|
||||
@@ -6,9 +6,11 @@ using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Sys.Entities;
|
||||
using Dlhis.Sys.Api;
|
||||
using Dlhis.Sys.Api.Response;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Mapster;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
@@ -16,11 +18,13 @@ public class FactorySettingService : IFactorySettingService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
|
||||
public FactorySettingService(IDbContext dbContext, ITenantApi tenantApi)
|
||||
public FactorySettingService(IDbContext dbContext, ITenantApi tenantApi, ICurrentUser currentUser)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_tenantApi = tenantApi;
|
||||
_currentUser = currentUser;
|
||||
}
|
||||
|
||||
public async Task<List<FactorySettingResponse>> GetListAsync(bool usePermission)
|
||||
@@ -67,6 +71,37 @@ public class FactorySettingService : IFactorySettingService
|
||||
return setting;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<TimeOnly> GetWorkGridSetLimitAsync()
|
||||
{
|
||||
var factory = _currentUser.GetStringTenantId();
|
||||
var v = new TimeOnly(20, 30, 0);
|
||||
|
||||
var vv = await _dbContext.Queryable<FactorySettingEntity>()
|
||||
.Where(x => x.TenantId == factory)
|
||||
.Select(x => SqlFunc.IsNull(x.WorkGridSetLimit, v))
|
||||
.SingleAsync();
|
||||
|
||||
return vv!.Value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task CheckWorkGridSetLimitAsync(DateOnly date)
|
||||
{
|
||||
var result = await IsWorkGridSetLimitAsync(date);
|
||||
result.ThrowIfTrue("当前时间不可编辑");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> IsWorkGridSetLimitAsync(DateOnly date)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var time = await GetWorkGridSetLimitAsync();
|
||||
var setting = date.ToDateTime(time);
|
||||
|
||||
return now >= setting;
|
||||
}
|
||||
|
||||
//************************************************************************************************************************************************************
|
||||
|
||||
private async Task<List<FactorySettingResponse>> GetFactorySettingsAsync(string factory, bool usePermission)
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace Dlhis.Basic.WorkGrids.Request;
|
||||
|
||||
public class WorkGridScheduleAttendancePageRequest : PageDto
|
||||
{
|
||||
[Required(ErrorMessage = "工号不能为空")]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
public DateTimePeriod DateTimePeriod { get; set; }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
|
||||
namespace Dlhis.Basic.WorkGrids.Request;
|
||||
|
||||
public class WorkGridScheduleSaveRequest
|
||||
public class WorkGridScheduleSaveRequest : IValidatableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 网格code
|
||||
@@ -23,4 +24,14 @@ public class WorkGridScheduleSaveRequest
|
||||
/// 人员codes
|
||||
/// </summary>
|
||||
public List<string> UserCodes { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
if (Date.ToDateTime(new TimeOnly(0, 0)) < now.Date)
|
||||
{
|
||||
yield return new ValidationResult("不可编辑历史数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,21 @@
|
||||
using Dlhis.Basic.Common.ApiLog.Services;
|
||||
using Dlhis.Basic.Organization.Services;
|
||||
using Dlhis.Basic.WorkGrids.Request;
|
||||
using Dlhis.Basic.WorkGrids.Response;
|
||||
using Dlhis.Constants;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Common.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Jip.Api;
|
||||
using Dlhis.Jip.Api.Requests;
|
||||
using Kurisu.AspNetCore.Authentication.Abstractions;
|
||||
using Kurisu.AspNetCore.CustomClass;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Basic.WorkGrids.Services.Implements;
|
||||
|
||||
@@ -20,22 +24,31 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
||||
private readonly IDbContext _dbContext;
|
||||
private readonly IJinkoJipApi _jinkoJipApi;
|
||||
private readonly IOperateLog _operateLog;
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IFactorySettingService _factorySettingService;
|
||||
|
||||
public WorkGridScheduleService(IDbContext dbContext, IJinkoJipApi jinkoJipApi, IOperateLog operateLog)
|
||||
public WorkGridScheduleService(IDbContext dbContext,
|
||||
IJinkoJipApi jinkoJipApi,
|
||||
IOperateLog operateLog,
|
||||
ICurrentUser currentUser,
|
||||
IFactorySettingService factorySettingService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_jinkoJipApi = jinkoJipApi;
|
||||
_operateLog = operateLog;
|
||||
_currentUser = currentUser;
|
||||
_factorySettingService = factorySettingService;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(WorkGridScheduleSaveRequest request)
|
||||
{
|
||||
//await _factorySettingService.CheckWorkGridSetLimitAsync(request.Date);
|
||||
|
||||
var workGrid = await _dbContext.Queryable<WorkGridEntity>().SingleAsync(x => x.Code == request.WorkGridCode);
|
||||
workGrid.ThrowIfNull("工作网格不存在");
|
||||
|
||||
var exists = await _dbContext.Queryable<WorkGridScheduleEntity>()
|
||||
.Where(x => x.WorkGridCode == request.WorkGridCode
|
||||
&& x.PeriodType == request.PeriodType
|
||||
&& x.Date == request.Date
|
||||
&& request.UserCodes.Contains(x.UserCode)
|
||||
)
|
||||
@@ -59,9 +72,11 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveAsync(WorkGridScheduleSaveRequest request)
|
||||
{
|
||||
//await _factorySettingService.CheckWorkGridSetLimitAsync(request.Date);
|
||||
|
||||
var workGrid = await _dbContext.Queryable<WorkGridEntity>().SingleAsync(x => x.Code == request.WorkGridCode);
|
||||
workGrid.ThrowIfNull("工作网格不存在");
|
||||
|
||||
|
||||
var data = await _dbContext.Queryable<WorkGridScheduleEntity>()
|
||||
.Where(x => x.WorkGridCode == request.WorkGridCode)
|
||||
.Where(x => x.Date == request.Date)
|
||||
@@ -114,11 +129,25 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
||||
/// <inheritdoc />
|
||||
public async Task<Pagination<WorkGridScheduleAttendancePageResponse>> GetAttendancePageAsync(WorkGridScheduleAttendancePageRequest request)
|
||||
{
|
||||
var jinkoCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode);
|
||||
var workGrid = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.LeaderUserCode == jinkoCode).SingleAsync();
|
||||
if (workGrid == null)
|
||||
{
|
||||
return new Pagination<WorkGridScheduleAttendancePageResponse>
|
||||
{
|
||||
PageIndex = request.PageIndex,
|
||||
PageSize = request.PageSize,
|
||||
Total = 0,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
return await _dbContext.Queryable<DeviceUploadLogEntity>()
|
||||
.LeftJoin<DeviceEntity>((log, d) => log.DeviceUniqueNo == d.UniqueNo)
|
||||
.Where(log => log.UserUniqueNo == request.UserCode)
|
||||
.WhereIF(request.DateTimePeriod.HasValue(), log => log.RaiseDateTime >= request.DateTimePeriod.Start
|
||||
&& log.RaiseDateTime <= request.DateTimePeriod.End)
|
||||
.WhereIF(request.UserCode.IsPresent(), log => log.UserUniqueNo == request.UserCode)
|
||||
.WhereIF(request.UserCode.IsEmpty(), log => SqlFunc.Subqueryable<WorkGridUserEntity>().Where(p => p.WorkGridCode == workGrid.Code && p.UserCode == log.UserUniqueNo).Any())
|
||||
.OrderBy(log => log.RaiseDateTime)
|
||||
.Select((log, d) => new WorkGridScheduleAttendancePageResponse
|
||||
{
|
||||
|
||||
@@ -20,7 +20,9 @@ public class WorkGridService : IWorkGridService
|
||||
private readonly ICurrentUser _currentUser;
|
||||
private readonly IOperateLog _operateLog;
|
||||
|
||||
public WorkGridService(IDbContext dbContext, ICurrentUser currentUser, IOperateLog operateLog)
|
||||
public WorkGridService(IDbContext dbContext,
|
||||
ICurrentUser currentUser,
|
||||
IOperateLog operateLog)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUser = currentUser;
|
||||
@@ -33,18 +35,13 @@ public class WorkGridService : IWorkGridService
|
||||
var insertGrids = new List<string>();
|
||||
var updateGrids = new List<string>();
|
||||
|
||||
var leaderUserCodes = requests.Select(x => x.LeaderUserCode).Distinct().ToList();
|
||||
var existsUserCodes = await _dbContext.Queryable<GainfoEntity>().Where(x => leaderUserCodes.Contains(x.Code)).Select(x => x.Code).ToListAsync();
|
||||
var notExistsUserCodes = leaderUserCodes.Except(existsUserCodes).ToList();
|
||||
notExistsUserCodes.ThrowIfExists($"工号:{notExistsUserCodes.Join(",")}不存在");
|
||||
|
||||
foreach (var request in requests)
|
||||
{
|
||||
var exists = await _dbContext.Queryable<WorkGridEntity>()
|
||||
.Where(x => x.LeaderUserCode == request.LeaderUserCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync();
|
||||
|
||||
if (!await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == request.LeaderUserCode).AnyAsync())
|
||||
{
|
||||
true.ThrowIfTrue($"工号:{request.LeaderUserCode}不存在");
|
||||
}
|
||||
|
||||
if (await _dbContext.Queryable<WorkGridEntity>().Where(x => x.Name == request.Name)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync())
|
||||
@@ -52,12 +49,18 @@ public class WorkGridService : IWorkGridService
|
||||
true.ThrowIfTrue($"网格区域名称[{request.Name}]重复");
|
||||
}
|
||||
|
||||
exists.ThrowIfTrue($"{request.LeaderUserCode}已存在管理的网格");
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
var exists = await _dbContext.Queryable<WorkGridEntity>()
|
||||
.Where(x => x.LeaderUserCode == request.LeaderUserCode)
|
||||
.WhereIF(request.Id.HasValue, x => x.Id != request.Id)
|
||||
.AnyAsync();
|
||||
exists.ThrowIfTrue($"{request.LeaderUserCode}人员存在管理中的网格,无法添加");
|
||||
|
||||
var entity = request.Adapt<WorkGridEntity>();
|
||||
entity.Code = Guid.NewGuid();
|
||||
entity.LeaderUserCode = request.LeaderUserCode;
|
||||
|
||||
await _dbContext.InsertAsync(entity);
|
||||
insertGrids.Add($"{entity.Name}({entity.LeaderUserCode})");
|
||||
@@ -82,6 +85,7 @@ public class WorkGridService : IWorkGridService
|
||||
public async Task<Pagination<WorkGridPageResponse>> GetPageAsync(WorkGridPageRequest request)
|
||||
{
|
||||
var role = _currentUser.GetRole();
|
||||
var factory = _currentUser.GetStringTenantId();
|
||||
var userCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode);
|
||||
var isAll = role is "admin" or "tenant-admin";
|
||||
|
||||
@@ -89,6 +93,7 @@ public class WorkGridService : IWorkGridService
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.LeaderUserCode == ga.Code)
|
||||
.WhereIF(!isAll, x => x.LeaderUserCode == userCode)
|
||||
.WhereIF(request.Search.IsPresent(), x => x.Name.Contains(request.Search) || x.LeaderUserCode == request.Search)
|
||||
.Where(x => SqlFunc.Subqueryable<GainfoEntity>().Where(p => p.Code == x.LeaderUserCode && p.Factory == factory).Any())
|
||||
.Select((x, ga) => new WorkGridPageResponse
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -108,9 +113,14 @@ public class WorkGridService : IWorkGridService
|
||||
var workGrid = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.LeaderUserCode == from).SingleAsync();
|
||||
workGrid.ThrowIfNull("网格不存在");
|
||||
|
||||
var beforeGainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == from).SingleAsync();
|
||||
beforeGainfo.ThrowIfNull($"{from}人员不存在");
|
||||
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == to).SingleAsync();
|
||||
gainfo.ThrowIfNull($"{to}人员不存在");
|
||||
|
||||
(gainfo.Factory != beforeGainfo.Factory).ThrowIfTrue($"必须选择相同厂区({beforeGainfo.Factory})人员管理({gainfo.Factory}错误)");
|
||||
|
||||
workGrid.LeaderUserCode = to;
|
||||
await _dbContext.UpdateAsync(workGrid);
|
||||
|
||||
@@ -120,7 +130,7 @@ public class WorkGridService : IWorkGridService
|
||||
/// <inheritdoc />
|
||||
public async Task<WorkGridUserPageResponse> GetMyWorkGridAsync(WorkGridPageRequest request)
|
||||
{
|
||||
var currentUserCode = _currentUser.GetUserClaim("jinko-code");
|
||||
var currentUserCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode);
|
||||
var myWorkGrid = await _dbContext.Queryable<WorkGridEntity>()
|
||||
.WhereIF(request.WorkGridCode.HasValue == false, x => x.LeaderUserCode == currentUserCode)
|
||||
.WhereIF(request.WorkGridCode.HasValue, x => x.Code == request.WorkGridCode)
|
||||
@@ -162,10 +172,10 @@ public class WorkGridService : IWorkGridService
|
||||
|
||||
(count != request.UserCodes.Count).ThrowIfTrue("存在非当前厂区人员,请检查");
|
||||
|
||||
var existsAssigned = await _dbContext.Queryable<WorkGridUserEntity>().Where(x => x.WorkGridCode == myWorkGrid.Code)
|
||||
var existsAssigned = await _dbContext.Queryable<WorkGridUserEntity>()
|
||||
.Where(x => request.UserCodes.Contains(x.UserCode))
|
||||
.AnyAsync();
|
||||
existsAssigned.ThrowIfTrue("存在已经分配人员,请勿重复分配");
|
||||
existsAssigned.ThrowIfTrue("存在已经分配人员,操作失败!");
|
||||
|
||||
var dataToInserts = request.UserCodes.Select(x => new WorkGridUserEntity
|
||||
{
|
||||
@@ -180,15 +190,19 @@ public class WorkGridService : IWorkGridService
|
||||
/// <inheritdoc />
|
||||
public async Task RemoveAsync(WorkGridUserRemoveRequest request)
|
||||
{
|
||||
var currentUserCode = _currentUser.GetUserClaim("jinko-code");
|
||||
var currentUserCode = _currentUser.GetUserClaim(UserClaimConstants.JinkoCode);
|
||||
var myWorkGrid = await _dbContext.Queryable<WorkGridEntity>().Where(x => x.LeaderUserCode == currentUserCode).SingleAsync();
|
||||
myWorkGrid.ThrowIfNull("工作网格尚未配置,请联系管理员");
|
||||
|
||||
var workGridUsers = await _dbContext.Queryable<WorkGridUserEntity>().Where(x => x.WorkGridCode == myWorkGrid.Code)
|
||||
var workGridUsers = await _dbContext.Queryable<WorkGridUserEntity>()
|
||||
.Where(x => x.WorkGridCode == myWorkGrid.Code)
|
||||
.Where(x => request.UserCodes.Contains(x.UserCode))
|
||||
.ToListAsync();
|
||||
|
||||
var workGridSchedules = await _dbContext.Queryable<WorkGridScheduleEntity>().Where(x => x.WorkGridCode == myWorkGrid.Code)
|
||||
var date = DateOnly.FromDateTime(DateTime.Today);
|
||||
var workGridSchedules = await _dbContext.Queryable<WorkGridScheduleEntity>()
|
||||
.Where(x => x.Date > date)
|
||||
.Where(x => x.WorkGridCode == myWorkGrid.Code)
|
||||
.Where(x => request.UserCodes.Contains(x.UserCode))
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using Dlhis.Basic.Common.ApiLog.Services;
|
||||
using Dlhis.Basic.WorkGrids.Request;
|
||||
using Dlhis.Basic.WorkGrids.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Common.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
@@ -27,7 +26,6 @@ public class WorkGridTimePeriodService : IWorkGridTimePeriodService
|
||||
public async Task SaveAsync(WorkGridTimePeriodSaveRequest request)
|
||||
{
|
||||
//await CheckDuplicateTimePeriodAsync(request);
|
||||
|
||||
if (!request.Id.HasValue)
|
||||
{
|
||||
//判断重复配置
|
||||
@@ -65,17 +63,6 @@ public class WorkGridTimePeriodService : IWorkGridTimePeriodService
|
||||
|
||||
//*************************************************************************************************************************************************
|
||||
|
||||
/// <summary>
|
||||
/// 根据类型获取配置
|
||||
/// </summary>
|
||||
/// <param name="timePeriodType"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<WorkGridTimePeriodEntity> GetSettingAsync(WorkGridTimePeriodEnumType timePeriodType)
|
||||
{
|
||||
return await _dbContext.Queryable<WorkGridTimePeriodEntity>()
|
||||
.Where(x => x.Type == timePeriodType)
|
||||
.SingleAsync();
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 检查时间段重合检查
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
@@ -9,19 +8,19 @@ namespace Dlhis.Entity.Basic.Entity;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "WorkGridSchedule")]
|
||||
public class WorkGridScheduleEntity : SugarBaseEntity, ITenantId
|
||||
[SugarTable(TableName = "WorkGridSchedules")]
|
||||
public class WorkGridScheduleEntity : SugarBaseEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 网格code
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "网格code")]
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "网格code", IndexGroupNameList = new[] { "idx_WorkGridSchedules_workGridCode_date" })]
|
||||
public Guid WorkGridCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排班日期
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDataType = "date", ColumnDescription = "排班日期")]
|
||||
[SugarColumn(IsNullable = false, ColumnDataType = "date", ColumnDescription = "排班日期", IndexGroupNameList = new[] { "idx_WorkGridSchedules_workGridCode_date" })]
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -33,10 +32,6 @@ public class WorkGridScheduleEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "工号")]
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "工号", IndexGroupNameList = new[] { "idx_WorkGridSchedules_userCode" })]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Kurisu.AspNetCore.DataAccess.Entity;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar;
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
|
||||
namespace Dlhis.Entity.Basic.Entity;
|
||||
|
||||
@@ -10,7 +7,7 @@ namespace Dlhis.Entity.Basic.Entity;
|
||||
/// 网格人员
|
||||
/// </summary>
|
||||
[SugarTable(TableName = "WorkGridUsers")]
|
||||
public class WorkGridUserEntity : SugarBaseEntity, ITenantId
|
||||
public class WorkGridUserEntity : SugarBaseEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 网格code
|
||||
@@ -21,15 +18,6 @@ public class WorkGridUserEntity : SugarBaseEntity, ITenantId
|
||||
/// <summary>
|
||||
/// 网格人员
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "网格人员")]
|
||||
[SugarColumn(IsNullable = false, ColumnDescription = "网格人员", UniqueGroupNameList = new[] { "idx_WorkGridUsers_userCode" })]
|
||||
public string UserCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排班类型
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true,ColumnDataType = "varchar(50)",ColumnDescription = "排班类型", SqlParameterDbType = typeof(EnumToStringConvert))]
|
||||
public WorkGridTimePeriodEnumType? ScheduleType { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
@@ -34,12 +34,15 @@ public class FactorySettingEntity : SugarBaseEntity, ITenantId
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "人脸检测配置", IsNullable = true, IsJson = true)]
|
||||
public FaceImageDetectionDto FaceImageDetection { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 外包自动离职天数(无通行记录)
|
||||
/// </summary>
|
||||
public int NoRecordAutoResignOutsourceDays { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = true, ColumnDataType = "time", ColumnDescription = "工作网格编辑限制时间")]
|
||||
public TimeOnly? WorkGridSetLimit { get; set; }
|
||||
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user