diff --git a/Dlhis.Jinko.Face.sln b/Dlhis.Jinko.Face.sln
index dc9198be..209e26e0 100644
--- a/Dlhis.Jinko.Face.sln
+++ b/Dlhis.Jinko.Face.sln
@@ -39,8 +39,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen", "Src\Dlhis.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Canteen.Api", "Src\Dlhis.Canteen.Api\Dlhis.Canteen.Api.csproj", "{D4043506-7247-4DDC-9751-927403515669}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Visitor", "Src\Dlhis.Visitor\Dlhis.Visitor.csproj", "{69E8A91A-5D05-4327-BC24-038523C7628C}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Message", "Message", "{65E76F97-E78A-4C95-B788-4091236B1A79}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dlhis.Message", "Src\Dlhis.Message\Dlhis.Message.csproj", "{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}"
@@ -111,10 +109,6 @@ Global
{D4043506-7247-4DDC-9751-927403515669}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4043506-7247-4DDC-9751-927403515669}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4043506-7247-4DDC-9751-927403515669}.Release|Any CPU.Build.0 = Release|Any CPU
- {69E8A91A-5D05-4327-BC24-038523C7628C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {69E8A91A-5D05-4327-BC24-038523C7628C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {69E8A91A-5D05-4327-BC24-038523C7628C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {69E8A91A-5D05-4327-BC24-038523C7628C}.Release|Any CPU.Build.0 = Release|Any CPU
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -151,7 +145,6 @@ Global
{9EA85FB2-F320-4F97-B278-00652CF35BD8} = {AA987BDF-EF63-467B-AD04-59F9B10D9000}
{A54426E2-1CA0-48AB-BBA6-07CDE2807E35} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
{D4043506-7247-4DDC-9751-927403515669} = {3D8A98C1-83C9-4375-AEAB-4F72AFAF365B}
- {69E8A91A-5D05-4327-BC24-038523C7628C} = {489252FB-A44B-46EE-B065-21CDCB724441}
{053BF7B2-B1A0-435F-9C77-2EF5622CC5C5} = {65E76F97-E78A-4C95-B788-4091236B1A79}
{4D656761-8CE7-4316-A3DF-8C1722D69CCE} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
{A501D16E-638F-4156-989C-2BACCC2FAC2B} = {4EBCE46B-CE3A-4A47-9432-82A1854CA58A}
diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs
index 3edeb03f..c5ae6fa3 100644
--- a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs
+++ b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs
@@ -1,6 +1,7 @@
using Dlhis.Entity.Basic.Enums;
using Kurisu.AspNetCore.DataAccess.SqlSugar;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Attributes;
+using Mapster;
using SqlSugar;
using SqlSugar.DbConvert;
@@ -13,23 +14,30 @@ namespace Dlhis.Entity.Basic.Entity;
public class GainfoEntity : SugarBaseEntity
{
///
- /// 档案号
+ /// 档案号
///
[SugarColumn(ColumnDescription = "档案号", UniqueGroupNameList = new[] { "idx_Gainfo_No" })]
public string No { get; set; }
///
- /// SAP内部编号
+ /// 内部编号
///
- [SugarColumn(ColumnDescription = "SAP内部编号")]
- public string SapNo { get; set; }
+ [SugarColumn(IsNullable = true, ColumnDescription = "内部编号")]
+ public string InternalNo { get; set; }
///
- /// 员类型
+ /// 人员类型
///
+ [AdaptIgnore(MemberSide.Destination)]
[SugarColumn(ColumnDescription = "人员类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
public GainfoUserTypeEnumType Type { get; set; }
+ ///
+ /// 人员来源
+ ///
+ [SugarColumn(ColumnDescription = "人员来源", IsNullable = true)]
+ public string Source { get; set; }
+
///
/// 姓名
///
@@ -37,61 +45,55 @@ public class GainfoEntity : SugarBaseEntity
public string Name { get; set; }
///
- /// 学工号
+ /// 学工号
///
[SugarColumn(ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_Gainfo_Code" })]
public string Code { get; set; }
///
- /// 国家代码
+ /// 国家代码
///
[SugarColumn(ColumnDescription = "国家代码")]
public string CountryNo { get; set; }
///
- /// 证件类型代码
+ /// 证件类型代码
///
[SugarColumn(ColumnDescription = "证件类型代码")]
public string IdClass { get; set; }
///
- /// 身份证号
+ /// 身份证号
///
[SugarColumn(ColumnDescription = "身份证号", UniqueGroupNameList = new[] { "idx_Gainfo_IdNo" })]
public string IdNo { get; set; }
///
- /// 身份证籍贯区域代码
+ /// 身份证籍贯区域代码
///
[SugarColumn(ColumnDescription = "身份证籍贯区域代码")]
public string Native { get; set; }
///
- /// 性别
+ /// 性别
///
[SugarColumn(ColumnDescription = "性别", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))]
public GenderEnumType Gender { get; set; }
///
- /// 生日
+ /// 生日
///
[SugarColumn(ColumnDescription = "生日")]
public DateTime Birthday { get; set; }
///
- /// 身份证地址
+ /// 身份证地址
///
[SugarColumn(ColumnDescription = "身份证地址")]
public string Address { get; set; }
- /////
- ///// 已婚/未婚
- /////
- //[SugarColumn(ColumnDescription = "已婚/未婚")]
- //public string Marital { get; set; }
-
///
- /// 部门编码
+ /// 部门编码
///
[SugarColumn(ColumnDescription = "部门编码")]
public string DepartmentNo { get; set; }
@@ -187,28 +189,17 @@ public class GainfoEntity : SugarBaseEntity
[SugarColumn(ColumnDescription = "身份认证用户Id", IsNullable = true)]
public int IdentityUserId { get; set; }
-
+ ///
+ /// 卡类型
+ ///
[SugarColumn(ColumnDescription = "卡类型", IsNullable = true)]
public int? CardType { get; set; }
}
///
-/// 离职人员档案表
+/// 离职人员档案表
///
[SugarTable(TableName = "GainfoLeave", TableDescription = "离职人员档案表")]
public class GainfoLeaveEntity : GainfoEntity
{
-}
-
-///
-/// 外部人员档案表
-///
-[SugarTable(TableName = "GainfoExternal", TableDescription = "外部人员档案表")]
-public class GainfoExternalEntity : GainfoEntity
-{
- ///
- /// 公司
- ///
- [SugarColumn(ColumnDescription = "公司", IsNullable = false)]
- public string Company { get; set; }
}
\ No newline at end of file
diff --git a/Src/Dlhis.Entity/Basic/Enums/GainfoUserTypeEnumType.cs b/Src/Dlhis.Entity/Basic/Enums/GainfoUserTypeEnumType.cs
index c9bb65d5..84aada0f 100644
--- a/Src/Dlhis.Entity/Basic/Enums/GainfoUserTypeEnumType.cs
+++ b/Src/Dlhis.Entity/Basic/Enums/GainfoUserTypeEnumType.cs
@@ -15,7 +15,19 @@ public enum GainfoUserTypeEnumType
Normal = 1,
///
- /// 安检白名单
+ /// 外包人员
+ ///
+ [Description("外包人员")]
+ Outsource = 2,
+
+ ///
+ /// 外部人员
+ ///
+ [Description("外部人员")]
+ External = 3,
+
+ ///
+ /// 安检白名单(也属于普通人员)
///
[Description("安检白名单")]
SecurityWhite = 99
diff --git a/Src/Dlhis.Entity/Visitor/Entity/AppointmentAreaEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/AppointmentAreaEntity.cs
index 6dbd1adf..c0f3d960 100644
--- a/Src/Dlhis.Entity/Visitor/Entity/AppointmentAreaEntity.cs
+++ b/Src/Dlhis.Entity/Visitor/Entity/AppointmentAreaEntity.cs
@@ -19,7 +19,7 @@ public class AppointmentAreaEntity : SugarBaseEntity, ITenantId, ISoftDeleted
[AdaptIgnore(MemberSide.Destination)]
[SugarColumn(IsNullable = false, ColumnDescription = "区域类型", ColumnDataType = "varchar(50)",
SqlParameterDbType = typeof(EnumToStringConvert),
- UniqueGroupNameList = new[] { "idx_ApponintmentArea_t_cc_tid" })]
+ UniqueGroupNameList = new[] { "idx_AppointmentArea_t_cc_tid" })]
public AppointmentAreaEnumType Type { get; set; }
///
@@ -27,7 +27,7 @@ public class AppointmentAreaEntity : SugarBaseEntity, ITenantId, ISoftDeleted
///
[AdaptIgnore(MemberSide.Destination)]
[SugarColumn(IsNullable = false, ColumnDescription = "自定义编码",
- UniqueGroupNameList = new[] { "idx_ApponintmentArea_t_cc_tid" })]
+ UniqueGroupNameList = new[] { "idx_AppointmentArea_t_cc_tid" })]
public string CustomCode { get; set; }
///
@@ -46,7 +46,7 @@ public class AppointmentAreaEntity : SugarBaseEntity, ITenantId, ISoftDeleted
/// 基地/租户
///
[SugarColumn(IsNullable = false, ColumnDescription = " 基地/租户",
- UniqueGroupNameList = new[] { "idx_ApponintmentArea_t_cc_tid" })]
+ UniqueGroupNameList = new[] { "idx_AppointmentArea_t_cc_tid" })]
public string TenantId { get; set; }
diff --git a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
index a253aeb8..9f6bca82 100644
--- a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
+++ b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs
@@ -11,7 +11,7 @@ namespace Dlhis.Entity.Visitor.Entity;
[SugarTable(TableName = "VisitorAppointmentDetail", TableDescription = "访客预约")]
public class VisitorAppointmentDetailEntity : SugarBaseEntity
{
- [SugarColumn(IsNullable = false, ColumnDescription = "父id")]
+ [SugarColumn(IsNullable = false, ColumnDescription = "pid")]
public long AppointmentId { get; set; }
///
@@ -20,12 +20,6 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity
[SugarColumn(IsNullable = false, ColumnDescription = "流水号")]
public string No { get; set; }
- ///
- /// 是否外部人员
- ///
- [SugarColumn(IsNullable = false, ColumnDataType = "bit")]
- public bool IsExternal { get; set; }
-
///
/// no
///
@@ -44,16 +38,6 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity
[SugarColumn(IsNullable = false, ColumnDescription = "手机号")]
public string Phone { get; set; }
-
- ///
- /// 身份证
- ///
- ///
- /// 使用身份证字段作为申请人唯一标识
- ///
- [SugarColumn(IsNullable = false, ColumnDescription = "身份证")]
- public string IdNo { get; set; }
-
///
/// 车牌
///
diff --git a/Src/Dlhis.Entity/Visitor/Enums/AppointmentAreaEnumType.cs b/Src/Dlhis.Entity/Visitor/Enums/AppointmentAreaEnumType.cs
index 70ebf494..d1d58806 100644
--- a/Src/Dlhis.Entity/Visitor/Enums/AppointmentAreaEnumType.cs
+++ b/Src/Dlhis.Entity/Visitor/Enums/AppointmentAreaEnumType.cs
@@ -18,5 +18,5 @@ public enum AppointmentAreaEnumType
/// 车间
///
[Description("车间")]
- Workshop = 2,
-}
+ Workplace = 2
+}
\ No newline at end of file
diff --git a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs
index e1aab234..f7c51b7d 100644
--- a/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs
+++ b/Src/Dlhis.External/Appointment/Dto/AppointmentReceiveItemDto.cs
@@ -18,10 +18,9 @@ public class AppointmentReceiveItemDto
public string Phone { get; set; }
///
- /// 身份证
+ /// 证件号/工号
///
- [StringLength(18, MinimumLength = 18)]
- [Required(ErrorMessage = "身份证必填")]
+ [Required(ErrorMessage = "证件号/工号")]
public string IdNo { get; set; }
///
diff --git a/Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs b/Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs
index 60a50aab..758f1a9a 100644
--- a/Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs
+++ b/Src/Dlhis.External/Appointment/Request/AppointmentReceiveRequest.cs
@@ -73,23 +73,19 @@ public class AppointmentReceiveRequest : IValidatableObject
///
public bool IsEnterWorkplace { get; set; }
+ ///
+ /// 车间区域
+ ///
+ public string WorkplaceArea { get; set; }
+
///
/// 明细
///
[MinLength(1, ErrorMessage = "明细必填")]
public List Items { get; set; }
-
public IEnumerable Validate(ValidationContext validationContext)
{
- if (IsEnterWorkplace)
- {
- if (Items.Any(x => x.ImageUrl.IsEmpty()))
- {
- yield return new ValidationResult("社保照片不可为空", new[] { "ImageUrl" });
- }
- }
-
if (Start >= End)
{
yield return new ValidationResult("来访时间不能大于等于离开时间", new[] { nameof(Start), nameof(End) });
diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
index 68e00939..97a1e6be 100644
--- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
+++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs
@@ -1,19 +1,24 @@
using Dlhis.Entity.Basic.Entity;
+using Dlhis.Entity.Basic.Enums;
using Dlhis.Entity.Visitor.Entity;
using Dlhis.Entity.Visitor.Enums;
using Dlhis.External.Appointment.Request;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
+using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions;
+using SqlSugar;
namespace Dlhis.External.Appointment.Services.Implements;
public class AppointmentService : IAppointmentService
{
private readonly IDbContext _dbContext;
+ private readonly RedisCache _redisCache;
- public AppointmentService(IDbContext dbContext)
+ public AppointmentService(IDbContext dbContext, RedisCache redisCache)
{
_dbContext = dbContext;
+ _redisCache = redisCache;
}
public async Task ReceiveAsync(AppointmentReceiveRequest request)
@@ -23,6 +28,11 @@ public class AppointmentService : IAppointmentService
var id = await _dbContext.InsertReturnIdentityAsync(new VisitorAppointmentEntity
{
+ Id = 0,
+ CreatedBy = 0,
+ CreateTime = default,
+ ModifiedBy = 0,
+ ModifiedTime = default,
No = request.No,
Title = request.Title,
Code = request.Code,
@@ -34,55 +44,76 @@ public class AppointmentService : IAppointmentService
Start = request.Start,
End = request.End,
Remark = request.Remark,
- IsEnterWorkplace = request.IsEnterWorkplace
+ IsEnterWorkplace = request.IsEnterWorkplace,
});
foreach (var item in request.Items)
{
- var no = await _dbContext.Queryable().Where(x => x.IdNo == item.IdNo).Select(x => x.No).SingleAsync();
- var isExternal = no.IsEmpty();
- if (isExternal)
+ var gainfo = await _dbContext.Queryable().Where(x => x.IdNo == item.IdNo || x.Code == item.IdNo).SingleAsync();
+ //外部人员
+ if (gainfo == null)
{
- var gainfoExternal = await _dbContext.Queryable().Where(x => x.IdNo == item.IdNo).FirstAsync();
- if (gainfoExternal == null)
+ gainfo = new GainfoEntity
{
- gainfoExternal = new GainfoExternalEntity
- {
- No = Guid.NewGuid().ToString(),
- Code = item.IdNo,
- IdNo = item.IdNo,
- Name = item.Name,
- Company = request.Company,
- Phone = item.Phone
- };
- await _dbContext.InsertAsync(gainfoExternal);
- }
- else
- {
- gainfoExternal.Phone = item.Phone;
- gainfoExternal.Company = request.Company;
-
- await _dbContext.UpdateAsync(gainfoExternal);
- }
-
- no = gainfoExternal.No;
+ No = Guid.NewGuid().ToString(),
+ Code = await GetExternalCodeAsync(),
+ Type = GainfoUserTypeEnumType.External,
+ IdNo = item.IdNo,
+ Name = item.Name,
+ Source = request.Company,
+ Phone = item.Phone
+ };
+ await _dbContext.InsertAsync(gainfo);
}
+ else
+ {
+ if (gainfo.Type == GainfoUserTypeEnumType.External)
+ {
+ gainfo.Source = request.Company;
+ gainfo.Phone = item.Phone;
+
+ await _dbContext.UpdateAsync(gainfo);
+ }
+ }
+
+ (gainfo.Type == GainfoUserTypeEnumType.External && request.IsEnterWorkplace && item.ImageUrl.IsEmpty()).ThrowIfTrue($"{item.Name}的社保照片不可为空");
var detail = new VisitorAppointmentDetailEntity
{
- UserNo = no,
+ UserNo = gainfo.No,
AppointmentId = id,
No = request.No,
- IdNo = item.IdNo,
Name = item.Name,
Phone = item.Phone,
Remark = item.Remark,
Status = AppointmentDetailEnumType.Wait,
- IsExternal = isExternal,
LicensePlate = item.LicensePlate
};
await _dbContext.InsertAsync(detail);
}
}
+
+ private async Task GetExternalCodeAsync()
+ {
+ await using var handler = await _redisCache.LockAsync("gainfo:external:code-generate", expiry: TimeSpan.FromSeconds(3), retryInterval: TimeSpan.FromSeconds(1), retryCount: 3);
+ handler.Acquired.ThrowIfFalse("生成虚拟工号失败");
+
+ int code;
+ var entity = await _dbContext.Queryable()
+ .Where(x => x.Type == GainfoUserTypeEnumType.External && x.Code.StartsWith("EXT"))
+ .OrderBy(x => x.Id, OrderByType.Desc)
+ .FirstAsync();
+
+ if (entity == null)
+ {
+ code = 1;
+ }
+ else
+ {
+ code = int.Parse(entity.Code.Replace("EXT", "").TrimStart('0')) + 1;
+ }
+
+ return "EXT" + code.ToString().PadLeft(6, '0');
+ }
}
\ No newline at end of file
diff --git a/Src/Dlhis.External/Program.cs b/Src/Dlhis.External/Program.cs
index e53ad73a..c388c2a4 100644
--- a/Src/Dlhis.External/Program.cs
+++ b/Src/Dlhis.External/Program.cs
@@ -21,8 +21,6 @@ public class Startup : DefaultStartup
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
-
- services.AddSqlSugar();
services.AddRedis();
}
}
\ No newline at end of file
diff --git a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs
index 4ec397a4..a8e12ff3 100644
--- a/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs
+++ b/Src/Dlhis.ScheduledTask/Common/Services/Implements/GainfoUpdateService.cs
@@ -243,7 +243,7 @@ public class GainfoUpdateService : IGainfoUpdateService
var info = new GainfoEntity
{
No = Guid.NewGuid().ToString(),
- SapNo = item.PERNR,
+ InternalNo = item.PERNR,
Type = GainfoUserTypeEnumType.Normal,
Name = item.gname,
Code = item.ename,
@@ -311,7 +311,7 @@ public class GainfoUpdateService : IGainfoUpdateService
var factory = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM;
await _dbContext.Updateable().SetColumns(g => new GainfoEntity
{
- SapNo = item.PERNR,
+ InternalNo = item.PERNR,
Name = item.gname,
PositionNo = item.STELL,
Grade = item.ZZ_ZD,
diff --git a/Src/Dlhis.ScheduledTask/Packs/JinkoSapHttpClientPack.cs b/Src/Dlhis.ScheduledTask/Packs/JinkoSapHttpClientPack.cs
index dace6138..71f02391 100644
--- a/Src/Dlhis.ScheduledTask/Packs/JinkoSapHttpClientPack.cs
+++ b/Src/Dlhis.ScheduledTask/Packs/JinkoSapHttpClientPack.cs
@@ -13,7 +13,7 @@ public class JinkoSapHttpClientPack : BaseAppPack
{
httpClient.Timeout = TimeSpan.FromMinutes(10);
- var credentials = string.Format("{0}:{1}", "EHS_USER", "y3R1hd2h*RICAC");
+ var credentials = $"{"EHS_USER"}:{"y3R1hd2h*RICAC"}";
var headerValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials));
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", headerValue);
});
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
index e31f258f..04175169 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs
@@ -251,8 +251,7 @@ public class AssignmentService : IAssignmentService
.LeftJoin((deviceTask, device, deviceTemplate, ga) => deviceTask.UserNo == ga.No)
.LeftJoin((deviceTask, device, deviceTemplate, ga, gaLeave) => deviceTask.UserNo == gaLeave.No)
.LeftJoin((deviceTask, device, deviceTemplate, ga, gaLeave, department) => department.No == ga.DepartmentNo)
- .LeftJoin((deviceTask, device, deviceTemplate, ga, gaLeave, department, gainfoEx) => deviceTask.UserNo == gainfoEx.No)
- .LeftJoin((deviceTask, device, deviceTemplate, ga, gaLeave, department, gainfoEx, deviceRegistry) => deviceRegistry.DeviceUniqueNo == deviceTask.DeviceUniqueNo)
+ .LeftJoin((deviceTask, device, deviceTemplate, ga, gaLeave, department, deviceRegistry) => deviceRegistry.DeviceUniqueNo == deviceTask.DeviceUniqueNo)
.Where((deviceTask, device) => device.Enable)
.WhereIF(!request.IsProcess, deviceTask => deviceTask.Status == DeviceTaskStatusEnumType.Wait)
.WhereIF(request.IsProcess, deviceTask => deviceTask.Status == DeviceTaskStatusEnumType.Process
@@ -261,14 +260,13 @@ public class AssignmentService : IAssignmentService
.WhereIF(factories.Any(), (deviceTask, device) => factories.Contains(deviceTask.TenantId))
.WhereIF(request.Types.IsPresent(), deviceTask => request.Types.Contains(deviceTask.Type))
.WhereIF(request.Brand.IsPresent(), (deviceTask, device, deviceTemplate) => deviceTemplate.Brand == request.Brand)
-
-#if !DEBUG
- .Where((deviceTask, device, deviceTemplate, ga, gaLeave, department, gainfoEx, deviceRegistry) =>
+ .Where((deviceTask, device, deviceTemplate, ga, gaLeave, department, deviceRegistry) =>
device.HeartbeatInterval == 0 || SqlFunc.DateAdd(deviceRegistry.LastHeartbeatTime, device.HeartbeatInterval, DateType.Second) > DateTime.Now)
+#if !DEBUG
+
#endif
-
.OrderBy(deviceTask => new { Priority = SqlFunc.Desc(deviceTask.Priority), deviceTask.CreateTime })
- .Select((deviceTask, device, deviceTemplate, ga, gaLeave, department, gainfoEx) => new TaskDto
+ .Select((deviceTask, device, deviceTemplate, ga, gaLeave, department) => new TaskDto
{
UserId = deviceTask.UserId == 0 || deviceTask.UserId == null
? ga.Id == 0
@@ -283,8 +281,8 @@ public class AssignmentService : IAssignmentService
Brand = deviceTemplate.Brand,
FuncStr = device.Funcs.ToString(),
UserNo = deviceTask.UserNo,
- UserCode = SqlFunc.IsNull(SqlFunc.IsNull(ga.Code, gaLeave.Code), gainfoEx.Code),
- UserName = SqlFunc.IsNull(SqlFunc.IsNull(ga.Name, gaLeave.Name), gainfoEx.Name),
+ UserCode = SqlFunc.IsNull(ga.Code, gaLeave.Code),
+ UserName = SqlFunc.IsNull(ga.Name, gaLeave.Name),
DepartmentNo = ga.DepartmentNo,
DepartmentName = department.Name,
CardNo = ga.CardNo,
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs
index 028e3bbb..6e704876 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/DeviceTaskAssignmentService.cs
@@ -30,8 +30,7 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
.LeftJoin((deviceTask, device) => deviceTask.DeviceUniqueNo == device.UniqueNo)
.LeftJoin((deviceTask, device, ga) => deviceTask.UserNo == ga.No)
.LeftJoin((deviceTask, device, ga, gaLeave) => deviceTask.UserNo == gaLeave.No)
- .LeftJoin((deviceTask, device, ga, gaLeave, gaEx) => deviceTask.UserNo == gaEx.No)
- .LeftJoin((deviceTask, device, ga, gaLeave, gaEx, deviceRegistry) => deviceRegistry.DeviceUniqueNo == deviceTask.DeviceUniqueNo)
+ .LeftJoin((deviceTask, device, ga, gaLeave, deviceRegistry) => deviceRegistry.DeviceUniqueNo == deviceTask.DeviceUniqueNo)
.Where(deviceTask => deviceTask.TenantId == request.Factory)
.WhereIF(request.Type.HasValue, deviceTask => deviceTask.DeviceType == request.Type)
.WhereIF(request.SearchDateTimePeriod.HasValue(), deviceTask => deviceTask.ModifiedTime >= request.SearchDateTimePeriod.Start && deviceTask.ModifiedTime <= request.SearchDateTimePeriod.End
@@ -44,12 +43,12 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
|| ga.Code == request.Search
|| deviceTask.DeviceUniqueNo == request.Search
)
- .WhereIF(request.IsOffline.HasValue && request.IsOffline.Value, (deviceTask, device, ga, gaLeave, gaEx, deviceRegistry) =>
+ .WhereIF(request.IsOffline.HasValue && request.IsOffline.Value, (deviceTask, device, ga, gaLeave, deviceRegistry) =>
device.HeartbeatInterval != 0 && SqlFunc.DateAdd(deviceRegistry.LastHeartbeatTime, device.HeartbeatInterval, DateType.Second) < DateTime.Now)
- .WhereIF(request.IsOffline.HasValue && !request.IsOffline.Value, (deviceTask, device, ga, gaLeave, gaEx, deviceRegistry) =>
+ .WhereIF(request.IsOffline.HasValue && !request.IsOffline.Value, (deviceTask, device, ga, gaLeave, deviceRegistry) =>
device.HeartbeatInterval == 0 || SqlFunc.DateAdd(deviceRegistry.LastHeartbeatTime, device.HeartbeatInterval, DateType.Second) >= DateTime.Now)
.OrderBy(deviceTask => deviceTask.ModifiedTime, OrderByType.Desc)
- .Select((deviceTask, device, ga, gaLeave, gaEx, deviceRegistry) => new DeviceTaskAssignmentResponse
+ .Select((deviceTask, device, ga, gaLeave, deviceRegistry) => new DeviceTaskAssignmentResponse
{
Id = deviceTask.Id,
DeviceUniqueNo = deviceTask.DeviceUniqueNo,
@@ -57,12 +56,8 @@ public class DeviceTaskAssignmentService : IDeviceTaskAssignmentService
RetryCount = deviceTask.Version,
Status = deviceTask.Status,
UserNo = deviceTask.UserNo,
- UserName = SqlFunc.IsNull(SqlFunc.IsNull(ga.Name,
- gaLeave.Name),
- gaEx.Name),
- UserCode = SqlFunc.IsNull(SqlFunc.IsNull(ga.Code,
- gaLeave.Code),
- gaEx.Code),
+ UserName = SqlFunc.IsNull(ga.Name, gaLeave.Name),
+ UserCode = SqlFunc.IsNull(ga.Code, gaLeave.Code),
Type = deviceTask.Type,
CreateTime = deviceTask.CreateTime,
LastUpdateTime = deviceTask.ModifiedTime,
diff --git a/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentAreaService.cs b/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentAreaService.cs
deleted file mode 100644
index 9df6f8e6..00000000
--- a/Src/Dlhis.Visitor/Appointment/Services/Implements/AppointmentAreaService.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-// using Dlhis.Entity.Basic.Entity;
-// using Dlhis.Entity.Device.Entities;
-// using Dlhis.Entity.Device.Enums;
-// using Dlhis.Entity.Visitor.Entity;
-// using Dlhis.Entity.Visitor.Enums;
-// using Dlhis.Visitor.Appointment.Request;
-// using Dlhis.Visitor.Appointment.Response;
-// using Kurisu.AspNetCore.DataAccess.Dto;
-// using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
-// using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
-// using Kurisu.AspNetCore.Utils.Extensions;
-// using Mapster;
-//
-// namespace Dlhis.Visitor.Appointment.Services.Implements;
-//
-// public class AppointmentAreaService : IAppointmentAreaService
-// {
-// private readonly IDbContext _dbContext;
-//
-// public AppointmentAreaService(IDbContext dbContext)
-// {
-// _dbContext = dbContext;
-// }
-//
-// public async Task> GetPageAsync(PageDto request)
-// {
-// return await _dbContext.Queryable()
-// .Select()
-// .ToPageListAsync(request);
-// }
-//
-//
-// public async Task SaveAsync(AppointmentAreaSaveRequest request)
-// {
-// await CheckCustomCodeDuplicateAsync(request);
-//
-// if (!request.Id.HasValue)
-// {
-// var entity = request.Adapt();
-// entity.Type = request.Type;
-// entity.CustomCode = request.CustomCode;
-//
-// await _dbContext.InsertAsync(entity);
-// }
-// else
-// {
-// var entity = await _dbContext.Queryable().Where(x => x.Id == request.Id).SingleAsync();
-// entity.ThrowIfNull("预约区域不存在");
-//
-// request.Adapt(entity);
-//
-// await _dbContext.UpdateAsync(entity);
-// }
-// }
-//
-//
-// public async Task DeleteAsync(long id)
-// {
-// var entity = await _dbContext.Queryable().Where(x => x.Id == id).SingleAsync();
-// await _dbContext.DeleteAsync(entity);
-// }
-//
-//
-// public async Task AssignAsync(AppointmentAreaAssignRequest request)
-// {
-// var userNos = await _dbContext.Queryable()
-// .LeftJoin((x, y) => x.No == y.No)
-// .Where(x => x.Status == AppointmentDetailEnumType.Arrived)
-// .Where((x, y) => y.AreaCustomCode == request.CustomCode)
-// .Select(x => x.UserNo)
-// .ToListAsync();
-//
-// //通过人
-// var deviceCodes = await _dbContext.Queryable()
-// .Where(x => x.CustomCode == request.CustomCode).Select(x => x.DeviceCode).ToListAsync();
-//
-// var userPermissions = userNos.ToDictionary(x => x, _ => deviceCodes.ToList());
-//
-// await _dbContext.Client.Deleteable()
-// .Where(x => x.CustomCode == request.CustomCode)
-// .ExecuteCommandAsync();
-//
-// var data = request.DeviceCodes.Select(x => new AppointmentAreaAssignmentEntity
-// {
-// CustomCode = request.CustomCode,
-// DeviceCode = x
-// }).ToList();
-//
-// await _dbContext.InsertAsync(data);
-//
-//
-// deviceCodes = await _dbContext.Queryable()
-// .Where(x => x.CustomCode == request.CustomCode).Select(x => x.DeviceCode).ToListAsync();
-//
-// var devices = await _dbContext.Queryable().Where(x => deviceCodes.Contains(x.Code)).ToListAsync();
-//
-// var userCurrentPermissions = userNos.ToDictionary(x => x, _ => deviceCodes.ToList());
-//
-// var tasks = new List();
-// foreach (var userNo in userNos)
-// {
-// var before = userPermissions[userNo];
-// var current = userCurrentPermissions[userNo];
-//
-// //被删除
-// var deletedItems = before.Where(x => !current.Contains(x)).ToList();
-// //新增
-// var addItems = current.Where(x => !before.Contains(x)).ToList();
-//
-// if (!deletedItems.Any() && !addItems.Any())
-// {
-// continue;
-// }
-//
-// tasks.AddRange(deletedItems.Select(x => new DeviceTaskEntity
-// {
-// Type = DeviceTaskEnumType.Delete,
-// DeviceType = DeviceTypeEnumType.Door,
-// UserNo = userNo,
-// DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo,
-// Status = DeviceTaskStatusEnumType.Wait,
-// Version = 0,
-// CancellationId = 0,
-// Source = DeviceTaskSourceEnumType.Appointment,
-// Priority = 99
-// }));
-//
-// tasks.AddRange(addItems.Select(x => new DeviceTaskEntity
-// {
-// Type = DeviceTaskEnumType.Add,
-// DeviceType = DeviceTypeEnumType.Door,
-// UserNo = userNo,
-// DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo,
-// Status = DeviceTaskStatusEnumType.Wait,
-// Version = 0,
-// CancellationId = 0,
-// Source = DeviceTaskSourceEnumType.Appointment,
-// Priority = 99
-// }));
-// }
-//
-// await _dbContext.InsertAsync(tasks);
-// }
-//
-//
-// //********************************************************* help methods ***************************************************************
-//
-//
-// ///
-// /// 检查编码重复
-// ///
-// ///
-// ///
-// private async Task CheckCustomCodeDuplicateAsync(AppointmentAreaSaveRequest request)
-// {
-// var exists = await _dbContext.Queryable()
-// .Where(x => x.CustomCode == request.CustomCode)
-// .WhereIF(request.Id.HasValue, x => x.Id == request.Id)
-// .AnyAsync();
-//
-// exists.ThrowIfTrue("重复区域编码,请检查");
-// }
-// }
\ No newline at end of file
diff --git a/Src/Dlhis.Visitor/Dlhis.Visitor.csproj b/Src/Dlhis.Visitor/Dlhis.Visitor.csproj
deleted file mode 100644
index 884581c7..00000000
--- a/Src/Dlhis.Visitor/Dlhis.Visitor.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- net6.0
- disable
- enable
- True
- Linux
- ..\..
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Src/Dlhis.Visitor/Dockerfile b/Src/Dlhis.Visitor/Dockerfile
deleted file mode 100644
index bf1c8a0e..00000000
--- a/Src/Dlhis.Visitor/Dockerfile
+++ /dev/null
@@ -1,24 +0,0 @@
-#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
-
-FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
-WORKDIR /app
-EXPOSE 80
-
-FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
-ARG BUILD_CONFIGURATION=Release
-WORKDIR /src
-COPY ["Src/Dlhis.Visitor/Dlhis.Visitor.csproj", "Src/Dlhis.Visitor/"]
-COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
-RUN dotnet restore "./Src/Dlhis.Visitor/./Dlhis.Visitor.csproj"
-COPY . .
-WORKDIR "/src/Src/Dlhis.Visitor"
-RUN dotnet build "./Dlhis.Visitor.csproj" -c $BUILD_CONFIGURATION -o /app/build
-
-FROM build AS publish
-ARG BUILD_CONFIGURATION=Release
-RUN dotnet publish "./Dlhis.Visitor.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
-
-FROM base AS final
-WORKDIR /app
-COPY --from=publish /app/publish .
-ENTRYPOINT ["dotnet", "Dlhis.Visitor.dll"]
\ No newline at end of file
diff --git a/Src/Dlhis.Visitor/Program.cs b/Src/Dlhis.Visitor/Program.cs
deleted file mode 100644
index 2da36e95..00000000
--- a/Src/Dlhis.Visitor/Program.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Kurisu.AspNetCore.Startup;
-using Microsoft.IdentityModel.Logging;
-
-namespace Dlhis.Visitor;
-
-class Program
-{
- static void Main(string[] args)
- {
- KurisuHost.Run(args);
- }
-}
-
-public class Startup : DefaultStartup
-{
- public Startup(IConfiguration configuration) : base(configuration)
- {
- IdentityModelEventSource.ShowPII = true;
- }
-}
\ No newline at end of file
diff --git a/Src/Dlhis.Visitor/Properties/launchSettings.json b/Src/Dlhis.Visitor/Properties/launchSettings.json
deleted file mode 100644
index 8499ad17..00000000
--- a/Src/Dlhis.Visitor/Properties/launchSettings.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "profiles": {
- "Dlhis.Visitor": {
- "commandName": "Project",
- "launchUrl": "weatherforecast",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
- "dotnetRunMessages": true,
- "applicationUrl": "http://localhost:5021"
- },
- "Docker": {
- "commandName": "Docker",
- "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast",
- "environmentVariables": {
- "ASPNETCORE_URLS": "http://+:80"
- },
- "publishAllPorts": true
- }
- },
- "$schema": "https://json.schemastore.org/launchsettings.json"
-}
\ No newline at end of file
diff --git a/Src/Dlhis.Visitor/appsettings.Development.json b/Src/Dlhis.Visitor/appsettings.Development.json
deleted file mode 100644
index 7bacdb83..00000000
--- a/Src/Dlhis.Visitor/appsettings.Development.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
- "InternalRequest": {
- "BasicRequestUrl": "http://localhost:5002"
- },
- "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": ""
- },
- "SqlSugarOptions": {
- "DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
- "SlaveConnectionString": [],
- "Timeout": 30,
- "SlowSqlTime": 1,
- "EnableSqlLog": true
- }
-}
diff --git a/Src/Dlhis.Visitor/appsettings.json b/Src/Dlhis.Visitor/appsettings.json
deleted file mode 100644
index 49ad4e0d..00000000
--- a/Src/Dlhis.Visitor/appsettings.json
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
- "InternalRequest": {
- "BasicRequestUrl": "http://basic"
- },
- "AllowedHosts": "*",
- "SqlSugarOptions": {
- "DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
- "SlaveConnectionString": [],
- "Timeout": 30,
- "SlowSqlTime": 1,
- "EnableSqlLog": false
- },
- "RedisOptions": {
- "ConnectionString": "192.168.199.30:30115,defaultDatabase=1,password=dlhis123"
- },
- "DataProtectionOptions": {
- "Enable": true,
- "AppName": "yiliantong"
- },
- "SwaggerOptions": {
- "Enable": true,
- "Authority": "http://identity.oauth.svc.cluster.local",
- "ClientId": "4fb184324eac4180",
- "ClientSecret": "8ac8f235152f1524",
- "Scopes": {
- "openid": "openid",
- "profile": "profile",
- "yikatong": "yikatong"
- }
- },
- "IdentityServerOptions": {
- "Authority": "http://identity.oauth.svc.cluster.local",
- "RequireHttpsMetadata": false,
- "Issuer": "identity.isawesome.cn",
- "Audience": "",
- "Pat": {
- "Enable": false,
- "Scheme": "token",
- "ClientId": "reference",
- "ClientSecret": "123456"
- }
- },
- "Serilog": {
- "MinimumLevel": {
- "Default": "Information",
- "Override": {
- "System": "Warning",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "WriteTo": [
- {
- "Name": "Async",
- "Args": {
- "configure": [
- {
- "Name": "Console",
- "Args": {
- "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}"
- }
- },
- {
- "Name": "MySQL",
- "Args": {
- "connectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=logs;charset=utf8mb4;",
- "tableName": "Logs",
- "autoCreateSqlTable": true
- }
- }
- ]
- }
- }
- ]
- }
-}