Merge branch 'develop' into dev
This commit is contained in:
commit
a7e6995570
7 changed files with 3251 additions and 51 deletions
|
|
@ -493,6 +493,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
};
|
||||
|
||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||
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();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||
periodExam.AuthName = org.result.name == null ? "" : org.result.name;
|
||||
periodExam.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||
}
|
||||
}
|
||||
|
||||
await _context.PeriodExams.AddAsync(periodExam);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
@ -1281,18 +1298,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
r.LastName = workSheet?.Cells[row, 8]?.GetValue<string>() ?? "";
|
||||
r.Gendor = workSheet?.Cells[row, 98]?.GetValue<string>() ?? "";
|
||||
r.National = workSheet?.Cells[row, 9]?.GetValue<string>() ?? "";
|
||||
r.Race = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.Race = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.Religion = workSheet?.Cells[row, 10]?.GetValue<string>() ?? "";
|
||||
r.DateOfBirth = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue;
|
||||
r.CitizenId = workSheet?.Cells[row, 12]?.GetValue<string>() ?? "";
|
||||
r.typeTest = workSheet?.Cells[row, 13]?.GetValue<string>() ?? "";
|
||||
r.Marry = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.Marry = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.Isspecial = "N";
|
||||
r.CitizenCardIssuer = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
|
||||
r.CitizenCardIssuer = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.CitizenCardExpireDate = DateTime.MinValue;//Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
|
||||
r.ApplyDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 87]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 87]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue;
|
||||
r.PositionType = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.PositionLevel = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.PositionType = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.PositionLevel = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
|
||||
r.CreatedAt = DateTime.Now;
|
||||
r.CreatedUserId = UserId ?? "";
|
||||
|
|
@ -1306,11 +1323,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
Degree = workSheet?.Cells[row, 18]?.GetValue<string>() ?? "",
|
||||
Major = workSheet?.Cells[row, 19]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 20]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 19]?.GetValue<string>() ?? "",
|
||||
MajorGroupId = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
MajorGroupName = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
MajorGroupId = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
MajorGroupName = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
University = workSheet?.Cells[row, 21]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 22]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 21]?.GetValue<string>() ?? "",
|
||||
GPA = (double)workSheet?.Cells[row, 26]?.GetValue<double>(),
|
||||
Specialist = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
Specialist = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
HighDegree = workSheet?.Cells[row, 27]?.GetValue<string>() ?? "",
|
||||
BachelorDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 25]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue,
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -1327,8 +1344,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
Occupation = workSheet?.Cells[row, 33]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 34]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 33]?.GetValue<string>() ?? "",
|
||||
Position = workSheet?.Cells[row, 37]?.GetValue<string>() ?? "",
|
||||
Workplace = $"{(workSheet?.Cells[row, 36]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 35]?.GetValue<string>() ?? "")}",
|
||||
Telephone = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
WorkAge = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
Telephone = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
WorkAge = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -1349,7 +1366,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
Province = workSheet?.Cells[row, 56]?.GetValue<string>() ?? "",
|
||||
ZipCode = workSheet?.Cells[row, 57]?.GetValue<string>() ?? "",
|
||||
Telephone = workSheet?.Cells[row, 58]?.GetValue<string>() ?? "",
|
||||
Mobile = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
Mobile = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
Address1 = $"{(workSheet?.Cells[row, 61]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 62]?.GetValue<string>() ?? "")}",
|
||||
Moo1 = workSheet?.Cells[row, 63]?.GetValue<string>() ?? "",
|
||||
Soi1 = workSheet?.Cells[row, 64]?.GetValue<string>() ?? "",
|
||||
|
|
@ -1396,10 +1413,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
// certificate
|
||||
r.Certificates.Add(new DisableCertificate()
|
||||
{
|
||||
CertificateNo = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
Description = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
IssueDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
|
||||
ExpiredDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
|
||||
CertificateNo = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
Description = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
|
||||
IssueDate = DateTime.MinValue,//Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
|
||||
ExpiredDate = DateTime.MinValue,//Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -1594,22 +1611,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
// ใช้ dictionary lookup แทน query DB ทีละรอบ
|
||||
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||
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();
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
||||
recruit.AuthName = org.result.name == null ? "" : org.result.name;
|
||||
recruit.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||
}
|
||||
}
|
||||
|
||||
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>();
|
||||
|
||||
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
|
||||
|
|
@ -1661,9 +1662,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
imported.Scores.Add(r);
|
||||
|
||||
}
|
||||
|
||||
|
||||
row++;
|
||||
|
||||
|
||||
} // end of sheet loop
|
||||
} // end of all file loop
|
||||
}
|
||||
|
|
@ -1760,6 +1761,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
// preload score
|
||||
var score = rec_import.ScoreImport.Scores
|
||||
.Where(s => !string.IsNullOrEmpty(s.ExamId))
|
||||
.GroupBy(x => x.ExamId)
|
||||
.Where(g => g.Count() == 1)
|
||||
.Select(g => g.First())
|
||||
.ToDictionary(s => s.ExamId, s => s);
|
||||
|
||||
// ถ้าไม่มีผลคะแนนสอบคัดเลือกผู้พิการให้จบการทำงาน
|
||||
|
|
@ -1906,19 +1910,19 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
profileID = dr["profileID"].ToString(),
|
||||
prefix = dr["prefix"].ToString(),
|
||||
fullName = dr["fullName"].ToString(),
|
||||
dateOfBirth = dr["dateofbirth"] == null ? "" : Convert.ToDateTime(dr["dateofbirth"]).ToThaiShortDate(),
|
||||
dateOfBirth = dr["dateofbirth"] == null || Convert.ToDateTime(dr["dateofbirth"]) == DateTime.MinValue ? "" : Convert.ToDateTime(dr["dateofbirth"]).ToThaiShortDate(),
|
||||
gender = dr["gender"].ToString(),
|
||||
degree = dr["degree"].ToString(),
|
||||
major = dr["major"].ToString(),
|
||||
majorgroup = dr["majorgroup"].ToString(),
|
||||
certificateNo = dr["certificateno"].ToString(),
|
||||
certificateIssueDate = dr["certificateIssueDate"] == null ? "" : Convert.ToDateTime(dr["certificateIssueDate"]).ToThaiShortDate(),
|
||||
certificateIssueDate = dr["certificateIssueDate"] == null || Convert.ToDateTime(dr["certificateIssueDate"]) == DateTime.MinValue ? "" : Convert.ToDateTime(dr["certificateIssueDate"]).ToThaiShortDate(),
|
||||
ExamScore = dr["score"] == null ? 0 : dr["score"].ToString().ToInteger(),
|
||||
ExamResult = dr["result"].ToString(),
|
||||
ExamAttribute = dr["examAttribute"].ToString(),
|
||||
Remark = dr["remark"].ToString(),
|
||||
IsSpecial = dr["isspecial"].ToString(),
|
||||
applyDate = dr["applydate"] == null ? "" : Convert.ToDateTime(dr["applydate"]).ToThaiShortDate(),
|
||||
applyDate = dr["applydate"] == null || Convert.ToDateTime(dr["applydate"]) == DateTime.MinValue ? "" : Convert.ToDateTime(dr["applydate"]).ToThaiShortDate(),
|
||||
university = dr["university"].ToString(),
|
||||
position_name = dr["position_name"].ToString(),
|
||||
hddPosition = dr["hddPosition"].ToString(),
|
||||
|
|
@ -1930,7 +1934,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
score_year = Convert.ToInt32(dr["score_year"]).ToThaiYear().ToString(),
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data != null && data.Count > 0)
|
||||
|
|
@ -1950,7 +1953,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
cmd.CommandText = sb.ToString();
|
||||
|
||||
|
||||
_context.Database.OpenConnection();
|
||||
MySqlDataAdapter da = new MySqlDataAdapter(cmd as MySqlCommand);
|
||||
DataTable dt = new DataTable();
|
||||
|
|
@ -2027,7 +2029,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
CertificateNo = p.Certificates.Count > 0
|
||||
? p.Certificates.First().CertificateNo ?? ""
|
||||
: "",
|
||||
CertificateIssueDate = p.Certificates.Count > 0
|
||||
CertificateIssueDate = p.Certificates.Count > 0
|
||||
? p.Certificates.First().IssueDate != DateTime.MinValue
|
||||
? p.Certificates.First().IssueDate.ToThaiShortDate()
|
||||
: ""
|
||||
|
|
@ -2333,7 +2335,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
Major = p.Educations.First().Major,
|
||||
University = p.Educations.First().University,
|
||||
PositionName = p.PositionName,
|
||||
ExamName = $"{p.PeriodExam!.Name} ครั้งที่ {p.PeriodExam.Round}/{(p.PeriodExam.Year > 2500 ? p.PeriodExam.Year : (p.PeriodExam.Year+543))}".ToThaiNumber(),
|
||||
ExamName = $"{p.PeriodExam!.Name} ครั้งที่ {p.PeriodExam.Round}/{(p.PeriodExam.Year > 2500 ? p.PeriodExam.Year : (p.PeriodExam.Year + 543))}".ToThaiNumber(),
|
||||
|
||||
ExamCount = _disableService.GetExamCount(p.CitizenId).ToString().ToThaiNumber(),
|
||||
type = p.typeTest == "bangkok" ? "กทม." : p.typeTest == "ocsc" ? "ก.พ." : "",
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
FullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
ExamResult = sr == null ? "" : sr.ExamStatus,
|
||||
EndDate = p.PeriodExam.RegisterEndDate == null ? null : p.PeriodExam.RegisterEndDate.Value.ToThaiFullDate3(),
|
||||
AuthName = "นายณัฐพงศ์ ดิษยบุตร",
|
||||
AuthPosition = "หัวหน้าสำนักงาน ก.ก."
|
||||
AuthName = p.PeriodExam.AuthName,
|
||||
AuthPosition = p.PeriodExam.AuthPosition,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -1007,12 +1007,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
b.Property<DateTime>("ApplyDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("AuthName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("AuthPosition")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<DateTime>("CitizenCardExpireDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
|
|
@ -2229,6 +2223,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
.HasColumnOrder(6)
|
||||
.HasComment("วันเริ่มประกาศ");
|
||||
|
||||
b.Property<string>("AuthName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("AuthPosition")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สำนัก");
|
||||
|
|
|
|||
3134
Migrations/20250915085529_update_table_period_add_authname.Designer.cs
generated
Normal file
3134
Migrations/20250915085529_update_table_period_add_authname.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,62 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class update_table_period_add_authname : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthName",
|
||||
table: "Disables");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthPosition",
|
||||
table: "Disables");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthName",
|
||||
table: "PeriodExams",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthPosition",
|
||||
table: "PeriodExams",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthName",
|
||||
table: "PeriodExams");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AuthPosition",
|
||||
table: "PeriodExams");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthName",
|
||||
table: "Disables",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AuthPosition",
|
||||
table: "Disables",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,8 +80,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models.Disables
|
|||
public string? PositionName { get; set; }//
|
||||
public string? PositionType { get; set; }
|
||||
public string? PositionLevel { get; set; }
|
||||
public string? AuthName { get; set; }
|
||||
public string? AuthPosition { get; set; }
|
||||
// public string? AuthName { get; set; }
|
||||
// public string? AuthPosition { get; set; }
|
||||
|
||||
[Comment("บัญชีสอบ")]
|
||||
public string? HddPosition { get; set; } = string.Empty;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
|
|||
|
||||
[Comment("Ref No1")]
|
||||
public string? RefNo1 { get; set; }
|
||||
public string? AuthName { get; set; }
|
||||
public string? AuthPosition { get; set; }
|
||||
|
||||
[Comment("รายชื่อคนสม้ครในรอบ")]
|
||||
public List<Candidate> Candidate { get; set; } = new List<Candidate>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue