api get รายชื่อผู้เกษียณอายุราชการ
Some checks failed
release-dev / release-dev (push) Failing after 10s
Some checks failed
release-dev / release-dev (push) Failing after 10s
This commit is contained in:
parent
f81806f59f
commit
59edf6a716
3 changed files with 67 additions and 72 deletions
|
|
@ -105,43 +105,49 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
|
|
||||||
//เกษียณอายุราชการ
|
//เกษียณอายุราชการ
|
||||||
public async Task ExecuteRetirement()
|
//public async Task ExecuteRetirement()
|
||||||
{
|
//{
|
||||||
var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
// var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||||
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||||
.Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
// .Where(x => x.Year == DateTime.Now.Year)
|
||||||
.Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
|
|
||||||
var body = retirePeriodOfficer.RetirementProfiles
|
// if (retirePeriodOfficer == null)
|
||||||
.Select(x => new {
|
// return;
|
||||||
profileId = x.profileId,
|
|
||||||
//lastUpdateUserId = UserId,
|
|
||||||
//lastUpdateFullName = FullName,
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
//ข้าราชการ
|
// var body = new
|
||||||
//var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
// {
|
||||||
var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
// data = retirePeriodOfficer.RetirementRawProfiles
|
||||||
using (var client = new HttpClient())
|
// .Select(x => new
|
||||||
{
|
// {
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
// profileId = x.profileId
|
||||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
// })
|
||||||
var jsonBody = JsonConvert.SerializeObject(body);
|
// .ToList()
|
||||||
var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
// };
|
||||||
var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
|
||||||
{
|
|
||||||
Content = content
|
|
||||||
};
|
|
||||||
var response = await client.SendAsync(_req);
|
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
|
||||||
if (!response.IsSuccessStatusCode)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
// //ข้าราชการ
|
||||||
}
|
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||||
}
|
// using (var client = new HttpClient())
|
||||||
|
// {
|
||||||
|
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
|
||||||
|
// var jsonBody = JsonConvert.SerializeObject(body);
|
||||||
|
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
|
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||||
|
// {
|
||||||
|
// Content = content
|
||||||
|
// };
|
||||||
|
// var response = await client.SendAsync(_req);
|
||||||
|
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||||
|
// if (!response.IsSuccessStatusCode)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
public void TestMethod()
|
public void TestMethod()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1999,44 +1999,34 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//เกษียณอายุราชการ
|
/// <summary>
|
||||||
//public async Task ExecuteRetirement()
|
/// เกษียณอายุราชการ
|
||||||
//{
|
/// </summary>
|
||||||
// var retirePeriodOfficer = await _context.RetirementPeriods
|
/// <param name="type">ประเภทUser(officer,employee)(ตัวใหญ่หรือเล็กก็ได้)</param>
|
||||||
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
/// <param name="year">ปีงบประมาณ(ค.ศ.)</param>
|
||||||
// .Where(x => x.Year == /*DateTime.Now.Year*/2026)
|
/// <returns></returns>
|
||||||
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
/// <response code="200"></response>
|
||||||
// .FirstOrDefaultAsync();
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("update-status/{type}/{year}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> UpdateStatusRetirement(string type, int year)
|
||||||
|
{
|
||||||
|
var retirePeriodOfficer = await _context.RetirementPeriods
|
||||||
|
.Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||||
|
.Where(x => x.Year == year && x.Type.Trim().ToUpper().Contains(type))
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
// var body = retirePeriodOfficer.RetirementProfiles
|
if (retirePeriodOfficer == null)
|
||||||
// .Select(x => new
|
return Error("ไม่พบรอบประกาศเกษียณอายุราชการ");
|
||||||
// {
|
|
||||||
// profileId = x.profileId,
|
|
||||||
// //lastUpdateUserId = UserId,
|
|
||||||
// //lastUpdateFullName = FullName,
|
|
||||||
// })
|
|
||||||
// .ToList();
|
|
||||||
|
|
||||||
// //ข้าราชการ
|
var data = retirePeriodOfficer.RetirementRawProfiles
|
||||||
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
.Select(x => new {
|
||||||
// var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
|
profileId = x.profileId
|
||||||
// using (var client = new HttpClient())
|
})
|
||||||
// {
|
.ToList();
|
||||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
|
||||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
|
||||||
// var jsonBody = JsonConvert.SerializeObject(body);
|
|
||||||
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
|
||||||
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
|
||||||
// {
|
|
||||||
// Content = content
|
|
||||||
// };
|
|
||||||
// var response = await client.SendAsync(_req);
|
|
||||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
|
||||||
// if (!response.IsSuccessStatusCode)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
return Success(data);
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,9 +173,8 @@ var app = builder.Build();
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบปลดออก", Job.FromExpression<RetirementRepository>(x => x.NotifyDischarge()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบไล่ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyExpulsion()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("แจ้งเตือนระบบให้ออก", Job.FromExpression<RetirementRepository>(x => x.NotifyOut()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||||
manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementRepository>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
//manager.AddOrUpdate("อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementRepository>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
||||||
manager.AddOrUpdate("ทดสอบ", Job.FromExpression<RetirementRepository>(x => x.TestMethod()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
manager.AddOrUpdate("ทดสอบ", Job.FromExpression<RetirementRepository>(x => x.TestMethod()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
||||||
//manager.AddOrUpdate("Test อัพเดทสถานะเกษียณอายุราชการ", Job.FromExpression<RetirementController>(x => x.ExecuteRetirement()), Cron.Yearly(10, 1, 0, 0), TimeZoneInfo.Local);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply migrations
|
// apply migrations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue