From 98ec99bb63cc71b0722e978626d738420bcfac94 Mon Sep 17 00:00:00 2001 From: Deryushev_av Date: Fri, 10 Apr 2026 08:56:33 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BB=D0=BE=D0=BD=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=B2=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=20=D1=81=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8=D0=B5?= =?UTF-8?q?=D0=B9,=20=D0=B2=20=D0=BA=D0=B0=D0=BA=D0=BE=D0=B9=20=D0=9D?= =?UTF-8?q?=D0=9E=D0=A0=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D0=B8=D1=82=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D1=8C=20=D1=81=D0=BE=D1=82=D1=80?= =?UTF-8?q?=D1=83=D0=B4=D0=BD=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\320\270\320\271 \320\262 DirectumRX.xlsx" | Bin 10323 -> 10495 bytes src/ImportData/Constants.cs | 4 + .../Entities/Databooks/Substitution.cs | 4 +- .../Models/ISubstitutionSubstitute.cs | 35 +++++++ .../Models/ISubstitutionUsers.cs | 35 +++++++ .../Models/ISubstitutions.cs | 14 +-- .../Models/ISubstitutionsWithBU.cs | 86 ++++++++++++++++++ src/Tests/Templates/Substitutions.xlsx | Bin 10523 -> 10712 bytes 8 files changed, 163 insertions(+), 15 deletions(-) create mode 100644 src/ImportData/IntegrationServicesClient/Models/ISubstitutionSubstitute.cs create mode 100644 src/ImportData/IntegrationServicesClient/Models/ISubstitutionUsers.cs create mode 100644 src/ImportData/IntegrationServicesClient/Models/ISubstitutionsWithBU.cs diff --git "a/Templates/\320\250\320\260\320\261\320\273\320\276\320\275 \320\264\320\273\321\217 \320\267\320\260\320\263\321\200\321\203\320\267\320\272\320\270 \320\267\320\260\320\274\320\265\321\211\320\265\320\275\320\270\320\271 \320\262 DirectumRX.xlsx" "b/Templates/\320\250\320\260\320\261\320\273\320\276\320\275 \320\264\320\273\321\217 \320\267\320\260\320\263\321\200\321\203\320\267\320\272\320\270 \320\267\320\260\320\274\320\265\321\211\320\265\320\275\320\270\320\271 \320\262 DirectumRX.xlsx" index 6ddd71dd0af7b47504122f1d359cc06d5ad0fb42..2d1bd3e44a682880150cbdb98f28bf76603f14b1 100644 GIT binary patch delta 3811 zcmZWsc|4R|8y;iqMi@eb!4P3&2$d|^Wr^&0NenTTjI}Vfh7@7!RF=?d%f3a@$XaBX zV(eM6FO7AGZ+gFeZ(n`SALlv0^W4jM&VAk2x$i;a<7*IOeQFQ~fEGXx005u>HHGj# zj|zw=5L0r!%j2yKYqQ0YipFd62RTtiMf7})d^RErbZG&JmLj!tJZBDr#gNy`D(G8b z*HC>nqNGdQr9@FHb=4V^G}+2X#Ga`zw$yu5`Mb_D&G6?X=CM`r59PDD!Rza^gEe$l z>xmB1u0qE`u#@uDjEJwT-wYSki=$Ppz?voIi!i|b;brBnw^l%XabIo+#efJCsZ)9r z7EMjpWD({fFEi1n&7_ldW5qctj2o)S0=i4x103156)rp%t_Y~!E}?qiE-S!{z%sB_ zoa6W==p0H57aniyu9s!R69a2~4GI zvhW@O0f6IUYQXPtr~#SD2yaytQS(zGk!WCqmtn@P>l{XP?h?l1S=IIZ)pTA#uZM){ zj-9B9%@g4rZxQ2Ty?!c!S{u_Ga@ajOekpdT6T0(7uH+#*$3@{<|59u!`HnB0gs69l z)}4~+Ha0)PHen}STQBg8U-M&$;`$dk`dyR4T7#P!6|8;I7N-~>`Fz-u%IRSk>vjXH z35UHhDuTM{YALq7P9b{<*O!U;oKmm|R*6=+x-yW?*@<>=9w`gzL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a0834..5b71f9f 100644 --- a/src/ImportData/Constants.cs +++ b/src/ImportData/Constants.cs @@ -107,6 +107,10 @@ public class KeyAttributes public const string Extension = "Extension"; public const string DocumentKinds = "DocumentKinds"; public const string RecipientLinks = "RecipientLinks"; + public const string UserBusinessUnit = "UserBusinessUnit"; + public const string SubstituteBusinessUnit = "SubstituteBusinessUnit"; + public const string SubstitutionUser = "SubstitutionUser"; + public const string SubstitutionSubstitute = "SubstitutionSubstitute"; } public static Dictionary AttributeValue = new Dictionary diff --git a/src/ImportData/Entities/Databooks/Substitution.cs b/src/ImportData/Entities/Databooks/Substitution.cs index 7ae1ddb..b77edd9 100644 --- a/src/ImportData/Entities/Databooks/Substitution.cs +++ b/src/ImportData/Entities/Databooks/Substitution.cs @@ -7,8 +7,8 @@ namespace ImportData.Entities.Databooks { public class Substitution : Entity { - public override int PropertiesCount { get { return 4; } } - protected override Type EntityType { get { return typeof(ISubstitutions); } } + public override int PropertiesCount { get { return 6; } } + protected override Type EntityType { get { return typeof(ISubstitutionsWithBU); } } protected override bool FillProperies(List exceptionList, NLog.Logger logger) { diff --git a/src/ImportData/IntegrationServicesClient/Models/ISubstitutionSubstitute.cs b/src/ImportData/IntegrationServicesClient/Models/ISubstitutionSubstitute.cs new file mode 100644 index 0000000..102a3df --- /dev/null +++ b/src/ImportData/IntegrationServicesClient/Models/ISubstitutionSubstitute.cs @@ -0,0 +1,35 @@ +using DocumentFormat.OpenXml.Wordprocessing; +using ImportData.Entities.Databooks; +using System.Collections.Generic; + +namespace ImportData.IntegrationServicesClient.Models +{ + [EntityName("Пользователи")] + public class ISubstitutionSubstitute: IEntity + { + [PropertyOptions("НОР замещающего", RequiredType.NotRequired, PropertyType.Entity, AdditionalCharacters.ForSearch)] + public IBusinessUnits SubstituteBusinessUnit { get; set; } + + public IUsers User; + + new public static IEntity FindEntity(Dictionary propertiesForSearch, Entity entity, bool isEntityForUpdate, List exceptionList, NLog.Logger logger) + { + var name = propertiesForSearch.ContainsKey(Constants.KeyAttributes.CustomFieldName) ? + propertiesForSearch[Constants.KeyAttributes.CustomFieldName] : propertiesForSearch[Constants.KeyAttributes.Substitute]; + + entity.ResultValues.TryGetValue(Constants.KeyAttributes.SubstituteBusinessUnit, out var substituteBusinessUnit); + var businessUnit = (IBusinessUnits)substituteBusinessUnit; + if (businessUnit != null) + { + var employee = BusinessLogic.GetEntityWithFilter(x => x.Name == name && x.Department != null && x.Department.BusinessUnit != null && x.Department.BusinessUnit.Id == businessUnit.Id, exceptionList, logger); + if (employee != null) + return new ISubstitutionSubstitute { User = employee }; + } + + var user = BusinessLogic.GetEntityWithFilter(x => x.Name == name, exceptionList, logger); + if (user != null) + return new ISubstitutionSubstitute { User = user }; + return null; + } + } +} diff --git a/src/ImportData/IntegrationServicesClient/Models/ISubstitutionUsers.cs b/src/ImportData/IntegrationServicesClient/Models/ISubstitutionUsers.cs new file mode 100644 index 0000000..95dfffd --- /dev/null +++ b/src/ImportData/IntegrationServicesClient/Models/ISubstitutionUsers.cs @@ -0,0 +1,35 @@ +using DocumentFormat.OpenXml.Wordprocessing; +using ImportData.Entities.Databooks; +using System.Collections.Generic; + +namespace ImportData.IntegrationServicesClient.Models +{ + [EntityName("Пользователи")] + public class ISubstitutionUsers : IEntity + { + [PropertyOptions("НОР замещаемого", RequiredType.NotRequired, PropertyType.Entity, AdditionalCharacters.ForSearch)] + public IBusinessUnits UserBusinessUnit { get; set; } + + public IUsers User; + + new public static IEntity FindEntity(Dictionary propertiesForSearch, Entity entity, bool isEntityForUpdate, List exceptionList, NLog.Logger logger) + { + var name = propertiesForSearch.ContainsKey(Constants.KeyAttributes.CustomFieldName) ? + propertiesForSearch[Constants.KeyAttributes.CustomFieldName] : propertiesForSearch[Constants.KeyAttributes.User]; + + entity.ResultValues.TryGetValue(Constants.KeyAttributes.UserBusinessUnit, out var userBusinessUnit); + var businessUnit = (IBusinessUnits)userBusinessUnit; + if (businessUnit != null) + { + var employee = BusinessLogic.GetEntityWithFilter(x => x.Name == name && x.Department != null && x.Department.BusinessUnit != null && x.Department.BusinessUnit.Id == businessUnit.Id, exceptionList, logger); + if (employee != null) + return new ISubstitutionUsers { User = employee }; + } + + var user = BusinessLogic.GetEntityWithFilter(x => x.Name == name, exceptionList, logger); + if (user != null) + return new ISubstitutionUsers { User = user }; + return null; + } + } +} diff --git a/src/ImportData/IntegrationServicesClient/Models/ISubstitutions.cs b/src/ImportData/IntegrationServicesClient/Models/ISubstitutions.cs index 8b9d5d1..d19b1b0 100644 --- a/src/ImportData/IntegrationServicesClient/Models/ISubstitutions.cs +++ b/src/ImportData/IntegrationServicesClient/Models/ISubstitutions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq.Expressions; namespace ImportData.IntegrationServicesClient.Models { @@ -27,11 +28,7 @@ public DateTimeOffset? EndDate public bool DelegateStrictRights { get; set; } public string Comment { get; set; } public string Status { get; set; } - - [PropertyOptions("Сотрудник", RequiredType.Required, PropertyType.Entity, AdditionalCharacters.ForSearch)] public IUsers User { get; set; } - - [PropertyOptions("Замещающий", RequiredType.Required, PropertyType.Entity, AdditionalCharacters.ForSearch)] public IUsers Substitute { get; set; } new public static IEntity CreateEntity(Dictionary propertiesForSearch, Entity entity, List exceptionList, bool isBatch, NLog.Logger logger) @@ -47,15 +44,6 @@ public DateTimeOffset? EndDate }, exceptionList, logger); } - new public static IEntity FindEntity(Dictionary propertiesForSearch, Entity entity, bool isEntityForUpdate, List exceptionList, NLog.Logger logger) - { - var userName = propertiesForSearch[Constants.KeyAttributes.User]; - var substituteName = propertiesForSearch[Constants.KeyAttributes.Substitute]; - var name = string.Format("{0} - {1}", substituteName, userName); - - return BusinessLogic.GetEntityWithFilter(x => x.User.Name == name && x.Substitute.Name == substituteName, exceptionList, logger); - } - new public static IEntityBase CreateOrUpdate(IEntity entity, bool isNewEntity, bool isBatch, List exceptionList, NLog.Logger logger) { if (isNewEntity) diff --git a/src/ImportData/IntegrationServicesClient/Models/ISubstitutionsWithBU.cs b/src/ImportData/IntegrationServicesClient/Models/ISubstitutionsWithBU.cs new file mode 100644 index 0000000..078c276 --- /dev/null +++ b/src/ImportData/IntegrationServicesClient/Models/ISubstitutionsWithBU.cs @@ -0,0 +1,86 @@ +using DocumentFormat.OpenXml.Wordprocessing; +using System.Collections.Generic; + +namespace ImportData.IntegrationServicesClient.Models +{ + [EntityName("Замещения")] + public class ISubstitutionsWithBU : ISubstitutions + { + + [PropertyOptions("НОР замещаемого", RequiredType.NotRequired, PropertyType.Entity, AdditionalCharacters.ForSearch)] + public IBusinessUnits UserBusinessUnit { get; set; } + + [PropertyOptions("НОР замещающего", RequiredType.NotRequired, PropertyType.Entity, AdditionalCharacters.ForSearch)] + public IBusinessUnits SubstituteBusinessUnit { get; set; } + + [PropertyOptions("Сотрудник", RequiredType.Required, PropertyType.Entity, AdditionalCharacters.ForSearch)] + public ISubstitutionUsers SubstitutionUser { get; set; } + + [PropertyOptions("Замещающий", RequiredType.Required, PropertyType.Entity, AdditionalCharacters.ForSearch)] + public ISubstitutionSubstitute SubstitutionSubstitute { get; set; } + + public ISubstitutions Substitution { get; set; } + + new public static IEntity CreateEntity(Dictionary propertiesForSearch, Entity entity, List exceptionList, bool isBatch, NLog.Logger logger) + { + var userName = propertiesForSearch[Constants.KeyAttributes.User]; + var substituteName = propertiesForSearch[Constants.KeyAttributes.Substitute]; + + var createdEntity = new ISubstitutionsWithBU(); + createdEntity.Substitution = BusinessLogic.CreateEntity(new ISubstitutions() + { + Name = string.Format("{0} - {1}", substituteName, userName), + DelegateStrictRights = false, + Status = Constants.AttributeValue[Constants.KeyAttributes.Status] + }, exceptionList, logger); + return createdEntity; + } + + new public static IEntity FindEntity(Dictionary propertiesForSearch, Entity entity, bool isEntityForUpdate, List exceptionList, NLog.Logger logger) + { + if (entity.ResultValues.TryGetValue(Constants.KeyAttributes.SubstitutionUser, out var user) && + entity.ResultValues.TryGetValue(Constants.KeyAttributes.SubstitutionSubstitute, out var substitute)) + { + var userId = ((ISubstitutionUsers)user).User.Id; + var substituteId = ((ISubstitutionSubstitute)substitute).User.Id; + var substitution = BusinessLogic.GetEntityWithFilter(x => x.User.Id == userId && x.Substitute.Id == substituteId, exceptionList, logger); + + if (substitution != null) + return new ISubstitutionsWithBU { Substitution = substitution }; + } + + return null; + } + new public static IEntityBase CreateOrUpdate(IEntity entity, bool isNewEntity, bool isBatch, List exceptionList, NLog.Logger logger) + { + var substitutionsWithBU = (ISubstitutionsWithBU)entity; + var substitute = substitutionsWithBU.SubstitutionSubstitute?.User; + var user = substitutionsWithBU.SubstitutionUser?.User; + if (substitutionsWithBU.Substitution == null) + { + substitutionsWithBU.Substitution = new ISubstitutions() + { + Name = string.Format("{0} - {1}", substitute?.Name, user?.Name), + DelegateStrictRights = false, + Status = Constants.AttributeValue[Constants.KeyAttributes.Status] + }; + } + + substitutionsWithBU.Substitution.Substitute = substitute; + substitutionsWithBU.Substitution.User = user; + substitutionsWithBU.Substitution.Comment = substitutionsWithBU.Comment; + substitutionsWithBU.Substitution.DelegateStrictRights = substitutionsWithBU.DelegateStrictRights; + substitutionsWithBU.Substitution.StartDate = substitutionsWithBU.StartDate; + substitutionsWithBU.Substitution.EndDate = substitutionsWithBU.EndDate; + substitutionsWithBU.Substitution.IsSystem = substitutionsWithBU.IsSystem; + + if (isNewEntity) + substitutionsWithBU.Substitution = BusinessLogic.CreateEntity(substitutionsWithBU.Substitution, exceptionList, logger); + else + substitutionsWithBU.Substitution = BusinessLogic.UpdateEntity(substitutionsWithBU.Substitution, exceptionList, logger); + + return substitutionsWithBU; + } + + } +} diff --git a/src/Tests/Templates/Substitutions.xlsx b/src/Tests/Templates/Substitutions.xlsx index 94e8e8afcdb799e9bfe35079c47da7407912ecd0..c9e9649eaecc0d9b756eac2824c970eb19c6cc71 100644 GIT binary patch delta 3953 zcmZu!2UHW=)(*Y5fFu-2=tX*$a;Z`bARQwrMF>LZL7G4SXjJM9I7CiDg%M^}IO%^Mmc!hj0!^Q^XyE-bP zhDk?BH@VundzE-}vXLq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