Merge branch 'develop' into working
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m9s

This commit is contained in:
Suphonchai Phoonsawat 2026-05-25 14:20:53 +07:00
commit a16ef7ac55
17 changed files with 21451 additions and 7 deletions

View file

@ -119,6 +119,10 @@ namespace BMA.EHR.Domain.Models.Placement
public string? position { get; set; }
[Comment("ตำแหน่งทางการบริหาร")]
public string? PositionExecutive { get; set; }
[Comment("id ตำแหน่งทางการบริหาร")]
public string? posExecutiveId { get; set; }
[Comment("id ประเภทตำแหน่ง")]
public string? posTypeId { get; set; }
[Comment("ชื่อประเภทตำแหน่ง")]

View file

@ -321,6 +321,10 @@ namespace BMA.EHR.Domain.Models.Placement
public string? positionName { get; set; }
[Comment("ตำแหน่งทางการบริหาร")]
public string? PositionExecutive { get; set; }
[Comment("id ตำแหน่งทางการบริหาร")]
public string? posExecutiveId { get; set; }
[Comment("สายงาน")]
public string? positionField { get; set; }
[Comment("id ประเภทตำแหน่ง")]

View file

@ -132,6 +132,10 @@ namespace BMA.EHR.Domain.Models.Placement
public string? position { get; set; }
[Comment("ตำแหน่งทางการบริหาร")]
public string? PositionExecutive { get; set; }
[Comment("id ตำแหน่งทางการบริหาร")]
public string? posExecutiveId { get; set; }
[Comment("id ประเภทตำแหน่ง")]
public string? posTypeId { get; set; }
[Comment("ชื่อประเภทตำแหน่ง")]

View file

@ -173,6 +173,10 @@ namespace BMA.EHR.Domain.Models.Retirement
public string? position { get; set; }
[Comment("ตำแหน่งทางการบริหาร")]
public string? PositionExecutive { get; set; }
[Comment("id ตำแหน่งทางการบริหาร")]
public string? posExecutiveId { get; set; }
[Comment("id ประเภทตำแหน่ง")]
public string? posTypeId { get; set; }
[Comment("ชื่อประเภทตำแหน่ง")]

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class update_Tables_add_posExecutiveId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "posExecutiveId",
table: "RetirementOthers",
type: "longtext",
nullable: true,
comment: "id ตำแหน่งทางการบริหาร")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posExecutiveId",
table: "PlacementReceives",
type: "longtext",
nullable: true,
comment: "id ตำแหน่งทางการบริหาร")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posExecutiveId",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "id ตำแหน่งทางการบริหาร")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posExecutiveId",
table: "PlacementAppointments",
type: "longtext",
nullable: true,
comment: "id ตำแหน่งทางการบริหาร")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "posExecutiveId",
table: "RetirementOthers");
migrationBuilder.DropColumn(
name: "posExecutiveId",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "posExecutiveId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "posExecutiveId",
table: "PlacementAppointments");
}
}
}

View file

@ -11721,6 +11721,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id revision");
b.Property<string>("posExecutiveId")
.HasColumnType("longtext")
.HasComment("id ตำแหน่งทางการบริหาร");
b.Property<string>("posLevelId")
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง");
@ -13108,6 +13112,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน");
b.Property<string>("posExecutiveId")
.HasColumnType("longtext")
.HasComment("id ตำแหน่งทางการบริหาร");
b.Property<string>("posLevelId")
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง");
@ -13613,6 +13621,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id revision");
b.Property<string>("posExecutiveId")
.HasColumnType("longtext")
.HasComment("id ตำแหน่งทางการบริหาร");
b.Property<string>("posLevelId")
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง");
@ -15803,6 +15815,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("id revision");
b.Property<string>("posExecutiveId")
.HasColumnType("longtext")
.HasComment("id ตำแหน่งทางการบริหาร");
b.Property<string>("posLevelId")
.HasColumnType("longtext")
.HasComment("id ระดับตำแหน่ง");

View file

@ -676,6 +676,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.positionName;
uppdated.PositionExecutive = req.posExecutiveName;
uppdated.posExecutiveId = req.posExecutiveId;
uppdated.positionExecutiveField = req.positionExecutiveField;
uppdated.positionArea = req.positionArea;
uppdated.positionField = req.positionField;
@ -1014,6 +1015,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,
@ -1226,6 +1229,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,
@ -1855,6 +1860,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,
@ -2016,6 +2023,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,

View file

@ -1065,6 +1065,7 @@ namespace BMA.EHR.Placement.Service.Controllers
person.positionId = req.positionId;
person.posMasterNo = req.posMasterNo;
person.positionName = req.positionName;
person.posExecutiveId = req.posExecutiveId;
person.PositionExecutive = req.posExecutiveName;
person.positionExecutiveField = req.positionExecutiveField;
person.positionArea = req.positionArea;
@ -1453,6 +1454,10 @@ namespace BMA.EHR.Placement.Service.Controllers
profile.posTypeName = null;
profile.posLevelId = null;
profile.posLevelName = null;
profile.PositionExecutive = null;
profile.posExecutiveId = null;
profile.positionArea = null;
profile.positionExecutiveField = null;
// profile.PositionLevel = null;
// profile.PositionType = null;
@ -1810,16 +1815,27 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPost("recruit/report/excecute")]
public async Task<ActionResult<ResponseObject>> PostReportExecuteRecruit([FromBody] ReportExecuteRequest req)
{
Console.WriteLine($"[RecruitReportExcecute] Starting execution at {DateTime.Now}");
try
{
Console.WriteLine($"[RecruitReportExcecute] Request received with {req?.refIds?.Length ?? 0} refIds");
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
Console.WriteLine($"[RecruitReportExcecute] Found {placementProfile?.Count ?? 0} placement profiles");
if (placementProfile == null)
{
Console.Error.WriteLine("[RecruitReportExcecute] PlacementProfile is null - returning NotFound");
return NotFound();
}
Console.WriteLine("[RecruitReportExcecute] Building resultData from placement profiles and refIds");
var resultData = (from p in placementProfile
join r in req.refIds
@ -1936,7 +1952,14 @@ namespace BMA.EHR.Placement.Service.Controllers
bodyPosition = new
{
posmasterId = p.posmasterId,
positionId = p.positionId
positionId = p.positionId,
positionName = p.positionName,
positionField = p.positionField,
posTypeId = p.posTypeId,
posLevelId = p.posLevelId,
posExecutiveId = p.posExecutiveId,
positionExecutiveField = p.positionExecutiveField,
positionArea = p.positionArea,
},
bodyMarry = new
{
@ -1965,6 +1988,9 @@ namespace BMA.EHR.Placement.Service.Controllers
},
}).ToList();
Console.WriteLine($"[RecruitReportExcecute] resultData built successfully with {resultData?.Count ?? 0} records");
Console.WriteLine($"[RecruitReportExcecute] Calling external API: {_configuration["API"]}/org/command/excexute/create-officer-profile");
var apiUrl = $"{_configuration["API"]}/org/command/excexute/create-officer-profile";
using (var client = new HttpClient())
{
@ -1976,8 +2002,10 @@ namespace BMA.EHR.Placement.Service.Controllers
data = resultData
});
var _result = await _res.Content.ReadAsStringAsync();
Console.WriteLine($"[RecruitReportExcecute] External API response status: {_res.StatusCode}");
if (_res.IsSuccessStatusCode)
{
Console.WriteLine("[RecruitReportExcecute] External API call successful - updating placement profiles");
placementProfile.ForEach(profile =>
{
profile.PlacementStatus = "DONE";
@ -1991,14 +2019,24 @@ namespace BMA.EHR.Placement.Service.Controllers
profile.templateDoc = req.refIds[0].remark;
}
});
Console.WriteLine($"[RecruitReportExcecute] Saving changes to database for {placementProfile.Count} profiles");
await _context.SaveChangesAsync();
Console.WriteLine("[RecruitReportExcecute] Database save completed successfully");
}
else
{
Console.Error.WriteLine($"[RecruitReportExcecute] External API call failed with status: {_res.StatusCode}");
Console.Error.WriteLine($"[RecruitReportExcecute] Response content: {_result}");
}
}
Console.WriteLine($"[RecruitReportExcecute] Process completed successfully at {DateTime.Now}");
return Success();
}
catch
catch (Exception ex)
{
Console.Error.WriteLine($"[RecruitReportExcecute] Error occurred: {ex.Message}");
Console.Error.WriteLine($"[RecruitReportExcecute] Stack trace: {ex.StackTrace}");
throw;
}
}
@ -2292,7 +2330,14 @@ namespace BMA.EHR.Placement.Service.Controllers
bodyPosition = new
{
posmasterId = p.posmasterId,
positionId = p.positionId
positionId = p.positionId,
positionName = p.positionName,
positionField = p.positionField,
posTypeId = p.posTypeId,
posLevelId = p.posLevelId,
posExecutiveId = p.posExecutiveId,
positionExecutiveField = p.positionExecutiveField,
positionArea = p.positionArea,
},
bodyMarry = new
{
@ -2563,6 +2608,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,
@ -2804,6 +2851,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,
@ -3030,6 +3079,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName,
posmasterId = p.posmasterId,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
commandId = r.commandId,
orgRoot = p.root,
orgChild1 = p.child1,

View file

@ -590,7 +590,7 @@ namespace BMA.EHR.Placement.Service.Controllers
placementReceive.positionAreaOld = org.result.positionArea;
placementReceive.PositionLevelOld = org.result.posLevelName;
placementReceive.PositionTypeOld = org.result.posTypeName;
placementReceive.PositionNumberOld = org.result.nodeShortName + " " + org.result.posMasterNo;
placementReceive.PositionNumberOld = org.result.posNo;
placementReceive.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
(org.result.child3 == null ? "" : org.result.child3 + "\n") +
(org.result.child2 == null ? "" : org.result.child2 + "\n") +
@ -782,6 +782,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.positionName;
uppdated.PositionExecutive = req.posExecutiveName;
uppdated.posExecutiveId = req.posExecutiveId;
uppdated.positionExecutiveField = req.positionExecutiveField;
uppdated.positionArea = req.positionArea;
uppdated.positionField = req.positionField;
@ -1217,7 +1218,14 @@ namespace BMA.EHR.Placement.Service.Controllers
bodyPosition = new
{
posmasterId = p.posmasterId,
positionId = p.positionId
positionId = p.positionId,
positionName = p.position,
positionField = p.positionField,
posTypeId = p.posTypeId,
posLevelId = p.posLevelId,
posExecutiveId = p.posExecutiveId,
positionExecutiveField = p.positionExecutiveField,
positionArea = p.positionArea,
}
}).ToList();

View file

@ -764,7 +764,7 @@ namespace BMA.EHR.Placement.Service.Controllers
placementTransfer.positionAreaOld = org.result.positionArea;
placementTransfer.PositionLevelOld = org.result.posLevelName;
placementTransfer.PositionTypeOld = org.result.posTypeName;
placementTransfer.PositionNumberOld = org.result.nodeShortName + " " + org.result.posMasterNo;
placementTransfer.PositionNumberOld = org.result.posNo;
placementTransfer.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") +
(org.result.child3 == null ? "" : org.result.child3 + "\n") +
(org.result.child2 == null ? "" : org.result.child2 + "\n") +

View file

@ -53,6 +53,7 @@ namespace BMA.EHR.Placement.Service.Requests
public double? Amount { get; set; }
public string? avatarUrl { get; set; }
public bool? isDeputy { get; set; }
public string? posNo { get; set; }
}
}

View file

@ -30,6 +30,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? posLevelName { get; set; }
public string? typeCommand { get; set; }
public string? posExecutiveName { get; set; }
public string? posExecutiveId { get; set; }
public string? positionExecutiveField { get; set; }
public string? positionArea { get; set; }
}

View file

@ -30,6 +30,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? posLevelName { get; set; }
public string? typeCommand { get; set; }
public string? posExecutiveName { get; set; }
public string? posExecutiveId { get; set; }
public string? positionExecutiveField { get; set; }
public string? positionArea { get; set; }
}

View file

@ -39,6 +39,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? posLevelName { get; set; }
public string? typeCommand { get; set; }
public string? posExecutiveName { get; set; }
public string? posExecutiveId { get; set; }
public string? positionExecutiveField { get; set; }
public string? positionArea { get; set; }

View file

@ -569,6 +569,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
uppdated.positionId = req.positionId;
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.positionName;
uppdated.posExecutiveId = req.posExecutiveId;
uppdated.PositionExecutive = req.posExecutiveName;
uppdated.positionExecutiveField = req.positionExecutiveField;
uppdated.positionArea = req.positionArea;
@ -889,6 +890,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
commandCode = r.commandCode,
commandName = r.commandName,
remark = r.remark,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
positionTypeNew = p.posTypeId,
positionLevelNew = p.posLevelId,
positionNameNew = p.position,
@ -1138,6 +1142,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
commandCode = r.commandCode,
commandName = r.commandName,
remark = r.remark,
positionId = p.positionId,
posExecutiveId = p.posExecutiveId,
positionField = p.positionField,
positionTypeNew = p.posTypeId,
positionLevelNew = p.posLevelId,
positionNameNew = p.position,

View file

@ -29,6 +29,7 @@ namespace BMA.EHR.Retirement.Service.Requests
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public string? typeCommand { get; set; }
public string? posExecutiveId { get; set; }
public string? posExecutiveName { get; set; }
public string? positionExecutiveField { get; set; }
public string? positionArea { get; set; }