Merge branch 'develop'
All checks were successful
Build & Deploy Placement Service / build (push) Successful in 1m13s

This commit is contained in:
harid 2025-11-21 15:00:19 +07:00
commit 287c11dfd5
2 changed files with 107 additions and 77 deletions

View file

@ -83,84 +83,114 @@ namespace BMA.EHR.Application.Repositories.Reports
sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน "); sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน ");
sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน "); sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน ");
} }
var data = await _dbExamContext.Set<Candidate>().AsQueryable() var candidate = await _dbExamContext.Set<Candidate>()
.Where(x => x.Id == id) .Where(x => x.Id == id)
.Select(p => new .Include(p => p.PeriodExam)
.Include(p => p.Educations)
.Include(p => p.PositionExam)
.Include(p => p.ProfileImg)
.FirstOrDefaultAsync();
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
// แปลง EditorConfirm เป็น List<string
var editorConfirmLists = /*string.IsNullOrEmpty(candidate.PeriodExam?.EditorConfirm)
? */new List<string>
{ {
p.Id, "1. ข้าพเจ้าขอให้คำรับรองว่า ข้อความดังกล่าวข้างต้นเป็นจริงทุกประการ และข้าพเจ้ามีคุณสมบัติทั่วไปและไม่มีลักษณะต้องห้ามตามมาตรา 43 แห่งพระราชบัญญัติระเบียบข้าราชการกรุงเทพมหานครและบุคลากรกรุงเทพมหานคร พ.ศ. 2554 และมีคุณสมบัติเฉพาะสำหรับตำแหน่งที่สมัครตรงตามประกาศรับสมัคร",
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id, "2. กรณีข้าพเจ้ามีลักษณะต้องห้าม ตามมาตรา 43 ข. แห่งพระราชบัญญัติระเบียบข้าราชการกรุงเทพมหานครและบุคลากรกรุงเทพมหานคร พ.ศ. 2554 และประสงค์จะยื่นคำขอยกเว้นเข้ารับราชการฯ ต่อสำนักงาน ก.ก. ตามระเบียบ ก.ก. ว่าด้วยการยกเว้นให้ผู้มีลักษณะต้องห้ามเข้ารับราชการเป็นข้าราชการกรุงเทพมหานคร พ.ศ. 2556 ตามมติ ก.ก. ครั้งที่ 7/2556 เมื่อวันที่ 15 สิงหาคม 2556 ข้าพเจ้าจะยื่นคำขอยกเว้นฯ ภายในวันปิดรับสมัคร ทั้งนี้ หากยื่นภายหลังกำหนด สำนักงาน ก.ก. จะไม่รับคำขอดังกล่าว",
ExamIdenNumber = p.ExamIdenNumber == null ? "-" : p.ExamIdenNumber, "3. ข้าพเจ้าจะยื่นหลักฐานและเอกสารที่แสดงว่า เป็นผู้มีคุณสมบัติทั่วไปและมีคุณสมบัติเฉพาะสำหรับตำแหน่งที่สมัครตรงตามประกาศรับสมัครภายในระยะเวลาที่กำหนดตามประกาศฯ หากมีการตรวจสอบหลักฐานและเอกสาร และหรือคุณวุฒิการศึกษาของข้าพเจ้าในภายหลังปรากฏว่าข้าพเจ้ามีคุณสมบัติไม่ตรงหรือมีลักษณะต้องห้ามตามประกาศรับสมัครหรือไม่ได้รับการยกเว้น ให้ถือว่า ข้าพเจ้าเป็นผู้ขาดคุณสมบัติในการสมัครครั้งนี้มาตั้งแต่ต้น และไม่มีสิทธิได้รับการบรรจุและแต่งตั้งให้ดำรงตำแหน่ง และข้าพเจ้าจะไม่มีสิทธิเรียกร้องใดๆ ทั้งสิ้น และหากข้าพเจ้าจงใจกรอกข้อความอันเป็นเท็จ อาจมีความผิดทางอาญาฐานแจ้งความเท็จต่อเจ้าพนักงาน ตามประมวลกฎหมายอาญา มาตรา 137",
PositionName = p.PositionExam == null ? "-" : p.PositionExam.PositionName, "4. ข้าพเจ้าได้ศึกษาและทำความเข้าใจพระราชบัญญัติคุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562 ตลอดจนประกาศและระเบียบที่เกี่ยวข้องโดยละเอียดครบถ้วนแล้ว ข้าพเจ้าขอแสดงความยินยอมให้หน่วยงานหรือบุคคลที่เกี่ยวข้องกับการดำเนินการสรรหา สามารถเก็บ รวบรวม ใช้ และเปิดเผยข้อมูลส่วนบุคคลที่เกี่ยวข้องกับข้าพเจ้า เพื่อประโยชน์ของทางราชการตามกฎหมายที่เกี่ยวข้อง",
PositionLevelName = p.PositionExam == null ? "-" : p.PositionExam.PositionLevelName, "5. ข้าพเจ้ารับทราบว่า การส่งใบสมัครคัดเลือกฯ พร้อมเอกสารนี้ ยังไม่ได้รับการตรวจสอบคุณสมบัติตามหลักเกณฑ์ ประกาศรับสมัครคัดเลือก และเงื่อนไขต่างๆ โดยจะได้รับการตรวจสอบคุณสมบัติเมื่อเป็นผู้สอบผ่านข้อเขียนภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่งแล้วเท่านั้น"
PeriodExamName = p.PeriodExam == null ? "-" : p.PeriodExam.Name, }
PeriodExamRound = p.PeriodExam == null ? "-" : p.PeriodExam.Round.ToString(), /*: Regex.Matches(
PeriodExamYear = p.PeriodExam == null ? "-" : (p.PeriodExam.Year + 543).ToString(), Regex.Replace(candidate.PeriodExam.EditorConfirm, "<.*?>", string.Empty)
.Replace("&nbsp;", " ")
.Trim(),
@"(?:[1-9]|[1-9][0-9]|100)\.\s*.*?(?=(?:[1-9]|[1-9][0-9]|100)\.|$)",
RegexOptions.Singleline
)
.Cast<Match>()
.Select(m => m.Groups[1].Value.Trim())
.ToList()*/;
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}", return new
Religion = p.ReligionName == null ? "-" : p.ReligionName, {
Nationality = p.Nationality == null ? "-" : p.Nationality, candidate.Id,
DateOfBirth = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.ToThaiFullDate2(), AvatarId = candidate.ProfileImg?.Id ?? Guid.Empty,
Age = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0), ExamIdenNumber = candidate.ExamIdenNumber ?? "-",
CitizenId = p.CitizenId == null ? "-" : p.CitizenId, PositionName = candidate.PositionExam?.PositionName ?? "-",
PositionLevelName = candidate.PositionExam?.PositionLevelName ?? "-",
PeriodExamName = candidate.PeriodExam?.Name ?? "-",
PeriodExamRound = candidate.PeriodExam?.Round.ToString() ?? "-",
PeriodExamYear = candidate.PeriodExam != null ? (candidate.PeriodExam.Year + 543).ToString() : "-",
FullName = $"{candidate.PrefixName}{candidate.FirstName} {candidate.LastName}",
Religion = candidate.ReligionName ?? "-",
Nationality = candidate.Nationality ?? "-",
DateOfBirth = candidate.DateOfBirth?.ToThaiFullDate2() ?? "-",
Age = candidate.DateOfBirth?.CalculateAgeStrV2(0, 0) ?? "-",
CitizenId = candidate.CitizenId ?? "-",
EducationLevelExamName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelExamName, EducationLevelExamName = candidate.Educations.FirstOrDefault()?.EducationLevelExamName ?? "-",
EducationName = p.Educations.FirstOrDefault() == null ? null : (p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาตรี" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาโท" || p.Educations.FirstOrDefault().EducationLevelExamName == "ปริญญาเอก" ? p.Educations.FirstOrDefault().EducationName : null), EducationName = (candidate.Educations.FirstOrDefault()?.EducationLevelExamName is "ปริญญาตรี" or "ปริญญาโท" or "ปริญญาเอก")
EducationMajor = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationMajor, ? candidate.Educations.FirstOrDefault()?.EducationName
EducationLocation = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLocation, : null,
EducationEndDate = p.Educations.FirstOrDefault() == null || p.Educations.FirstOrDefault().EducationEndDate == null ? "-" : p.Educations.FirstOrDefault().EducationEndDate.Value.ToThaiFullDate2(), EducationMajor = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-",
EducationScores = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationScores, EducationLocation = candidate.Educations.FirstOrDefault()?.EducationLocation ?? "-",
EducationType = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationType, EducationEndDate = candidate.Educations.FirstOrDefault()?.EducationEndDate?.ToThaiFullDate2() ?? "-",
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelHighName, EducationScores = candidate.Educations.FirstOrDefault()?.EducationScores ?? "-",
EducationType = candidate.Educations.FirstOrDefault()?.EducationType ?? "-",
EducationLevelHighName = candidate.Educations.FirstOrDefault()?.EducationLevelHighName ?? "-",
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-")), OccupationPositionType = candidate.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" :
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition, candidate.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" :
OccupationSalary = p.OccupationSalary == null ? "-" : (p.OccupationSalary.Value % 1 == 0 ? p.OccupationSalary.Value.ToString("N0") : p.OccupationSalary.Value.ToString("N2")), candidate.OccupationPositionType == "prem" ? "ลูกจ้างประจำ" : "-",
OccupationGroup = p.OccupationGroup == null ? "-" : p.OccupationGroup, OccupationPosition = candidate.OccupationPosition ?? "-",
OccupationPile = p.OccupationPile == null ? "-" : p.OccupationPile, OccupationSalary = candidate.OccupationSalary.HasValue
OccupationOrg = p.OccupationOrg == null ? "-" : p.OccupationOrg, ? (candidate.OccupationSalary.Value % 1 == 0
OccupationTelephone = p.OccupationTelephone == null ? "-" : p.OccupationTelephone, ? candidate.OccupationSalary.Value.ToString("N0")
: candidate.OccupationSalary.Value.ToString("N2"))
: "-",
OccupationGroup = candidate.OccupationGroup ?? "-",
OccupationPile = candidate.OccupationPile ?? "-",
OccupationOrg = candidate.OccupationOrg ?? "-",
OccupationTelephone = candidate.OccupationTelephone ?? "-",
CareersTotal = sb.ToString(), CareersTotal = sb.ToString(),
RegistAddress = p.RegistAddress == null ? "-" : p.RegistAddress, RegistAddress = candidate.RegistAddress ?? "-",
RegistProvinceName = p.RegistProvinceName == null ? "-" : p.RegistProvinceName, RegistProvinceName = candidate.RegistProvinceName ?? "-",
RegistDistrictName = p.RegistDistrictName == null ? "-" : p.RegistDistrictName, RegistDistrictName = candidate.RegistDistrictName ?? "-",
RegistSubDistrictName = p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName, RegistSubDistrictName = candidate.RegistSubDistrictName ?? "-",
RegistZipCode = p.RegistZipCode == null ? "-" : p.RegistZipCode, RegistZipCode = candidate.RegistZipCode ?? "-",
CurrentAddress = p.CurrentAddress == null ? (p.RegistAddress == null ? "-" : p.RegistAddress) : p.CurrentAddress, CurrentAddress = candidate.CurrentAddress ?? candidate.RegistAddress ?? "-",
CurrentProvinceName = p.CurrentProvinceName == null ? (p.RegistProvinceName == null ? "-" : p.RegistProvinceName) : p.CurrentProvinceName, CurrentProvinceName = candidate.CurrentProvinceName ?? candidate.RegistProvinceName ?? "-",
CurrentDistrictName = p.CurrentDistrictName == null ? (p.RegistDistrictName == null ? "-" : p.RegistDistrictName) : p.CurrentDistrictName, CurrentDistrictName = candidate.CurrentDistrictName ?? candidate.RegistDistrictName ?? "-",
CurrentSubDistrictName = p.CurrentSubDistrictName == null ? (p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName) : p.CurrentSubDistrictName, CurrentSubDistrictName = candidate.CurrentSubDistrictName ?? candidate.RegistSubDistrictName ?? "-",
CurrentZipCode = p.CurrentZipCode == null ? (p.RegistZipCode == null ? "-" : p.RegistZipCode) : p.CurrentZipCode, CurrentZipCode = candidate.CurrentZipCode ?? candidate.RegistZipCode ?? "-",
Telephone = p.Telephone == null ? "-" : p.Telephone, Telephone = candidate.Telephone ?? "-",
Email = p.Email == null ? "-" : p.Email, Email = candidate.Email ?? "-",
ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}", ContactFullName = $"{candidate.ContactPrefixName}{candidate.ContactFirstname} {candidate.ContactLastname}",
ContactRelations = p.ContactRelations == null ? "-" : p.ContactRelations, ContactRelations = candidate.ContactRelations ?? "-",
ContactTel = p.ContactTel == null ? "-" : p.ContactTel, ContactTel = candidate.ContactTel ?? "-",
RegisterDate = p.RegisterDate == null ? "-" : p.RegisterDate.Value.ToThaiFullDate(), RegisterDate = candidate.RegisterDate?.ToThaiFullDate() ?? "-",
IsBachelors = p.PositionExam != null && !string.IsNullOrEmpty(p.PositionExam.EducationLevel) && p.PositionExam.EducationLevel.Trim().ToUpper() == "BACHELOR" IsBachelors = candidate.PositionExam != null && !string.IsNullOrEmpty(candidate.PositionExam.EducationLevel) && candidate.PositionExam.EducationLevel.Trim().ToUpper() == "BACHELOR"
? new List<object> { ? new List<object>
$"ชื่อปริญญา {(p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationLevelExamName)}", {
$"สาขาวิชา/วิชาเอก {(p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationMajor)}" new { label = "ชื่อปริญญา", value = candidate.Educations.FirstOrDefault()?.EducationName ?? "-" },
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
} }
: new List<object> { : new List<object>
$"สาขาวิชา/วิชาเอก {(p.Educations.FirstOrDefault() == null ? "-" : p.Educations.FirstOrDefault().EducationMajor)}" {
new { label = "สาขาวิชา/วิชาเอก", value = candidate.Educations.FirstOrDefault()?.EducationMajor ?? "-" }
}, },
EditorConfirm = p.PeriodExam == null || p.PeriodExam.EditorConfirm == null
? "1. ข้าพเจ้าขอให้คำรับรองว่า ข้อความดังกล่าวข้างต้นเป็นจริงทุกประการ และข้าพเจ้ามีคุณสมบัติทั่วไปและไม่มีลักษณะต้องห้ามตามมาตรา 43 แห่งพระราชบัญญัติระเบียบข้าราชการกรุงเทพมหานครและบุคลากรกรุงเทพมหานคร พ.ศ. 2554 และมีคุณสมบัติเฉพาะสำหรับตำแหน่งที่สมัครตรงตามประกาศรับสมัคร\r\n" EditorConfirms = editorConfirmLists
+ "2. กรณีข้าพเจ้ามีลักษณะต้องห้าม ตามมาตรา 43 ข. แห่งพระราชบัญญัติระเบียบข้าราชการกรุงเทพมหานครและบุคลากรกรุงเทพมหานคร พ.ศ. 2554 และประสงค์จะยื่นคำขอยกเว้นเข้ารับราชการฯ ต่อสำนักงาน ก.ก. ตามระเบียบ ก.ก. ว่าด้วยการยกเว้นให้ผู้มีลักษณะต้องห้ามเข้ารับราชการเป็นข้าราชการกรุงเทพมหานคร พ.ศ. 2556 ตามมติ ก.ก. ครั้งที่ 7/2556 เมื่อวันที่ 15 สิงหาคม 2556 ข้าพเจ้าจะยื่นคำขอยกเว้นฯ ภายในวันปิดรับสมัคร ทั้งนี้ หากยื่นภายหลังกำหนด สำนักงาน ก.ก. จะไม่รับคำขอดังกล่าว\r\n" };
+ "3. ข้าพเจ้าจะยื่นหลักฐานและเอกสารที่แสดงว่า เป็นผู้มีคุณสมบัติทั่วไปและมีคุณสมบัติเฉพาะสำหรับตำแหน่งที่สมัครตรงตามประกาศรับสมัครภายในระยะเวลาที่กำหนดตามประกาศฯ หากมีการตรวจสอบหลักฐานและเอกสาร และหรือคุณวุฒิการศึกษาของข้าพเจ้าในภายหลังปรากฏว่าข้าพเจ้ามีคุณสมบัติไม่ตรงหรือมีลักษณะต้องห้ามตามประกาศรับสมัครหรือไม่ได้รับการยกเว้น ให้ถือว่า ข้าพเจ้าเป็นผู้ขาดคุณสมบัติในการสมัครครั้งนี้มาตั้งแต่ต้น และไม่มีสิทธิได้รับการบรรจุและแต่งตั้งให้ดำรงตำแหน่ง และข้าพเจ้าจะไม่มีสิทธิเรียกร้องใดๆ ทั้งสิ้น และหากข้าพเจ้าจงใจกรอกข้อความอันเป็นเท็จ อาจมีความผิดทางอาญาฐานแจ้งความเท็จต่อเจ้าพนักงาน ตามประมวลกฎหมายอาญา มาตรา 137\r\n"
+ "4. ข้าพเจ้าได้ศึกษาและทำความเข้าใจพระราชบัญญัติคุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562 ตลอดจนประกาศและระเบียบที่เกี่ยวข้องโดยละเอียดครบถ้วนแล้ว ข้าพเจ้าขอแสดงความยินยอมให้หน่วยงานหรือบุคคลที่เกี่ยวข้องกับการดำเนินการสรรหา สามารถเก็บ รวบรวม ใช้ และเปิดเผยข้อมูลส่วนบุคคลที่เกี่ยวข้องกับข้าพเจ้า เพื่อประโยชน์ของทางราชการตามกฎหมายที่เกี่ยวข้อง\r\n"
+ "5. ข้าพเจ้ารับทราบว่า การส่งใบสมัครคัดเลือกฯ พร้อมเอกสารนี้ ยังไม่ได้รับการตรวจสอบคุณสมบัติตามหลักเกณฑ์ ประกาศรับสมัครคัดเลือก และเงื่อนไขต่างๆ โดยจะได้รับการตรวจสอบคุณสมบัติเมื่อเป็นผู้สอบผ่านข้อเขียนภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่งแล้วเท่านั้น"
: Regex.Replace(Regex.Match(p.PeriodExam.EditorConfirm, @"1\..*", RegexOptions.Singleline).Value,"<.*?>", string.Empty).Replace("&nbsp;", " ").Trim(),
})
.FirstOrDefaultAsync();
if (data == null)
throw new Exception(GlobalMessages.CandidateNotFound);
return data;
} }
public async Task<dynamic> GetExamCareerCandidateAsync(Guid id) public async Task<dynamic> GetExamCareerCandidateAsync(Guid id)
{ {

View file

@ -3541,7 +3541,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Url = picContent ?? "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg", Url = picContent ?? "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg",
Careers = careers, Careers = careers,
IsBachelors = candidate.GetType().GetProperty("IsBachelors").GetValue(candidate), IsBachelors = candidate.GetType().GetProperty("IsBachelors").GetValue(candidate),
EditorConfirm = candidate.GetType().GetProperty("EditorConfirm").GetValue(candidate) EditorConfirms = candidate.GetType().GetProperty("EditorConfirms").GetValue(candidate)
}; };
var data = new var data = new