diff --git a/Hcs.Client/Client/Api/HouseManagementApi.cs b/Hcs.Client/Client/Api/HouseManagementApi.cs
index 4dc6ea9..e50c552 100644
--- a/Hcs.Client/Client/Api/HouseManagementApi.cs
+++ b/Hcs.Client/Client/Api/HouseManagementApi.cs
@@ -58,7 +58,6 @@ namespace Hcs.Client.Api
return await request.ExecuteAsync(contractRootGuid, token);
}
-
///
/// Импорт лицевого счета
///
@@ -71,6 +70,17 @@ namespace Hcs.Client.Api
return await request.ExecuteAsync(payload, token);
}
+ ///
+ /// Импорт данных дома
+ ///
+ /// Пейлоад данных дома
+ /// Токен отмены
+ /// true, если операция выполнена успешно, иначе - false
+ public async Task ImportHouseUODataAsync(ImportLivingHouseUODataPayload payload, CancellationToken token = default)
+ {
+ var request = new ImportHouseUODataRequest(client);
+ return await request.ExecuteAsync(payload, token);
+ }
///
/// Импорт новости для информирования граждан
@@ -84,7 +94,6 @@ namespace Hcs.Client.Api
return await request.ExecuteAsync(payload, token);
}
-
///
/// Импорт договора ресурсоснабжения с РСО
///
diff --git a/Hcs.Client/Client/Api/Payload/HouseManagement/ImportLivingHouseUODataPayload.cs b/Hcs.Client/Client/Api/Payload/HouseManagement/ImportLivingHouseUODataPayload.cs
new file mode 100644
index 0000000..59691e1
--- /dev/null
+++ b/Hcs.Client/Client/Api/Payload/HouseManagement/ImportLivingHouseUODataPayload.cs
@@ -0,0 +1,94 @@
+using Hcs.Service.Async.HouseManagement;
+using System;
+
+namespace Hcs.Client.Api.Payload.HouseManagement
+{
+ // http://open-gkh.ru/HouseManagement/importHouseUORequest/LivingHouse/LivingHouseToCreate.html
+ // http://open-gkh.ru/HouseManagement/HouseBasicUOType.html
+ public class ImportLivingHouseUODataPayload
+ {
+ ///
+ /// Глобальный уникальный идентификатор дома по ФИАС
+ ///
+ public Guid fiasHouseGuid;
+
+ ///
+ /// Общая площадь здания
+ ///
+ public decimal totalSquare;
+
+ ///
+ /// Состояние (НСИ 24)
+ ///
+ public nsiRef state;
+
+ ///
+ /// Необязательное. Стадия жизненного цикла (НСИ 338).
+ ///
+ public nsiRef lifeCycleStage;
+
+ ///
+ /// Год ввода в эксплуатацию. До 2215 включительно.
+ ///
+ public short usedYear;
+
+ ///
+ /// Количество этажей. До 999 включительно.
+ ///
+ public int floorCount;
+
+ ///
+ /// Необязательное. ОКТМО (обязательное для всех территорий, за исключением города и космодрома
+ /// "Байконур"). Значение из ФИАС при наличии.
+ ///
+ public OKTMORefType oktmo;
+
+ ///
+ /// Часовая зона. Справочник 32.
+ ///
+ public nsiRef olsonTZ;
+
+ ///
+ /// Наличие у дома статуса объекта культурного наследия
+ ///
+ public bool culturalHeritage;
+
+ ///
+ /// Необязательное. Данные ОЖФ
+ ///
+ public OGFData[] ogfData;
+
+ ///
+ /// Необязательное. Дом находится в муниципальной собственности и в полном объеме используется
+ /// в качестве общежития. Принимает только false.
+ ///
+ public bool isMunicipalProperty;
+
+ ///
+ /// Необязательное. Дом находится в собственности субъекта Российской Федерации и в полном объеме
+ /// используется в качестве общежития. Принимает только false.
+ ///
+ public bool isRegionProperty;
+
+ ///
+ /// Кадастровый номер
+ ///
+ public string cadastralNumber;
+
+ ///
+ /// Условный номер. При указании в ГИС ЖКХ осуществляется привязка к ЕГРП (поиск в ЕГРП выполняется
+ /// по условному номеру).
+ ///
+ public string conditionalNumber;
+
+ ///
+ /// Необязательное. Жилой дом блокированной застройки (если не указан - аналог false).
+ ///
+ public bool hasBlocks;
+
+ ///
+ /// Необязательное. Несколько жилых домов с одинаковым адресом (если не указан - аналог false)
+ ///
+ public bool hasMultipleHousesWithSameAddress;
+ }
+}
diff --git a/Hcs.Client/Client/Api/Registry/Registry239.cs b/Hcs.Client/Client/Api/Registry/Registry239.cs
index 0b01940..10d8efc 100644
--- a/Hcs.Client/Client/Api/Registry/Registry239.cs
+++ b/Hcs.Client/Client/Api/Registry/Registry239.cs
@@ -3,7 +3,7 @@
namespace Hcs.Client.Api.Registry
{
///
- /// НСИ "Тарифицируемый ресурс" (реестровый номер 239)
+ /// НСИ "Тарифицируемый ресурс" (реестровый номер 239).
/// Взято из https://dom.gosuslugi.ru/opendataapi/nsi-239/v1.
///
public static class Registry239
diff --git a/Hcs.Client/Client/Api/Registry/Registry24.cs b/Hcs.Client/Client/Api/Registry/Registry24.cs
new file mode 100644
index 0000000..eb665db
--- /dev/null
+++ b/Hcs.Client/Client/Api/Registry/Registry24.cs
@@ -0,0 +1,47 @@
+using Hcs.Service.Async.HouseManagement;
+
+namespace Hcs.Client.Api.Registry
+{
+ ///
+ /// НСИ "Состояние дома" (реестровый номер 24).
+ /// Взято из https://dom.gosuslugi.ru/opendataapi/nsi-24/v1.
+ ///
+ public static class Registry24
+ {
+ ///
+ /// Аварийный
+ ///
+ public static nsiRef Element1 => new()
+ {
+ Code = "1",
+ GUID = "cbe05853-a91b-43cc-a2cb-06cdfa97d492"
+ };
+
+ ///
+ /// Исправный
+ ///
+ public static nsiRef Element2 => new()
+ {
+ Code = "2",
+ GUID = "2d3ae73e-6c72-4740-9122-9c632d1893a7"
+ };
+
+ ///
+ /// Ветхий
+ ///
+ public static nsiRef Element3 => new()
+ {
+ Code = "3",
+ GUID = "bf083ae4-e4ec-4ace-b190-4d009e5cd1a1"
+ };
+
+ ///
+ /// Не выбран
+ ///
+ public static nsiRef Element4 => new()
+ {
+ Code = "4",
+ GUID = "4ee07c0b-82d6-41f4-a8c5-2cff784bbd9c"
+ };
+ }
+}
diff --git a/Hcs.Client/Client/Api/Registry/Registry276.cs b/Hcs.Client/Client/Api/Registry/Registry276.cs
index 649d460..31a35be 100644
--- a/Hcs.Client/Client/Api/Registry/Registry276.cs
+++ b/Hcs.Client/Client/Api/Registry/Registry276.cs
@@ -3,7 +3,7 @@
namespace Hcs.Client.Api.Registry
{
///
- /// НСИ "Показатели качества коммунальных ресурсов" (реестровый номер 276)
+ /// НСИ "Показатели качества коммунальных ресурсов" (реестровый номер 276).
/// Взято из https://dom.gosuslugi.ru/opendataapi/nsi-276/v1.
///
public static class Registry276
diff --git a/Hcs.Client/Client/Api/Registry/Registry3.cs b/Hcs.Client/Client/Api/Registry/Registry3.cs
index 1d3551d..b116008 100644
--- a/Hcs.Client/Client/Api/Registry/Registry3.cs
+++ b/Hcs.Client/Client/Api/Registry/Registry3.cs
@@ -3,7 +3,7 @@
namespace Hcs.Client.Api.Registry
{
///
- /// НСИ "Вид коммунальной услуги" (реестровый номер 3)
+ /// НСИ "Вид коммунальной услуги" (реестровый номер 3).
/// Взято из https://dom.gosuslugi.ru/opendataapi/nsi-3/v1.
///
public static class Registry3
diff --git a/Hcs.Client/Client/Api/Registry/Registry32.cs b/Hcs.Client/Client/Api/Registry/Registry32.cs
new file mode 100644
index 0000000..44b1a14
--- /dev/null
+++ b/Hcs.Client/Client/Api/Registry/Registry32.cs
@@ -0,0 +1,20 @@
+using Hcs.Service.Async.HouseManagement;
+
+namespace Hcs.Client.Api.Registry
+{
+ ///
+ /// НСИ "Часовые зоны по Olson" (реестровый номер 32).
+ /// Взято из https://dom.gosuslugi.ru/opendataapi/nsi-32/v1.
+ ///
+ public static class Registry32
+ {
+ ///
+ /// Иркутск
+ ///
+ public static nsiRef Element11 => new()
+ {
+ Code = "11",
+ GUID = "244ae392-0b96-46f2-80ea-4dac32e7326a"
+ };
+ }
+}
diff --git a/Hcs.Client/Client/Api/Registry/Registry338.cs b/Hcs.Client/Client/Api/Registry/Registry338.cs
new file mode 100644
index 0000000..0e21260
--- /dev/null
+++ b/Hcs.Client/Client/Api/Registry/Registry338.cs
@@ -0,0 +1,74 @@
+using Hcs.Service.Async.HouseManagement;
+
+namespace Hcs.Client.Api.Registry
+{
+ ///
+ /// НСИ "Стадия жизненного цикла" (реестровый номер 338).
+ /// Взято из https://dom.gosuslugi.ru/opendataapi/nsi-338/v1.
+ ///
+ public static class Registry338
+ {
+ ///
+ /// Эксплуатация
+ ///
+ public static nsiRef Element1 => new()
+ {
+ Code = "1",
+ GUID = "29b18683-5195-4ef4-83fc-71bf45597d46"
+ };
+
+ ///
+ /// Реконструкция
+ ///
+ public static nsiRef Element2 => new()
+ {
+ Code = "2",
+ GUID = "75764145-f181-47e5-bff1-1306a46eb20e"
+ };
+
+ ///
+ /// Капитальный ремонт с отселением
+ ///
+ public static nsiRef Element3 => new()
+ {
+ Code = "3",
+ GUID = "dee170df-db42-4cd6-9e5e-b62be91b3663"
+ };
+
+ ///
+ /// Капитальный ремонт без отселения
+ ///
+ public static nsiRef Element4 => new()
+ {
+ Code = "4",
+ GUID = "91dc91e2-6883-4c84-b711-53f57f28dbe2"
+ };
+
+ ///
+ /// Снос
+ ///
+ public static nsiRef Element5 => new()
+ {
+ Code = "5",
+ GUID = "cc358aa9-10b3-4d6a-bbec-c5f6b14950f6"
+ };
+
+ ///
+ /// Не эксплуатируется, расселен
+ ///
+ public static nsiRef Element6 => new()
+ {
+ Code = "6",
+ GUID = "4bed3d7e-6015-428e-b4b4-7b7aec171c0d"
+ };
+
+ ///
+ /// Выведен из эксплуатации
+ ///
+ public static nsiRef Element7 => new()
+ {
+ Code = "7",
+ GUID = "f3edc065-c1a1-4110-96fa-03313ae7a039"
+ };
+ }
+}
diff --git a/Hcs.Client/Client/Api/Request/HouseManagement/ImportHouseUODataRequest.cs b/Hcs.Client/Client/Api/Request/HouseManagement/ImportHouseUODataRequest.cs
new file mode 100644
index 0000000..f616f93
--- /dev/null
+++ b/Hcs.Client/Client/Api/Request/HouseManagement/ImportHouseUODataRequest.cs
@@ -0,0 +1,105 @@
+using Hcs.Client.Api.Payload.HouseManagement;
+using Hcs.Client.Api.Request.Exception;
+using Hcs.Client.Internal;
+using Hcs.Service.Async.HouseManagement;
+using System;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Hcs.Client.Api.Request.HouseManagement
+{
+ internal class ImportHouseUODataRequest(ClientBase client) : HouseManagementRequestBase(client)
+ {
+ protected override bool CanBeRestarted => false;
+
+ internal async Task ExecuteAsync(ImportLivingHouseUODataPayload payload, CancellationToken token)
+ {
+ // TODO: Добавить проверку пейлоада
+
+ // http://open-gkh.ru/HouseManagement/importHouseUORequest.html
+ var request = new importHouseUORequest
+ {
+ Id = Constants.SIGNED_XML_ELEMENT_ID,
+ version = "13.2.3.2",
+ Item = GetLivingHouseFromPayload(payload)
+ };
+
+ var result = await SendAndWaitResultAsync(request, async asyncClient =>
+ {
+ var response = await asyncClient.importHouseUODataAsync(CreateRequestHeader(), request);
+ return response.AckRequest.Ack;
+ }, token);
+
+ result.Items.OfType().ToList().ForEach(error =>
+ {
+ throw RemoteException.CreateNew(error.ErrorCode, error.Description);
+ });
+
+ var importResults = result.Items.OfType();
+ var commonResults = GetCommonResults(importResults);
+ foreach (var commonResult in commonResults)
+ {
+ if (commonResult.ItemElementName == ItemChoiceType26.ImportHouseUO)
+ {
+ return commonResult.Item is OGFImportStatusType;
+ }
+ }
+
+ return false;
+ }
+
+ private importHouseUORequestLivingHouse GetLivingHouseFromPayload(ImportLivingHouseUODataPayload payload)
+ {
+ var livingHouse = new importHouseUORequestLivingHouseLivingHouseToCreate()
+ {
+ TransportGUID = Guid.NewGuid().ToString(),
+ BasicCharacteristicts = new HouseBasicUOType()
+ {
+ FIASHouseGuid = payload.fiasHouseGuid.ToString(),
+ TotalSquare = payload.totalSquare,
+ State = payload.state,
+ LifeCycleStage = payload.lifeCycleStage,
+ UsedYear = payload.usedYear,
+ FloorCount = payload.floorCount,
+ OKTMO = payload.oktmo,
+ OlsonTZ = payload.olsonTZ,
+ CulturalHeritage = payload.culturalHeritage,
+ OGFData = payload.ogfData,
+ // TODO: Разобраться с кадастровым номером
+ Items = [true, payload.conditionalNumber],
+ ItemsElementName = [ItemsChoiceType3.NoCadastralNumber, ItemsChoiceType3.ConditionalNumber]
+ }
+ };
+
+ if (!payload.isMunicipalProperty)
+ {
+ livingHouse.BasicCharacteristicts.IsMunicipalProperty = false;
+ livingHouse.BasicCharacteristicts.IsMunicipalPropertySpecified = true;
+ }
+
+ if (!payload.isRegionProperty)
+ {
+ livingHouse.BasicCharacteristicts.IsRegionProperty = false;
+ livingHouse.BasicCharacteristicts.IsRegionPropertySpecified = true;
+ }
+
+ if (payload.hasBlocks)
+ {
+ livingHouse.HasBlocks = true;
+ livingHouse.HasBlocksSpecified = true;
+ }
+
+ if (payload.hasMultipleHousesWithSameAddress)
+ {
+ livingHouse.HasMultipleHousesWithSameAddress = true;
+ livingHouse.HasMultipleHousesWithSameAddressSpecified = true;
+ }
+
+ return new importHouseUORequestLivingHouse()
+ {
+ Item = livingHouse
+ };
+ }
+ }
+}
diff --git a/Hcs.Client/Hcs.Client.csproj b/Hcs.Client/Hcs.Client.csproj
index 74c3c0b..2084ce6 100644
--- a/Hcs.Client/Hcs.Client.csproj
+++ b/Hcs.Client/Hcs.Client.csproj
@@ -70,11 +70,15 @@
+
+
+
+
@@ -92,6 +96,7 @@
+
diff --git a/Hcs.TestApp/TestApp/Program.cs b/Hcs.TestApp/TestApp/Program.cs
index 74560d7..c6d2283 100644
--- a/Hcs.TestApp/TestApp/Program.cs
+++ b/Hcs.TestApp/TestApp/Program.cs
@@ -50,6 +50,8 @@ namespace Hcs.TestApp
//houseManagementScenario.ImportAccountData();
+ //houseManagementScenario.ImportLivingHouseUOData();
+
//houseManagementScenario.ImportNotificationData();
//houseManagementScenario.ImportSupplyResourceContractData();
diff --git a/Hcs.TestApp/TestApp/Scenario/HouseManagementScenario.cs b/Hcs.TestApp/TestApp/Scenario/HouseManagementScenario.cs
index 4029f5b..4d57e46 100644
--- a/Hcs.TestApp/TestApp/Scenario/HouseManagementScenario.cs
+++ b/Hcs.TestApp/TestApp/Scenario/HouseManagementScenario.cs
@@ -34,6 +34,94 @@ namespace Hcs.TestApp.Scenario
Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed"));
}
+ internal void ImportAccountData()
+ {
+ var payload = new ImportAccountDataPayload()
+ {
+ accountNumber = "385635479641",
+ accountReasons = new AccountReasonsImportType()
+ {
+ SupplyResourceContract =
+ [
+ new()
+ {
+ Items = ["0aca4ebc-8d5c-4a39-801c-e25f0867adc6"],
+ ItemsElementName = [ItemsChoiceType17.ContractGUID]
+ }
+ ]
+ },
+ accountType = ImportAccountDataPayload.AccountType.RC,
+ livingPersonsNumber = 1,
+ totalSquare = 29.3m,
+ residentialSquare = 29.3m,
+ heatedArea = 29.3m,
+ accomodations =
+ [
+ new()
+ {
+ Item = "db041c58-4a14-45ce-8ecc-d99727e9683f",
+ ItemElementName = ItemChoiceType9.FIASHouseGuid
+ }
+ ],
+ payerInfo = new AccountTypePayerInfo()
+ {
+ IsRenter = true,
+ IsRenterSpecified = true,
+ Item = new AccountIndType()
+ {
+ Item = "62392021264",
+ FirstName = "Имя",
+ Surname = "Фамилия",
+ Patronymic = "Отчество"
+ }
+ }
+ };
+ var result = client.HouseManagement.ImportAccountDataAsync(payload).Result;
+ Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
+ }
+
+ internal void ImportLivingHouseUOData()
+ {
+ var payload = new ImportLivingHouseUODataPayload()
+ {
+ fiasHouseGuid = Guid.Parse("db041c58-4a14-45ce-8ecc-d99727e9683f"),
+ totalSquare = 29.3m,
+ state = Registry24.Element2,
+ lifeCycleStage = Registry338.Element1,
+ usedYear = 2000,
+ floorCount = 1,
+ oktmo = new OKTMORefType()
+ {
+ code = "98641101001"
+ },
+ olsonTZ = Registry32.Element11,
+ culturalHeritage = false,
+ isMunicipalProperty = false,
+ isRegionProperty = false,
+ conditionalNumber = "1234567890"
+ };
+ var result = client.HouseManagement.ImportHouseUODataAsync(payload).Result;
+ Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
+ }
+
+ internal void ImportNotificationData()
+ {
+ var payload = new ImportNotificationDataPayload()
+ {
+ topic = "Тема новости",
+ isImportant = true,
+ content = "Содержимое новости",
+ destinations =
+ [
+ new(ItemsChoiceType29.IsAll, true)
+ ],
+ isNotLimit = true,
+ isShipOff = true
+ };
+ var result = client.HouseManagement.ImportNotificationDataAsync(payload).Result;
+ Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
+ }
+
internal void ImportSupplyResourceContractData()
{
var signingDate = new DateTime(2017, 01, 01);
@@ -136,69 +224,5 @@ namespace Hcs.TestApp.Scenario
var result = client.HouseManagement.ImportSupplyResourceContractDataAsync(payload).Result;
Console.WriteLine("Scenario execution " + (result != null ? "succeeded" : "failed"));
}
-
- internal void ImportNotificationData()
- {
- var payload = new ImportNotificationDataPayload()
- {
- topic = "Тема новости",
- isImportant = true,
- content = "Содержимое новости",
- destinations =
- [
- new(ItemsChoiceType29.IsAll, true)
- ],
- isNotLimit = true,
- isShipOff = true
- };
- var result = client.HouseManagement.ImportNotificationDataAsync(payload).Result;
- Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
- }
-
- internal void ImportAccountData()
- {
- var payload = new ImportAccountDataPayload()
- {
- accountNumber = "385635479641",
- accountReasons = new AccountReasonsImportType()
- {
- SupplyResourceContract =
- [
- new()
- {
- Items = ["0aca4ebc-8d5c-4a39-801c-e25f0867adc6"],
- ItemsElementName = [ItemsChoiceType17.ContractGUID]
- }
- ]
- },
- accountType = ImportAccountDataPayload.AccountType.RC,
- livingPersonsNumber = 1,
- totalSquare = 29.3m,
- residentialSquare = 29.3m,
- heatedArea = 29.3m,
- accomodations =
- [
- new()
- {
- Item = "db041c58-4a14-45ce-8ecc-d99727e9683f",
- ItemElementName = ItemChoiceType9.FIASHouseGuid
- }
- ],
- payerInfo = new AccountTypePayerInfo()
- {
- IsRenter = true,
- IsRenterSpecified = true,
- Item = new AccountIndType()
- {
- Item = "62392021264",
- FirstName = "Имя",
- Surname = "Фамилия",
- Patronymic = "Отчество"
- }
- }
- };
- var result = client.HouseManagement.ImportAccountDataAsync(payload).Result;
- Console.WriteLine("Scenario execution " + (result ? "succeeded" : "failed"));
- }
}
}