Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
a09a732ff1
8 changed files with 811 additions and 71 deletions
|
|
@ -6574,6 +6574,76 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-11
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("command11/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportCommand11([FromBody] ReportPersonRequest reqss)
|
||||
{
|
||||
try
|
||||
{
|
||||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
var baseAPI = _configuration["Node:API"];
|
||||
var apiUrl = $"{baseAPI}/report/pass";
|
||||
|
||||
var response = new PassProbationResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassProbationResponse>(result);
|
||||
|
||||
var seq = 1;
|
||||
foreach (var d in response!.data)
|
||||
{
|
||||
var _baseAPI = _configuration["API"];
|
||||
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||
using (var _client = new HttpClient())
|
||||
{
|
||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
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)
|
||||
continue;
|
||||
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||
};
|
||||
seq++;
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-11
|
||||
/// </summary>
|
||||
|
|
@ -6608,6 +6678,76 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-12
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("command12/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportCommand12([FromBody] ReportPersonRequest reqss)
|
||||
{
|
||||
try
|
||||
{
|
||||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
var baseAPI = _configuration["Node:API"];
|
||||
var apiUrl = $"{baseAPI}/report/not-pass";
|
||||
|
||||
var response = new PassProbationResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassProbationResponse>(result);
|
||||
|
||||
var seq = 1;
|
||||
foreach (var d in response!.data)
|
||||
{
|
||||
var _baseAPI = _configuration["API"];
|
||||
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
|
||||
using (var _client = new HttpClient())
|
||||
{
|
||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
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)
|
||||
continue;
|
||||
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
|
||||
Prefix = org.result.prefix == null ? "" : org.result.prefix,
|
||||
FirstName = org.result.firstName == null ? "" : org.result.firstName,
|
||||
LastName = org.result.lastName == null ? "" : org.result.lastName,
|
||||
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
|
||||
};
|
||||
seq++;
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-12
|
||||
/// </summary>
|
||||
|
|
@ -6642,6 +6782,30 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-19
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("command19/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportCommand19([FromBody] ReportPersonRequest req)
|
||||
{
|
||||
var placementProfiles = await _context.RetirementDischarges
|
||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var placementProfile in placementProfiles)
|
||||
{
|
||||
// update placementstatus
|
||||
placementProfile.Status = "REPORT";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-19
|
||||
/// </summary>
|
||||
|
|
@ -6676,6 +6840,30 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-20
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("command20/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportcommand20([FromBody] ReportPersonRequest req)
|
||||
{
|
||||
var placementProfiles = await _context.RetirementExpulsions
|
||||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var placementProfile in placementProfiles)
|
||||
{
|
||||
// update placementstatus
|
||||
placementProfile.Status = "REPORT";
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-20
|
||||
/// </summary>
|
||||
|
|
@ -6710,6 +6898,68 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-21
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("command21/report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostReportcommand21([FromBody] ReportPersonRequest req_)
|
||||
{
|
||||
try
|
||||
{
|
||||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/org/profile-employee/report-temp";
|
||||
|
||||
var response = new PassSalaryResponse();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.SendAsync(req);
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
|
||||
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
|
||||
|
||||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = d.citizenId,
|
||||
Prefix = d.prefix == null ? "" : d.prefix,
|
||||
FirstName = d.firstName == null ? "" : d.firstName,
|
||||
LastName = d.lastName == null ? "" : d.lastName,
|
||||
RefPlacementProfileId = d.id,
|
||||
RefDisciplineId = d.id,
|
||||
Organization = d.organization,
|
||||
PositionName = d.positionName,
|
||||
PositionLevel = d.positionLevel,
|
||||
PositionType = d.positionType,
|
||||
PositionNumber = d.positionNumber,
|
||||
BirthDate = d.birthDate,
|
||||
};
|
||||
seq++;
|
||||
|
||||
resultData.Add(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
return Success(resultData);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ออกคำสั่ง C-PM-21
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue