refid ส่งกลับ
This commit is contained in:
parent
b1d198133f
commit
6dd057516f
5 changed files with 20143 additions and 1 deletions
|
|
@ -101,5 +101,7 @@ namespace BMA.EHR.Domain.Models.Placement
|
|||
public string? posLevelOldId { get; set; }
|
||||
[Comment("ชื่อระดับตำแหน่ง old")]
|
||||
public string? posLevelNameOld { get; set; }
|
||||
[Comment("Id อ้างอิงช่วยราช")]
|
||||
public Guid? refId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20076
BMA.EHR.Infrastructure/Migrations/20250401035607_update_table_placementRepatriation_add_refId.Designer.cs
generated
Normal file
20076
BMA.EHR.Infrastructure/Migrations/20250401035607_update_table_placementRepatriation_add_refId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class update_table_placementRepatriation_add_refId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "refId",
|
||||
table: "PlacementRepatriations",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
comment: "Id อ้างอิงช่วยราช",
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "refId",
|
||||
table: "PlacementRepatriations");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -14083,6 +14083,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("profile Id");
|
||||
|
||||
b.Property<Guid?>("refId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("Id อ้างอิงช่วยราช");
|
||||
|
||||
b.Property<string>("rootDnaOldId")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id หน่วยงาน rootDna old");
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
[HttpPost()]
|
||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
||||
{
|
||||
|
||||
|
||||
var placementOfficer = await _context.PlacementOfficers
|
||||
.Where(x => x.Id == (req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000")))
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
@ -230,6 +230,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
var placementRepatriation = new PlacementRepatriation
|
||||
{
|
||||
Organization = placementOfficer.Organization,
|
||||
refId = req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
// Reason = placementOfficer.Reason,
|
||||
Date = placementOfficer.DateStart,
|
||||
DateRepatriation = placementOfficer.DateEnd,
|
||||
|
|
@ -298,6 +299,20 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
(org.result.root == null ? "" : org.result.root);
|
||||
placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + (placementRepatriation.PositionExecutiveOld == null ? "" : placementRepatriation.PositionExecutiveOld + "\n") + placementRepatriation.OrganizationOld;
|
||||
}
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/profile/assistance/status";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
status = "DONE"
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
await _context.PlacementRepatriations.AddAsync(placementRepatriation);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
@ -391,6 +406,20 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (deleted == null)
|
||||
return NotFound();
|
||||
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/profile/assistance/status";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = deleted.refId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
status = "PENDING"
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
_context.PlacementRepatriations.Remove(deleted);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue