Commit 6dc56ee3 by Alex Nasyr

enup attributes added

parent 228c223f
......@@ -25,8 +25,8 @@ namespace DDO_Application {
var ActiveMQ = Configuration.GetSection("ActiveMQ").Get<configActiveMQ>().Endpoint;
var msgQueues = Configuration.GetSection("TestQueues").Get<configTestQueues>();
//string queue2 = "CONTINGENT.APPLICATION_INC";
string queue2 = "GMU.APPLICATION_INC";
string queue2 = "CONTINGENT.APPLICATION_INC";
//string queue2 = "GMU.APPLICATION_INC";
string queue3 = "CONTINGENT.MV.REQ";
string queue4 = "CONTINGENT.MV.RESP";
......
......@@ -14,10 +14,36 @@ namespace SocialMinistryDataExchange.Controllers {
_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]
[Route("[controller]/getpersonFixDoc")]
public async Task<List<SMResponce>> GetPersonFixDoc() {
public async Task<List<SMData>> GetPersonFixDoc() {
var msg = new SMPersonDataRequest() {
MsgID = "123",
MsgDataTime = DateTime.Now,
......@@ -53,7 +79,7 @@ namespace SocialMinistryDataExchange.Controllers {
//[HttpPost]
[HttpGet]
[Route("[controller]/getpersonByDoc/{Rowguid}/{Seria}/{Number}")]
public async Task<List<SMResponce>> GetPersonByDoc(string Rowguid, string Seria, string Number) {
public async Task<List<SMData>> 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 }));
return result;
}
......
......@@ -3,7 +3,9 @@ using System.Threading.Tasks;
namespace SocialMinistryDataExchange.Model {
public interface ISMRepository {
Task<List<SMResponce>> GetPersonByDoc(string Document);
Task<List<SMData>> GetPersonByDoc(string Document);
Task<SMDefenceDemandResponce> GetPersonDefenceDemandByID(string PersonID);
Task<SMPersonDataRequest> GetPersonsOcupation(string OcupationRequest);
}
}
......@@ -2,8 +2,8 @@
namespace SocialMinistryDataExchange.Model {
public class SMResponce {
public SMResponce() { }
public class SMData {
public SMData() { }
public string rowguid_eais { get; set; }
public string TerritoryName { get; set; }
public string PersonFamilyName { get; set; }
......@@ -24,12 +24,26 @@ namespace SocialMinistryDataExchange.Model {
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 string MsgID { get; set; }
public Person[] MsgData { get; set; }
}
public class SMResponceTemp {
public string rowguid_eais { get; set; }
......
......@@ -17,6 +17,7 @@ namespace SocialMinistryDataExchange.Model {
_logger = logger;
}
// возвращает статус нуждаемости личности
public Task<SMDefenceDemandResponce> GetPersonDefenceDemandByID(string PersonID) {
var status = (from st in _contingentContext.СтатусыНуждаемостиs
where st.Личность == new Guid(PersonID)
......@@ -26,10 +27,45 @@ namespace SocialMinistryDataExchange.Model {
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);
List<SMResponce> responce = new();
SMResponce responce_record;
List<SMData> responce = new();
SMData responce_record;
foreach (var doc in docs.MsgData) {
try {
// TODO separate exceptions
......@@ -37,7 +73,7 @@ namespace SocialMinistryDataExchange.Model {
throw new ArgumentNullException($"{nameof(doc.Person)}");
}
responce_record = new SMResponce();
responce_record = new SMData();
var record = (from pd in _contingentContext.ДокументЛичностиs
where pd.СерияДокумента == doc.Person.PersonDocumentSeria && pd.НомерДокумента == doc.Person.PersonDocumentNumber
......@@ -108,8 +144,8 @@ namespace SocialMinistryDataExchange.Model {
}
private static SMResponce FormatResponce(IContingentContext context, SMResponceTemp record) {
SMResponce responce = new();
private static SMData FormatResponce(IContingentContext context, SMResponceTemp record) {
SMData responce = new();
if (record.Личность != Guid.Empty) { // записи найдены
responce.rowguid_eais = record.rowguid_eais;
responce.TerritoryName = record.ТерриторияShortname;
......
using System;
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 {
......
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