diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfoOutSourceController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfoOutSourceController.cs
new file mode 100644
index 00000000..e3e7c690
--- /dev/null
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfoOutSourceController.cs
@@ -0,0 +1,52 @@
+using Dlhis.Basic.Organization.Request;
+using Dlhis.Basic.Organization.Services;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Dlhis.Basic.Organization.Controllers;
+
+///
+/// 外包人员
+///
+[Authorize]
+[Route("api/[controller]")]
+[ApiController]
+public class GainfoOutSourceController : ControllerBase
+{
+ private readonly IGainfoOutSourceService _gainfoOutSourceService;
+
+ public GainfoOutSourceController(IGainfoOutSourceService gainfoOutSourceService)
+ {
+ _gainfoOutSourceService = gainfoOutSourceService;
+ }
+
+ ///
+ /// 入职
+ ///
+ ///
+ [HttpPost("entry")]
+ public async Task EntryAsync(GainfoOutEntryRequest request)
+ {
+ await _gainfoOutSourceService.EntryAsync(request);
+ }
+
+ ///
+ /// 离职
+ ///
+ ///
+ [HttpPost("resign")]
+ public async Task ResignAsync(GainfoOutResignRequest request)
+ {
+ await _gainfoOutSourceService.ResignAsync(request);
+ }
+
+ ///
+ /// 编辑
+ ///
+ ///
+ [HttpPost("edit")]
+ public async Task EditAsync(GainfoOutEntryRequest request)
+ {
+ await _gainfoOutSourceService.EditAsync(request);
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
index c94a192d..0ee1001e 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs
@@ -7,7 +7,7 @@ using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Dlhis.Basic.MealUser.Controllers;
+namespace Dlhis.Basic.Organization.Controllers;
///
/// sap档案表
diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoOutEntryRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoOutEntryRequest.cs
new file mode 100644
index 00000000..4684a17d
--- /dev/null
+++ b/Src/Dlhis.Basic/Organization/Request/GainfoOutEntryRequest.cs
@@ -0,0 +1,119 @@
+using Dlhis.Entity.Basic.Enums;
+using SqlSugar;
+
+namespace Dlhis.Basic.Organization.Request;
+
+public class GainfoOutEntryRequest
+{
+ public long? Id { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 证件类型代码
+ ///
+ public string IdClass { get; set; }
+
+ ///
+ /// 身份证号
+ ///
+ public string IdNo { get; set; }
+
+ ///
+ /// 身份证籍贯区域代码
+ ///
+ public string Native { get; set; }
+
+ ///
+ /// 性别 GenderEnumType
+ ///
+ public GenderEnumType Gender { get; set; }
+
+ ///
+ /// 生日
+ ///
+ public DateTime Birthday { get; set; }
+
+ ///
+ /// 身份证地址
+ ///
+ public string Address { get; set; }
+
+ ///
+ /// 部门编码
+ ///
+ public string DepartmentNo { get; set; }
+
+ ///
+ /// 民族代码
+ ///
+ public string Nation { get; set; }
+
+ ///
+ /// 手机号码
+ ///
+ public string Phone { get; set; }
+
+ ///
+ /// 学历
+ ///
+ public string Degree { get; set; }
+
+ ///
+ /// 岗位
+ ///
+ public string PositionNo { get; set; }
+
+ ///
+ /// 职等
+ ///
+ public string Grade { get; set; }
+
+ ///
+ /// 职级
+ ///
+ public string Title { get; set; }
+
+ ///
+ /// 卡号
+ ///
+ public string CardNo { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 人事范围
+ ///
+ public string Werks { get; set; }
+
+ ///
+ /// 工作地
+ ///
+ public string Workplace { get; set; }
+
+ ///
+ /// 厂区
+ ///
+ public string Factory { get; set; }
+
+ ///
+ /// 成本中心
+ ///
+ public string CostId { get; set; }
+
+ ///
+ /// 入职日期
+ ///
+ public DateTime? EntryDate { get; set; }
+
+ ///
+ /// 离职日期
+ ///
+ public DateTime? ResignationDate { get; set; }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoOutResignRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoOutResignRequest.cs
new file mode 100644
index 00000000..02e28332
--- /dev/null
+++ b/Src/Dlhis.Basic/Organization/Request/GainfoOutResignRequest.cs
@@ -0,0 +1,23 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Dlhis.Basic.Organization.Request
+{
+ public class GainfoOutResignRequest : IValidatableObject
+ {
+ public long Id { get; set; }
+
+ [Required]
+ public string Reason { get; set; }
+
+ public DateTime Date { get; set; }
+
+ ///
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (Date < DateTime.Now.Date)
+ {
+ yield return new ValidationResult("离职日期不能小于当前时间", new[] { nameof(Date) });
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoPageRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoPageRequest.cs
index 3868a83e..82262089 100644
--- a/Src/Dlhis.Basic/Organization/Request/GainfoPageRequest.cs
+++ b/Src/Dlhis.Basic/Organization/Request/GainfoPageRequest.cs
@@ -18,6 +18,12 @@ public class GainfoPageRequest : PageDto, IValidatableObject
///
public List DepartmentSelections { get; set; } = new List();
+
+ ///
+ /// 是否为外包
+ ///
+ public bool? IsOutSource { get; set; }
+
public IEnumerable Validate(ValidationContext validationContext)
{
DepartmentSelections.ForEach(d =>
diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoOutSourceService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoOutSourceService.cs
new file mode 100644
index 00000000..a80d3843
--- /dev/null
+++ b/Src/Dlhis.Basic/Organization/Services/IGainfoOutSourceService.cs
@@ -0,0 +1,12 @@
+using Dlhis.Basic.Organization.Request;
+
+namespace Dlhis.Basic.Organization.Services;
+
+public interface IGainfoOutSourceService : IScopeDependency
+{
+ Task EntryAsync(GainfoOutEntryRequest request);
+
+ Task ResignAsync(GainfoOutResignRequest request);
+
+ Task EditAsync(GainfoOutEntryRequest request);
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutSourceService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutSourceService.cs
new file mode 100644
index 00000000..93bcca5d
--- /dev/null
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutSourceService.cs
@@ -0,0 +1,85 @@
+using Dlhis.Basic.Organization.Request;
+using Dlhis.Entity.Basic.Entity;
+using Kurisu.AspNetCore.Utils;
+using Kurisu.AspNetCore.Utils.Extensions;
+using Kurisu.SqlSugar.Services;
+using Mapster;
+using SqlSugar;
+
+namespace Dlhis.Basic.Organization.Services.Implements;
+
+public class GainfoOutSourceService : IGainfoOutSourceService
+{
+ private readonly IDbContext _dbContext;
+ private readonly RedisCache _redisCache;
+
+ public GainfoOutSourceService(IDbContext dbContext, RedisCache redisCache)
+ {
+ _dbContext = dbContext;
+ _redisCache = redisCache;
+ }
+
+ public async Task EntryAsync(GainfoOutEntryRequest request)
+ {
+ await SaveAsync(request);
+ }
+
+ public async Task ResignAsync(GainfoOutResignRequest request)
+ {
+ //todo 生成任务处理
+ }
+
+ public async Task EditAsync(GainfoOutEntryRequest request)
+ {
+ await SaveAsync(request);
+ }
+
+
+ //********************************************************************** help methods ***********************************************************************************
+
+ private async Task GetOutSourceCodeAsync()
+ {
+ await using var handler = await _redisCache.LockAsync("gainfo:outsource:code-generate", expiry: TimeSpan.FromSeconds(3), retryInterval: TimeSpan.FromSeconds(1), retryCount: 3);
+ handler.Acquired.ThrowIfFalse("生成虚拟工号失败");
+
+ int code;
+ var entity = await _dbContext.Queryable().OrderBy(x => x.Id, OrderByType.Desc).FirstAsync();
+ if (entity == null)
+ {
+ code = 1;
+ }
+ else
+ {
+ code = int.Parse(entity.Code.Replace("LS", "").Replace("0", "")) + 1;
+ }
+
+ return "LS" + code.ToString().PadLeft(6, '0');
+ }
+
+ private async Task SaveAsync(GainfoOutEntryRequest request)
+ {
+ if (!request.Id.HasValue)
+ {
+ var entity = request.Adapt();
+ entity.No = Guid.NewGuid().ToString();
+ entity.Code = await GetOutSourceCodeAsync();
+
+ await _dbContext.InsertAsync(entity);
+ await _dbContext.InsertAsync(new OutSourceEntity
+ {
+ Code = entity.Code
+ });
+ }
+ else
+ {
+ var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == request.Id);
+ entity.ThrowIfNull("档案数据不存在");
+
+ (await _dbContext.Queryable().AnyAsync(x => x.Code == entity.Code)).ThrowIfFalse("不可编辑非外包人员档案数据");
+
+ request.Adapt(entity);
+
+ await _dbContext.UpdateAsync(entity);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
index 33c1ea94..7b9e22b8 100644
--- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
+++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs
@@ -11,6 +11,7 @@ using Kurisu.Core.User.Abstractions;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
using Microsoft.AspNetCore.DataProtection;
+using SqlSugar;
namespace Dlhis.Basic.Organization.Services.Implements;
@@ -64,10 +65,12 @@ public class GainfoService : IGainfoService
var page = await _gainfoStore.Queryable(request.Status)
.WhereIF(request.DepartmentSelections.IsPresent(), where)
.WhereIF(request.DepartmentSelections.IsEmpty(), gainfo => gainfo.Factory == currentTenantId)
+ .WhereIF(request.IsOutSource.HasValue && request.IsOutSource.Value, gainfo => SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code).Any())
+ .WhereIF(request.IsOutSource.HasValue && !request.IsOutSource.Value, gainfo => SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code).NotAny())
.WhereIF(request.Search.IsPresent(), gainfo =>
- gainfo.Name.Contains(request.Search)
- || gainfo.Code == request.Search
- || gainfo.IdNo == request.Search)
+ gainfo.Name.Contains(request.Search)
+ || gainfo.Code == request.Search
+ || gainfo.IdNo == request.Search)
.Select()
.ToPageListAsync(request);
@@ -77,9 +80,9 @@ public class GainfoService : IGainfoService
public async Task> GetPageByCodeAsync(string code)
{
var page = await _gainfoStore.Queryable()
- .Where(x => x.Code == code)
- .Select()
- .ToPageListAsync(new PageDto { PageIndex = 1, PageSize = 1 });
+ .Where(x => x.Code == code)
+ .Select()
+ .ToPageListAsync(new PageDto { PageIndex = 1, PageSize = 1 });
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
var tenants = tenantsResult.Data;
@@ -101,6 +104,7 @@ public class GainfoService : IGainfoService
_logger.LogWarning("工号为空尝试获取人员信息");
return null;
}
+
var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == code).SingleAsync();
if (gainfo == null)
@@ -111,25 +115,25 @@ public class GainfoService : IGainfoService
}
var info = await _gainfoStore.Queryable(GainfoStatusEnumType.Working)
- .LeftJoin((ga, department) => ga.DepartmentNo == department.No)
- .LeftJoin((ga, department, mealUser) => ga.No == mealUser.UserNo)
- .Where((ga, department) => ga.Id == gainfo.Id)
- .Select((ga, department, mealUser) => new GainfoCurrentResponse
- {
- UserNo = ga.No,
- Birthday = ga.Birthday,
- DepartmentNo = department.No,
- DepartmentName = department.Name,
- Gender = ga.Gender,
- UserCode = ga.Code,
- UserName = ga.Name,
- Factory = ga.Factory,
- MealInfo = new GainfoCurrentMealInfoResponse
- {
- Balance = mealUser.Balance
- }
- })
- .FirstAsync();
+ .LeftJoin((ga, department) => ga.DepartmentNo == department.No)
+ .LeftJoin((ga, department, mealUser) => ga.No == mealUser.UserNo)
+ .Where((ga, department) => ga.Id == gainfo.Id)
+ .Select((ga, department, mealUser) => new GainfoCurrentResponse
+ {
+ UserNo = ga.No,
+ Birthday = ga.Birthday,
+ DepartmentNo = department.No,
+ DepartmentName = department.Name,
+ Gender = ga.Gender,
+ UserCode = ga.Code,
+ UserName = ga.Name,
+ Factory = ga.Factory,
+ MealInfo = new GainfoCurrentMealInfoResponse
+ {
+ Balance = mealUser.Balance
+ }
+ })
+ .FirstAsync();
if (info != null)
{
@@ -259,7 +263,6 @@ public class GainfoService : IGainfoService
}
catch (Exception)
{
-
}
}
@@ -339,4 +342,4 @@ public class GainfoService : IGainfoService
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Canteen/MealSupplementRecord/Request/MealSupplementInitImportRequest.cs b/Src/Dlhis.Canteen/MealSupplementRecord/Request/MealSupplementInitImportRequest.cs
index efe33828..1c66cd69 100644
--- a/Src/Dlhis.Canteen/MealSupplementRecord/Request/MealSupplementInitImportRequest.cs
+++ b/Src/Dlhis.Canteen/MealSupplementRecord/Request/MealSupplementInitImportRequest.cs
@@ -1,15 +1,32 @@
using System.ComponentModel.DataAnnotations;
+using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Canteen.MealSupplementRecord.Request;
-public class MealSupplementInitImportRequest
+public class MealSupplementInitImportRequest : IValidatableObject
{
[Required(ErrorMessage = "工号不能为空")]
public string Code { get; set; }
+
+ public string Name { get; set; }
+
///
/// 余额
///
- [Range(1, int.MaxValue, ErrorMessage = "余额有误")]
public decimal Balance { get; set; }
+
+ ///
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (Name.IsEmpty())
+ {
+ yield return new ValidationResult($"工号{Code}姓名不能为空", new[] { nameof(Name) });
+ }
+
+ if (Balance <= 0)
+ {
+ yield return new ValidationResult($"工号{Code}余额有误", new[] { nameof(Balance) });
+ }
+ }
}
\ No newline at end of file
diff --git a/Src/Dlhis.Canteen/MealSupplementRecord/Services/Implements/MealSupplementRecordService.cs b/Src/Dlhis.Canteen/MealSupplementRecord/Services/Implements/MealSupplementRecordService.cs
index 35b8c7ba..44b184b3 100644
--- a/Src/Dlhis.Canteen/MealSupplementRecord/Services/Implements/MealSupplementRecordService.cs
+++ b/Src/Dlhis.Canteen/MealSupplementRecord/Services/Implements/MealSupplementRecordService.cs
@@ -117,10 +117,10 @@ public class MealSupplementRecordService : IMealSupplementRecordService
foreach (var request in requests)
{
var gainfo = await _dbContext.Queryable().Where(x => x.Code == request.Code).FirstAsync();
- if (gainfo == null)
- {
- continue;
- }
+ gainfo.ThrowIfNull($"工号{request.Code}不存在");
+
+ (_currentUser.GetStringTenantId() != gainfo.Factory).ThrowIfTrue($"工号{request.Code}属于{gainfo.Factory}人员,无法导入");
+ (gainfo.Name != request.Name).ThrowIfTrue($"工号{request.Code}姓名不一致");
await CommonHelper.RetryAsync(async () =>
{
@@ -150,6 +150,9 @@ public class MealSupplementRecordService : IMealSupplementRecordService
.ExecuteCommandThrowVersionAsync();
}, 5);
+ (await _dbContext.Queryable().Where(x => x.UserCode == request.Code).Where(x => x.Remark == "期初导入").AnyAsync()).ThrowIfTrue($"工号{request.Code}已导入期初余额");
+
+
await _dbContext.InsertAsync(new BalanceRecordEntity
{
Amount = request.Balance,
diff --git a/Src/Dlhis.Entity/Basic/Entity/OutSourceEntity.cs b/Src/Dlhis.Entity/Basic/Entity/OutSourceEntity.cs
new file mode 100644
index 00000000..afc507e7
--- /dev/null
+++ b/Src/Dlhis.Entity/Basic/Entity/OutSourceEntity.cs
@@ -0,0 +1,10 @@
+using Kurisu.SqlSugar;
+using SqlSugar;
+
+namespace Dlhis.Entity.Basic.Entity;
+
+[SugarTable(TableName = "OutSources")]
+public class OutSourceEntity : SugarBaseEntity
+{
+ public string Code { get; set; }
+}
\ No newline at end of file
diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoJIPService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoJIPService.cs
index 3d756a0d..c0f7e21b 100644
--- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoJIPService.cs
+++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/JinkoJIPService.cs
@@ -99,10 +99,10 @@ public class JinkoJIPService : IJinkoJIPService
{
var jwtKey = _configuration.GetSection("JinkoOptions:Jip:Key").Value;
var jwtSecret = _configuration.GetSection("JinkoOptions:Jip:Secret").Value;
- var mins = 5;
+ const int min = 5;
- var now = DateTime.Now.AddMinutes(-mins);
- var expires = DateTime.Now.AddMinutes(mins);
+ var now = DateTime.Now.AddMinutes(-min);
+ var expires = DateTime.Now.AddMinutes(min);
var claims = new List
{
diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogPageRequest.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogPageRequest.cs
index 8d7797ea..95b76160 100644
--- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogPageRequest.cs
+++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogPageRequest.cs
@@ -18,6 +18,11 @@ public class DeviceUploadLogPageRequest : PageDto, IValidatableObject
///
public bool? Sync { get; set; }
+ ///
+ /// 是否为外包
+ ///
+ public bool? IsOutSource { get; set; }
+
///
/// 日期范围查询
///
diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs
index eace219b..40186005 100644
--- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs
+++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs
@@ -27,8 +27,9 @@ public class DeviceUploadLogService : IDeviceUploadLogService
{
DeviceUploadLogTypeEnumType? type = request.Type == DeviceTypeEnumType.Attendance
? DeviceUploadLogTypeEnumType.Attendance
- : request.Type == DeviceTypeEnumType.Door ? DeviceUploadLogTypeEnumType.Door
- : null;
+ : request.Type == DeviceTypeEnumType.Door
+ ? DeviceUploadLogTypeEnumType.Door
+ : null;
return await _dbContext.Queryable()
.LeftJoin((deviceUp, device) => deviceUp.DeviceUniqueNo == device.UniqueNo)
@@ -37,10 +38,12 @@ public class DeviceUploadLogService : IDeviceUploadLogService
.WhereIF(request.Sync.HasValue, deviceUp => deviceUp.Sync == request.Sync)
.WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true, deviceUp => deviceUp.RaiseDateTime >= request.SearchDateTimePeriod.Start)
.WhereIF(request.SearchDateTimePeriod?.End.HasValue == true, deviceUp => deviceUp.RaiseDateTime <= request.SearchDateTimePeriod.End)
+ .WhereIF(request.IsOutSource.HasValue && request.IsOutSource.Value, deviceUp => SqlFunc.Subqueryable().Where(x => x.Code == deviceUp.UserUniqueNo).Any())
+ .WhereIF(request.IsOutSource.HasValue && !request.IsOutSource.Value, deviceUp => SqlFunc.Subqueryable().Where(x => x.Code == deviceUp.UserUniqueNo).NotAny())
.WhereIF(request.Search.IsPresent(), (deviceUp, device, ga) =>
- ga.Code == request.Search
- || ga.Name == request.Search
- || deviceUp.DeviceUniqueNo == request.Search
+ ga.Code == request.Search
+ || ga.Name == request.Search
+ || deviceUp.DeviceUniqueNo == request.Search
)
.OrderBy(deviceUp => deviceUp.CreateTime, OrderByType.Desc)
.Select((deviceUp, device, ga) => new DeviceUploadLogResponse
@@ -65,10 +68,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService
{
//判断存在的记录
Expression> where = LinqExpressionExtensions.False();
- requests.ForEach(p =>
- {
- where = where.Or(x => x.DeviceUniqueNo == p.DeviceUniqueNo && x.SerialNo == p.SerialNo && x.RaiseDateTime == p.RaiseDateTime);
- });
+ requests.ForEach(p => { where = where.Or(x => x.DeviceUniqueNo == p.DeviceUniqueNo && x.SerialNo == p.SerialNo && x.RaiseDateTime == p.RaiseDateTime); });
//处理冗余的请求数据
var exists = await _dbContext.Queryable().Where(where).ToListAsync();
@@ -94,12 +94,10 @@ public class DeviceUploadLogService : IDeviceUploadLogService
Type = device.Type == DeviceTypeEnumType.Attendance ? DeviceUploadLogTypeEnumType.Attendance : DeviceUploadLogTypeEnumType.Door,
TenantId = device.TenantId,
-
}).ToList();
}
return null;
-
}).Where(x => x != null).ToList();
await _dbContext.InsertAsync(records);
@@ -130,4 +128,4 @@ public class DeviceUploadLogService : IDeviceUploadLogService
await _dbContext.InsertAsync(logs);
}
-}
+}
\ No newline at end of file
diff --git a/Src/Dlhis.ScheduledTask/Jobs/SyncOriginCardInfoJob.cs b/Src/Dlhis.ScheduledTask/Jobs/SyncOriginCardInfoJob.cs
index 746a035b..fa2a107e 100644
--- a/Src/Dlhis.ScheduledTask/Jobs/SyncOriginCardInfoJob.cs
+++ b/Src/Dlhis.ScheduledTask/Jobs/SyncOriginCardInfoJob.cs
@@ -33,24 +33,21 @@ public class SyncOriginCardInfoJob : BaseJob
//获取上传日志(有效的)
var deviceUniqueNos = devices.Select(x => x.UniqueNo).ToList();
- var logs = await DbContext.Queryable()
- .Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
- .Where(x => !string.IsNullOrEmpty(x.UserUniqueNo))
- .Where(x => x.Sync == false)
- .ToListAsync();
- //获取人员信息
- var userCodes = logs.Select(x => x.UserUniqueNo).ToList();
- var gainfoCodes = await DbContext.Queryable().Where(x => userCodes.Contains(x.Code)).Select(x => x.Code).ToListAsync();
-
- var requests = logs.Select(x => new UploadAttendanceRequest
- {
- Id = x.Id,
- RaiseDateTime = x.RaiseDateTime,
- ZNOTE = devices.First(item => item.UniqueNo == x.DeviceUniqueNo).DeployPlace,
- ZWORKCODE = gainfoCodes.Contains(x.UserUniqueNo) ? x.UserUniqueNo?.TrimEnd('\0') : string.Empty,
-
- }).Where(x => x.ZWORKCODE.IsPresent()).ToList();
+ var requests = await DbContext.Queryable()
+ .Where(x => deviceUniqueNos.Contains(x.DeviceUniqueNo))
+ .Where(x => !string.IsNullOrEmpty(x.UserUniqueNo))
+ .Where(x => x.Sync == false)
+ .Where(x => SqlFunc.Subqueryable().Where(p => p.Code == x.UserUniqueNo).Any())
+ .Where(x => SqlFunc.Subqueryable().Where(p => p.Code == x.UserUniqueNo).NotAny())
+ .Select(x => new UploadAttendanceRequest
+ {
+ Id = x.Id,
+ RaiseDateTime = x.RaiseDateTime,
+ ZNOTE = devices.First(item => item.UniqueNo == x.DeviceUniqueNo).DeployPlace,
+ ZWORKCODE = x.UserUniqueNo.TrimEnd('\0')
+ })
+ .ToListAsync();
if (requests.Any())
{
@@ -63,10 +60,10 @@ public class SyncOriginCardInfoJob : BaseJob
if (r.OLX == "0")
{
await DbContext.Updateable()
- .SetColumns(x => x.Sync == true)
- .SetColumns(x => x.ModifiedTime == DateTime.Now)
- .Where(x => ids.Contains(x.Id))
- .ExecuteCommandAsync();
+ .SetColumns(x => x.Sync == true)
+ .SetColumns(x => x.ModifiedTime == DateTime.Now)
+ .Where(x => ids.Contains(x.Id))
+ .ExecuteCommandAsync();
}
else
{
@@ -80,4 +77,4 @@ public class SyncOriginCardInfoJob : BaseJob
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Src/Dlhis.ScheduledTask/Program.cs b/Src/Dlhis.ScheduledTask/Program.cs
index ed5501cc..e3670558 100644
--- a/Src/Dlhis.ScheduledTask/Program.cs
+++ b/Src/Dlhis.ScheduledTask/Program.cs
@@ -1,3 +1,4 @@
+using Dlhis.ScheduledTask.Common.Services;
using Kurisu.AspNetCore.Startup;
using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions;
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs
index 2c2732cc..c8434fbe 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs
@@ -30,7 +30,7 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
.LeftJoin((deviceTask, ga, device) => deviceTask.DeviceUniqueNo == device.UniqueNo)
.WhereIF(request.Type.HasValue, (deviceTask, ga, device) => deviceTask.DeviceType == request.Type)
.WhereIF(request.SearchDateTimePeriod?.Start.HasValue == true && request.SearchDateTimePeriod?.End.HasValue == true,
- deviceTask => deviceTask.CreateTime >= request.SearchDateTimePeriod.Start && deviceTask.CreateTime <= request.SearchDateTimePeriod.End
+ deviceTask => deviceTask.ModifiedTime >= request.SearchDateTimePeriod.Start && deviceTask.ModifiedTime <= request.SearchDateTimePeriod.End
)
.WhereIF(request.TaskTypes.IsPresent(), deviceTask => request.TaskTypes.Contains(deviceTask.Type))
.WhereIF(request.Status.IsPresent(), deviceTask => request.Status.Contains(deviceTask.Status))
diff --git a/Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs b/Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs
index f7c16948..e02834f2 100644
--- a/Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs
+++ b/Src/Dlhis.Sys/Identity/Controllers/TenantsController.cs
@@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Sys.Identity.Controllers;
+///
+/// 租户
+///
[Authorize]
[Route("api/[controller]")]
[ApiController]
@@ -84,7 +87,7 @@ public class TenantsController : ControllerBase
}
///
- /// 获取我的管理租户
+ /// 获取我管理的租户
///
///
[HttpGet("my")]
diff --git a/Src/Dlhis.Sys/Identity/Controllers/UserTenantsController.cs b/Src/Dlhis.Sys/Identity/Controllers/UserTenantsController.cs
index 60559162..7425b33f 100644
--- a/Src/Dlhis.Sys/Identity/Controllers/UserTenantsController.cs
+++ b/Src/Dlhis.Sys/Identity/Controllers/UserTenantsController.cs
@@ -6,6 +6,9 @@ using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Sys.Identity.Controllers;
+///
+/// 用户租户
+///
[Authorize(Roles = "admin")]
[Route("api/[controller]")]
[ApiController]