no message
This commit is contained in:
parent
e47eca3235
commit
877e7f19c9
4 changed files with 693 additions and 573 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
|
||||
|
|
@ -5500,6 +5501,44 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แสดงประวัติการออกคำสั่ง
|
||||
/// </summary>
|
||||
/// <param name="type">ประเภทระบบคำสั่ง</param>
|
||||
/// <param name="profileId">Id ผู้ใช้งาน</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("historanfaskfa")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> DumpDB([FromHeader] string authorization)
|
||||
{
|
||||
try
|
||||
{
|
||||
var token = string.Empty;
|
||||
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
||||
{
|
||||
// we have a valid AuthenticationHeaderValue that has the following details:
|
||||
|
||||
var scheme = headerValue.Scheme;
|
||||
token = headerValue.Parameter;
|
||||
|
||||
// scheme will be "Bearer"
|
||||
// parmameter will be the token itself.
|
||||
}
|
||||
await _repository.DumpDB(token);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
"DefaultConnection": "server=192.168.1.61;user=root;password=adminVM123;port=4061;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
|
|
|
|||
|
|
@ -887,71 +887,143 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
// if (old_retire != null)
|
||||
// num = old_retire.Order + 1;
|
||||
|
||||
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.ProfileId}";
|
||||
using (var client = new HttpClient())
|
||||
if (retire.Type == "OFFICER")
|
||||
{
|
||||
var data = new RetirementProfile
|
||||
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.ProfileId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
Order = num,
|
||||
Remove = "ADD",
|
||||
RetirementPeriod = retire,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
var data = new RetirementProfile
|
||||
{
|
||||
Order = num,
|
||||
Remove = "ADD",
|
||||
RetirementPeriod = retire,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
if (org == null || org.result == null)
|
||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||
if (org == null || org.result == null)
|
||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||
|
||||
data.profileId = org.result.profileId;
|
||||
data.prefix = org.result.prefix;
|
||||
data.firstName = org.result.firstName;
|
||||
data.lastName = org.result.lastName;
|
||||
data.citizenId = org.result.citizenId;
|
||||
data.root = org.result.root;
|
||||
data.rootId = org.result.rootId;
|
||||
data.rootShortName = org.result.rootShortName;
|
||||
data.child1 = org.result.child1;
|
||||
data.child1Id = org.result.child1Id;
|
||||
data.child1ShortName = org.result.child1ShortName;
|
||||
data.child2 = org.result.child2;
|
||||
data.child2Id = org.result.child2Id;
|
||||
data.child2ShortName = org.result.child2ShortName;
|
||||
data.child3 = org.result.child3;
|
||||
data.child3Id = org.result.child3Id;
|
||||
data.child3ShortName = org.result.child3ShortName;
|
||||
data.child4 = org.result.child4;
|
||||
data.child4Id = org.result.child4Id;
|
||||
data.child4ShortName = org.result.child4ShortName;
|
||||
data.posMasterNo = org.result.posMasterNo;
|
||||
data.position = org.result.position;
|
||||
data.posTypeId = org.result.posTypeId;
|
||||
data.posTypeName = org.result.posTypeName;
|
||||
data.posTypeRank = org.result.posTypeRank;
|
||||
data.posLevelId = org.result.posLevelId;
|
||||
data.posLevelName = org.result.posLevelName;
|
||||
data.posLevelRank = org.result.posLevelRank;
|
||||
data.posExecutiveId = org.result.posExecutiveId;
|
||||
data.posExecutiveName = org.result.posExecutiveName;
|
||||
data.posNo = org.result.posNo;
|
||||
data.profileId = org.result.profileId;
|
||||
data.prefix = org.result.prefix;
|
||||
data.firstName = org.result.firstName;
|
||||
data.lastName = org.result.lastName;
|
||||
data.citizenId = org.result.citizenId;
|
||||
data.root = org.result.root;
|
||||
data.rootId = org.result.rootId;
|
||||
data.rootShortName = org.result.rootShortName;
|
||||
data.child1 = org.result.child1;
|
||||
data.child1Id = org.result.child1Id;
|
||||
data.child1ShortName = org.result.child1ShortName;
|
||||
data.child2 = org.result.child2;
|
||||
data.child2Id = org.result.child2Id;
|
||||
data.child2ShortName = org.result.child2ShortName;
|
||||
data.child3 = org.result.child3;
|
||||
data.child3Id = org.result.child3Id;
|
||||
data.child3ShortName = org.result.child3ShortName;
|
||||
data.child4 = org.result.child4;
|
||||
data.child4Id = org.result.child4Id;
|
||||
data.child4ShortName = org.result.child4ShortName;
|
||||
data.posMasterNo = org.result.posMasterNo;
|
||||
data.position = org.result.position;
|
||||
data.posTypeId = org.result.posTypeId;
|
||||
data.posTypeName = org.result.posTypeName;
|
||||
data.posTypeRank = org.result.posTypeRank;
|
||||
data.posLevelId = org.result.posLevelId;
|
||||
data.posLevelName = org.result.posLevelName;
|
||||
data.posLevelRank = org.result.posLevelRank;
|
||||
data.posExecutiveId = org.result.posExecutiveId;
|
||||
data.posExecutiveName = org.result.posExecutiveName;
|
||||
data.posNo = org.result.posNo;
|
||||
|
||||
_context.RetirementProfiles.Add(data);
|
||||
await _context.SaveChangesAsync();
|
||||
if (retire.RetirementPeriodHistorys.Count() == 0)
|
||||
{
|
||||
await GenOrderByYear(retire.Id);
|
||||
_context.RetirementProfiles.Add(data);
|
||||
await _context.SaveChangesAsync();
|
||||
if (retire.RetirementPeriodHistorys.Count() == 0)
|
||||
{
|
||||
await GenOrderByYear(retire.Id);
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.ProfileId}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var data = new RetirementProfile
|
||||
{
|
||||
Order = num,
|
||||
Remove = "ADD",
|
||||
RetirementPeriod = retire,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
if (org == null || org.result == null)
|
||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||
|
||||
data.profileId = org.result.profileId;
|
||||
data.prefix = org.result.prefix;
|
||||
data.firstName = org.result.firstName;
|
||||
data.lastName = org.result.lastName;
|
||||
data.citizenId = org.result.citizenId;
|
||||
data.root = org.result.root;
|
||||
data.rootId = org.result.rootId;
|
||||
data.rootShortName = org.result.rootShortName;
|
||||
data.child1 = org.result.child1;
|
||||
data.child1Id = org.result.child1Id;
|
||||
data.child1ShortName = org.result.child1ShortName;
|
||||
data.child2 = org.result.child2;
|
||||
data.child2Id = org.result.child2Id;
|
||||
data.child2ShortName = org.result.child2ShortName;
|
||||
data.child3 = org.result.child3;
|
||||
data.child3Id = org.result.child3Id;
|
||||
data.child3ShortName = org.result.child3ShortName;
|
||||
data.child4 = org.result.child4;
|
||||
data.child4Id = org.result.child4Id;
|
||||
data.child4ShortName = org.result.child4ShortName;
|
||||
data.posMasterNo = org.result.posMasterNo;
|
||||
data.position = org.result.position;
|
||||
data.posTypeId = org.result.posTypeId;
|
||||
data.posTypeName = org.result.posTypeName;
|
||||
data.posTypeRank = org.result.posTypeRank;
|
||||
data.posLevelId = org.result.posLevelId;
|
||||
data.posLevelName = org.result.posLevelName;
|
||||
data.posLevelRank = org.result.posLevelRank;
|
||||
data.posExecutiveId = org.result.posExecutiveId;
|
||||
data.posExecutiveName = org.result.posExecutiveName;
|
||||
data.posNo = org.result.posNo;
|
||||
|
||||
_context.RetirementProfiles.Add(data);
|
||||
await _context.SaveChangesAsync();
|
||||
if (retire.RetirementPeriodHistorys.Count() == 0)
|
||||
{
|
||||
await GenOrderByYear(retire.Id);
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue