no message

This commit is contained in:
kittapath 2024-10-04 18:16:31 +07:00
parent dd170565b5
commit 345de97657

View file

@ -6782,150 +6782,6 @@ 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.AsQueryable()
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "REPORT");
await _context.SaveChangesAsync();
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/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand19Execute([FromBody] ReportExecuteRequest req)
{
// create new profile
foreach (var recv in req.refIds)
{
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/profile/command19/{recv.refId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
var dataSend = req.refIds.Select(x => new
{
Id = x.refId,
CommandAffectDate = x.commandAffectDate,
CommandNo = x.commandNo,
CommandYear = x.commandYear.ToThaiYear(),
Detail = "คำสั่งลงโทษ ปลดออกจากราชการ"
});
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(_apiUrl, new { result = dataSend });
var result = await res.Content.ReadAsStringAsync();
}
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.AsQueryable()
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "REPORT");
await _context.SaveChangesAsync();
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/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand20Execute([FromBody] ReportExecuteRequest req)
{
// create new profile
foreach (var recv in req.refIds)
{
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/profile/command20/{recv.refId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
profileId = recv.refId,
date = recv.commandAffectDate,
refCommandNo = $"{recv.commandNo}/{recv.commandYear.ToThaiYear()}",
salaryRef = recv.templateDoc,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
var dataSend = req.refIds.Select(x => new
{
Id = x.refId,
CommandAffectDate = x.commandAffectDate,
CommandNo = x.commandNo,
CommandYear = x.commandYear.ToThaiYear(),
detail = "คำสั่งลงโทษ ไล่ออกจากราชการ"
});
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/discipline/result/report/up/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(_apiUrl, new { result = dataSend });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-21
/// </summary>
@ -7020,445 +6876,6 @@ namespace BMA.EHR.Command.Service.Controllers
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-33
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command33/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand33([FromBody] ReportPersonRequest req)
{
try
{
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/33/{id}";
// 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,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-33 เลื่อนเงินเดือนและให้ข้าราชการกรุงเทพมหานครสามัญ ได้รับเงินเดือนสูงกว่าขั้นสูงของตำแหน่งที่ได้รับแต่งตั้ง
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command33/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand33Execute([FromBody] ReportExecuteRequest req)
{
var data = req.refIds.Select(x => new
{
Id = x.refId,
refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
templateDoc = x.templateDoc,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/salary/report/command/33/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-34
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command34/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand34([FromBody] ReportPersonRequest req)
{
try
{
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/34/{id}";
// 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,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-34 ให้ข้าราชการกรุงเทพมหานครสามัญได้รับค่าตอบแทนพิเศษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command34/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand34Execute([FromBody] ReportExecuteRequest req)
{
var data = req.refIds.Select(x => new
{
Id = x.refId,
refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
templateDoc = x.templateDoc,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/salary/report/command/34/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-35
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command35/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand35([FromBody] ReportPersonRequest req)
{
try
{
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/35/{id}";
// 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,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-35 เลื่อนเงินเดือนและให้ข้าราชการกรุงเทพมหานครสามัญที่เกษียณอายุราชการ ในสิ้นปีงบประมาณ พ.ศ.……… ได้รับเงินเดือนสูงกว่าขั้นสูงของตำแหน่งที่ได้รับแต่งตั้ง
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command35/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand35Execute([FromBody] ReportExecuteRequest req)
{
var data = req.refIds.Select(x => new
{
Id = x.refId,
refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
templateDoc = x.templateDoc,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/salary/report/command/35/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-36
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command36/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand36([FromBody] ReportPersonRequest req)
{
try
{
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/36/{id}";
// 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,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-36 เลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command36/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand36Execute([FromBody] ReportExecuteRequest req)
{
var data = req.refIds.Select(x => new
{
Id = x.refId,
refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
templateDoc = x.templateDoc,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/salary/report/command/36/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-37
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command37/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand37([FromBody] ReportPersonRequest req)
{
try
{
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/37/{id}";
// 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,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// ออกคำสั่ง C-PM-37 ให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command37/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportCommand37Execute([FromBody] ReportExecuteRequest req)
{
var data = req.refIds.Select(x => new
{
refCommandNo = $"{x.commandNo}/{x.commandYear.ToThaiYear()}",
templateDoc = x.templateDoc,
});
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/salary/report/command/37/resume";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
var result = await res.Content.ReadAsStringAsync();
}
return Success();
}
/// <summary>
/// ส่งรายชื่อออกคำสั่ง C-PM-38
/// </summary>