Commit b28ec718 by AlexNasyr

jsons updated

parent fc5ed2c5
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SocialMinistryDataExchange.Model; using SocialMinistryDataExchange.Model;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -16,15 +17,26 @@ namespace SocialMinistryDataExchange.Controllers { ...@@ -16,15 +17,26 @@ namespace SocialMinistryDataExchange.Controllers {
[HttpGet] [HttpGet]
[Route("[controller]/getpersonFixDoc")] [Route("[controller]/getpersonFixDoc")]
public async Task<List<SMResponce>> GetPersonFixDoc() { public async Task<List<SMResponce>> GetPersonFixDoc() {
var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new List<SMPersonRequest>() { new SMPersonRequest() { rowguid_eais = "223322", document_seria = "V-II", document_number = "123456" } })); var msg = new SMPersonDataRequest() {
MsgID = "123",
MsgDataTime = DateTime.Now,
MsgData = new SMPersonDataOccupationMessage[] { new SMPersonDataOccupationMessage() { Person = new Person() { rowguid_eais = "223322", PersonDocumentSeria = "V-II", PersonDocumentNumber = "123456" }, PersonOccupation = new SMPersonOccupation(), Error = "" } }
};
var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(msg));
//var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new List<SMPersonRequest>() { new SMPersonRequest() { rowguid_eais = "223322", document_seria = "V-II", document_number = "123456" }, new SMPersonRequest() { rowguid_eais = "322223", document_seria = "1234", document_number = "123456" } })); //var result = await _repository.GetPersonByDoc(JsonSerializer.Serialize(new List<SMPersonRequest>() { new SMPersonRequest() { rowguid_eais = "223322", document_seria = "V-II", document_number = "123456" }, new SMPersonRequest() { rowguid_eais = "322223", document_seria = "1234", document_number = "123456" } }));
return result; return result;
} }
// тестовый запрос для получения json формата // тестовый запрос для получения json формата для данных о личности (нуждаемость)
[HttpGet] [HttpGet]
[Route("[controller]/getSMPersonNewDataRequest")] [Route("[controller]/getSMPersonSocialDefenceDataRequest")]
public async Task<SMPersonNewDataRequest> GetSMPersonNewDataRequest() { public async Task<SMPersonSocialDefenceDataRequest> GetSMPersonSocialDefenceDataRequest() {
return new SMPersonNewDataRequest(); return new SMPersonSocialDefenceDataRequest();
}
// тестовый запрос для получения json формата для данных о личности (где учится)
[HttpGet]
[Route("[controller]/getSMPersonOccupationDataRequest")]
public async Task<SMPersonDataRequest> GetSMPersonOccupationDataRequest() {
return new SMPersonDataRequest();
} }
// запрос по серии/номеру документа личности // запрос по серии/номеру документа личности
......
...@@ -22,13 +22,15 @@ namespace SocialMinistryDataExchange.Model { ...@@ -22,13 +22,15 @@ namespace SocialMinistryDataExchange.Model {
} }
public Task<List<SMResponce>> GetPersonByDoc(string document) { public Task<List<SMResponce>> GetPersonByDoc(string document) {
var docs = JsonSerializer.Deserialize<List<SMPersonRequest>>(document); var docs = JsonSerializer.Deserialize<SMPersonDataRequest>(document);
List <SMResponce> responce = new(); List<SMResponce> responce = new();
foreach (SMPersonRequest doc in docs) { foreach (var doc in docs.MsgData) {
SMResponce responce_record = new SMResponce(); SMResponce responce_record = new SMResponce();
try { try {
var record = (from pd in _contingentContext.ДокументЛичностиs var record = (from pd in _contingentContext.ДокументЛичностиs
where pd.СерияДокумента == doc.document_seria && pd.НомерДокумента == doc.document_number where pd.СерияДокумента == doc.Person.PersonDocumentSeria && pd.НомерДокумента == doc.Person.PersonDocumentNumber
&& pd.ЛичностьNavigation.Фамилия == doc.Person.PersonFamilyName && pd.ЛичностьNavigation.Имя == doc.Person.PersonName
&& (pd.ЛичностьNavigation.БезОтчества == false & pd.ЛичностьNavigation.Отчество == doc.Person.PersonSurname) && pd.ЛичностьNavigation.ДатаРождения == doc.Person.PersonBirthday
join lp in _contingentContext.ЛичностьПодразделенияs on pd.Личность equals lp.Личность into lps join lp in _contingentContext.ЛичностьПодразделенияs on pd.Личность equals lp.Личность into lps
from lp in lps.DefaultIfEmpty() from lp in lps.DefaultIfEmpty()
join op in _contingentContext.ОбразовательнаяПрограммаОрганизацииs on lp.Организация equals op.Организация into ops join op in _contingentContext.ОбразовательнаяПрограммаОрганизацииs on lp.Организация equals op.Организация into ops
...@@ -37,9 +39,9 @@ namespace SocialMinistryDataExchange.Model { ...@@ -37,9 +39,9 @@ namespace SocialMinistryDataExchange.Model {
from cp in cps.DefaultIfEmpty() from cp in cps.DefaultIfEmpty()
orderby lp.НачальнаяДата descending orderby lp.НачальнаяДата descending
select new SMResponceTemp { select new SMResponceTemp {
rowguid_eais = doc.rowguid_eais rowguid_eais = doc.Person.rowguid_eais
// СерияДокумента, НомерДокумента, КогдаВыданДокумент, ВидУдостоверяющегоДокумента, НаименованиеУдостоверяющегоДокумента, КодУдостоверяющегоДокумента // СерияДокумента, НомерДокумента, КогдаВыданДокумент, ВидУдостоверяющегоДокумента, НаименованиеУдостоверяющегоДокумента, КодУдостоверяющегоДокумента
, СерияДокумента = doc.document_seria, НомерДокумента = doc.document_number, КогдаВыданДокумент = pd.КогдаВыданДокумент, ВидУдостоверяющегоДокумента = pd.ВидУдостоверяющегоДокумента, НаименованиеУдостоверяющегоДокумента = pd.ВидУдостоверяющегоДокументаNavigation.Наименование, КодУдостоверяющегоДокумента = pd.ВидУдостоверяющегоДокументаNavigation.Код , СерияДокумента = doc.Person.PersonDocumentSeria, НомерДокумента = doc.Person.PersonDocumentNumber, КогдаВыданДокумент = pd.КогдаВыданДокумент, ВидУдостоверяющегоДокумента = pd.ВидУдостоверяющегоДокумента, НаименованиеУдостоверяющегоДокумента = pd.ВидУдостоверяющегоДокументаNavigation.Наименование, КодУдостоверяющегоДокумента = pd.ВидУдостоверяющегоДокументаNavigation.Код
// Личность (Guid), Имя, Отчество, БезОтчества, Фамилия // Личность (Guid), Имя, Отчество, БезОтчества, Фамилия
, Личность = pd.Личность, Имя = pd.ЛичностьNavigation.Имя, Отчество = pd.ЛичностьNavigation.Отчество, БезОтчества = pd.ЛичностьNavigation.БезОтчества, Фамилия = pd.ЛичностьNavigation.Фамилия , Личность = pd.Личность, Имя = pd.ЛичностьNavigation.Имя, Отчество = pd.ЛичностьNavigation.Отчество, БезОтчества = pd.ЛичностьNavigation.БезОтчества, Фамилия = pd.ЛичностьNavigation.Фамилия
// ДатаРождения, ТерриторияФактическогоМестаЖительстваNew (нигде не заполнено - null), Снилс // ДатаРождения, ТерриторияФактическогоМестаЖительстваNew (нигде не заполнено - null), Снилс
...@@ -59,14 +61,15 @@ namespace SocialMinistryDataExchange.Model { ...@@ -59,14 +61,15 @@ namespace SocialMinistryDataExchange.Model {
}).First(); }).First();
// записи не найдены // записи не найдены
if (record == null) { if (record == null) {
record = new SMResponceTemp() { rowguid_eais = doc.rowguid_eais, СерияДокумента = doc.document_seria, НомерДокумента = doc.document_number };
record = new SMResponceTemp() { rowguid_eais = doc.Person.rowguid_eais, СерияДокумента = doc.Person.PersonDocumentSeria, НомерДокумента = doc.Person.PersonDocumentNumber };
} }
responce_record = FormatResponce(_contingentContext, record); responce_record = FormatResponce(_contingentContext, record);
} }
catch (Exception ex) { catch (Exception ex) {
// TODO log exception // TODO log exception
responce_record = FormatResponce(_contingentContext, new SMResponceTemp() { rowguid_eais = doc.rowguid_eais, СерияДокумента = doc.document_seria, НомерДокумента = doc.document_number }); responce_record = FormatResponce(_contingentContext, new SMResponceTemp() { rowguid_eais = doc.Person.rowguid_eais, СерияДокумента = doc.Person.PersonDocumentSeria, НомерДокумента = doc.Person.PersonDocumentNumber });
} }
responce.Add(responce_record); responce.Add(responce_record);
} }
......
...@@ -7,8 +7,28 @@ namespace SocialMinistryDataExchange.Model { ...@@ -7,8 +7,28 @@ namespace SocialMinistryDataExchange.Model {
public string document_number { get; set; } public string document_number { get; set; }
} }
public class SMPersonDataRequest {
public string MsgID { get; set; }
public DateTime MsgDataTime { get; set; }
public string? MsgPriority { get; set; }
public SMPersonDataOccupationMessage[] MsgData { get; set; }
}
public class SMPersonDataOccupationMessage {
public Person Person { get; set; }
public SMPersonOccupation PersonOccupation { get; set; }
public string? Error { get; set; }
}
public class SMPersonOccupation {
public string Status { get; set; }
public DateTime? StatusDate { get; set; }
public string FounderType { get; set; }
public string OrganizationType { get; set; }
public string EducationProgram { get; set; }
public string EducationForm { get; set; }
}
public class SMPersonNewDataRequest { public class SMPersonSocialDefenceDataRequest {
public string MsgID { get; set; } public string MsgID { get; set; }
public DateTime MsgDataTime { get; set; } public DateTime MsgDataTime { get; set; }
public string? MsgPriority { get; set; } public string? MsgPriority { get; set; }
......
...@@ -24,6 +24,12 @@ namespace SocialMinistryDataExchange.Model { ...@@ -24,6 +24,12 @@ namespace SocialMinistryDataExchange.Model {
public string EducationForm { get; set; } public string EducationForm { get; set; }
} }
public class SMPersonDataResponce {
public string MsgID { get; set; }
public Person[] MsgData { get; set; }
}
public class SMResponceTemp { public class SMResponceTemp {
public string rowguid_eais { get; set; } public string rowguid_eais { get; set; }
......
{
"msgID": "string",
"msgDataTime": "2022-03-25T11:30:08.118Z",
"msgPriority": "string",
"msgData": [
{
"person": {
"rowguid_eais": "string",
"rowguid_contingent": "string",
"personFamilyName": "string",
"personName": "string",
"personSurname": "string",
"personBirthday": "2022-03-25T11:30:08.118Z",
"personDocumentType": 0,
"personDocumentSeria": "string",
"personDocumentNumber": "string",
"personDocumentDate": "2022-03-25T11:30:08.118Z",
"personSnils": "string",
"personAddress": "string",
"dependentPerson": "string",
"dependenceType": "string",
"territory": "string"
},
"personOccupation": {
"status": "string",
"statusDate": "2022-03-25T11:30:08.118Z",
"founderType": "string",
"organizationType": "string",
"educationProgram": "string",
"educationForm": "string"
},
"error": "string"
}
]
}
\ No newline at end of file
{
"msgID": "111222333",
"msgDataTime": "2022-03-25",
"msgPriority": "force",
"person": {
"rowguid_eais": "223322",
"rowguid_contingent": "11111111-2222-3333-4444-555555555555",
"personFamilyName": "Мкртчян",
"personName": "Василий",
"personSurname": "Алибабаевич",
"personBirthday": "2015-01-01",
"personDocumentType": "2",
"personDocumentSeria": "V-II",
"personDocumentNumber": "123456",
"personDocumentDate": "2010-01-01",
"personSnils": null,
"personAddress": null,
"dependentPerson": null,
"dependenceType": null
},
"personStatus": "2",
"personStatusStartDate": "2021-12-01",
"personStatusEndDate": "2022-12-01",
"relatives": [
{
"rowguid_eais": "223223",
"rowguid_contingent": "22221111-2222-3333-4444-555555555555",
"personFamilyName": "Кац",
"personName": "Роза",
"personSurname": "Изевна",
"personBirthday": "1950-02-02",
"personDocumentType": "1",
"personDocumentSeria": "5517",
"personDocumentNumber": "654322",
"personDocumentDate": "2012-02-01",
"personSnils": "120000098",
"personAddress": null,
"dependentPerson": "11111111-2222-3333-4444-555555555555",
"dependenceType": "Мать"
},
{
"rowguid_eais": "223223",
"rowguid_contingent": null,
"personFamilyName": "Мкртчян",
"personName": "Алибаба",
"personSurname": null,
"personBirthday": "1950-03-02",
"personDocumentType": "1",
"personDocumentSeria": "5518",
"personDocumentNumber": "654321",
"personDocumentDate": "2012-03-01",
"personSnils": "120000089",
"personAddress": null,
"dependentPerson": "11111111-2222-3333-4444-555555555555",
"dependenceType": "Отец"
}
],
"familyPersonsCount": 3,
"avgIncome": 4445.00,
"minIncome": 4444.99,
"territory": "Гадюкино"
}
\ No newline at end of file
{
"msgID": "string",
"msgDataTime": "2022-03-25T11:30:08.105Z",
"msgPriority": "string",
"msgData": {
"person": {
"rowguid_eais": "string",
"rowguid_contingent": "string",
"personFamilyName": "string",
"personName": "string",
"personSurname": "string",
"personBirthday": "2022-03-25T11:30:08.106Z",
"personDocumentType": 0,
"personDocumentSeria": "string",
"personDocumentNumber": "string",
"personDocumentDate": "2022-03-25T11:30:08.106Z",
"personSnils": "string",
"personAddress": "string",
"dependentPerson": "string",
"dependenceType": "string",
"territory": "string"
},
"personStatus": {
"status": 0,
"personStatusStartDate": "2022-03-25T11:30:08.106Z",
"personStatusEndDate": "2022-03-25T11:30:08.106Z",
"familyPersonsCount": 0,
"avgIncome": 0,
"minIncome": 0
},
"relatives": [
{
"rowguid_eais": "string",
"rowguid_contingent": "string",
"personFamilyName": "string",
"personName": "string",
"personSurname": "string",
"personBirthday": "2022-03-25T11:30:08.106Z",
"personDocumentType": 0,
"personDocumentSeria": "string",
"personDocumentNumber": "string",
"personDocumentDate": "2022-03-25T11:30:08.106Z",
"personSnils": "string",
"personAddress": "string",
"dependentPerson": "string",
"dependenceType": "string",
"territory": "string"
}
]
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment