Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Marat Pavlov
/
AlexAdapter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b28ec718
authored
Mar 25, 2022
by
AlexNasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jsons updated
parent
fc5ed2c5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
143 additions
and
77 deletions
SocialMinistryDataExchange/Controllers/apiController.cs
SocialMinistryDataExchange/Model/SMRepository.cs
SocialMinistryDataExchange/Model/SMRequest.cs
SocialMinistryDataExchange/Model/SMResponce.cs
SocialMinistryDataExchange/Model/reference/SM_PersoneOccupation.json
SocialMinistryDataExchange/Model/reference/SM_RerquestAddPersonData.json
SocialMinistryDataExchange/Model/reference/SM_SocialDefence.json
SocialMinistryDataExchange/Controllers/apiController.cs
View file @
b28ec718
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
();
}
}
// запрос по серии/номеру документа личности
// запрос по серии/номеру документа личности
...
...
SocialMinistryDataExchange/Model/SMRepository.cs
View file @
b28ec718
...
@@ -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_n
umber
,
КогдаВыданДокумент
=
pd
.
КогдаВыданДокумент
,
ВидУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
,
НаименованиеУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
Navigation
.
Наименование
,
КодУдостоверяющегоДокумента
=
pd
.
ВидУдостоверяющегоДокумента
Navigation
.
Код
,
СерияДокумента
=
doc
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
doc
.
Person
.
PersonDocumentN
umber
,
КогдаВыданДокумент
=
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_n
umber
});
responce_record
=
FormatResponce
(
_contingentContext
,
new
SMResponceTemp
()
{
rowguid_eais
=
doc
.
Person
.
rowguid_eais
,
СерияДокумента
=
doc
.
Person
.
PersonDocumentSeria
,
НомерДокумента
=
doc
.
Person
.
PersonDocumentN
umber
});
}
}
responce
.
Add
(
responce_record
);
responce
.
Add
(
responce_record
);
}
}
...
...
SocialMinistryDataExchange/Model/SMRequest.cs
View file @
b28ec718
...
@@ -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
SMPerson
New
DataRequest
{
public
class
SMPerson
SocialDefence
DataRequest
{
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
;
}
...
...
SocialMinistryDataExchange/Model/SMResponce.cs
View file @
b28ec718
...
@@ -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
;
}
...
...
SocialMinistryDataExchange/Model/reference/SM_PersoneOccupation.json
0 → 100644
View file @
b28ec718
{
"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
SocialMinistryDataExchange/Model/reference/SM_RerquestAddPersonData.json
deleted
100644 → 0
View file @
fc5ed2c5
{
"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
SocialMinistryDataExchange/Model/reference/SM_SocialDefence.json
0 → 100644
View file @
b28ec718
{
"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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment