Merge branch 'develop' into adiDev
This commit is contained in:
commit
aeb2ceea6f
13 changed files with 332 additions and 64 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -1216,8 +1217,15 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
},
|
||||
bodyPosition = new
|
||||
{
|
||||
posmasterId = p.posmasterId,
|
||||
positionId = p.positionId
|
||||
posmasterId = p.posmasterId,
|
||||
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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue