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
6dc56ee3
authored
Mar 28, 2022
by
Alex Nasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enup attributes added
parent
228c223f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
20 deletions
DDO_Application/Startup.cs
SocialMinistryDataExchange/Controllers/apiController.cs
SocialMinistryDataExchange/Model/ISMRepository.cs
SocialMinistryDataExchange/Model/SMResponce.cs → SocialMinistryDataExchange/Model/SMData.cs
SocialMinistryDataExchange/Model/SMRepository.cs
SocialMinistryDataExchange/Model/SMRequest.cs → SocialMinistryDataExchange/Model/SMRequests.cs
DDO_Application/Startup.cs
View file @
6dc56ee3
...
@@ -25,8 +25,8 @@ namespace DDO_Application {
...
@@ -25,8 +25,8 @@ namespace DDO_Application {
var
ActiveMQ
=
Configuration
.
GetSection
(
"ActiveMQ"
).
Get
<
configActiveMQ
>().
Endpoint
;
var
ActiveMQ
=
Configuration
.
GetSection
(
"ActiveMQ"
).
Get
<
configActiveMQ
>().
Endpoint
;
var
msgQueues
=
Configuration
.
GetSection
(
"TestQueues"
).
Get
<
configTestQueues
>();
var
msgQueues
=
Configuration
.
GetSection
(
"TestQueues"
).
Get
<
configTestQueues
>();
//
string queue2 = "CONTINGENT.APPLICATION_INC";
string
queue2
=
"CONTINGENT.APPLICATION_INC"
;
string
queue2
=
"GMU.APPLICATION_INC"
;
//
string queue2 = "GMU.APPLICATION_INC";
string
queue3
=
"CONTINGENT.MV.REQ"
;
string
queue3
=
"CONTINGENT.MV.REQ"
;
string
queue4
=
"CONTINGENT.MV.RESP"
;
string
queue4
=
"CONTINGENT.MV.RESP"
;
...
...
SocialMinistryDataExchange/Controllers/apiController.cs
View file @
6dc56ee3
...
@@ -14,10 +14,36 @@ namespace SocialMinistryDataExchange.Controllers {
...
@@ -14,10 +14,36 @@ namespace SocialMinistryDataExchange.Controllers {
_repository
=
repository
;
_repository
=
repository
;
}
}
// тестовый запрос зачисленности личности
[
HttpGet
]
[
Route
(
"[controller]/getFixPerson"
)]
public
async
Task
<
SMPersonDataRequest
>
GetFixPerson
()
{
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"
,
PersonFamilyName
=
"Мкртчян"
,
PersonName
=
"Василий"
,
PersonSurname
=
"Алибабаевич"
,
PersonBirthday
=
DateTime
.
Parse
(
"2015-01-01"
),
},
PersonOccupation
=
new
SMPersonOccupationStatus
()
}
}
};
var
result
=
await
_repository
.
GetPersonsOcupation
(
JsonSerializer
.
Serialize
(
msg
));
return
result
;
}
// тестовый запрос с фиксированным документом личности
// тестовый запрос с фиксированным документом личности
[
HttpGet
]
[
HttpGet
]
[
Route
(
"[controller]/getpersonFixDoc"
)]
[
Route
(
"[controller]/getpersonFixDoc"
)]
public
async
Task
<
List
<
SM
Responce
>>
GetPersonFixDoc
()
{
public
async
Task
<
List
<
SM
Data
>>
GetPersonFixDoc
()
{
var
msg
=
new
SMPersonDataRequest
()
{
var
msg
=
new
SMPersonDataRequest
()
{
MsgID
=
"123"
,
MsgID
=
"123"
,
MsgDataTime
=
DateTime
.
Now
,
MsgDataTime
=
DateTime
.
Now
,
...
@@ -53,7 +79,7 @@ namespace SocialMinistryDataExchange.Controllers {
...
@@ -53,7 +79,7 @@ namespace SocialMinistryDataExchange.Controllers {
//[HttpPost]
//[HttpPost]
[
HttpGet
]
[
HttpGet
]
[
Route
(
"[controller]/getpersonByDoc/{Rowguid}/{Seria}/{Number}"
)]
[
Route
(
"[controller]/getpersonByDoc/{Rowguid}/{Seria}/{Number}"
)]
public
async
Task
<
List
<
SM
Responce
>>
GetPersonByDoc
(
string
Rowguid
,
string
Seria
,
string
Number
)
{
public
async
Task
<
List
<
SM
Data
>>
GetPersonByDoc
(
string
Rowguid
,
string
Seria
,
string
Number
)
{
var
result
=
await
_repository
.
GetPersonByDoc
(
JsonSerializer
.
Serialize
(
new
SMPersonRequest
()
{
rowguid_eais
=
Rowguid
,
document_seria
=
Seria
,
document_number
=
Number
}));
var
result
=
await
_repository
.
GetPersonByDoc
(
JsonSerializer
.
Serialize
(
new
SMPersonRequest
()
{
rowguid_eais
=
Rowguid
,
document_seria
=
Seria
,
document_number
=
Number
}));
return
result
;
return
result
;
}
}
...
...
SocialMinistryDataExchange/Model/ISMRepository.cs
View file @
6dc56ee3
...
@@ -3,7 +3,9 @@ using System.Threading.Tasks;
...
@@ -3,7 +3,9 @@ using System.Threading.Tasks;
namespace
SocialMinistryDataExchange.Model
{
namespace
SocialMinistryDataExchange.Model
{
public
interface
ISMRepository
{
public
interface
ISMRepository
{
Task
<
List
<
SM
Responce
>>
GetPersonByDoc
(
string
Document
);
Task
<
List
<
SM
Data
>>
GetPersonByDoc
(
string
Document
);
Task
<
SMDefenceDemandResponce
>
GetPersonDefenceDemandByID
(
string
PersonID
);
Task
<
SMDefenceDemandResponce
>
GetPersonDefenceDemandByID
(
string
PersonID
);
Task
<
SMPersonDataRequest
>
GetPersonsOcupation
(
string
OcupationRequest
);
}
}
}
}
SocialMinistryDataExchange/Model/SM
Responce
.cs
→
SocialMinistryDataExchange/Model/SM
Data
.cs
View file @
6dc56ee3
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
namespace
SocialMinistryDataExchange.Model
{
namespace
SocialMinistryDataExchange.Model
{
public
class
SM
Responce
{
public
class
SM
Data
{
public
SM
Responce
()
{
}
public
SM
Data
()
{
}
public
string
rowguid_eais
{
get
;
set
;
}
public
string
rowguid_eais
{
get
;
set
;
}
public
string
TerritoryName
{
get
;
set
;
}
public
string
TerritoryName
{
get
;
set
;
}
public
string
PersonFamilyName
{
get
;
set
;
}
public
string
PersonFamilyName
{
get
;
set
;
}
...
@@ -24,12 +24,26 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -24,12 +24,26 @@ namespace SocialMinistryDataExchange.Model {
public
string
EducationForm
{
get
;
set
;
}
public
string
EducationForm
{
get
;
set
;
}
}
}
[
Flags
]
enum
PersonSearchAttributes
:
byte
{
PersonDocumentSeria
=
1
,
PersonDocumentNumber
=
2
,
PersonFamilyName
=
4
,
PersonName
=
8
,
PersonBirthday
=
16
,
}
public
class
SMPersonRequest
{
public
string
rowguid_eais
{
get
;
set
;
}
public
string
document_seria
{
get
;
set
;
}
public
string
document_number
{
get
;
set
;
}
}
public
class
SMPersonDataResponce
{
public
class
SMPersonDataResponce
{
public
string
MsgID
{
get
;
set
;
}
public
string
MsgID
{
get
;
set
;
}
public
Person
[]
MsgData
{
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/SMRepository.cs
View file @
6dc56ee3
...
@@ -17,6 +17,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -17,6 +17,7 @@ namespace SocialMinistryDataExchange.Model {
_logger
=
logger
;
_logger
=
logger
;
}
}
// возвращает статус нуждаемости личности
public
Task
<
SMDefenceDemandResponce
>
GetPersonDefenceDemandByID
(
string
PersonID
)
{
public
Task
<
SMDefenceDemandResponce
>
GetPersonDefenceDemandByID
(
string
PersonID
)
{
var
status
=
(
from
st
in
_contingentContext
.
СтатусыНуждаемости
s
var
status
=
(
from
st
in
_contingentContext
.
СтатусыНуждаемости
s
where
st
.
Личность
==
new
Guid
(
PersonID
)
where
st
.
Личность
==
new
Guid
(
PersonID
)
...
@@ -26,10 +27,45 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -26,10 +27,45 @@ namespace SocialMinistryDataExchange.Model {
return
Task
.
FromResult
(
status
);
return
Task
.
FromResult
(
status
);
}
}
public
Task
<
List
<
SMResponce
>>
GetPersonByDoc
(
string
document
)
{
//
public
Task
<
SMPersonDataRequest
>
GetPersonsOcupation
(
string
OcupationRequest
)
{
SMPersonDataRequest
Responce
=
new
();
try
{
var
Request
=
JsonSerializer
.
Deserialize
<
SMPersonDataRequest
>(
OcupationRequest
);
Responce
.
MsgID
=
Request
.
MsgID
;
Responce
.
MsgDataTime
=
DateTime
.
Now
;
Responce
.
MsgData
=
Request
.
MsgData
;
foreach
(
var
Person
in
Request
.
MsgData
)
{
var
x
=
0
;
foreach
(
var
psa
in
Enum
.
GetValues
(
typeof
(
PersonSearchAttributes
)))
{
x
=
Person
.
Person
.
GetType
().
GetProperty
(
psa
.
ToString
()).
GetValue
(
Person
.
Person
)
is
null
?
x
:
(
x
|
(
byte
)
psa
);
}
var
z
=
(
PersonSearchAttributes
)
x
;
if
(
x
<
Enum
.
GetValues
(
typeof
(
PersonSearchAttributes
)).
Cast
<
byte
>().
Sum
(
s
=>
s
))
{
Person
.
Person
.
Error
=
$"Parameters: [
{(
PersonSearchAttributes
)(
31
-
z
)}
] can't be null"
;
_logger
.
Error
(
$"MsgID '
{{
@MsgID
}}
':
{{
@Error
}}
;"
,
Responce
.
MsgID
,
Person
.
Person
.
Error
);
}
else
{
// SearchPerson();
}
}
}
catch
(
Exception
ex
)
{
_logger
.
Error
(
$"
{
ex
.
TargetSite
.
Name
}
;
{
ex
.
Message
}
;"
);
}
return
Task
.
FromResult
(
Responce
);
}
private
void
SearchPerson
(
Person
person
)
{
}
public
Task
<
List
<
SMData
>>
GetPersonByDoc
(
string
document
)
{
var
docs
=
JsonSerializer
.
Deserialize
<
SMPersonDataRequest
>(
document
);
var
docs
=
JsonSerializer
.
Deserialize
<
SMPersonDataRequest
>(
document
);
List
<
SM
Responce
>
responce
=
new
();
List
<
SM
Data
>
responce
=
new
();
SM
Responce
responce_record
;
SM
Data
responce_record
;
foreach
(
var
doc
in
docs
.
MsgData
)
{
foreach
(
var
doc
in
docs
.
MsgData
)
{
try
{
try
{
// TODO separate exceptions
// TODO separate exceptions
...
@@ -37,7 +73,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -37,7 +73,7 @@ namespace SocialMinistryDataExchange.Model {
throw
new
ArgumentNullException
(
$"
{
nameof
(
doc
.
Person
)}
"
);
throw
new
ArgumentNullException
(
$"
{
nameof
(
doc
.
Person
)}
"
);
}
}
responce_record
=
new
SM
Responce
();
responce_record
=
new
SM
Data
();
var
record
=
(
from
pd
in
_contingentContext
.
ДокументЛичности
s
var
record
=
(
from
pd
in
_contingentContext
.
ДокументЛичности
s
where
pd
.
СерияДокумента
==
doc
.
Person
.
PersonDocumentSeria
&&
pd
.
НомерДокумента
==
doc
.
Person
.
PersonDocumentNumber
where
pd
.
СерияДокумента
==
doc
.
Person
.
PersonDocumentSeria
&&
pd
.
НомерДокумента
==
doc
.
Person
.
PersonDocumentNumber
...
@@ -108,8 +144,8 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -108,8 +144,8 @@ namespace SocialMinistryDataExchange.Model {
}
}
private
static
SM
Responce
FormatResponce
(
IContingentContext
context
,
SMResponceTemp
record
)
{
private
static
SM
Data
FormatResponce
(
IContingentContext
context
,
SMResponceTemp
record
)
{
SM
Responce
responce
=
new
();
SM
Data
responce
=
new
();
if
(
record
.
Личность
!=
Guid
.
Empty
)
{
// записи найдены
if
(
record
.
Личность
!=
Guid
.
Empty
)
{
// записи найдены
responce
.
rowguid_eais
=
record
.
rowguid_eais
;
responce
.
rowguid_eais
=
record
.
rowguid_eais
;
responce
.
TerritoryName
=
record
.
Территория
Shortname
;
responce
.
TerritoryName
=
record
.
Территория
Shortname
;
...
...
SocialMinistryDataExchange/Model/SMRequest.cs
→
SocialMinistryDataExchange/Model/SMRequest
s
.cs
View file @
6dc56ee3
using
System
;
using
System
;
namespace
SocialMinistryDataExchange.Model
{
namespace
SocialMinistryDataExchange.Model
{
public
class
SMPersonRequest
{
public
string
rowguid_eais
{
get
;
set
;
}
public
string
document_seria
{
get
;
set
;
}
public
string
document_number
{
get
;
set
;
}
}
// формат обмена данными о зачислении лица в учереждения образования (двусторонний)
// формат обмена данными о зачислении лица в учереждения образования (двусторонний)
public
class
SMPersonDataRequest
{
public
class
SMPersonDataRequest
{
public
string
MsgID
{
get
;
set
;
}
public
string
MsgID
{
get
;
set
;
}
...
...
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